package humaneval.buggy;

import java.util.List;

public class BELOW_ZERO {
    public static boolean below_zero(List<Integer> operations) {
        int balance = 0;
        for (Integer op : operations){
            balance += op;
            if (balance > 0){
                return false;
            }
        }
        return true;
    }
}

package humaneval;

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

public class TEST_BELOW_ZERO {
    @org.junit.Test(timeout = 3000)
    public void test_0() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>()
        );
        org.junit.Assert.assertEquals(result, false);
    }

    @org.junit.Test(timeout = 3000)
    public void test_1() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>(Arrays.asList(1, 2, -3, 1, 2, -3))
        );
        org.junit.Assert.assertEquals(result, false);
    }

    @org.junit.Test(timeout = 3000)
    public void test_2() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>(Arrays.asList(1, 2, -4, 5, 6))
        );
        org.junit.Assert.assertEquals(result, true);
    }

    @org.junit.Test(timeout = 3000)
    public void test_3() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>(Arrays.asList(1, -1, 2, -2, 5, -5, 4, -4))
        );
        org.junit.Assert.assertEquals(result, false);
    }

    @org.junit.Test(timeout = 3000)
    public void test_4() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>(Arrays.asList(1, -1, 2, -2, 5, -5, 4, -5))
        );
        org.junit.Assert.assertEquals(result, true);
    }

    @org.junit.Test(timeout = 3000)
    public void test_5() throws java.lang.Exception {
        boolean result = humaneval.buggy.BELOW_ZERO.below_zero(
            new ArrayList<Integer>(Arrays.asList(1, -2, 2, -2, 5, -5, 4, -4))
        );
        org.junit.Assert.assertEquals(result, true);
    }
}


package humaneval.buggy;

/* Given a positive integer N, return the total sum of its digits in binary.

Example
    For N = 1000, the sum of digits will be 1 the output should be "1".
    For N = 150, the sum of digits will be 6 the output should be "110".
    For N = 147, the sum of digits will be 12 the output should be "1100".

Variables:
    @N integer
            Constraints: 0 ≤ N ≤ 10000.
Output:
        a string of binary number */

public class SOLVE {
    public static String solve(int N) {
        int sum = 0;
        for (int i = 0; i < (N + "").length(); i += 1){
            sum += Integer.parseInt((N + "").substring(i + 1));
        }
        return Integer.toBinaryString(sum);
    }
}

package humaneval;

public class TEST_SOLVE {
    @org.junit.Test(timeout = 3000)
    public void test_0() throws java.lang.Exception {
        String result = humaneval.buggy.SOLVE.solve(1000);
        org.junit.Assert.assertEquals(
            result, "1"
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_1() throws java.lang.Exception {
        String result = humaneval.buggy.SOLVE.solve(150);
        org.junit.Assert.assertEquals(
            result, "110"
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_2() throws java.lang.Exception {
        String result = humaneval.buggy.SOLVE.solve(147);
        org.junit.Assert.assertEquals(
            result, "1100"
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_3() throws java.lang.Exception {
        String result = humaneval.buggy.SOLVE.solve(333);
        org.junit.Assert.assertEquals(
            result, "1001"
        );
    }

    @org.junit.Test(timeout = 3000)
    public void test_4() throws java.lang.Exception {
        String result = humaneval.buggy.SOLVE.solve(963);
        org.junit.Assert.assertEquals(
            result, "10010"
        );
    }
}