from os import mkdir
from random import *

seed('sequence')

logger = lambda s : print (s)

class Printer:
    def __init__(self, path):
        self.path = "../" + path
        self.tests = 0
        try:
            logger("Creating directory %s"%self.path)
            mkdir(self.path)
        except:
            logger("...Directory already exists")

    def print(self, t):
        self.tests += 1
        p = self.path + "/" + "%02d"%self.tests
        logger("Printing test %s"%p)
        out = open(p, "w")
        print (len(t), file=out)
        for n, mod in t:
            print (n, mod, file=out)

prelim = Printer("preliminary")
prelim.print([(i, 4) for i in range(1, 11)])

tests = Printer("tests")
tests.print([(2 ** n, 1000) for n in range(0, 10)])
tests.print([(2 ** n - 1, 1000) for n in range(1, 10)])
tests.print([(i, randint(2, 10)) for i in range(1, 1001)])

tests.print([(10 ** 7, 1000)])
tests.print([(2 ** i, 1000) for i in range(24)] + [(2 ** i - 1, 1000) for i in range(1, 24)])
tests.print([(randint(1, 10**7), randint(2, 10 ** 5)) for i in range(10 ** 5)])

tests.print([(10 ** 18, 1000)])
tests.print([(2 ** 59, 2), (2 ** 59 - 1, 59)])
tests.print([(randint(1, 10**18), randint(2, 10 ** 18)) for i in range(10 ** 5)])
tests.print([(randint(1, 10**18), randint(2, 10 ** 18)) for i in range(10 ** 5)])
