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
95d1bf1e5710cf7072f02f07e961e440
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.util.Scanner; /** * * 二位前缀和 * */ public class E { public static void main(String[] args) { //Scanner sc = new Scanner(System.in);...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
e1856ec16f52207ee39329c9f075c72c
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; /** * * 二位前缀和 * */ public class E { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int q = sc.nextInt(); int[][] rec = n...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
cce25c4d601063002c05caa651b95fb1
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class Sort { static BufferedReader bf; static PrintWriter out; static Scanner sc; static StringTokenizer st; static long mod = (long)(1e9+7); static long mod2 = 998244353; static long[]fact = new long[200005]; static long[]invFact = new long[200005]; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
fece09d906f482b12f0cbe856d065e9b
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class TaskE { public static void main(String[] args) { FastReader reader = new FastReader(); int tt = reader.nextInt(); // int tt = 1; for (; tt > 0; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
a1ccfdc9af1884700aa33ae0af7725b2
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class CodeForces { /*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/ public static void solve(int tCase) throws IOException { int n = sc.nextInt(); int q = sc.nextInt(); int mx...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
943ba93fab67d1b2c5635c84546bf3c5
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc; static PrintWriter pw; public static void main(String[] args) throws IOException { sc = new Scanner(System.in); pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(), q = s...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d0f98561a3114e0a1d124fd56f2e9d46
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc; static PrintWriter pw; public static void main(String[] args) throws IOException { sc = new Scanner(System.in); pw = new PrintWriter(System.out); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(), q = s...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 < 2$$$ (comparing heights) and $$$1 < 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
737dcb4855d161924f85bd474882506a
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int q=sc.nextInt(); long[][] dp=new long[1001][1001]; for(int j=0;j<n;j++) { int x=sc.nextInt(); ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
16df7d27ab052a12b31f52f2607d8e80
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Main { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws Exception { int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int q = sc....
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
88b501f13ce657fe41b9483a30085a51
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void solveE(long[][] arr, int[][] queries, int n, int q){ int BOUND = 1000; long[][] memo = new long[1011][1011]; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
3c258e896911b3fbfc30bd1b1a97426f
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int i=0;i<t;i++) { int n=sc.nextInt(); int q=sc.nextInt(); long[][] dp=new long[1001][1001]; for(int j=0;j<n;j++) { int x=sc.nextInt()...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
712f2c75bc873ecc70101431eec75a86
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { // static int [] arr; // static boolean prime[] = new boolean[1000]; // static int l; // static String s; static StringBuilder sb; // static HashSet<L> hs; // static HashSet<Long> hs = ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
c4b361edd90d8872ebd083c9a09b2638
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; /** * @author Naitik * */ public class Main { static FastReader sc=new FastReader(); static int dp[][]; // static boolean v[][][]; // static int mod=998244353;; static int mod=1000000007; static long max; static int bit[]; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
59cb1bb1f1d5268ba490a4cc59019f92
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; public class E1722 { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); int T = in.nextInt(); for (int t=0; t<T; t++) { long[][] stat = new long[1001][1001]; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
9669336d43e4b0e8cf9e43c27c9fba06
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; public class CountingRectangles { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while (t > 0) { solve(scanner); t--; } } public static void solve(Sc...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
ea22868aa8f4dc38f3fe4e8e7ae7774d
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class AAAPractice { BufferedReader br; StringTokenizer st; BufferedWriter bw; public static void main(String[] args) throws Exception { new AAAPractice().run(); } void run() throws IOException { br = new BufferedReader(new InputStreamReader(Syst...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
3faebb2471e87cdec09e9e027162589a
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class countingRectangles { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tests = sc.nextInt(); while(tests-->0) { long[][] array = new long[1001][1001]; int n = sc.nextInt(); int queries = sc.next...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
f9840ea8444bfff83c3328ba727e3f2b
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
// Mahakal // Remainder: Agar ni ban raha to demotivate ni hona. Yehi chance hai sikhne ka. import java.util.*; import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringT...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d08f6855c9013332c8f4527b5338cb2a
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
33fbea3a04dfd9c031a376b3adc5c64a
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.*; public class Main { public static void main(String[] args) { InputStre...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
1a9bcdd7cabb2590aae4e347eb39c978
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int n = Inte...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
e29f308bc5e3c37eb68872ebf928c287
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
/* Goal: Become better in CP! Key: Consistency and Discipline Desire: SDE @ Google USA Motto: Do what i Love <=> Love what i do If you don't use your brain 100%, it deteriorates gradually */ import java.util.*; import java.io.*; import java.math.*; public class Code { static StringBuffer st...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
ff7302978e2c6d77e18521bf92f3bd48
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
/* Goal: Become better in CP! Key: Consistency and Discipline Desire: SDE @ Google USA Motto: Do what i Love <=> Love what i do If you don't use your brain 100%, it deteriorates gradually */ import java.util.*; import java.io.*; import java.math.*; public class Code { static StringBuffer st...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
a65a407e5850f0375e48f4237cfb7e04
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; public class Main { static InputReader sc; public static void main(String[] args) throws Exception { sc=new InputReader(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); int q=sc.nextInt(); long[][] m...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
1ebe1758af132bbfd22b0f7b11a0ec25
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class myclass { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
c55246800955bfff8d1f976ea575978f
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
/*========================================================================== * AUTHOR: RonWonWon * CREATED: 13.10.2022 22:55:40 /*==========================================================================*/ import java.io.*; import java.util.*; public class EE { public static void main(S...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
98d910ba07f92027e6ff5210317560ea
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
/* Author:-crazy_coder- Do what i Love <=> Love what i do */ import java.io.*; import java.util.*; public class cp{ static long mod=998244353; static int ans=0; static int[] par=new int[100005]; static int[] rank=new int[...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
c2f6e387a5e5875270058acbf8cab85f
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class countingRectangles { public static void main(String[] args) throws IOException { BufferedReader bi = new BufferedReader(new InputStreamReader(System.in)); PrintWriter out = new PrintWriter(System.out); StringTokeniz...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d189b540414d27b0f21bad822065ff20
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.Scanner; public class E1722 { public static void main(String[] args) { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); int T = in.nextInt(); for (int t=0; t<T; t++) { long[][] stat = new long[1001][1001]; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d6827b75ae1f9ccfc7d895450b698ac9
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
/*############################################################################################################ ########################################## >>>> Diaa12360 <<<< ############################################### ########################################### Just Nothing ###################################...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
815867f4ce352d849bbbede215945fb0
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class codeforces1722E { public static void main(String[] args) throws Exception { FastScanner in = new FastScanner(); PrintWriter pw = new PrintWriter(System.out); int numCases = in.nextInt(); while (numCases-->0) { ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
7ebb656996d7bd5719fa503c79aaaf45
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class countRec{ public static void main(String[] args) throws IOException{ BufferedReader inp = new BufferedReader(new InputStreamReader(System.in)); int t= Integer.parseInt(inp.readLine()); while(t-->0){ Str...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
7eee032d372ff75769ac8fa15125282f
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution { public static class CFScanner { BufferedReader br; StringTokenizer st; ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
f606510aa2e22fa839e5f99dba48a411
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Prior...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
e2aab71dbb4863106111ad7970964fed
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cr { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new S...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
6b35c875be4b342cbea1586eb5f85d75
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.security.cert.X509CRL; import java.util.*; import java.lang.*; import java.util.stream.Collector; import java.util.stream.Co...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
7b97e015268013bf981cca224ec61944
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
//SHIVAM GARG import java.util.*; import java.io.*; import java.lang.*; public class Codechef { public static FastReader reader = new FastReader(); public static int[] primes; public static void main(String[] args) throws java.lang.Exception { int n = reader.nextInt(); fo...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
34a06af9d0ba7c75df43997402f940d0
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import javax.print.DocFlavor; import java.math.BigInteger; import java.util.*; import java.io.*; public class Vaibhav { static long bit[]; static boolean prime[]; public static long lcm(long x, long y) { return (x * y) / gcd(x, y); } static class Pair {//implements Comparab...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
26f66a190aa29e79d94d866c04075f5d
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Balabizo { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pw = new PrintWriter(System.out); int tt = sc.nextInt(); while(tt-->0) { int n =sc.nextInt(...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
175ae69ec88f5a25971608c363670309
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class CF1 { static FastReader sc=new FastReader(); // static long dp[][]; // static boolean v[][][]; // static int mod=998244353;; // static int mod=1000000007; static long oset[]; static int oset_p; static long...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d3d351ae9ff7557b84dc563f67e2650f
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.Closeable; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.time.Clock; import java.time.LocalDateTime; import java.util.*; import java.util.function.BiFunction...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
1d081e1e5ba159118bb63b4b4237715e
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
//package codeforces.round817div4; import java.io.*; import java.util.*; import static java.lang.Math.*; public class E { static InputReader in; static PrintWriter out; public static void main(String[] args) { //initReaderPrinter(true); initReaderPrinter(false); sol...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
3495b1ba70b8ec987e827caccb8c008d
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class e { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
67c293bff65908f8f058fd5114b718c1
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader sc=new FastReader(); static PrintWriter out=new PrintWriter(System.out); static int dx[]={0,0,-1,1},dy[]={-1,1,0,0}; static final double pi=3.1415926536; static long mod=1000000007; // static long mod=998244353; static int ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
91948e0d35456b631f3b7488e72d7674
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main{ public static void main(String args[]) throws IOException{ Read sc=new Read(); int t=sc.nextInt(); for(int i=0;i<t;i++){ int n=sc.nextInt(); int q=sc.nextInt(); ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
cc9189b0f1519e04d5206ba9be4b5799
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
3a7cbc00b820f737fcec2a9237af1831
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class MainE { static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream stream) { reader = new BufferedReader(new InputStreamReader(stream), 32768); ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
65cdd8db2b73809f0b3a256e7cf2fabe
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class E_Counting_Rectangles { static FastReader sc; static void solve() { StringBuilder res = new StringBuilder(); int n = sc.nextInt(), q = sc.nextInt(); long[][] arr = new long[1001][1001]; for (int i = 0; i < n; i++) { ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
d08d41a49312286a98d789db0fba23b5
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.io.*; import java.util.*; public class Solution { static Solution2 admin = new Solution2(); public static void main(String[] args) { admin.start(); } } class Solution2 { //---------------------------------INPUT READER-----------------------------------------// pub...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
532264c2714dbdbe3b13993518386b4a
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class A { static Scanner sc; static PrintWriter pw; public static long[][] prefixSum(long a[][]) { int R = a.length; int C = a[0].length; long psa[][] = new long[R][C]; psa[0][0] = a[0][0]; for (int i = 1; i < C; i++) psa[0][i] = psa[0][i - 1] ...
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
76850df31f0ba9c5dbc985971e381568
train_109.jsonl
1661871000
You have $$$n$$$ rectangles, the $$$i$$$-th rectangle has height $$$h_i$$$ and width $$$w_i$$$.You are asked $$$q$$$ queries of the form $$$h_s \ w_s \ h_b \ w_b$$$. For each query output, the total area of rectangles you own that can fit a rectangle of height $$$h_s$$$ and width $$$w_s$$$ while also fitting in a recta...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { Reader in = new Reader(); PrintWriter out = new PrintWriter(System.out); int T = in.nextInt(); for (int t = 0; t < T; t++) { int N = in....
Java
["3\n\n2 1\n\n2 3\n\n3 2\n\n1 1 3 4\n\n5 5\n\n1 1\n\n2 2\n\n3 3\n\n4 4\n\n5 5\n\n3 3 6 6\n\n2 1 4 5\n\n1 1 2 10\n\n1 1 100 100\n\n1 1 3 3\n\n3 1\n\n999 999\n\n999 999\n\n999 998\n\n1 1 1000 1000"]
6 seconds
["6\n41\n9\n0\n54\n4\n2993004"]
Note In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a $$$1 \times 1$$$ rectangle inside of it and fit into a $$$3 \times 4$$$ rectangle.Only the $$$2 \times 3$$$ rectangle works, because $$$1 &lt; 2$$$ (comparing heights) and $$$1 &lt; 3$$$ (comparing w...
Java 8
standard input
[ "brute force", "data structures", "dp", "implementation" ]
9e9c7434ebf0f19261012975fe9ee7d0
The first line of the input contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The first line of each test case two integers $$$n, q$$$ ($$$1 \leq n \leq 10^5$$$; $$$1 \leq q \leq 10^5$$$) — the number of rectangles you own and the number of queries. Then $$$n$$$ lines follow, each contai...
1,600
For each test case, output $$$q$$$ lines, the $$$i$$$-th line containing the answer to the $$$i$$$-th query.
standard output
PASSED
865487f854f4ea20c16bff4ecaf62aa4
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class WordGame { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder result = new StringBu...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
0beb6b31c22663fd200177d7c3fb529e
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class WordGame { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder result = new StringBu...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
d3af35f525b8fdfbe6757ea6a53036a3
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class WordGame { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder result = new StringBu...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
cd8b1606a5e0d85f8c5ec3bf464e68a4
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; public class WordGame { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder result = new StringBu...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
b61a2098cbb78b6499c29a7f7f001dea
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; public class WordGame { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder result = new StringBuilder(); int tc = Integer.pa...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
8f9a1bdf89c8f8d39ede554a397a373a
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; public class S { public static HashMap<String,Integer> map = new HashMap<>(); public static String[][] strs; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
9e2dbf78665893f29274de1b2a9556fb
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import static java.lang.Character.isWhitespace; import java.io.*; import java.util.*; public final class Main { void solve(InputReader in, StringBuilder sb) { int t = in.nextInt(); while (t-- > 0) { var wordCount = new HashMap<String, Integer>(); int count = in.nextInt(); var words1 = Arrays.stream(in.n...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
618c3d69c5138ac8d38964b4c0a409e9
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; /** * Three guys play a game: first, each person writes down n distinct words of length 3. * Then, they total up the number of poi...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
e540f74e61e0a8688d00dc47f4efde4f
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; /** * Three guys play a game: first, each person writes down n distinct words of length 3. * Then, they total up the number of poi...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
0549203c2569b92d75bca7febfb06f6f
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = Integer.valueOf(sc.nextLine()); for(int i = 0; i < t; i ++) { ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
895b26849475f496b8636f5bef30ff8f
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class code3 { public static void main(String[] args) throws IOException { Kattio in = new Kattio(); int t=in.nextInt(); while(t-->0){ int n=in.nextInt(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
debc4ef10d3b61293a421c87eb9f72b5
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; //min public class Solution { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t= sc.nextInt(); while (t-->0) { int n=sc.nextInt(); HashMap<String,ArrayList<Integer>> map=new HashMap<>(); HashSet<String> set=new HashS...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
3bdecd4c1d1f9463615e9de55e0dd33e
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; public class c { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numC = sc.nextInt(); for (int c = 0; c < numC; c++) { int n = sc.nextInt(); HashMap<...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
8344f451e38b19b1b6ac3fdcd222e3d1
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.HashMap; import java.util.Scanner; /* The pain you feel today will be the strength you feel tomorrow */ import java.util.*; public class Bb { public static void main(String[] args) { Scanner S = new Scanner(System.in); int T = S.nextInt(); while (T-- > 0) { ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
5f333be8784a8dcb0fcbc78088ce3b3f
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; public class Main{ public static void main (String[] abc) throws IOException{ BufferedReader sc =new BufferedRead...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
b9f2e8a2b971d52a2d7d8a66cc899705
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws Exception{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); HashMap<String, Int...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
a4dea7a72708fa1e5da589b0c34bca69
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner lta = new Scanner(System.in); int t = lta.nextInt(); while (t-- >0) { int n = lta.nextInt(); /* String[] s1 = new String[n]; String[] s2 =...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
f0c2423c647a5228e859159c8e6e1818
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner lta = new Scanner(System.in); int t = lta.nextInt(); while (t-- >0) { int n = lta.nextInt(); String[] a = new String[n]; String[] b = new String[n]; ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
cdd3a68ccea5cf922ab86b681b54dfba
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; import java.util.Vector; public class CF_1722C_WordGame { public static void scores(int n,String[][] str) { Map<String,Integer> map=new HashMap<>(); for(int i=0;i<3;i++) { for(int j=0;j<n;j++) { if(map.containsKey(st...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
798be8cd1b562c43d11158731136e260
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.stream.Collectors; public class WordGame { public static void main(String[] args) throws IOException { //BufferedReader buf = new ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
4cfc5e43a205c8484c49b46267ad9ab6
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; public class WordGame { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOExcep...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
88847085f81b8c18f2150cabd787b73e
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
9920f75a2d4610f2f2c7fe7323112abf
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner lta = new Scanner(System.in); int t = lta.nextInt(); while (t-- >0) { int n = lta.nextInt(); String[] a = new String[n]; String[] b = new String[n]; ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
7d2d73c19960b11abf9c5b68b0a10753
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner lta = new Scanner(System.in); int t = lta.nextInt(); while (t-- >0) { int n = lta.nextInt(); /* String[] s1 = new String[n]; String[] s2 =...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
d2bef960714aa8803df843ed5b1cdaf2
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class Main { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamRea...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
efbc2723a0093c3ebcc86ce9b270ea87
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class c1722c_2 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while (t-->0) { int n=sc.nextInt(); String[] s1=new String[n]; ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
9bad272a88c7d15415d3667a94a53548
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import static java.lang.System.out; import static java.lang.Math.abs; import static java.lang.Math.min; import static java.lang.Math.max; import static java.lang.Math.log; import java.util.*; import java.lang.*; import java.io.*; public class a_Codeforces { public static void main(String[] args) throws...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
1fd5260158c19b283a0ab4dde0223271
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codechef { public static void main(String[]args){ Scanner sc=new Scanner(System.in); int test=sc.nextInt(); while(test-->0) { solve(sc); } sc.close(); } public static void solve(Scanner sc){ int n=sc.nextInt(); int...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
2a5550954aa437992a6c830a185b70e3
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); while(tc-- > 0){ int n = sc.nextInt(); boolean ans = true; HashMap<String, Integer> map1 = new HashMap<>(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
302929398835a4682960a7f68e654092
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Main { public static void main(String []args) { Scanner in = new Scanner(System.in); int t = 1; t = in.nextInt(); while (t-->0) { int n=in.nextInt(); HashMap<String,Integer> mp=new HashMap<String,Integer>(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
142fbc15f3737abe731511710223eb4a
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.StringTokenizer; public class C { private static Scan sc = new Scan(); public static void main(String[] args) { int n = sc.nextInt(); for (int i = 0; i < n; i+...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
e5c373cac4a136617512ce7a62333752
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner S = new Scanner(System.in); int T = S.nextInt(); while(T-- > 0) { HashMap<String,Integer>Mp = new HashMap<String,Integer>(); Arra...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
641d9a4f21c7b5cfdce1b8e795b8810b
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); sc.nextLine(); HashMap<String,Integer> temp = new HashMap<>();...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
89dfb0004ae0aa91158d93dbb2d0cb29
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; import java.io.*; public class WG { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader( new FileReader("input.t...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
7092d6a2a2560f0df3c9d9cf94d3fcca
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; import java.io.*; public class CWordGame { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader( new FileReader("...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
bda5cad5a383c0c742193681df781526
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.Set; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int nn; nn = scan.nextInt(); while(nn > 0) { ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
748e5526401c5ba9d751fc41f987c13a
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Wordgame { public static void main(String args[]) { Scanner in = new Scanner(System.in); int t = in.nextInt() ; while( t-- > 0 ) { HashMap<String,Integer> m = new HashMap<String, Integer>() ; int n = in.nextI...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
2710b1af680375df766b0a03b0ba8b66
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Scanner; public class main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader (new InputStreamRead...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
f3c19f461a9b5ca95646bff1ccc14989
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; /** * @Author Create by jiaxiaozheng * @Date 2022/9/1 */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for (int i = 0; i < n; i++) { int m=scanner.nextInt(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
de7c4ee69851a26a61ffb7aa20979016
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; public class word { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; public static void main(String args[]) throws IOException{ int t = readInt(); for(int i=0; i<t; i++) { int n = readInt(); int s1...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
bebece7ce5eba4774edbd3c42219f9f2
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class WordGame2 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); for (int i = 0; i < t; i++) { int n=s.nextInt(); String[] s1=new String[n]; String[] s2=new String[n]; ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
44a7e69cd354ca8f16ac9d74903652fb
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
// package codeForces; import java.util.*; import java.lang.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { // ************************************************************************************************************// static Scanner sc = new Scanner(Sys...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
3ae3e87e227e487a1e265d4ffd1a99c4
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.io.*; import java.util.*; public class Main { static InputReader r; static int T; static StringBuilder answer = new StringBuilder(); private static void solution() throws IOException { int col = r.nextInt(); String[] r1 = r.nextLine().split(" "); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
9696103b5e294346fb2c6821a9860b1d
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class p2{ public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n =sc.nextInt(); int tot1=0,tot2=0,tot3=0; Map<String,Integer...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
8295842d85f8a1bd9db812035c3991c2
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scn=new Scanner(System.in); int t=scn.nextInt(); while(t-->0){ int n=scn.nextInt(); HashMap<String,Integer>map=new HashMap<>(); ArrayList<String> v=new ArrayList<>(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
9c0af2087c4756aae96ab316766d13f8
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
// package learn; import java.util.*; import java.lang.*; import java.math.*; public class Codechef{ static Scanner sc= new Scanner(System.in); public static void main(String[] args){ int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); HashSet<String> se...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
e6a927032ff22eadd9bce2dc305610d2
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.ArrayList; import java.util.HashSet; import java.util.Scanner; public class Vasya { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t > 0) { t--; int n = sc.nextInt(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
91f23b2d31aeaece3339617a8c46118c
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; import java.text.*; public class Main{ public static void main(String args[]) throws IOException{ Read sc=new Read(); int n=sc.nextInt(); for(int i=0;i<n;i++){ Map<String,Integer> map=new HashMap<>(); ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output
PASSED
2f44e73679aa7bc4473f114a83f96b60
train_109.jsonl
1661871000
Three guys play a game: first, each person writes down $$$n$$$ distinct words of length $$$3$$$. Then, they total up the number of points as follows: if a word was written by one person — that person gets 3 points, if a word was written by two people — each of the two gets 1 point, if a word was written by all — no...
256 megabytes
import java.util.*; import java.io.*; public class Main { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; public static void main(String args[]) throws IOException { int t=in.nextInt(); while(t-->0){ ...
Java
["3\n\n1\n\nabc\n\ndef\n\nabc\n\n3\n\norz for qaq\n\nqaq orz for\n\ncod for ces\n\n5\n\niat roc hem ica lly\n\nbac ter iol ogi sts\n\nbac roc lly iol iat"]
1 second
["1 3 1 \n2 2 6 \n9 11 5"]
NoteIn the first test case: The word $$$\texttt{abc}$$$ was written by the first and third guys — they each get $$$1$$$ point. The word $$$\texttt{def}$$$ was written by the second guy only — he gets $$$3$$$ points.
Java 17
standard input
[ "data structures", "implementation" ]
f8a89510fefbbc8e5698efe8a0c30927
The input consists of multiple test cases. The first line contains an integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer $$$n$$$ ($$$1 \leq n \leq 1000$$$) — the number of words written by each person. The...
800
For each test case, output three space-separated integers — the number of points each of the three guys earned. You should output the answers in the same order as the input; the $$$i$$$-th integer should be the number of points earned by the $$$i$$$-th guy.
standard output