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 | 6b9eb17ea034a898a7bb9163fbd50614 | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes |
import java.util.*;
public class Nyc {
static Long swap(Long a, Long b) {
return a;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
HashMap<Long, Long> map = new HashMap<Long, Long>();
int q = sc.nextInt();
while (q-- > 0) {
... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | fdd77debcfd64fb4c6249ec513bb638f | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes |
import java.util.*;
public class Nyc {
static Long swap(Long a, Long b) {
return a;
}
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
HashMap<Long, Long> map = new HashMap<>();
int q = sc.nextInt();
while (q-- > 0) {
int opt... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | 7ab7d8119053db9c2cc4fd77b933661a | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes | /**
* Created by Bakytzhan_Manaspayev on 8/2/2016.
*/
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | 2824bf0627667aa4ccb22b00f3f2619a | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes | import java.util.*;
public class C {
static HashMap<Long,Long> hm;
public static void main(String[] args) {
Scanner qwe = new Scanner(System.in);
hm = new HashMap<Long,Long>();
int q = qwe.nextInt();
while(q-->0){
int t = qwe.nextInt();
long v = qwe.nextLong();
long u = qwe.nextLon... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | e6f41fbf8dd20348826e560b1707a66b | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes | import javafx.util.Pair;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main
{
private String line;
private int index;
public long height(long x)
{
int nr = 0;
while (x > 0) { nr++; x = x / 2; }
r... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | ba81958951ab7f8daf2205d324d94d1f | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class C {
static class Edge {
long u, v;
public Edge(long u, long v) {
this.u = u;
this.v = v... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | 1a919fbb0482e59f5ad76c02eb0cca09 | train_000.jsonl | 1468514100 | Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections i and 2i and another road between i and 2iβ+β1 for every positive integer i. You can clearly see that there exists a unique shortest path between any two... | 256 megabytes | /*Author LAVLESH*/
import java.util.*;
import java.io.*;
public class solution{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer st=new StringTokenizer("");
static public String next(){
while (st == null || !st.hasMoreTokens()) {
try {
... | Java | ["7\n1 3 4 30\n1 4 1 2\n1 3 6 8\n2 4 3\n1 6 1 40\n2 3 7\n2 2 4"] | 1 second | ["94\n0\n32"] | NoteIn the example testcase:Here are the intersections used: Intersections on the path are 3, 1, 2 and 4. Intersections on the path are 4, 2 and 1. Intersections on the path are only 3 and 6. Intersections on the path are 4, 2, 1 and 3. Passing fee of roads on the path are 32, 32 and 30 in order. So answer equals... | Java 8 | standard input | [
"data structures",
"implementation",
"trees",
"brute force"
] | 12814033bec4956e7561767a6778d77e | The first line of input contains a single integer q (1ββ€βqββ€β1β000). The next q lines contain the information about the events in chronological order. Each event is described in form 1 v u w if it's an event when government makes a new rule about increasing the passing fee of all roads on the shortest path from u to v ... | 1,500 | For each event of second type print the sum of passing fee of all roads Barney passes in this event, in one line. Print the answers in chronological order of corresponding events. | standard output | |
PASSED | ece377eaed27f67e192b7e66e0eb4b1d | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
public class Check2 implements Runnable
{
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numCh... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 00c6229057b4d72f512203f4d2238256 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes |
import java.util.*;
import java.io.*;
/**
*
* @author umang
*/
public class ProblemF {
public static int mod = 1000000007;
public static InputReader in;
public static PrintWriter out;
static String s1[];
static String s2[];
static int[] pick;
static void change(int id){
p... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 13a3156c4a5c2d6248b0a9c0759bcd45 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws Exception{
Scanner sc = new Scanner(System.in);
HashMap<String, Boolean> ma, mma;
int N = sc.nextInt();
ma = new HashMap<String, Boolean>();
mma = new HashMap<String, Boolean>();
String[] Ans = ne... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 43910cbd5514c76d6f8b5ad5bed30a71 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
public class D2 {
public static void main(String[] args)throws Throwable {
MyScanner ... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 5268e30d8611fd5eeca47fc8425682b8 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.*;
public class D {
public static void main(String[] args) {
Scanner qwe = new Scanner(System.in);
int n = qwe.nextInt();
String[][] names = new String[2][n];
HashMap<String,Integer> toid = new HashMap<String,Integer>();
int curid = n;
int[] count = new int[3*n+5];
Str... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 5d1b775cc99fa08d800e0faca8af06f8 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Sc... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 5cf38ca094914ce4b6bfff216d6140e6 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.util.regex.*;
import java.text.*;
public class Solution {
public static void main(String[] args) throws Exception {
MyReader reader = new MyReader(System.in);
MyWriter w... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 139e8e90ecf70c9f38149fcfc18abebb | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
import java.util.stream.*;
import java.util.regex.*;
import java.text.*;
public class Solution {
public static void main(String[] args) throws Exception {
MyReader reader = new MyReader(System.in);
MyWriter w... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 9a1f7dae7c3daea12fd267fcb0506e93 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class App {
private static boolean solve(Map<String, Integer> mp1, Map<String, Integer> mp2, String[] tm, String[] hm, int ind,
int flag) {
if (ind == tm.length) {
return true;
}
String tmp1 = tm[ind].s... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 7aa12c8e601740acc705fd193b2fb4d4 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comp... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 2344022287b8d52e7ef0f905ea090239 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
/**
* @author ramilagger
*/
public class Main {
boolean ok;
final static boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
class Club {
String pre;
char a, b;
boolean t;
Club(char a,... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 960c7f53e1abcdc3eae724ff2b6a923d | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.util.HashMap;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Map;
import java.io.BufferedReader;
impo... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 2613816d5774d64f006b11f38d33529d | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Set;
import java.io.IOException;
import java.util.HashMap;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
import ja... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 1793c4aef4a2f531f65226e51088f916 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes |
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
static HashMap<String, Name> names;
static Name[] order;
public static void main(String args[]) throws IOException {
... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | c469e418f126be9f5ef9bdefa125cff1 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | cf443e67a84e0e5704b2c259f7929522 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
public class P782D
{
public static void main(String[] arg... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | e600334cbafb19af3e19a5aa9ca9f2e4 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
i... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 72e3c404f76d77a0484a104a1be3f62c | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | //package baobab;
import java.io.*;
import java.util.*;
public class D {
public static void main(String[] args) {
Solver solver = new Solver();
}
static class Solver {
IO io;
public Solver() {
this.io = new IO();
try {
solve();
... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 58a672dd05c9b4b6fd7896f873899e1c | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.*;
import java.io.*;
public class ProbD {
public static void main(String[] args) {
ProbD sol = new ProbD();
sol.start();
}
StringBuffer printstr;
public void print(Object o){ System.out.print(o); }
public void println(Object o) { System.out.println(o); }
public void bufp(Object o){ prints... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 143208b1b0deaf2a3facb20b4279fea7 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | d2b495590769e3c1caf64a96f58b6429 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
/**
* Created by Anton Berezin on 2/18/2017.
*/
public class FootballLeague {
public static void main(String[] args) throws Exception {
try (FastScanner fastScanner = new FastScanner();
PrintWriter writer =... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 4b8a2b83e0cb226d0a7c87ba14a5ed00 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import java.io.*;
public class Main {
public class pair implements Comparable<pair> {
String s1, s2;
int a;
public int compareTo(pair p) {
return s1.compareTo(p.s1);
}
}
public class tr... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | a75512f51da239818c30be4a5e054384 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
public class InnokentyAndAFootballLeague {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Pr... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | c1da6e33ae618f82c04382cc05d68d7d | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
String[][] a = new String[n][2];
HashMap<String, Integer> map = new HashMap<>();
for(int i=0;i<n;i+... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 3fbd203670f491733ea92b1f867f0d01 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import java.util.stream.Stream;
public class D {
static class Sat2 {
static void dfs1(List<Integer>[] graph, boo... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | f7a09fe632a564e85c1fdfb709b49247 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;
public class D
{
String line;
StringTokenizer inputParser;
BufferedReader is;
FileInputStream fstream;
DataInputStream in;
void openInput(String file)
{
if(file==null)is = new BufferedReader(n... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | f02a8902e46a82f1e638d64a17ea2f0b | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.*;
import java.util.*;
public final class round_403_d
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
static Random rnd=new Random();
static int[] parent,size;
stati... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 1f7a36f52810b6b8f3dfa57e05f3a1cc | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | /**
* DA-IICT
* Author : Savaliya Sagar
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class D782 {
InputStream is;
PrintWriter out;
String ans1[], ans2[], ans[];
HashSet<String> hs = new HashSet<>();
HashMap<String, ArrayList<Integer>> hm = new HashMap<>();
void solve() {
int n = ni()... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 47f82f80477db8161e205cc472a7b2a4 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
public class Div2_403D {
public static voi... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 7a3b0d107d64a439a76ec57bc00d0186 | train_000.jsonl | 1488705300 | Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wants that all short names consist of three letters.Each club's full name consist of two word... | 256 megabytes | import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
/**
* Created by mmaikovych on 05.03.17.
*/
public class CF_403_D {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
String[] co... | Java | ["2\nDINAMO BYTECITY\nFOOTBALL MOSCOW", "2\nDINAMO BYTECITY\nDINAMO BITECITY", "3\nPLAYFOOTBALL MOSCOW\nPLAYVOLLEYBALL SPB\nGOGO TECHNOCUP", "3\nABC DEF\nABC EFG\nABD OOO"] | 2 seconds | ["YES\nDIN\nFOO", "NO", "YES\nPLM\nPLS\nGOG", "YES\nABD\nABE\nABO"] | NoteIn the first sample Innokenty can choose first option for both clubs.In the second example it is not possible to choose short names, because it is not possible that one club has first option, and the other has second option if the first options are equal for both clubs.In the third example Innokenty can choose the ... | Java 8 | standard input | [
"graphs",
"greedy",
"shortest paths",
"strings"
] | 733b36bfc2b72200281477af875f8efa | The first line contains a single integer n (1ββ€βnββ€β1000)Β β the number of clubs in the league. Each of the next n lines contains two wordsΒ β the team's name and the hometown's name for some club. Both team's name and hometown's name consist of uppercase English letters and have length at least 3 and at most 20. | 1,900 | It it is not possible to choose short names and satisfy all constraints, print a single line "NO". Otherwise, in the first line print "YES". Then print n lines, in each line print the chosen short name for the corresponding club. Print the clubs in the same order as they appeared in input. If there are multiple answers... | standard output | |
PASSED | 4712f9a23e4145be4e770e0b127f7f41 | train_000.jsonl | 1489851300 | A tree is an undirected connected graph without cycles. The distance between two vertices is the number of edges in a simple path between them.Limak is a little polar bear. He lives in a tree that consists of n vertices, numbered 1 through n.Limak recently learned how to jump. He can jump from a vertex to any vertex wi... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
public class C implements Runnable {
List<Integer>[] r;
long[][] down;
int ... | Java | ["6 2\n1 2\n1 3\n2 4\n2 5\n4 6", "13 3\n1 2\n3 2\n4 2\n5 2\n3 6\n10 6\n6 7\n6 13\n5 8\n5 9\n9 11\n11 12", "3 5\n2 1\n3 1"] | 2 seconds | ["20", "114", "3"] | NoteIn the first sample, the given tree has 6 vertices and it's displayed on the drawing below. Limak can jump to any vertex within distance at most 2. For example, from the vertex 5 he can jump to any of vertices: 1, 2 and 4 (well, he can also jump to the vertex 5 itself). There are pairs of vertices (s,βt) such tha... | Java 8 | standard input | [
"dp",
"dfs and similar",
"trees"
] | 0b4362204bb9f0e95eaf7e2949315c8f | The first line of the input contains two integers n and k (2ββ€βnββ€β200β000, 1ββ€βkββ€β5)Β β the number of vertices in the tree and the maximum allowed jump distance respectively. The next nβ-β1 lines describe edges in the tree. The i-th of those lines contains two integers ai and bi (1ββ€βai,βbiββ€βn)Β β the indices on verti... | 2,100 | Print one integer, denoting the sum of f(s,βt) over all pairs of vertices (s,βt) such that sβ<βt. | standard output | |
PASSED | 5ca31122b20347158c6205046f846003 | train_000.jsonl | 1369927800 | Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string sβ=βs1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li,βri (1ββ€βliβ<βriββ€βn... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class B {
static BufferedReader stdin = new BufferedReader(new
InputStreamReader(System.in));
static StringTokenizer st = new StringTokenizer("");
public static void main(String[] args) throws Exception {
... | Java | ["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"] | 2 seconds | ["1\n1\n5\n4", "1\n1\n2\n2\n0"] | null | Java 6 | standard input | [
"dp",
"implementation"
] | b30e09449309b999473e4be6643d68cd | The first line contains string s of length n (2ββ€βnββ€β105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1ββ€βmββ€β105) β the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer... | 1,100 | Print m integers β the answers to the queries in the order in which they are given in the input. | standard output | |
PASSED | 2fd1ee1b813c9467425a77f43717b337 | train_000.jsonl | 1369927800 | Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string sβ=βs1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li,βri (1ββ€βliβ<βriββ€βn... | 256 megabytes | import java.io.IOException;
import java.util.Locale;
import java.util.Scanner;
public class B {
public void processInput() throws IOException {
Scanner in = new Scanner(System.in);
String str = in.next();
int n = in.nextInt();
int[] l = new int[n];
int[] r = new int[n];
... | Java | ["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"] | 2 seconds | ["1\n1\n5\n4", "1\n1\n2\n2\n0"] | null | Java 6 | standard input | [
"dp",
"implementation"
] | b30e09449309b999473e4be6643d68cd | The first line contains string s of length n (2ββ€βnββ€β105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1ββ€βmββ€β105) β the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer... | 1,100 | Print m integers β the answers to the queries in the order in which they are given in the input. | standard output | |
PASSED | a2c15c84c0cb46a966c7a10f3d586bb4 | train_000.jsonl | 1369927800 | Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string sβ=βs1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li,βri (1ββ€βliβ<βriββ€βn... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author sukhdeep
*/
public class Code {
public static void main(String arg[]) throws IOException
{
BufferedReader r=new BufferedReader(new InputStreamReader(System.... | Java | ["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"] | 2 seconds | ["1\n1\n5\n4", "1\n1\n2\n2\n0"] | null | Java 6 | standard input | [
"dp",
"implementation"
] | b30e09449309b999473e4be6643d68cd | The first line contains string s of length n (2ββ€βnββ€β105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1ββ€βmββ€β105) β the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer... | 1,100 | Print m integers β the answers to the queries in the order in which they are given in the input. | standard output | |
PASSED | 40523295dbb3c7da21cfb5db1376c965 | train_000.jsonl | 1369927800 | Ilya the Lion wants to help all his friends with passing exams. They need to solve the following problem to pass the IT exam.You've got string sβ=βs1s2... sn (n is the length of the string), consisting only of characters "." and "#" and m queries. Each query is described by a pair of integers li,βri (1ββ€βliβ<βriββ€βn... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CFTest45
{
static BufferedReader br;
public static void main(String[] args) {
br = new BufferedReader(new InputStreamReader(System.in));
try {
String s=readLine();
int nm=readInt();
int[]... | Java | ["......\n4\n3 4\n2 3\n1 6\n2 6", "#..###\n5\n1 3\n5 6\n1 5\n3 6\n3 4"] | 2 seconds | ["1\n1\n5\n4", "1\n1\n2\n2\n0"] | null | Java 6 | standard input | [
"dp",
"implementation"
] | b30e09449309b999473e4be6643d68cd | The first line contains string s of length n (2ββ€βnββ€β105). It is guaranteed that the given string only consists of characters "." and "#". The next line contains integer m (1ββ€βmββ€β105) β the number of queries. Each of the next m lines contains the description of the corresponding query. The i-th line contains integer... | 1,100 | Print m integers β the answers to the queries in the order in which they are given in the input. | standard output | |
PASSED | f55214f961a9556387d8665859c7f686 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
private static FastScanner sc = new FastScanner();
public static void main(String[] args) {
char[] oleg = sc.next().toCharArray();
char[] igo... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | dc65c5e00d7882aa053cb83ca3fc4cb1 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.NoSuchElementException;
public class Main {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
char[][] s = new char[2][];
s[0] = sc.next().toCharArray... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | bd480dc21ac219d7fce4f6f36b2057e1 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | /*
ID: mchensd
LANG: JAVA
PROG: NamingCompany
*/
/**
*
* @author Michael
*/
import java.util.*;
import java.io.*;
public class NamingCompany {
static int len;
public static int[] readWord(String s) {
int[] res = new int[26];
for (int i = 0; i < s.length(); ++i) {
++res[s.char... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | e653a69fe19cc9a32ff779cf28cb228d | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | /*
ID: mchensd
LANG: JAVA
PROG: NamingCompany
*/
/**
*
* @author Michael
*/
import java.util.*;
import java.io.*;
public class NamingCompany {
static int len;
public static int[] readWord(String s) {
int[] res = new int[26];
for (int i = 0; i < s.length(); ++i) {
++res[s.char... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 2a3b4404eae6cf1ccd2d020aaa2df0f8 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
FastScanner in;
PrintWriter out;
boolean systemIO = true;
public void solve() throws IOException {
String s1 = in.next();
String s2 = in.next();
TreeMap<Character, Integer> t11 = new TreeMap<>();
TreeMap<Character, Integer> t22 = new TreeMap<>();
T... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 33a7124201f63a6a0dc3432b37e01eef | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.HashMap;
import java.util.InputMismatchException;
public class Main
{
sta... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | d03fd28e0d7197e05bafad9e77101a52 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes |
/*
HARSH KHATRI
DA-IICT
*/
import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
public class CF794C {
public static void main(String[] args) {
FasterScanner... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 01edd80cd7ba6e82dc14d7c41428edcd | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
import java.util.HashMap;
public class templ {
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l)
{
int mid = l + (r - l)/2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x) ... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 72e82c167bcde8a13199bfa9da2a787b | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
public class Luck{
public static InputReader sc;
public static PrintWriter out;
public static final int MOD = (int) (1e9 + 7);
public static void main(String[] args){
sc=new InputReader(System.in);
out=new PrintWriter(System.out);
S... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 6bd4f0621f728acebfe56ba98adafe29 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.*;
import java.util.*;
public class C{
public static void main(String[] args) {
FastScannerC sc = new FastScannerC(System.in);
String a = sc.next();
String b = sc.next();
int len = a.length();
ArrayList<Character> first = new ArrayList<>();
ArrayList<Character> sec = new ArrayLi... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 3e95d48c474591f4ea5fc8be93439bea | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Xinyi Tao
*/
public class Main {
public static void main(String[] ar... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | 04003fb54f2c0e63eeef211bfda27860 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Xinyi Tao
*/
public class Main {
public static void main(String[] args) {
InputStream... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | ba382dc85ac249bf797029a844c8eecc | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | /*
* Author Ayub Subhaniya
* Institute DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Codeforces408 {
InputStream in;
PrintWriter out;
void solve()
{
char []c1=ns().toCharArray();
char []c2=ns().toCharArray();
int n=c1.length;
char []c=new char[n];
Arrays.s... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | fe0f9bfd7a53401acaffec300879b861 | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.util.*;
import java.math.*;
import java.io.*;
import java.text.*;
public class A{
static class Node{
int x;
int id;
public Node(int x,int id) {
this.id=id;
this.x=x;
}
}
//public static PrintWriter pw;
public static PrintWriter pw=new PrintWriter(System.out);
public static void solve() throws IOE... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | dbf13fe818e3baa8060b66164423f16a | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.util.InputMismatchException;
import java.util.Arrays;
public class companyName {
static class InputReader
{
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | b5848cbde683010654045b8555f9a08b | train_000.jsonl | 1494668100 | Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor each... | 256 megabytes | /**
* Created by Ariana Herbst on 5/13/17.
*/
import java.util.*;
import java.io.*;
public class cfs414C {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
StringBuilder sb = new StringBuilder();
String strA = sc.next();
String strB = sc.next();
... | Java | ["tinkoff\nzscoder", "xxxxxx\nxxxxxx", "ioi\nimo"] | 2 seconds | ["fzfsirk", "xxxxxx", "ioi"] | NoteOne way to play optimally in the first sample is as follows : Initially, the company name is ???????. Oleg replaces the first question mark with 'f'. The company name becomes f??????. Igor replaces the second question mark with 'z'. The company name becomes fz?????. Oleg replaces the third question mark with 'f'. T... | Java 8 | standard input | [
"greedy",
"sortings",
"games"
] | bc3d0d902ef457560e444ec0128f0688 | The first line of input contains a string s of length n (1ββ€βnββ€β3Β·105). All characters of the string are lowercase English letters. This string denotes the set of letters Oleg has initially. The second line of input contains a string t of length n. All characters of the string are lowercase English letters. This strin... | 1,800 | The output should contain a string of n lowercase English letters, denoting the company name if Oleg and Igor plays optimally. | standard output | |
PASSED | e6f32704fd42d13b937cc17c1b997420 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
/**
* @author Don Li
*/
public class DZYLovesFibonacciNumbers {
static final int MOD = (int) (1e9 + 9);
static final int MAXN = (int) (3e5 + 5);
... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | 1f95cc3d3faf60defe2fee310a98e369 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.util.*;
import java.io.*;
/**
*
* @author usquare
*/
public class E447 {
public static int mod = (int) (1e9+9);
public static long[] f=new long[300005];
public static Pair[] buff;
public static void pre(){
f[1]=f[2]=1;
for(int i=3;i<f.length;i++){
f... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | fa3417b40738372bb06bee89a948cab0 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF447E {
static final int MD = 1000000009;
static int[] ff, gg;
static int sum(int f0, int f1, int i, int j) {
// (f0, f1, f0+f1, f0+f1+f1, ...) = (f0, 0, f0, f0, ...) + (0, f1, f1, ...)
int s = i == 0 ? f0 : 0;
if (j >= 1) {
int g1 = i <= 1 ? gg[j - 1] : ... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | 561270dad6dc758547a5d82110e12b15 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF447E {
static int M = 1000000009;
static int add(int a, int b) { return (a + b) % M; }
static int sub(int a, int b) { return (a - b + M) % M; }
static int mul(int a, int b) { return (int) ((long) a * b % M); }
static int[] ff, gg;
static int sum(int f0, int f1... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | b09c1cc44c0459bd9ea7ba9960e87590 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF447E {
static int M = 1000000009;
static int add(int a, int b) { return (a + b) % M; }
static int sub(int a, int b) { return (a - b + M) % M; }
static int mul(int a, int b) { return (int) ((long) a * b % M); }
static int[] ff, gg, f0, f1, ss;
// (a0, a1, a0+a1... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | e814c4438dde9f4931825012c8ce2df7 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class FibonacciLove {
private static final int MODULUS = 1000000009;
private static int[] fibSeq;
private static int[] fibSum;
private static int[] fib0;
private static int[] fib1;
private static int[] ss;
private static... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | a98031bafd36678fc63a7dc3f919e0f8 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes |
import java.io.*;
public class Code_Forces_447_E
{
public static void main (String[] args) throws java.lang.Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
String[] input = br.readLine().split(" ");
int n = Integer.parseI... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | a0244b8aa8a7ab8fbe08f0da432b8237 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | /**
* DA-IICT
* Author : Savaliya Sagar
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class E447 {
InputStream is;
PrintWriter out;
long tree[];
Pair lazy[];
long a[];
int n,m,N=(int) (3e5+5);
int mod = (int) (1e9+9);
long pw[][][] = new long[N][2][2];
void solve() {
n = ni();
m =... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | 6d0ef54da8e9cbc63f4659256922fe26 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | /**
* DA-IICT
* Author : Savaliya Sagar
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class E447 {
InputStream is;
PrintWriter out;
long a[];
int n, m, N = (int) (3e5 + 5);
int mod = (int) (1e9 + 9);
long fib[] = new long[N];
long update[] = new long[N];
int sq = 550;
long pair[] = ne... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | 98d2478445c4b00be64ec29299582493 | train_000.jsonl | 1405256400 | In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation F1β=β1;Β F2β=β1;Β Fnβ=βFnβ-β1β+βFnβ-β2Β (nβ>β2).DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: a1,βa2,β...,βan. Moreover, there are m queries, each query has one of the two ty... | 256 megabytes | /*
* Author Ayub Subhaniya
* Institute DA-IICT
*/
import java.io.*;
import java.math.*;
import java.util.*;
public class Driver {
InputStream in;
PrintWriter out;
int n;
int MAXB;
int MAXN;
long buffer[];
long f[];
long mod=(long)1e9+9;
void init()
{
MAXN=(int)3e5+7;
MAXB=(int) Math.sqrt(n);
... | Java | ["4 4\n1 2 3 4\n1 1 4\n2 1 4\n1 2 4\n2 1 3"] | 4 seconds | ["17\n12"] | NoteAfter the first query, aβ=β[2,β3,β5,β7].For the second query, sumβ=β2β+β3β+β5β+β7β=β17.After the third query, aβ=β[2,β4,β6,β9].For the fourth query, sumβ=β2β+β4β+β6β=β12. | Java 8 | standard input | [
"data structures",
"math"
] | 8771e13d0958494e59bf8f61a0041c7a | The first line of the input contains two integers n and m (1ββ€βn,βmββ€β300000). The second line contains n integers a1,βa2,β...,βanΒ (1ββ€βaiββ€β109) β initial array a. Then, m lines follow. A single line describes a single query in the format given in the statement. It is guaranteed that for each query inequality 1ββ€βlββ€β... | 2,400 | For each query of the second type, print the value of the sum on a single line. | standard output | |
PASSED | 8f7ccfea1f2e6c6bcda548416437c6fe | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.nio.Buffer;
import java.util.*;
public class Pair {
public static void main(String[] args) throws Exception {
try {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T!=... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 56dbaa6f3cbb563ba3a3484ddd2646d3 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class competitive23 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
long x[] = new long[n];
for (int i = 0; i < n; i++) {
x[i] = in.nextLong();
}
int count[] = new int[... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 393be7e27126fc20cf3431a52c3c477d | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | /*package whatever //do not write package name here */
import java.util.Scanner;
public class GFG {
public static void main (String[] args) {
Scanner value = new Scanner(System.in);
int n,i,x,y=0,z=0,l=0;
n=value.nextInt();
Long a[];
a=new Long[n];
for(i=0;i<n;i++)
{
a[i]=value.nextLong();
}... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 9ab730d4b77fde337fce461c219f63fb | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.util.*;
public class divide
{
public static void main(String args[])
{
Scanner s=new Scanner(System.in);
long q,i,c=0,n;
q=s.nextLong();
for(i=0;i<q;i++)
{ c=0;
n=s.nextLong();
if(n==1)
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 4883f81a004377e5d15dd5026ee5fcbe | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
import java.math.*;
public class divide_it
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int T=in.nextInt();
while(T-->0)
{
BigInteger n=in.nextBigInteger();
int c=0;
for(int i=1;i<=100;i++)
{
if(n.mod(BigInteger.valueOf(5))==BigInteger.ZERO... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 7c21691d572dfc0bef9ca1c49b773b01 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DivideIt {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for (int i = 0; i < t; i++) {
long n = scan.nextLong();
int count = 0;
while (true) {
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 7ce44e7a0a57b8248f184c3e0e38cffd | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | //package pkg1176a;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
long num=sc.nextInt();
for(int i=0;i<num;i++)
{
int n=0;
long number=sc.nextLong();
while(number%5 == 0)
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | e82bd4367610d2a08c8a4a923c64b400 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DivideIt_1176A {
public static long divide(long n){ // we have to save the answers
long c1 = 0;
long c2 = 0;
long c3 = 0;
while(n%2==0){
n = n/2;
c1++;
}
while(n%3==0){
n = n/3;
c... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 2c79e19d6779a5c468824a9a23092522 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
while(n-->0){
int sum=0;
long a=sc.nextLong();
while(a!=1){
if(a%2!=0 && a%3!=0 && a%5!=0){
sum=-1;
break;
}
else if(a%5==0){
sum++;
a=a*... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | ad8c60c7157c54dd9af5d84b847b9dba | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.lang.reflect.Array;
import java.util.*;
public final class Solution {
static Scanner in = new Scanner(System.in);
static void solve() {
long n = in.nextLong();
int c = 0;
while (n % 3 == 0) {
n = 2*n/3;
c++;
}
while (n % 5 == 0) {
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 458b74d0d849924297856a089f00517b | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DivideIt {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0) {
long n = sc.nextLong();
int c = 0;
while(n>1) {
if (n % 2 == 0) {
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | e370ac93f2e33a39af4295079622a3ef | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
long t,i,... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | a7715a522b00de3b5a9f343e3056a2a9 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
import java.math.BigInteger;
public class Main{
public static void main(String[]args){
Scanner sc = new Scanner (System.in);
int q = sc.nextInt();
int a[]= new int[q];
int count;
for ( int i=0; i<q;i++){
BigInteger b =sc.nextBigI... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | c2a116d7a8f853bbaccb640a5d49cf7a | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DiM {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int q,count=0;
q=input.nextInt();
for(int i=0;i<q;i++){
long n,a;
n=input.nextLong();
a=n;
while(a!=1){
if(a%2==0){
a=... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 39f27256f02a8f9badcea2d2ce0904a0 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
public class arr {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t=scn.nextInt();
for(int j=0;j<t;j++){
long num=scn.nextLong();
System.out.println(nom(n... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | b4b834a8021aaf5655975ecb6b6f0e09 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes |
import java.util.*;
import static java.lang.System.out;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main
{
static int mod = 1000000007;
static final long M = (int)1e9+7;
static ... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 8b6763f5c9bbf00889cecbd1eafac463 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | //package com.company;
import java.io.Reader;
import java.util.*;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int tt = scanner.nextInt();
for(int i1 = 0 ;i1<tt;i1++){
long k = scanner.nextLong();
int count = 0;
boolean... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | bb716a5c370b312bdfa2b0af2124ce6e | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
public class Scanner {
BufferedReader br;
StringTokenizer st;
Scanner()
{
br... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 23a45c895898b1e1527861206f7efde3 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class Divide_it {
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0)
{
int count = 0;
long no = sc.nextLong();
while(no>1)
{
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 9fb48a212102d644d7449efd42aec7b3 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes |
import java.io.*;
import java.util.*;
public class test {
/*
* array list
*
* ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers
*
* BigInteger a=new BigInteger(); BigInteger b=new BigInteger();
*
* hash map
*
* HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>(); for(int
*... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | e52d4b0804e26251c252830596b32ef6 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
static long mod = 1000000007;
static InputReader in = new InputReader(System.in);
static PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args)... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 23ccbfd4dd88f54c3a40688079c5b222 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class T6 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++ )
{
long n=sc.nextLong();
long c=0;
while (n%5==0){
n=(4*n)/... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 42e0c6f57a288be405d361e648f15328 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
public class one {
public static boolean isPalindrome(String word)
{ word=word.toLowerCase();
int start = 0 ;
int end = word.length()-1;
boolean flag = true;
while(start<=end)
{
if(word.charAt(start)!=word.charAt(end))
{
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | b3aed3534bebca171b90ee8e57f8047c | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DivideIt {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int q = sc.nextInt();
for (int i = 0;i < q; i++)
{
long n = sc.nextLong();
int steps = 0;
while (n != 1)
{
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | a333b45ecc1991260ed6731cccd1a703 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class DivideIt {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int queries = sc.nextInt();
sc.nextLine();
while(queries-- > 0) {
long n = sc.nextLong();
boolean flag = false;
int mov... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 8b6c6bcc4ea574b76593d5f60cbbae08 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int t;
t = sc.nextInt();
while(t-- > 0)
{
long n;
long count =0;
long flag = 0;
n = sc.nextLong();
while(n... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | f3e4d61ef460e63d6781e2623bf72254 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author ky112233
*/
public class Main {
public static void main(String[] args) {
InputStream ... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 653b11f9c0ff7ee856a3cf3c8fd2a046 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in= new Scanner(System.in);
long n=in.nextLong(),count=0;
for(int i=0;i<n;i++){
long a=in.nextLong();
while(a>0){
if(a%2==0){
a=a/2;count++;
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 892da38af06142d712d9d4ed9d00d11a | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
public class P1176A
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-->0)
{
long n = in.nextLong();
boolean ok = true;
int moves = 0;
while(n>1)
{
if(n%5 == 0)
n = (4*n)/5;... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | e3bfc9873ebd0694fe4d50534a4947fc | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.Scanner;
/**
*
* @author nhiphamleyen
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
int Q = sc.nextInt();
for... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | e4e3d6f7a29ec505f13aa0f66eaa2322 | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.HashSet;
import java.util.*;
public class Test {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
for(int ii=0;ii<test;ii++){
long n = sc.nextLong();
int count = 0;boolean flag = true;
... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output | |
PASSED | 1976330ce59717914ac98e4cede7cc4f | train_000.jsonl | 1560090900 | You are given an integer $$$n$$$.You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace $$$n$$$ with $$$\frac{n}{2}$$$ if $$$n$$$ is divisible by $$$2$$$; Replace $$$n$$$ with $$$\frac{2n}{3}$$$ if $$$n$$$ is divisible by $$$3$$$; Replace $$$n$$$ with... | 256 megabytes | import java.util.*;
public class Divide_it{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int q = Integer.parseInt(scan.nextLine());
long n;
long temp;
int count;
for (int i =0;i<q ;i++ ) {
n = Long.parseLong(scan.nextLine());
temp = n;
count = 0;
while (temp... | Java | ["7\n1\n10\n25\n30\n14\n27\n1000000000000000000"] | 1 second | ["0\n4\n6\n6\n-1\n6\n72"] | null | Java 11 | standard input | [
"implementation",
"greedy",
"brute force"
] | ed5ea0e664aa986ab86e4e6746e8a1bf | The first line of the input contains one integer $$$q$$$ ($$$1 \le q \le 1000$$$) β the number of queries. The next $$$q$$$ lines contain the queries. For each query you are given the integer number $$$n$$$ ($$$1 \le n \le 10^{18}$$$). | 800 | Print the answer for each query on a new line. If it is impossible to obtain $$$1$$$ from $$$n$$$, print -1. Otherwise, print the minimum number of moves required to do it. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.