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 | 0af5849a14f6be9b099418ec0c2700c4 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Main
{
void Solve(long n){
ArrayList<Long>v=new ArrayList<Long>(0);
long mod=n;
long ans=1;
for(long i=1;i<n;i++){
if(__gcd(i,n)==1){
v.add(i);
ans*=i;
ans%=mod;
}
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f7926b5434b505e58cd7cf99e073ed8d | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 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 product1 {
static class FastReader {
BufferedReader br;
StringTokenizer st;
publi... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6c0d659290b736775d7dad7b52e70db5 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class a2oj {
static FastReader sc;
static PrintWriter out;
static int mod = 1000000007;
public static void main(String[] args) throws IOException {
if (System.getProperty("ONLINE_JUDGE") == null) {
File f1 = new File("input.t... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 7fb1aa39f3242770b3d428e5038afa34 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> ans = new ArrayList<>();
ans.add(1);
if(n != 2) {
long prod = 1;
for(int ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 254e1a0848ce596b4d6cd4ca3b39edf3 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class p717C {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
long n=scn.nextLong();
long pro=1;
ArrayList<Long> arr=new ArrayList<Long>();
arr.add(1L);
for(long i=2;i<n;i++){
if(gcd(n,i)==1)... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f76768a0132cc6b2b915cd4a78f6bea2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*; import java.io.*; import java.math.*;
public class Main{
//Don't have to see. start------------------------------------------
static class InputIterator{
ArrayList<String> inputLine = new ArrayList<>(1024);
int index = 0; int max; String read;
InputIterator(){
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 3aa6800af24788eaf0eb2589750c70ba | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
import java.lang.*;
public class Main{
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
static long MOD = (long) (1e9 + 7);
// static long MOD = 998244353;
static long MOD2 = MOD * MOD;
static FastReader sc = new FastRea... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 2704a7d00005efc54d7dfd1b47b6b6c6 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Round716Div2C {
private static int gcd(int a, int b) {// a is larger
if(b==0)
return a;
return gcd(b,a%b);
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedR... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | baaee324b6972fbf29c8e2c6793c164e | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class C
{
public static void main(String[] args) {
new Runner().run();
}
static class Runner {
FastReader in;
public void run() {
in = new FastReader();
//int T = in.nextInt();
StringBuffer sb = new StringBuffer();
//while(T-- ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 5e9decd665ee962a4c818ce19304bdec | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.stream.Collectors.*;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.stream.*;
public class C {
static Buffe... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8b5cef083e53bb75697eba3593506478 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.PrintWriter;
import java.util.*;
public class C {
static Scanner sc;
static PrintWriter out;
public static void main(String[] args) throws Exception {
sc = new Scanner(System.in);
out = new PrintWriter(System.out);
//int t = sc.nextInt();
f... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | c84b278dcfbe8590e23b65f44931a186 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* @author Peter Li
* @version 04/19/2021
*/
public class C {
private final static int[] list = new int[100000];
private static int gcd(int a, int b) {
if (a < b) {
return gcd(b, a);
}
if... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 11 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 33844833d6e29e5bb4ac4dde734488ff | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class dummy2
{
public static void main(String args[])throws IOException
{
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(x.readLine());
long p=1;
HashSet<Long> arr=new HashSet<... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 330999ef3bf582312947ae02e634edd8 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Intege... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 7306e7955b79911762e2af7b15b02b0c | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Intege... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | aa14bd16ef0deaf3ecf6dd0934236610 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Intege... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 1f488f9becb22e5daab1551eaeb63caa | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Intege... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 74cb2241d074cf89fe333ff32ec40ac8 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
int n = Intege... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 5e7cdd5178052acd6e88162a08558523 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1modulon {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(f.readLine());
ArrayList<Integer> coprimes = new ArrayList<>();
int count = 0... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | ccf17351f69d1dcdd2b4cd71a6373690 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static int MAX_SIZE = 10... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d9aeb8de9f31ca818611b12f8b040dd2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Main {
public static int MAX_SIZE = 10... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 95a6f895fdfbc1452501dd502a854606 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class A {
/* 10^(7) = 1s.
*... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | ea0c415381882f37d808f3a2963efbab | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Math.*;
import static java.lang.System.out;
import java.util.*;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.math.BigInteger;
public class A {
/* 10^(7) = 1s.
*... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | ae5d7ebd65dfa1812494913233d02e5d | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class C {
static class FastScanner {
int idk;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 09cb284b6430afb0f907857775d9ee29 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces1514C {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
StringBuilder ans = new StringBuilder();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | fdf346738bcd863619f9fc26be10c63c | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 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 Solution
{
static int mod=1000000007;
static FastReader sc=new FastReader();
public static long ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f4b4d223cfc05257f08c0a848aaef303 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 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 Solution
{
static int mod=1000000007;
static FastReader sc=new FastReader();
public static long g... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | bcf92b587dd149c87fd19fc59294223e | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package competition.cf.cf716;
import java.util.Scanner;
//public class C {
// private final static Scanner scanner = new Scanner(System.in);
// private final static long MOD = 1000000007L;
//
// public static void main(String[] args){ //素数筛
//
//
// int n = scanner.nextInt();
// ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 2daf05a84221f9283a8b4f5bbaa7d3e7 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.Scanner;
public class C {
private final static Scanner scanner = new Scanner(System.in);
private final static long MOD = 1000000007L;
public static void main(String[] args){ //素数筛
int n = scanner.nextInt();
boolean[] isPrime = new boolean[n + 1];
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 0628a02e31681464df7b5088c34ed3ae | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static final MyWriter writer = new MyWriter();
private static final MyReader scan = new MyReader();
public static void main(String[] args) throws Exception {
Main main = new Main();
// int q = scan.nextInt(); while (q-... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 89b0c38222a2f9e3704bad03afde5329 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
private static final MyReader scan = new MyReader();
private static final MyWriter writer = new MyWriter();
public static void main(String[] args) throws IOException {
// int q = scan.nextInt(); while (q-- > 0)
solve(); wri... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9d713f990adc853d64f6c75fce682cbe | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class C {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = in.nextInt();
ArrayList<Integer> ans = solve(n);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | eeab3bca7d3e09a982fc6e75b52207f2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
public cl... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | a11f348b23710d1356f6f785bcaa8cd3 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.*;
/**
*
* @author Anand
*/
public class Solution2 {
/**
* @param args the command li... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 21886f8ad8becf9365739be3f81e0a48 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String args[])
{
FastReader input=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int T=1;
while(T-->0)
{
int n=input.nextInt();
long p=1;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 5dff37818129ec5b38e19b9554718bf5 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Coder {
static int n;
static int ok[] = new int[(int)1e5+5];
static StringBuilder str = new StringBuilder("");
static int gcd(int a, int b){
if(b==0) ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 48ec87ed9b046af4dc17df2b4861bf6c | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.util.StringTokenizer;
import static java.lang.Math.*;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 76ade297e0786180ec346b045394e82f | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*
"जय श्री कृष्णा"
*/
import java.util.*;
import java.io.*;
public class Product_1_modulo_name implements Runnable {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public FastReader(String s) {... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | de6ae28e0d526153b7df9735c96c1764 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*
"जय श्री कृष्णा"
*/
import java.util.*;
import java.io.*;
public class Product_1_mod_n_716 implements Runnable {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
public FastRead... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8494713e13b44dee77a7e1bf435e10f4 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import javafx.util.Pair;
public class Main
{
public static long GCD(Long n1, Long n2)
{
if (n1 == 0) {
return n2;
}
return GCD(n2 % n1, n1);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9b0c0ca42834bacbae3708c07fae9484 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import javafx.util.Pair;
public class Main
{
public static long GCD(Long n1, Long n2)
{
if (n1 == 0) {
return n2;
}
return GCD(n2 % n1, n1);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 59f59e05d3e145dd17a55c65bdf825c5 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deq... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 1a996f6f54867da022016b0044d16e3c | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | // package codeforces;
import java.util.*;
public class C1514 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
long mul = 1;
// long [] dp = new long[n+1];
// 1 2 3 4 5 6 7 8 9
// 1, ...,n-2, ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 81845fe7586db5e31a1fa96aa1362621 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class c716c
{
//By shwetank_verma
public static void main(String[] args)
{
FastReader sc=new Fas... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 479c6b5d3516d9b9905b7fcce6b5bf23 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
*
* @author eslam
*/
public class IceCave {
static class FastReader ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 5569ef75b455678e13a3ba65d6681d83 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class test {
public static void main(String[] args) throws Exception{
FastScanner fs = new FastScanner();
int T = 1;
/// System.out.println(gcd(14,56));
//T=fs.nextInt();
for (int tt = 0; tt < T; tt++) {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 11525d4058300ab08c4ca2d8f2811dee | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class codeforcesD{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
pub... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 88a27c9f8f0f5a650ce6db290739252d | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class C {
public static BufferedReader br;
public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException {
readInput();
out.close();
}
static long inv(long a, long b) {... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | dc83ae1cf314ef8bd9405a3c6eb41732 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.math.*;
import static java.util.stream.Collectors.*;
import static java.util.Map.Entry.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
public static void main (String[] args) throws... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 819679cc3e3ce695317d9ed99dd72102 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class C{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
boolean a[] = new boolean[n];
a[1] = true;
long product = 1l;
for(int i = 1 ; i<n ; i++){
if(gcd(i,n) == 1){
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d7879d90eacb4ea293ce9c28dcef01f9 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 776bf06cb623d0a1634e1b5ae0f89b01 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class product1ModuloN {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int n = sc.nextInt();
int[] visited = new int[n-1];
int count = 0;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 3669e00f5125cd3a1f8e34d7f341a3eb | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package graphs;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class PW {
public static FastReader s = new FastReader();
public static void main(String[] args) {
// TODO Auto-generated method s... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6411f23d71515d4360dcd3d87f7a3b35 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class n716C {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int n = sc.ni();
if (n % 2 != 0) {
long result = 1;
int count = 0;
for (int i = 2; i < n; i++) {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 357c2795503aeb4a3f3d792eb6969daf | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package clipse;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTo... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9f551d8c1e1d4bad45486f5aa0e18a3b | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class CF1514_D2_C {
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int n = scanner.nextInt();
// if(n <= 4) {
// Sys... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 2aef55ca5223a93e812bca0cfa986517 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class product_1_modulo_n {
public static int gcd(int i, int j) {
if(i == 0 || j == 0) {
return i + j;
}
if(i > j) {
return gcd(i % j, j);
}
return gcd(i, j % i);
}
public static void main(String[]args){
Kattio io = new Kattio();
int n = io.nextInt();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 4e1e27e0ec1b54be448b4efcdfa9afad | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.StringTokenizer;
public class Product1ModuloN {
static class Pair {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 2a7056725275cac4a8b9c8ba00ad3d92 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class prod1mod {
public static int gcd(int a, int b) {
if (b==0) return a;
return gcd(b,a%b);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long prod = 1;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 884e21725844513d467052c569e5e704 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //package codeforces;
import java.io.*;
import java.util.*;
public class Solution {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElemen... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 08c901f7746f393fa8d0ba6b17d2c3f5 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math;
public class C_Product_1_Modulo_N {
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader() {
br = new BufferedReader(new InputStreamReader(System.in));
}
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | ba888f8521f5f746e2d0c516026ef87e | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
InputReader in = new InputRe... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d91eedf804269f3631886bbce386ed37 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | // package codeforces.Practice;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class Div2_716_C {
public static void main(String[] args) throws IOException {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f596b16a186db0d637b6fe84f61342d9 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringJoiner;
import java.util.TreeMap;
public class C {
public static vo... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 73ac7e5b128a83fbdafdfbfd35b70a66 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static void main(String args[]) throws IOException {
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
int[] ok = new int[n];
long x=1;
for(int i=1;i<n;i++)
{ if(gcdExtended(i,n,1,1)==1)
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8f92b6f00a4fa0a0b76e554cd5171c2b | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.*;
import java.io.*;
import java.lang.*;
public class cfpract {
static int mod=10000_00007;
public static void solve() throws Exception{
InputStreamReader ip=new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(ip);
// int t = Integer.parseInt(br.re... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8cd735f41acba087b9a30c24e7c05643 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class C {
static class Reader{
private BufferedReader reader;
private StringTokenizer tokenizer;
Reader(InputStream input)
{
this.reader = new BufferedReader(new InputStreamReader(input));
this.tokenizer = ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 0a6b7ebb215af079d2aeb2044015dfc4 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Poster {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
ArrayList<Integer> al = new ArrayList<>();
long sum = 1;
int max = 0;
for(int i=1;i<n;i++) {
if(gcd(i,n) == 1) {
al.add(i);
sum = sum*i%n;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | af7902142e3ec30197844f324857bbcc | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.*;
import java.io.*;
public class main {
class FastScanner{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer("");
String next() {
while(!st.hasMoreTokens()) {
try {
st=new StringTokenizer(br.readLine());
}
catch(IOException e)... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 81b9e73209f53036b31686d826d9dc57 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public final class Solution {
static PrintWriter out = new PrintWriter(System.out);
static FastReader in = new FastReader();
static long mod = (long) 1e9 + 7;
static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(1, 0), new Pair(0, -1), new Pair(0, ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 59c2c4f4741128332888dd0463627c05 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
public class Div2 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | fa270315a16735b45b51c1319ced4ca8 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
public class Product1ModuloN {
private static StreamTokenizer st;
private static int nextInt()throws IOException{
st.nextToken();
return (int)st.nval;
}
public static void main(String[] args) throws IOException{
st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8207b2a43090d61183e01cb30f662797 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
static FastScanner fs;
public static void main(String[] args) {
fs = new FastScanner();
// int t = fs.nextInt();
// while (t-->0)
solve();
}
public static void solve() {
int n = fs.nextInt();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6502456c0a3dda12ea8945082c9f89e3 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Product{
static long mod = 1000000007L;
static MyScanner sc = new MyScanner();
static void solve() {
int n = sc.nextInt();
ArrayList<Integer> ans = new ArrayList<>();
long prod = 1;
for(int i = 1;i<=n;i++){
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | f56e563f8e9754fbff6b5beb5449335e | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collect... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 12e8bbfbfa641e238a8a97eb513538bb | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | /*==========================================================================
* AUTHOR: RonWonWon
* CREATED: 02.06.2021 01:05:22
/*==========================================================================*/
import java.io.*;
import java.util.*;
public class C {
public static void main(Str... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | fab81627df2de357aac556d2d3b11a73 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
public class Product1 {
//--------------------------INPUT READER--------------------------------//
static class fs {
public BufferedReader br;
StringTokenizer st = new StringTokenizer("");
public fs() { this(System.in); }
public f... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 91c8a12d02ef709961f8479240994cf7 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.*;
import java.util.*;
public class Main{
public static long mod = (long)1e9+7;
public static ArrayList<Integer>[] graph;
public static void sort(int[] arr){
ArrayList<Integer> list = new ArrayList<>();
for(int u:arr) list.add(u);
Collections.sort(list);
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 17697619a6be07d35d7700a3a816a998 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
import java.util.stream.Collectors;
public class CF1514C {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
List<Integer> coPrimeNumbers = new ArrayList<>();
for ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 448068ff117172c5039352d5dfd61e32 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.ArrayList;
import java.util.Scanner;
public class Product1ModuloN {
static long gcd(long a, long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 97e2db70aaa3d6310341689416f30156 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.TreeSet;
import javax.management.RuntimeErrorE... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | e1d8d9a4bd172b818bf3bcc65e943ce5 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.Scanner;
import java.util.ArrayList;
public class C_Product_1_Modulo_N{
public static void main(String[] args) {
Scanner s= new Scanner(System.in);
int n=s.nextInt();
boolean array[]= new boolean[n];
ArrayList<Integer> list = new ArrayList<Integer>();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d74472b6979c278b5d62311f969d65b2 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.*;
import java.lang.*;
import java.math.BigInteger;
import java.util.*;
public class Main{
static Scanner scanner=new Scanner(System.in);
public static void main(String[] args) {
int n=scanner.nextInt();
boolean b[]=new boolean [n];
long ans=1;
for(int i=1;i<n;i++) {
if(Gcd(n,... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | ce29f6db2e353f9aa56af9df2736737d | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.LinkedList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
LinkedList<Integer> primeFactors = primeFactorize(n);
int[] array = new int[n-1];
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 9b89acd7292033c7414c1be7b816f113 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.util.Scanner;
public class Main {
public static int gcd(int a,int b) {
if(b == 0) return a;
return gcd(b,a % b);
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = 1;
int[] a = new int[100010];
int n = sc.nextInt();
long ans = 1;
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 249d3929b48377cb5915042edd00a89f | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Queue;
import java.util.LinkedList;
public class ProdMod {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 82e8f0cca6cc2b55927e1dfbc3889dfe | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class C {
public static void main(String[] args) {
new C().solve(System.in, System.out);
}
public void solve(InputStream in, OutputStream out) {
InputReader inputReader = new Input... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 483f677cd820365a3c0f70f5ccd6b6c1 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* A... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 6f1a4ac39c99675e95df08f68948c7cf | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 75a3f8b6af27a4a180fc91c9436ac155 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
public class Main
{
public static int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int n =... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 0f717cf4eadf6e3978150b056e815aff | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main
{
PrintWriter out;
FastReader sc;
long mod=(long)(1e9+7);
long maxlong=Long.MAX_VALUE;
long minlong=Long.MIN_VALUE;
/******************************************************************************************
**************... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | cec661179f86477036d81745c5d2f5ab | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
//_________________________________________________________________
public class Main {
public static void main(String[] args) throws IOException {
// File file = new File("input.txt");
FastScanner sc = new FastScanner();
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | da7d75f2e00f385457ecf4b4f4ca1427 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
//import javafx.util.*;
public final class B
{
static StringBuilder ans=new StringBuilder();
static FastReader in=new FastReader();
static ArrayList<ArrayList<Integer>> g;
static long mod=1000000007;
static int ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 4bb96d01e6e8c6caac311c0c40af8d81 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.*;
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.hasMoreElements()){try{st = new S... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 5c5d223c84dc7d03ae977dea7c6c3343 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Stack1 {
static class Reader {
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
public Reader() {
... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 09241bf01f1e60e86c1a8df86a4d6bb7 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.util.*;
import java.io.*;
//import java.math.*;
public class Task{
// ..............code begins here..............
static long mod=(long)1e9+7,inf=(long)1e17;
static int modInverse(int a, int m)
{
int m0 = m;
int y = 0, x = 1;
if (m == 1)
return 0;
while ... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d66de85448b92b6e72ed95d41e356878 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | e5ace6060be6d804a6c0b1c70f69c731 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.math.BigInteger;
import java.util.*;
public class Main {
private static boolean gcd(int i, int j){
int max = Math.max(i,j);
int min = Math.min(i,j);
while(min != 0){
int now = min;
min = max%min;
max = now;
}
re... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | 8c2a9e38c2b9450ae2a77af1b6f7d895 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | //Utilities
import java.io.*;
import java.util.*;
public class Main {
static int n;
static boolean[] used;
static ArrayList<Integer> res, extra;
public static void main(String[] args) throws IOException {
n = in.iscan(); res = new ArrayList<Integer>(); extra = new ArrayList<Integer>();
res.add(1);... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output | |
PASSED | d269163b0bc7cf1e1dc48bbbf506a6d7 | train_110.jsonl | 1618839300 | Now you get Baby Ehab's first words: "Given an integer $$$n$$$, find the longest subsequence of $$$[1,2, \ldots, n-1]$$$ whose product is $$$1$$$ modulo $$$n$$$." Please solve the problem.A sequence $$$b$$$ is a subsequence of an array $$$a$$$ if $$$b$$$ can be obtained from $$$a$$$ by deleting some (possibly all) elem... | 256 megabytes | import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
public class Codeforces {
private static final Scanner sc = new Scanner(System.in);
private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
private static final lo... | Java | ["5", "8"] | 1 second | ["3\n1 2 3", "4\n1 3 5 7"] | NoteIn the first example, the product of the elements is $$$6$$$ which is congruent to $$$1$$$ modulo $$$5$$$. The only longer subsequence is $$$[1,2,3,4]$$$. Its product is $$$24$$$ which is congruent to $$$4$$$ modulo $$$5$$$. Hence, the answer is $$$[1,2,3]$$$. | Java 8 | standard input | [
"greedy",
"number theory"
] | d55afdb4a83aebdfce5a62e4ec934adb | The only line contains the integer $$$n$$$ ($$$2 \le n \le 10^5$$$). | 1,600 | The first line should contain a single integer, the length of the longest subsequence. The second line should contain the elements of the subsequence, in increasing order. If there are multiple solutions, you can print any. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.