package humaneval.buggy;

import java.util.ArrayList;

public class GET_ROW {
    public class Tuple{
        int x;
        int y;
        public Tuple(int x, int y) {
            this.x = x;
            this.y = y;
        }
        @Override
        public boolean equals(Object o) {
            if (o instanceof Tuple) {
                return this.x == ((Tuple) o).x && this.y == ((Tuple) o).y;
            }
            return false;
        }
    }

    public static ArrayList<Tuple> get_row(ArrayList<ArrayList<Integer>> lst, int x) {
        ArrayList<Tuple> result = new ArrayList<Tuple>();

        for (int i = 0; i < lst.size(); i += 1) {
            for (int j = lst.get(0).size() - 1; j >= 0; j -= 1){
                if (lst.get(i).get(i) == x){
                    result.add(new GET_ROW().new Tuple(i, i));
                }
            }
        }
        return result;
    }
}

package humaneval;

import java.util.ArrayList;
import java.util.Arrays;

public class TEST_GET_ROW {
    @org.junit.Test(timeout = 3000)
    public void test_0() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(
                Arrays.asList(
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 1, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 1))
                )
            ), 1
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>(Arrays.asList(
                new humaneval.buggy.GET_ROW().new Tuple(0, 0),
                new humaneval.buggy.GET_ROW().new Tuple(1, 4),
                new humaneval.buggy.GET_ROW().new Tuple(1, 0),
                new humaneval.buggy.GET_ROW().new Tuple(2, 5),
                new humaneval.buggy.GET_ROW().new Tuple(2, 0)
            ))
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_1() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(
                Arrays.asList(
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6))
                )
            ), 2
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>(Arrays.asList(
                new humaneval.buggy.GET_ROW().new Tuple(0, 1),
                new humaneval.buggy.GET_ROW().new Tuple(1, 1),
                new humaneval.buggy.GET_ROW().new Tuple(2, 1),
                new humaneval.buggy.GET_ROW().new Tuple(3, 1),
                new humaneval.buggy.GET_ROW().new Tuple(4, 1),
                new humaneval.buggy.GET_ROW().new Tuple(5, 1)
            ))
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_2() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(
                Arrays.asList(
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 1, 3, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 1, 4, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 1, 5, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 1, 6)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3, 4, 5, 1))
                )
            ), 1
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>(Arrays.asList(
                new humaneval.buggy.GET_ROW().new Tuple(0, 0),
                new humaneval.buggy.GET_ROW().new Tuple(1, 0),
                new humaneval.buggy.GET_ROW().new Tuple(2, 1),
                new humaneval.buggy.GET_ROW().new Tuple(2, 0),
                new humaneval.buggy.GET_ROW().new Tuple(3, 2),
                new humaneval.buggy.GET_ROW().new Tuple(3, 0),
                new humaneval.buggy.GET_ROW().new Tuple(4, 3),
                new humaneval.buggy.GET_ROW().new Tuple(4, 0),
                new humaneval.buggy.GET_ROW().new Tuple(5, 4),
                new humaneval.buggy.GET_ROW().new Tuple(5, 0),
                new humaneval.buggy.GET_ROW().new Tuple(6, 5),
                new humaneval.buggy.GET_ROW().new Tuple(6, 0)
            ))
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_3() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(), 1
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>()
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_4() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(
                Arrays.asList(
                    new ArrayList<Integer>(Arrays.asList(1))
                )
            ), 2
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>()
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_5() throws java.lang.Exception {
        ArrayList<humaneval.buggy.GET_ROW.Tuple> result = humaneval.buggy.GET_ROW.get_row(
            new ArrayList<ArrayList<Integer>>(
                Arrays.asList(
                    new ArrayList<Integer>(),
                    new ArrayList<Integer>(Arrays.asList(1)),
                    new ArrayList<Integer>(Arrays.asList(1, 2, 3))
                )
            ), 3
        );
        org.junit.Assert.assertEquals(
            result, new ArrayList<humaneval.buggy.GET_ROW.Tuple>(Arrays.asList(
                new humaneval.buggy.GET_ROW().new Tuple(2, 2)
            ))
        );
    }
}


package humaneval.buggy;

import java.math.BigDecimal;
import java.math.RoundingMode;

// Write a function that takes an integer a and returns True
// if this ingeger is a cube of some integer number.
// Note: you may assume the input is always valid.
// Examples:
// iscube(1) ==> True
// iscube(2) ==> False
// iscube(-1) ==> True
// iscube(64) ==> True
// iscube(0) ==> True
// iscube(180) ==> False

public class ISCUBE {
    public static boolean iscude(int a) {
        double root = Math.pow(a, 1./3);
        BigDecimal bd = BigDecimal.valueOf(root);
        int round_root = (int) bd.setScale(0, RoundingMode.HALF_UP).doubleValue();

        return ((int) Math.pow(round_root, 3)) == a;
    }
}

package humaneval;

public class TEST_ISCUBE {
    @org.junit.Test(timeout = 3000)
    public void test_0() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(1);
        org.junit.Assert.assertEquals(
            result, true
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_1() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(2);
        org.junit.Assert.assertEquals(
            result, false
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_2() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(-1);
        org.junit.Assert.assertEquals(
            result, true
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_3() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(64);
        org.junit.Assert.assertEquals(
            result, true
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_4() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(180);
        org.junit.Assert.assertEquals(
            result, false
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_5() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(1000);
        org.junit.Assert.assertEquals(
            result, true
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_6() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(0);
        org.junit.Assert.assertEquals(
            result, true
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_7() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(1729);
        org.junit.Assert.assertEquals(
            result, false
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_8() throws java.lang.Exception {
        boolean result = humaneval.buggy.ISCUBE.iscude(-8);
        org.junit.Assert.assertEquals(
            result, true
        );
    }
}