Example #1
0
def run_line(match):
    N = int(match.group(1))
    x = get_ints(match.group(2))
    t = get_ints(match.group(3))
    expected = int(match.group(4))
    actual = max_height(N, x, t)
    assert_equals(actual, expected)
Example #2
0
def run_line(match):
    red = get_ints(match.group(1))
    green = get_ints(match.group(2))
    blue = get_ints(match.group(3))
    expected = int(match.group(4))
    actual = min_operations(red, green, blue)
    assert_equals(actual, expected)
Example #3
0
def run_line(match):
    a = get_ints(match.group(3))
    last_seen = get_ints(match.group(4))
    t = get_ints(match.group(5))
    expected = get_strings(match.group(6))
    actual = solve(a, last_seen, t)
    assert_equals(actual, expected)
Example #4
0
def run_line(match):
    n = int(match.group(1))
    a = get_ints(match.group(2))
    b = get_ints(match.group(3))
    expected = int(match.group(4))
    actual = solve(n, a, b)
    assert_equals(actual, expected)
Example #5
0
def run_line(match):
    global x
    global y
    x = get_ints(match.group(1))
    y = get_ints(match.group(2))
    expected = float(match.group(3))
    actual = largest(x, y)
    assert_equals(actual, expected)
Example #6
0
def run_line(match):
    t = int(match.group(1))
    a = get_ints(match.group(2))
    b = get_ints(match.group(3))
    direct_cost = get_strings(match.group(4))
    expected = int(match.group(5))
    actual = minimize_cost(t, a, b, direct_cost)
    assert_equals(actual, expected)
Example #7
0
def run_line(match):
    n = int(match.group(1))
    b = int(match.group(2))
    up_to = get_ints(match.group(3))
    quantity = get_ints(match.group(4))
    expected = match.group(5)
    actual = is_fair(n, b, up_to, quantity)
    assert_equals(actual, expected)
Example #8
0
def run_line(match):
    xl = get_ints(match.group(1))
    yl = get_ints(match.group(2))
    xh = get_ints(match.group(3))
    yh = get_ints(match.group(4))
    k = int(match.group(5))
    expected = int(match.group(6))
    actual = max_intersection(xl, yl, xh, yh, k)
    assert_equals(actual, expected)
Example #9
0
def run_line(match):
    reels = get_ints(match.group(1))
    expected = get_ints(match.group(2))
    actual = reels_sort(reels)
    print("actual:", actual)
    if len(expected) == 1 and expected[0] == -1:
        assert_equals(actual, expected)
    if len(actual) == 1 and actual[0] == -1:
        assert_equals(actual, expected)
Example #10
0
def run_line(match):
    N = int(match.group(1))
    SX = int(match.group(2))
    SY = int(match.group(3))
    Xprefix = get_ints(match.group(4))
    Yprefix = get_ints(match.group(5))
    expected = int(match.group(6))
    actual = count_locations(N, SX, SY, Xprefix, Yprefix)
    assert_equals(actual, expected)
Example #11
0
def run_line(match):
    need_mean = int(match.group(1))
    need_median = int(match.group(2))
    d = get_ints(match.group(3))
    expected = int(match.group(4))
    actual = min_effort(need_mean, need_median, d)
    assert_equals(actual, expected)
Example #12
0
def run_line(match):
    C = int(match.group(1))
    F = int(match.group(2))
    sock_count = get_ints(match.group(3))
    expected = int(match.group(4))
    actual = fewest_socks(C, F, sock_count)
    assert_equals(actual, expected)
Example #13
0
def run_line(match):
    water_width = int(match.group(1))
    land_width = int(match.group(2))
    block_height = get_ints(match.group(3))
    depth = int(match.group(4))
    expected = match.group(5)
    actual = is_it_even_possible(water_width, land_width, block_height, depth)
    assert_equals(actual, expected)
Example #14
0
def run_line(match):
    f = int(match.group(1))
    m = int(match.group(2))
    data = get_ints(match.group(3))
    goal = int(match.group(4))
    expected_persons = int(match.group(5))
    expected_changes = int(match.group(6))
    expected = [expected_persons, expected_changes]
    actual = minimize(f, m, data, goal)
    assert_equals(actual, expected)
Example #15
0
def run_line(match):
    sums = get_ints(match.group(1))
    expected = get_ints(match.group(2))
    actual = get_primes(sums)
    assert_equals(len(actual), len(expected))
Example #16
0
def run_line(match):
    n = int(match.group(1))
    index = int(match.group(2))
    expected = get_ints(match.group(3))
    actual = find_cell(n, index)
    assert_equals(actual, expected)
Example #17
0
def run_line(match):
    candy = get_ints(match.group(1))
    bag_size = int(match.group(2))
    expected = int(match.group(3))
    actual = make_bags(candy, bag_size)
    assert_equals(actual, expected)
Example #18
0
def run_line(match):
    prices = get_ints(match.group(1))
    expected = float(match.group(2))
    actual = non_duplicated_average(prices)
    assert_equals(actual, expected)
Example #19
0
def run_line(match):
    height = get_ints(match.group(1))
    expected = int(match.group(2))
    actual = get_max(height)
    assert_equals(actual, expected)
Example #20
0
def run_line(match):
    gates = get_ints(match.group(1))
    expected = match.group(2)
    actual = minimize(gates)
    assert_equals(count(actual), count(expected))
Example #21
0
def run_line(match):
    clipboard = get_strings(match.group(1))
    t = int(match.group(2))
    expected = get_ints(match.group(3))
    actual = count_colors(clipboard, t)
    assert_equals(actual, expected)
Example #22
0
def run_line(match):
    a = get_ints(match.group(1))
    b = get_ints(match.group(2))
    expected = int(match.group(3))
    actual = minimal_planets(a, b)
    assert_equals(actual, expected)
Example #23
0
def run_line(match):
    a = get_ints(match.group(1))
    k = int(match.group(2))
    expected = int(match.group(3))
    actual = count_ways(a, k)
    assert_equals(actual, expected)
Example #24
0
def run_line(match):
    leaves = get_ints(match.group(1))
    expected = get_ints(match.group(3))
    actual = swap_nodes(leaves)
    assert_equals(actual, expected)
Example #25
0
def run_line(match):
    digits = get_ints(match.group(1))
    expected = match.group(2)
    actual = construct(digits)
    assert_equals(actual, expected)
Example #26
0
File: jumps.py Project: alonana/top
def run_line(match):
    positions = get_ints(match.group(1))
    expected = match.group(2)
    actual = is_valid_list(positions)
    assert_equals(actual, expected)
Example #27
0
def run_line(match):
    target = get_ints(match.group(1))
    actual = sort_shelf(target)
    print(actual)
Example #28
0
def run_line(match):
    scores = get_ints(match.group(1))
    expected = float(match.group(2))
    actual = overall_score(scores)
    assert_equals(actual, expected)
Example #29
0
def run_line(match):
    lower_bound = get_ints(match.group(1))
    upper_bound = get_ints(match.group(2))
    expected = int(match.group(3))
    actual = count_possibilities(lower_bound, upper_bound)
    assert_equals(actual, expected)
Example #30
0
def run_line(match):
    d = get_ints(match.group(1))
    expected = float(match.group(2))
    actual = expected_deliciousness(d)
    assert_equals(actual, expected)