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
b021a77858c71881472cfff91def6391
train_001.jsonl
1600526100
An agent called Cypher is decrypting a message, that contains a composite number $$$n$$$. All divisors of $$$n$$$, which are greater than $$$1$$$, are placed in a circle. Cypher can choose the initial order of numbers in the circle.In one move Cypher can choose two adjacent numbers in a circle and insert their least co...
256 megabytes
import java.io.PrintWriter; import java.util.*; public class Main extends PrintWriter { public Main() { super(System.out); } public static void main(String[] args) { Scanner s = new Scanner(System.in); Main main = new Main(); int n = s.nextInt(); while (n-- > 0) { ...
Java
["3\n6\n4\n30"]
1 second
["2 3 6 \n1\n2 4 \n0\n2 30 6 3 15 5 10 \n0"]
NoteIn the first test case $$$6$$$ has three divisors, which are greater than $$$1$$$: $$$2, 3, 6$$$. Regardless of the initial order, numbers $$$2$$$ and $$$3$$$ are adjacent, so it's needed to place their least common multiple between them. After that the circle becomes $$$2, 6, 3, 6$$$, and every two adjacent number...
Java 11
standard input
[ "constructive algorithms", "implementation", "number theory", "math" ]
406f8f662d2013d87b36dacca663bef5
The first line contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases. Next $$$t$$$ lines describe each test case. In a single line of each test case description, there is a single composite number $$$n$$$ $$$(4 \le n \le 10^9)$$$ — the number from the message. It's guaranteed that the total num...
2,100
For each test case in the first line output the initial order of divisors, which are greater than $$$1$$$, in the circle. In the second line output, the minimal number of moves needed to decrypt the message. If there are different possible orders with a correct answer, print any of them.
standard output
PASSED
23e8c1f551ce264ac4e608829fa4b3cd
train_001.jsonl
1600526100
An agent called Cypher is decrypting a message, that contains a composite number $$$n$$$. All divisors of $$$n$$$, which are greater than $$$1$$$, are placed in a circle. Cypher can choose the initial order of numbers in the circle.In one move Cypher can choose two adjacent numbers in a circle and insert their least co...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static long mod = 1000000007; static class Point{ int x, y; Point(int nx, int ny){ x = nx; y = ny; } } public static void main(String[] args) throws IOException{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int q = p...
Java
["3\n6\n4\n30"]
1 second
["2 3 6 \n1\n2 4 \n0\n2 30 6 3 15 5 10 \n0"]
NoteIn the first test case $$$6$$$ has three divisors, which are greater than $$$1$$$: $$$2, 3, 6$$$. Regardless of the initial order, numbers $$$2$$$ and $$$3$$$ are adjacent, so it's needed to place their least common multiple between them. After that the circle becomes $$$2, 6, 3, 6$$$, and every two adjacent number...
Java 11
standard input
[ "constructive algorithms", "implementation", "number theory", "math" ]
406f8f662d2013d87b36dacca663bef5
The first line contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases. Next $$$t$$$ lines describe each test case. In a single line of each test case description, there is a single composite number $$$n$$$ $$$(4 \le n \le 10^9)$$$ — the number from the message. It's guaranteed that the total num...
2,100
For each test case in the first line output the initial order of divisors, which are greater than $$$1$$$, in the circle. In the second line output, the minimal number of moves needed to decrypt the message. If there are different possible orders with a correct answer, print any of them.
standard output
PASSED
60455b9fd8a3b16d3c4e8234c72031b9
train_001.jsonl
1600526100
An agent called Cypher is decrypting a message, that contains a composite number $$$n$$$. All divisors of $$$n$$$, which are greater than $$$1$$$, are placed in a circle. Cypher can choose the initial order of numbers in the circle.In one move Cypher can choose two adjacent numbers in a circle and insert their least co...
256 megabytes
import java.io.*; import java.util.*; public class Main { InputStream is; PrintWriter out; String INPUT = ""; long MAX = 100000L, MOD = 1000000007L, INF = (long) 1e18; void solve(int TC) throws Exception { int n = ni(); TreeSet<Integer> factors = new TreeSet<>(); for(int i=...
Java
["3\n6\n4\n30"]
1 second
["2 3 6 \n1\n2 4 \n0\n2 30 6 3 15 5 10 \n0"]
NoteIn the first test case $$$6$$$ has three divisors, which are greater than $$$1$$$: $$$2, 3, 6$$$. Regardless of the initial order, numbers $$$2$$$ and $$$3$$$ are adjacent, so it's needed to place their least common multiple between them. After that the circle becomes $$$2, 6, 3, 6$$$, and every two adjacent number...
Java 11
standard input
[ "constructive algorithms", "implementation", "number theory", "math" ]
406f8f662d2013d87b36dacca663bef5
The first line contains an integer $$$t$$$ $$$(1 \le t \le 100)$$$ — the number of test cases. Next $$$t$$$ lines describe each test case. In a single line of each test case description, there is a single composite number $$$n$$$ $$$(4 \le n \le 10^9)$$$ — the number from the message. It's guaranteed that the total num...
2,100
For each test case in the first line output the initial order of divisors, which are greater than $$$1$$$, in the circle. In the second line output, the minimal number of moves needed to decrypt the message. If there are different possible orders with a correct answer, print any of them.
standard output
PASSED
aefa4a494c735d15ffcfce439b7b9280
train_001.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 Main { static ArrayList<Integer> adj[]; static char color[]; static boolean b[],visited[],possible; static Map<Integer,HashSet<Integer>> s; static int totalnodes,colored; static int count[]; static long sum[]; public static void main(String[] args) throws IOEx...
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
64e11468536d92dcd11287371db98ec7
train_001.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 { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int q = nextInt(); TreeMap<String, String> a = new TreeMa...
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
23b7e4aa1cfb72f00690d9782e3690be
train_001.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 { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); int n = nextInt(); TreeMap<String, String> a = new TreeMa...
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
b46f970cdf9a51be5ab2c773465bf467
train_001.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 static java.lang.Integer.parseInt; import java.util.HashMap; import java.util.StringTokenizer; public class Main { static HashMap<String, String> map = new HashMap<String, String>(); static String x, y; p...
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
65e6908dcfe0f2f55e45d86134ec73fe
train_001.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 gibberish { public static void main(String[] args) throws Exception { FastScanner sc = new FastScanner(System.in); PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(System.out))); int n = sc.nextInt(); String[] first = new 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
40db55124a6996382445bddb7f31772c
train_001.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; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author Ibrahim Ali */ public class BMishaAndChangingHandles { ...
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
b57ffa33797c2f0c4f8904f80f12de48
train_001.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.BufferedOutputStream; import java.io.BufferedReader; import java.io.FileOutputStream; 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.HashMap; import java.util.S...
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
16019d5bc1c8ef0c5f9b68fcc700a478
train_001.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
//package javaapplication1; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; 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
5ee439f17b5df9efb26e84b6b0a305b9
train_001.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
//package javaapplication1; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; import java.util.stream.Collectors; import sun.awt.HKSCS; public clas...
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
c121cc24063ee4d48c892098a3b57e99
train_001.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
//package cf; import java.util.Scanner; public class water2 { public static Scanner cin = new Scanner(System.in); public static void main(String[] args) { while(cin.hasNext()) { int n=cin.nextInt(); String[][] str=new String[n][2]; for(int i=0;i<n;i++) { str[i][0]=cin.next(); str[i][1]=cin.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
9b8ccdae6f8e4291b0433fede646e56d
train_001.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
//package cf; import java.util.HashMap; import java.util.Scanner; public class water2 { public static Scanner cin = new Scanner(System.in); public static void main(String[] args) { while(cin.hasNext()) { int n=cin.nextInt(); HashMap<String,String> map=new HashMap<String, String>(); for(int i=0;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
e4c1c53b22a3ff6d7a241ecafebb029f
train_001.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; public class Misha_and_Changing_Handles { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int q=scanner.nextInt(); HashMap<String, String> hMap=new HashMap<>(); HashMap<String, String> hMap2=new ...
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
6ad08c80d94c58ac8142f0d7c9220223
train_001.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.lang.Math; import java.util.Arrays; import java.util.Scanner; import java.util.stream.IntStream; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; pu...
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
cd39e0a2b5089871edd2445a17bca71e
train_001.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.Set; import java.util.Scanner; public class Practice { public static void main(String args[]) { int q,ans=0; HashMap<String,String> map = new HashMap<>(); String str1,str2; 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
9ede571d676a05b14ed85b7db40fae69
train_001.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 Random { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int temp=n; Map<String,String> m=new HashMap<>(); while(temp>0){ m.put(...
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
a0f24f141fbcdbfd75b13d3a1526236f
train_001.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 Random { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int temp=n; Map<String,String> m=new HashMap<>(); while(temp>0){ m.put(...
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
906d5375b2e2ce976131bad7dde7587a
train_001.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 Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); Map<String, String> graph = new HashMap<>(); List<String> origins = new LinkedList<>(); int q = Integer.parseI...
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
706c48ee4f9016c5421e43ec218f70d9
train_001.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 MishaChangingHandles { public static void main(String[] args) { Map<String, String> edges = new HashMap(); Set<String> children = new HashSet(); Map<String, String> results = new HashMap(); Scanner sc = new Scanner(System.in); int n = sc.nex...
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
83165317ec611fa102dcb2192894d826
train_001.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.HashSet; import java.util.StringTokenizer; public class MishaandChangingHandles { /** * @param args */ static HashMap<String, String> h...
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
306afa4735da729323bec0642439e176
train_001.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 codeforces { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList <String> al=new ArrayList<>(); String arr[][]=new String[n][2]; int counter=0; for(int j =...
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
713239953520b977bffc38a401c645e8
train_001.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.*; import java.nio.charset.StandardCharsets; // import java.math.BigInteger; // remember to check if n=0, n=1 are special cases public class B { static Writer wr; public static void main(String[] args) throws Exception { // long startTime = System.nanoTime(); ...
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
d5c1db2113ec644b702e8468e0bedac8
train_001.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.Scanner; public class CF501B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap<String, User> map = new HashMap<>(); while(n-->0) { String oldName = sc.next(); String newName = sc.next(); if(!map.con...
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
fba536ce6ab56c94e35c1d2b04412841
train_001.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 Main { static Graph g; static int n ; public static void main(String[] args) { InputReader in = new InputReader(System.in); OutputWriter out = new OutputWriter(System.out); Hashtable<String,Integer> h = new Hashtable<>(); ...
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
ee19618ace020e9b5133952c0f5452dc
train_001.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 solution{ public static void main(String[] args){ Scanner in=new Scanner(System.in); String[][] handles=new String[1000][2]; int tc=in.nextInt(); handles[0][0]=in.next(); handles[0][1]=in.next(); int ind=1; for(int i=1;i<tc;++i){ String old=in.next(); String news=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
402c4542401718cc18b9cb4f99680740
train_001.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
//package com.company; import java.util.*; public class Main { public static void main(String[] args) { Solve solve = new Solve(new Scanner(System.in)); solve.start(); } private static class Solve { private final Scanner SCANNER; private String []names; private ...
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
a480b5be6ad067821aced9d747624f89
train_001.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 { private static final Boolean FILE_IO_ENABLE = false; private static final Integer BUFFER_SIZE = 1 << 12; private static final String INPUT_FILE_NAME = "input.txt"; private static final String OUTPUT_FILE_NAME = "output.txt"; private static...
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
f6ec511a2e1a8c353071de7a64a77edf
train_001.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.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; public class B { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ni(); HashMap<String,String> map = new HashMap<>(); HashSet<String> left ...
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
1aab5d797428b765097a3e00213bec2d
train_001.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 PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { // write your code here ...
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
1b5285b424e0aa24bbaead923e8391ca
train_001.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.*;//1 1 2 3 3 2 2 4 8 8 public class r{ public static void main(String[] args)throws IOException{ File f=new File("/home/ujjwal/Desktop/new.txt"); BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); //BufferedWriter output = new BufferedWriter(new Output...
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
465dd3d74bca41bcf778d3f96bfcc468
train_001.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.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { try { BufferedReader br=new BufferedReader(new InputStreamReader(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
a3a8e46aba4d9f7ec6c40b099dcf3585
train_001.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.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashM...
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
5ae12ad746088cb970514f26355b1620
train_001.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
/* by Fuzious 7/5/2019 */ import java.io.*; import java.util.*; public class codeforces { public static void main(String[] args) { InputReader sc = new InputReader(System.in); int N=sc.nextInt(); Map<String,Integer> HM=new HashMap<>(); String q[]=new String[2*N]; fo...
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
455628c5e154ba43bd7e7434e6e2bb33
train_001.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.lang.*; public class C501 { public static void main(String[] args){ Scanner z = new Scanner (System.in); final int maxn = 1005; boolean ok; String s[]= new String[maxn], t[] = new String[maxn], a, b, c; String item[] = new String[4]; int q=z.nextInt(), n=0, x=0;c=z.nextLine(...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
5565092432579c04c88d15254c6904a5
train_001.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.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.io.IOException; import java.util.Set; import java.util.StringTokenizer; /** * Built using CHelper plug-in * Actual solution is at...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
c2467920641ef80da5e29d0f8f48dfd3
train_001.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.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class MainB { MyScanner sc = new MyScanner(); Scanner sc2 = new Scanner(System.in); final int MOD = 1000000007; int[] dx = { 1, 0, 0, -1 }; int[] dy = { 0, 1, -1, 0 }; void r...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
5acb1d7f8ce16877f9d93bfd319c6e0e
train_001.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.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Unsupported...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
11411e0ecdf83db8c8d44fd99f03ce45
train_001.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.io.PrintWriter; import java.util.HashMap; public class Main { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); PrintWri...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
ba2c8e6678f51cd8cb978e83b95bfb63
train_001.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 per { public static void main(String []args) { Scanner s=new Scanner(System.in); int n=Integer.parseInt(s.nextLine()); String a[]=new String[n]; String b[]=new String[n]; for(int i=0;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 6
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
f26f976ce809b00a390eefd0dc31fca5
train_001.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.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class B { void run(){ Scanner sc = new Scanner(System.in); int Q = sc.nextInt(); Map<String, String> res = new HashMap<String, String>(); while(Q--!=0){ String old ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
ca7435e589969e863a7abb0390d1e2d2
train_001.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
//package Contest_Div285; //Xudo xoxlasa Accepted; import java.util.Scanner; import java.util.TreeMap; public class B { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); TreeMap<String, String>mp1=new TreeMap<String, String>(); TreeMap<String, String>mp2=new TreeMap<St...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
d0aed512d31f1c6347e2ba6b686b81ee
train_001.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
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Ideone { public static void main (String[] args) throws java.lang.Exception { Scanner obj=new Scanner(System...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 6
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
97e9252e6788fcd133d08cafe2c4db0d
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.*; public class Main{ static long m=998244353l; //line 156 modInverse static boolean[] vis; //line 74 and 91 hasElement ans pth_fnd public static void main(String[] args) throws IOException{ // long sttm=System.currentTime...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
34685cd70405358193981f59a4cc2eaa
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.*; import java.util.*; public class Anti { public static void main(String [] args) { Scanner in = new Scanner (System.in); int t = in.nextInt(); for(int cs = 1; cs <= t; cs++) { char s[][] = new char [9][9]; for(int i = 0; i < 9; i++) { s[i] = in.next().toCharArray(); ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
b551ca4eb5467db4cc91baa621524b05
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.Scanner; public class antiSudoku { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); StringBuilder ans = new StringBuilder(); while (--T >= 0) { StringBuilder matrix = new StringBuilder(); for (int i = 0; i < 9; i++) matrix.append(sc...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
c48907f30133f7ee5a61e2f68b9f0ae7
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.*; public class AntiSudoku{ public static void main(String args[]){ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); try{ int t=Integer.parseInt(br.readLine()); while(t-- >0){ int[][] s=new int[9][9]; ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
703328eb8d1d69eef7d32e2914453540
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.lang.*; public class Main{ public static void main(String []args){ Scanner in = new Scanner(System.in); int t=in.nextInt(); in.nextLine(); while(t>0) { String[] s = new String[9]; ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
ce84a7fa7e8e60774b79f2fabaae07a2
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; public class A { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[][] arr = new int[9][9]; StringBuffer out = new...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
5e51544af4f6c36d71f9a3fbb5b786d7
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(System.out); int t = nextInt(); for (int q = 0; q < ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
765612737946a158abc3ecab9b250b97
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; public class Solution{ public static void main(String[]args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); StringBuffer sb = new StringBuffer(); while(t-->0){ int[][]arr=new int[9][9]; for(int i = 0;i<9;i++){ S...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
f571a2f647f70184b25a8e660b76d4b6
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.awt.datatransfer.FlavorEvent; import java.io.*; import java.util.*; import java.util.concurrent.CountDownLatch; public class Main { private static void solver(InputReader sc, PrintWriter out) throws Exception { int test = sc.nextInt(); for(int ii=0; ii<test; ii++) { int ar...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
cccb654ff4783e2c0cd2160327c9be28
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.lang.reflect.Array; import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int t = sc.nextInt(); for (int i=0; i<t; i++) { StringBuilder sb = new StringBu...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
c22d78ee3aa0e8c86746f941c7687436
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.*; import java.util.*; public class Main { static ArrayList<Integer>[] gr; static boolean[] was; static boolean[] want_h; static int to; static boolean ans; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System....
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
662ea42577285707a99974e01de150ac
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class D{ public static void main(String[] args) throws IOException{ sc.init(System.in); int T = sc.nextInt()...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
b6cc0fb712d342f091ee5ff6607efb33
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // Scanner sc=new Scanner(System.in); FastReader sc=new FastReader(); Writer w=new PrintWriter(System.out); int t=sc.nextInt(); while(t-->0){ String[] s...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
33ffdf0fe1ac716587cb2dd080d24aca
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
// @uthor -: puneet // TimeStamp -: 26/03/20 import java.io.*; import java.util.*; public class Q4 implements Runnable { private boolean testCases=true; private boolean console=false; private long MOD = 1000_000_007L; private int MAX = 1000_001; char[][] arr=new char[9][]; void change(int ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
deca2cc5871f4fed32f10135eb8406a1
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class Cf182 implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCha...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
67df4ef500a3819cb14c8239bd525d3d
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.Scanner; import java.util.*; public class Power { static long power(int a,int b){ if(b==0) return 1; long pow=power(a,b/2); if(b%2!=0){ return pow*pow*a; } else{ return pow*pow; } } static long gcd(long a,lo...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
3eecef105a5cd64b9ce345005a02e119
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.Scanner; public class AntiSudoku { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tests = sc.nextInt(); for(int t=0; t<tests; t++) { String ans[] = new String[9]; int index = 0; int row = 0; for(int i=0; i<3; i++) { String str1 = s...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
25cf3210e7b0934ea4e04a4187c486eb
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class D1335Unsolved { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new Bu...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
1ca35e06f868f4877418d8b90a6c1dfd
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) throws IOException { PrintWriter out = new PrintWriter(System.out); //Scanner sc = new Scanner(); Reader in = new Reader(); Main solver = new Main(); solver....
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
807705a994491faf9f1f7ad5e84d737d
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.*; public class ProblemD { public static PrintWriter out; public static void main(String[] args) { MyScanner sc = new MyScanner(); //out = new PrintWriter(new BufferedOutputStream(System.out)); int cases = sc.nextInt(); int[][] ar = new int[9]...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
33dc6619bd5655f3b40a62f5d9ca8fe4
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
/****************************************************************************** Online Java Compiler. Code, Compile, Run and Debug java program online. Write your code in this editor and press "Run" button to execute it. *****************************************************...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
baaaf9285b1ecb43f7aba5f948b069ff
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
/* package codechef; // don't place package name! */ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.util.*; public class HelloWorld{ public static void main(String[] args) throws IOException { ...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
a7bc7bee5b023b4d69012929aa3ee35f
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws Exception { InputStreamReader r = new InputStreamReader...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
23a9cec4e77e1b3dd0a889cc6435ae57
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; public class AntiSudoku{ static Scanner in=new Scanner(System.in); public static void main(String array[]){ int t=in.nextInt(); while(t-->0){ StringBuffer sudoku[]=new StringBuffer[9]; for(int i=0;i<9;i++){ sudoku[i]=new StringBuffer(in.next()); } for(int...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
2a5132bb02ecb2b122eb0244432db1e0
train_001.jsonl
1586788500
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black color.Your task is to change at most $$$9$$$ elements of this field (i.e. choose some $$$1 \le i, j \le 9$$$ and cha...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { FastReader sc = new FastReader(); int t = sc.nextInt(); while (t-->0) { for (int i = 1; i <=9;i++) { String s = sc.nextLine(); int idx = s.indexOf(...
Java
["1\n154873296\n386592714\n729641835\n863725149\n975314628\n412968357\n631457982\n598236471\n247189563"]
2 seconds
["154873396\n336592714\n729645835\n863725145\n979314628\n412958357\n631457992\n998236471\n247789563"]
null
Java 11
standard input
[ "constructive algorithms", "implementation" ]
0e21f1c48c8c0463b2ffa7275eddc633
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. Each test case consists of $$$9$$$ lines, each line consists of $$$9$$$ characters from $$$1$$$ to $$$9$$$ without any whitespaces — the correct solution of the sudoku puzzle.
1,300
For each test case, print the answer — the initial field with at most $$$9$$$ changed elements so that the obtained field is anti-sudoku. If there are several solutions, you can print any. It is guaranteed that the answer exists.
standard output
PASSED
b2bc05820550935ab2d3775fa596a6b1
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.util.Scanner; // 2500 public class CrosswordExpert1194F { static final long MOD = 1_000_000_007; static long n; static long T; static long[] t; // [0] = 0, [1:] = input, [n + 1] = T public static void main(String[] args) throws Exception { try (Scanner scanner = new Scanner(...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
904be0454090aa6ae363e02f8b8d169a
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
/** * author: derrick20 * created: 10/3/20 12:50 AM */ import java.io.*; import java.util.*; public class CrosswordExpertBruteForce implements Runnable { public static void main(String[] args) throws Exception { new Thread(null, new CrosswordExpertBruteForce(), ": )", 1 << 28).start(); } publi...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
d98b12c33676fcabc6d78a584610d277
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
/** * author: derrick20 * created: 10/3/20 12:50 AM */ import java.io.*; public class CrosswordExpertSimple implements Runnable { public static void main(String[] args) throws Exception { new Thread(null, new CrosswordExpertSimple(), ": )", 1 << 28).start(); } public void run() { FastS...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
81a4c2a8b171a5b4c252e9555f3ca679
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.util.*; import java.io.*; public class CrosswordExpert { public static long MOD = 1000000007; public static int MAXN = 200005; public static long[] fact; public static long[] invfact; public static void main(String[] args) throws IOException{ BufferedReader f = new BufferedReade...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
fc246df55ceaa4ffbc1eb4513c6e5ad4
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
8dbda9f815a2a9d1a02f246cacacef9b
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.charset.Charset; import java.util.Arrays; import java.util.Random; public class CFContest { public static void main(String[] args) throws Exception { boolean local = System...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
24f944452538ff403f8c3e01daedc4db
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.function.IntPredicate; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java....
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
49219f24e709421e145804664a4009c7
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /** * Built using CHel...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
51be5da0418b81778fe668ed5946cd4f
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /** * Built using CHel...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
fc8dfbd9fe6c280d59986207ec591d46
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /** * Built using CHel...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
5f773776605d16f33f91b812f2578fa5
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; /** * Built using CHelper...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
f655cd4c3106381590e4a68126bbcbb6
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.function.IntPredicate; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java....
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
26ed5740d7d205cfceb9aac81e858a27
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.IOException; import java.io.InputStreamReader; import java.util.function.IntPredicate; import java.util.ArrayList; import java.util.StringTokenizer; import java.io.BufferedReader; import java....
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
d23d37613ccefbafa5630dcc9de7549e
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
//package educational.round68; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; public class F { InputStream is; PrintWriter out; String INPUT = ""; void solve() { int n = ...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
c319e23641b9bf02cebcd8b34dcc7e4e
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
//package ContestEd68; import java.io.*; import java.util.StringTokenizer; public class mainF { public static PrintWriter out = new PrintWriter(System.out); public static FastScanner enter = new FastScanner(System.in); public static long fact[]; public static long mod = (long) (1e9) + 7; public st...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
cac51284a47d7527159d37105b4c02ea
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.*; import java.util.*; public class F implements Runnable { public static void main (String[] args) {new Thread(null, new F(), "_cf", 1 << 28).start();} long MOD = (long)1e9+7; int MOD2 = 500000004; int MAX = 200200; long[] fact, inv, invFact; public void run() { FastScanner fs = new FastScan...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
26f0a547a8cd0f6084f7d542c916a8f2
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** What do you think? What do you think? 1st on Billboard, what do you think of it Next is a Grammy, what do you think of it However you think, I’m sorry, but shit, I have no fcking inter...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
98b60e39d060eba779baacd04ca3f31c
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
d12517d88a58f6244ba9416c6fa2cf53
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
691786a106cad560763ea91109ee9387
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
5cbca80494963e5c76759fd088909644
train_001.jsonl
1563115500
Today Adilbek is taking his probability theory test. Unfortunately, when Adilbek arrived at the university, there had already been a long queue of students wanting to take the same test. Adilbek has estimated that he will be able to start the test only $$$T$$$ seconds after coming. Fortunately, Adilbek can spend time w...
256 megabytes
import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class template { public static void main(String[] args) throws Exception { new template().run(); } public void run() throws Exception { FastScanner f = new FastScanner(); PrintWriter out = new PrintWriter(System.out); int ...
Java
["3 5\n2 2 2", "3 5\n2 1 2"]
2 seconds
["750000007", "125000003"]
NoteThe answer for the first sample is equal to $$$\frac{14}{8}$$$.The answer for the second sample is equal to $$$\frac{17}{8}$$$.
Java 8
standard input
[ "dp", "combinatorics", "two pointers", "number theory", "probabilities" ]
a44cba5685500b16e24b8fba30451bc5
The first line contains two integers $$$n$$$ and $$$T$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$1 \le T \le 2 \cdot 10^{14}$$$) — the number of crosswords and the time Adilbek has to spend, respectively. The second line contains $$$n$$$ integers $$$t_1, t_2, \dots, t_n$$$ ($$$1 \le t_i \le 10^9$$$), where $$$t_i$$$ is the...
2,400
Print one integer — the expected value of the number of crosswords Adilbek solves in $$$T$$$ seconds, expressed in the form of $$$P \cdot Q^{-1} \bmod (10^9 + 7)$$$.
standard output
PASSED
6a79c37ba4fe8f3ac2694e7b035025d1
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.util.*; import java.io.*; import java.util.Map.*; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = n...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
06e521c5bb77e267b7a754332a339667
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.util.*; import java.io.*; public class E669 { public static void main(String[] args) throws IOException { FS input = new FS(System.in); PrintWriter out = new PrintWriter(System.out); int n = input.nextInt(); int[] as = new int[n], ts = new int[n], xs = new int[n]; for(int i = 0; i<n; i++) { as[i] = ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
e26b33b1ef7feb59e3e8e1a7a023daab
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class E { static class Data { int[] add; int[] sub; int n; public Data(int n) { this.n = n; add = new int[n+1]; sub = new int[n+1]; } public void query(int type, i...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
f2682d974c2253f0ba97b98e19d0c9e0
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.util.*; import java.io.*; public class CF669E{ public static int index; public static void main(String[] args)throws Exception { InputReader in = new InputReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); HashMap<Integer, ArrayList<ArrayList<Inte...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
b4fba5ff08930901143cfec11effa86c
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
/* / フフ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ム / )\⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ Y (⠀⠀| ( ͡° ͜ʖ ͡°)⠀⌒(⠀ ノ (⠀ ノ⌒ Y ⌒ヽ-く __/ | _⠀。ノ| ノ。 |/ (⠀ー '_人`ー ノ ⠀|\  ̄ _人'彡ノ ⠀ )\⠀⠀ 。⠀⠀ / ⠀⠀(\⠀ #⠀ / ⠀/⠀⠀⠀/ὣ====================D- /⠀⠀⠀/⠀ \ \⠀⠀\ ( (⠀)⠀⠀⠀⠀ ) ).⠀) (⠀⠀)⠀⠀⠀⠀⠀( | / |⠀ /⠀⠀⠀⠀⠀⠀ | / [_] ⠀⠀⠀⠀⠀[___] */ // Main Code at the Bottom import ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
364eea369ddd8afce077ed6c83363861
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Map; import java.util.Scanner; import java.util.HashMap; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
235c9592755662c087426634d11bd4cd
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
//package baobab; import java.io.*; import java.util.*; public class E { public static void main(String[] args) { EIO io = new EIO(); try { Esolver solver = new Esolver(io); } finally { io.close(); } } } class Esolver { public Esolver(EIO io) { ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
6536b35458e4ee2c459a6a954c1f37d7
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Solve4 { public static void main(String[] args) { MyScanner scanner = new MyScanner(); PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); int q = scanner.nextInt(); int[][] t = new int[3][q]; int[] res = new int[q]; ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
541c4c28e976a858718fee0b1e1aa714
train_001.jsonl
1461515700
Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multiset.Artem wants to create a basic multiset of integers. He wants these structure to support operations of three types...
256 megabytes
import java.util.*; import java.lang.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.*; import java.math.*; public class Main { public static void main(String[] args) throws Exception{ Reader.init(System.in); ...
Java
["6\n1 1 5\n3 5 5\n1 2 5\n3 6 5\n2 3 5\n3 7 5", "3\n1 1 1\n2 2 1\n3 3 1"]
2 seconds
["1\n2\n1", "0"]
null
Java 8
standard input
[ "data structures" ]
39d7cf2640284689d074accfca527ecc
The first line of the input contains a single integer n (1 ≤ n ≤ 100 000) — the number of Artem's queries. Then follow n lines with queries descriptions. Each of them contains three integers ai, ti and xi (1 ≤ ai ≤ 3, 1 ≤ ti, xi ≤ 109) — type of the query, moment of time Artem travels to in order to execute this query ...
2,000
For each ask operation output the number of instances of integer being queried at the given moment of time.
standard output
PASSED
db30f38028a6f5552fe634df0560b633
train_001.jsonl
1398612600
As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation:A swap operation is the following sequence of actions: choose two indexes i, j (i ≠ j); perform assignments tmp = a[i], a[i] = a[j], a[j] = tmp. What maximum value of function m(a) can Sereja get if he is allowed ...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; public class Rextester{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st1 = new StringTokenizer(br.readLine()); StringTokenizer st...
Java
["10 2\n10 -1 2 2 2 2 2 2 -1 10", "5 10\n-1 -1 -1 -1 -1"]
1 second
["32", "-1"]
null
Java 11
standard input
[ "two pointers", "sortings", "brute force" ]
ff69d22bc683e5d1d83438585224c774
The first line contains two integers n and k (1 ≤ n ≤ 200; 1 ≤ k ≤ 10). The next line contains n integers a[1], a[2], ..., a[n] ( - 1000 ≤ a[i] ≤ 1000).
1,500
In a single line print the maximum value of m(a) that Sereja can get if he is allowed to perform at most k swap operations.
standard output