Exemple #1
0
def main(argv):
    lines = files.read_ints(argv[0])
    T = lines[0]

    for i in range(T):
        N = lines[i + 1]
        print(sieve(count(N)))
def main(argv):
    lines = files.read_ints(argv[0])
    T     = lines[0]

    for i in range(T):
        N = lines[i + 1]
        print(sieve(count(N)))
Exemple #3
0
def main(argv):
    lines = files.read_ints(argv[0])
    T = lines[0]

    for i in range(T):
        n = lines[(3 * i) + 1]
        a = lines[(3 * i) + 2]
        b = lines[(3 * i) + 3]
        print(' '.join(str(val) for val in sorted(last_stones(n, a, b))))
Exemple #4
0
def main(argv):
    lines = files.read_ints(argv[0])
    T     = lines[0]
    F     = fibonacci(10 ** 10)

    for N in lines[1:]:
        if N in F:
            print('IsFibo')
        else:
            print('IsNotFibo')
Exemple #5
0
def main(argv):
    lines = files.read_ints(argv[0])
    T = lines[0]
    F = fibonacci(10**10)

    for N in lines[1:]:
        if N in F:
            print('IsFibo')
        else:
            print('IsNotFibo')
def main(argv):
    lines   = files.read_ints(argv[0])
    p       = lines[0]
    q       = lines[1]

    numbers = kaprekar_numbers(p, q)

    if numbers:
        print(' '.join(str(n) for n in numbers))
    else:
        print('INVALID RANGE')
Exemple #7
0
def main(argv):
    lines   = files.read_ints(argv[0])
    p       = lines[0]
    q       = lines[1]

    numbers = kaprekar_numbers(p, q)

    if numbers:
        print(' '.join(str(n) for n in numbers))
    else:
        print('INVALID RANGE')
def main(argv):
    L, R = files.read_ints(argv[0])

    print(max_xor(L, R))
def main(argv):
    lines = files.read_ints(argv[0])

    for line in lines[1:]:
        print(decent_number(line))
Exemple #10
0
def main(argv):
    values = files.read_ints(argv[0])

    for value in values[1:]:
        print(grow(value))
def main(argv):
    ints = files.read_ints(argv[0])
    T    = ints[0]

    for P in ints[1:]:
        print(minimum_draws(P))
def main(argv):
    lines = files.read_ints(argv[0])
    T     = lines[0]

    for N in lines[1:]:
        print(count_digit_dividers(N))
def main(argv):
    values = files.read_ints(argv[0])

    for value in values[1:]:
        print(grow(value))
Exemple #14
0
def main(argv):
    lines = files.read_ints(argv[0])
    a = lines[0]
    b = lines[1]

    print(solve_me_first(a, b))
Exemple #15
0
def main(argv):
    lines = files.read_ints(argv[0])
    T     = lines[0]

    for N in lines[1:]:
        print(count_digit_dividers(N))
def main(argv):
    lines = files.read_ints(argv[0])
    T     = lines[0]

    for K in lines[1:]:
        print(optimal_slices(K))
def main(argv):
    H, M = files.read_ints(argv[0])

    print(time_in_words(H, M))
Exemple #18
0
def main(argv):
    lines = files.read_ints(argv[0])
    N     = lines[0]
    K     = lines[1]

    print(minimum_unfairness(lines[2:], K))
def main(argv):
    lines = files.read_ints(argv[0])
    N     = lines[0]
    A     = lines[1:]

    print(lis(N, A))
Exemple #20
0
def main(argv):
    ints = files.read_ints(argv[0])
    T = ints[0]

    for P in ints[1:]:
        print(minimum_draws(P))
def main(argv):
    H, M = files.read_ints(argv[0])

    print(time_in_words(H, M))
Exemple #22
0
def main(argv):
    L, R = files.read_ints(argv[0])

    print(max_xor(L, R))
Exemple #23
0
def main(argv):
    lines = files.read_ints(argv[0])
    N = lines[0]
    R = lines[1:]

    print(candies(N, R))
def main(argv):
    lines = files.read_ints(argv[0])
    N = lines[0]
    A = lines[1:]

    print(lis(N, A))
Exemple #25
0
def main(argv):
    lines = files.read_ints(argv[0])
    N = lines[0]
    K = lines[1]

    print(minimum_unfairness(lines[2:], K))
Exemple #26
0
def main(argv):
    lines = files.read_ints(argv[0])
    index = lines[0]
    k     = lines[1]

    print genetics.number_to_pattern(index, k)
Exemple #27
0
def main(argv):
    lines = files.read_ints(argv[0])
    T = lines[0]

    for K in lines[1:]:
        print(optimal_slices(K))
def main(argv):
    lines = files.read_ints(argv[0])

    for line in lines[1:]:
        print(decent_number(line))
Exemple #29
0
def main(argv):
    lines = files.read_ints(argv[0])
    N     = lines[0]
    R     = lines[1:]

    print(candies(N, R))
def main(argv):
    lines = files.read_ints(argv[0])
    a     = lines[0]
    b     = lines[1]

    print(solve_me_first(a, b))