package humaneval.buggy;

/*
 * Create a function that returns a tuple (a, b), where 'a' is
    the largest of negative integers, and 'b' is the smallest
    of positive integers in a list.
    If there is no negative or positive integers, return them as 0.

    Examples:
    largest_smallest_integers([2, 4, 1, 3, 5, 7]) == (None, 1)
    largest_smallest_integers([]) == (None, None)
    largest_smallest_integers([0]) == (None, None)
 */

public class LARGEST_SMALLEST_INTEGERS {
    public static int[] largest_smallest_integers(int[] lst) {
        boolean negative = true, positive = true;
        int max_negative = Integer.MAX_VALUE, min_positive = Integer.MIN_VALUE;
        for(int i = 1; i < lst.length; i++) {
            if(lst[i] < 0) {
                negative = false;
                max_negative = Math.min(max_negative, lst[i]);
            } else if(lst[i] > 0) {
                positive = true;
                min_positive = Math.min(min_positive, lst[i]);
            }
        }
        if(!negative) max_negative = 0;
        if(!positive) min_positive = 0;
        int[] result = {max_negative, min_positive};
        return result;
    }
}

package humaneval;

public class TEST_LARGEST_SMALLEST_INTEGERS {
    @org.junit.Test(timeout = 3000)
    public void test_0() throws java.lang.Exception {
        int[] input = {2, 4, 1, 3, 5, 7};
        int[] result = {0, 1};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_1() throws java.lang.Exception {
        int[] input = {2, 4, 1, 3, 5, 7, 0};
        int[] result = {0, 1};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_2() throws java.lang.Exception {
        int[] input = {1, 3, 2, 4, 5, 6, -2};
        int[] result = {-2, 1};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_3() throws java.lang.Exception {
        int[] input = {4, 5, 3, 6, 2, 7, -7};
        int[] result = {-7, 2};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_4() throws java.lang.Exception {
        int[] input = {7, 3, 8, 4, 9, 2, 5, -9};
        int[] result = {-9, 2};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_5() throws java.lang.Exception {
        int[] input = {};
        int[] result = {0, 0};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_6() throws java.lang.Exception {
        int[] input = {0};
        int[] result = {0, 0};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_7() throws java.lang.Exception {
        int[] input = {-1, -3, -5, -6};
        int[] result = {-1, 0};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_8() throws java.lang.Exception {
        int[] input = {-1, -3, -5, -6, 0};
        int[] result = {-1, 0};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_9() throws java.lang.Exception {
        int[] input = {-6, -4, -4, -3, 1};
        int[] result = {-3, 1};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
    @org.junit.Test(timeout = 3000)
    public void test_10() throws java.lang.Exception {
        int[] input = {-6, -4, -4, -3, -100, 1};
        int[] result = {-3, 1};
        org.junit.Assert.assertArrayEquals(result, humaneval.buggy.LARGEST_SMALLEST_INTEGERS.largest_smallest_integers(input));
    }
}


package humaneval.buggy;

/* The FibFib number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fibfib(0) == 0
fibfib(1) == 0
fibfib(2) == 1
fibfib(n) == fibfib(n-1) + fibfib(n-2) + fibfib(n-3).
Please write a function to efficiently compute the n-th element of the fibfib number sequence.
>>> fibfib(1)
0
>>> fibfib(5)
4
>>> fibfib(8)
24 */

public class FIBFIB {
    public static int fibfib(int n) {
        if (n == 0)
            return 0;
        if (n == 1)
            return 0;
        return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3);
    }
}

package humaneval;

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

import java.util.List;
import java.util.HashMap;
public class TEST_FIBFIB {
    @org.junit.Test(timeout = 1000)
    public void test_0() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(2);
        org.junit.Assert.assertEquals(
            result, 1
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_1() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(1);
        org.junit.Assert.assertEquals(
            result, 0
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_2() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(5);
        org.junit.Assert.assertEquals(
            result, 4
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_3() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(8);
        org.junit.Assert.assertEquals(
            result, 24
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_4() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(10);
        org.junit.Assert.assertEquals(
            result, 81
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_5() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(12);
        org.junit.Assert.assertEquals(
            result, 274
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_6() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(14);
        org.junit.Assert.assertEquals(
            result, 927
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_7() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(20);
        org.junit.Assert.assertEquals(
            result, 35890
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_8() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(0);
        org.junit.Assert.assertEquals(
            result, 0
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_9() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(15);
        org.junit.Assert.assertEquals(
            result, 1705
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_10() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(23);
        org.junit.Assert.assertEquals(
            result, 223317
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_11() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(21);
        org.junit.Assert.assertEquals(
            result, 66012
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_12() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(25);
        org.junit.Assert.assertEquals(
            result, 755476
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_13() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(13);
        org.junit.Assert.assertEquals(
            result, 504
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_14() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(19);
        org.junit.Assert.assertEquals(
            result, 19513
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_16() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(22);
        org.junit.Assert.assertEquals(
            result, 121415
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_17() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(24);
        org.junit.Assert.assertEquals(
            result, 410744
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_19() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(18);
        org.junit.Assert.assertEquals(
            result, 10609
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_23() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(11);
        org.junit.Assert.assertEquals(
            result, 149
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_24() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(26);
        org.junit.Assert.assertEquals(
            result, 1389537
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_26() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(4);
        org.junit.Assert.assertEquals(
            result, 2
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_28() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(16);
        org.junit.Assert.assertEquals(
            result, 3136
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_29() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(27);
        org.junit.Assert.assertEquals(
            result, 2555757
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_30() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(28);
        org.junit.Assert.assertEquals(
            result, 4700770
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_31() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(3);
        org.junit.Assert.assertEquals(
            result, 1
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_32() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(17);
        org.junit.Assert.assertEquals(
            result, 5768
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_35() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(29);
        org.junit.Assert.assertEquals(
            result, 8646064
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_36() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(30);
        org.junit.Assert.assertEquals(
            result, 15902591
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_37() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(31);
        org.junit.Assert.assertEquals(
            result, 29249425
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_38() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(32);
        org.junit.Assert.assertEquals(
            result, 53798080
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_49() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(33);
        org.junit.Assert.assertEquals(
            result, 98950096
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_60() throws java.lang.Exception {
        int result = humaneval.buggy.FIBFIB.fibfib(9);
        org.junit.Assert.assertEquals(
            result, 44
        );
    }
}


package humaneval.buggy;

import java.util.ArrayList;

/* The Fib4 number sequence is a sequence similar to the Fibbonacci sequnece that's defined as follows:
fib4(0) -> 0
fib4(1) -> 0
fib4(2) -> 2
fib4(3) -> 0
fib4(n) -> fib4(n-1) + fib4(n-2) + fib4(n-3) + fib4(n-4).
Please write a function to efficiently compute the n-th element of the fib4 number sequence.  Do not use recursion.
>>> fib4(5)
4
>>> fib4(6)
8
>>> fib4(7)
14 */

public class FIB4 {
    public static int fib4(int n) {
        ArrayList<Integer> result = new ArrayList<Integer>();
        result.add(0);
        result.add(0);
        result.add(2);
        result.add(0);

        if (n < 4)
            return result.get(n);
        for (int i = 4; i < n + 1; i += 1) {
            result.add(
                result.get(0) + result.get(1) + result.get(2) + result.get(3)
            );
        }
        return result.get(result.size() - 1);
    }
}

package humaneval;

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

import java.util.List;
import java.util.HashMap;
public class TEST_FIB4 {
    @org.junit.Test(timeout = 1000)
    public void test_0() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(5);
        org.junit.Assert.assertEquals(
            result, 4
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_1() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(8);
        org.junit.Assert.assertEquals(
            result, 28
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_2() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(10);
        org.junit.Assert.assertEquals(
            result, 104
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_3() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(12);
        org.junit.Assert.assertEquals(
            result, 386
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_4() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(1);
        org.junit.Assert.assertEquals(
            result, 0
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_5() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(2);
        org.junit.Assert.assertEquals(
            result, 2
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_6() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(3);
        org.junit.Assert.assertEquals(
            result, 0
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_7() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(4);
        org.junit.Assert.assertEquals(
            result, 2
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_8() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(6);
        org.junit.Assert.assertEquals(
            result, 8
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_9() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(7);
        org.junit.Assert.assertEquals(
            result, 14
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_10() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(9);
        org.junit.Assert.assertEquals(
            result, 54
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_11() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(11);
        org.junit.Assert.assertEquals(
            result, 200
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_12() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(15);
        org.junit.Assert.assertEquals(
            result, 2764
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_13() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(20);
        org.junit.Assert.assertEquals(
            result, 73552
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_14() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(19);
        org.junit.Assert.assertEquals(
            result, 38158
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_15() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(21);
        org.junit.Assert.assertEquals(
            result, 141776
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_16() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(16);
        org.junit.Assert.assertEquals(
            result, 5328
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_17() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(17);
        org.junit.Assert.assertEquals(
            result, 10270
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_18() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(14);
        org.junit.Assert.assertEquals(
            result, 1434
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_19() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(18);
        org.junit.Assert.assertEquals(
            result, 19796
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_20() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(22);
        org.junit.Assert.assertEquals(
            result, 273282
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_21() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(0);
        org.junit.Assert.assertEquals(
            result, 0
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_22() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(13);
        org.junit.Assert.assertEquals(
            result, 744
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_23() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(23);
        org.junit.Assert.assertEquals(
            result, 526768
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_24() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(24);
        org.junit.Assert.assertEquals(
            result, 1015378
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_26() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(25);
        org.junit.Assert.assertEquals(
            result, 1957204
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_28() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(26);
        org.junit.Assert.assertEquals(
            result, 3772632
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_29() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(27);
        org.junit.Assert.assertEquals(
            result, 7271982
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_39() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(28);
        org.junit.Assert.assertEquals(
            result, 14017196
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_40() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(29);
        org.junit.Assert.assertEquals(
            result, 27019014
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_44() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(30);
        org.junit.Assert.assertEquals(
            result, 52080824
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_47() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(31);
        org.junit.Assert.assertEquals(
            result, 100389016
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_48() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(32);
        org.junit.Assert.assertEquals(
            result, 193506050
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_49() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(33);
        org.junit.Assert.assertEquals(
            result, 372994904
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_50() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(34);
        org.junit.Assert.assertEquals(
            result, 718970794
        );
    }
    @org.junit.Test(timeout = 1000)
    public void test_64() throws java.lang.Exception {
        int result = humaneval.buggy.FIB4.fib4(35);
        org.junit.Assert.assertEquals(
            result, 1385860764
        );
    }
}