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 | f0dcafabc7b022df29e7d427ee048b0b | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | //import java.io.IOException;
import java.io.*;
import java.util.*;
public class BracketSequenceDeletion {
static InputReader inputReader=new InputReader(System.in);
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static List<LinkedHashS... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 5261bbfc4dd0f911bdc574d01b9d60fb | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.math.*;
import java.util.* ;
import java.io.* ;
@SuppressWarnings("unused")
//Scanner s = new Scanner(new File("input.txt"));
//s.close();
//PrintWriter writer = new PrintWriter("output.txt");
//writer.close();
public class cf
{
static long gcd(long a, long b){if (b == 0) {return a;}return gcd(b... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | a093b8d315dbeb97a90fb1b08d41152a | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
public class CF1{
public static void main(String[] args) {
FastScanner sc=new FastScanner();
int T=sc.nextInt();
// int T=1;
for (i... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 1208a5509d916d8a180ef7683d4ed322 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.Comparator;
import java.util.Objects;
import java.util.Scanner;
import java.util.Stack;
public class Main {
static void solve() {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for (int i = 0; i < t; i++) {
int n = scan.nextInt();
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 930bc5a7ab483b035d7e361a0c20e568 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.util.stream.LongStream;
import java.io.*;
import java.math.BigInteger;
public class Template{
public static void main(String[] args) {
FastReader fr = new FastReader();
PrintWriter out = new PrintWriter(System.out);
Scanner sc= new Scanner (Syste... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | b39e9700b8e1ae5a70f5c2a1be5cd5b7 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import static java.lang.Math.*;
import java.util.*;
import java.io.*;
import java.math.*;
public class x1657C
{
public static void main(String omkar[]) throws Exception
{
BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringToke... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | fb2b06bf915badcde312321520b7cf0c | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
public class Contest {
public static void main(String[] args) throws IOException {
// Reader reader = new Reader("c.in");
Reader reader = new Reader();
int t = reader.nextInt();
for (int ti = 0; ti < t; ti++) {
int n = reader.nextInt();
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | d7c352fe7a95ca49b30e8010022a7dd9 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;
public class BracketSequenceDeletion {
public static void main(String[] args)throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int ... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 3433b294ac304cf3d75a564a0a650333 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
public class BracketsSeqDeletions {
static boolean isPalindrome(String word, int l, int r) {
while (l < r) {
if (word.charAt(l) != word.charAt(r)) ret... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 954878ee2d49bc1f35a6a05adc55ef34 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
public class program1 {
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0)
{
int n=s.nextInt();
String str=s.next();
char ch[]=str.toCharArray();
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | faf45694179b9a21aa5c8312ed005002 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.LinkedList;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0) {
int n=sc.nextInt();
char[] str=sc.next().toC... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | d4066195464af992baa00688ffce755d | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static int t;
static int n;
static int[] a;
static String s;
static FastReader fr = new FastReader();
static PrintWriter... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 404b4b3ddd765f9c0a2a66b7396cb443 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringTokenizer st;
int t = Integer.parseInt(br.readLine()... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 62071ac99f49577f2ae3a1a24090c6fb | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class Main {
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
St... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | e591e1d78e9f477b9ed0569ff745826e | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
// import java.lang.*;
// import java.math.*;
public class Main {
static FastReader sc=new FastReader();
static PrintWriter out=new PrintWriter(System.out);
static long mod=1000000007;
// static long mod=998244353;
static int MAX=Integer.MAX_VALUE;
static int M... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | b2430e42ad4fc12e2b708810663bd9be | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
// cd C:\Users\Lenovo\Desktop\New
//ArrayList<Integer> a=new ArrayList<>();
//List<Integer> lis=new ArrayList<>();
//StringBuilder ans = new StringBuilder();
//HashMap<Integer,Integer> map=new HashMap<>();
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 169170cf73e0ac0ab55b0885a8438729 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class test {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 44f2bed28c4c35cd621c356da6c1e5ac | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.io.*;
import java.util.*;
import java.math.*;
import static java.lang.Math.sqrt;
import static java.lang.Math.floor;
public class run_code {
static class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 446a7f8b3e7bdd9388b47b27340ae35d | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | //package Codeforces;
import java.io.*;
import java.util.*;
public class C {
public static void main (String[] Z) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder op = new StringBuilder();
StringTokenizer stz;
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 0e29886ef4d4e3fc583aa3f5ae44a6a5 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long startTime = System.currentTimeMillis();
// for global initializations and methods starts here
// global initialisations and methods end here
static void run() {
boolean tc = true;
//AdityaFastIO r = n... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 0b3c3988a0ba5ce6b8795a383aa11e5f | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.io.*;
import java.util.*;
import java.lang.*;
import static java.lang.Math.*;
public class Codeforces {
static int MAX = Integer.MAX_VALUE,MIN = Integer.MIN_VALUE;
static long MAXL = Long.MAX_VALUE,MINL = Long.MIN_VALUE,MOD = (int)1e9+7;
static void solve() {
int n = fs... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 583ff77839bc4aff6a1462b0849eb2b4 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
static long INF = 2000000000000000010l;
public static void main(String[] args) throws IOException {
int t = cin.nextInt();
while (t-- > 0) {
// csh();
solve();
out.flush();
}
out.close();
}
public static void solve() {... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 30b6a9eba2b792ac47054c0dcf5c6cda | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
public class tr1 {
static PrintWriter out;
static StringBuilder sb;
static long mod = 998244353;
static Boolean[] memo;
static int n, m, id, c;
static ArrayList<int[]>[] ad;
static HashMap<Integer, Integer>[] going;
static long i... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | b7035a54bad4181195987aa92969d278 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
/*
* Author: Atuer
*/
public class Main
{
// ==== Solve Code ====//
static int INF = 2000000010;
public static void csh()
{
}
public static void main(String[] args) throws IOException
{
// csh();
int t = in.nextInt();
while (t-- > 0)
{
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 71ac51c03f89ce32573b3da1f207e6c8 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.util.*;
public class gotoJapan {
public static void main(String[] args) throws java.lang.Exception {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream)... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 6468fc983f93c494b92914b3ec6c22d5 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
public class Omar {
static Scanner sc;
static PrintWriter pw;
public static void main(String[] args) throws IOException, InterruptedException {
sc = new Scanner(System.in);
pw = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n =... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 42179f4a3a2365761da5c15870302873 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Solution {
static long cr[][]=new long[1001][1001];
//static double EPS = 1e-7;
static long mod=998244353;
static long val=0;
static boolean flag=true;
public static void main(String[] args)
{
FScanner sc = new FScanner();
//Arrays.fill(prime... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 756d653bdfb11eaf813ad327f7915d9f | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.util.*;
public class BracketSequenceDeletion {
private static final int START_TEST_CASE = 1;
public static void solveCase(FastIO io, int testCase) {
final int N = io.nextInt();
final char[] S = io.nextLine().toCharArray();
int idx = 0;
int moves = 0;
while (idx +... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 19cd662c394b8242ee1e49f79d1b650b | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.nio.Buffer;
import java.util.*;
public class Main2 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int testCases = sc.nextInt();
while (testCases -- > 0)
{
int n = sc.nextInt()... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 7f9da6e8c44d520d5be1bbf5df535fb2 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
public class MyCpClass{
public static void main(String []args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine().... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | bb59db2b8b6b7ca538d258cf58e99653 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static PrintStream out = new PrintStream(System.out);
static LinkedList<LinkedList<Integer>> adj;
static boolean[] vis;
//static ArrayList<ArrayList<Integer>> lists;
public static void main(String[] args){
FastScanner sc =... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 24c7efef635ab3104a3a124f4a441621 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[]data;
int t, n;
char... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | a74378fcfc2b1d1e7a73fba5be87578e | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | //package codeforces.educational125;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class BracketSequenceDeletion {
public static void m... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 95e17c455429e46bdc5355abd84bc1a4 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main {
static Reader rd = new Reader();
public static void main(String[] args) {
int tt = rd.nextInt();
while (tt-- > 0) {
new Solution().solve();
}
}
static class Solution {
long P1 = 1337;
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 7299e5af403bb4ab6d216efe8432fbb4 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.util.*;
public class CodeForces {
/*-------------------------------------------EDITING CODE STARTS HERE-------------------------------------------*/
public static void solve(int tCase) throws IOException {
int n = sc.nextInt();
char[] str = sc.next().toCharArray()... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 908b1aa8f5ffece077b85a5bbf6292fe | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | //package codeforces;
import java .util.*;
public class squarebracketdeletion {
public static void main(String [] args)
{
Scanner in=new Scanner (System.in);
int t=in.nextInt();
while(t>0)
{ //System.out.println(t);
int n1=in.nextInt();
in.nextLine();
String s1=in.nextLine();
int... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | a179d5363b0ff77cb5128221e6512a0a | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.util.*;
public class _1657c {
FastScanner scn;
PrintWriter w;
PrintStream fs;
int MOD = 1000000007;
int MAX = 200005;
long mul(long x, long y) {long res = x * y; return (res >= MOD ? res % MOD : res);}
long power(long x, long y) {if (y < 0) return ... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 4f10a4fb24a50d9be1b98baa4bff60ad | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | // package faltu;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static int upperBound(long[] arr, long m, int l, int r) {
while(l<=r) {
int mid=(l+r)/2;
if(arr[mid... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 6e08a7c2613086616a3682cecedea36e | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class HelloWorld{
public static void main(String[] args) throws java.io.IOException {
BufferedReader scan = new BufferedReader(new InputStreamReader(System.in));
int t = Integer.parseInt(scan.readLine());
while(t-... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 06fb33dc968865e9a29672690ba1f6b6 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Stack;
import java.util.*;
public class BracketSequenceDeletion {
static class Pair
{
int f;int s; //
... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 5f98dad3dbbbb55cf0baa599216bc592 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
import javax.management.Query;
import java.io.*;
public class practice {
// static int n,k;
//// static String t,s;
// static long[]memo;
// static int n;
static String s;
static HashMap<Long,Integer>hm;
public static void main(String[] args) throws Except... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | ffbe7a712fd2d90d4aafcb0c08681762 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
// Online IDE - Code Editor, Compiler, Interpreter
import java.util.*;
import java.util.Collections;
public class C_125
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++)
{
int n=sc.next... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 7f3834689a8850ab8fc801570f5c4afe | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class ER125_C{
public static FastScanner sc;
public static PrintWriter pw;
public static StringBuilder sb;
public static int MOD= 1000000007;
public static class FastScanner {
BufferedRead... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | b1c8df3e368b66e14bd9de3744708a8e | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Logger;
/**
* Accomplished using the EduTools plugin by JetBrains https://plugins.jetbrains.com/plugin/10081-edutools
*
* To modify the template, go to Prefer... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 41d56865f05b935e7d82e978071ae5a0 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | // Working program with FastReader
import java.io.*;
import java.util.*;
//
public class Example {
static BufferedWriter bw;
static {
bw = new BufferedWriter(new OutputStreamWriter(System.out));
}
static class FastReader {
BufferedReader br;
StringTokeniz... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 8 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 43b50c4c619eb1cbf90e0aefe607e4d0 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 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.Math.*;
import static java.lang.System.*;
import static java.util.Arrays.*;
import static java.util.stream.IntStream.iterate;
public class Te... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 17 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | fc6f88337ea47b06b0153c4ac7f5b56c | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes |
import java.util.*;
public class Test1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
String s = sc.next();
int op = 0, left = n, ind = 0;
while(ind < n-1) {
cha... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 17 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 49e6e6fb5f9ac0376551471b247e8213 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
public class sol {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
while(test-->0){
int n = sc.nextInt();
sc.nextLine();
String s=sc.next();
char[] ch=s.toC... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 17 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 0be4098c201f5667567c432f9b394ad3 | train_110.jsonl | 1647960300 | You are given a bracket sequence consisting of $$$n$$$ characters '(' and/or )'. You perform several operations with it.During one operation, you choose the shortest prefix of this string (some amount of first characters of the string) that is good and remove it from the string.The prefix is considered good if one of t... | 256 megabytes | import java.util.*;
public class MergeSort {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
while(test-->0){
int n = sc.nextInt();
sc.nextLine();
String s=sc.next();
char[] ch... | Java | ["5\n2\n()\n3\n())\n4\n((((\n5\n)((()\n6\n)((()("] | 2 seconds | ["1 0\n1 1\n2 0\n1 0\n1 1"] | null | Java 17 | standard input | [
"greedy",
"implementation"
] | af3f3329e249c0a4fa14476626e9c97c | The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$2t$$$ lines describe test cases. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10^5$$$) — the length of the bracket sequence. The second line of the test case ... | 1,200 | For each test case, print two integers $$$c$$$ and $$$r$$$ — the number of operations you will perform on the given bracket sequence and the number of characters that remain in the string after performing all operations. | standard output | |
PASSED | 1e4d586576db028c354bba5182d8c51d | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static FastReader in = new FastReader();
public stat... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 0e0f538d4df27cfd1bb1d319e30cd5a9 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int x = sc.nextInt();
int y = sc.nextInt();
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 47c066d4c488b177c5986426389953bf | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | edce35efcef844d95a961b04e5a7c284 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main{
public static void main(String args[])throws IOException{
// int dp[][]=new int[51][51];
// for(int i=0;i<=50;i++){
// for(int j=0;j<=50;j++){
// if(i==0&&j==0){
// dp[i][j]=0;
/... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 7e7b4fd5d784349060dd0a7260c95bdd | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class 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... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | b6e52adae6bf674c65a7734e6ef03bb8 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | // package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
for (int i = 0; i < num; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
double xsquare = x*x+y*y;
double underroo =... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 54291a6f168f7ff69c7e6b7d55ec3150 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 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
{
Scanner sc = new Scanner(Syst... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | ec68eefcfab7d817add1a4890240713d | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.Integer;
import java.lang.Math;
// import org.apache.commons.lang.ArrayUtils;
public class cod... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 2bc2aece2851e5886bd43a6ba5e2ec45 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | //package cf;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
public class integer_move {
static int map[][]=new int[51][51];
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | c1ab70ea5ba0f9a3b0189352618dea12 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class A{
static Scanner sc = new Scanner(System.in);
public static void main(String[] args){
int t =sc.nextInt();
while(t-->0)
solve();
}
public static void solve(){
int x = sc.nextInt();
int y = sc.nextInt();
doub... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 016d362c02aacba15ea7189428bc8634 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int noOfTestCases = scan.nextInt();
for(int i = 0; i < noOfTestCases; i++){
int x1 = scan.nextInt();
int y1 = scan.nextInt();
neededMoves(x1, y1);
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | b7be571eaafaa8eccb55dcf6887d0517 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int a=sc.nextInt();
int b=sc.nextInt();
if(a==0&&b==0)
{ System.out.println(0);
continu... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 8ad516fd88f9d6ff884a38946a61a6d3 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Random;
import java.util.StringTokenizer;
import javax.lan... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 626d4bb4df88ae846cbc5f9e536eb4f5 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.util.*;
public class solut {
public static void main (String[] args){
int t=sc.nextInt();
while(t--!=0) {
int x=sc.nextInt();int y=sc.nextInt();
if(x==0&&y==0) {
out.println(0);
}else {
double sq=(Math.pow(x, 2)+Math.pow(y, 2)); ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 0a6116c48ec637012fabc6bb1c783494 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class solut {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0) {
int x=sc.nextInt();int y=sc.nextInt();
if(x==0&&y==0) {
System.out.println(0);
}else {
double sq=(Math.pow(x, 2)+Math.pow(y... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | f022327181017bf8b35a733a0e8dbcca | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class solut {
static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
int t=sc.nextInt();
while(t--!=0) {
int x=sc.nextInt();int y=sc.nextInt();
if(x==0&&y==0) {
System.out.println(0);
}else {
double sq=(Math.pow(x, 2)+Math.pow(y,... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 0b1ae2fba01070e8ecdc310e38fb7a58 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
public class IntegerMoves {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t;
try {
t = sc.nextInt();
}catch(Exception e) {
t=0;
}
while(t-- > 0) {
int x2;
try {
x2 = ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 94be937c2fb6fa02c077fde54636d0a9 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.lang.*;
public class demo{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0)
{
int x = sc.nextInt();
int y = sc.nextInt();
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | bc49cc3f15bb9c5d591ae25503fc841b | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.Queue;
public class A {
static final Reader in = new Reader();
static final PrintWriter o... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | f7bf1c14570b3d8605f50f6c18495ac9 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t>0)
{
int x=sc.nextInt();
int y=sc.nextInt();
if(x==0&&y==0)
{
System.out.println(0);
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | d086f9a134eb2f12e6c97227009ff34d | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main
{
public static boolean check_sqrt(int x,int y)
{
double sq = Math.sqrt( (x*x)+(y*y) );
return ((sq - Math.floor(sq)) == 0);
}
public static void main(String[] args)
{
int q;
Scanner sc = new Scanner(System.in);
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 068f847b43b484c4453436d687bf16c6 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class IntegerMoves{
public static int getMinSquare(int x, int y, int d){
int r = 0;
while (r * r < d) ++r;
int ans = 2;
if (r * r == d) ans = 1;
if (x == 0 && y == 0) ans = 0;
return ans;
}
public static void main(String[] ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 839fc712ad327e8e6907a55534224a95 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import javax.swing.plaf.synth.SynthDesktopIconUI;
import java.lang.*;
import java.io.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=0;i<n;i++){
int a = sc.nextInt();
int b = sc.... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | cd8acd7b0256a2f60a30fabfdb5afef5 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
public class Main
{
static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws Exception
{
int distance[][] = bfs();
int tc = scanner.nextInt();
while (tc > 0)
{
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | aa112497a43e616f9380cbfef55da6f4 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class intergermoves
{
public static void main (String[]args)
{
Scanner x= new Scanner(System.in);
int t=x.nextInt();
while(t-->0)
{
int X=x.nextInt();
int y=x.nextInt();
double d=Math.sqrt((X*X)+(y*y));
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 60d123a338e916d88b15b2c067430fc9 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
import java.util.*;
public class integerMoves{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int times = input.nextInt();
for (int k = 0; k < times; k++) {
int a=input.nextInt();
int b=input.nextInt();
if(a == 0 && b == ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 3e809415283a9a96c4b60d670587bb0a | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
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());
BufferedWriter output = new Buffere... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 0e47b40f481341e02846b83f8c7cf536 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class IntegerMoves {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- >0) {
int x = sc.nextInt();
int y = sc.nextInt();
double ans = Math.sqrt(x*x + y... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 9cc5e48c13860e2a1059da766cdb8c58 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
/**
* Provide prove of correctness before implementation. Implementation can cost a lot of time.
* Anti test that prove that it's wrong.
* <p>
* Do not confuse i j k g indexes, upTo and length. Do extra methods!!! Write more informative names to simulation
* <p>
* W... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | ae0bc767a1c623d4a1c568ed3afbc38b | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
/**
* Provide prove of correctness before implementation. Implementation can cost a lot of time.
* Anti test that prove that it's wrong.
* <p>
* Do not confuse i j k g indexes, upTo and length. Do extra methods!!! Write more informative names to simulation
* <p>
* W... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | f4a9b772cb396bd9e30ec140b0ebc7aa | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
//package basicjava;
import java.util.Scanner;
import java.lang.*;
public class Biodata {
public static void main(String[] args)
{
int tc;
Scanner input=new Scanner(System.in);
tc=input.nextInt();
while(tc>0)
{
tc--;
int a,b;
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 569c2142aa2050443e560080b0469ad6 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
static final int INF = Integer.MAX_VALUE;
static final int NINF = Integer.MIN_VALUE;
static final long LINF = Long.MAX_VALUE;
static final long LNINF = Long.MIN_VALUE;
static Reader reader;
static Writer writer;
static ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 6a62a630ca989603179ac758b5ced4ab | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.util.*;
public class IntegerMove {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
for (int i=0;i<t;i++)
{
int x=s.nextInt();
int y=s.nextInt();
double first=Math.sqrt(x*x+y*y);
int ... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 82e75019e5ef2b3f7221828d437db600 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
import java.lang.Math;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int x = sc.nextInt(), y = sc.nextInt();
if (x == 0 && y == 0) {
Syst... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | be888ce3dcc8c64e6a9f97e3519e0038 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t > 0) {
int x = in.nextInt();
int y = in.nextInt();
if (x == 0 && y == 0) {
System.out.println(0);
} else if (String.valueO... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 784af8265fd02881d471dee296455ac1 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.io.*;
public class a1657A {
public static void main(String[] args) throws IOException {
BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int t = Integer.parseInt(bu.readLine());
next: while(t-->0... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | e378c435ea10d8b695a195e3acfc8d28 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Rough {
public static void main(String[] args) throws Exception {
Scanner s = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int t = s.nextInt();
while (t-- > 0) {
int x = s.nextInt();
int y = s.nextInt();
int cnt =(... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 22b87bcec365fcc817bd1927eb7c0fef | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.util.*;
public class A {
public static void main(String[] args) {
// Use the Scanner class
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int ti = 0; ti < t; ti++) {
int x = sc.nextInt();
int y = sc.nextInt();
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 3cb760f576c486ec796f16ad3f6c8814 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class CF {
public static void main(String[] args) throws IOException {
Scanner sc=new Scanner(System.in);
int T=sc.nextInt();
while(T-->0)
{
int x=sc.nextInt();
int y=sc.nextInt();
if(x==0 && y==0){
Sy... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 5f06eb1086e77005c7b067875fe848ed | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.*;
import java.util.*;
public class A_Integer_Moves {
public static void main(String[] quesgs) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i = 0; i<t; i++){
int x = sc.nextInt();
int y = sc.nextInt();
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 1035576db1655e1c6febdcd3a0c41e73 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.Scanner;
public class Solution {
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
var cas = scan.nextInt();
while (cas-->0){
var x = scan.nextInt();
var y = scan.nextInt();
boolean isFound = fa... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 70e3af5e569d15459f47c2fc57ab2c14 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.lang.Math;
public class Main{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int s=sc.nextInt();
// int x=0;
// int y=0;
for(int i=0;i<s;i++){
int x=sc.nextInt();
int y=sc.nextInt();
// float z=M... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 1646c5516e1298d7ab080b9662aa61c0 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main {
// Driver Code
public static void main(String args[])
{
Scanner sc= new Scanner(System.in);
int x,y;
double d;
int n=sc.nextInt();
for (int i=0; i<n;i++){
x=sc.nextInt();
y=sc.nextInt... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 83ea69b5d5b1d21146029b3f33fc88ed | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException {
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int tt = Integer.parseInt(in.readLine());
... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 2a3358160fd6ad52c8ffe1922d63d50d | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static void main(String[] args) throws Exception {
PrintWriter out = new PrintWriter(System.out);
InputReader in = new InputReader(System.in);
Task solver = n... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 1039039083add57784e39b8430cf330d | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Play {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t -- > 0) {
int x = sc.nextInt(), y = sc.nextInt();
if (x =... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 3e44e861d4abf15c014d2263835aefa5 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes |
/*
* akshaygupta26
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public class A {
static long mod = (long) (1e9 + 7);
public static void main(String[] args) {
F... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | ddc823c09ded4166b551f2fe01b86192 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | // package CF1657;
import java.util.Scanner;
/**
* User : ribhavpahuja
* Date : 22/03/22
* Time : 8:11 PM
*/
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-- > 0) {
int x = s.nextInt... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | bb01cf5d46a9014eb4b12a486ed1eff1 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int x,y,i;
double d;
for(i=0;i<t;i++){
x=sc.nextInt();
y=sc.nextInt();
d=Math.sqrt(x... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 41617b1ab506d850526c543c1a6ae478 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class a {
static int t;
static int x, y;
public static void main(String[] args) throws IOException {
t = in.iscan();
while (t-- > 0) {
x = in.iscan(); y = in.iscan();
if (x == 0 && y == 0) {
out.println(0);
}
else if (isPe... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output | |
PASSED | 2f2795dfe2fb43351c9ab3fe08f10a70 | train_110.jsonl | 1647960300 | There's a chip in the point $$$(0, 0)$$$ of the coordinate plane. In one operation, you can move the chip from some point $$$(x_1, y_1)$$$ to some point $$$(x_2, y_2)$$$ if the Euclidean distance between these two points is an integer (i.e. $$$\sqrt{(x_1-x_2)^2+(y_1-y_2)^2}$$$ is integer).Your task is to determine the ... | 256 megabytes | import java.util.*;
import java.io.*;
public class JavaApplication77 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner read=new Scanner(System.in);
int t=read.nextInt();
while(t-->0)
{
int n=read.nextInt(),k=read.nextInt... | Java | ["3\n8 6\n0 0\n9 15"] | 2 seconds | ["1\n0\n2"] | NoteIn the first example, one operation $$$(0, 0) \rightarrow (8, 6)$$$ is enough. $$$\sqrt{(0-8)^2+(0-6)^2}=\sqrt{64+36}=\sqrt{100}=10$$$ is an integer.In the second example, the chip is already at the destination point.In the third example, the chip can be moved as follows: $$$(0, 0) \rightarrow (5, 12) \rightarrow (... | Java 11 | standard input | [
"brute force",
"math"
] | fce6d690c2790951f7e04c622c3c2d44 | The first line contains a single integer $$$t$$$ ($$$1 \le t \le 3000$$$) — number of test cases. The single line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$0 \le x, y \le 50$$$) — the coordinates of the destination point. | 800 | For each test case, print one integer — the minimum number of operations required to move the chip from the point $$$(0, 0)$$$ to the point $$$(x, y)$$$. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.