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 | bea2eb2f62c10ec1e745bd4d3f716cb0 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.Scanner;
public class LogChopping {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n =sc.nextInt();
while (n-- > 0) {
int t = sc.nextInt();
int total = 0;
for (int i = 0 ; i < t ;i++)
total+=sc.nextInt();
System.out.println((total - t)%2 == 0 ? "maomao90" : "errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 1ae544e4143ccec7020a02e843f249c4 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class May10
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
String who[] = new String[t];
for(int i = 0; i<t; i++)
{
int n = sc.nextInt();
int a[] = new int[n];
int count = 0;
for(int j = 0; j<n; j++)
{
a[j] = sc.nextInt();
count+=a[j]-1;
}
if(count%2==0)
who[i] = "maomao90";
else
who[i] = "errorgorn";
}
for(int i = 0; i<t; i++)
{
System.out.println(who[i]);
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | c481cba77d2982c1acdba8192ffeec8d | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner in =new Scanner(System.in);
int t =in.nextInt();
while(t-->0){
int n =in.nextInt();
int sum=0;
for(int i=0; i<n; i++){
sum+=in.nextInt();
}
sum-=n;
if(sum%2!=0)
System.out.println("errorgorn");
else System.out.println("maomao90");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 8cbb75f6ba43fd9d34038b3096fe7e21 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 0; tc < t; ++tc) {
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < a.length; ++i) {
a[i] = sc.nextInt();
}
System.out.println(solve(a));
}
sc.close();
}
static String solve(int[] a) {
return ((Arrays.stream(a).sum() - a.length) % 2 == 0) ? "maomao90" : "errorgorn";
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 9a9c2711f646ab21f612ec5a2daa68e8 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.*;
public class Codeforces {
static long mod= Long.MAX_VALUE;
public static void main(String[] args) throws Exception {
PrintWriter out=new PrintWriter(System.out);
FastScanner fs=new FastScanner();
// DecimalFormat formatter= new DecimalFormat("#0.000000");
int t=fs.nextInt();
// int t=1;
outer:for(int time=1;time<=t;time++) {
int n=fs.nextInt();
int arr[]=fs.readArray(n);
boolean f=true;
for(int ele:arr) {
int turns= (ele-1);
if(turns%2!=0) {
f=!f;
}
}
if(f) {
out.println("maomao90");
}
else out.println("errorgorn");
}
out.close();
}
static long pow(long a,long b) {
if(b<0) return 1;
long res=1;
while(b!=0) {
if((b&1)!=0) {
res*=a;
res%=mod;
}
a*=a;
a%=mod;
b=b>>1;
}
return res;
}
static long gcd(long a,long b) {
if(b==0) return a;
return gcd(b,a%b);
}
static long nck(int n,int k) {
if(k>n) return 0;
long res=1;
res*=fact(n);
res%=mod;
res*=modInv(fact(k));
res%=mod;
res*=modInv(fact(n-k));
res%=mod;
return res;
}
static long fact(long n) {
// return fact[(int)n];
long res=1;
for(int i=2;i<=n;i++) {
res*=i;
res%=mod;
}
return res;
}
static long modInv(long n) {
return pow(n,mod-2);
}
static void sort(int[] a) {
//suffle
int n=a.length;
Random r=new Random();
for (int i=0; i<a.length; i++) {
int oi=r.nextInt(n);
int temp=a[i];
a[i]=a[oi];
a[oi]=temp;
}
//then sort
Arrays.sort(a);
}
static void sort(long[] a) {
//suffle
int n=a.length;
Random r=new Random();
for (int i=0; i<a.length; i++) {
int oi=r.nextInt(n);
long temp=a[i];
a[i]=a[oi];
a[oi]=temp;
}
//then sort
Arrays.sort(a);
}
// Use this to input code since it is faster than a Scanner
static 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) {
e.printStackTrace();
}
return st.nextToken();
}
String nextLine() {
String str="";
try {
str= (br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
int nextInt() {
return Integer.parseInt(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
long[] readArrayL(int n) {
long a[]=new long[n];
for(int i=0;i<n;i++) a[i]=nextLong();
return a;
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 2a305986b30569ae226d23f718ff14e9 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
/**
* Made by egor https://github.com/chermehdi/egor.
*
* @author Azuz
*
*/
public class Main {
void solve(InputReader in, PrintWriter out) {
int t = in.nextInt();
while (t-->0) {
int n = in.nextInt();
int s = 0;
for (int i = 0; i < n; ++i) {
s += in.nextInt() - 1;
}
out.println(s % 2 == 1? "errorgorn" : "maomao90");
}
}
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
try (PrintWriter out = new PrintWriter(System.out)) {
new Main().solve(in, out);
}
}
}
class InputReader {
private InputStream stream;
private static final int DEFAULT_BUFFER_SIZE = 1 << 16;
private static final int EOF = -1;
private byte[] buf = new byte[DEFAULT_BUFFER_SIZE];
private int curChar;
private int numChars;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int[] readIntArray(int tokens) {
int[] ret = new int[tokens];
for (int i = 0; i < tokens; i++) {
ret[i] = nextInt();
}
return ret;
}
public int read() {
if (this.numChars == EOF) {
throw new UnknownError();
} else {
if (this.curChar >= this.numChars) {
this.curChar = 0;
try {
this.numChars = this.stream.read(this.buf);
} catch (IOException ex) {
throw new InputMismatchException();
}
if (this.numChars <= 0) {
return EOF;
}
}
return this.buf[this.curChar++];
}
}
public int nextInt() {
int c;
for (c = this.read(); isSpaceChar(c); c = this.read()) {
}
byte sgn = 1;
if (c == 45) {
sgn = -1;
c = this.read();
}
int res = 0;
while (c >= 48 && c <= 57) {
res *= 10;
res += c - 48;
c = this.read();
if (isSpaceChar(c)) {
return res * sgn;
}
}
throw new InputMismatchException();
}
public long nextLong() {
int c;
for (c = this.read(); isSpaceChar(c); c = this.read()) {
}
byte sgn = 1;
if (c == 45) {
sgn = -1;
c = this.read();
}
long res = 0;
while (c >= 48 && c <= 57) {
res *= 10L;
res += c - 48;
c = this.read();
if (isSpaceChar(c)) {
return res * sgn;
}
}
throw new InputMismatchException();
}
public double nextDouble() {
double ret = 0, div = 1;
int c = read();
while (c <= ' ') {
c = read();
}
boolean neg = (c == '-');
if (neg) {
c = read();
}
do {
ret = ret * 10 + c - '0';
}
while ((c = read()) >= '0' && c <= '9');
if (c == '.') {
while ((c = read()) >= '0' && c <= '9') {
ret += (c - '0') / (div *= 10);
}
}
if (neg) {
return -ret;
}
return ret;
}
public String next() {
int c;
while (isSpaceChar(c = this.read())) {
}
StringBuilder result = new StringBuilder();
result.appendCodePoint(c);
while (!isSpaceChar(c = this.read())) {
result.appendCodePoint(c);
}
return result.toString();
}
public String nextLine() {
int c;
StringBuilder result = new StringBuilder();
boolean read = false;
while ((c = this.read()) != '\n') {
if (c == -1) {
return null;
}
result.appendCodePoint(c);
read = true;
}
if (!read) {
return null;
}
return result.toString();
}
public static boolean isSpaceChar(int c) {
return c == 32 || c == 10 || c == 13 || c == 9 || c == EOF;
}
public int[] nextIntArray(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
public long[] nextLongArray(int n) {
long[] arr = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = nextLong();
}
return arr;
}
public int[][] nextIntMatrix(int n, int m) {
int[][] arr = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = nextInt();
}
}
return arr;
}
public long[][] nextLongMatrix(int n, int m) {
long[][] arr = new long[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = nextLong();
}
}
return arr;
}
public char[] nextCharArray() {
return next().toCharArray();
}
public double[] nextDoubleArray(int n) {
double[] ret = new double[n];
for (int i = 0; i < n; i++) {
ret[i] = nextDouble();
}
return ret;
}
public int[]
nextIntArrayOneBased(int n) {
int[] ret = new int[n + 1];
for (int i = 1; i <= n; i++) {
ret[i] = nextInt();
}
return ret;
}
public char[][] nextCharMatrix(int n, int m) {
char[][] res = new char[n][m];
for (int i = 0; i < n; ++i) {
res[i] = nextCharArray();
}
return res;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 8286bd8496e425e50ed23ca6c87fee31 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Solution
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(--t>-1)
{
int n=sc.nextInt();
int sum=0;
for(int i=0;i<n;i++) sum+=sc.nextInt()-1;
if(sum%2==0) System.out.println("maomao90");
else System.out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | deef758b2d6a876faca7a03e6e6de95c | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.*;
public class P1672A {
public static void main(String[] args) throws Exception {
new P1672A().run();
}
void run() throws Exception {
Scanner scanner = new Scanner(getInputStream());
int t = scanner.nextInt();
while(t-- > 0) {
int totalCuts = 0;
int n = scanner.nextInt();
while(n-- > 0) {
totalCuts += scanner.nextInt() - 1;
}
getOutputStream().println(totalCuts % 2 == 1 ? "errorgorn" : "maomao90");
}
}
InputStream getInputStream() {
return System.in;
}
PrintStream getOutputStream() {
return System.out;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 54b7d989afc3aa65786c97e91d167290 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | // package faltu;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.util.Map.Entry;
public class Main {
public static int upperBound(long[] arr, long m, int l, int r) {
while(l<=r) {
int mid=(l+r)/2;
if(arr[mid]<=m) l=mid+1;
else r=mid-1;
}
return l;
}
public static int lowerBound(long[] a, long m, int l, int r) {
while(l<=r) {
int mid=(l+r)/2;
if(a[mid]<m) l=mid+1;
else r=mid-1;
}
return l;
}
public static long getClosest(long val1, long val2,long target)
{
if (target - val1 >= val2 - target)
return val2;
else
return val1;
}
static void ruffleSort(long[] a) {
int n=a.length;
Random r=new Random();
for (int i=0; i<a.length; i++) {
long oi=r.nextInt(n), temp=a[i];
a[i]=a[(int)oi];
a[(int)oi]=temp;
}
Arrays.sort(a);
}
static void ruffleSort(int[] a){
int n=a.length;
Random r=new Random();
for (int i=0; i<a.length; i++) {
int oi=r.nextInt(n), temp=a[i];
a[i]=a[oi];
a[oi]=temp;
}
Arrays.sort(a);
}
int ceilIndex(int input[], int T[], int end, int s){
int start = 0;
int middle;
int len = end;
while(start <= end){
middle = (start + end)/2;
if(middle < len && input[T[middle]] < s && s <= input[T[middle+1]]){
return middle+1;
}else if(input[T[middle]] < s){
start = middle+1;
}else{
end = middle-1;
}
}
return -1;
}
public static int findIndex(long arr[], long t)
{
if (arr == null) {
return -1;
}
int len = arr.length;
int i = 0;
while (i < len) {
if (arr[i] == t) {
return i;
}
else {
i = i + 1;
}
}
return -1;
}
static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
static int gcd(int a, int b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
static long lcm(long a,long b)
{
return (a / gcd(a, b)) * b;
}
public static int[] swap(int a[], int left, int right)
{
int temp = a[left];
a[left] = a[right];
a[right] = temp;
return a;
}
public static void swap(long x,long max1)
{
long temp=x;
x=max1;
max1=temp;
}
public static int[] reverse(int a[], int left, int right)
{
// Reverse the sub-array
while (left < right) {
int temp = a[left];
a[left++] = a[right];
a[right--] = temp;
}
return a;
}
static int lowerLimitBinarySearch(ArrayList<Integer> A,int B) {
int n =A.size();
int first = 0,second = n;
while(first <second) {
int mid = first + (second-first)/2;
if(A.get(mid) > B) {
second = mid;
}else {
first = mid+1;
}
}
if(first < n && A.get(first) < B) {
first++;
}
return first; //1 index
}
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 StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
// *******----segement tree implement---*****
// -------------START--------------------------
void buildTree (int[] arr,int[] tree,int start,int end,int treeNode)
{
if(start==end)
{
tree[treeNode]=arr[start];
return;
}
buildTree(arr,tree,start,end,2*treeNode);
buildTree(arr,tree,start,end,2*treeNode+1);
tree[treeNode]=tree[treeNode*2]+tree[2*treeNode+1];
}
void updateTree(int[] arr,int[] tree,int start,int end,int treeNode,int idx,int value)
{
if(start==end)
{
arr[idx]=value;
tree[treeNode]=value;
return;
}
int mid=(start+end)/2;
if(idx>mid)
{
updateTree(arr,tree,mid+1,end,2*treeNode+1,idx,value);
}
else
{
updateTree(arr,tree,start,mid,2*treeNode,idx,value);
}
tree[treeNode]=tree[2*treeNode]+tree[2*treeNode+1];
}
// disjoint set implementation --start
static void makeSet(int n)
{
parent=new int[n];
rank=new int[n];
for(int i=0;i<n;i++)
{
parent[i]=i;
rank[i]=0;
}
}
static void union(int u,int v)
{
u=findpar(u);
v=findpar(v);
if(rank[u]<rank[v])parent[u]=v;
else if(rank[v]<rank[u])parent[v]=u;
else
{
parent[v]=u;
rank[u]++;
}
}
private static int findpar(int node)
{
if(node==parent[node])return node;
return parent[node]=findpar(parent[node]);
}
static int parent[];
static int rank[];
// *************end
static void presumbit(int[][]prebitsum) {
for(int i=1;i<=200000;i++) {
int z=i;
int j=0;
while(z>0) {
if((z&1)==1) {
prebitsum[i][j]+=(prebitsum[i-1][j]+1);
}else {
prebitsum[i][j]=prebitsum[i-1][j];
}
z=z>>1;
j++;
}
}
}
public static int[] sort(int[] arr) {
ArrayList<Integer> al = new ArrayList<>();
for(int i=0;i<arr.length;i++) al.add(arr[i]);
Collections.sort(al);
for(int i=0;i<arr.length;i++) arr[i]=al.get(i);
return arr;
}
static ArrayList<String>powof2s;
static void powof2S() {
long i=1;
while(i<(long)2e18) {
powof2s.add(String.valueOf(i));
i*=2;
}
}
static boolean coprime(int a, long l){
return (gcd(a, l) == 1);
}
static int[][] dirs = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
static Long MOD=(long) (1e9+7);
static int prebitsum[][];
static ArrayList<Integer>arr;
static boolean[] vis;
static ArrayList<ArrayList<Integer>>adj;
public static void main(String[] args) throws IOException
{
// sieve();
// prebitsum=new int[200001][18];
// presumbit(prebitsum);
// powof2S();
FastReader s = new FastReader();
int tt = s.nextInt();
while(tt-->0) {
int n=s.nextInt();
int[]a=new int[n];
for(int i=0;i<n;i++)a[i]=s.nextInt();
solver(a,n);
}
}
static void solver(int[]a, int n) {
int sum=0;
for(int i:a) {
sum+=(i-1);
}
if(sum%2==0)System.out.println("maomao90");
else System.out.println("errorgorn");
}
static void pc2d(char[][]a) {
int n=a.length;
int m=a[0].length;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
static void pi2d(int[][]a) {
int n=a.length;
int m=a[0].length;
for(int i=0;i<n;i++) {
for(int j=0;j<m;j++) {
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
static void DFSUtil(int v, boolean[] vis)
{
vis[v] = true;
Iterator<Integer> it = adj.get(v).iterator();
while (it.hasNext()) {
int n = it.next();
if (!vis[n])
DFSUtil(n, vis);
}
}
static long DFS(int n)
{
vis = new boolean[n+1];
long cnt=0;
for (int i = 1; i <= n; i++) {
if (!vis[i]) {
DFSUtil(i, vis);
cnt++;
}
}
return cnt;
}
public static String revStr(String str){
String input = str;
StringBuilder input1 = new StringBuilder();
input1.append(input);
input1.reverse();
return input1.toString();
}
public static String sortString(String inputString){
char tempArray[] = inputString.toCharArray();
Arrays.sort(tempArray);
return new String(tempArray);
}
static long myPow(long n, long i){
if(i==0) return 1;
if(i%2==0) return (myPow(n,i/2)%MOD * myPow(n,i/2)%MOD)%MOD;
return (n%MOD* myPow(n,i-i)%MOD)%MOD;
}
static void palindromeSubStrs(String str) {
HashSet<String>set=new HashSet<>();
char[]a =str.toCharArray();
int n=str.length();
int[][]dp=new int[n][n];
for(int g=0;g<n;g++){
for(int i=0,j=g;j<n;j++,i++){
if(!set.contains(str.substring(i,i+1))&&g==0) {
dp[i][j]=1;
set.add(str.substring(i,i+1));
}
else {
if(!set.contains(str.substring(i,j+1))&&isPalindrome(str,i,j)) {
dp[i][j]=1;
set.add(str.substring(i,j+1));
}
}
}
}
int ans=0;
for(int i=0;i<n;i++) {
for(int j=0;j<n;j++) {
System.out.print(dp[i][j]+" ");
if(dp[i][j]==1)ans++;
}
System.out.println();
}
System.out.println(ans);
}
static boolean isPalindrome(String str,int i,int j)
{
while (i < j) {
if (str.charAt(i) != str.charAt(j))
return false;
i++;
j--;
}
return true;
}
static boolean sign(long num) {
return num>0;
}
static boolean isSquare(long x){
if(x==1)return true;
long y=(long) Math.sqrt(x);
return y*y==x;
}
static long power1(long a,long b) {
if(b == 0){
return 1;
}
long ans = power(a,b/2);
ans *= ans;
if(b % 2!=0){
ans *= a;
}
return ans;
}
static void swap(StringBuilder sb,int l,int r)
{
char temp = sb.charAt(l);
sb.setCharAt(l,sb.charAt(r));
sb.setCharAt(r,temp);
}
// function to reverse the string between index l and r
static void reverse(StringBuilder sb,int l,int r)
{
while(l < r)
{
swap(sb,l,r);
l++;
r--;
}
}
// function to search a character lying between index l and r
// which is closest greater (just greater) than val
// and return it's index
static int binarySearch(StringBuilder sb,int l,int r,char val)
{
int index = -1;
while (l <= r)
{
int mid = (l+r)/2;
if (sb.charAt(mid) <= val)
{
r = mid - 1;
}
else
{
l = mid + 1;
if (index == -1 || sb.charAt(index) >= sb.charAt(mid))
index = mid;
}
}
return index;
}
// this function generates next permutation (if there exists any such permutation) from the given string
// and returns True
// Else returns false
static boolean nextPermutation(StringBuilder sb)
{
int len = sb.length();
int i = len-2;
while (i >= 0 && sb.charAt(i) >= sb.charAt(i+1))
i--;
if (i < 0)
return false;
else
{
int index = binarySearch(sb,i+1,len-1,sb.charAt(i));
swap(sb,i,index);
reverse(sb,i+1,len-1);
return true;
}
}
private static int lps(int m ,int n,String s1,String s2,int[][]mat)
{
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
if(s1.charAt(i-1)==s2.charAt(j-1))mat[i][j]=1+mat[i-1][j-1];
else mat[i][j]=Math.max(mat[i-1][j],mat[i][j-1]);
}
}
return mat[m][n];
}
static int lcs(String X, String Y, int m, int n)
{
int[][] L = new int[m+1][n+1];
// Following steps build L[m+1][n+1] in bottom up fashion. Note
// that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1]
for (int i=0; i<=m; i++)
{
for (int j=0; j<=n; j++)
{
if (i == 0 || j == 0)
L[i][j] = 0;
else if (X.charAt(i-1) == Y.charAt(j-1))
L[i][j] = L[i-1][j-1] + 1;
else
L[i][j] = Math.max(L[i-1][j], L[i][j-1]);
}
}
return L[m][n];
// Following code is used to print LCS
// int index = L[m][n];
// int temp = index;
//
// // Create a character array to store the lcs string
// char[] lcs = new char[index+1];
// lcs[index] = '\u0000'; // Set the terminating character
//
// // Start from the right-most-bottom-most corner and
// // one by one store characters in lcs[]
// int i = m;
// int j = n;
// while (i > 0 && j > 0)
// {
// // If current character in X[] and Y are same, then
// // current character is part of LCS
// if (X.charAt(i-1) == Y.charAt(j-1))
// {
// // Put current character in result
// lcs[index-1] = X.charAt(i-1);
//
// // reduce values of i, j and index
// i--;
// j--;
// index--;
// }
//
// // If not same, then find the larger of two and
// // go in the direction of larger value
// else if (L[i-1][j] > L[i][j-1])
// i--;
// else
// j--;
// }
// return String.valueOf(lcs);
// Print the lcs
// System.out.print("LCS of "+X+" and "+Y+" is ");
// for(int k=0;k<=temp;k++)
// System.out.print(lcs[k]);
}
static long lis(long[] aa2, int n)
{
long lis[] = new long[n];
int i, j;
long max = 0;
for (i = 0; i < n; i++)
lis[i] = 1;
for (i = 1; i < n; i++)
for (j = 0; j < i; j++)
if (aa2[i] >= aa2[j] && lis[i] <= lis[j] + 1)
lis[i] = lis[j] + 1;
for (i = 0; i < n; i++)
if (max < lis[i])
max = lis[i];
return max;
}
static boolean isPalindrome(String str)
{
int i = 0, j = str.length() - 1;
while (i < j) {
if (str.charAt(i) != str.charAt(j))
return false;
i++;
j--;
}
return true;
}
static boolean issafe(int i, int j, int r,int c, char ch)
{
if (i < 0 || j < 0 || i >= r || j >= c|| ch!= '1')return false;
else return true;
}
static long power(long a, long b)
{
a %=MOD;
long out = 1;
while (b > 0) {
if((b&1)!=0)out = out * a % MOD;
a = a * a % MOD;
b >>= 1;
a*=a;
}
return out;
}
static long[] sieve;
public static void sieve()
{
int nnn=(int) 1e6+1;
long nn=(int) 1e6;
sieve=new long[(int) nnn];
int[] freq=new int[(int) nnn];
sieve[0]=0;
sieve[1]=1;
for(int i=2;i<=nn;i++)
{
sieve[i]=1;
freq[i]=1;
}
for(int i=2;i*i<=nn;i++)
{
if(sieve[i]==1)
{
for(int j=i*i;j<=nn;j+=i)
{
if(sieve[j]==1)
{
sieve[j]=0;
}
}
}
}
}
}
class decrease implements Comparator<Long> {
// Used for sorting in ascending order of
// roll number
public int compare(long a, long b)
{
return (int) (b - a);
}
@Override
public int compare(Long o1, Long o2) {
// TODO Auto-generated method stub
return (int) (o2-o1);
}
}
class pair{
long x;
long y;
long c;
char ch;
public pair(long x,long y) {
this.x=x;
this.y=y;
}
public pair(long x,char ch) {
this.x=x;
this.ch=ch;
}
public pair(long x,long y,long c)
{
this.x=x;
this.y=y;
this.c=c;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 7a78a5ba5f2677f0a36a55484e23e62b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class App{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
while(n > 0){
int sum = 0;
int len = sc.nextInt();
while(len > 0){
sum += sc.nextInt() - 1;
len--;
}
if(sum % 2 == 1){
System.out.println("errorgorn");
}
else{
System.out.println("maomao90");
}
n--;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e18d9e8a2b10e1d015c3084b8b48a21c | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class Solution{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int rows=Integer.parseInt(sc.nextLine());
while(rows>0){
int n=Integer.parseInt(sc.nextLine()),sum=-n;
String[] nums=sc.nextLine().split(" ");
for(int i=0;i<n;i++){
sum+=Integer.parseInt(nums[i]);
}
System.out.println(sum%2==0?"maomao90":"errorgorn");
rows--;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 020cf3af13da5350b3ae5d481851fee8 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Codeforces {
static int M = 1_000_000_007;
static int INF = 2_000_000_000;
static int N = (int) 2e5 + 1;
static long[] factorial;
static boolean[] isPrime = new boolean[N+1];
static final FastScanner fs = new FastScanner();
//variable
public static void main(String[] args) throws IOException {
int T = fs.nextInt();
while (T-- > 0) {
int n = fs.nextInt();
int[] arr = fs.arrayIn(n);
int sum = 0;
for(int i=0;i<n;i++) {
sum += arr[i]-1;
}
System.out.println(sum % 2 == 1 ? "errorgorn" : "maomao90");
}
}
//class
//function
static void getPrimes() {
for(int i=2;i<N;i++) isPrime[i] = true;
int i = 2;
while(i<N) {
if(isPrime[i]) {
for(int j=2*i;j<N;j+=i)
isPrime[j] = false;
}
System.out.println(i+" "+isPrime[i]);
i++;
}
}
static void build(int[] a, int[] seg, int ind, int low, int high) {
if (low == high) {
seg[ind] = a[low];
return;
}
int mid = (low + high) / 2;
build(a, seg, 2 * ind + 1, low, mid);
build(a, seg, 2 * ind + 2, mid + 1, high);
seg[ind] = Math.max(seg[2 * ind + 1], seg[2 * ind + 2]);
}
static long query(int ind, int[] seg, int l, int h, int low, int high) {
if (low > h || high < l) return -INF;
if (low >= l && high <= h) return seg[ind];
int mid = (low + high) / 2;
long left = query(2 * ind + 1, seg, l, h, low, mid);
long right = query(2 * ind + 2, seg, l, h, mid + 1, high);
return Math.max(left, right);
}
// Template
static long factorial(int n) {
long fact = 1;
for (int i = 1; i <= n; i++) {
fact *= i;
}
return fact;
}
static long lcm(long a, long b) {
return (a / gcd(a, b)) * b;
}
static long gcd(long a, long b) {
if (a == 0) return b;
return gcd(b % a, a);
}
static void premutation(int n, ArrayList<Integer> arr, boolean[] chosen) {
if (arr.size() == n) {
System.out.println(arr);
} else {
for (int i = 1; i <= n; i++) {
if (chosen[i]) continue;
arr.add(i);
chosen[i] = true;
premutation(n, arr, chosen);
arr.remove(Integer.valueOf(i));
chosen[i] = false;
}
}
}
static boolean isPalindrome(char[] c) {
int n = c.length;
for (int i = 0; i < n / 2; i++) {
if (c[i] != c[n - i - 1]) return false;
}
return true;
}
static long nCk(int n, int k) {
return (modMult(fact(n), fastExpo(modMult(fact(n - k), fact(k)), M - 2)));
}
static long nPk(int n, int k) {
return (modMult(fact(n), fastExpo(fact(n - k), M - 2)));
}
static long fact(int n) {
if (factorial != null) return factorial[n];
else factorial = new long[N];
factorial[0] = 1;
long fact = 1;
for (int i = 1; i <= n; i++) {
factorial[i] = fact = modMult(fact, i);
}
return fact % M;
}
static long modMult(long a, long b) {
return (int) (a * b % M);
}
static long negMult(long a, long b) {
return (int) ((a * b) % M + M) % M;
}
static long fastExpo(long x, int y) {
if (y == 1) return x;
if (y == 0) return 1;
long ans = fastExpo(x, y / 2);
if (y % 2 == 0) return modMult(ans, ans);
else return modMult(ans, modMult(ans, x));
}
static final Random random = new Random();
static void ruffleSort(int[] arr) {
int n = arr.length;
for (int i = 0; i < n; i++) {
int j = random.nextInt(n);
int temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
Arrays.sort(arr);
}
private static class Pairs implements Comparable<Pairs> {
int f, s;
Pairs(int f, int s) {
this.f = f;
this.s = s;
}
public int compareTo(Pairs p) {
if (this.f != p.f) return Integer.compare(this.f, p.f);
return -Integer.compare(this.s, p.s);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Pairs)) return false;
Pairs pairs = (Pairs) o;
return f == pairs.f && s == pairs.s;
}
@Override
public int hashCode() {
return Objects.hash(f, s);
}
}
private static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer str = new StringTokenizer("");
String next() throws IOException {
while (!str.hasMoreTokens())
str = new StringTokenizer(br.readLine());
return str.nextToken();
}
char nextChar() throws IOException {
return next().charAt(0);
}
int nextInt() throws IOException {
return Integer.parseInt(next());
}
float nextFloat() throws IOException {
return Float.parseFloat(next());
}
double nextDouble() throws IOException {
return Double.parseDouble(next());
}
long nextLong() throws IOException {
return Long.parseLong(next());
}
byte nextByte() throws IOException {
return Byte.parseByte(next());
}
int[] arrayIn(int n) throws IOException {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = nextInt();
}
return arr;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 1d9700881ca9caff8ca78d891c916354 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 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
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int c = 0;
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int i=0;i<n;i++) {
int v = sc.nextInt();
c += getCount(v, map);
}
if(c%2 == 0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
private static int getCount(int n, HashMap<Integer, Integer> map) {
if(n == 1)
return 0;
if(map.containsKey(n))
return map.get(n);
int c = 1 + getCount(n/2, map) + getCount((n - (n/2)), map);
map.put(n, c);
return c;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 3f7dcfa3e6ed950db75951305e32b50c | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class CF_1672A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int total = 0;
for (int i = 0; i < n; i++) {
total += (sc.nextInt() - 1);
}
if (total % 2 == 0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
// public static int breakLog(int log) {
// if (log == 1)
// return 1;
// else if (log == 0)
// return 0;
// else
// return breakLog(log/2) + breakLog((log/2) + log%2);
// }
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 93ce15c4ad77305fb4f2f5b66fde3865 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class codeforces1672A {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int numCases = Integer.parseInt(br.readLine());
for (int rep = 0; rep<numCases;rep++)
{
int logs = Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
int cuts = 0;
for (int i = 0; i<logs;i++)
{
int a = Integer.parseInt(st.nextToken());
cuts+=a-1;
}
if (cuts%2==0)
{
System.out.println("maomao90");
}
else
{
System.out.println("errorgorn");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 131209e3251ab6b149f82743f8d09cb9 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class HelloWorld {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int l=0;
int n = sc.nextInt();
int array[] = new int[n];
for(int j=0;j<n;j++){
array[j]=sc.nextInt();
l=l+array[j]-1;
}
if(l%2==1)System.out.println("errorgorn");
else if(l%2==0)System.out.println("maomao90");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | eb4d0a28db866640c07e0bf86c0afbc9 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class A_Log_Chopping {
public static void main(String[] args) {
MyScanner sc = new MyScanner();
out = new PrintWriter(new BufferedOutputStream(System.out));
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt(), a[] = sc.readArray(n);
long sum = 0;
for (int i : a)
sum += i - 1;
if (sum % 2 == 0)
out.println("maomao90");
else
out.println("errorgorn");
}
out.close();
}
public static PrintWriter out;
public static long mod = (long) 1e9 + 7;
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
int[] readArray(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long[] readLongArray(int n) {
long a[] = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
static void SieveOfEratosthenes(int n, boolean prime[]) {
prime[0] = false;
prime[1] = false;
for (int p = 2; p * p <= n; p++) {
if (prime[p] == true)
for (int i = p * p; i <= n; i += p)
prime[i] = false;
}
}
static void dfs(int root, boolean[] vis, int[] value, ArrayList[] gr, int prev) {
vis[root] = true;
value[root] = 3 - prev;
prev = 3 - prev;
for (int i = 0; i < gr[root].size(); i++) {
int next = (int) gr[root].get(i);
if (!vis[next])
dfs(next, vis, value, gr, prev);
}
}
static boolean isPrime(int n) {
for (int i = 2; i <= Math.sqrt(n); i++)
if (n % i == 0)
return false;
return true;
}
static boolean isPrime(long n) {
for (long i = 2; i <= Math.sqrt(n); i++)
if (n % i == 0)
return false;
return true;
}
static int abs(int a) {
return a > 0 ? a : -a;
}
static int max(int a, int b) {
return a > b ? a : b;
}
static int min(int a, int b) {
return a < b ? a : b;
}
static long pow(long n, long m) {
if (m == 0)
return 1;
long temp = pow(n, m / 2);
long res = ((temp * temp) % mod);
if (m % 2 == 0)
return res;
return (res * n) % mod;
}
static long modular_add(long a, long b) {
return ((a % mod) + (b % mod)) % mod;
}
static long modular_sub(long a, long b) {
return ((a % mod) - (b % mod) + mod) % mod;
}
static long modular_mult(long a, long b) {
return ((a % mod) * (b % mod)) % mod;
}
static long lcm(int a, int b) {
return (a / gcd(a, b)) * b;
}
static long gcd(long a, long b) {
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
static int gcd(int n1, int n2) {
if (n2 != 0)
return gcd(n2, n1 % n2);
else
return n1;
}
static class Pair {
int u, v;
Pair(int u, int v) {
this.u = u;
this.v = v;
}
static void sort(Pair[] coll) {
List<Pair> al = new ArrayList<>(Arrays.asList(coll));
Collections.sort(al, new Comparator<Pair>() {
public int compare(Pair p1, Pair p2) {
return p1.u - p2.u;
}
});
for (int i = 0; i < al.size(); i++) {
coll[i] = al.get(i);
}
}
}
static void sort(int[] a) {
ArrayList<Integer> list = new ArrayList<>();
for (int i : a)
list.add(i);
Collections.sort(list);
for (int i = 0; i < a.length; i++)
a[i] = list.get(i);
}
static void sort(long a[]) {
ArrayList<Long> list = new ArrayList<>();
for (long i : a)
list.add(i);
Collections.sort(list);
for (int i = 0; i < a.length; i++)
a[i] = list.get(i);
}
static int[] array(int n, int value) {
int a[] = new int[n];
for (int i = 0; i < n; i++)
a[i] = value;
return a;
}
static long sum(long a[]) {
long sum = 0;
for (long i : a)
sum += i;
return (sum);
}
static long count(long a[], long x) {
long c = 0;
for (long i : a)
if (i == x)
c++;
return (c);
}
static int sum(int a[]) {
int sum = 0;
for (int i : a)
sum += i;
return (sum);
}
static int count(int a[], int x) {
int c = 0;
for (int i : a)
if (i == x)
c++;
return (c);
}
static int count(String s, char ch) {
int c = 0;
char x[] = s.toCharArray();
for (char i : x)
if (ch == i)
c++;
return (c);
}
static int[] freq(int a[], int n) {
int f[] = new int[n + 1];
for (int i : a)
f[i]++;
return f;
}
static int[] pos(int a[], int n) {
int f[] = new int[n + 1];
for (int i = 0; i < n; i++)
f[a[i]] = i;
return f;
}
static boolean isPalindrome(String s) {
StringBuilder sb = new StringBuilder();
sb.append(s);
String str = String.valueOf(sb.reverse());
if (s.equals(str))
return true;
else
return false;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | a98b72fcc199472cfdc980758d026c5b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math;
public class cp{
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 StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
public static void main(String args[]){
FastReader sc=new FastReader();
PrintWriter out=new PrintWriter(System.out);
int t=sc.nextInt();
while(t-->0){
PriorityQueue<Integer> pq=new PriorityQueue<>((a,b)->b-a);
int n=sc.nextInt();
for(int i=0;i<n;i++){
pq.add(sc.nextInt());
}
boolean flag=true;
while(!pq.isEmpty()){
int log=pq.remove();
if(log==1){
if(flag)
out.println("maomao90");
else
out.println("errorgorn");
break;
}
if(log%2==0){
pq.add(log/2);
pq.add(log/2);
}
else{
pq.add((log+1)/2);
pq.add(log/2);
}
flag=!flag;
}
}
out.close();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 0e2aab2abc2e1836d9629c7088ad8d9e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class A{
static Scanner sc;
public static void solve(){
int n=sc.nextInt();
int sum=0;
for(int i=0;i<n;i++){
sum+=sc.nextInt();
}
sum-=n;
if(sum%2!=0) System.out.println("errorgorn");
else System.out.println("maomao90");
}
public static void main(String args[]){
sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) solve();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 7834b25d070dd0a0458dfa1d8153a72e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class code {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long t = sc.nextLong();
while (t-- > 0) {
int n=sc.nextInt();
int[] a= new int[n];
for (int i=0;i<n;i++){
a[i]=sc.nextInt();
}
Arrays.sort(a);
System.out.println(fun(a,n));
}
}
static String fun(int[] a,int n){
int ans=0;
for(int i=0;i<n;i++) ans+=(a[i]-1);
return (ans&1)!=1?"maomao90":"errorgorn";
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5713b0e8e09d4f3826781679d494f1d2 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class logchopping {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
int n=sc.nextInt();
int a[]=new int[n];
for(int j=0;j<n;j++){
a[j]=sc.nextInt();
}
int c=0;
int m=0;
for(int k=0;k<n;k++){
if(a[k]==1)
continue;
else if(a[k]==2){
c++;
}
else if(a[k]%2==0){
c=c+(a[k]/2);
m=m+(a[k]/2)-1;
}
else{
c=c+(a[k]/2);
m=m+(a[k]/2);
}
}
if(m%2==0){
if(c%2==0){
System.out.println("maomao90");
}
else{
System.out.println("errorgorn");
}
}
else{
if(c%2==0){
System.out.println("errorgorn");
}
else{
System.out.println("maomao90");
}
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e78649dc6d8b5eb6cbd5f3aaa12ba2c8 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class A {
public static void main(String[] args) {
FastReader fr = new FastReader();
int tc = fr.nextInt();
while(tc-- != 0) {
int n=fr.nextInt();
int[] a = fr.readArray(n);
long totalMoves=0;
for (int i:a) totalMoves += i-1;
System.out.println(totalMoves%2==0?"maomao90":"errorgorn");
}
}
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
long[] readArrayLong(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++) {
a[i] = nextInt();
}
return a;
}
}
static int sumOfDigits(int n) {
if (n == 0)
return 0;
return n % 10 + sumOfDigits(n / 10);
}
static int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
static boolean isPrime(int n) {
if (n % 2 == 0)
return false;
for (int i = 3; i <= Math.sqrt(n); i++) {
if (n % i == 0)
return false;
}
return true;
}
static long fastPower(long a, long b, int n) {
long res = 1;
while ( b > 0) {
if ( (b&1) != 0) {
res = (res * a % n) % n;
}
a = (a % n * a % n) % n;
b = b >> 1;
}
return res;
}
static boolean[] seiveOfEratoSthenes(int n) {
boolean isPrime[] = new boolean[n+1];
Arrays.fill(isPrime, true);
isPrime[0] = false;
isPrime[1] = false;
for(int i = 2; i * i <= n; i++) {
for(int j = 2*i; j<=n; j += i) {
isPrime[j] = false;
}
}
return isPrime;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | a56e8519f4bc3d3f0629d338a6c5dc32 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
/*
!!!!Hello World,Prakhar here!!!!
codechef handle prakhar_3011
codeforces handle prakhar_30
trying to get good at CP
PEACE OUT.........
*/
/*
2 4
1 1 2 2
1 1 1 1
*/
import java.io.*;
import java.util.*;
public class log {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
PrintWriter out = new PrintWriter(System.out);
int t = sc.nextInt();
while (t-- > 0) {
int n=sc.nextInt();int f=0;long sum=0;
int a[]=sc.readArray(n);
for(int i=0;i<n;i++){
sum+=a[i]-1;
}
System.out.println((sum%2==0?"maomao90":"errorgorn"));
}
}
static void sort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
for (int i : a)
l.add(i);
Collections.sort(l);
for (int i = 0; i < a.length; i++)
a[i] = l.get(i);
}
static void revsort(int[] a) {
ArrayList<Integer> l = new ArrayList<>();
for (int i : a)
l.add(i);
Collections.sort(l, Collections.reverseOrder());
for (int i = 0; i < a.length; i++)
a[i] = l.get(i);
}
/* ......FAST SCANNER template taken from secondthread...... */
static 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) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
double nextdouble() {
return Double.parseDouble(next());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5f163c94b04c779c633cf23e4bb7cfe3 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
static FastReader s = new FastReader();
static PrintWriter out = new PrintWriter(System.out);
private static int[] rai(int n) {
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
return arr;
}
private static int[][] rai(int n, int m) {
int[][] arr = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = s.nextInt();
}
}
return arr;
}
private static long[] ral(int n) {
long[] arr = new long[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextLong();
}
return arr;
}
private static long[][] ral(int n, int m) {
long[][] arr = new long[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = s.nextLong();
}
}
return arr;
}
private static int ri() {
return s.nextInt();
}
private static long rl() {
return s.nextLong();
}
private static String rs() {
return s.next();
}
static int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
static long gcd(long a,long b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
static int MOD= (int) (1e9+7);
public static void primeFactors(int n) {
// Print the number of 2s that divide n
while (n % 2 == 0) {
System.out.print(2 + " ");
n /= 2;
}
// n must be odd at this point. So we can
// skip one element (Note i = i +2)
for (int i = 3; i <= Math.sqrt(n); i += 2) {
// While i divides n, print i and divide n
while (n % i == 0) {
System.out.print(i + " ");
n /= i;
}
}
// This condition is to handle the case whien
// n is a prime number greater than 2
if (n > 2)
System.out.print(n);
System.out.println();
}
static boolean isPrime(int val)
{
for(int i=2;i<=Math.sqrt(val);i++)
{
if(val%i==0)
{
return false;
}
}
return true;
}
static long pow(long x,long y, long n)
{
if(y == 0)
{
return 1;
}
long val = pow(x,y/2,n);
if(y%2==1)
{
return (((val*val)%n)*x)%n;
}
else
{
return (val*val)%n;
}
}
static int MOD2 = 998244353;
static long getProd(long x)
{
if(x<5)
{
return x;
}
long val = x/2;
long val2 = (x+1)/2;
return (getProd(val) * getProd(val2))%MOD2;
}
static boolean isHappy(int val)
{
char[] arr=Integer.toString(val).toCharArray();
if(arr.length==1)
{
return true;
}
for(int i=1;i<arr.length;i++)
{
if(Character.getNumericValue(arr[i])<Character.getNumericValue(arr[i-1]))
{
return false;
}
}
return true;
}
public static void main(String[] args){
StringBuilder ans = new StringBuilder();
int t = ri();
// int t=1;
while (t-- > 0)
{
int n=ri();
int[] arr=rai(n);
int sum=0;
for(int i:arr)
{
sum+=i-1;
}
ans.append(sum%2==0?"maomao90\n":"errorgorn\n");
}
out.print(ans);
out.flush();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 8 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | b1c39df6fafcb50d70f7609462832434 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class A {
static final FastReader sc = new FastReader();
static final PrintWriter out = new PrintWriter(System.out, true);
private static boolean debug = System.getProperty("ONLINE_JUDGE") == null;
private static void trace(Object... o) {
if (debug) {
System.err.println(Arrays.deepToString(o));
}
}
public static void main(String[] args) {
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int[] a = new int[n];
int c = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
if (a[i] > 1)
c += (a[i] - 1);
}
out.println((c % 2 == 0) ? "maomao90" : "errorgorn");
}
}
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 30c4068d204b10a67e25292abcaf5db5 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class logchopping {
static String chop(int[] arr) {
int res = 0;
for (int num : arr) {
res += num - 1;
}
return res % 2 == 0 ? "maomao90" : "errorgorn";
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testcase = sc.nextInt();
List<String> res = new ArrayList<>();
while (testcase-- > 0) {
int[] arr = new int[sc.nextInt()];
for (int i = 0; i < arr.length; i++) {
arr[i] = sc.nextInt();
}
res.add(chop(arr));
}
for (String str : res) {
System.out.println(str);
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 575d6efa789a77da5d0e5932866d4bb3 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.io.*;
import java.util.*;
public class example {
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 StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
}
static FastReader sc=new FastReader();
static Scanner in=new Scanner(System.in);
public static void main(String[] args) {
int t = sc.nextInt() ;
while(t-- != 0 )
{
int n = sc.nextInt() ;
long sum = 0 ;
int count = 0 ;
for(int i= 0 ; i< n ; i++)
{
int res = sc.nextInt() ;
//if(res != 1 )
{
count++ ;
sum += res ;
}
}
sum = sum -n ;
if(sum%2 == 0 )
{
System.out.println("maomao90") ;
}
else {
System.out.println("errorgorn") ;
}
}
}// main method ends
static long modInv(int a )
{
int mod = 109 ;
for(int i = 1 ; i <mod ; i++ )
{
if(( (i%mod) * (a%mod) ) % mod == 1 )
{
return i ;
}
}
return -1 ;
}
static boolean can(int m , int s )
{
return s>=0 && s<= 9*m ;
}
static boolean isPrime(long n)
{
// Corner cases
if (n <= 1)
return false;
if (n <= 3)
return true;
// This is checked so that we can skip
// middle five numbers in below loop
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
}//class ends
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | f528311b002e292a75822c5e286ee908 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class LogChopping{
public static int count=0;
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
{
arr[i]=sc.nextInt();
}
for(int i=0;i<n;i++)
{
if(arr[i]%2==0)
{
count++;
}
}
if(count%2==0)
{
System.out.println("maomao90");
}
else
{
System.out.println("errorgorn");
}
count=0;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | ae2d66a7b3660b5035da3a5369e0e01e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while(t-->0)
{
int n = scn.nextInt();
int countOptions = 0;
for(int i = 0 ; i<n ; i++) {
countOptions+= scn.nextInt()-1;
}
if(countOptions%2==0)
{
System.out.println("maomao90");
}
else
System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 166cc60e5422f5c90e315c84106cf7b8 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class CodeForce2
{
public static void main(String args[])
{
Scanner s = new Scanner(System.in);
int t = s.nextInt();
while(t-->0)
{ int pos=-1;
int n = s.nextInt();
int[] arr = new int[n+1];
int odd=0,even=0;
for(int k=1;k<=n;k++)
{
arr[k] = s.nextInt();
}
for(int i=1;i<=n;i++)
{
if(arr[i]%2==0)
even++;
else
odd++;
}
if((odd%2==0 && even%2==0) || (odd%2!=0 && even%2==0))
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 4948253730a4facbeb615cd7aee0a6d9 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
while (t-- > 0) {
int n = scanner.nextInt(), turn = 0, cnt[] = new int[51];
for (int i = 0; i < n; i++) cnt[scanner.nextInt()]++;
while (true) {
int i = 2;
for (; i < 51; i++) {
if (cnt[i] > 0) {
cnt[i/2]++;
cnt[i/2 + i%2]++;
cnt[i]--;
turn++;
break;
}
}
if (i == 51) break;
}
System.out.println(turn%2 == 1 ? "errorgorn" : "maomao90");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | dea3f7220e48a22e3be0842f5b7fc495 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main {
static Scanner sc = new Scanner (System.in);
public static void main(String[] args) {
int test = sc.nextInt();
for ( int t=0; t<test; t++){
int a = sc.nextInt();
long[] arr = new long[a];
long sum=0;
for ( int i=0; i<a; i++){
arr[i] = sc.nextInt();
long x = arr[i]-1;
sum = sum + x;
}
if( sum%2==1)
System.out.println("errorgorn");
else
System.out.println("maomao90");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 7f1e0d0564de23ba7e822395b754c008 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | // package codeForces;
import java.util.*;
public class LogChopping {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int a [] = new int [n];
int sum =0;
for(int i=0;i<n;i++) {
a[i] = sc.nextInt();
sum += a[i]-1;
}
if(sum%2==0) System.out.println("maomao90");
else System.out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 4be7e190e1db418eec9a4387889ccc9f | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.Scanner;
public class p1 {
public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int t=scan.nextInt();
// int[] arr=new int[n+1];
int w;
int c=0;
while(t--!=0) {
int n=scan.nextInt();
while(n--!=0) {
w=scan.nextInt();
if(w%2==0) {
// w=w-1;
c+=w-1;
}
}
if(c%2==0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
c=0;
}}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 2232ff706023073dd30b8158fe9882fc | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | // 1672A
import java.util.*;
public class LogChopping {
public static void main (String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for (int i = 0; i < t; i++) {
int n = in.nextInt();
int cuts = 0;
for (int j = 0; j < n; j++) {
cuts += in.nextInt() - 1;
}
if (cuts % 2 == 0) {
System.out.println("maomao90");
} else {
System.out.println("errorgorn");
}
}
in.close();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e0cddd0dc2809b61180a9b67c98e25da | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static long mod = 1000000007;
static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
int t = sc.nextInt();
while( t-- > 0) {
int sum = 0;
int n = sc.nextInt();
for( int i =0 ;i < n;i++) {
sum+=sc.nextInt()-1;
}
out.println(sum%2 == 0 ?"maomao90":"errorgorn");
}
out.flush();
}
/*
* time for a change
*/
public static boolean ifpowof2(long n ) {
return ((n&(n-1)) == 0);
}
static boolean isprime(long x ) {
if( x== 2) {
return true;
}
if( x%2 == 0) {
return false;
}
for( long i = 3 ;i*i <= x ;i+=2) {
if( x%i == 0) {
return false;
}
}
return true;
}
static boolean[] sieveOfEratosthenes(long n) {
boolean prime[] = new boolean[(int)n + 1];
for (int i = 0; i <= n; i++) {
prime[i] = true;
}
for (long p = 2; p * p <= n; p++) {
if (prime[(int)p] == true) {
for (long i = p * p; i <= n; i += p)
prime[(int)i] = false;
}
}
return prime;
}
public static int[] nextLargerElement(int[] arr, int n) {
Stack<Integer> stack = new Stack<>();
int rtrn[] = new int[n];
rtrn[n-1] = -1;
stack.push( n-1);
for( int i = n-2 ;i >= 0 ; i--){
int temp = arr[i];
int lol = -1;
while( !stack.isEmpty() && arr[stack.peek()] <= temp){
if(arr[stack.peek()] == temp ) {
lol = stack.peek();
}
stack.pop();
}
if( stack.isEmpty()){
if( lol != -1) {
rtrn[i] = lol;
}
else {
rtrn[i] = -1;
}
}
else{
rtrn[i] = stack.peek();
}
stack.push( i);
}
return rtrn;
}
static void mysort(int[] arr) {
for(int i=0;i<arr.length;i++) {
int rand = (int) (Math.random() * arr.length);
int loc = arr[rand];
arr[rand] = arr[i];
arr[i] = loc;
}
Arrays.sort(arr);
}
static void mySort(long[] arr) {
for(int i=0;i<arr.length;i++) {
int rand = (int) (Math.random() * arr.length);
long loc = arr[rand];
arr[rand] = arr[i];
arr[i] = loc;
}
Arrays.sort(arr);
}
static long gcd(long a, long b)
{
if (a == 0)
return b;
return gcd(b % a, a);
}
static long lcm(long a, long b)
{
return (a / gcd(a, b)) * b;
}
static long rightmostsetbit(long n) {
return n&-n;
}
static long leftmostsetbit(long n)
{
long k = (long)(Math.log(n) / Math.log(2));
return k;
}
static HashMap<Long,Long> primefactor( long n){
HashMap<Long ,Long> hm = new HashMap<>();
long temp = 0;
while( n%2 == 0) {
temp++;
n/=2;
}
if( temp!= 0) {
hm.put( 2L, temp);
}
long c = (long)Math.sqrt(n);
for( long i = 3 ; i <= c ; i+=2) {
temp = 0;
while( n% i == 0) {
temp++;
n/=i;
}
if( temp!= 0) {
hm.put( i, temp);
}
}
if( n!= 1) {
hm.put( n , 1L);
}
return hm;
}
static ArrayList<Long> allfactors(long abs) {
HashMap<Long,Integer> hm = new HashMap<>();
ArrayList<Long> rtrn = new ArrayList<>();
for( long i = 2 ;i*i <= abs; i++) {
if( abs% i == 0) {
hm.put( i , 0);
hm.put(abs/i, 0);
}
}
for( long x : hm.keySet()) {
rtrn.add(x);
}
if( abs != 0) {
rtrn.add(abs);
}
return rtrn;
}
public static int[][] prefixsum( int n , int m , int arr[][] ){
int prefixsum[][] = new int[n+1][m+1];
for( int i = 1 ;i <= n ;i++) {
for( int j = 1 ; j<= m ; j++) {
int toadd = 0;
if( arr[i-1][j-1] == 1) {
toadd = 1;
}
prefixsum[i][j] = toadd + prefixsum[i][j-1] + prefixsum[i-1][j] - prefixsum[i-1][j-1];
}
}
return prefixsum;
}
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 StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 131ea7145475c50c8651d38d55dc36d5 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
import java.util.Collection;
import static java.lang.Math.*;
/*
author id: shubhanshu_jha
This is being used for the FastIO operations...
*/
public class Main implements Runnable {
public void run() {
InputReader input = new InputReader(System.in);
PrintWriter output = new PrintWriter(System.out);
int numOfTestCases = input.nextInt();
final String[] result = {"errorgorn", "maomao90"};
while (numOfTestCases-- > 0) {
int numOfLogs = input.nextInt();
int[] lenOfLogs = new int[numOfLogs];
int sumOfLogs = 0;
for (int i = 0; i < numOfLogs; i++) {
lenOfLogs[i] = input.nextInt();
sumOfLogs += lenOfLogs[i];
}
sumOfLogs -= numOfLogs;
if ((sumOfLogs & 1) == 0) {
output.println(result[1]);
} else {
output.println(result[0]);
}
}
output.close();
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;;
private SpaceCharFilter filter;
private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars==-1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
}
catch (IOException e) {
throw new InputMismatchException();
}
if(numChars <= 0)
return -1;
}
return buf[curChar++];
}
public String nextLine() {
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
public int nextInt() {
int c = read();
while(isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if(c<'0'||c>'9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
while (!isSpaceChar(c));
return res * sgn;
}
public long nextLong() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
while (!isSpaceChar(c));
return res * sgn;
}
public double nextDouble() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
double res = 0;
while (!isSpaceChar(c) && c != '.') {
if (c == 'e' || c == 'E')
return res * Math.pow(10, nextInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
}
if (c == '.') {
c = read();
double m = 1;
while (!isSpaceChar(c)) {
if (c == 'e' || c == 'E')
return res * Math.pow(10, nextInt());
if (c < '0' || c > '9')
throw new InputMismatchException();
m /= 10;
res += (c - '0') * m;
c = read();
}
}
return res * sgn;
}
public String readString() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
}
while (!isSpaceChar(c));
return res.toString();
}
public char nextChar() {
return next().charAt(0);
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
public static void main(String args[]) throws Exception {
new Thread(null, new Main(),"Main",1<<26).start();
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5f9667a7b2f175d578fa4df68fe043f0 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public final class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int i = 0; i < T; i++) {
int N = sc.nextInt();
int sum = 0;
for (int j = 0; j < N; j++) {
sum += sc.nextInt();
}
sum -= N;
if (sum % 2 == 0) {
System.out.println("maomao90");
} else {
System.out.println("errorgorn");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 4d3082aaca55cedd02973b4decee64c2 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Testclass
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int t,n;
Scanner sc=new Scanner (System.in);
t=sc.nextInt();
for (int a=0;a<t;a++)
{
n=sc.nextInt();
int arr[]=new int[n];
int o=0,p=0,e=0;
for(int i=0;i<n;i++){
arr[i]=sc.nextInt();
if(arr[i]%2!=0&&arr[i]!=1){
o++;
}
else if(arr[i]%2==0){
e++;
}
if(arr[i]==1){
p++;
}
}
if(p==n){
System.out.println("maomao90");
}
else{
if(o%2==0&&e%2!=0){
System.out.println("errorgorn");
}
else if(o%2!=0&&e%2!=0){
System.out.println("errorgorn");
}
else{
System.out.println("maomao90");
}
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e0d6c8680d445739a977dbda863dfda3 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.IOException;
import java.util.Scanner;
public class Solution {
public static void main(String[] args) throws IOException {
try {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
for (int i = 0; i < a; i++) {
boolean d = true;
int b = sc.nextInt();
int[] c = new int[b];
for (int j = 0; j < b; j++) {
c[j] = sc.nextInt();
}
int result = 0;
for (int elements: c){
result = result+elements -1;
}
if (result%2==1){
System.out.println("errorgorn");
} else{
System.out.println( "maomao90");
}
}
} catch (Exception e) {
return;
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 54d0b0788fab407839cc9a59681c630c | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.Math;
public class Log_Chopping {
public static void main(String[] args) throws Exception{
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-- > 0){
int n = in.nextInt();
int cpt = 0;
for(int i = 0; i < n; i++){
cpt += in.nextInt() - 1;
}
if(cpt % 2 == 0) System.out.println("maomao90");
else System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | cd6cbbabc6fcca04c6da08b8b9a4ed0d | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class Solution{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] YDSV) throws IOException{
//int t=1;
int t=Integer.parseInt(br.readLine());
while(t-->0) Solve();
bw.flush();
}
public static void Solve() throws IOException{
st=new StringTokenizer(br.readLine());
int n=Integer.parseInt(st.nextToken());
st=new StringTokenizer(br.readLine());
int[] ar=new int[n];
for(int i=0;i<n;i++) ar[i]=Integer.parseInt(st.nextToken());
int s=0;
for(int i:ar){
if(i>1){
s+=(i-1);
}
}
if(s%2!=0){
bw.write("errorgorn\n");
}
else bw.write("maomao90\n");
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 9badb43770a92256b79dd56cf8af4131 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.StringTokenizer;
public class contest1 {
public static class MyScanner {
BufferedReader br;
StringTokenizer st;
public MyScanner() {
br = new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
void run() {
//MyScanner ms = new MyScanner();
Scanner ms = new Scanner(System.in);
//PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int tests = ms.nextInt();
while (tests-- > 0) {
int logs = ms.nextInt();
//ArrayList<Integer> lgs = new ArrayList<>(logs);
int turns = 0;
for (int i = 0; i < logs; i++) {
int in = ms.nextInt();
if (in > 1) {
turns += f(in);
}
}
//out.println(turns%2!=0?"errorgorn" : "maomao90");
System.out.println(turns % 2 != 0 ? "errorgorn" : "maomao90");
}
ms.close();
//out.close();
}
int closep2(int i) {
int p = 1;
int ret = 0;
while (i >= p * 2) {
p *= 2;
//ret++;
}
return p;
}
int f(int log) {
int sum = 0;
while (log > 0) {
int cls = closep2(log);
//System.out.println(log + " "+ cls);
sum += cls - 1;
log -= cls;// (int)Math.pow(2,cls);
//System.out.println(log + " "+ cls);
if (log != 0)
sum++;
}
return sum;
}
public static void main(String[] args) throws Exception {
contest1 m = new contest1();
m.run();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | fae7294cae55f1da7f4fc4d4f65fbbfb | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class logChopping {
public static void main(String[] args) {
Scanner sn=new Scanner(System.in);
int t=sn.nextInt();
while(t-->0){
int n=sn.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
arr[i]=sn.nextInt();
if(result(arr, n)%2!=0)
System.out.println("errorgorn");
else
System.out.println("maomao90");
}
}
public static long result(int arr[],int n){
long sum=0;
for(int i:arr)
sum+=i-1;
return sum;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 51b5eb7e3ab8c1c2163c76501403a423 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
// System.out.println(sc.nextByte());
logchop(sc);
}
private static void logchop(Scanner scanner){
int testcase=scanner.nextInt();
for(int i=0;i<testcase;i++){
int size=scanner.nextInt();
int sum=0;
for(int j=0;j<size;j++){
int z=scanner.nextInt();
if(z>1)sum+=z-1;
}
if(sum%2==0)System.out.println("maomao90");
else{
System.out.println("errorgorn");
}
}
}} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 8ebed50425e55bdf35896c54ca16693f | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 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
* Actual solution is at the top
*/
public class ProbB {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
Task solver = new Task();
solver.solve(in, out);
out.close();
}
static class Task {
public void solve(InputReader in, PrintWriter out) {
int cases = in.nextInt();
for(int a = 0; a < cases; a++){
int len = in.nextInt();
int chops = 0;
for(int b = 0; b < len; b++){
int chop = in.nextInt();
if(chop == 1){
continue;
}
else{
chops += chop - 1;
}
}
if(chops%2==1){
out.println("errorgorn");
}
else{
out.println("maomao90");
}
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | da1b2894df3601d9462fdf4dd21ca080 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | /* package CodeForces; // don't place package name! */
// algo_messiah23 , NIT RKL ...
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import static java.lang.System.*;
import java.util.stream.IntStream;
import java.util.Map.Entry;
/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
static PrintWriter out=new PrintWriter((System.out));
static FastReader in = new FastReader();
static int INF = Integer.MAX_VALUE;
static int NINF = Integer.MIN_VALUE;
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
int t=i();
while(t-->0)
{
solve();
}
out.close();
}
public static void solve()
{
int n=i();
int a[]=input(n);
int sum=0;
for(int i=0;i<n;i++)
sum+=a[i]-1;
if(sum%2==0)
out.println("maomao90");
else
out.println("errorgorn");
}
static int[] input(int N){
int[] A=new int[N];
for(int i=0; i<N; i++)
A[i]=in.nextInt();
return A;
}
public static void print(int[] arr){
int n = arr.length;
for(int i = 0;i < n;i++){
out.print(arr[i] + " ");
}
out.println();
}
public static void sort(int[] arr){
ArrayList<Integer> ls = new ArrayList<>();
for(int x : arr){
ls.add(x);
}
Collections.sort(ls);
for(int i = 0;i < arr.length;i++){
arr[i] = ls.get(i);
}
}
public static void reverse(int[] arr){
int n = arr.length;
for(int i = 0;i < n/2;i++){
int temp = arr[i];
arr[i] = arr[n-1-i];
arr[n-1-i] = temp;
}
}
public static void reverse(long[] arr){
int n = arr.length;
for(int i = 0;i < n/2;i++){
long temp = arr[i];
arr[i] = arr[n-1-i];
arr[n-1-i] = temp;
}
}
public static void print(ArrayList<Integer> arr){
int n = arr.size();
for(int i = 0;i < n;i++){
out.print(arr.get(i) + " ");
}
out.println();
}
static int i()
{
return in.nextInt();
}
static long l()
{
return in.nextLong();
}
static char ich()
{
return in.next().charAt(0);
}
static String is()
{
return in.next();
}
static String isl()
{
return in.nextLine();
}
public static int max(int[] arr){
int max = -1;
int n = arr.length;
for(int i = 0;i < n;i++)
max = Math.max(max,arr[i]);
return max;
}
public static int min(int[] arr){
int min=100000;
int n=arr.length;
for(int i = 0;i< n;i++)
min=Math.min(min,arr[i]);
return min;
}
public static int gcd(int x, int y)
{
if (y==0){
return x;
}
return gcd(y,x%y);
}
}
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | ee86210a4f5f654d5f2647cf3472b095 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.lang.*;
// import java.math.*;
import java.io.*;
import java.util.*;
public class Main{
public static int mod=(int)(1e9) + 7;
public static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public static PrintWriter ot=new PrintWriter(System.out);
public static int[] take_arr(int n){
int a[]=new int[n];
try {
String s[]=br.readLine().trim().split(" ");
for(int i=0;i<n;i++)
a[i]=Integer.parseInt(s[i]);
} catch (Exception e) {
e.printStackTrace();
}
return a;
}
public static void main (String[] args) throws java.lang.Exception
{
try{
int t=Integer.parseInt(br.readLine().trim());
int cno=1;
while(t-->0){
String s[]=br.readLine().trim().split(" ");
int n=Integer.parseInt(s[0]);
// int b=Integer.parseInt(s[1]);
// int x=Integer.parseInt(s[2]);
// int y=Integer.parseInt(s[3]);
int a[]=take_arr(n);
// int b[]=take_arr(n);
// char ch[]=br.readLine().trim().toCharArray();
// long n=Long.parseLong(s[0]);
solve(n,a);
}
ot.close();
br.close();
}catch(Exception e){
e.printStackTrace();
return;
}
}
static void solve(int n, int a[]){
try{
Queue<Integer> pq=new PriorityQueue<>(Collections.reverseOrder());
for(int x:a) if(x!=1) pq.add(x);
boolean bool = true;
while(!pq.isEmpty()){
int temp = pq.remove();
// int x = temp/2;
if(temp>2)
pq.add(temp-1);
// if(x>1) pq.add(x);
// if(temp-x>1) pq.add(x);
bool=!bool;
}
if(!bool)
ot.println("errorgorn");
else
ot.println("maomao90");
} catch(Exception e){
e.printStackTrace();
return ;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | abd587d9485056b190ef3dc7124d4b5b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.security.cert.X509CRL;
import java.util.*;
import java.lang.*;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@SuppressWarnings("unused")
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static String OUTPUT = "";
//global
//private final static long BASE = 998244353L;
private final static int BASE = 1000000007;
private final static int INF_I = 1001001001;
private final static long INF_L = 1001001001001001001L;
private final static int MAXN = 100100;
private static List<Integer> palin = new ArrayList<>();
static void solve() {
int ntest = readInt();
for (int test=0;test<ntest;test++) {
int N = readInt();
int s = 0;
for (int i=0;i<N;i++) s^=(1-readInt()%2);
if (s>0) out.println("errorgorn");
else out.println("maomao90");
}
}
public static void main(String[] args) throws Exception
{
long S = System.currentTimeMillis();
if (INPUT=="") {
is = System.in;
} else {
File file = new File(INPUT);
is = new FileInputStream(file);
}
if (OUTPUT == "") out = new PrintWriter(System.out);
else out = new PrintWriter(OUTPUT);
solve();
out.flush();
long G = System.currentTimeMillis();
}
private static class Point<T extends Number & Comparable<T>> implements Comparable<Point<T>> {
private T x;
private T y;
public Point(T x, T y) {
this.x = x;
this.y = y;
}
public T getX() {return x;}
public T getY() {return y;}
@Override
public int compareTo(Point<T> o) {
int cmp = x.compareTo(o.getX());
if (cmp==0) return y.compareTo(o.getY());
return cmp;
}
}
private static class ClassComparator<T extends Comparable<T>> implements Comparator<T> {
public ClassComparator() {}
@Override
public int compare(T a, T b) {
return a.compareTo(b);
}
}
private static class ListComparator<T extends Comparable<T>> implements Comparator<List<T>> {
public ListComparator() {}
@Override
public int compare(List<T> o1, List<T> o2) {
for (int i = 0; i < Math.min(o1.size(), o2.size()); i++) {
int c = o1.get(i).compareTo(o2.get(i));
if (c != 0) {
return c;
}
}
return Integer.compare(o1.size(), o2.size());
}
}
private static boolean eof()
{
if(lenbuf == -1)return true;
int lptr = ptrbuf;
while(lptr < lenbuf)if(!isSpaceChar(inbuf[lptr++]))return false;
try {
is.mark(1000);
while(true){
int b = is.read();
if(b == -1){
is.reset();
return true;
}else if(!isSpaceChar(b)){
is.reset();
return false;
}
}
} catch (IOException e) {
return true;
}
}
private static byte[] inbuf = new byte[1024];
static int lenbuf = 0, ptrbuf = 0;
private static int readByte()
{
if(lenbuf == -1)throw new InputMismatchException();
if(ptrbuf >= lenbuf){
ptrbuf = 0;
try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
if(lenbuf <= 0)return -1;
}
return inbuf[ptrbuf++];
}
private static boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
// private static boolean isSpaceChar(int c) { return !(c >= 32 && c <= 126); }
private static int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
private static double readDouble() { return Double.parseDouble(readString()); }
private static char readChar() { return (char)skip(); }
private static String readString()
{
int b = skip();
StringBuilder sb = new StringBuilder();
while(!(isSpaceChar(b))){
sb.appendCodePoint(b);
b = readByte();
}
return sb.toString();
}
private static char[] readChar(int n)
{
char[] buf = new char[n];
int b = skip(), p = 0;
while(p < n && !(isSpaceChar(b))){
buf[p++] = (char)b;
b = readByte();
}
return n == p ? buf : Arrays.copyOf(buf, p);
}
private static char[][] readTable(int n, int m)
{
char[][] map = new char[n][];
for(int i = 0;i < n;i++)map[i] = readChar(m);
return map;
}
private static int[] readIntArray(int n)
{
int[] a = new int[n];
for(int i = 0;i < n;i++)a[i] = readInt();
return a;
}
private static long[] readLongArray(int n) {
long[] a = new long[n];
for (int i=0;i<n;i++) a[i] = readLong();
return a;
}
private static int readInt()
{
int num = 0, b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static long readLong()
{
long num = 0;
int b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-'){
minus = true;
b = readByte();
}
while(true){
if(b >= '0' && b <= '9'){
num = num * 10 + (b - '0');
}else{
return minus ? -num : num;
}
b = readByte();
}
}
private static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); }
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | f400a35419407f7ce7daf3fdea1c6127 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while (t-- > 0) {
int n = in.nextInt();
int sum = 0;
for (int i = 0; i < n; ++i) {
sum += in.nextInt()-1;
}
System.out.println(sum%2 == 0 ? "maomao90" : "errorgorn");
}
in.close();
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 8655bc1d73dc5e8a964ddf1bf1256231 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int testCases = sc.nextInt();
for (int t = 0; t < testCases; t++) {
int n = sc.nextInt(), total = 0;
for (int i = 0; i < n; i++) {
total += sc.nextInt() - 1;
}
System.out.println((total & 1) == 0 ? "maomao90" : "errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | bcd7dd64010ca4a45e4211c2b692293b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
// import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Set;
import java.util.Stack;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
// import java.util.Set;
// import java.util.TreeSet;
// import java.util.stream.Collectors;
// import java.util.stream.Stream;
// import java.util.Stack;
// import java.util.Optional;
// import java.util.HashSet;
import java.io.*;
public class sol {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n=sc.nextInt();
// int ar[]=new int[n];
// boolean flag=true;
String ans="";
int count[]={0};
// for(int i=0;i<n;i++){
IntStream.range(0, n).forEach(i->{
int temp=sc.nextInt();
count[0]+=(temp-1);
});
System.out.println(count[0]%2==0?"maomao90":"errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 7bd5150465ba72ee69f7ea6ed45e99a9 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class a111 {
public static void main(String []args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t-->0) {
int n=s.nextInt();
int res=0;
while(n-->0) {
int a=s.nextInt();
if(a>1)
res+=a-1;
}
if(res%2==0)
System.out.println("maomao90");
else System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | ca7831e7de9cd86999eca68bac8ab4f2 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedInputStream(System.in));
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
int a[] = new int[n + 100];
long sum = 0;
for (int i = 0; i < n; i++){
a[i] = sc.nextInt();
sum+=a[i]-1;
}
System.out.println(sum%2==0?"maomao90":"errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 755b7927b8e1fab1df0a09d79a943dcc | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.lang.*;
import java.util.*;
public class ComdeFormces {
public static int cc2;
public static pair pr;
public static long sum;
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
// Reader.init(System.in);
FastReader sc=new FastReader();
BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
// OutputStream out = new BufferedOutputStream ( System.out );
int t=sc.nextInt();
int tc=1;
while(t--!=0) {
int n=sc.nextInt();
int a[]=new int[n];
boolean ev=false;
int cnt=0;
for(int i=0;i<n;i++) {
a[i]=sc.nextInt();
if(a[i]%2==0) {
cnt++;
}
}
if(cnt%2!=0)log.write("errorgorn");
else log.write("maomao90");
log.write("\n");
log.flush();
}
}
static long evv(int a[],int mx,int mn,int n,long ans) {
int ind=-1;
int min=Integer.MAX_VALUE;
int min2=Integer.MAX_VALUE;
for(int i=0;i<n;i++) {
if(i==0 || i==n-1) {
if(mx-a[i]<min) {
min=mx-a[i];
ind=i;
}
if(ind==i) {
if(min2>mx-1) {
min2=mx-1;
}
}
else if(ind!=i) {
if(min2>a[i]-1)min2=a[i]-1;
}
}
else {
if(Math.abs(mx-a[i])+Math.abs(mx-a[i+1])<min) {
min=Math.abs(mx-a[i])+Math.abs(mx-a[i+1]);
ind=i;
}
if(ind==i) {
if(min2>mx+a[i]-2) {
min2=mx+a[i]-2;
}
}
else if(ind!=i) {
if(min2>a[i]+a[i+1]-2)min2=a[i]+a[i+1]-2;
}
}
// upd[i]=min;
}
return ans+=min+min2;
}
static long eval(ArrayList<ArrayList<Integer>> ar,int src,long f[], boolean vis[]) {
long mn=Integer.MAX_VALUE;
vis[src]=true;
for(int p:ar.get(src)) {
if(!vis[p]) {
long s=eval(ar,p,f,vis);
mn=Math.min(mn,s);
sum+=s;
}
}
if(src==0)return 0;
if(mn==Integer.MAX_VALUE)return f[src];
sum-=mn;
return Math.max(f[src], mn);
}
public static void radixSort(int a[]) {
int n=a.length;
int res[]=new int[n];
int p=1;
for(int i=0;i<=8;i++) {
int cnt[]=new int[10];
for(int j=0;j<n;j++) {
a[j]=res[j];
cnt[(a[j]/p)%10]++;
}
for(int j=1;j<=9;j++) {
cnt[j]+=cnt[j-1];
}
for(int j=n-1;j>=0;j--) {
res[cnt[(a[j]/p)%10]-1]=a[j];
cnt[(a[j]/p)%10]--;
}
p*=10;
}
}
static int bits(long n) {
int ans=0;
while(n!=0) {
if((n&1)==1)ans++;
n>>=1;
}
return ans;
}
static long flor(ArrayList<Long> ar,long el) {
int s=0;
int e=ar.size()-1;
while(s<=e) {
int m=s+(e-s)/2;
if(ar.get(m)==el)return ar.get(m);
else if(ar.get(m)<el)s=m+1;
else e=m-1;
}
return e>=0?e:-1;
}
public static int kadane(int a[]) {
int sum=0,mx=Integer.MIN_VALUE;
for(int i=0;i<a.length;i++) {
sum+=a[i];
mx=Math.max(mx, sum);
if(sum<0) sum=0;
}
return mx;
}
public static int m=1000000007;
public static int mul(int a, int b) {
return ((a%m)*(b%m))%m;
}
public static long mul(long a, long b) {
return ((a%m)*(b%m))%m;
}
public static int add(int a, int b) {
return ((a%m)+(b%m))%m;
}
public static long add(long a, long b) {
return ((a%m)+(b%m))%m;
}
//debug
public static <E> void p(E[][] a,String s) {
System.out.println(s);
for(int i=0;i<a.length;i++) {
for(int j=0;j<a[0].length;j++) {
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
public static void p(int[] a,String s) {
System.out.print(s+"=");
for(int i=0;i<a.length;i++)System.out.print(a[i]+" ");
System.out.println();
}
public static void p(long[] a,String s) {
System.out.print(s+"=");
for(int i=0;i<a.length;i++)System.out.print(a[i]+" ");
System.out.println();
}
public static <E> void p(E a,String s){
System.out.println(s+"="+a);
}
public static <E> void p(ArrayList<E> a,String s){
System.out.println(s+"="+a);
}
public static <E> void p(LinkedList<E> a,String s){
System.out.println(s+"="+a);
}
public static <E> void p(HashSet<E> a,String s){
System.out.println(s+"="+a);
}
public static <E> void p(Stack<E> a,String s){
System.out.println(s+"="+a);
}
public static <E> void p(Queue<E> a,String s){
System.out.println(s+"="+a);
}
//utils
static ArrayList<Integer> divisors(int n){
ArrayList<Integer> ar=new ArrayList<>();
for (int i=2; i<=Math.sqrt(n); i++){
if (n%i == 0){
if (n/i == i) {
ar.add(i);
}
else {
ar.add(i);
ar.add(n/i);
}
}
}
return ar;
}
static ArrayList<Integer> prime(int n){
ArrayList<Integer> ar=new ArrayList<>();
int cnt=0;
boolean pr=false;
while(n%2==0) {
ar.add(2);
n/=2;
}
for(int i=3;i*i<=n;i+=2) {
pr=false;
while(n%i==0) {
n/=i;
ar.add(i);
pr=true;
}
}
if(n>2) ar.add(n);
return ar;
}
static long gcd(long a,long b) {
if(b==0)return a;
else return gcd(b,a%b);
}
static int gcd(int a,int b) {
if(b==0)return a;
else return gcd(b,a%b);
}
static long factmod(long n,long mod,long img) {
if(n==0)return 1;
long ans=1;
long temp=1;
while(n--!=0) {
if(temp!=img) {
ans=((ans%mod)*((temp)%mod))%mod;
}
temp++;
}
return ans%mod;
}
static int ncr(int n, int r){
if(r>n-r)r=n-r;
int ans=1;
for(int i=0;i<r;i++){
ans*=(n-i);
ans/=(i+1);
}
return ans;
}
public static class trip{
int a,b;
int c;
public trip(int a,int b,int c) {
this.a=a;
this.b=b;
this.c=c;
}
public int compareTo(trip q) {
return this.b-q.b;
}
}
static void mergesort(long[] a,int start,int end) {
if(start>=end)return ;
int mid=start+(end-start)/2;
mergesort(a,start,mid);
mergesort(a,mid+1,end);
merge(a,start,mid,end);
}
static void merge(long[] a, int start,int mid,int end) {
int ptr1=start;
int ptr2=mid+1;
long b[]=new long[end-start+1];
int i=0;
while(ptr1<=mid && ptr2<=end) {
if(a[ptr1]<=a[ptr2]) {
b[i]=a[ptr1];
ptr1++;
i++;
}
else {
b[i]=a[ptr2];
ptr2++;
i++;
}
}
while(ptr1<=mid) {
b[i]=a[ptr1];
ptr1++;
i++;
}
while(ptr2<=end) {
b[i]=a[ptr2];
ptr2++;
i++;
}
for(int j=start;j<=end;j++) {
a[j]=b[j-start];
}
}
public static class FastReader {
BufferedReader b;
StringTokenizer s;
public FastReader() {
b=new BufferedReader(new InputStreamReader(System.in));
}
String next() {
while(s==null ||!s.hasMoreElements()) {
try {
s=new StringTokenizer(b.readLine());
}
catch(IOException e) {
e.printStackTrace();
}
}
return s.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
public long nextLong() {
return Long.parseLong(next());
}
public double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str="";
try {
str=b.readLine();
}
catch(IOException e) {
e.printStackTrace();
}
return str;
}
boolean hasNext() {
if (s != null && s.hasMoreTokens()) {
return true;
}
String tmp;
try {
b.mark(1000);
tmp = b.readLine();
if (tmp == null) {
return false;
}
b.reset();
} catch (IOException e) {
return false;
}
return true;
}
}
public static class pair{
int a;
int b;
public pair(int a,int b) {
this.a=a;
this.b=b;
}
public int compareTo(pair b) {
return this.a-b.a;
}
// public int compareToo(pair b) {
// return this.b-b.b;
// }
@Override
public String toString() {
return "{"+this.a+" "+this.b+"}";
}
}
static long pow(long a, long pw) {
long temp;
if(pw==0)return 1;
temp=pow(a,pw/2);
if(pw%2==0)return temp*temp;
return a*temp*temp;
}
static int pow(int a, int pw) {
int temp;
if(pw==0)return 1;
temp=pow(a,pw/2);
if(pw%2==0)return temp*temp;
return a*temp*temp;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5d0c1c12b325760270ddecd07a8303ce | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | // package global_20;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A{
public static void main(String[] args){
FastReader sc = new FastReader();
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int a[]=sc.fastArray(n);
long sum=0;
for(int i:a) {
sum+=(i-1);
}
if((sum&1)==1) System.out.println("errorgorn");
else System.out.println("maomao90");
}
}
static class pair {
int x;int y;
pair(int x,int y){
this.x=x;
this.y=y;
}
}
static void sort(int a[]) {
ArrayList<Integer> aa= new ArrayList<>();
for(int i:a)aa.add(i);
Collections.sort(aa);
int j=0;
for(int i:aa)a[j++]=i;
}
static ArrayList<Integer> primeFac(int n){
ArrayList<Integer>ans = new ArrayList<Integer>();
int lp[]=new int [n+1];
Arrays.fill(lp, 0); //0-prime
for(int i=2;i<=n;i++) {
if(lp[i]==0) {
for(int j=i;j<=n;j+=i) {
if(lp[j]==0) lp[j]=i;
}
}
}
int fac=n;
while(fac>1) {
ans.add(lp[fac]);
fac=fac/lp[fac];
}
print(ans);
return ans;
}
static ArrayList<Long> prime_in_given_range(long l,long r){
ArrayList<Long> ans= new ArrayList<>();
int n=(int)Math.sqrt(r)+1;
int prime[]=sieve_of_Eratosthenes(n);
long res[]=new long [(int)(r-l)+1];
for(int i=0;i<=r-l;i++) {
res[i]=i+l;
}
for(int i=0;i<prime.length;i++) {
if(prime[i]==1) {
System.out.println(2);
for(int j=Math.max((int)i*i, (int)(l+i-1)/i*i);j<=r;j+=i) {
res[j-(int)l]=0;
}
}
}
for(long i:res) if(i!=0)ans.add(i);
return ans;
}
static int [] sieve_of_Eratosthenes(int n) {
int prime[]=new int [n];
Arrays.fill(prime, 1); // 1-prime | 0-not prime
prime[0]=prime[1]=0;
for(int i=2;i<n;i++) {
if(prime[i]==1) {
for(int j=i*i;j<n;j+=i) {
prime[j]=0;
}
}
}
return prime;
}
static long binpow(long a,long b) {
long res=1;
if(b==0)return a;
if(a==0)return 1;
while(b>0) {
if((b&1)==1) {
res*=a;
}
a*=a;
b>>=1;
}
return res;
}
static void print(int a[]) {
System.out.println(a.length);
for(int i:a) {
System.out.print(i+" ");
}
System.out.println();
}
static void print(long a[]) {
System.out.println(a.length);
for(long i:a) {
System.out.print(i+" ");
}
System.out.println();
}
static void print(ArrayList<Integer> a) {
System.out.println(a.size());
for(long i:a) {
System.out.print(i+" ");
}
System.out.println();
}
static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReader()
{
br = new BufferedReader(
new InputStreamReader(System.in));
}
int [] fastArray(int n) {
int a[]=new int [n];
for(int i=0;i<n;i++) {
a[i]=nextInt();
}
return a;
}
String next()
{
while (st == null || !st.hasMoreElements()) {
try {
st = new StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 19c739c84c2ef17ea3802242ea890a43 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.lang.reflect.Array;
import java.math.*;
import java.util.*;
import java.io.*;
public class Main {
public static int getHash(ArrayList<Integer> arr, int i){
int sm = 7 * -1;
if (i - 2 > 0){
sm*= arr.get(i - 2);
}
if (i + 1 < arr.size()){
sm*= arr.get(i + 1);
}
return sm;
}
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0){
// ArrayList<Integer> arr= new ArrayList<>();
int n = sc.nextInt();
int sm = 0;
while(n-- > 0){
// int u = sc.nextInt();
// arr.add(u);
int k = sc.nextInt();
if (k > 1) {
int o = k;
int u = 0;
while(o >= 2){
o /= 2;
u ++;
}
sm += (Math.pow(2, u) - (k % 2 == 0 ? 1 : 0));
}
}
// int c = 0;
// for(int i = 1 ; i < arr.size(); i++){
// if (arr.get(i) == arr.get(i-1)){
//
// int h = getHash(arr, i);
//
// arr.set(i, h);
// arr.set(i - 1, h);
// c ++;
// }
// }
//
// System.out.println(c);
if (sm == 0){
System.out.println("maomao90");
}
else{
// if (sm % 2 != 0 )
// sm++;
// int turns = sm / 2;
if (sm % 2 == 0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 02aa7c3af2750a58f3ac1b1085be4d67 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class Codeforces extends PrintWriter {
Codeforces() { super(System.out); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
Codeforces o = new Codeforces(); o.main(); o.flush();
o.close();
}
void main() {
int t = sc.nextInt();
while (t--> 0) {
int n = sc.nextInt();
int arr[] = new int[n];
int sum=0;
for(int i=0;i<n;i++){
arr[i]=sc.nextInt();
sum+=arr[i];
}
if(n==1 && arr[0]==1){
println("maomao90");
}
else if((sum-n)%2==0){
println("maomao90");
}
else{
println("errorgorn");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | d5a5790b72aa8ebbe5973238ebebb68b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.*;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCases = scanner.nextInt();
while(testCases-->0) {
int numBr = scanner.nextInt();
int sum =0;
for(int i =numBr;i>0;i--) {
sum= sum+scanner.nextInt();
}
int res=sum-numBr;
if (res%2==0) {
System.out.println("maomao90");
}else {
System.out.println("errorgorn");
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | abef15dcfa965323341018978a9029a5 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.*;
public class Regional_round20 {
public static void main(String[] args) {
Scanner Abhi = new Scanner(System.in); // Abhishek Das Codechef 1*//
int t = Abhi.nextInt(); // long/ int
while(t-->0){
int n = Abhi.nextInt(); // long/int
PriorityQueue<Integer> q = new PriorityQueue<>(Collections.reverseOrder());
int arr[] = new int[n];
for(int i =0;i<n;i++) {
arr[i] =Abhi.nextInt();
q.offer(arr[i]);
}
int turn = 1;
while(q.peek()!=1) {
int x = q.poll();
q.offer(x/2);
q.offer(x-(x/2));
turn = 1-turn;
}
if(turn==0) {
System.out.println("errorgorn");
}
else System.out.println("maomao90");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 2053be3c393d62a4743934e66bc47505 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Answer3 {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
for (int j = 0; j < x; j++) {
int n = sc.nextInt();
int[] ar = new int[n];
for (int i = 0; i < n; i++) {
ar[i] = sc.nextInt();
}
int sum =0;
for(int i=0;i<n;i++){
sum+=ar[i];
}
sum = sum - n;
if(sum%2==0){
System.out.println("maomao90");
}
else{
System.out.println("errorgorn");
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 0f8d9d8d0923e5e5427a81c9119cba65 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class template {
static class QuickReader
{
BufferedReader in;
StringTokenizer token;
public QuickReader(InputStream ins)
{
in=new BufferedReader(new InputStreamReader(ins));
token=new StringTokenizer("");
}
public boolean hasNext()
{
while (!token.hasMoreTokens())
{
try
{
String s = in.readLine();
if (s == null) return false;
token = new StringTokenizer(s);
} catch (IOException e)
{
throw new InputMismatchException();
}
}
return true;
}
public String next()
{
hasNext();
return token.nextToken();
}
public int nextInt()
{
return Integer.parseInt(next());
}
public int[] nextInts(int n)
{
int[] res = new int[n];
for (int i = 0; i < n; i++)
res[i] = nextInt();
return res;
}
public long nextLong() {
return Long.parseLong(next());
}
public long[] nextLongs(int n)
{
long[] res = new long[n];
for (int i = 0; i < n; i++)
res[i] = nextLong();
return res;
}
}
static 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 ignored) {}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
private QuickReader sc;
private PrintWriter ptk;
public template(QuickReader sc, PrintWriter ptk) {
this.sc = sc;
this.ptk = ptk;
}
public static void main(String[] args) {
QuickReader in = new QuickReader(System.in);
try(PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));)
{
new template(in, out).solve();
}
}
public static String sortString(String inputString)
{
// Converting input string to character array
char tempArray[] = inputString.toCharArray();
// Sorting temp array using
Arrays.sort(tempArray);
// Returning new sorted string
return new String(tempArray);
}
static int mostFrequent(int arr[], int n)
{
// Sort the array
Arrays.sort(arr);
// find the max frequency using linear
// traversal
int max_count = 1, res = arr[0];
int curr_count = 1;
for (int i = 1; i < n; i++)
{
if (arr[i] == arr[i - 1])
curr_count++;
else
{
if (curr_count > max_count)
{
max_count = curr_count;
res = arr[i - 1];
}
curr_count = 1;
}
}
// If last element is most frequent
if (curr_count > max_count)
{
max_count = curr_count;
res = arr[n - 1];
}
return res;
}
public int maxFrequency(int[] nums, int k) {
int l = 0;
int r = 0;
int maxWin = 0;
long totalSum = 0;
//sorting is needed to get relation between consecutive elements
Arrays.sort(nums);
while (r < nums.length) {
totalSum = totalSum + nums[r];
//when this condition occurs means we have to increase left pointer which will reduce our window
while ((long) nums[r] * (r - l + 1) > totalSum + k) {
totalSum = totalSum - nums[l];
l++;
}
maxWin = Math.max(maxWin, r - l + 1);
r++;
}
return maxWin;
}
public static void countFrequencies(ArrayList<String> list)
{
TreeMap<String, Integer> tmap = new TreeMap<String, Integer>();
for (String t : list) {
Integer c = tmap.get(t);
tmap.put(t, (c == null) ? 1 : c + 1);
}
for (Map.Entry m : tmap.entrySet())
System.out.println("Frequency of " + m.getKey() + " is " + m.getValue());
}
static int countPairs(long A1[], long A2[] , int n1, int n2, long K)
{
// Initialize pairs to 0
int res = 0;
// create map of elements of array A1
Map<Long, Long> m = new HashMap<Long, Long> ();
for (int i = 0; i < n1; ++i)
{
if(m.containsKey(A1[i]))
m.put(A1[i], m.get(A1[i]) + 1);
else
m.put(A1[i], 1L);
}
// count total pairs
for (int i = 0; i < n2; ++i) {
long temp = K - A2[i];
if (m.containsKey(temp) && m.get(temp) != 0) {
res++;
// Every element can be part
// of at most one pair.
m.put(temp, m.get(A1[i]) - 1);
}
}
// return total pairs
return res;
}
static long getPairsCount(long[] arr, int n, double k)
{
HashMap<Long,Long> m = new HashMap<>();
long count = 0;
for (int i = 0; i < n; i++) {
if (m.containsKey((long)(k - arr[i]))) {
count += m.get((long)(k - arr[i]));
}
if(m.containsKey(arr[i])){
m.put(arr[i], m.get(arr[i])+1);
}
else{
m.put(arr[i], 1L);
}
}
return count;
}
public static void maxPairs(
long[] nums, double k)
{
// Initialize a hashmap
Map<Long, Long> map
= new HashMap<>();
// Store the final result
int result = 0;
// Iterate over the array nums[]
for (long i : nums) {
// Decrement its frequency
// in map and increment
// the result by 1
if (map.containsKey(i) &&
map.get(i) > 0)
{
map.put(i, map.get(i) - 1);
result++;
}
// Increment its frequency by 1
// if it is already present in map.
// Otherwise, set its frequency to 1
else
{
map.put((long) (k - i),
map.getOrDefault((long)(k - i), 0L) + 1);
}
}
// Print the result
System.out.println(result);
}
static int countTriplets(int A[], int N)
{
// Stores the count
int ans = 0;
// Map to store frequency
// of array elements
HashMap<Integer,
Integer> map = new HashMap<Integer,
Integer>();
for(int j = N - 2; j >= 1; j--)
{
// Increment the frequency
// of A[j+1] as it can be
// a valid A[k]
if(map.containsKey(A[j + 1]))
map.put(A[j + 1], map.get(A[j + 1]) + 1);
else
map.put(A[j + 1], 1);
for(int i = 0; i < N; i++)
{
int target = A[i] * A[j];
// If target exists in the map
if (map.containsKey(target))
ans += map.get(target);
}
}
// Return the final count
return ans;
}
public void solve() {
int tt=sc.nextInt();
while (tt-->0){
int n=sc.nextInt();
int [] arr=new int[n];
for (int i = 0; i <n ; i++) {
arr[i]=sc.nextInt();
}
int twos=0;
for (int i = 0; i <n ; i++) {
twos+=arr[i]/2;
}
int opnes=0;
for (int i = 0; i <n ; i++) {
if(arr[i]%2==1){
opnes++;
}
}
boolean b=true;
// System.out.println(twos);
for (int i = 0; i <n ; i++) {
if (arr[i]%2==0){
b= !b;
}
}
if (b){
System.out.println("maomao90");
}else System.out.println("errorgorn");
}
}
static long lcm(int a, int b)
{
return (a / gcd(a, b)) * b;
}
private static long gcd(long a, long b)
{
if (b == 0) {
return a;
}
return gcd(b, a % b);
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e54463aa8a7e1113f08f6e6b1eaf650a | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
static FastReader in=new FastReader();
static final Random random=new Random();
static long mod=1000000007L;
static HashMap<String,Integer>map=new HashMap<>();
public static void main(String args[]) throws IOException {
int t=in.nextInt();
while(t-->0){
int n=in.nextInt();
int arr[]=in.readintarray(n);
int sum=0;
for(int x:arr){
sum+=(x-1);
}
if(sum%2!=0)print("errorgorn");
else print("maomao90");
}
}
static int max(int a, int b)
{
if(a<b)
return b;
return a;
}
static void ruffleSort(int[] a) {
int n=a.length;
for (int i=0; i<n; i++) {
int oi=random.nextInt(n), temp=a[oi];
a[oi]=a[i]; a[i]=temp;
}
Arrays.sort(a);
}
static < E > void print(E res)
{
System.out.println(res);
}
static int gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
static int lcm(int a, int b)
{
return (a / gcd(a, b)) * b;
}
static int abs(int a)
{
if(a<0)
return -1*a;
return a;
}
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 StringTokenizer(br.readLine());
}
catch (IOException e)
{
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt()
{
return Integer.parseInt(next());
}
long nextLong()
{
return Long.parseLong(next());
}
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try
{
str = br.readLine();
}
catch (IOException e)
{
e.printStackTrace();
}
return str;
}
int [] readintarray(int n) {
int res [] = new int [n];
for(int i = 0; i<n; i++)res[i] = nextInt();
return res;
}
long [] readlongarray(int n) {
long res [] = new long [n];
for(int i = 0; i<n; i++)res[i] = nextLong();
return res;
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 93129a98c07dfb6509dfec6dcd794b3e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
/**
*
* @author eslam
*/
public class IceCave {
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
static FastReader input = new FastReader();
static BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
int t = input.nextInt();
loop:
while (t-- > 0) {
int n = input.nextInt();
String ans = "maomao90";
int numof2 = 0;
for (int i = 0; i < n; i++) {
int x = input.nextInt();
while (x > 2) {
numof2 += 1;
x -=2;
if (ans.equals("maomao90")) {
ans = "errorgorn";
} else {
ans = "maomao90";
}
}
if (x == 2) {
numof2++;
}
}
if (numof2 % 2 == 1) {
if (ans.equals("maomao90")) {
ans = "errorgorn";
} else {
ans = "maomao90";
}
} else {
}
log.write(ans + "\n");
}
log.flush();
}
static long mod(long a, long b) {
long r = a % b;
return r < 0 ? r + b : r;
}
public static long binaryToDecimal(String w) {
long r = 0;
long l = 0;
for (int i = w.length() - 1; i > -1; i--) {
long x = (w.charAt(i) - '0') * (long) Math.pow(2, l);
r = r + x;
l++;
}
return r;
}
public static String decimalToBinary(long n) {
String w = "";
while (n > 0) {
w = n % 2 + w;
n /= 2;
}
return w;
}
public static boolean isSorted(int[] a) {
for (int i = 0; i < a.length - 1; i++) {
if (a[i] > a[i + 1]) {
return false;
}
}
return true;
}
public static void print(int a[]) throws IOException {
for (int i = 0; i < a.length; i++) {
log.write(a[i] + " ");
}
log.write("\n");
}
public static void read(int[] a) {
for (int i = 1; i < a.length; i++) {
a[i] = input.nextInt();
}
}
static class pair {
int x;
int y;
public pair(int x, int y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return x + " " + y;
}
}
public static long LCM(long x, long y) {
return (x * y) / GCD(x, y);
}
public static long GCD(long x, long y) {
if (y == 0) {
return x;
}
return GCD(y, x % y);
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 85db6229704ec872a0a795251d4a5f91 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.math.BigInteger;
import java.util.*;
import static java.lang.System.out;
import static java.lang.System.setProperty;
public class Round_780_Div_3 {
static Scanner str = new Scanner(System.in);
static ArrayList<Integer> list;
final int mod = 1000000007;
public static void main(String[] args) {
long T = str.nextLong();
while (T-- > 0) {
solve();
}
}
static void solve() {
int n = str.nextInt();
int a[] = new int[n];
long sum = 0;
for (int i = 0; i < n; i++) {
a[i] = str.nextInt();
sum += a[i]-1;
}
out.println(sum % 2 == 1 ? "errorgorn" : "maomao90");
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 65a4b5dfda1986c91af7d9856ed9d915 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class A_Log_Chopping{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int t= sc.nextInt();
while(t-- > 0){
int n = sc.nextInt();
int a, c=0;
for(int i=0; i<n;i++){
a= sc.nextInt();
c= c+(a-1);
}
if(c%2!=0){
System.out.println("errorgorn");
}
else{
System.out.println("maomao90");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 74eab72ac8afbe635b9626fa97667cef | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.lang.*;
import java.math.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
for(int i = 0; i < n; i++)
{
int loop = scan.nextInt();
int count = 0;
for(int idx = 0; idx< loop; idx++)
count += scan.nextInt() - 1;
if(count % 2 == 0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 40b8c0330f126a2b6dd9d9d56b9b1daf | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
public class Q1672A {
static int mod = (int) (1e9 + 7);
static void solve() {
int n=i();
long ans=0;
for(int i=0;i<n;i++){
long val=l();
ans+=val-1;
}
//System.out.println(ans);
if(ans%2==0){
System.out.println("maomao90");
return;
}
System.out.println("errorgorn");
}
public static void main(String[] args) {
int test = i();
while (test-- > 0) {
solve();
}
}
// ----->segmentTree--> segTree as class
// ----->lazy_Seg_tree --> lazy_Seg_tree as class
// -----> Trie --->Trie as class
// ----->fenwick_Tree ---> fenwick_Tree
// -----> POWER ---> long power(long x, long y) <----
// -----> LCM ---> long lcm(long x, long y) <----
// -----> GCD ---> long gcd(long x, long y) <----
// -----> SIEVE --> ArrayList<Integer> sieve(int N) <-----
// -----> NCR ---> long ncr(int n, int r) <----
// -----> BINARY_SEARCH ---> int binary_Search(long[]arr,long x) <----
// -----> (SORTING OF LONG, CHAR,INT) -->long[] sortLong(long[] a2)<--
// ----> DFS ---> void dfs(ArrayList<ArrayList<Integer>>edges,int child,int parent)<---
// ---> NODETOROOT --> ArrayList<Integer> node2Root(ArrayList<ArrayList<Integer>>edges,int child,int parent,int tofind) <--
// ---> LEVELS_TREE -->levels_Trees(ArrayList<HashSet<Integer>> edges, int child, int parent,int[]level,int currLevel) <--
// ---> K_THPARENT --> int k_thparent(int node,int[][]parent,int k) <---
// ---> TWOPOWERITHPARENTFILL --> void twoPowerIthParentFill(int[][]parent) <---
// -----> (INPUT OF INT,LONG ,STRING) -> int i() long l() String s()<-
// tempstart
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1)
throw new InputMismatchException();
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0)
return -1;
}
return buf[curChar++];
}
public int Int() {
int c = read();
while (isSpaceChar(c))
c = read();
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9')
throw new InputMismatchException();
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String String() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null)
return filter.isSpaceChar(c);
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return String();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static InputReader in = new InputReader(System.in);
public static int i() {
return in.Int();
}
public static long l() {
String s = in.String();
return Long.parseLong(s);
}
public static String s() {
return in.String();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | fb29efc6a3924853dd2b990eb5360cce | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.*;
public class ChoppingLogs {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i = 0; i < n; i++) {
int logs = in.nextInt();
int moves = 0;
for (int j = 0; j < logs; j++) {
int input = in.nextInt();
moves += input - 1;
}
if (moves % 2 == 0) {
System.out.println("maomao90");
} else {
System.out.println("errorgorn");
}
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 91208f1cd64017138108c30dc4511459 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class LogChopping {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(br.readLine());
while (t-- > 0) {
int n = Integer.parseInt(br.readLine());
String s = br.readLine();
StringTokenizer st = new StringTokenizer(s);
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = Integer.parseInt(st.nextToken());
}
String winner = "maomao90";
int newEntries = 1;
while (true) {
Boolean lost = true;
for (int i = 0; i < arr.length; i++) {
if (arr[i] % 2 == 0) {
int[] arrTmp = new int[n + newEntries];
arrTmp[i] = arr[i] / 2;
arrTmp[n + newEntries - 1] = arr[i] / 2;
for (int j = 0; j < arr.length; j++) {
if (i != j)
arrTmp[j] = arr[j];
}
arr = arrTmp;
lost = false;
newEntries++;
break;
}
}
if (lost) {
out.println(winner);
break;
}
if (winner == "maomao90")
winner = "errorgorn";
else
winner = "maomao90";
}
}
out.flush();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 2cfbec529ee09def56a2f086fd0b24d6 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class LogChopping {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(System.out);
int t = Integer.parseInt(br.readLine());
while (t-- > 0) {
int n = Integer.parseInt(br.readLine());
String s = br.readLine();
StringTokenizer st = new StringTokenizer(s);
int[] arr = new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i] = Integer.parseInt(st.nextToken());
}
String winner = "maomao90";
int newEntries = 1;
while (true) {
Boolean lost = true;
for (int i = 0; i < arr.length; i++) {
if (arr[i] % 2 == 0) {
int[] arrTmp = new int[n + newEntries];
arrTmp[i] = arr[i] / 2;
arrTmp[n + newEntries - 1] = arr[i] / 2;
for (int j = 0; j < arr.length; j++) {
if (i != j)
arrTmp[j] = arr[j];
}
arr = arrTmp;
/*
* for (int j = 0; j < arr.length; j++) { System.out.print(arr[j] + " "); }
* System.out.println(); System.out.println("------------------");
*/
lost = false;
newEntries++;
break;
}
}
if (lost) {
out.println(winner);
break;
}
if (winner == "maomao90")
winner = "errorgorn";
else
winner = "maomao90";
}
}
out.flush();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | cd6194286a20072d7a3f572238ee1d2e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=0;i<n;i++){
int m = sc.nextInt();
int count = 0;
for(int j=0;j<m;j++){
count+=sc.nextInt()-1;
}
if(count%2==0)
System.out.println("maomao90");
else if(1==1)
System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5451224ae2e6e4ec87d17438d7fba933 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=0;i<n;i++){
int m = sc.nextInt();
int count = 0;
for(int j=0;j<m;j++){
count+=sc.nextInt()-1;
}
if(count%2==0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 0b8e3a86d87d710eea7fbf5c35d940c8 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class A_Log_Chopping{
public static void main(String[] args){
Scanner sc = new Scanner(System.in) ;
int t = sc.nextInt();
while(t-- >0){
int c=0;
int n =sc.nextInt();
for(int i=0; i<n; i++){
int l = sc.nextInt();
c = c + (l-1);
}
if (c%2!=0){System.out.println("errorgorn"); }
else{System.out.println("maomao90");}
}
sc.close();
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e5249e8a932b5306fa003f291319fc64 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
// when can't think of anything -->>
// 1. In sorting questions try to think about all possibilities like starting from start, end, middle.
// 2. Two pointers, brute force.
// 3. In graph query questions try to solve it reversely or try to process all the queries in a single parse.
// 4. If order does not matter then just sort the data if constraints allow. It'll never harm.
// 5. In greedy problems if you are just overwhelmed by the possibilities and stuck, try to code whatever you come up with.
// 6. Try to solve it from back or reversely.
// 7. When can't prove something take help of contradiction/pigeon hole principle.
public static void main(String[] args) throws Exception {
FastReader sc = new FastReader();
PrintWriter writer = new PrintWriter(System.out);
int t = sc.nextInt();
while(t-->0) {
int n = sc.nextInt();
int count = 0;
for(int i = 0; i < n; i++) {
int y = sc.nextInt();
count+=y;
}
count-=n;
if(count == 0)writer.println("maomao90");
else if(count%2==1)writer.println("errorgorn");
else writer.println("maomao90");
}
writer.flush();
writer.close();
}
private static boolean palindrome(String ss) {
int i = 0;
int j = ss.length() - 1;
while(i<j) {
if(ss.charAt(i) == ss.charAt(j)) {
i++; j--;
}else return false;
}
return true;
}
private static long power (long a, long n, long p) {
long res = 1;
while(n!=0) {
if(n%2==1) {
res=(res*a)%p;
n--;
}else {
a= (a*a)%p;
n/=2;
}
}
return res;
}
private static boolean isPrime(int c) {
for (int i = 2; i*i <= c; i++) {
if(c%i==0)return false;
}
return true;
}
private static int find(int a , int arr[]) {
if(arr[a] != a) return arr[a] = find(arr[a], arr);
return arr[a];
}
private static void union(int a, int b, int arr[]) {
int aa = find(a,arr);
int bb = find(b, arr);
arr[aa] = bb;
}
private static int gcd(int a, int b) {
if(a==0)return b;
return gcd(b%a, a);
}
public static int[] readIntArray(int size, FastReader s) {
int[] array = new int[size];
for (int i = 0; i < size; i++) {
array[i] = s.nextInt();
}
return array;
}
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 StringTokenizer(br.readLine());
}
catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() { return Integer.parseInt(next()); }
long nextLong() { return Long.parseLong(next()); }
double nextDouble()
{
return Double.parseDouble(next());
}
String nextLine()
{
String str = "";
try {
str = br.readLine();
}
catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
}
class Pair implements Comparable<Pair>{
int a;
int b;
Pair(int a, int b){
this.a = a;
this.b = b;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null || obj.getClass()!= this.getClass()) return false;
Pair pair = (Pair) obj;
return (pair.a == this.a && pair.b == this.b);
}
@Override
public int hashCode()
{
return Objects.hash(a,b);
}
@Override
public int compareTo(Pair o) {
if(this.a == o.a) {
return Integer.compare(this.b, o.b);
}else {
return Integer.compare(this.a, o.a);
}
}
@Override
public String toString() {
return this.a + " " + this.b;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 4d8b5bbd99373e044301a9c2f4876760 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Codeforces {
static Scanner scan = new Scanner(System.in);
static boolean[] was = new boolean[100000000];
public static void main(String... args) {
int t = scan.nextInt();
while ( t-- > 0 ) {
solve();
}
}
public static void solve() {
boolean ok = true; long count = 0; boolean no = false;
int n = scan.nextInt();
long summ = 0;
for ( int i = 0; i < n; ++i ) {
int input = scan.nextInt();
summ += input - 1;
}
System.out.println(summ % 2 == 0 ? "maomao90" : "errorgorn");
}
public static void sort( int[] array ) {
Arrays.sort(array);
}
public static void swap( int[] array, int x, int y ) {
int temp = array[x];
array[x] = array[y];
array[y] = temp;
}
public static int maxOfArray( int[] array, int idx, int max ) {
// max = Integer.MIN_VALUE;
if ( idx == array.length ) {
return max;
}
if ( array[idx] > max ) {
max = array[idx];
}
return maxOfArray( array, idx + 1, max );
}
public static void insertion_sort( int[] array ) {
for ( int l = 1; l < array.length; ++l ) {
int value = array[l];
while ( array[l - 1] > value && l > 0 ) {
swap( array, l - 1, l );
l--;
}
}
}
public static int minOfArray( int[] array, int idx, int min ) {
// min = Integer.MAX_VALUE
if ( idx == array.length ) {
return min;
}
if ( min > array[idx] ) {
min = array[idx];
}
return minOfArray( array, idx + 1, min );
}
public static int findMaxOfSubArray(int[] arr, int k) {
int max = Integer.MIN_VALUE;
int currentSum = 0;
// sliding window
for ( int i = 0; i < arr.length; ++i ) {
currentSum += arr[i];
if ( i >= k - 1 ) {
max = Math.max(max, currentSum);
currentSum -= arr[i - (k - 1)];
}
}
return max;
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 89d338cf0c0ac69550f892d7c5361a2b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class InfiniteReplacement {
public static boolean isWinner(int[] logs) {
int sum = 0;
for(int i=0;i<logs.length;i++)
sum += logs[i];
sum -= logs.length;
return sum%2 == 1;
}
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
try {
int t = s.nextInt();
for(int i=0;i<t;i++) {
int n = s.nextInt();
int[] logs = new int[n];
for(int j=0;j<n;j++)
logs[j] = s.nextInt();
System.out.println(isWinner(logs)?"errorgorn":"maomao90");
}
} catch(Exception e) {
System.out.println("Exception: " + e);
e.printStackTrace();
} finally {
s.close();
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 6c784d461221e2e7f7f2a524694b3fc4 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class P1672A_LogChopping {
public static void main(String[] args){
//System.out.println("top");
Scanner in = new Scanner(System.in);
int numTests = Integer.parseInt(in.nextLine());
//System.out.println("numTests = " + numTests);
for(int test = 0; test < numTests; ++test){
int numLogs = Integer.parseInt(in.nextLine());
long mc = 0;
String[] logs = in.nextLine().split(" ");
for (String s : logs){
mc += (Integer.parseInt(s) - 1);
}
System.out.println(((mc % 2) == 1 ? "errorgorn" : "maomao90"));
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 71ceb47bbbff8a3ecb6c69d6b948cdae | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String args[])
{
long t;int n,i,s=0;
Scanner x=new Scanner(System.in);
t=x.nextLong();
while(t>0)
{
t--;
n=x.nextInt();
int[] a=new int[n];
for(i=0;i<n;i++)
{
a[i]=x.nextInt();
s+=a[i];
}
s=s-n;
if(s%2==1)
System.out.println("errorgorn");
else
System.out.println("maomao90");
s=0;
}}}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | e8a949fe4df127ba90533edde793cf54 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.lang.*;
public class Solution{
static long mod=(long)1e9+7;
static int mod1=998244353;
static int[] cost=new int[(int)1005];
static FastScanner sc = new FastScanner();
// static StringBuffer ans=new StringBuffer("");
public static void solve(){
int n=sc.nextInt();
int[] a=sc.readArray(n);
int ct=0;
for (int i:a) {
// if (i==1) {
ct+=i;
// }
}
ct-=n;
if ((ct%2)==0) {
System.out.println("maomao90");
}else{
System.out.println("errorgorn");
}
}
public static boolean isPoss(int no,int[] a){
a[0]=no;
for (int i=1;i<a.length;i++) {
if (a[i]==a[i-1]+1 ) {
continue;
}
if (a[i]-1==a[i-1]+1) {
a[i]=a[i-1]+2;
continue;
}
return false;
}
return true;
}
public static boolean isPoss(List<Integer> lst,long s){
long sum=0l;
for (int i:lst) {
sum+=(long)i;
}
return sum<=s;
}
public static long getAns(List<Integer> lst,long n){
String s="";
for (int i:lst) {
s=i+""+s;
}
return Long.parseLong(s)-n;
}
public static void main(String[] args) {
int t = sc.nextInt();
outer: for (int tt = 0; tt < t; tt++) {
solve();
}
// System.out.println(ans);
}
static boolean isSubSequence(String str1, String str2,
int m, int n)
{
int j = 0;
for (int i = 0; i < n && j < m; i++)
if (str1.charAt(j) == str2.charAt(i))
j++;
return (j == m);
}
static boolean isPrime(int n)
{
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (int i = 5; i * i <= n; i = i + 6)
if (n % i == 0 || n % (i + 2) == 0)
return false;
return true;
}
public static int[] LPS(String s){
int[] lps=new int[s.length()];
int i=0,j=1;
while (j<s.length()) {
if(s.charAt(i)==s.charAt(j)){
lps[j]=i+1;
i++;
j++;
continue;
}else{
if (i==0) {
j++;
continue;
}
i=lps[i-1];
while(s.charAt(i)!=s.charAt(j) && i!=0) {
i=lps[i-1];
}
if(s.charAt(i)==s.charAt(j)){
lps[j]=i+1;
i++;
}
j++;
}
}
return lps;
}
static long getPairsCount(int n, double sum,int[] arr)
{
HashMap<Double, Integer> hm = new HashMap<>();
for (int i = 0; i < n; i++) {
if (!hm.containsKey((double)arr[i]))
hm.put((double)arr[i], 0);
hm.put((double)arr[i], hm.get((double)arr[i]) + 1);
}
long twice_count = 0;
for (int i = 0; i < n; i++) {
if (hm.get(sum - arr[i]) != null)
twice_count += hm.get(sum - arr[i]);
if (sum - (double)arr[i] == (double)arr[i])
twice_count--;
}
return twice_count / 2l;
}
static boolean[] sieveOfEratosthenes(int n)
{
boolean prime[] = new boolean[n + 1];
for (int i = 0; i <= n; i++)
prime[i] = true;
for (int p = 2; p * p <= n; p++)
{
if (prime[p] == true)
{
for (int i = p * p; i <= n; i += p)
prime[i] = false;
}
}
prime[1]=false;
return prime;
}
static long power(long x, long y, long p)
{
long res = 1l;
x = x % p;
if (x == 0)
return 0;
while (y > 0)
{
if ((y & 1) != 0)
res = (res * x) % p;
y>>=1;
x = (x * x) % p;
}
return res;
}
public static int log2(int N)
{
int result = (int)(Math.log(N) / Math.log(2));
return result;
}
////////////////////////////////////////////////////////////////////////////////////
////////////////////DO NOT READ AFTER THIS LINE //////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
static long modFact(int n,
int p)
{
if (n >= p)
return 0;
long result = 1l;
for (int i = 2; i <= n; i++)
result = (result * i) % p;
return result;
}
static boolean isPalindrom(char[] arr, int i, int j) {
boolean ok = true;
while (i <= j) {
if (arr[i] != arr[j]) {
ok = false;
break;
}
i++;
j--;
}
return ok;
}
static int max(int a, int b) {
return Math.max(a, b);
}
static int min(int a, int b) {
return Math.min(a, b);
}
static long max(long a, long b) {
return Math.max(a, b);
}
static long min(long a, long b) {
return Math.min(a, b);
}
static int abs(int a) {
return Math.abs(a);
}
static long abs(long a) {
return Math.abs(a);
}
static void swap(long arr[], int i, int j) {
long temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static void swap(int arr[], int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
static int maxArr(int arr[]) {
int maxi = Integer.MIN_VALUE;
for (int x : arr)
maxi = max(maxi, x);
return maxi;
}
static int minArr(int arr[]) {
int mini = Integer.MAX_VALUE;
for (int x : arr)
mini = min(mini, x);
return mini;
}
static long maxArr(long arr[]) {
long maxi = Long.MIN_VALUE;
for (long x : arr)
maxi = max(maxi, x);
return maxi;
}
static long minArr(long arr[]) {
long mini = Long.MAX_VALUE;
for (long x : arr)
mini = min(mini, x);
return mini;
}
static int lcm(int a,int b){
return (int)(((long)a*b)/(long)gcd(a,b));
}
static int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
static long gcd(long a, long b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
static void ruffleSort(int[] a) {
int n = a.length;
Random r = new Random();
for (int i = 0; i < a.length; i++) {
int oi = r.nextInt(n);
int temp = a[i];
a[i] = a[oi];
a[oi] = temp;
}
Arrays.sort(a);
}
public static int binarySearch(int a[], int target) {
int left = 0;
int right = a.length - 1;
int mid = (left + right) / 2;
int i = 0;
while (left <= right) {
if (a[mid] <= target) {
i = mid + 1;
left = mid + 1;
} else {
right = mid - 1;
}
mid = (left + right) / 2;
}
return i-1;
}
static 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) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a = new int[n];
for (int i = 0; i < n; i++)
a[i] = nextInt();
return a;
}
long[] readLongArray(int n) {
long[] a = new long[n];
for (int i = 0; i < n; i++)
a[i] = nextLong();
return a;
}
int[][] read2dArray(int n, int m) {
int arr[][] = new int[n][m];
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = nextInt();
}
}
return arr;
}
ArrayList<Integer> readArrayList(int n) {
ArrayList<Integer> arr = new ArrayList<Integer>();
for (int i = 0; i < n; i++) {
int a = nextInt();
arr.add(a);
}
return arr;
}
long nextLong() {
return Long.parseLong(next());
}
}
static class Pair {
int val;
long coins;
Pair(int val,long coins) {
this.val=val;
this.coins=coins;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 53b8033c3b4f188d93b8713466141a2d | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.io.*;
import java.util.*;
public class Script {
static boolean flag = false;
// Driver code
public static void main(String[] args) throws Exception
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int t = Integer.parseInt(st.nextToken());
PrintWriter pw = new PrintWriter(System.out);
while(t-->0) {
int l = 0;
st = new StringTokenizer(br.readLine());
int k = Integer.parseInt(st.nextToken());
PriorityQueue <Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
st = new StringTokenizer(br.readLine());
while(k-->0) {
pq.add(Integer.parseInt(st.nextToken()));
}
while(pq.peek() > 1 ) {
int z = pq.poll();
if(z % 2 == 0) {
pq.add(z/ 2);
pq.add(z/2);
} else {
pq.add(z/2);
pq.add((z/2) +1 );
}
l++;
}
if(l %2 == 0)
pw.println("maomao90");
else
pw.println("errorgorn");
}
pw.close();
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 4fc51b10dc7d129f29c168caa8a7d40e | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
long T = Integer.parseInt(reader.readLine().split("\\s")[0]);
for (int t = 0; t < T; t++) {
int n = Integer.parseInt(reader.readLine().split("\\s")[0]);
String[] line = reader.readLine().split("\\s");
int[] logLengths = new int[n];
for (int i = 0; i < n; i++) {
logLengths[i] = Integer.parseInt(line[i]);
}
String answer = solve(n, logLengths);
System.out.println(answer);
}
reader.close();
}
public static String solve(int n, int[] logLengths) {
long sum = 0;
for (int i = 0; i < n; i++) {
sum += logLengths[i];
}
sum -= n;
if (sum % 2 == 0) {
return "maomao90";
}
return "errorgorn";
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | abe2a95d3780cf04619703266f2afce4 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class LogChopping{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int j=0;j<t;j++){
int n = sc.nextInt();
int sum = 0;
for(int i=0;i<n;i++){
sum+=sc.nextInt()-1;
}
if(sum%2==0) System.out.println("maomao90");
else System.out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 5df734df7b393a7e18ade924ca9e5a0a | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt(), ans = 0, arr[] = new int[n];
for(int i=0;i<n;i++) arr[i] = sc.nextInt();
for(int x : arr) if(x % 2 == 0) ans++;
System.out.println(ans % 2 == 0 ? "maomao90" : "errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 72bc7c283b3e2a1698dab7e30c64f80b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A_Log_Chopping{
static void solve(int n, int[] arr) {
int sum=0;
for (int i : arr) {
sum+=i-1;
}
if(sum%2==0)
{
System.out.println("maomao90");
}
else{
System.out.println("errorgorn");
}
}
public static void main(String[] args) {
try {
FastReader s = new FastReader();
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
solve(n, arr);
}
} catch (Exception e) {
return;
}
}
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | fd413a31ee2ee82efde35efbcb889e5d | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class A_Log_Chopping{
static void solve(int n, int[] arr) {
int sum=0;
for (int i : arr) {
sum+=i-1;
}
if(sum%2==0)
{
System.out.println("maomao90");
}
else{
System.out.println("errorgorn");
}
}
public static void main(String[] args) {
try {
FastReader s = new FastReader();
int t = s.nextInt();
while (t-- > 0) {
int n = s.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = s.nextInt();
}
solve(n, arr);
}
} catch (Exception e) {
return;
}
}
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 StringTokenizer(br.readLine());
} catch (IOException e) {
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
double nextDouble() {
return Double.parseDouble(next());
}
String nextLine() {
String str = "";
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 1a3ec5a23133a1197a0f6d78a7ac7918 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class schnipschnap {
static 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) {
e.printStackTrace();
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
int[] readArray(int n) {
int[] a=new int[n];
for (int i=0; i<n; i++) a[i]=nextInt();
return a;
}
long nextLong() {
return Long.parseLong(next());
}
}
public static String wergewinnt(int n, int[] a){
int summe = 0;
for (int i = 0; i<a.length; i++){
summe += a[i];
}
summe-=n;
if (summe%2==0){return "maomao90";}
else return "errorgorn";
}
public static void main(String[] args) {
FastScanner scanner = new FastScanner();
int t = scanner.nextInt();
for (int i = 0; i < t; i++){
int n = scanner.nextInt();
int a[] = scanner.readArray(n);
System.out.println(wergewinnt(n,a));
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | ce9d8194405a73a63581b1c868380bcf | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int t = s.nextInt();
for(int c = 0; c < t; c++){
int len = s.nextInt();
int k=0;
for (int i = 0; i < len; i++) {
k += s.nextInt() - 1;
}
if(k % 2 == 0)
System.out.println("maomao90");
else
System.out.println("errorgorn");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | eebd2630473d68c416aeecb621a9e356 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int test = sc.nextInt();
String ans = "";
while(test-->0){
int n = sc.nextInt();
int[] A = new int[n];
for(int i=0; i<n; i++)
A[i] = sc.nextInt();
int sum = 0;
for(int i=0; i<n; i++)
sum += A[i];
sum -= n;
if(sum%2==0)
ans = "maomao90";
else
ans = "errorgorn";
System.out.println(ans);
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 187e0671723649bc5985ddec46e0234b | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Main
{
InputStream is;
PrintWriter out = new PrintWriter(System.out); ;
String INPUT = "";
void run() throws Exception
{
is = System.in;
solve();
out.flush();
out.close();
}
public static void main(String[] args) throws Exception { new Main().run(); }
public byte[] inbuf = new byte[1024];
public int lenbuf = 0, ptrbuf = 0;
public int readByte()
{
if(lenbuf == -1)throw new InputMismatchException();
if(ptrbuf >= lenbuf){ ptrbuf = 0;
try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
if(lenbuf <= 0)return -1; } return inbuf[ptrbuf++]; }
public boolean isSpaceChar(int c)
{
return !(c >= 33 && c <= 126);
}
public int skip()
{
// continue; String; charAt; println(); ArrayList; Integer; Long;
// long; Queue; Deque; LinkedList; Pair; double; binarySearch;
// s.toCharArray; length(); length; getOrDefault; break;
// Map.Entry<Integer, Integer> e; HashMap; TreeMap;
int b;
while((b = readByte()) != -1 && isSpaceChar(b));
return b;
}
public double nd()
{
return Double.parseDouble(ns());
}
public char nc()
{
return (char)skip();
}
private String ns()
{
int b = skip();
StringBuilder sb = new StringBuilder();
while(!(isSpaceChar(b)))
{
sb.appendCodePoint(b); b = readByte();
}
return sb.toString();
}
private int ni()
{
return (int)nl();
}
private long nl()
{
long num = 0;
int b;
boolean minus = false;
while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
if(b == '-')
{
minus = true; b = readByte();
}
while(true)
{
if(b >= '0' && b <= '9')
{
num = num * 10 + (b - '0');
}
else { return minus ? -num : num; } b = readByte();
}
}
class Pair
{
int first;
int second;
Pair(int a, int b)
{
first = a;
second = b;
}
}
// KMP ALGORITHM
void KMPSearch(String pat, String txt) {
int M = pat.length(); int N = txt.length();
int lps[] = new int[M]; int j = 0;
computeLPSArray(pat, M, lps); int i = 0;
while (i < N) {
if (pat.charAt(j) == txt.charAt(i)) {
j++;
i++;
}
if (j == M) {
j = lps[j - 1];
}
else if (i < N && pat.charAt(j) != txt.charAt(i)) {
if (j != 0) j = lps[j - 1];
else i = i + 1;
}
}
}
void computeLPSArray(String pat, int M, int lps[]) {
int len = 0; int i = 1; lps[0] = 0;
while (i < M) {
if (pat.charAt(i) == pat.charAt(len)) {
len++;
lps[i] = len;
i++;
}
else {
if (len != 0) {
len = lps[len - 1];
}
else {
lps[i] = len;
i++;
}
}
}
}
int FirstAndLastOccurrenceOfAnElement(int[] arr, int target, boolean findStartIndex)
{
int ans = -1;
int n = arr.length;
int low = 0; int high = n-1;
while(low <= high)
{
int mid = low + (high - low)/2;
if(arr[mid] > target) high = mid-1;
else if(arr[mid] < target) low = mid+1;
else
{
ans = mid;
if(findStartIndex) high = mid-1;
else low = mid+1;
}
}
return ans;
}
// Print All Subsequence.
static ArrayList<Integer> qwerty = new ArrayList<>();
void printAllSubsequence(int[] arr, int index, int n)
{
if(index >= n) {
for(int i=0; i<qwerty.size(); i++) out.print(qwerty.get(i) + " ");
if(qwerty.size() == 0) out.print(" "); out.println();
return;
}
qwerty.add(arr[index]); printAllSubsequence(arr, index+1, n);
qwerty.remove(qwerty.size()-1); printAllSubsequence(arr, index+1, n);
}
// Print All Subsequence.
// Print All Subsequence. with sum k.
static ArrayList<Integer> qwerty2 = new ArrayList<>();
void printSubsequenceWithSumK(int[] arr, int index, int K, int sum, int n)
{
if(index >= n) {
if(sum == K)
{
for(int i=0; i<qwerty2.size(); i++)
out.print(qwerty2.get(i) + " ");
out.println();
}
return;
}
qwerty2.add(arr[index]);
sum += arr[index];
printSubsequenceWithSumK(arr, index+1, K, sum, n);
sum -= arr[index];
qwerty2.remove(qwerty2.size()-1);
printSubsequenceWithSumK(arr, index+1, K, sum, n);
}
// Print All Subsequence. with sum k.
int[] na(int n)
{
int[] arr = new int[n];
for(int i=0; i<n; i++) arr[i]=ni();
return arr;
}
long[] nal(int n)
{
long[] arr = new long[n];
for(int i=0; i<n; i++) arr[i]=nl();
return arr;
}
void solve()
{
int test_case = ni();
while(test_case-- > 0)
{
int n = ni();
int[] arr = na(n);
int tot = 0;
for(int i=0; i<n; i++) {
tot += arr[i] - 1;
}
if(tot % 2 == 0) out.println("maomao90");
else out.println("errorgorn");
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 326195d4210dc756752ddfc1b1461297 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int size = sc.nextInt();
int[] logs = new int[size];
for (int j = 0; j < size; j++) {
logs[j] = sc.nextInt();
}
solve(logs);
}
}
private static void solve(int[] logs) {
int total = 0;
for(int log:logs){
total +=log;
}
int result = total - logs.length;
System.out.println(result%2==1?"errorgorn":"maomao90");
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 9fcb50249c4c5b370dce0509c0d13cb5 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.util.Arrays;
import java.util.Scanner;
public class ProblemA {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int size = sc.nextInt();
int[] logs = new int[size];
for (int j = 0; j < size; j++) {
logs[j] = sc.nextInt();
}
solve(logs);
}
}
private static void solve(int[] logs) {
boolean isErrorgorn = false;
int[] ref = logs;
while (true) {
ref = play(ref);
if (ref == null) {
System.out.println(isErrorgorn ? "errorgorn" : "maomao90");
return;
}
isErrorgorn = !isErrorgorn;
}
}
private static int[] play(int[] logs) {
for (int j = logs.length - 1; j >= 0; j--) {
if (logs[j] >= 2) {
int old = logs[j];
logs[j] = 1;
int[] newLogs = Arrays.copyOf(logs, logs.length + 1);
newLogs[logs.length] = old - 1;
return newLogs;
}
}
return null;
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 92a422d78e35b8ac863ffa404319c591 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class HelloWorld{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
int n=sc.nextInt();
int count=0;
int[]arr=new int[n];
for(int i=0;i<n;i++){
arr[i]=sc.nextInt();
count+=arr[i];
}
if(n==1 && arr[0]==1){
System.out.println("maomao90");
continue;
}
count=count-n;
if(count%2==0){
System.out.println("maomao90");
}else{
System.out.println("errorgorn");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 7dc16dfc823af689f5c5da24617238db | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main
{
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int t=sc.nextInt();
while(t>0){
t--;
int n=sc.nextInt();
int []arr= new int[n];
for (int i = 0; i < arr.length; i++) {
arr[i]=sc.nextInt();
}
int moves=0;
for(int i=0; i<arr.length; i++){
if(arr[i]==2){
moves++;
}
else if(arr[i]>2){
while(arr[i]!=1){
arr[i]=arr[i]-1;
moves++;
}
}
}
if(moves==0){
System.out.println("maomao90");
}
else if(moves%2==0){
System.out.println("maomao90");
}
else{
System.out.println("errorgorn");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | cca4335cee54f0025f42ee54d86b08d7 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt(br.readLine());
String[] s= br.readLine().split(" ");
int sum=0;
for (String i:s ) {
sum+=Integer.parseInt(i);
}
sum-=n;
if (sum%2!=0)
System.out.println("errorgorn");
else
System.out.println("maomao90");
}
}
}
| Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 2c0c38aabac95a4aece2083042fd9e79 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[]args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t--!=0) {
int n = sc.nextInt();
ArrayList<Integer> a = new ArrayList<Integer>();
for(int i=0; i<n; ++i) {
a.add(sc.nextInt());
}
for(int i=0;;++i) {
Collections.sort(a);
if(a.get(a.size()-1)>1) {
int log = a.remove(a.size()-1);
if(log>2 && log%2!=0) {
a.add(log-1);
a.add(1);
}else {
a.add(log/2);
a.add(log/2);
}
}else {
if(i%2!=0) {
System.out.println("errorgorn");
break;
}else {
System.out.println("maomao90");
break;
}
}
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 1aaa770546c0f3fe9f8b8c9cbe8f8037 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
public class PC {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
for (int z = 0; z < t; z++) {
int n = sc.nextInt();
int sum = 0; char w = ' ';
for (int i = 0; i < n; i++) {
int temp = sc.nextInt();
if(temp > 1){
if(sum == 0){
if(temp %2 == 0) w='e';
else w='m';
sum++;
}
else{
if(temp%2 == 0){
if(w=='m') w='e';
else if(w=='e') w='m';
}
}
}
}
if(sum == 0) System.out.println("maomao90");
else if(w == 'e') System.out.println("errorgorn");
else System.out.println("maomao90");
}
}
}
/*abstract
2 4 7 8 123
2 4 5 8 123
3 6 10 12 234
3 6 8 12 234
*/ | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | fe7b43353f55109b6526d92cd830007c | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.*;
import java.lang.*;
import java.io.*;
public class solution
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in) ;
int w = sc.nextInt() ;
while(w>0){
int n = sc.nextInt() ;
int[] arr = new int[n] ;
for(int i = 0 ; i < n ; i++){
arr[i] = sc.nextInt() ;
}
int sum = 0 ;
for(int i = 0 ; i < n ; i++){
sum+= arr[i];
}
sum= sum-n ;
if(sum%2 == 0){
System.out.println("maomao90") ;
}
else{
System.out.println("errorgorn") ;
}
w--;
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 08b92df68502a0e4f2d4d20db278ca35 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class codeforce {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
while (a-->0){
int len = sc.nextInt();
int arr[] = new int[len];
PriorityQueue<Integer> q = new PriorityQueue<>(Collections.reverseOrder());
for(int i=0;i<len;i++){
arr[i] = sc.nextInt();
q.add(arr[i]);
}
// errorgorn and maomao90
int count = 0;
while(q.peek()!=1){
int t = q.remove();
if(t%2==0){
q.add(t/2);
q.add(t/2);
}else{
q.add(t/2);
q.add(t/2 +1);
}
count++;
}
if((count)%2!=0){
System.out.println("errorgorn");
}else{
System.out.println("maomao90");
}
}
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output | |
PASSED | 848af5c584d1ab998ff1329456a5d044 | train_108.jsonl | 1650722700 | There are $$$n$$$ logs, the $$$i$$$-th log has a length of $$$a_i$$$ meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into $$$2$$$ pieces. If the length of the chosen log is $$$x$$$, and the lengths of the resulting pieces are $$$y$$$ and $$$z$$$, then $$$y$$$ and $$$z$$$ have to be positive integers, and $$$x=y+z$$$ must hold. For example, you can chop a log of length $$$3$$$ into logs of lengths $$$2$$$ and $$$1$$$, but not into logs of lengths $$$3$$$ and $$$0$$$, $$$2$$$ and $$$2$$$, or $$$1.5$$$ and $$$1.5$$$.The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner? | 256 megabytes | import java.util.Scanner;
public class Log_Chopping
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int n = sc.nextInt();
int a[] = new int[n];
int steps = 0;
for(int i = 0 ; i < n ; i++)
{
a[i] = sc.nextInt();
steps += a[i]-1;
}
if(steps == 0 || (steps&1) == 0)
{
System.out.println("maomao90");
}
else
{
System.out.println("errorgorn");
}
}
sc.close();
}
} | Java | ["2\n\n4\n\n2 4 2 1\n\n1\n\n1"] | 1 second | ["errorgorn\nmaomao90"] | NoteIn the first test case, errorgorn will be the winner. An optimal move is to chop the log of length $$$4$$$ into $$$2$$$ logs of length $$$2$$$. After this there will only be $$$4$$$ logs of length $$$2$$$ and $$$1$$$ log of length $$$1$$$.After this, the only move any player can do is to chop any log of length $$$2$$$ into $$$2$$$ logs of length $$$1$$$. After $$$4$$$ moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner. | Java 11 | standard input | [
"games",
"implementation",
"math"
] | fc75935b149cf9f4f2ddb9e2ac01d1c2 | Each test contains multiple test cases. The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 100$$$) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 50$$$) — the number of logs. The second line of each test case contains $$$n$$$ integers $$$a_1,a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 50$$$) — the lengths of the logs. Note that there is no bound on the sum of $$$n$$$ over all test cases. | 800 | For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes). | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.