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
8152b27658b5a55020bed2b893f28814
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i < j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class SolutionBBB { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int t = in.nextInt(); while (t-- > 0) { int n = in.nextInt(); long[] arr = new long[n]; HashMap<Long,Long> map =...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a6048084cba4b546f2132f87fac68b65
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Solution{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t=Integer.parseInt(br.readLine()); for(int i=0;i<t;i++) { ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
e9217c2897c24b906a33eef32c6874e0
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.Scanner; public class Demo1 { public static void main(String args[]) throws Exception{ Scanner sc=new Scanner(System.in); int q=sc.nextInt(); for (int iq=1;iq<=q;iq++){ int n=sc.nextInt(); long ar[]= new long[n+1]; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6ad1f8e4cbb278dd6fa6ab1ba578a204
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize reader for InputStr...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
ac95ed0acff7e4b0fdc8b61b9a728bd2
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class abc { //utilities //Main public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0) { int n=sc.nextInt(); long a[][] =new long[n][2]; for (int i = 0; i...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d9cb99a01e047b6265b48ab5f443bb47
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main(String[] args) throws java.lang.Exception { FastReader in = new FastReader(Sy...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
f27eddb05cc4cf91c846d0935ca6e821
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; public class contest728 { public static void main(String[] args) { FastScanner fs = new FastScanner(); ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
fb88df052d22bf73e51e944ca1f140f4
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Random; import java.util.Stack; impor...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
ba3a75c52d0e104a14e02035708663ac
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class ProblemE { public static void main(String[] args) throws IOException { Reader io = new Reader(); PrintWriter pw = new PrintWriter(System.out); int t = io.nextInt(); while(t-- > 0) { int n = io.nextInt(); long[] arr = new long[n +...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 8
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
21da2d8b796b661d67061b1826079d41
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class PleasantPair { public static void main(String[] args) { FastReader s = new FastReader(); int t = s.nextInt(); try{ while (t>0) { int count=0; int n=s.nextInt(); long ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
f6b68d795d58dd164b3058f92889a79d
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*;import java.lang.*;import java.util.*; // number of prime numbers less then or equal to x are --> x/ln(x) public class b {static class FastScanner {InputStreamReader is;BufferedReader br;StringTokenizer st; public FastScanner() {is = new InputStreamReader(System.in);br = new BufferedReader(is);}...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a34a27d2dc32b0767c95cad81ede6bef
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*;import java.lang.*;import java.util.*; // number of prime numbers less then or equal to x are --> x/ln(x) public class b {static class FastScanner {InputStreamReader is;BufferedReader br;StringTokenizer st; public FastScanner() {is = new InputStreamReader(System.in);br = new BufferedReader(is);}...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
5782d9d8aa1b219a5fbf28cfebdeb177
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*;import java.lang.*;import java.util.*; // number of prime numbers less then or equal to x are --> x/ln(x) public class b {static class FastScanner {InputStreamReader is;BufferedReader br;StringTokenizer st; public FastScanner() {is = new InputStreamReader(System.in);br = new BufferedReader(is);}...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
52c9db00e98342b62e0f41d914d00746
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; public class edoti { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); long[] a = new long[n + 1]; for (int i = 1; i < n + 1; i++) { a[i] = s.nextInt(); } long count = 0...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
9cf87fb1451f5b209af38a8dfaf0202b
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; public class edoti { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); long[] a = new long[n + 1]; for (int i = 1; i < n + 1; i++) { a[i] = s.nextInt(); } long count ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
5da0e36397fcb176362ecd7b7eb02190
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; public class edoti { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); long[] a = new long[n + 1]; for (int i = 1; i < n + 1; i++) { a[i] = s.nextInt(); } int count...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
ba5dcbab92e675d6a000d85ff4677ba5
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); static void solve(int a...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
4f35a1a5d23df8e22c800f4a9c477ac3
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); static void solve(int a...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
9a27073ff8aa5bf8217a713544900185
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); // static void solve(in...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
1e9a6627c4edc897c78c2f5c50b43fab
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); // static void solve(in...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
01bffe2a715b2bb695621999ab9fafd5
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); // static void solve(in...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
40f5b6671e3000f70f84088b4253dc16
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class b { static PrintWriter out = new PrintWriter(System.out); // static void solve(in...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
627d840a51f865245dee0f6abeaf2643
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class B { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException { int t = Integer.parseInt(reader.readLine()); for (int ii=0;...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
1779fd7783018765f1d60f0c5b9fc975
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); while(t-->0) { long n=sc.nextLong(); long...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
c3412950bc9f162abfa6b77a0b6536be
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { FastReader sc =new FastReader(); int t=sc.nextInt(); long brr[] = new long[10000000]; while(t-->0) { long n=s...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
f9ce6f5cfd4365b94d7eb97ce8af6de1
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; 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.LinkedLi...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
e56c7fc0437919b74c0e9e46e96e260f
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; 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.LinkedLi...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
14f94b97926719e4a72f8f2b015d0fe0
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class work { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0){ int n = scan.nextInt(); ArrayList<Long> list = new ArrayList<Long>(); for(int i = 0; i < n; i++) ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
52f02020179902c94f4748e8572394a6
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class work { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-- > 0){ int n = scan.nextInt(); Item[] a = new Item[n]; for(int i = 0; i < n; i++) a[i] = new Item(scan.n...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6810357d0e16fda6d385280606383fa0
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.Map.Entry; public class codeforces { static int mod = 1073741824; public static void main(String[] args) { FastReader sc = new FastReader();...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
fc805b7a94915c7d0dcf74a0bf8df12c
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.util.Map.Entry; public class codeforces { static int mod = 1000000007; public static void main(String[] args) { FastReader sc = new FastRea...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
e6e631e2fc829c4492c8e82426a9ef2f
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.*; public class Codeforces { public static void main(Str...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
1fc05980381ed6702afaa79678897885
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class InsertionSort { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int a[] = new int[n+1]; for(int i = 1 ;i<=n;i++) { a[i]...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
77e029d8df485fb96db7e6bca9acc540
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; public class Greph { public static class FastReader { BufferedReader b; StringTokenizer s; public FastReader() { b=new BufferedReader(new InputStreamRea...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
9481b1682c56ea94b16cd2d5d423c1fe
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; /** * * @author eslam */ public class PleasantPairs2 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
b2682a13cca7e38949baaa699b243e0c
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; /** * * @author eslam */ public class PleasantPairs { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); for (int i = 0; i < t; i+...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
3ec594bf93f5b64d82fcc747fb4cd1d4
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codeforces { static FastReader sc=new FastReader(); public static void main (String[] args) throws java.lang.Exception { // your code goes here StringBuffer sb=new StringBuffer(); int t=I(); while(t-->0) { int n=I();...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
af4cefcaa0d33df2318700ae2047e5d9
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codeforces { static FastReader sc=new FastReader(); public static void main (String[] args) throws java.lang.Exception { // your code goes here StringBuffer sb=new StringBuffer(); int t=I(); while(t-->0) { int n=I();...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
5517852fa8d98f9a087f349b966f31f2
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws java.lang.Exception{ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); int a[]=new int[n+1]; for(int i=1;i<=n;i++) { a[i]=sc.nextInt(); } long c=0; for(...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d3a47ddea6934c8a4f61b4f89bcc50ee
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class solver { public static void main(String args[]) throws Exception { InputStreamReader r = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(r); //n is the number of test cases int n = Integer.parseInt(br.readL...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
77da9bd24fd4c3b540087f61db716d1f
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class asd{ public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); HashMap<Long,Long> hm=new HashMap<>(); ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
0edef8000ca30883e4ab365a2c2aa3ac
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class hashda{ public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); HashMap<Long,Long> hm=new HashMap<>();...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
0f8c385cdc0766822d4c728880d4f25b
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStre...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
52a5047324abad6f9c4db11b27d1d8d4
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //import java.util.Scanner; import java.util.*; public class t { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReade...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
e201487e2244f82cc5edc8e644573423
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; //import java.util.Scanner; import java.util.*; public class t { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader(){ br = new BufferedReade...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
4a86570577eb8f3ab6f59cb60b3664b6
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter sout = new PrintWriter(outputStream)...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6de27726864fee105efa7b5c57cf8552
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
//package Java; import java.io.*; import java.text.DecimalFormat; import java.util.*; import java.util.Map.Entry; public class Main { static int dirx[]= {-1,1,0,0};static int diry[]= {0,0,-1,1}; static final PrintWriter out = new PrintWriter(System.out, true); static final FastScanner sc = new FastScann...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
713f6b05843ca3963017ff73aebc2bdf
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
//package Java; import java.io.*; import java.text.DecimalFormat; import java.util.*; import java.util.Map.Entry; public class Main { static int dirx[]= {-1,1,0,0};static int diry[]= {0,0,-1,1}; static final PrintWriter out = new PrintWriter(System.out, true); static final FastScanner sc = new FastScann...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
7a54115e61a7e20e8aef378cc3766cdd
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
//package Java; import java.io.*; import java.text.DecimalFormat; import java.util.*; import java.util.Map.Entry; public class Main { static int dirx[]= {-1,1,0,0};static int diry[]= {0,0,-1,1}; static final PrintWriter out = new PrintWriter(System.out, true); static final FastScanner sc = new FastScann...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
86aba5db2d089f0e535c6d15f6ab6f51
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; 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(); ArrayList<int[]> a = new ArrayList<>(); ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
8f46a457ff7fd4996bdc5f0529b0400e
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; import java.util.*; public class Main{ // public static int floor(ArrayList<int[]> a,int i,int j,int m){ // while(i<=j){ // int mid = i+(j-i)/2; // if(a.get(mid)[0]==m){ // return mid; // }else if(a.get(mid)[0]<m){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a2f0d5dc13cd569406991c3d41f93dfb
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws java.lang.Exception{ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); int a[]=new int[n+1]; for(int i=1;i<=n;i++) { a[i]=sc.nextInt(); } long c=0; for(...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
23f85c95483655507226a19c7b917ebd
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } private FastScanner sc; private PrintWriter pw; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d06eab4ed7a6d8c50c4aab3eddfc4c75
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigInteger; import java.io.*; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "whatever", 1 << 26).start(); } private FastScanner sc; private PrintWriter pw; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
752444fc804400ccc77b68633dd3458c
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class PlesentPairs { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int tt = sc.nextInt(); while(tt != 0){ int n = sc.nextInt(); ArrayList<Long> arr = new ArrayList<>(); for(int i = 0;i < n;i...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a30f1c29da4faa69b46ed00ba78c7f42
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/*import java.util.*; public class PlesentPairs { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int tt = sc.nextInt(); while(tt != 0){ int n = sc.nextInt(); long arr[] = new long[n+5]; for(int i = 1;i <= n;i++){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
20caeadfc6e00b379ced392c919643dc
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class PlesentPairs { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int tt = sc.nextInt(); while(tt != 0){ int n = sc.nextInt(); long arr[] = new long[n+5]; for(int i = 1;i <= n;i++){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
087fa15e74327c55da28e5f3f0f13f3a
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class pleasentpairs{ public static void main(String ...asda){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int []a=new int[n+1]; for(int i=1;i<=n;i++) a[i]=sc.nextInt(); int c=0; for(int i=1;i<=n;i++){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
fa503ddb250375a0edfca2119768c231
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private final DataInputStream din; private final byte[] buffer; private int bufferPointer, byte...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6ecc312c62e3ab80b0ed9bbeab067658
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; public class Main { static class Reader { final private int BUFFER_SIZE = 1 << 16; private final DataInputStream din; private final byte[] buffer; private int bufferPointer, byte...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
871b90940dacc77757fc7f8485900cdb
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class PleasantPairs { static BufferedReader br = new ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
aa514a90d64eaac5cac3d54897b55c5d
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class PleasantPairs { static BufferedReader br = new ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a572ef33e63c7b45cf98f89ec36901fd
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Extras { static class pair { long first; long second; pair(long f, long s) { first = f; second = s; } // @Overr...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
441412cade27a80dead93256b1267b0c
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * A...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
960c5fd18d738aed0851ef64003827cb
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.math.*; import java.util.*; /* author : Multi-Thread */ public class B { // public class Main { // static int INF = 998244353; static int INF = (int) 1e9 + 7; static int MAX = Integer.MAX_VALUE; static int MIN = Integer.MIN_VALUE; public static void main(String[] ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
7c528ba26b4794e72ff3014787b77a24
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; import java.io.OutputStreamWriter; import java.io.BufferedWriter; import java.io.IOException; public class pleasantpairs { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int tt = in.nextInt(); BufferedWriter log = new B...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
c2dd14ca3b2abd57f2000cbf00c6e988
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.*; import static java.lang.System.out ; public class CP0065 { public static void main(String args[])throws Exception{ PrintWriter pw = new PrintWriter(out); ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
167c29856c1386f9677fc66215d22084
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
// import static java.lang.System.out; import static java.lang.Math.*; import java.awt.desktop.AboutHandler; import java.lang.reflect.Array; import java.util.*; import java.io.*; import java.math.*; import java.util.concurrent.Phaser; public class Main { static FastReader sc; static long mod =...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
b1d91e75d3aab577f61f387b2aa0fafe
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.sqrt; import static java.lang.Math.pow; import static java.lang.System.out; import static java.lang.System.err; import java.util.*; import java.io.*; import java.math.*; public ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d9112d8d373fcbd55d33b9e931c2e803
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.Math.sqrt; import static java.lang.Math.pow; import static java.lang.System.out; import static java.lang.System.err; import java.util.*; import java.io.*; import java.math.*; public ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
702f7ccc13b0b4f6e59f5891946fe5d1
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class Pleasant_Pairs { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int t = sc.nextInt(); while(t-->0) { int n = sc.nextInt(); int arr[] = new int[n+1]; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
3ec7763338940f471e0f6965cd28ccd0
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class Pattern { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { int n = scan.nextInt(); int a[] = new int[n+1]; for(int i =1;i<=n;i++) a[i] = scan.nextInt(); int count =0; for(long...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
81c5889509bfb445b74782fae425cb08
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class cp { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d77c5d6fef882f55f4a1dc5796509a53
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class cp { static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
360879d5d4a28f56b85b84edfef60b79
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Comparator; public class Main { private static void run() throws IOException { int n = in.nextInt(); Node[] a = new Node...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
19bc02a37810deeeeb738f621d547c59
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class Main{ public static long nPairs(int arr[],int n,HashMap<Integer,Integer> hmap){ long count=0; int max=2*n; for(int i=0;i<n;i++){ for(int j=1;j*arr[i]<=max;j++){ if(!hmap.containsKey(j)) ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
242ab23ca6e4832206a0793bb2726cc6
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); int arr[] = new int[n+1]; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
ab5fa20face971e5b205a2528a3c8c6b
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/*package whatever //do not write package name here */ import java.io.*; import java.util.*; public class GFG { public static void main (String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while(t-- > 0){ int n = scn.nextInt(); int arr[] = new int[n+1]; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
51a5c38207b1f6c86d40a74be8a07919
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-- > 0) { int n = s.nextInt(); int[] a = new int[n + 1]; for(int i = 1; i <= n; i++) a[i] = s.next...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
5efd8e585920f3d3a75369e413b771a7
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import java.util.*; import static java.lang.System.out; public class Solution { static MyScanner str = new MyScanner(); // static Scanner str = new Scanner(System.in); // ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6adcc7d728ba49a48b74dd126a67c1fd
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) throws java.lang.Exception{ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int a[]=new int[n+1]; for(int i=1;i<=n;i++) { ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
2b0657d649fc7ef831398d591416478d
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class B1541 { public static void main(String[] args) { FastReader fs = new FastReader(); int t = fs.nextInt(); StringB...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
2ffeee0302f0344d0a2efa989e0671f6
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
// Working program with FastReader import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class PleasantPairs { public static void main(String[] args) { FastReader fs = new FastReader(); int t = fs.nextInt(); S...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
198387ea007c66bc33b441ea99e9bd22
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.lang.*; import java.io.FileReader; import java.io.IOException; import java.math.BigInteger; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.util.*; im...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
4927d083864f099f8b420b44b7f243a9
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class B_Pleasant_Pairs { public static void main(String[] args) throws java.lang.Exception{ Scanner sc=new Scanner(System.in); int T=sc.nextInt(); while(T-->0) { int n=sc.nextInt(); int a[]=new int[n+1]; for(int i=1;i<=n;i++) { a[i]=sc.nextInt(); } long c=...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
709a17b7df08f5a1e1bbffb66b15447c
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class A { static class Pair { long x; long y; public Pair(long x, long y) { this.x = x; this.y = y; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder str = new StringBuilder(); int t = sc.nextInt(); for (...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
5b95648fc0ad92df69b2d9072fc7b3b4
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Main { //----------- StringBuilder for faster output------------------------------ static StringBuilder out = new StringBuilder(); public static void main(String[] args) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
6ec60db79c13ed9b7ab83f9a4c4209df
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Main { //----------- StringBuilder for faster output------------------------------ static StringBuilder out = new StringBuilder(); public static void main(String[] args) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
b696961e015df0bb4e197b9ea7ebfbfd
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.*; import java.util.*; public class Main { //----------- StringBuilder for faster output------------------------------ static StringBuilder out = new StringBuilder(); public static void main(String[] args) { FastScanner fs=new FastScanner(); /****** CODE STARTS HERE *****/ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
eeea6ef0dee85f4c07dbe4f755ee14d9
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; public class PleasantPairs { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); long[] a = new long[n + 1]; for (int i = 1; i < n + 1; i++) { a[i] = sc.nextInt(); } long co...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
f22cccdeb7bd025883997bd0906f9767
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class B{ public static void main(String[] args){ FastReader sc = new FastReader(); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int[]a=new int [n+1]; ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
2b068635d8bcb635095567910f51252e
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.util.*; import java.io.*; public class Pleasant_Pairs { public static void main(String[] args) throws java.lang.Exception { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(input.readLine()); for(int i=0;i<t;i++){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
d181ab1087f7e936d1484c7a5f9436b3
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.TreeSet; public class Main { static boolean hasMultipleTestCases = true; static final String newLine = "\n"; public static void main(String[] args) { InputR...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
ba76d0153cf0c3b7987c698fd570fbf5
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.InputMismatchException; import java.util.TreeSet; public class Main { static boolean hasMultipleTestCases = true; static final String newLine = "\n"; public static void main(String[] args) { InputR...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
35b427b5c04cc5786f6024320ff2fd38
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // your code goes here Buf...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
c779768ca94e34f695b17b495dee2c96
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
/* ⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀⢠⠞⠉⠙⠲⡀⠀ ⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀⡏⠀⠀Y⠀⠀⢷ ⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀⢸⠀⠀A⠀⠀ ⡇ ⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀⣸⠀⠀S⠀ ⡇ ⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀⢹⠀⠀H⠀⠀ ⡇ ⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀⡇⠀⠀⠀⠀⡼ ⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀⠘⠤⣄⣠⠞⠀ ⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀ ⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀ ⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀ ⣿⣿⣧⣀⣿………⣀⣰⣏⣘⣆⣀⠀⠀ */ import java.io.BufferedReader; imp...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
8dff26219b52df4b1c0552827e614d45
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class pairs{ static class pair{ long ele; long pos; pair(long x,long y){ ele=x; pos=y; } long getEle(){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
a846ee1317d68ad92717a6e7223c5bfa
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import java.io.DataInputStream; import java.io.IOException; import java.io.PrintWriter; import java.util.*; public class pairs{ static class pair{ long ele; long pos; pair(long x,long y){ ele=x; pos=y; } long getEle(){ ...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
1a97e9d7a7e7ed68e5a092149c709099
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; import java.util.Map.Entry; public class MacroTemplates { public static void main(String hi[]) throws Excep...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output
PASSED
24b9a2246656f4d742fa268d596356f9
train_107.jsonl
1624635300
You are given an array $$$a_1, a_2, \dots, a_n$$$ consisting of $$$n$$$ distinct integers. Count the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
256 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; import java.util.Map.Entry; public class MacroTemplates { public static void main(String hi[]) throws Excep...
Java
["3\n2\n3 1\n3\n6 1 5\n5\n3 1 5 9 2"]
2 seconds
["1\n1\n3"]
NoteFor the first test case, the only pair that satisfies the constraints is $$$(1, 2)$$$, as $$$a_1 \cdot a_2 = 1 + 2 = 3$$$For the second test case, the only pair that satisfies the constraints is $$$(2, 3)$$$.For the third test case, the pairs that satisfy the constraints are $$$(1, 2)$$$, $$$(1, 5)$$$, and $$$(2, 3...
Java 11
standard input
[ "brute force", "implementation", "math", "number theory" ]
0ce05499cd28f0825580ff48dae9e7a9
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 10^4$$$) — the number of test cases. Then $$$t$$$ cases follow. The first line of each test case contains one integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — the length of array $$$a$$$. The second line of each test case contains $$$n$$$ space separated integer...
1,200
For each test case, output the number of pairs of indices $$$(i, j)$$$ such that $$$i &lt; j$$$ and $$$a_i \cdot a_j = i + j$$$.
standard output