<commit_before>from Numberjack import *


def get_model():
    # Create the model
    model = Model()

    #Variable definitions, we need a variable for every letter
    s, m = (Variable(1, 9) for val in range(2))  # These can't be zero as they are the start of a word
    e, n, d, o, r, y = (Variable(0, 9) for val in range(6))  # These can

    model.add(      s*1000 + e*100 + n*10 + d +
                    m*1000 + o*100 + r*10 + e ==
          m*10000 + o*1000 + n*100 + e*10 + y)

    # Post the all different constraint on all the variables
    model.add(AllDiff((s, e, n, d, m, o, r, y)))

    return s, e, n, d, m, o, r, y, model


def solve(param):
    s, e, n, d, m, o, r, y, model = get_model()

    # Load up model into solver
    solver = model.load(param['solver'])
    solver.setVerbosity(param['verbose'])

    # Now Solve
    out = ''
    if solver.solve():
        out += "     " + str(s) + ' ' + str(e) + ' ' + str(n) + ' ' + str(d) + ' ' + '\n'
        out += " +  " + ' ' + str(m) + ' ' + str(o) + ' ' + str(r) + ' ' + str(e) + ' ' + '\n'
        out += "= " + ' ' + str(m) + ' ' + str(o) + ' ' + str(n) + ' ' + str(e) + ' ' + str(y) + ' ' + '\n'
    return out


default = {'solver': 'Mistral', 'verbose': 1, 'tcutoff': 3}

if __name__ == '__main__':
    param = input(default)
    print solve(param)<commit_msg>Small tidy to send more money example.<commit_after>from Numberjack import *


def get_model():
    # Create the model
    model = Model()

    #Variable definitions, we need a variable for every letter
    s, m = VarArray(2, 1, 9)  # These can't be zero as they are the start of a word
    e, n, d, o, r, y = VarArray(6, 0, 9)  # These can

    model.add(      s*1000 + e*100 + n*10 + d +
                    m*1000 + o*100 + r*10 + e ==
          m*10000 + o*1000 + n*100 + e*10 + y)

    # Post the all different constraint on all the variables
    model.add(AllDiff((s, e, n, d, m, o, r, y)))

    return s, e, n, d, m, o, r, y, model


def solve(param):
    s, e, n, d, m, o, r, y, model = get_model()

    # Load up model into solver
    solver = model.load(param['solver'])
    solver.setVerbosity(param['verbose'])

    # Now Solve
    solver.solve()
    if solver.is_sat():
        print "    %d %d %d %d" % (s.get_value(), e.get_value(), n.get_value(), d.get_value())
        print "+   %d %d %d %d" % (m.get_value(), o.get_value(), r.get_value(), e.get_value())
        print "= %d %d %d %d %d" % (m.get_value(), o.get_value(), n.get_value(), e.get_value(), y.get_value())


if __name__ == '__main__':
    default = {'solver': 'Mistral', 'verbose': 0}
    param = input(default)
    solve(param)
{'fraction_non_alphanumeric': 0.18243754731264195, 'fraction_numerical': 0.029901589704769114, 'mean_word_length': 2.3797953964194374, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7358750', 'n_tokens_mistral': 1077, 'n_tokens_neox': 994, 'n_words': 312}