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 | 184f9878df2567786022c757447b826e | train_003.jsonl | 1329750000 | One day little Vasya found mom's pocket book. The book had n names of her friends and unusually enough, each name was exactly m letters long. Let's number the names from 1 to n in the order in which they are written.As mom wasn't home, Vasya decided to play with names: he chose three integers i, j, k (1 ≤ i < j ≤ n,... | 256 megabytes | import java.util.*;
public class c {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = input.nextInt();
char[][] names = new char[n][m];
for(int i = 0; i<n; i++)
{
String s = input.next();
for(int j = 0; j<m; j++)
... | Java | ["2 3\nAAB\nBAA", "4 5\nABABA\nBCGDG\nAAAAA\nYABSA"] | 2 seconds | ["4", "216"] | NoteIn the first sample Vasya can get the following names in the position number 1: "AAB", "AAA", "BAA" and "BAB". | Java 8 | standard input | [
"combinatorics"
] | a37df9b239a40473516d1525d56a0da7 | The first input line contains two integers n and m (1 ≤ n, m ≤ 100) — the number of names and the length of each name, correspondingly. Then n lines contain names, each name consists of exactly m uppercase Latin letters. | 1,400 | Print the single number — the number of different names that could end up in position number 1 in the pocket book after the applying the procedures described above. Print the number modulo 1000000007 (109 + 7). | standard output | |
PASSED | 92a4160b393c94d44058591b7bf79ebf | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.math.*;
import java.text.*;
public class Main
{
static FastScanner in = new FastScanner(System.in);
static StringBuilder sb = new StringBuilder();
static DecimalFormat df = new DecimalFormat();
public static void main(String[] args)
{
df.setMaximumFractio... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | 2d56bf53aaf9ae02684e66441dbd3fc1 | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main implements Runnable
{
class Cycle implements Comparable<Cycle>
{
int len;
ArrayList<Integer> v;
public int compareTo( Cycle o )
{
return len - o.len;
}
}
void solve() throws Exception
{
... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | d498f87d668c10759768650383b0c5b5 | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
/**
* @author Pavel Mavrin
*/
public class B {
private void solve() throws IOException {
int n = nextInt();
int[] p = new int[n];
for (int i = 0; i... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | 577fdddfe37b6209bc69208e6d4eb67a | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.util.*;
import java.io.*;
public class B576 {
public static void main(String[] args) throws Exception
{
EspyScanner input = new EspyScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
int n = input.nextInt();
int[] p = new int[n];
for(int i =0 ;i <n; i++) p[i] = input... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | ff3738525f56475b7737116c20df562e | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class InvarianceOfTree {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = ... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | 5e30125b6f6f460eef16e1bb161f97a2 | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.util.*;
import java.io.*;
import java.awt.Point;
import java.math.BigDecimal;
import java.math.BigInteger;
import static java.lang.Math.*;
// Solution is at the bottom of code
public class B implements Runnable{
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | 08d9995a7bfdae4784ec40580d424615 | train_003.jsonl | 1441902600 | A tree of size n is an undirected connected graph consisting of n vertices without cycles.Consider some tree with n vertices. We call a tree invariant relative to permutation p = p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertic... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchEx... | Java | ["4\n4 3 2 1", "3\n3 1 2"] | 1 second | ["YES\n4 1\n4 2\n1 3", "NO"] | NoteIn the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree.It can be shown that in the second sample test no tree satisfies the given condition. | Java 7 | standard input | [
"constructive algorithms",
"greedy",
"dfs and similar",
"trees"
] | 5ecb8f82b073b374a603552fdd95391b | The first line contains number n (1 ≤ n ≤ 105) — the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 ≤ pi ≤ n). | 2,100 | If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n - 1 lines, each of which contains two integers — the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within ... | standard output | |
PASSED | 4d4fe768137985ab673018271df4bc5e | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.util.*;
public class j
{
public static void main(String[] args)
{
HashMap<String, String> H = new HashMap<String, String>();
int n;
Scanner cin = new Scanner(System.in);
n = cin.nextInt();
int i;
String s, value, aux;
for (i = 1; i <= n; i+... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 8357a6c6e92a06102ac582a213167081 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Int... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | fde7b31c08d7a5e62eb1d3a92161ea48 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import static java.lang.Double.max;
import java.util.Map.Entry;
import java.util.Scanner;
/**
*
* @author ESC
*/
public class JavaApplication39 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner in... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 577234ed4f26718df0418260a2fcaed6 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class MeshaAndChangingHandles {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 8c1de0d2262fbf1116ce7f75dcbfda5b | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
public class MeshaAndChangingHandles {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 4f81d86c180e033f133c0cd183d5a4c0 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class ACM2 {
public static void main(... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | c69a1a8c3e6491fd002a0f50e60a1dfe | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class ACM2 {
public static void main(String[] args) throws IOException {
BufferedReader in = ne... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | b175b954cc41d881db06ee303fa1db74 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
public class Misha {
public static void main(String[] args) throws Exception{
BufferedReader bi = new BufferedReader(new InputStreamReader(System.i... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | b588c1984f6bc962534938b3bb5c81b2 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Sol
{
static int[] vis;
static class qu
{
String f;
String s;
qu(String x,String y)
{
f=x;
s=y;
}
}
static qu[] arr;
public static void main(String[] args)throws IOException
{
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | d6654bc72c1f2eb2ce977a3ee343b0fb | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Graph1 {
//static int flag=1;
//private static int n,l,r,z,way=0;
private static InputStream stream;
private static byte[] buf=new byte[1024];
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | eb626f1e42afbdfd709511d56fc6f1c6 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public final class Solution{
public static void main(String args[]){
HashMap<String, String> map = new HashMap<>();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String old = "a", news = "b";
int count = 0;
for(int i = 0; i < n... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | c7ae71e2afc91d47ba880c4d59de349f | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.io.*;
public class Main
{
public static void main(String args[]) throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(reader.readLi... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 81ee1b8302a9ff60814819f4248c2599 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
TaskB Solver = new TaskB();
Solver.Solve();
}
public static class TaskB {
private static void Solve() {
Scanner in = new Scanner(System.in);
int... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 6bf188742bb7dc14d63a3cef69953658 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
@SuppressWarnings("unused")
public class A {
public static Scanner scan = new Scanner(System.in);
public static void solve () {
int n=scan.nextIn... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 1f175c431268b133a9468bcce952520d | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;
public class JavaApplication3 {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
StringTokenizer tok = new StringTokenizer(sc.nextLine());
int n = Integer.pars... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | ef09d16b29b0310f20a131f07af12b92 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
public class JavaApplication3 {
public static void main(String[] args) th... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 6ccc9c91aa8dfcb9f76c524efcdfa9a2 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class runtimeError {
public static void main (String[] args) throws IOException , NumberFormatException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | dbea8fa6f085eaa06549b4787ee38eec | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class runtimeError {
public static void main (String[] args) throws IOException , NumberFormatException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 5425b3419ae43cadd9529b705659f561 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | /*
█████╗ ██╗ ██╗████████╗██╗ ██╗ ██████╗ ██████╗ ███████╗██╗ ██╗ █████╗ ██████╗ ██╗ ██╗
██╔══██╗██║ ██║╚══██╔══╝██║ ██║██╔═══██╗██╔══██╗██╗ ██╔════╝██║ ██║██╔══██╗██╔══██╗╚██╗ ██╔╝
███████║██║ ██║ ██║ ███████║██║ ██║██████╔╝╚═╝ ███████╗███████║███████║██║ ██║ ╚████╔╝
██╔══██║██║ ██║... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 2ffb6ffe0e1d251942afe22328cbd330 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static class Reader {
private BufferedReader br;
private StringTokenizer token;
protected Reader(FileReader obj) {
br = new BufferedReader(obj, 32768);
token = null;
}
protected Reader() {
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | a798075978c4b8f3d7d3a09784defd62 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static class Reader {
private BufferedReader br;
private StringTokenizer token;
protected Reader(FileReader obj) {
br = new BufferedReader(obj, 32768);
token = null;
}
protected Reader() {
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 00178fbc6a2bea2235ea9ab8ae18d875 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class b {
public static void main(String[] arg)
{
new b();
}
public b()
{
Scanner in = new Scanner(System.in);
ArrayList<ArrayList<String>> eList = new ArrayList<ArrayList<String>>();
int size = in.nextInt();
for(int q = 0; q < size; q++)
{
String v1 = in.next();
String... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 54d322b6963132f24a33c81164827d1a | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.StringTokenizer;
import static java.lang.Integer.parseInt;
public class B_Misha_and_Changing_Handles {
static HashMap<String,String> map;
static String[] st;
static Stri... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 8876c3e95c4634d9bb4051ae49432b97 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class ah{
public static void main (String []args){
Scanner sc=new Scanner(System.in);
int n=Integer.parseInt(sc.nextLine());
String old[]=new String[n];
String nw[]=new String[n];
int c=0;
for (int i=0;i<n;i++){
String s=sc.nextLine();
String h[]=s.split("\\s+");
boolean... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 963fc3add7665985e08002d9a7a7d0ff | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class abc
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String arr[][]=new String[n][3];
int c=0;
sc.nextLine();
for(int i=1;i<=n;i++)
{
String temp=sc.nextLine();
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 2419b87fa98fc27569be09560c946055 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;
public class B501Codeforces {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader bf = new BufferedReader(ne... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 1f909a61c6e1201f16e6c80033eca8f6 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
ArrayList<String> keys = new ArrayList<>();
ArrayList<String> values = new ArrayList<>();
Map<String,String> map = new HashMa... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 88fb99b69d282bf4779642362a01e7fb | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Code2 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
ArrayList<String> keys = new ArrayList<>();
ArrayList<String> values = new ArrayList<>();
Map<String,Strin... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 3595607ec17fc0a75cd6099b6f8c249f | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class acm {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] old = new String[n];
String[] news = new String[n];
for(int i=0;i<n;i++)
{ old[i]=sc.next();
news[i]=sc.next();}
String result... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 62132e85c5bdb306415c75eb6319ddea | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class MishaandChangingHandles {
public static String getkey(HashMap<String, String> map, String value) {
for (String key : map.keySet()) {
if (value.equals(map.get(key)))
return key;
}
return null;
}
public static void main(String args[]) {
Scanner sc = n... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | fd1c10d01c2ccf65702952ba33e36bbb | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
public class ninjaturtle {
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int n= sc.nextInt();
String[][]s=new String[n][2];
for(int i=0;i<n;i++)
{
s[i][0]= sc.next();
s[i][1]=sc.next();
}
int c=0;
for(int k=0;k<n;k++)
{
String nw=s[k][1];
for(in... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | f1a594beb5693e11012784279f367854 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class hello2
{static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new Buffered... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | bf79555cd15489ee55c45947b90aa723 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.lang.StringBuffer;
public class Main {
static Scanner in = new Scanner();
static PrintWriter out = new Prin... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 6b79d4f6705a69ef4ad254ab0a29a162 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Problem3 {
static BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
public static void display(String[][]a){
for(int i = 0;i<a.length;i++){
for(... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 820ea826dc7b93d2180949a60fe35e80 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
import java.io.*;
public class MishaChangingHandles
{
public static void main (String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | bcfcfde0916de2f3dc60b226b31db600 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;
public class dsal2 {
static class coordinates {
int x, y;
coordinates(int x, int y) {
this.x = x;
this.y = y;
}
}
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | db153589e76304a4612fd0359c2d1623 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class MishaAndChagingHandles_B501 {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 6dbe0f1d6dfa4137335e035c6c12fdd9 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class MishaAndChagingHandles_B501 {
public static void main(String[] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | b67a1f011dcf58cf47019fd4cc4d672f | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] s = new String[2 * n];
for (int i = 0; i < 2 * n; i += 2) {
s[i] = sc.next();
s[i + 1] = sc.next();
}
int m = 0;
for (int i = 1; i < 2 * n; i +... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 9690840c67ce068cd3fc7eaf004e6e2e | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.StringTokenizer;
public class Handle
{
public static void main (String [] args) throws IOException
{
InputStreamReader instream=new InputStreamReader (System.in);
BufferedReader input = new BufferedReader (instream);
int n=Integer.parseInt(input.readLine());
int j=1;
int c=0... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 50c08eefb78276efb366632959a89cd9 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeMap;
public class MishaAndChangingHandles {
public static void main(String[] args) throw... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | b2224046aaf7753f6b49c43e56c2bef1 | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.ByteArrayInputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
/**
* User: faer Date: 2/20/16
*/
public class ChangingHandles {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = Integer.parseInt(in.nextLine());
... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | d759485525f67cf10e686b150e17312d | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
public void solve() throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String [] str = br.readLine().split(" ");
int n = Integer.parseInt(str[0]);
String [] lectureWords = new String[n];
Map<Strin... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 0bfbeeea1132711e66bf42726fe62eea | train_003.jsonl | 1421053200 | Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is already used or that was used at some point.Misha has a list of handle change requests. After completing the requ... | 256 megabytes | import java.io.*;
import java.util.*;
public class ab22
{
public static void main(String agrs[])
{
int n;
int count=0;
Scanner s=new Scanner(System.in);
n=s.nextInt();
HashMap<String,String>hm=new HashMap<String,String>();
HashMap<String,String>hm1=new HashMap<String,String>();
for(int i=0;i<... | Java | ["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"] | 1 second | ["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"strings"
] | bdd98d17ff0d804d88d662cba6a61e8f | The first line contains integer q (1 ≤ q ≤ 1000), the number of handle change requests. Next q lines contain the descriptions of the requests, one per line. Each query consists of two non-empty strings old and new, separated by a space. The strings consist of lowercase and uppercase Latin letters and digits. Strings ol... | 1,100 | In the first line output the integer n — the number of users that changed their handles at least once. In the next n lines print the mapping between the old and the new handles of the users. Each of them must contain two strings, old and new, separated by a space, meaning that before the user had handle old, and after ... | standard output | |
PASSED | 0bae7bc54958607917d26e9a398c6664 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner SC = new Scanner(System.in);
int n=SC.nextInt();
long minendch=Long.MAX_VALUE, minendp=Long.MAX_VALUE, maxstartch=Long.MIN_VALUE, maxstartp=Long.MIN_VALUE;
for(int i=0; i<n; i++){
... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | ec21971cf6eae18eaedff5354cd9a823 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.io.*;
import java.util.*;
public class S {
static BufferedReader reader;
static StringTokenizer tokenizer;
/** call this method to initialize reader for InputStream */
static void init(InputStream input) {
reader = new BufferedReader(
new InputStreamReader(... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 955f3084e693b249bbf1cd9ca9407423 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class antonAndClasses {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int l1[] = new int[n];
int r1[] = new int[n];
for (int i = 0; i < n; i++)
... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 2e39764214b895b5664ad2f189474ce0 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;import java.io.*;import java.math.*;
public class Main
{
public static void process()throws IOException
{
int n=ni(),l_chess=0,r_chess=Integer.MAX_VALUE,l_prog=0,r_prog=Integer.MAX_VALUE;
//max l, min r
while(n-->0){
l_chess=Math.max(l_chess, ni());
... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 3bc063225d4f4cc145bfd76a707fd52b | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.Scanner;
public class anton_and_classes_785B{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int first_temp, second_temp;
int n = in.nextInt();
int chs_first_max, chs_second_min;
chs_first_max = Integer.MIN_VALUE;
chs_second_min = Integer.MAX_VALUE;
wh... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 3a05e65fa83696b368708bea604f8cff | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class Main
{
static int mod = 10000000... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 9e11a55c6840b8858beadecc7bc69d27 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | /* package codechef; // don't place package name! */
import java.math.BigInteger;
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Solution
{
// Complete the maximumSum function below.
public static class InputReader {... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 354148e2cf9cdd7a196aa5a283c1062d | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
HashMap <String,Integer> map = new HashMap<String,Integer>();
int maxValue = Integer.MIN_VALUE;
int minValue = Integer.MAX_VALUE;
int maxValue2 = Integer.MIN_VALUE;
int minVa... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 2b33fd7d864504fab45567f40cfdc543 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class Solution {
public static void main(String[] args) {
HashMap <String,Integer> map = new HashMap<String,Integer>();
int maxValue = 0;
int minValue = 1000000001;
int maxStep = 0;
Scanner sc = new Scanner(System.in);
int a = sc... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | dcb25ed42f586f5e6717754cff09c31b | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes |
/**
* @author egaeus
* @mail sebegaeusprogram@gmail.com
* @veredict Not sended
* @url <https://codeforces.com/problemset/problem/>
* @category ?
* @date 5/06/2020
**/
import java.io.*;
import java.util.*;
import static java.lang.Integer.*;
import static java.lang.Math.*;
public class CF785B {
public stat... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | d8abcb34441b29a37c9ce64abae2e345 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.io.*;
import java.util.*;
public class B {
public static void main(String[] args) throws IOException{
FastScanner sc = new FastScanner();
// int yo = sc.nextInt();
// while(yo-->0) {
// }
int n = sc.nextInt();
List<Pair> list1 = new ArrayList<>();
int min1 = Integer.MAX_VALUE;
int max1 ... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | fc8430ae86250b19eb7255edef50b655 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import com.sun.jdi.ArrayReference;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class Main {
public static void main(String[] args) {
FastScanner fs = new FastScanner();
int n = fs.nextInt();
... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | ca470e2621d96f016b8b9b8fc04ef4d4 | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
//Mann Shah [ DAIICT ].
public class Main {
static long mod = (long) (1e9+7);
static InputReader in;
static PrintWriter out;
static Debugger deb;
public static void main(String args[] ) throws NumberFormatException, IOException... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 5edecd63d4bc11c82858b30cb6b02eeb | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// File file = new File("input.txt");
// Scanner in = new Scanner(file);
// PrintWriter out = new PrintWriter(new FileWriter("output.txt"));
public static void main(String[] args) {
// Scanner in = new Scanner(System.in);
... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 85b63913395935e956ff397189a42c5e | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.util.*;
import java.lang.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int a[][]=new int[n][2];
int mina=Integer.MAX_VALUE,maxa=0,minb=Integer.MAX_VALUE,maxb=0;
for(int i=0;i<n;i++){
a[i][0]=sc.nextIn... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 5060eef7cb32e84516e3f59e4b4e151b | train_003.jsonl | 1489590300 | Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes.Anton has n variants when he will attend chess classes, i-th variant is given by a period of time (l1, i, r1, i). Also he has m variants when he will attend programming classes, i-th var... | 256 megabytes | import java.io.*;
import java.util.*;
public class d2prac implements Runnable
{
private boolean console=false;
public void solve()
{
int i;
int n=in.ni();
Integer cs[]=new Integer[n];
Integer ce[]=new Integer[n];
for(i=0;i<n;i++)
{
cs[i]=in.ni(); ce[i]=in.ni();
}
int m=in.ni();
Integer ps[]=ne... | Java | ["3\n1 5\n2 6\n2 3\n2\n2 4\n6 8", "3\n1 5\n2 6\n3 7\n2\n2 4\n1 4"] | 4 seconds | ["3", "0"] | NoteIn the first sample Anton can attend chess classes in the period (2, 3) and attend programming classes in the period (6, 8). It's not hard to see that in this case the distance between the periods will be equal to 3.In the second sample if he chooses any pair of periods, they will intersect. So the answer is 0. | Java 11 | standard input | [
"sortings",
"greedy"
] | 4849a1f65afe69aad12c010302465ccd | The first line of the input contains a single integer n (1 ≤ n ≤ 200 000) — the number of time periods when Anton can attend chess classes. Each of the following n lines of the input contains two integers l1, i and r1, i (1 ≤ l1, i ≤ r1, i ≤ 109) — the i-th variant of a period of time when Anton can attend chess classe... | 1,100 | Output one integer — the maximal possible distance between time periods. | standard output | |
PASSED | 1e4940a940d6ff43754a6edcac61613a | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.util.*;
public class LeastRoundWay {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int [][] board2 = new int[n][n];
boolean [][] prev2 = new boolean[n][n];
int [][] board5 = new int[n][n];
bo... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 9f847c9492285542725c6543e16b2f79 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes |
import java.io.*;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.StringTokenizer;
/**
* CodeForces 2B. The least round way
* Created by Darren on 14-9-3.
*/
public class Main {
Reader in = new Reader(System.in);
PrintWriter out = new PrintWriter(System.out);
public static void m... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | dccf208161a38f47ccde8e659c0241c8 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class TheLeastRoundWay {
static int [][] memo;
static int [][] twos;
static int [][] fives;
static int [][] memo1;
static int [][] memo2;
static String [][] way;
sta... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | ebaaa7a47fea30e2f33596887271e9bb | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class R002B {
static int n;
public static void main(String[] args) {
FastScanner in=new FastScanner();
PrintWriter out=new PrintWriter(System.out);
n=in.nextInt();
int[][] dp2... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | b37086df267f67ba4fcfa2971508784c | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | //package hw5;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.*;
public class LeastRound {
public static void solve(int n, Scanner readInput) {
int[][] twos = new int[n][n];
int[][] fives = new int[n][n];
int[][] twosTable = new int[n][n];
int[][] fivesTable =... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | b85e98e84d9b1b47119ce1279e2c0b10 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
* @author Lokesh Khandelwal aka (codeK... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 2944ff1038beaedd62b0f8336be66743 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.util.Scanner;
public class Code_2B {
public static void main(String[] args) {
int INF = 100000000;
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int[][] p5 = new int[n][n];
int[][] p2 = new int[n][n];
boolean[][] isZero = new boolean[n][n];
boolean haveZero = false;
int ze... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 5bd2a14d6e19ad0dc36ee1d21f20a01b | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.DataInputStream;
import java.io.InputStream;
public class TheLeastWay {
public static void main (String args[]) throws Exception{
FS in = new FS(System.in);
int n=in.nextInt();
int a[][]=new int[n][2];
boolean paret[][][]= new boolean[n][n][2];
int v= Integer.MAX_VALUE/2;
for(int i=1;i<n;i+... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | e5d5509a0f81fb895492df30a5fbba9e | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.DataInputStream;
import java.io.InputStream;
public class TheLeastWay {
public static void main (String args[]) throws Exception{
FS in = new FS(System.in);
Printer out = new Printer(System.out);
int n=in.nextInt();
int a[][]=new int[n][2];
boolean paret[][][]= new boolean[n][n][2];
int v= ... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 1d7342e0559ae526a140e7168f443030 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
impor... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 9729fa34b58276eb8c0e93b74bb4b4ab | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class C2B {
static int n, twos[][], fives[][];
static int rowNull = -1, colNull = -1;
public sta... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 3366de4f9521058d39b13cbc98dd9c95 | train_003.jsonl | 1267117200 | There is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right or down from the current cell; the way ends in the bottom right cell. Moreover, if we multiply together all the numbers a... | 64 megabytes | import java.io.*;
import java.util.*;
public class Problem2BUsingDPRevised
{
static boolean DEBUG=false;
static long startTime=0,endTime=0,totalTime=0;
public static void main(String[] args) throws Exception
{
if(DEBUG) startTime = System.currentTimeMillis();
BufferedReader br;
if(DEBUG)
... | Java | ["3\n1 2 3\n4 5 6\n7 8 9"] | 2 seconds | ["0\nDDRR"] | null | Java 7 | standard input | [
"dp",
"math"
] | 13c58291ab9cf7ad1b8c466c3e36aacf | The first line contains an integer number n (2 ≤ n ≤ 1000), n is the size of the matrix. Then follow n lines containing the matrix elements (non-negative integer numbers not exceeding 109). | 2,000 | In the first line print the least number of trailing zeros. In the second line print the correspondent way itself. | standard output | |
PASSED | 6608486b8687c43d945d51b846d1b06a | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.*;
import java.io.*;
public class NewYear {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
PrintWriter out = new PrintWriter( System.out);
int alen = sc.nextInt();
int blen = sc.nextInt();
String[] a = new Str... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 1b75b6340b6a947aeadd16539e99c8c8 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.io.*;
import java.util.*;
public class d2prac implements Runnable
{
private boolean console=false;
public void solve()
{
int i; int n=in.ni(); int m=in.ni(); String s[]=new String[n]; String t[]=new String[m];
for(i=0;i<n;i++)
s[i]=in.ns();
for(i=0;i<m;i++)
t[i]=in.ns();
int q=in.ni();
... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | eb615478239800ff5398cb703058b148 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int length_str1 = input.nextInt();
int length_str2 = input.nextInt();
String[] array1 = new String[length_str1];
String[] array2 = new Stri... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | a68febd77b38a7dd26243a30a2d6d1d4 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 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 Jaynil
*/
public class Main {
public static void main(String[] args) {
InputStream in... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 871120292d17a1d306976656f72b02bc | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 9c7073d74c288bc2fb9aeab0d942a504 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.Scanner;
public class x1284A {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int n=input.nextInt();
int m=input.nextInt();
String[] s=new String[n];
String[] t=new String[m];
for(int i=0;i<n;i++){
s[i]=inp... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 491364afb0e3d957f3478e00523e44db | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
FastScanner cin = new FastScanner(System.in);
int n = cin... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 564407e84871cbaddec4eb62a2724ac8 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collections;
import java.util.Scanner;
public class codeforces {
static Scanner stdin = new Scanner(System.in);
private int n, m, q;
private void solution() {
ArrayList<String>S = new ArrayList<String>();
ArrayList<Strin... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 8dc4b59c1031f418fbf764c7b2a74243 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.Scanner;
public class AAA {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int m = input.nextInt();
String str;
String[] str1 = new String[222];
int l1 = 0;
for (int i = 0; i < n... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 01cca612c7faa529a4d78f9a9325afe2 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes |
import java.io.*;
import java.util.*;
public class Solution {
//--START helper submission code
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] s = new String[sc.nextInt()];
String[] t = new String[sc.nextInt()];
for... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 1bcd00322337149f28f5ba27b17773c1 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes |
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String[] s = new String[sc.nextInt()];
String[] t = new String[sc.nextInt()];
for (int i = 0; i < s.length; ++i) {
s[i... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 219b1779452a0984ffd7da1538a3f3cf | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n,m,q;
n=scanner.nextInt();
m=scanner.nextInt();
String[] s = new String[n];
String[] t = new String[m];
for (int i = 0; ... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 8854998109be42440f6b158781e5d7fe | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | //problem: https://codeforces.com/problemset/problem/1284/A
import java.util.Scanner;
public class NewYearName{
public static void main(String[] args){
Scanner sObj = new Scanner(System.in);
int fLen = sObj.nextInt();
int sLen = sObj.nextInt();
sObj.nextLine();
String[] first... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | 9b930e6800e0c16a7b3253451a26eb40 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.io.*;
import java.util.*;
public class Main
{
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String nm[]=br.readLine().split(" ");
int n=Integer.parseInt(nm[0]);
int m=Integer.parseInt(nm[1]);
... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | e5067398f5facae23b43548614fec72d | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.*;
public class yearNames {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
int m = scan.nextInt();
scan.nextLine();
String s = scan.nextLine();
String t = scan.nextLine();
String[] sequenceS = s.split("\\s+");
String[] sequenceT ... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | d656522b9253d05031b23256bacccb6d | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class decdfault_t {
public static void main(String[] args) {
in = new FastReader();
int n=ni();
int m=ni();
String[] arr1=new String[n];
String[] arr2=new String[m... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | c6f8a392b4de20d71bf9db606f6a7549 | train_003.jsonl | 1578139500 | Happy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Korea to name the years.There are two sequences of $$$n$$$ strings $$$s_1, s_2, s_3, \ldots, s_{n}$$$ and $$$m$$$ strings $$$t... | 1024 megabytes | import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int m = scanner.nextInt();
String[] table1 = new String[n];
String[] table2 = new String[m];
for (int i = 0; i < n... | Java | ["10 12\nsin im gye gap eul byeong jeong mu gi gyeong\nyu sul hae ja chuk in myo jin sa o mi sin\n14\n1\n2\n3\n4\n10\n11\n12\n13\n73\n2016\n2017\n2018\n2019\n2020"] | 1 second | ["sinyu\nimsul\ngyehae\ngapja\ngyeongo\nsinmi\nimsin\ngyeyu\ngyeyu\nbyeongsin\njeongyu\nmusul\ngihae\ngyeongja"] | NoteThe first example denotes the actual names used in the Gapja system. These strings usually are either a number or the name of some animal. | Java 11 | standard input | [
"implementation",
"strings"
] | efa201456f8703fcdc29230248d91c54 | The first line contains two integers $$$n, m$$$ ($$$1 \le n, m \le 20$$$). The next line contains $$$n$$$ strings $$$s_1, s_2, \ldots, s_{n}$$$. Each string contains only lowercase letters, and they are separated by spaces. The length of each string is at least $$$1$$$ and at most $$$10$$$. The next line contains $$$m$... | 800 | Print $$$q$$$ lines. For each line, print the name of the year as per the rule described above. | standard output | |
PASSED | af963437612f6ff48b072eed966a13d2 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Integer.max;
public class ThePhoneNumber implements Closeable {
private InputRe... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | 1e2d42e6c1c765ebc6cdd1bc110f0fbd | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | /*
* Author: Minho Kim (ISKU)
* Date: August 8, 2018
* E-mail: minho.kim093@gmail.com
*
* https://github.com/ISKU/Algorithm
* http://codeforces.com/problemset/problem/1017/C
*/
import java.io.*;
public class C {
private static void solve() {
int N = io.nextInt();
int lis = (int) Math.sqrt(N);
int lds =... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output | |
PASSED | bd3b3ebded297ebc3a46541f47113072 | train_003.jsonl | 1533737100 | Mrs. Smith is trying to contact her husband, John Smith, but she forgot the secret phone number!The only thing Mrs. Smith remembered was that any permutation of $$$n$$$ can be a secret phone number. Only those permutations that minimize secret value might be the phone of her husband.The sequence of $$$n$$$ integers is ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHel... | Java | ["4", "2"] | 1 second | ["3 4 1 2", "2 1"] | NoteIn the first sample, you can build a permutation $$$[3, 4, 1, 2]$$$. LIS is $$$[3, 4]$$$ (or $$$[1, 2]$$$), so the length of LIS is equal to $$$2$$$. LDS can be ony of $$$[3, 1]$$$, $$$[4, 2]$$$, $$$[3, 2]$$$, or $$$[4, 1]$$$. The length of LDS is also equal to $$$2$$$. The sum is equal to $$$4$$$. Note that $$$[3,... | Java 8 | standard input | [
"constructive algorithms",
"greedy"
] | 6ea899e915cfc95a43f0e16d6d08cc1e | The only line contains one integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the length of permutation that you need to build. | 1,600 | Print a permutation that gives a minimum sum of lengths of LIS and LDS. If there are multiple answers, print any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.