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
3456728e281d68f9eb36902585296073
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class aa { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); //int t = 1; int a[] = {2, 3, -2, -3}; while(t-->0) { int n=sc.nextInt(); int out = 0; if(...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
9b7881a2e2da8c692778b17f39e6937c
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.StringTokenizer; public class Main { public static class MyScanner { // https://codeforces.com/blog/entry/7018 BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
ef3dc7451a19ba46e179d9aad788a74c
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import static java.lang.Integer.parseInt; import static java.lang.Long.parseLong; import static java.lang.Double.parseDouble; import static java.lang.Math.PI; import static java.lang.Math.min; import static java.lang.System.arraycopy; import static java.lang.System.exit; import static java.util.Arrays.copyOf; import j...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
7f68838d502262362eeaa4351f1263fa
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class test { public static void main(String[]args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); long[] arr = new long[t]; for(int i = 0;i < t;i++) {arr[i]=scan.nextLong();} for(int i = 0;i < t;i++) { long steps=(arr[i]/3)-1; if(arr[i] == 2 ||arr[i...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
fcbcfeb34cdcf2f7301b876caefa3c3d
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { // System.out.println("Hello World"); Scanner scn=new Scanner(System.in); int t=scn.nextInt(); while(t-->0){ int n=scn.nextInt(); int ans=0; if(n==1){ ans=2; } else if(...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
d99c929ed51c2d088f51fb4d0a6a2fcd
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
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 Public { public static void main (String[] args) throws java.lang.Exception { try{ Scanner sc = new Sc...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
4854c7ce3e2abad0295f9beb1701daec
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class _2_3_Moves { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int noOfTests = sc.nextInt(); while(noOfTests-->0){ int n = sc.nextInt(); if(n==1) { System.out.println...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
c7eec26cb5ba32b15f24dd5c5bd4c546
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); while(n>0){ int fnl=sc.nextInt(); if(fnl<0){ fnl=-fnl; } int curr=0; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
8018796eafda182c8232392f32a1366b
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
// Online Java Compiler // Use this editor to write, compile and run your Java code online import java.util.*; public class HelloWorld { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int num=sc.ne...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
5258eb10dddab715c308d4a0cac8d59c
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.*; public class A_TwoThreeMoves { public final static MyScanner sc = new MyScanner(); public static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
b1508fd522dee31a742e9f6238845140
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class MyClass { public static void main(String[] args) { var in = new Scanner(System.in); int test = in.nextInt(); for (int i=0; i<test;i++){ int n = in.nextInt(); if (n==1) { System.out.println(2); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
1541cdc9399e350760f8afc2696e7fa1
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
//package com.company; import java.io.*; import java.util.*; public class Main{ static final Random random = new Random(); static boolean[] primecheck; static ArrayList<Integer>[] adj; static int[] vis; static int[] parent; static int[] rank; static int[] fact; static in...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
b1c78100f7941867f1f3be4cfd476eae
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.net.Inet4Address; import java.util.*; public class Main { private boolean oj = System.getProperty("ONLINE_JUDGE") != null; private FastWriter wr; private Reader rd; public final int MOD = 1000000007; /************************************************** FAST I...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
479976c680fe8a07794a28c86f93f3e3
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class codeforces { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-->0){ int a = sc.nextInt(); a = Math.abs(a); if(a==1) System.out.println(2); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
16f7d1bba2e1e2be8547acfa778376b8
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import j...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
21fd42c5bb540951083ab9396e2bf5df
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import j...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
d8ab713f470be2ee9eb2b6282b10303a
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); String nul = in.nextLine(); for(int i=0;i<t;i++){ long a = in.nextLong(); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
e3109f929231b1e8f91ca150770895c2
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.math.BigInteger; import java.util.*; import java.util.stream.Collectors; public cla...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
d81b7f92711c9758357cef7fe660caec
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class CodeForce1 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); int ans=0; for(int i=0;i<t;i++) { int n=sc.nextInt(); if(n%2==0 && n%3==0) { System.out.println(ans=n/3); }else if(n==2 || n==4) { ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
9889fb041cbeb0604a6528a6c58bd5be
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { // write your code here Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); if(n%3==0) System.out.println(n/3); else if(n%3=...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
bff742527db36a57efa36d4c8a478bc8
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.util.stream.Collectors; import java.util.stream.LongStream; public class Main { static Scanner in = new Scanner(System.in); public static void generator() { } public static void solve(int n) { int count; if (n == 1){ Syste...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
5fc7d622ae1c5347e9f2afe3ad015698
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import org.w3c.dom.ls.LSOutput; import java.util.*; import java.util.function.IntBinaryOperator; public class Example { static long[][] dp; // static int[] ar; static int mod = 1000000000 + 7; static long[] ans = new long[100000 + 1]; static List<List<Integer>> adj; static...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a9bd438cf6af830aa45c289067e80a95
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Moves { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
4074d59b59dc71462d014000bc4438f3
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class code4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int t = input.nextInt(); while(t-- > 0) { int n = Math.abs(input.nextInt()); if(n == 1){ System.out.println(n+1); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
fc802fce7b4991cc4138ee2601dab39a
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.PriorityQueue; import java.util.Scanner; /** * * @author xpeng */ public class codeforces { static class obj { int prev, index, val; obj(int prev, int in...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
65268550577e1bf8486929724565817e
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Main { // For fast input output static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { try { br = new BufferedReader( new InputStreamReader...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
daa8238a15c085fb5b011567e710a648
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader( new InputStreamReader(System.in)); } String next() ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
f78a5e904455dd52c436dd081d6649e4
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.*; import java.math.BigInteger; import java.util.stream.Collectors; public class Main { InputStream is; PrintWriter out; String INPUT = ""; void run() throws Exception { is = System.in; out = new PrintWriter(System.out); solve(); ou...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
76c0049f64954096e4bb3e36a7921656
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.*; import java.util.Map.Entry; import java.util.regex.Pattern; public class a { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.i...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
e718b2df382b2b29404efa12789e2c29
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.lang.*; import java.math.*; public class New { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t= sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int ans1=n/3; int ans2=n/2; if(n==1) { System.out.println(2); c...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
270d68a0776e84b8ec80bb3f38ca4ded
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Two { public static void main(String args[]) { Scanner s=new Scanner(System.in); int t=s.nextInt(); int a[]=new int[t]; for(int i=0;i<t;i++) a[i]=s.nextInt(); for(int i=0;i<t;i++) { int x=a[i]; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a2dbfa0ad517f8e03bac95f66f0c3a68
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Solution { // TODO global variables - must be static public static void main(String[] args) { Scanner scanner = new Scanner(System.in); // testcase int t = Integer.parseInt(scanner.nextLine()); for (int testcase = 0; testcase < t;...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
9991f66aa2c84c563aced514917b0370
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); for(int z = 0; z < t; z++){ int n = in.nextInt(); if (n == 1) System.out.println(2); else if (n % 3 == 0) System.ou...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
6eaa867ecfcc87fe2a6c61d26a554987
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int testNum = sc.nextInt(); StringBuilder ans = new StringBuilder(); for (int i = 0; i < testNum; i++) { int num = sc.nextInt(); if (nu...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
134410f2e68e4681a5404ae87b547e4c
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.math.*; import java.util.*; public class Main { static final int INF = 0x3f3f3f3f; static final long LNF = 0x3f3f3f3f3f3f3f3fL; static int n; public static void main(String[] args) throws IOException { initReader(); int t=nextInt(); while (t--!=...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
5ccb039149a23ee406e4fda177fef5c5
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; public class Run { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); int numberSets = Integer.parseInt(br.readLine()); for (int nos = 0; nos < numberSets; nos ++) { int dist = Integer.parseI...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
e18ae3c0730fe562d578b4054ef8eef4
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class Problem1716A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int t = sc.nextInt(); for (int i = 0; i < t; i++) { solve(); } } public static void solve() { long n = sc.nextLong(); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a158fb5a31dbee3f44021f6faaab4e09
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner kb = new Scanner(System.in); int t = kb.nextInt(); while(t-- > 0) { int n = kb.nextInt(); if(n < 3) { if(n==2) ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
ef7513719985b35f8fb1767828b21e50
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String []args) { Scanner scan = new Scanner(System.in); int testCase = scan.nextInt(); List<Integer> answers = new ArrayList<>(); int j = 0; while(j < testCase) { int point = scan.nextInt();...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
d31687743a0dac14a8ed19b0bdbd2df2
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class TwoThreeMoves { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int tc = scanner.nextInt(); for (int i = 0; i<tc; i++){ int a =scanner.nextInt(); int byThree = Integer.MAX_VALUE; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
e5f8cb6cc1c20ad3cacd9d0fa046a920
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.awt.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class sol { public static void main(String[] args) { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWr...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
6a39a43b229d93a0a3da567f23a5bd9b
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
//package Java3rdyearPracticals; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); int...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
60c4bf45d3e4b9af960418cddecad8e0
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.awt.*; import java.io.*; import java.util.*; public class Main { static class QuickReader { BufferedReader in; StringTokenizer token; public QuickReader(InputStream ins) { in=new BufferedReader(new InputStreamReader(ins)); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
f610586657bca0172033bfcb2ef5cd4b
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Moves{ static void solve(Scanner in, PrintWriter out){ int n = in.nextInt(); if(n == 1){ out.println(2); return; } if(n % 3 == 0) out.println(n/3); // else if(n % 3 == 1) out.print...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
ea779b9a55dd16b4b5acd2d94ab85a4d
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Main { static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.h...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
01fefcc844cc5e71f20493750369eb2c
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int cycle = input.nextInt(); // int cycle = 4; // int[] arr = new int[]{1,3,4,12}; for (int i = 0; i < cycle; i++) { System...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
d6340df851a4b76b63299a27a221d15b
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
// Created By Jefferson Samuel => JeffIsHere import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockin...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
338832a60bb5506bfae7b42459ff74bb
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t, n; t = sc.nextInt(); while(t-- > 0){ n = sc.nextInt(); if(n==1) System.out.println(2); else if(n%3 ==0) Sys...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
23559b301e860bb072b44c8117d0ba1a
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Main { static int mod = 1000000007; static void read(int arr[], int start, int end, FastReader in) { for (int i = start; i < end; i++) { arr[i] = in.nextInt(); } } static int sumArr(int arr[]) { ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
927a3fb4c56b65620a0ccb20b71046aa
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.*; public class solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int ans=0; int k=n/6; if...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
f7c5d8113bb559a67d95be4c0f70f392
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; import java.util.*; public class solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=1; t=sc.nextInt(); while(t-->0) { int n=sc.nextInt(); int p=0; p=n/6; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
33e11a9e633634b5c66a9bc0343e7fb8
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; public class Main { public static void main(String args[]) { int t; Scanner scn=new Scanner(System.in); t=scn.nextInt(); for(int i=0;i<t;i++) { int n=scn.nextInt(); int a=n/3; if(n==1) ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
6387837293a43a3fdce4bd19bde76bab
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.lang.*; // import java.math.*; import java.io.*; import java.util.*; public class Main{ public static int mod=(int)(1e9) + 7; public static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter ot=new PrintWriter(System.out); public static int[] ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
97851d028e73797954bb88fa929e5292
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
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(System...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
aa8ef1b9179745c9ca3bdcc2c8f2dfa5
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { FastReader sc = new FastReader(); int t = sc.nextInt(); while(t-->0){ int n = sc.nextInt(); if(n == 1) out.println(2); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a9b5caa370e4456574e0e9a5d7847ed3
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; /** * * @author Caio */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int casosPrueba = sc.nextInt(); while (casosPrueba-- > 0) { int a = sc.nextInt(); if(a == 1){ ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
404958bf73010807bac02abec32016f8
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.ArrayList; import java.util.*; public class Sol2 { public static void main(String[] args) { Scanner in =new Scanner(System.in); int t=in.nextInt(); while(t-->0) { int n=in.nextInt(); if(n==1) System.out.println("2"); else if(n==2) System.out.println("1"); else if...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
41060a42757cdf6ad5bbe80afee59c1a
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; import java.lang.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while(t-->0){ int x = sc.nextInt(); if(x==1){ System.out.println(2); }else if(x%3==0){ ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
845b1f84f999958dbe8b7081221ed78b
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.Scanner; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { // TODO Auto-generated method stub Scanner scan = new S...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
735337231527a2c7fbe439854885241a
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static int helper(int n){ if(n==1) return 2; if(n==2 || n==3) return 1; return((n-1)/3 + 1); } public static void main(String[] args) throws IOException { BufferedReader br = new BufferedRea...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
e863127baceb39478c1a258b382cc931
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { static FastReader in=new FastReader(); static PrintWriter out=new PrintWriter(System.out); static int n,m,zu; stat...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a6b0a84723f446c68ffd6af404486743
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(; t>0; t--) { int n = sc.nextInt(); if(n%3==0) System.out.println(n/3); else if(n==1) System.out.pr...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
498a1f03c37e48a45a1eb73ad57266fd
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.Scanner; public class moves23 { public int moves(int n){ if(n==1){ return 2; } if(n==2){ return 1; } if(n==3){ return 1; } if(n==4){ return 2; } int count=0; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
f5f053e5baca6d5a74ac3973c32703db
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; public class Moves23{ public static void main(String[] args) throws IOException{ FastScanner sc = new FastScanner(false); PrintWriter write = new PrintWriter(System.out); int t = sc.nextInt(); int n; while(t-- > 0){ n = sc.nextInt(); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
1f68696a1e2194a6abf1ad4d5edb07a2
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.io.*; public class Moves23{ public static void main(String[] args) throws IOException{ FastScanner sc = new FastScanner(false); PrintWriter write = new PrintWriter(System.out); int t = sc.nextInt(); int n, moves; while(t-- > 0){ moves = 0; ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
fb484a958d36c10e5ead673ba478c330
train_109.jsonl
1659623700
You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate c...
256 megabytes
import java.util.*; import java.io.*; public class a { public static void main(String args[]) throws IOException { FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); for ( ; t > 0; t--) { long n = in.nextLong(); long y = solve(n); ...
Java
["4\n\n1\n\n3\n\n4\n\n12"]
1 second
["2\n1\n2\n4"]
null
Java 11
standard input
[ "greedy", "math" ]
208e285502bed3015b30ef10a351fd6d
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.
800
For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.
standard output
PASSED
a8ae36a4d17391782de4a504a1d0a243
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.currentTimeMillis; /* * @author: Hivilsm * @createTime: 2022-04-27, 23:29:16 * @description: Platform */ public class Ac { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(new OutputStr...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
b036d3bad318946c77e896613cd16563
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.currentTimeMillis; /* * @author: Hivilsm * @createTime: 2022-04-27, 23:29:16 * @description: Platform */ public class Ac { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(new OutputStr...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
9d234d920708bd2c60e1c31764e97f34
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.currentTimeMillis; /* * @author: Hivilsm * @createTime: 2022-04-27, 23:29:16 * @description: Platform */ public class Ac { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(new OutputStr...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
b9005d12dc03cfe058a98924fa5c2497
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.currentTimeMillis; /* * @author: Hivilsm * @createTime: 2022-04-27, 23:29:16 * @description: Platform */ public class Ac { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(new OutputStr...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
e42bfb81410d6b3cc719f460c462b325
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.System.currentTimeMillis; /* * @author: Hivilsm * @createTime: 2022-04-27, 23:29:16 * @description: Platform */ public class Ac { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(new OutputStreamW...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
81798f452d6ea31da91d0404c6542148
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class PermChain { public static void main(String[] args) { String input = "2\r\n" + "2\r\n" + "3\r\n" + ""...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
b862a716b2216f7dd757b7a2137a877b
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
// package com.test; import java.io.*; import java.util.*; public class Main { static int mod = (int) 1e9+7; private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); private static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputSt...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
f60e6b0f019d1687532115045d2e9035
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int) 1e9+7; private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); private static PrintWriter out = new PrintWriter(System.out); public static void main(String[] ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
3096bc126330dcacfd05ac3f09824f34
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; public class Main { static int mod = (int) 1e9+7; private static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); private static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.ou...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
ac093c5102dc1a146b05c9af6be34474
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.util.*; public class akarshanand2810 { public static void main(String[] args) throws IOException { solve(); } public static void solve() throws IOException { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System....
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
a9187773d3c4a7c2ddce9a936bd7f7e8
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { Reader sc = new Reader(); PrintWriter out = new PrintWriter(System.out); int t = sc.nextInt(); while(t-- > 0) { int n = sc.nextI...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
bdb22716eefc69e80dc92ed7b87f95a2
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws IOException { Reader sc = new Reader(); BufferedWriter output = new BufferedWriter(new OutputStreamWriter(System.out)); int t = sc.nextInt(); while(t-- > 0...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
565bfb659d2c04059c46350a0c0323df
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class contest { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); BufferedReader br = new BufferedReader(new ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
d7d3d365cf7a8b0bd302a4eb342ce2f9
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.security.cert.CollectionCertStoreParameters; import java.util.*; import javax.xml.transform.SourceLocator; public class B_Permutation_Chain { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); // int arr[] = new int[100]; ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
35b7bb55cd37c3ea26a4b743be0633de
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class C { static StringBuffer str=new StringBuffer(); static int n; static void solve(){ int a[]=new int[n+1]; str.append(n).append("\n"); for(int i=1;i<=n;i++){ a[i]=i; str.append(a[i]).append(" "); ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
a3262016231d71fa67d22321dc040976
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Rextester { public static void main(String args[]) throws java.lang.Exception { Scanner sc=new Scanner(System.in); BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out)); int test; ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
d1366d4fad7b8d8494235076e8d96e8c
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.lang.*; import java.util.*; public class PermutationChain { static StringBuilder sb; public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int t = s.nextInt(); while(t-- > 0) { int n = s.nextInt(); ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
fb34bfaec9c7d03cca2a82adf52cd95f
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner s = new Scanner(System.in); int t = s.nextInt(); while (t-- > 0) { int n = s.nextInt(); int pos = 1; System.out.println(n); for (int i = 1; i <= n; i++) { StringBuilder str = new StringBui...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
8ecea9033a07239ab190f610eaac29e9
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; public class B{ static class FastReader{ BufferedReader br; StringTokenizer st; public FastReader(){ br=new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(st==null || !st.hasMo...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
d0f2865ed6ca628153cc85ec0001d3e2
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class PermutationChain { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new Buffere...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
736027d7e327980bf0485c5880072dc6
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Test { public static void main(String[] args) throws IOException { Reader rd = new Reader(); int t = rd.nextInt(); while (t-- > 0) { int n = rd.nextInt(); int[] arr = new int[...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
b477f7fc28b813e98d55f4a5f5c19f6c
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.math.BigInteger; import java.util.*; public class Test { public static void main(String[] args) throws IOException { Reader rd = new Reader(); int t = rd.nextInt(); while (t-- > 0) { int n = rd.nextInt(); int[] arr = new int[...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
4ed505a3328222902cee708d612621e1
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; public class oop{ static PrintWriter pw; public static void main(String[] args) throws Exception { pw = new PrintWriter(System.out); Reader sc = new Reader(); StringBuffer sb = new StringBuffer(); int t = sc.nextInt(); wh...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
7c7ac6ebc18595f102f59cc924ec9ab4
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.*; import java.util.*; public class oop{ public static void main(String[] args) throws Exception { Reader sc = new Reader(); StringBuffer sb = new StringBuffer(); int t = sc.nextInt(); while(t-->0){ int n=sc.nextInt(); sb.append(n +...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
a0729bec8ecb332a8b7a543896b8c9d6
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.io.PrintWriter; public class Solution { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next() { while (!st.hasMoreElements()) ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
1527bd8ba9d3a841ba575128ef80bbd1
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.*; import java.io.PrintWriter; public class Solution { static class FastScanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next() { while (!st.hasMoreElements()) ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
b4f1a8911b277ec994c89c888655cb26
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B_Permutation_Chain { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); static Stri...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
18286a638fed91927d220b7621b8dae1
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); static StringBuilder ans = ne...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
832fec87cb6b2159231d87cc4201f6aa
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.io.PrintWriter; import java.util.Scanner; public class Moves { public static void solve(int n) { PrintWriter out=new PrintWriter(System.out); int A[]=new int[n]; for(int i=0;i<n;i++) A[i]=i+1; System.out.println(n); for(int i=0;i<n-1;i++) out.print(A[i]+" "); out.print(...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
a053242b04e2e95ac2bf3119d677d9f6
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.Scanner; public class Set_Intersect { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt(); StringBuffer s1=new Stri...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
9bad3d50f523be6a9b689575fc412177
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
//package CP.Codeforces.Div2_4_8_22; import java.util.*; import java.io.*; import java.util.stream.Collectors; public class Permutation { static FastReader in=new FastReader(); static final Random random=new Random(); static long mod=1000000007L; static HashMap<String,Integer>map=new HashMa...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
cb55f1f828a6f055a2dff6ae93862d75
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.io.PrintWriter; public class PermutationChain { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int[] arr = new int[1000]; PrintWriter out = new PrintWriter(System.out); while(t-->0) { int n = sc.nextInt(); for(int ...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
72ae130661f4ad8afe8a70ca9a369565
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Codechef { /* FastReader class to work with input */ static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output
PASSED
29a062e8639c883749fc2f025bf198ca
train_109.jsonl
1659623700
A permutation of length $$$n$$$ is a sequence of integers from $$$1$$$ to $$$n$$$ such that each integer appears in it exactly once.Let the fixedness of a permutation $$$p$$$ be the number of fixed points in it — the number of positions $$$j$$$ such that $$$p_j = j$$$, where $$$p_j$$$ is the $$$j$$$-th element of the p...
256 megabytes
/* https://fb.watch/2_f8UL2Jev/ watch this if you are facing rejections *********************************************** Don't Copy template it might lead to palagarism *********************************************** I only Believe on will of fire. ******************************* Work so hard, be so good...
Java
["2\n\n2\n\n3"]
2 seconds
["2\n1 2\n2 1\n3\n1 2 3\n3 2 1\n3 1 2"]
null
Java 8
standard input
[ "constructive algorithms", "math" ]
02bdd12987af6e666d4283f075f73725
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 99$$$) — the number of testcases. The only line of each testcase contains a single integer $$$n$$$ ($$$2 \le n \le 100$$$) — the required length of permutations in the chain.
800
For each testcase, first, print the length of a permutation chain $$$k$$$. Then print $$$k$$$ permutations $$$a_1, a_2, \dots, a_k$$$. $$$a_1$$$ should be an identity permutation of length $$$n$$$ ($$$[1, 2, \dots, n]$$$). For each $$$i$$$ from $$$2$$$ to $$$k$$$, $$$a_i$$$ should be obtained by swapping two elements i...
standard output