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
f9991ac4979222ed3714dd118754a9db
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
//Code by Sounak, IIEST import java.io.*; import java.math.*; import java.util.*; import java.util.Arrays; public class Test1{ public static void main(String args[])throws IOException{ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[2*n]; int i,j; for(i...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
f03aa75ddc10e06bbbc65d2df0b76958
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { FastReader fr = new FastReader(); OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); int n = fr.nextInt()...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
b57443ba03055f2acc2e3d06565f8973
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.util.*; import java.io.*; import java.io.FileWriter; import java.math.BigInteger; // Solution public class Main { public static void main (String[] argv) { new Main(); } boolean test = false; final int[][] dirs8 = {{0,1}, {0,-1}, {-1,0}, {1,0}, {1,1},{1,-1},{-1,1},{-1,-1}}; ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
53c9bc201566c018d9bf0679622229cd
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.util.Random; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
d489f6fe13c969cd744780be012ba3a1
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.lang.reflect.Array; import java.util.Arrays; import java.util.Scanner; public class SkyPhoto { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n*2]; for (int k = 0; k < 2*n; k++){ arr[k] ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
9ff29c53fa50f50f639d949ea3d2552e
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.util.*; import java.io.*; public class A { static final boolean stdin = true; static final String filename = ""; static FastScanner br; static PrintWriter pw; public static void main(String[] args) throws IOException { if (stdin) { br = new FastScanner(); pw = new PrintWriter(new OutputStr...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
aecdfc1c502e3a4b876c9bc34a4c067e
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
0ff1a8564124e583d1fbfe1b589fe974
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collections; public class A { public static void main(String[] args) { JS in = new JS(); int n = in.nextInt(); int N = 2*n; ArrayList<Lon...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
3277b6d0324c764a63c8b189d2c8b15b
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); int n=sc.nextInt(); Integer [] a=new Integer [2*n]; for(int i=0;i<2*n;i++) a[...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
ff9a2aec540f900eea903d8d760c80d0
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class HelloWorld{ public static void main(String []args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(br.readLine()); long a[]=new long[2*n]; ...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
8006aec54d0fbbdad4158652ebfbd282
train_001.jsonl
1532938500
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes.Strictly speaking, it makes a photo of all points with coordinates $$$(x, y)$$$, such that $$$x_1 \leq x \leq x_2$$$ and $$$y_1 \leq y \leq y_2...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class a{ static void solve(){ int n = ni(); long[] a = nla(2*n); Arrays.sort(a); long ans = (a[n-1]-a[0])*(a[2*n-1]-a[n]); for(int i=n+1;i...
Java
["4\n4 1 3 2 3 2 1 3", "3\n5 8 5 5 7 5"]
1 second
["1", "0"]
NoteIn the first sample stars in Pavel's records can be $$$(1, 3)$$$, $$$(1, 3)$$$, $$$(2, 3)$$$, $$$(2, 4)$$$. In this case, the minimal area of the rectangle, which contains all these points is $$$1$$$ (rectangle with corners at $$$(1, 3)$$$ and $$$(2, 4)$$$).
Java 8
standard input
[ "implementation", "sortings", "brute force", "math" ]
cda1179c51fc69d2c64ee4707b97cbb3
The first line of the input contains an only integer $$$n$$$ ($$$1 \leq n \leq 100\,000$$$), the number of points in Pavel's records. The second line contains $$$2 \cdot n$$$ integers $$$a_1$$$, $$$a_2$$$, ..., $$$a_{2 \cdot n}$$$ ($$$1 \leq a_i \leq 10^9$$$), coordinates, written by Pavel in some order.
1,500
Print the only integer, the minimal area of the rectangle which could have contained all points from Pavel's records.
standard output
PASSED
cef610ea1b05d61782ae69087a622384
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String args[]) throws IOException { Reader sc = new Reader(System.in); int n = sc.nextInt(); long[] a = new long[n]; long[] b = new long[n]; for (int i = 0; i < n; ++ i) { a[i] = sc...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
d55ed27a966c8831b6052bed26ed588f
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.util.*; public class Main { static class Task{ ////////////////// Solution ///////////////////////////////////// public void solve(InputReader in, PrintWriter out) throws Exception { int n = in.nextInt(); Integer[] a = new Integer[n]; ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
c0c17cf20716b4c9da03727c15fa56c2
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; /** * Created by jfuentes on 20.05.17. */ public class CodForceA { public static void main(String[] args) throws IOException { ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
81b6707d8ca426065f72e8d91f7dca5e
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static FastScanner in; static PrintWriter out; static final int MOD = 1000000007; public static void main(String[] args) throws IOException { // Scanner in = new Scanner(new File("input.txt")); // ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
e4605b20c4041eb709c75d2b4690f484
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class C { static long MOD = (long) (1e9 + 7); static int N; static long initial; public static v...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
b964091275335e6e675249af2ca3cc89
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class Codeforces...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
212cfd4628f435394b2c4169c0e57014
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.PriorityQueue; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual so...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
f8aa3ffd645f90b4062d1bd8d51f7011
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
65ff8a1193349ffd44ede49979025674
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class ProblemA { static long MOD = 1000000007; public static void main(String[] args) { FastScanner input = new FastScanner(); int n = input.nextInt(); int[] arr = input.readIntArray(n); shuffle(arr); Arrays.sort(arr); if(n == 1){ ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
07bb8ecc799dbbc8be160d18941dd176
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; imp...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
76cbd4e800b2f4749811c7d8fde62dad
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.Iterator; import java.io.BufferedWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Writer; imp...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
7a6dbc38fb02e64b60f4cb0736e75e5b
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; public class Code809A{ public static int MOD = 1000000007; public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] Tab = new int[n]; int[] Pow = new int[n]; Pow[0]=1; for(int i=1;i<n;i++)Pow[i]=(2*Pow[i-1])%MOD; //System.out.println("...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
127761930533f7a8cb3c9ee9e7632678
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; import java.io.*; public class A { public static void main(String[] args) throws Exception { PrintWriter out = new PrintWriter(System.out); new A(new FastScanner(System.in), out); out.close(); } int MODO = 1_000_000_007; public A(FastScanner in, PrintWriter out) ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
c084d56d8f5ac83f131ff3bc8f7803f5
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import static java.lang.Integer.min; import static java.lang.System.out; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; import java.util.stream.IntStream; /* * N points on a line, coordinate 1 ≤ xi ≤ 10^9, 1 ≤ n ≤ 3·10^5 * a is none empty subset of A - all points * F(a) = max dis...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
941191c3346b9df01b187d2561d4244b
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; import java.util.HashMap; import java.util.HashSet; imp...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
13ebdbee69e29778f629f412cd7dcbdb
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Random; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
f7b3a5d185883cac52d614f018d5b276
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class MainA { public static void main(String[] args) { try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){ int n = Integer.parseInt(in.readLine()); BigInteger[] x = new BigInteger[n]; String[] sArr = in...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
0915703bb5d5133b39ed652bbe3dd179
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
e6a508897d26f6030a61c1fe425ad70e
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
ffcdbe7ec340cdeac51db851049f5934
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class A415 { static long mod = 1_000_000_007; static long twoInv = 500000004; public static void...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
8f89d3c4ab904b5cbc76c6945eaaa450
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
//package round415; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Random; public class A { InputStream is; PrintWriter out; String INPUT = ""; void solve()...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
1422351abae229d4a4b3af8eae24ff86
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Solution { static long M=1000000007; public static long exponent(long x,long n) { long y=0; if(n==0) return 1; else if(n==1) return x%M; else { ...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
b34f7299393600e396b66f0ee1e2b8b6
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class Solution { private static String inputFilename = "input.txt"; private static String outputFilename = "output.txt"; private BufferedReader in; private StringTokenizer line; private Pri...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
af40c328d89e78f7bd3453e07c2eb480
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.math.*; import java.security.KeyStore.Entry; import java.util.*; public class Main { private InputStream is; private PrintWriter out; int MOD = (int)(1e9+7); void solve() { int n = ni(); int arr[] = na(n); long ans = 0; shuffle(arr, new Random()); Arrays.sort(arr); long su...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
1c233fff7ecba4ad34e61dbd1d9b7477
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOExcept...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
f0b34c294a4b6ee5658c1b5624ac19fa
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))){ int n = Integer.parseInt(in.readLine()); BigInteger[] x = new BigInteger[n]; String[] sArr = in....
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
1f96bf0b5aac2abf2ea347885593ae3b
train_001.jsonl
1495303500
Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access to n computers throughout the town. Incidentally all the computers, which were hacked by Leha, lie on the...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.security.SecureRandom; import java.util.*; /** * Created by noureldin on 4/05/17. */ public class Main { private static final int mod = 1000000007; private static int add(int x,int y){ x += y; if(x >= mod) x -= mod; if(x < 0)...
Java
["2\n4 7", "3\n4 3 1"]
2 seconds
["3", "9"]
NoteThere are three non-empty subsets in the first sample test:, and . The first and the second subset increase the sum by 0 and the third subset increases the sum by 7 - 4 = 3. In total the answer is 0 + 0 + 3 = 3.There are seven non-empty subsets in the second sample test. Among them only the following subsets incre...
Java 8
standard input
[ "implementation", "sortings", "math" ]
acff03fe274e819a74b5e9350a859471
The first line contains one integer n (1 ≤ n ≤ 3·105) denoting the number of hacked computers. The second line contains n integers x1, x2, ..., xn (1 ≤ xi ≤ 109) denoting the coordinates of hacked computers. It is guaranteed that all xi are distinct.
1,500
Print a single integer — the required sum modulo 109 + 7.
standard output
PASSED
f1ccc06ed92b576c363f2acc83c628b1
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class C { private static Comparator<int[]> cmp = new Comparator<int[]>() { @Override public int compare(int[] a, int[] b) { if(a...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
7e0517e87411f0d699db1c5db49ef659
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.util.*; import java.io.*; public class TavasPashmaks { public static void main(String[] args) { FastScanner scanner = new FastScanner(); PrintWriter out = new PrintWriter(System.out,false); int n =scanner.nextInt(); P[] pts = new P[n]; P[] keep = new P[n]; ...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
6d84586f798381f88a7c54915267002a
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.util.*; import java.io.*; public class runswim { private static final int INF = (int)1e9; private static class Pt implements Comparable <Pt> { double x; double y; public Pt(double a, double b){ x = a; y = b; } public int compareTo(Pt arg0) { int t = Double.compare(x, arg0.x); if(t!=0)r...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
e919e8b2843d0adc0c98213347ce09ab
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.util.*; import static java.lang.Math.*; import java.io.*; public class C { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer stok = new StringTokenizer(in.readLine()); int N = Integ...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
e79ad20fd66deca22f1d9104758e475a
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.io.*; import java.util.*; public class C { class Competitor implements Comparable<Competitor> { int id; int s, r; Competitor next; Competitor(int id, int s, int r) { this.id = id; this.s = s; this.r = r; } public in...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
2ed0d1e09eb1258641a7de2a0d4097f4
train_001.jsonl
1429029300
Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running R meters after they finished swimming exactly S meters. A winner is a such person that nobody else finishes running before him/her (there may be...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); Task solver = ...
Java
["3\n1 3\n2 2\n3 1", "3\n1 2\n1 1\n2 1"]
1 second
["1 2 3", "1 3"]
null
Java 8
standard input
[ "geometry", "math" ]
e54f8aff8ede309bd591cb9fbd565d1f
The first line of input contains a single integer n (1 ≤ n ≤ 2 × 105). The next n lines contain the details of competitors. i-th line contains two integers si and ri (1 ≤ si, ri ≤ 104).
2,600
In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.
standard output
PASSED
bcc941d20ae8bb33859ea9554b3b0250
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.HashMap; public class MishaChangingHandles { public static void main(String[] args) throws NumberFormatException, IOException { 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 7
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
af729e48a7ca7125d14ede50aca56c3f
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.Scanner; import java.util.Arrays; import java.util.LinkedList; public class main { public static void main(String args[]) { Scanner input = new Scanner(System.in); int n = input.nextInt(); input.nextLine(); String arr[][] = new String[n][2]; String result...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
6c12dfacca75fc60783c372c0b181586
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.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; import java.util.StringTokenizer; import java.util.TreeMap; publ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
6a29ddbacbdce25fbdc9d8f02970ee2a
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 Contest { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); Hashtable<String, String> h = new Hashtable<String, String>(); while (n > 0) { S...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
49c7c2284846200bdb679ec4898b62b1
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.InputStreamReader; public class Div2_285 { public static void main(String args[])throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int q=Integer.parseInt(br.readLine()); String[][] names = new String[q][2]; boolean[] chec...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
f3fa9b1f72acc08fbfd01b1ebfea5fc3
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.Iterator; import java.util.Map; import java.util.Scanner; public class B { public static void main(String[] args) { HashMap<String, String> users = new HashMap<String, String>(); Scanner console = new Scanner(System.in); int count = console.nextInt...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
a2a24b97656770c19260ef96e3df63f8
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 { // your code goes here Scanner s=new Sca...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
966e587ef5799a5ce4096ae017bfe887
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.Scanner; public class B { public static void main(String args[]){ Scanner in = new Scanner(System.in); String s[][] = new String[1000][2]; int n = in.nextInt(); int ind = 0 , c = 0; String temp1 = "", temp2 = ""; for(int i = 0...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
8939fe96cce4fb78d04aa818cffca68c
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.PrintWriter; import java.util.HashMap; import java.util.Scanner; public class ChangingHandles { public static void main(String args[]) { Scanner input = new Scanner(System.in); //PrintWriter out = new PrintWriter(System.out); int q = input.nextInt(); HashMap<String, S...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
9af954e15b388d38b2e91f16cf5517f7
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.InputStreamReader; import java.io.IOException; import java.util.HashMap; public class Mishahandles { public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String brr[]=br.readLi...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
cdb5104cabf7419d8029723f0e810c5a
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 Div2; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.Stack; public class Sketch { public static void main(String[] args){ Scanner input = new Scanner(System.in); int q = input.nextInt(); String[]...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
104be5545347f3afc1ef32cbc9597ce0
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.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; public class Ques1 { public static void main(String[] args) throws NumberFormatException, IOException { Buffer...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
70fb280ea6a8caf4a27b4fd874460aad
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 B { String old; String current; public B(String a, String b) { old = a; current =b; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int cases = in.nextInt(); B[]arr = new B[cases]; int count = 0; for(int i = 0; i<cases; i++) { ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
70961c95f7166ff01292b432721829d1
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; /** * Date: 18-01-2015 * Time: 06:41 */ public class MishaAndChangingHandles { public static void main(String[] args) { Scanner in = new Scanner(System.in); HashMap<String, String> currentPrev = new HashMap<>(); int q = in.nextInt(); ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
aadfce16ab9bcf81d7603f9b27e93a59
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.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.StringTokenizer; public class ASC { public st...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
e3483ee621ec4aff531ab403441c3fd7
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.*; import static java.lang.System.*; public class CF501B{ public static void main(String[] args) throws Exception{ BufferedReader sc = new BufferedReader(new InputStreamReader(in)); HashMap<String, String> mappings = new HashMap<String, String>(); ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
26c16f4301019458a9cd5d10a9bbdef9
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.InputStreamReader; import java.util.TreeMap; import java.util.TreeSet; public class MishaAndChangingHandles_501B { public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
d8b8aa8d878c370a1f0a5bec4e77da22
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 Main { public static HashMap<String,Integer> map=new HashMap<>(); public static int par[]=new int[1001*2]; public static String store[]=new String[1001*2]; public static String out[]; public static void main(String[] args) { // TODO Auto-generated method stub Scanner k=new Sca...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
da8a495c48367b9800447cd36de71e6c
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.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import ja...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
24ae8c8ca2fc39c8d84d91e4c87dbe44
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
/* * 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.util.*; import java.math.*; import java.io.*; /** * * @author magzhankairanbay */ public class Code { /** ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
97fef12ff767009e3bd5df532d537a6e
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 codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java....
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
22b27753a24f8e59ad58e2fec0ef9d5d
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.Scanner; public class Main { static Scanner in = new Scanner(System.in); public static void main(String[] args) { int TestCases = in.nextInt(); dsu ds = new dsu(TestCases); String st[][] = new String[TestCases][2]; boolean Changes[] = new boolean[TestCases]; ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
bbfdd748ecdce7e18a6f41479b3bf060
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.Collections; import java.util.HashMap; import java.util.Map; public final class Misha { static public void main(String[] args) throws IOException { BufferedReader in ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
2039a3e4f773ac1003961eea2f4b47b1
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.Map; import java.util.Scanner; public class B501 { public static void main(String[] args) { Scanner input = new Scanner(System.in); Map<String,String> map = new HashMap<String,String>(); int N = input.nextInt(); for (int n=0; n<N; n++) { ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
0c3884a34bb42b78c8cd8f803c2ec010
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.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.IOException; import java.util.StringTokenizer; import java.util.HashMap; import java.util.Map; import java.lang.String; import java.lang.Math; import java....
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
b8bbbef500139f93a324e74af913055b
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.HashMap; public class B501 { public static void main(String[] args) throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String[] input = bf.readLine().split(" ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
54e9c290eaecb22df16b8b459770608b
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 cf501B { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashSet<String> hash = new HashSet<String>(); ArrayList<String> root = new ArrayList<String>(); ArrayList<String> newH = new ArrayLis...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
711f054ff66051d79eaade3609a6b5e7
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 handles { public static void main(String args[]) { Scanner e=new Scanner(System.in); int n=e.nextInt(),i,x=0; String a[]=new String[n]; String b[]=new String[n]; String c[]=new String[n]; for(i=0;i<n;i++) { a[i]=e.next(); b[i]=e.next(); } for(i=0;i<n;i++) { //String ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
ac7dd4e4f542d5f9b7fd27bc1d7cf1f4
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.util.LinkedList; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class tmp { public static void main(String [] args) throws Exception{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
7fd4f87129d4fe8eed0fc6a96d0c7ad2
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 { public static void main(String[]args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashMap<String, Node> conv = new HashMap<String, Node>(); ArrayList<Node> graph = new ArrayList<Node>(); int n = Integ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
af82a49f834ff314a73d5e12a8ec15df
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.InputStreamReader; import java.io.IOException; public class B { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); String x[] = new String[n];...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
021109af91821b484df5657cc12e93ba
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 Change { public static void main(String args[]) { Scanner input = new Scanner(System.in); ArrayList <User> a = new ArrayList <User>(); int n; n = input.nextInt(); for (int i = 0; i < n; i++) { String handle, newhandle; handle = input.next(); newhandle = input.n...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
2b5e94d01754079ea136ca9451062024
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.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintStream out = Sys...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
eef3e6a2926d69aa03c5dbb48249dc04
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.math.*; import java.io.*; import java.text.*; import java.awt.Point; import static java.util.Arrays.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.Short.*; import static java.lang.Math.*; import static jav...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
2de6dc353d4dd147ab9dc16406479e5a
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.math.*; import java.io.*; import java.text.*; import java.awt.Point; import static java.util.Arrays.*; import static java.lang.Integer.*; import static java.lang.Double.*; import static java.lang.Long.*; import static java.lang.Short.*; import static java.lang.Math.*; import static jav...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
4d20ec51d17eda5f22248d489dc13387
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 final class changing_handles { static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter out=new PrintWriter(System.out); public static void main(String args[]) throws Exception { int n=sc.nextInt(); List<...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
614f720bb1125d1e158dd857054364eb
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 codeforces; import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.StringTokenizer; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int N = Integer.parseInt(in.nextLine()); HashMap<String, String> map = new HashMap...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
be9bde30b2200835dafd6180fecad982
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.LinkedList; import java.util.Scanner; public class ChangingHandles { public static void main(String[] args) { Scanner sc=new Scanner(System.in); LinkedList<LinkedList<String>> nombres=new LinkedList<LinkedList<String>>(); int n=Integer.parseInt(sc.nextLine()); int cambios=0; for(int k=0;k...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
13455beec55971a3a1b9eae92dc22734
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
/* Rajarshee Mitra (rajarshee) */ import java.io.*; import java.util.*; public class Solution { static int n; static int h[]; public static void main(String[] args) { Scanner s = new Scanner(System.in); n = s.nextInt(); ArrayList<Name> al = new ArrayList<>(); Iterator it ; for(int i=0;i<n;i++) { String m = s...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
fe60a554e0bd12d6194db3fcbba1fb7b
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 B285 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Hashtable <String, String> hash = new Hashtable <String, String>(); int times = scan.nextInt(); int count = 0; String old; String neu; for (int i = 0; i < times; i+...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
3a613856b5f35b179cc3a1f410e2752f
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.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; import java.util.Arrays; import java.util.Tr...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
e7d0589ba21acbd6107e64f0321b8ff5
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.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class B { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintStream out = Sy...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
e70362ac98dd8aadd315e3302bb17c09
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.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.List; import java.util.Scanner; public class Problem501b { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(new Input...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
2651c1c52de4d3d5a8535ea7e950ba03
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.InputStream; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.StringTokenizer; public class Problem501b { /** * @param args ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
80096bc5ef47211a71df7715c4a85d84
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.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; public class Problem501b { /** * @param args */ public ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
be9602519320a2dce1c81e5fc8662055
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.InputStreamReader; import java.util.StringTokenizer; import java.util.Arrays; public class Main { //String [] Orig; String []Old; String []New; int counter = 0; static int j; public Main (int n){ Old = new String[n]; New = new ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
95c4c835f45d3b060ce521a6e168a993
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.Arrays; import java.util.LinkedList; import java.util.StringTokenizer; import java.util.TreeMap; public class Main { public static void main(String[] args) throws NumberFormatException, IOExcep...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
125e503c7937facc0dc99dd37e6e3c8b
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; public class Main { public static void main(String[] args) { Scanner s = new Scanner (System.in); int n = s.nextInt(); s.nextLine(); String L[] = new String [n]; String old[] = new String [n]; String nw[] = new String [n]; int i=0; for(i=0;i<n;i++) { L[i] = s.nextL...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
f7be49d8b95eee430e51b16fbcaf51be
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 ProblemB { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int q = scanner.nextInt(); HashMap<String, String> rest = new HashMap<String, String>(); Has...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
4ea04f5bed0001ee87587ac3ea941513
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.util.Map.Entry; import java.io.*; public class Main { public static void main (String[]args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashMap<String,Integer> unique = new HashMap<String, Integer>(); TreeMap<String, String> ...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
18474dedfa869ab5d633df8f8dce88cb
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 MishaHandles{ public static int ips(String s){ return Integer.parseInt(s); } public static void main(String[] args) throws IOException{ BufferedReader r=new BufferedReader(new InputStreamReader(System.in)); int n=ips(r.readLine()); HashMap<String,String> hm=n...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
d924d0f6da4657b5400a0146cb2aab38
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.awt.Point; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInt...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
910249d1d6a2dd34eb2014f2eef5afa1
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.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.InputMismatchEx...
Java
["5\nMisha ILoveCodeforces\nVasya Petrov\nPetrov VasyaPetrov123\nILoveCodeforces MikeMirzayanov\nPetya Ivanov"]
1 second
["3\nPetya Ivanov\nMisha MikeMirzayanov\nVasya VasyaPetrov123"]
null
Java 7
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
12c416840690efc8a00c81cf43f772f4
train_001.jsonl
1469205300
On vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the length l meters. Each of the pupils will go with the speed equal to v1. To get to the excursion quickly, it was decided to rent a bus, which has seats for k people (it means that it can't fit more than k pe...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int n, l, v1, v2, k, q; public static void main(String[] args) throws Exception { Reader.init(System.in); n = Reader.nextInt...
Java
["5 10 1 2 5", "3 6 1 2 1"]
1 second
["5.0000000000", "4.7142857143"]
NoteIn the first sample we should immediately put all five pupils to the bus. The speed of the bus equals 2 and the distance is equal to 10, so the pupils will reach the place of excursion in time 10 / 2 = 5.
Java 11
standard input
[ "binary search", "math" ]
620a9baa531f0c614cc103e70cfca6fd
The first line of the input contains five positive integers n, l, v1, v2 and k (1 ≤ n ≤ 10 000, 1 ≤ l ≤ 109, 1 ≤ v1 &lt; v2 ≤ 109, 1 ≤ k ≤ n) — the number of pupils, the distance from meeting to the place of excursion, the speed of each pupil, the speed of bus and the number of seats in the bus.
1,900
Print the real number — the minimum time in which all pupils can reach the place of excursion. Your answer will be considered correct if its absolute or relative error won't exceed 10 - 6.
standard output
PASSED
e076b3c21e70333e5bc27594b2bcde54
train_001.jsonl
1583246100
To become the king of Codeforces, Kuroni has to solve the following problem.He is given $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. Help Kuroni to calculate $$$\prod_{1\le i&lt;j\le n} |a_i - a_j|$$$. As result can be very big, output it modulo $$$m$$$.If you are not familiar with short notation, $$$\prod_{1\le i&lt;j\...
256 megabytes
//package cf; import java.util.*; import java.util.Scanner; import java.io.*; public class Cf{ static class Node{ int sum,occur; Node(int sum){ this.sum=sum; } } public static void main(String[]args){ Scanner in=new Scanner(System.in); PrintWr...
Java
["2 10\n8 5", "3 12\n1 4 5", "3 7\n1 4 9"]
1 second
["3", "0", "1"]
NoteIn the first sample, $$$|8 - 5| = 3 \equiv 3 \bmod 10$$$.In the second sample, $$$|1 - 4|\cdot|1 - 5|\cdot|4 - 5| = 3\cdot 4 \cdot 1 = 12 \equiv 0 \bmod 12$$$.In the third sample, $$$|1 - 4|\cdot|1 - 9|\cdot|4 - 9| = 3 \cdot 8 \cdot 5 = 120 \equiv 1 \bmod 7$$$.
Java 8
standard input
[ "combinatorics", "number theory", "brute force", "math" ]
bf115b24d85a0581e709c012793b248b
The first line contains two integers $$$n$$$, $$$m$$$ ($$$2\le n \le 2\cdot 10^5$$$, $$$1\le m \le 1000$$$) — number of numbers and modulo. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^9$$$).
1,600
Output the single number — $$$\prod_{1\le i&lt;j\le n} |a_i - a_j| \bmod m$$$.
standard output
PASSED
8f972f14a6635e8fa5e0ad0ae505fc94
train_001.jsonl
1583246100
To become the king of Codeforces, Kuroni has to solve the following problem.He is given $$$n$$$ numbers $$$a_1, a_2, \dots, a_n$$$. Help Kuroni to calculate $$$\prod_{1\le i&lt;j\le n} |a_i - a_j|$$$. As result can be very big, output it modulo $$$m$$$.If you are not familiar with short notation, $$$\prod_{1\le i&lt;j\...
256 megabytes
import java.util.Scanner; public class C { public static void main(String[] args) { new C(); } public C() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); long prod = 1; if (n <= m) { long[] array = new long[n]; for (int i = 0; i < n; i++) { array[i] = sc.n...
Java
["2 10\n8 5", "3 12\n1 4 5", "3 7\n1 4 9"]
1 second
["3", "0", "1"]
NoteIn the first sample, $$$|8 - 5| = 3 \equiv 3 \bmod 10$$$.In the second sample, $$$|1 - 4|\cdot|1 - 5|\cdot|4 - 5| = 3\cdot 4 \cdot 1 = 12 \equiv 0 \bmod 12$$$.In the third sample, $$$|1 - 4|\cdot|1 - 9|\cdot|4 - 9| = 3 \cdot 8 \cdot 5 = 120 \equiv 1 \bmod 7$$$.
Java 8
standard input
[ "combinatorics", "number theory", "brute force", "math" ]
bf115b24d85a0581e709c012793b248b
The first line contains two integers $$$n$$$, $$$m$$$ ($$$2\le n \le 2\cdot 10^5$$$, $$$1\le m \le 1000$$$) — number of numbers and modulo. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$0 \le a_i \le 10^9$$$).
1,600
Output the single number — $$$\prod_{1\le i&lt;j\le n} |a_i - a_j| \bmod m$$$.
standard output