title: Efficient table-lookup computation

text:
# Question
Title: Efficient table-lookup computation
The challenge: compute the day of the week from a `MM-DD` representation of a day in this year (2021).

However, you have to write your program in the following subset of Python: (*I chose Python because it's popular and easy to understand even to the people who doesn't know the language. Obviously you can use another program in another language to generate the program, and you're encouraged to post the source code of that program*)

```
# This is the input. For example this represents the date 2021-01-28.
m1 = "0"
m2 = "1"
d1 = "2"
d2 = "8"

T = {
# `T` is a dict
# * each key must be a string of digits [0-9]
# * each value must be a single digit.
"1234": "1",
"5678": "2",
}

# The main program code.
# Each line must have the format:
# <variable_name> = T[<string formed by concatenating string literals or other variables>]
# Example:
variable_1 = T["12" + m1 + "3" + "4"]
output = T[variable_1]

# This must be exactly one `print` statement like this at the end of the program
print(output)

```

*Background: This is basically the only way Preproc (the C/C++ preprocessor) can parse tokens. See how Boost's `BOOST_PP_INC_I` macro is implemented.*

More info:

* You can (and should!) submit multiple programs in one answer if the method that you use to generate these programs are similar.
* You can reassign variables, but doing that will not make your score better (than labeling each usage of the variables `a_1, a_2, a_3, ...`.
* To be clear (this is implied by the rules), you're not allowed to do `x = "0"` or `x = y + z`; only `x = T[...]` is allowed.
* The output should be `0` if the day is Monday, `1` if the day is Tuesday, ..., `6` if the day is Sunday.
* The program must not raise an error given valid input data.

### Winning criteria

Let `A` about the number of entries in the dict `T`, and `B` be the number of assignment instructions (excluding the input assignment instructions to `m1, m2, d1, d2` but including the final assignment to `output`).

You should minimize both `A` and `B`.

Note that you can make the length of the keys of the dict `T` arbitrarily long and it doesn't make the score worse; however it doesn't make the score better either.

Because there isn't a consensus on whether it's allowed to have 2 separate winning criteria, the method to calculate the score is described in this meta answer ("**Solution 2**"), with the board size `10000 10000`. -- For example, if you have a program with `A=100` and `B=100`, enter into the input of the score calculation program

```
10000 10000
100 100

```

and the calculated result is 1970199.

### Recommended header format

```
## Score: (5, 1), (4, 2), (3, 3) -> 999, Combined score: 999, Combined score improvement: 99

```
* Score: The (A, B) parameters of your generated program(s), and (optionally) the computed score of all your generated programs.
* Combined score: the computed score of all the generated programs of the whole community (all answers posted so far) (you can easily calculate the "combined score" by taking the most recent/best combined score answer, then modify the score-list to add your program's scores. Also you should add a link to the score calculation program with your generated programs' scores as input)
* Combined score improvement: the difference between the most-recent computed score and the current combined score.

This is not a requirement, but just in case someone want to write a visualization/leaderboard script. (I intend to have it like this)

### Table of all values

### Program to verify submissions

Note that this program does not verify that the provided program is inside the subset, only if the output is valid.

# Answer
# Score: 679685 (`A=64`, `B=6`)

```
T = {
    # three digits: first day of the month, 0-based (12 entries)
    "001": "4", "002": "0", "003": "0", "004": "3", "005": "5", "006": "1", "007": "3", "008": "6", "009": "2", "010": "4", "011": "0", "012": "2",
    # two digits ab: lookup table for (a + b) % 7 (52 entries)
    "00": "0", "01": "1", "02": "2", "03": "3", "04": "4", "05": "5", "06": "6",
    "10": "1", "11": "2", "12": "3", "13": "4", "14": "5", "15": "6", "16": "0",
    "20": "2", "21": "3", "22": "4", "23": "5", "24": "6", "25": "0", "26": "1",
    "30": "3", "31": "4", "32": "5", "33": "6", "34": "0", "35": "1", "36": "2",
    "40": "4", "41": "5", "42": "6", "43": "0", "44": "1", "45": "2", "46": "3",
    "50": "5", "51": "6", "52": "0", "53": "1", "54": "2", "55": "3", "56": "4",
    "60": "6", "61": "0", "62": "1", "63": "2", "64": "3", "65": "4", "66": "5", "67": "6", "68": "0", "69": "1",
}

# (d2 + 6) % 7 = (d2 - 1) % 7
d2_0d1 = T["6" + d2]

# (d2 - 1 + 1*d1) % 7
d2_1d1 = T[d1 + d2_0d1]

# (d2 - 1 + 2*d1) % 7
d2_2d1 = T[d1 + d2_1d1]

# (d2 - 1 + 3*d1) % 7 = (d2 - 1 + 10*d1) % 7 = (d1d2 - 1) % 7
day_of_month = T[d1 + d2_2d1]

month_start = T["0" + m1 + m2]

output = T[month_start + day_of_month]

```

Try it online! and try the Generator / Testing program!
> 4 votes

# Answer
# Combined score: 440654 (63, 4), (50, 37), (46, 43), (42, 52)

## First program: A=~~64~~ 63, B=4

```
T = {
    # 0mm: lookup table for a such that a1 % 7 is the first day of the month
    "001": "1", "002": "2", "003": "2", "004": "3", "005": "6", "006": "0", "007": "3", "008": "4", "009": "5", "010": "1", "011": "2", "012": "5",
    # ab0: lookup table for ab % 7, "010" already happens to be the correct answer "1"
    "000": "0", "020": "2", "030": "3", "040": "4", "050": "5", "060": "6", "070": "0", "080": "1", "090": "2",
    "100": "3", "110": "4", "120": "5", "130": "6", "140": "0", "150": "1", "160": "2",
    "200": "6", "210": "0", "220": "1", "230": "2", "240": "3", "250": "4", "260": "5",
    "300": "2", "310": "3", "320": "4", "330": "5", "340": "6", "350": "0", "360": "1",
    "400": "5", "410": "6", "420": "0", "430": "1", "440": "2", "450": "3", "460": "4",
    "500": "1", "510": "2", "520": "3", "530": "4", "540": "5", "550": "6", "560": "0",
    "600": "4", "610": "5", "620": "6", "630": "0", "640": "1", "650": "2", "660": "3",
}

m = T["0" + m1 + m2]
d3 = T["0" + d2 + "0"]
d = T[d1 + d3 + "0"]
output = T[m + d + "0"]

```

Try it online! Verification: Try it online! Edit: Reduced A by 1 thanks to a hint from @user202729.

## Second program: A=~~56~~ ~~52~~ 50, B=37

```
T = {
    # 0th day of the month (12 entries)
    "01": "3", "02": "6", "03": "6", "04": "2", "05": "4", "06": "0", "07": "2", "08": "5", "09": "1", "10": "3", "11": "6", "12": "1",
    # abcde: (a%7%2^b^c)+d+e%7>>1 (30 entries) e.g. a0001: a%7%2 abc01: a^b^c 00cde: c+d+e>>1 0000e: e%7>>1
    "01001": "1", "01101": "0", "10001": "1", "10101": "0", "11001": "0", "11101": "1",
    "20001": "0", "30001": "1", "40001": "0", "50001": "1", "60001": "0", "70001": "0", "80001": "1", "90001": "0",
    "00000": "0", "00001": "0", "00010": "0", "00011": "1", "00100": "0", "00101": "1", "00110": "1", "00111": "1",
    "00002": "1", "00003": "1", "00004": "2", "00005": "2", "00006": "3", "00007": "0", "00008": "0", "00009": "1",
    # Convert from binary (modulo 7) (8 entries)
    "000": "0", "001": "1", "010": "2", "011": "3", "100": "4", "101": "5", "110": "6", "111": "0",
}

# Get the day of the month and convert it to binary.
m = T[m1 + m2]
mh = T["0000" + m]
m0 = T[m + "0001"]
m1 = T[mh + "0001"]
m2 = T["0000" + mh]

# Convert the ones day digit (modulo 7) to binary.
d2h = T["0000" + d2]
d20 = T[d2 + "0001"]
d21 = T[d2h + "0001"]
d22 = T["0000" + d2h]

# Convert the tens day digit to binary.
d10 = T[d1 + "0001"]
d11 = T["0000" + d1]

# Multiply by three (modulo 7)
o = T["000" + d10 + d11]
o1 = T[d10 + d11 + "001"]
o0 = T[o + d10 + "001"]
o1 = T[o + o1 + "001"]
o2 = T[o + d11 + "001"]

# Add the ones.
c0 = T["000" + o0 + d20]
o0 = T[o0 + d20 + "001"]
c1 = T["00" + c0 + o1 + d21]
o1 = T[c0 + o1 + d21 + "01"]
o3 = T["00" + c1 + o2 + d22]
o2 = T[c1 + o2 + d22 + "01"]

# Add the month offset.
c0 = T["000" + o0 + m0]
o0 = T[o0 + m0 + "001"]
c1 = T["00" + c0 + o1 + m1]
o1 = T[c0 + o1 + m1 + "01"]
c2 = T["00" + c1 + o2 + m2]
o2 = T[c1 + o2 + m2 + "01"]
o4 = T["000" + o3 + c2]
o3 = T[o3 + c2 + "001"]

# Reduce modulo 7.
c0 = T["000" + o0 + o3]
c1 = T["00" + c0 + o1 + o4]
o1 = T[c0 + o1 + o4 + "01"]
c2 = T["000" + c1 + o2]
o2 = T[c1 + o2 + "001"]
o0 = T[o0 + o3 + c2 + "01"]

# Convert from binary.
output = T[o2 + o1 + o0]

```

Verification: Try it online! Edit: Reduced A by ~~4~~ 6 thanks to a hint from @user202729.

Note that for the next two variants I used letters to code the lookup type for my sanity but obviously distinct digits work just as well.

## Third program: A=~~52~~ ~~48~~ 46, B=43

Simply performs the XORs two bits at a time instead of three. Verification: Try it online!

## Fourth program: A=~~48~~ ~~44~~ 42, B=52

Also performs the additions two bits at a time instead of three. Verification: Try it online!

## "Fifth" program: A=20, B=360

I noticed that @thedefault.'s answer, while having an impressively low A, had a very high B. I looked to see what I could do to remedy that. My first step was to invert the sense of the first half of the lookup table, so that `not` could be calculated directly rather than by adding `9` and taking the sign. The next step was to swap the two halves of the table, so that `and` only took two operations, and the decimal output function could also be simplified. However this meant that `or` was too inefficient, particularly when used to add modulo 7, so I rewrote that to reduce the inefficiency. This is the generator program that I ended up with:

```
import functools
print("""
T = {
 "00": "1", "01":"2", "02":"3", "03":"4", "04":"5", "05":"6", "06":"7", "07":"8", "08":"9", "09":"0"
,
 "10": "1", "11":"0", "12":"0", "13":"0", "14":"0", "15":"0", "16":"0", "17":"0", "18":"0", "19":"0"
}
""".strip())

varn = 0
def getvar():
    global varn
    ret = 'v' + str(varn)
    varn += 1
    return ret
def enot(bi):
    ni = getvar()
    print('%s = T["1"+%s]' % (ni, bi))
    return ni
def enand(b1, b2): #result may be greater than 1, use enot(eand()) to avoid this
    ni = getvar()
    print('%s = T[%s+%s]' % (ni, b1, b2))
    return ni
def eand(b1, b2):
    return enot(enand(b1, b2))
def eor(b1, b2):
    return enot(eand(enot(b1), enot(b2)))
def eeqt(vi):
    #return array of 10 bits for all 10 possible values of vi.
    res = []
    vi2 = getvar()
    for i in range(10):
        ni = getvar()
        print('%s = T["1"+%s]' % (ni, vi if i == 0 else vi2))
        print('%s = T["0"+%s]' % (vi2, vi if i == 0 else vi2))
        res.append(ni)
    #e.g. res[0] = !(x == 0)
    return res[:1] + res[:0:-1]
def edmon(m1, m2):
    #decode m2 using eeqt. create 2 more variables for november and december
    #m1 is already boolean
    m2p = eeqt(m2)
    v11 = eand(m2p[1], m1)
    m2p[1] = eand(m2p[1], enot(m1))
    v12 = eand(m2p[2], m1)
    m2p[2] = eand(m2p[2], enot(m1))
    return m2p[1:] + m2p[:1] + [v11, v12]
def elmon(dmon):
    #given output of edmon, find first day modulo 7.
    #table = [4, 0, 0, 3, 5, 1, 3, 6, 2, 4, 0, 2]
    d0 = enot(eand(eand(enot(dmon[1]), enot(dmon[2])), enot(dmon[10])))
    d1 = dmon[5]
    d2 = eor(dmon[8], dmon[11])
    d3 = eor(dmon[3], dmon[6])
    d4 = eor(dmon[0], dmon[9])
    d5 = dmon[4]
    d6 = dmon[7]
    return [d0,d1,d2,d3,d4,d5,d6]
def eadd7(v1, v2):
    vals = [['"1"'] for _ in range(7)]
    for a in range(7):
        for b in range(7):
            if v2[b] != '"0"':
                vals[(a+b)%7].append(enand(v1[a], v2[b]))
    return [enot(functools.reduce(eand, a)) for a in vals]
def emod7(d2):
    et = eeqt(d2)
    et[0] = eor(et[0], et[7])
    et[1] = eor(et[1], et[8])
    et[2] = eor(et[2], et[9])
    return et[:7]
def e3mod7(d1):
    et = eeqt(d1) # can't optimize because entries are obtained like 0, 9, 8, ... and 1 must be reached
    #d1 < 4. multiply by 3
    #0*3 = 0, 1*3 = 3, 2*3 = 6, 3*3 = 2
    return [et[0], '"0"', et[3], et[1], '"0"', '"0"', et[2]]
def eout(m7):
    val = '"1"'
    ni = getvar()
    for x in m7:
        print('%s = T[%s+%s]' % (ni, x, val))
        val = ni
    return ni
def solve(m1, m2, d1, d2):
    mmod7 = elmon(edmon(m1, m2))
    dmod7 = eadd7(emod7(d2), e3mod7(d1))
    res = eadd7(mmod7, dmod7)
    res = res[1:] + res[:1]
    return eout(res[::-1])

print('output =', solve('m1', 'm2', 'd1', 'd2'))

```
> 4 votes

# Answer
# Score: 26310277, A=20, B=2618, combined score 332345

The `A` is fairly likely to be optimal. (of course, the `B` is terrible)

```
T = {
 "00": "0", "01":"1", "02":"1", "03":"1", "04":"1", "05":"1", "06":"1", "07":"1", "08":"1", "09":"1",
 "10": "1", "11":"2", "12":"3", "13":"4", "14":"5", "15":"6", "16":"7", "17":"8", "18":"9", "19":"0"
}
v1 = T["0"+m2]
v0 = T["1"+m2]
v2 = T["0"+v0]
v0 = T["1"+v0]
v3 = T["0"+v0]
v0 = T["1"+v0]
v4 = T["0"+v0]
v0 = T["1"+v0]
v5 = T["0"+v0]
v0 = T["1"+v0]
v6 = T["0"+v0]
v0 = T["1"+v0]
v7 = T["0"+v0]
v0 = T["1"+v0]
v8 = T["0"+v0]
v0 = T["1"+v0]
v9 = T["0"+v0]
v0 = T["1"+v0]
v10 = T["0"+v0]
v0 = T["1"+v0]
v11 = T["1"+m1]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v11 = T["1"+v11]
v12 = T["0"+v11]
v13 = T[v10+v12]
v13 = T["0"+v13]
v14 = T[v10+m1]
v14 = T["0"+v14]
v15 = T["1"+m1]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v15 = T["1"+v15]
v16 = T["0"+v15]
v17 = T[v9+v16]
v17 = T["0"+v17]
v18 = T[v9+m1]
v18 = T["0"+v18]
v19 = T[v18+v8]
v20 = T["1"+v19]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["1"+v20]
v20 = T["0"+v20]
v21 = T["1"+v20]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v21 = T["1"+v21]
v22 = T["0"+v21]
v23 = T[v22+v13]
v24 = T["1"+v23]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["1"+v24]
v24 = T["0"+v24]
v25 = T["1"+v24]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v25 = T["1"+v25]
v26 = T["0"+v25]
v27 = T[v2+v17]
v28 = T["1"+v27]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["1"+v28]
v28 = T["0"+v28]
v29 = T["1"+v28]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v29 = T["1"+v29]
v30 = T["0"+v29]
v31 = T[v7+v4]
v32 = T["1"+v31]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["1"+v32]
v32 = T["0"+v32]
v33 = T["1"+v32]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v33 = T["1"+v33]
v34 = T["0"+v33]
v35 = T[v14+v1]
v36 = T["1"+v35]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["1"+v36]
v36 = T["0"+v36]
v37 = T["1"+v36]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v37 = T["1"+v37]
v38 = T["0"+v37]
v40 = T["0"+d2]
v39 = T["1"+d2]
v41 = T["0"+v39]
v39 = T["1"+v39]
v42 = T["0"+v39]
v39 = T["1"+v39]
v43 = T["0"+v39]
v39 = T["1"+v39]
v44 = T["0"+v39]
v39 = T["1"+v39]
v45 = T["0"+v39]
v39 = T["1"+v39]
v46 = T["0"+v39]
v39 = T["1"+v39]
v47 = T["0"+v39]
v39 = T["1"+v39]
v48 = T["0"+v39]
v39 = T["1"+v39]
v49 = T["0"+v39]
v39 = T["1"+v39]
v50 = T["1"+v40]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v50 = T["1"+v50]
v51 = T["0"+v50]
v52 = T["1"+v49]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v52 = T["1"+v52]
v53 = T["0"+v52]
v54 = T["1"+v48]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v54 = T["1"+v54]
v55 = T["0"+v54]
v56 = T["1"+v47]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v56 = T["1"+v56]
v57 = T["0"+v56]
v58 = T["1"+v46]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v58 = T["1"+v58]
v59 = T["0"+v58]
v60 = T["1"+v45]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v60 = T["1"+v60]
v61 = T["0"+v60]
v62 = T["1"+v44]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v62 = T["1"+v62]
v63 = T["0"+v62]
v64 = T["1"+v43]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v64 = T["1"+v64]
v65 = T["0"+v64]
v66 = T["1"+v42]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v66 = T["1"+v66]
v67 = T["0"+v66]
v68 = T["1"+v41]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v68 = T["1"+v68]
v69 = T["0"+v68]
v70 = T[v51+v65]
v70 = T["0"+v70]
v71 = T[v53+v67]
v71 = T["0"+v71]
v72 = T[v55+v69]
v72 = T["0"+v72]
v74 = T["0"+d1]
v73 = T["1"+d1]
v75 = T["0"+v73]
v73 = T["1"+v73]
v76 = T["0"+v73]
v73 = T["1"+v73]
v77 = T["0"+v73]
v73 = T["1"+v73]
v78 = T["0"+v73]
v73 = T["1"+v73]
v79 = T["0"+v73]
v73 = T["1"+v73]
v80 = T["0"+v73]
v73 = T["1"+v73]
v81 = T["0"+v73]
v73 = T["1"+v73]
v82 = T["0"+v73]
v73 = T["1"+v73]
v83 = T["0"+v73]
v73 = T["1"+v73]
v84 = T["1"+v74]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v84 = T["1"+v84]
v85 = T["0"+v84]
v86 = T["1"+v81]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v86 = T["1"+v86]
v87 = T["0"+v86]
v88 = T["1"+v83]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v88 = T["1"+v88]
v89 = T["0"+v88]
v90 = T["1"+v82]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v90 = T["1"+v90]
v91 = T["0"+v90]
v92 = T[v70+v85]
v93 = T["1"+v92]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["1"+v93]
v93 = T["0"+v93]
v94 = T["1"+v93]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v94 = T["1"+v94]
v95 = T["0"+v94]
v96 = T[v70+"0"]
v97 = T["1"+v96]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["1"+v97]
v97 = T["0"+v97]
v98 = T["1"+v97]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v98 = T["1"+v98]
v99 = T["0"+v98]
v100 = T[v70+v87]
v101 = T["1"+v100]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["1"+v101]
v101 = T["0"+v101]
v102 = T["1"+v101]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v102 = T["1"+v102]
v103 = T["0"+v102]
v104 = T[v70+v89]
v105 = T["1"+v104]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["1"+v105]
v105 = T["0"+v105]
v106 = T["1"+v105]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v106 = T["1"+v106]
v107 = T["0"+v106]
v108 = T[v70+"0"]
v109 = T["1"+v108]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["1"+v109]
v109 = T["0"+v109]
v110 = T["1"+v109]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v110 = T["1"+v110]
v111 = T["0"+v110]
v112 = T[v70+"0"]
v113 = T["1"+v112]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["1"+v113]
v113 = T["0"+v113]
v114 = T["1"+v113]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v114 = T["1"+v114]
v115 = T["0"+v114]
v116 = T[v70+v91]
v117 = T["1"+v116]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["1"+v117]
v117 = T["0"+v117]
v118 = T["1"+v117]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v118 = T["1"+v118]
v119 = T["0"+v118]
v120 = T[v71+v85]
v121 = T["1"+v120]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["1"+v121]
v121 = T["0"+v121]
v122 = T["1"+v121]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v122 = T["1"+v122]
v123 = T["0"+v122]
v124 = T[v71+"0"]
v125 = T["1"+v124]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["1"+v125]
v125 = T["0"+v125]
v126 = T["1"+v125]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v126 = T["1"+v126]
v127 = T["0"+v126]
v128 = T[v71+v87]
v129 = T["1"+v128]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["1"+v129]
v129 = T["0"+v129]
v130 = T["1"+v129]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v130 = T["1"+v130]
v131 = T["0"+v130]
v132 = T[v71+v89]
v133 = T["1"+v132]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["1"+v133]
v133 = T["0"+v133]
v134 = T["1"+v133]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v134 = T["1"+v134]
v135 = T["0"+v134]
v136 = T[v71+"0"]
v137 = T["1"+v136]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["1"+v137]
v137 = T["0"+v137]
v138 = T["1"+v137]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v138 = T["1"+v138]
v139 = T["0"+v138]
v140 = T[v71+"0"]
v141 = T["1"+v140]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["1"+v141]
v141 = T["0"+v141]
v142 = T["1"+v141]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v142 = T["1"+v142]
v143 = T["0"+v142]
v144 = T[v71+v91]
v145 = T["1"+v144]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["1"+v145]
v145 = T["0"+v145]
v146 = T["1"+v145]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v146 = T["1"+v146]
v147 = T["0"+v146]
v148 = T[v72+v85]
v149 = T["1"+v148]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["1"+v149]
v149 = T["0"+v149]
v150 = T["1"+v149]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v150 = T["1"+v150]
v151 = T["0"+v150]
v152 = T[v72+"0"]
v153 = T["1"+v152]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["1"+v153]
v153 = T["0"+v153]
v154 = T["1"+v153]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v154 = T["1"+v154]
v155 = T["0"+v154]
v156 = T[v72+v87]
v157 = T["1"+v156]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["1"+v157]
v157 = T["0"+v157]
v158 = T["1"+v157]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v158 = T["1"+v158]
v159 = T["0"+v158]
v160 = T[v72+v89]
v161 = T["1"+v160]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["1"+v161]
v161 = T["0"+v161]
v162 = T["1"+v161]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v162 = T["1"+v162]
v163 = T["0"+v162]
v164 = T[v72+"0"]
v165 = T["1"+v164]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["1"+v165]
v165 = T["0"+v165]
v166 = T["1"+v165]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v166 = T["1"+v166]
v167 = T["0"+v166]
v168 = T[v72+"0"]
v169 = T["1"+v168]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["1"+v169]
v169 = T["0"+v169]
v170 = T["1"+v169]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v170 = T["1"+v170]
v171 = T["0"+v170]
v172 = T[v72+v91]
v173 = T["1"+v172]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["1"+v173]
v173 = T["0"+v173]
v174 = T["1"+v173]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v174 = T["1"+v174]
v175 = T["0"+v174]
v176 = T[v57+v85]
v177 = T["1"+v176]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["1"+v177]
v177 = T["0"+v177]
v178 = T["1"+v177]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v178 = T["1"+v178]
v179 = T["0"+v178]
v180 = T[v57+"0"]
v181 = T["1"+v180]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["1"+v181]
v181 = T["0"+v181]
v182 = T["1"+v181]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v182 = T["1"+v182]
v183 = T["0"+v182]
v184 = T[v57+v87]
v185 = T["1"+v184]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["1"+v185]
v185 = T["0"+v185]
v186 = T["1"+v185]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v186 = T["1"+v186]
v187 = T["0"+v186]
v188 = T[v57+v89]
v189 = T["1"+v188]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["1"+v189]
v189 = T["0"+v189]
v190 = T["1"+v189]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v190 = T["1"+v190]
v191 = T["0"+v190]
v192 = T[v57+"0"]
v193 = T["1"+v192]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["1"+v193]
v193 = T["0"+v193]
v194 = T["1"+v193]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v194 = T["1"+v194]
v195 = T["0"+v194]
v196 = T[v57+"0"]
v197 = T["1"+v196]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["1"+v197]
v197 = T["0"+v197]
v198 = T["1"+v197]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v198 = T["1"+v198]
v199 = T["0"+v198]
v200 = T[v57+v91]
v201 = T["1"+v200]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["1"+v201]
v201 = T["0"+v201]
v202 = T["1"+v201]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v202 = T["1"+v202]
v203 = T["0"+v202]
v204 = T[v59+v85]
v205 = T["1"+v204]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["1"+v205]
v205 = T["0"+v205]
v206 = T["1"+v205]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v206 = T["1"+v206]
v207 = T["0"+v206]
v208 = T[v59+"0"]
v209 = T["1"+v208]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["1"+v209]
v209 = T["0"+v209]
v210 = T["1"+v209]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v210 = T["1"+v210]
v211 = T["0"+v210]
v212 = T[v59+v87]
v213 = T["1"+v212]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["1"+v213]
v213 = T["0"+v213]
v214 = T["1"+v213]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v214 = T["1"+v214]
v215 = T["0"+v214]
v216 = T[v59+v89]
v217 = T["1"+v216]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["1"+v217]
v217 = T["0"+v217]
v218 = T["1"+v217]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v218 = T["1"+v218]
v219 = T["0"+v218]
v220 = T[v59+"0"]
v221 = T["1"+v220]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["1"+v221]
v221 = T["0"+v221]
v222 = T["1"+v221]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v222 = T["1"+v222]
v223 = T["0"+v222]
v224 = T[v59+"0"]
v225 = T["1"+v224]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["1"+v225]
v225 = T["0"+v225]
v226 = T["1"+v225]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v226 = T["1"+v226]
v227 = T["0"+v226]
v228 = T[v59+v91]
v229 = T["1"+v228]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["1"+v229]
v229 = T["0"+v229]
v230 = T["1"+v229]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v230 = T["1"+v230]
v231 = T["0"+v230]
v232 = T[v61+v85]
v233 = T["1"+v232]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["1"+v233]
v233 = T["0"+v233]
v234 = T["1"+v233]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v234 = T["1"+v234]
v235 = T["0"+v234]
v236 = T[v61+"0"]
v237 = T["1"+v236]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["1"+v237]
v237 = T["0"+v237]
v238 = T["1"+v237]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v238 = T["1"+v238]
v239 = T["0"+v238]
v240 = T[v61+v87]
v241 = T["1"+v240]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["1"+v241]
v241 = T["0"+v241]
v242 = T["1"+v241]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v242 = T["1"+v242]
v243 = T["0"+v242]
v244 = T[v61+v89]
v245 = T["1"+v244]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["1"+v245]
v245 = T["0"+v245]
v246 = T["1"+v245]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v246 = T["1"+v246]
v247 = T["0"+v246]
v248 = T[v61+"0"]
v249 = T["1"+v248]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["1"+v249]
v249 = T["0"+v249]
v250 = T["1"+v249]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v250 = T["1"+v250]
v251 = T["0"+v250]
v252 = T[v61+"0"]
v253 = T["1"+v252]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["1"+v253]
v253 = T["0"+v253]
v254 = T["1"+v253]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v254 = T["1"+v254]
v255 = T["0"+v254]
v256 = T[v61+v91]
v257 = T["1"+v256]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["1"+v257]
v257 = T["0"+v257]
v258 = T["1"+v257]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v258 = T["1"+v258]
v259 = T["0"+v258]
v260 = T[v63+v85]
v261 = T["1"+v260]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["1"+v261]
v261 = T["0"+v261]
v262 = T["1"+v261]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v262 = T["1"+v262]
v263 = T["0"+v262]
v264 = T[v63+"0"]
v265 = T["1"+v264]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["1"+v265]
v265 = T["0"+v265]
v266 = T["1"+v265]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v266 = T["1"+v266]
v267 = T["0"+v266]
v268 = T[v63+v87]
v269 = T["1"+v268]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["1"+v269]
v269 = T["0"+v269]
v270 = T["1"+v269]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v270 = T["1"+v270]
v271 = T["0"+v270]
v272 = T[v63+v89]
v273 = T["1"+v272]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["1"+v273]
v273 = T["0"+v273]
v274 = T["1"+v273]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v274 = T["1"+v274]
v275 = T["0"+v274]
v276 = T[v63+"0"]
v277 = T["1"+v276]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["1"+v277]
v277 = T["0"+v277]
v278 = T["1"+v277]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v278 = T["1"+v278]
v279 = T["0"+v278]
v280 = T[v63+"0"]
v281 = T["1"+v280]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["1"+v281]
v281 = T["0"+v281]
v282 = T["1"+v281]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v282 = T["1"+v282]
v283 = T["0"+v282]
v284 = T[v63+v91]
v285 = T["1"+v284]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["1"+v285]
v285 = T["0"+v285]
v286 = T["1"+v285]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v286 = T["1"+v286]
v287 = T["0"+v286]
v288 = T[v95+v147]
v288 = T["0"+v288]
v289 = T[v288+v171]
v289 = T["0"+v289]
v290 = T[v289+v195]
v290 = T["0"+v290]
v291 = T[v290+v219]
v291 = T["0"+v291]
v292 = T[v291+v243]
v292 = T["0"+v292]
v293 = T[v292+v267]
v293 = T["0"+v293]
v294 = T[v99+v123]
v294 = T["0"+v294]
v295 = T[v294+v175]
v295 = T["0"+v295]
v296 = T[v295+v199]
v296 = T["0"+v296]
v297 = T[v296+v223]
v297 = T["0"+v297]
v298 = T[v297+v247]
v298 = T["0"+v298]
v299 = T[v298+v271]
v299 = T["0"+v299]
v300 = T[v103+v127]
v300 = T["0"+v300]
v301 = T[v300+v151]
v301 = T["0"+v301]
v302 = T[v301+v203]
v302 = T["0"+v302]
v303 = T[v302+v227]
v303 = T["0"+v303]
v304 = T[v303+v251]
v304 = T["0"+v304]
v305 = T[v304+v275]
v305 = T["0"+v305]
v306 = T[v107+v131]
v306 = T["0"+v306]
v307 = T[v306+v155]
v307 = T["0"+v307]
v308 = T[v307+v179]
v308 = T["0"+v308]
v309 = T[v308+v231]
v309 = T["0"+v309]
v310 = T[v309+v255]
v310 = T["0"+v310]
v311 = T[v310+v279]
v311 = T["0"+v311]
v312 = T[v111+v135]
v312 = T["0"+v312]
v313 = T[v312+v159]
v313 = T["0"+v313]
v314 = T[v313+v183]
v314 = T["0"+v314]
v315 = T[v314+v207]
v315 = T["0"+v315]
v316 = T[v315+v259]
v316 = T["0"+v316]
v317 = T[v316+v283]
v317 = T["0"+v317]
v318 = T[v115+v139]
v318 = T["0"+v318]
v319 = T[v318+v163]
v319 = T["0"+v319]
v320 = T[v319+v187]
v320 = T["0"+v320]
v321 = T[v320+v211]
v321 = T["0"+v321]
v322 = T[v321+v235]
v322 = T["0"+v322]
v323 = T[v322+v287]
v323 = T["0"+v323]
v324 = T[v119+v143]
v324 = T["0"+v324]
v325 = T[v324+v167]
v325 = T["0"+v325]
v326 = T[v325+v191]
v326 = T["0"+v326]
v327 = T[v326+v215]
v327 = T["0"+v327]
v328 = T[v327+v239]
v328 = T["0"+v328]
v329 = T[v328+v263]
v329 = T["0"+v329]
v330 = T["1"+v26]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v330 = T["1"+v330]
v331 = T["0"+v330]
v332 = T["1"+v5]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v332 = T["1"+v332]
v333 = T["0"+v332]
v334 = T["1"+v30]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v334 = T["1"+v334]
v335 = T["0"+v334]
v336 = T["1"+v34]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v336 = T["1"+v336]
v337 = T["0"+v336]
v338 = T["1"+v38]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v338 = T["1"+v338]
v339 = T["0"+v338]
v340 = T["1"+v6]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v340 = T["1"+v340]
v341 = T["0"+v340]
v342 = T["1"+v3]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v342 = T["1"+v342]
v343 = T["0"+v342]
v344 = T[v331+v293]
v345 = T["1"+v344]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["1"+v345]
v345 = T["0"+v345]
v346 = T["1"+v345]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v346 = T["1"+v346]
v347 = T["0"+v346]
v348 = T[v331+v299]
v349 = T["1"+v348]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["1"+v349]
v349 = T["0"+v349]
v350 = T["1"+v349]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v350 = T["1"+v350]
v351 = T["0"+v350]
v352 = T[v331+v305]
v353 = T["1"+v352]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["1"+v353]
v353 = T["0"+v353]
v354 = T["1"+v353]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v354 = T["1"+v354]
v355 = T["0"+v354]
v356 = T[v331+v311]
v357 = T["1"+v356]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["1"+v357]
v357 = T["0"+v357]
v358 = T["1"+v357]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v358 = T["1"+v358]
v359 = T["0"+v358]
v360 = T[v331+v317]
v361 = T["1"+v360]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["1"+v361]
v361 = T["0"+v361]
v362 = T["1"+v361]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v362 = T["1"+v362]
v363 = T["0"+v362]
v364 = T[v331+v323]
v365 = T["1"+v364]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["1"+v365]
v365 = T["0"+v365]
v366 = T["1"+v365]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v366 = T["1"+v366]
v367 = T["0"+v366]
v368 = T[v331+v329]
v369 = T["1"+v368]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["1"+v369]
v369 = T["0"+v369]
v370 = T["1"+v369]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v370 = T["1"+v370]
v371 = T["0"+v370]
v372 = T[v333+v293]
v373 = T["1"+v372]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["1"+v373]
v373 = T["0"+v373]
v374 = T["1"+v373]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v374 = T["1"+v374]
v375 = T["0"+v374]
v376 = T[v333+v299]
v377 = T["1"+v376]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["1"+v377]
v377 = T["0"+v377]
v378 = T["1"+v377]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v378 = T["1"+v378]
v379 = T["0"+v378]
v380 = T[v333+v305]
v381 = T["1"+v380]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["1"+v381]
v381 = T["0"+v381]
v382 = T["1"+v381]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v382 = T["1"+v382]
v383 = T["0"+v382]
v384 = T[v333+v311]
v385 = T["1"+v384]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["1"+v385]
v385 = T["0"+v385]
v386 = T["1"+v385]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v386 = T["1"+v386]
v387 = T["0"+v386]
v388 = T[v333+v317]
v389 = T["1"+v388]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["1"+v389]
v389 = T["0"+v389]
v390 = T["1"+v389]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v390 = T["1"+v390]
v391 = T["0"+v390]
v392 = T[v333+v323]
v393 = T["1"+v392]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["1"+v393]
v393 = T["0"+v393]
v394 = T["1"+v393]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v394 = T["1"+v394]
v395 = T["0"+v394]
v396 = T[v333+v329]
v397 = T["1"+v396]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["1"+v397]
v397 = T["0"+v397]
v398 = T["1"+v397]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v398 = T["1"+v398]
v399 = T["0"+v398]
v400 = T[v335+v293]
v401 = T["1"+v400]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["1"+v401]
v401 = T["0"+v401]
v402 = T["1"+v401]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v402 = T["1"+v402]
v403 = T["0"+v402]
v404 = T[v335+v299]
v405 = T["1"+v404]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["1"+v405]
v405 = T["0"+v405]
v406 = T["1"+v405]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v406 = T["1"+v406]
v407 = T["0"+v406]
v408 = T[v335+v305]
v409 = T["1"+v408]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["1"+v409]
v409 = T["0"+v409]
v410 = T["1"+v409]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v410 = T["1"+v410]
v411 = T["0"+v410]
v412 = T[v335+v311]
v413 = T["1"+v412]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["1"+v413]
v413 = T["0"+v413]
v414 = T["1"+v413]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v414 = T["1"+v414]
v415 = T["0"+v414]
v416 = T[v335+v317]
v417 = T["1"+v416]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["1"+v417]
v417 = T["0"+v417]
v418 = T["1"+v417]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v418 = T["1"+v418]
v419 = T["0"+v418]
v420 = T[v335+v323]
v421 = T["1"+v420]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["1"+v421]
v421 = T["0"+v421]
v422 = T["1"+v421]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v422 = T["1"+v422]
v423 = T["0"+v422]
v424 = T[v335+v329]
v425 = T["1"+v424]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["1"+v425]
v425 = T["0"+v425]
v426 = T["1"+v425]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v426 = T["1"+v426]
v427 = T["0"+v426]
v428 = T[v337+v293]
v429 = T["1"+v428]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["1"+v429]
v429 = T["0"+v429]
v430 = T["1"+v429]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v430 = T["1"+v430]
v431 = T["0"+v430]
v432 = T[v337+v299]
v433 = T["1"+v432]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["1"+v433]
v433 = T["0"+v433]
v434 = T["1"+v433]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v434 = T["1"+v434]
v435 = T["0"+v434]
v436 = T[v337+v305]
v437 = T["1"+v436]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["1"+v437]
v437 = T["0"+v437]
v438 = T["1"+v437]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v438 = T["1"+v438]
v439 = T["0"+v438]
v440 = T[v337+v311]
v441 = T["1"+v440]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["1"+v441]
v441 = T["0"+v441]
v442 = T["1"+v441]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v442 = T["1"+v442]
v443 = T["0"+v442]
v444 = T[v337+v317]
v445 = T["1"+v444]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["1"+v445]
v445 = T["0"+v445]
v446 = T["1"+v445]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v446 = T["1"+v446]
v447 = T["0"+v446]
v448 = T[v337+v323]
v449 = T["1"+v448]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["1"+v449]
v449 = T["0"+v449]
v450 = T["1"+v449]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v450 = T["1"+v450]
v451 = T["0"+v450]
v452 = T[v337+v329]
v453 = T["1"+v452]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["1"+v453]
v453 = T["0"+v453]
v454 = T["1"+v453]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v454 = T["1"+v454]
v455 = T["0"+v454]
v456 = T[v339+v293]
v457 = T["1"+v456]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["1"+v457]
v457 = T["0"+v457]
v458 = T["1"+v457]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v458 = T["1"+v458]
v459 = T["0"+v458]
v460 = T[v339+v299]
v461 = T["1"+v460]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["1"+v461]
v461 = T["0"+v461]
v462 = T["1"+v461]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v462 = T["1"+v462]
v463 = T["0"+v462]
v464 = T[v339+v305]
v465 = T["1"+v464]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["1"+v465]
v465 = T["0"+v465]
v466 = T["1"+v465]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v466 = T["1"+v466]
v467 = T["0"+v466]
v468 = T[v339+v311]
v469 = T["1"+v468]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["1"+v469]
v469 = T["0"+v469]
v470 = T["1"+v469]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v470 = T["1"+v470]
v471 = T["0"+v470]
v472 = T[v339+v317]
v473 = T["1"+v472]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["1"+v473]
v473 = T["0"+v473]
v474 = T["1"+v473]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v474 = T["1"+v474]
v475 = T["0"+v474]
v476 = T[v339+v323]
v477 = T["1"+v476]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["1"+v477]
v477 = T["0"+v477]
v478 = T["1"+v477]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v478 = T["1"+v478]
v479 = T["0"+v478]
v480 = T[v339+v329]
v481 = T["1"+v480]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["1"+v481]
v481 = T["0"+v481]
v482 = T["1"+v481]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v482 = T["1"+v482]
v483 = T["0"+v482]
v484 = T[v341+v293]
v485 = T["1"+v484]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["1"+v485]
v485 = T["0"+v485]
v486 = T["1"+v485]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v486 = T["1"+v486]
v487 = T["0"+v486]
v488 = T[v341+v299]
v489 = T["1"+v488]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["1"+v489]
v489 = T["0"+v489]
v490 = T["1"+v489]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v490 = T["1"+v490]
v491 = T["0"+v490]
v492 = T[v341+v305]
v493 = T["1"+v492]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["1"+v493]
v493 = T["0"+v493]
v494 = T["1"+v493]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v494 = T["1"+v494]
v495 = T["0"+v494]
v496 = T[v341+v311]
v497 = T["1"+v496]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["1"+v497]
v497 = T["0"+v497]
v498 = T["1"+v497]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v498 = T["1"+v498]
v499 = T["0"+v498]
v500 = T[v341+v317]
v501 = T["1"+v500]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["1"+v501]
v501 = T["0"+v501]
v502 = T["1"+v501]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v502 = T["1"+v502]
v503 = T["0"+v502]
v504 = T[v341+v323]
v505 = T["1"+v504]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["1"+v505]
v505 = T["0"+v505]
v506 = T["1"+v505]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v506 = T["1"+v506]
v507 = T["0"+v506]
v508 = T[v341+v329]
v509 = T["1"+v508]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["1"+v509]
v509 = T["0"+v509]
v510 = T["1"+v509]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v510 = T["1"+v510]
v511 = T["0"+v510]
v512 = T[v343+v293]
v513 = T["1"+v512]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["1"+v513]
v513 = T["0"+v513]
v514 = T["1"+v513]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v514 = T["1"+v514]
v515 = T["0"+v514]
v516 = T[v343+v299]
v517 = T["1"+v516]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["1"+v517]
v517 = T["0"+v517]
v518 = T["1"+v517]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v518 = T["1"+v518]
v519 = T["0"+v518]
v520 = T[v343+v305]
v521 = T["1"+v520]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["1"+v521]
v521 = T["0"+v521]
v522 = T["1"+v521]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v522 = T["1"+v522]
v523 = T["0"+v522]
v524 = T[v343+v311]
v525 = T["1"+v524]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["1"+v525]
v525 = T["0"+v525]
v526 = T["1"+v525]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v526 = T["1"+v526]
v527 = T["0"+v526]
v528 = T[v343+v317]
v529 = T["1"+v528]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["1"+v529]
v529 = T["0"+v529]
v530 = T["1"+v529]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v530 = T["1"+v530]
v531 = T["0"+v530]
v532 = T[v343+v323]
v533 = T["1"+v532]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["1"+v533]
v533 = T["0"+v533]
v534 = T["1"+v533]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v534 = T["1"+v534]
v535 = T["0"+v534]
v536 = T[v343+v329]
v537 = T["1"+v536]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["1"+v537]
v537 = T["0"+v537]
v538 = T["1"+v537]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v538 = T["1"+v538]
v539 = T["0"+v538]
v540 = T[v347+v399]
v540 = T["0"+v540]
v541 = T[v540+v423]
v541 = T["0"+v541]
v542 = T[v541+v447]
v542 = T["0"+v542]
v543 = T[v542+v471]
v543 = T["0"+v543]
v544 = T[v543+v495]
v544 = T["0"+v544]
v545 = T[v544+v519]
v545 = T["0"+v545]
v546 = T[v351+v375]
v546 = T["0"+v546]
v547 = T[v546+v427]
v547 = T["0"+v547]
v548 = T[v547+v451]
v548 = T["0"+v548]
v549 = T[v548+v475]
v549 = T["0"+v549]
v550 = T[v549+v499]
v550 = T["0"+v550]
v551 = T[v550+v523]
v551 = T["0"+v551]
v552 = T[v355+v379]
v552 = T["0"+v552]
v553 = T[v552+v403]
v553 = T["0"+v553]
v554 = T[v553+v455]
v554 = T["0"+v554]
v555 = T[v554+v479]
v555 = T["0"+v555]
v556 = T[v555+v503]
v556 = T["0"+v556]
v557 = T[v556+v527]
v557 = T["0"+v557]
v558 = T[v359+v383]
v558 = T["0"+v558]
v559 = T[v558+v407]
v559 = T["0"+v559]
v560 = T[v559+v431]
v560 = T["0"+v560]
v561 = T[v560+v483]
v561 = T["0"+v561]
v562 = T[v561+v507]
v562 = T["0"+v562]
v563 = T[v562+v531]
v563 = T["0"+v563]
v564 = T[v363+v387]
v564 = T["0"+v564]
v565 = T[v564+v411]
v565 = T["0"+v565]
v566 = T[v565+v435]
v566 = T["0"+v566]
v567 = T[v566+v459]
v567 = T["0"+v567]
v568 = T[v567+v511]
v568 = T["0"+v568]
v569 = T[v568+v535]
v569 = T["0"+v569]
v570 = T[v367+v391]
v570 = T["0"+v570]
v571 = T[v570+v415]
v571 = T["0"+v571]
v572 = T[v571+v439]
v572 = T["0"+v572]
v573 = T[v572+v463]
v573 = T["0"+v573]
v574 = T[v573+v487]
v574 = T["0"+v574]
v575 = T[v574+v539]
v575 = T["0"+v575]
v576 = T[v371+v395]
v576 = T["0"+v576]
v577 = T[v576+v419]
v577 = T["0"+v577]
v578 = T[v577+v443]
v578 = T["0"+v578]
v579 = T[v578+v467]
v579 = T["0"+v579]
v580 = T[v579+v491]
v580 = T["0"+v580]
v581 = T[v580+v515]
v581 = T["0"+v581]
v582 = T["1"+v545]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v582 = T["1"+v582]
v583 = T["0"+v582]
v584 = T["1"+v581]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v584 = T["1"+v584]
v585 = T["0"+v584]
v586 = T["1"+v575]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v586 = T["1"+v586]
v587 = T["0"+v586]
v588 = T["1"+v569]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v588 = T["1"+v588]
v589 = T["0"+v588]
v590 = T["1"+v563]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v590 = T["1"+v590]
v591 = T["0"+v590]
v592 = T["1"+v557]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v592 = T["1"+v592]
v593 = T["0"+v592]
v594 = T["1"+v551]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v594 = T["1"+v594]
v595 = T["0"+v594]
v596 = T[v583+"1"]
v596 = T[v585+v596]
v596 = T[v587+v596]
v596 = T[v589+v596]
v596 = T[v591+v596]
v596 = T[v593+v596]
v596 = T[v595+v596]
v597 = T["1"+v596]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
v597 = T["1"+v597]
output = v597

```

Generator code:

```
import functools
print("""
T = {
 "00": "0", "01":"1", "02":"1", "03":"1", "04":"1", "05":"1", "06":"1", "07":"1", "08":"1", "09":"1",
 "10": "1", "11":"2", "12":"3", "13":"4", "14":"5", "15":"6", "16":"7", "17":"8", "18":"9", "19":"0"
}
""".strip())

varn = 0
def getvar():
    global varn
    ret = 'v' + str(varn)
    varn += 1
    return ret
def eaddi(vi, imm):
    if imm == 0: return vi
    ni = getvar()
    for i in range(imm):
        print('%s = T["1"+%s]' % (ni, vi if i == 0 else ni))
    return ni
def enot(bi):
    bi2 = eaddi(bi, 9)
    ni = getvar()
    print('%s = T["0"+%s]' % (ni, bi2))
    return ni
def eor(b1, b2):
    ni = getvar()
    print('%s = T[%s+%s]' % (ni, b1, b2))
    print('%s = T["0"+%s]' % (ni, ni))
    return ni
def enor(b1, b2):
    return enot(eor(b1, b2))
#def eand(b1, b2):
#   return enor(enot(b1), enot(b2))
def eand(b1, b2):
    ni = getvar()
    print('%s = T[%s+%s]' % (ni, b1, b2))
    #return enot(eaddi(ni, 8))
    ni = eaddi(ni, 8)
    print('%s = T["0"+%s]' % (ni, ni))
    return enot(ni)
def exor(b1, b2):
    return enor(enor(enot(b1), enot(b2)), enor(b1, b2))
def eeqt(vi):
    #return array of 10 bits for all 10 possible values of vi. inverted
    res = []
    vi2 = getvar()
    for i in range(10):
        ni = getvar()
        print('%s = T["0"+%s]' % (ni, vi if i == 0 else vi2))
        print('%s = T["1"+%s]' % (vi2, vi if i == 0 else vi2))
        res.append(ni)
    #e.g. res[0] = !(x == 0)
    return res[0:1] + res[1:][::-1]
def edmon(m1, m2):
    #decode m2 using eeqt. create 2 more variables for november and december
    #m1 is already boolean
    m2p = eeqt(m2)
    v11 = eor(m2p[1], enot(m1))
    m2p[1] = eor(m2p[1], m1)
    v12 = eor(m2p[2], enot(m1))
    m2p[2] = eor(m2p[2], m1)
    ret = m2p + [v11, v12]
    #return ret
    return ret[1:10] + ret[0:1] + ret[10:]
def elmon(dmon):
    #given output of edmon, find first day modulo 7. also output inverted!
    #table = [4, 0, 0, 3, 5, 1, 3, 6, 2, 4, 0, 2]
    d0 = eand(eand(dmon[1], dmon[2]), dmon[10])
    d1 = dmon[5]
    d2 = eand(dmon[8], dmon[11])
    d3 = eand(dmon[3], dmon[6])
    d4 = eand(dmon[0], dmon[9])
    d5 = dmon[4]
    d6 = dmon[7]
    return [d0,d1,d2,d3,d4,d5,d6]
def enotarr(a):
    return [enot(x) for x in a]
def eadd7(v1, v2):
    vals = [[] for _ in range(7)]
    for a in range(7):
        for b in range(7):
            vals[(a+b)%7].append(eand(v1[a], v2[b]))
    return [functools.reduce(eor, a) for a in vals]

def emod7(d2):
    et = eeqt(d2)
    et = enotarr(et)
    et[0] = eor(et[0], et[7])
    et[1] = eor(et[1], et[8])
    et[2] = eor(et[2], et[9])
    return et[0:7]
def e3mod7(d1):
    et = eeqt(d1) # can't optimize because entries are obtained like 0, 9, 8, ... and 1 must be reached
    #d1 < 4. multiply by 3
    #0*3 = 0, 1*3 = 3, 2*3 = 6, 3*3 = 2
    return [enot(et[0]), '"0"', enot(et[3]), enot(et[1]), '"0"', '"0"', enot(et[2])]

def eout(m7):
    m7 = enotarr(m7)
    val = '"1"'
    ni = getvar()
    for x in m7:
        print('%s = T[%s+%s]' % (ni, x, val))
        val = ni
    return eaddi(ni, 9)

def solve(m1, m2, d1, d2):
    mmod7 = elmon(edmon(m1, m2))
    dmod7 = eadd7(emod7(d2), e3mod7(d1))
    res = eadd7(enotarr(mmod7), dmod7)
    res = res[1:] + res[:1]
    return eout(res[::-1])

#print(eaddinv(['A'+str(i) for i in range(7)], ['B'+str(i) for i in range(7)]))

#print('print(' + ', '.join(elmon(edmon('M1', 'M2'))) + ')')
#print('print(' + ', '.join(edmon('M1', 'M2')) + ')')

#print('output =', '['+','.join(e3mod7('d1'))+']')
#print('output =', '['+','.join(eadd7(e3mod7('d1'), emod7('d2')))+']')
#print('output =', '['+','.join(emod7('d2'))+']')
#print('output =', '['+','.join(solve('m1','m2','d1','d2'))+']')
print('output =', solve('m1', 'm2', 'd1', 'd2'))

```

No TIO links because of the code size. The generator can be run as `python3 x.py > solution.py`.

# Explanation

In the table T, `T[0x]` is `0` when x is `0` and `1` otherwise, and `T[1x]` is `(x+1) % 10`. Then logic can be performed on values in (0, 1):

```
!bit = T['0' + (bit+9)]
b1 | b2 = T['0' + T[b1 + b2]]

```

OR and NOT are functionally complete (and can be used to evaluate any boolean function). To perform any boolean calculations on the input, it should be converted to bits. In my code, it's done like this:

```
!(x == 0) = T['0' + x]
!(x == 9) = T['0' + (x+1)%10]
!(x == 8) = T['0' + (x+2)%10]
...
!(x == 1) = T['0' + (x+9)%10]

```

(and a 10-bit representation is obtained from this). To convert a sequence of bits to a number, the following is used in my code:

```
x = 1
x = T[bit1 + x]
x = T[bit2 + x]
x = T[bit3 + x]
...
x = T[bitn + x]
x = x + 9

```

After this, `x` is the number of zeroes after the last `1` in the sequence of bits (modulo 10 and assuming the sequence of bits is short). In my code, integers modulo 7 are represented as sequences of 7 bits (when the bit at index `i` is set, the integer is equal to `i`). Some calculations are performed with inverted values. Addition is implemented by checking for all 49 possible cases and selecting the correct output.
> 2 votes

---
Tags: atomic-code-golf
---


title: Count strictly overlapping substrings

text:
# Question
Title: Count strictly overlapping substrings
Given two strings `a` and `b`, count how many times `b` occurs as a substring in `a`, but only when it overlaps with another instance of `b`.

(This means that `1` will never be a valid output, because in order for the substring to be strictly overlapping, there must be at least one other instance for it to overlap with.)

## Test cases

```
input a              input b     output

trololololol         trol        0
trololololol         ol          0
trololololol         lol         4
trololololol         LOL         0
HAAAAHAAAAA          A           0
HAAAAHAAAAA          AA          7
Teeheeee             ee          3
123123123123123123   12312312    4
(empty string)       whatever    0

```

`b` will never be an empty string.

## Rules

# Answer
> 6 votes
# JavaScript (ES6), 69 bytes

Expects `(a)(b)`.

```
a=>g=(b,i=(t=0)-.1,p)=>~i?g(b,a.indexOf(b,i+1),i,q=b[i-p]?t-=~!q:0):t

```

Try it online!

### How?

Given the last position **i** of **b** in **a**, we use `a.indexOf(b, i + 1)` to get the position of the next occurrence. We keep track of the previous position in **p** and figure out whether they overlap by testing if `b[i - p]` is defined.

At the very beginning of the process, we initialize **i** to **-0.1** so that it's neither **-1** (that would stop the recursion) nor **0** that would mean that there's a match at position **0**, while still being interpreted as **0** by `.indexOf()`.

Exemple for `a = "XABABA"` and `b = "ABA"`:

```
 iteration |         1 |        2 |    3 |   4
-----------+-----------+----------+------+-----
         i |      -0.1 |        1 |    3 |  -1
         p | undefined |     -0.1 |    1 |   3
     i - p |       NaN |      1.1 |    2 | n/a
     match |  "X**ABA**BA" | "XAB**ABA**" | none | n/a
                ^            ^
```

### Commented

```
a =>                // outer function taking the haystack a
g = (               // inner recursive function g taking:
  b,                //   b = needle
  i = (t = 0) - .1, //   i = pointer in a, initialized to -0.1
                    //   t = output, initialized to 0
  p                 //   p = position of the previous occurrence
) =>                //
  ~i ?              // if i is not equal to -1:
    g(              //   do a recursive call:
      b,            //     pass b unchanged
      a.indexOf(    //     set i = position of the next occurrence
        b,          //       of b in a
        i + 1       //       starting at i + 1 (for the first iteration,
      ),            //       this gives -0.1 + 1 = 0.9, rounded to 0)
      i,            //     set p = i
      q =           //     the flag q is set to 0 if this is the first
                    //     occurrence in a chain of valid matches:
        b[i - p] ?  //       if i - p is less than the length of b:
          t -= ~!q  //         add 2 to t if q = 0, or only 1 otherwise
                    //         either way, set q to a non-zero value
        :           //       else:
          0         //         set q to 0
    )               //   end of recursive call
  :                 // else:
    t               //   stop the recursion and return t

```

# Answer
> 6 votes
# , 35 33 31 24 bytes

```
1#.1<1#.#@[>|@-//~@I.@E.

```

Try it online!

*-7 bytes after reading Luis Mendo's idea and realizing I could adapt it to J*

* `I.@E.` Indexes of matches
* `|@-//~@` Table of pairwise absolute differences
* `#@[>` Is it less than the substring length? (produces 0-1 table)
* `1#.` Sum rows
* `1<` Greater than 1? (produces 0-1 list)
* `1#.` Sum

# Answer
> 6 votes
# MATL, 13 bytes

```
yXf&-|wn<s1>s

```

Inputs are in reverse order: `b`, then `a`.

Try it online! Or verify all test cases.

### Explanation

Consider inputs `'lol'` and `'trololololol'` as an example.

```
y     % Implicit inputs: b, a. Duplicate second-top element in stack
      % STACK: 'lol', 'trololololol', 'lol'
Xf    % Find second string in first string. Produces a row vector (possibly
      % empty) with the indices of all occurrences of b in a
      % STACK: 'lol', [4 6 8 10]
&-    % Square matrix of pairwise differences
      % STACK: 'lol', [0 2 4 6; -2 0 2 4; -4 -2 0 2; -6 -4 -2 0]
|     % Absolute value, element-wise
      % STACK: 'lol', [0 2 4 6; 2 0 2 4; 4 2 0 2; 6 4 2 0]
w     % Swap
      % STACK: [0 2 4 6; 2 0 2 4; 4 2 0 2; 6 4 2 0], 'lol'
n     % Number of elements
      % STACK: [0 2 4 6; 2 0 2 4; 4 2 0 2; 6 4 2 0], 3
<     % Less than? Element-wise
      % STACK: [1 1 0 0; 1 1 1 0; 0 1 1 1; 0 0 1 1]
s     % Sum of each column. For each ocurrence, this gives the number of
      % occurrences, including itself, that are close enough to overlap.
      % If there are no occurrences this gives 0
      % STACK: [2 3 3 2]
1>    % Greater than 1? Element-wise. For each occurrence, this gives 1 (true)
      % if there is a different occurrence that is close enough to overlap
      % STACK: [1 1 1 1]
s     % Sum. Implicit display
      % STACK: 4

```

(Note that the code `1>s` cannot be replaced by `qz` because when there are no occurrences of `b` in `a` that would give `1` instead of `0`, due to the behaviour of the previous `s`).

# Answer
> 4 votes
# Python 3.8 (pre-release), 102 bytes

```
lambda a,b:sum(b==a[i-1:i+(T:=len(b)-1)]*(b in a[i+~T:i+T-1]or b in a[i:i+T*2])for
i in range(len(a)))

```

Try it online!

Explanation: it's pretty readable already. Just that `i+~T` == `i-T-1`, and the `:=` is equivalent to an assignment but can be inserted in a lambda (to make the code shorter)

# Answer
> 4 votes
# Jelly, 15 bytes

```
wÐƤẹ1ạ€`<L}S>1S

```

A dyadic Link accepting `a` on the left and `b` on the right which yields the count.

**Try it online!** Or see the test-suite.

### How?

```
wÐƤẹ1ạ€`<L}S>1S - Link: a, b
 ÐƤ             - for postfixes (of a):
w               -   first 1-indexed index (of b)
   ẹ1           - indices of 1 (i.e. X = a list of starts of b in a)
       `        - use (X) as both arguments of:
      €         -   for each (v in X):
     ạ          -     (v) absolute difference (across each of X)
                  -> list of lists of distances between starts
         L}     - length (of b)
        <       - less than
           S    - sum
            >1  - greater than 1 (i.e. not just overlapping itself)
              S - sum

```

# Answer
> 3 votes
# Retina 0.8.2, 43 bytes

```
(?=(.+)(.*¶)\1$)(.(?!\2))+?((?=\1)|(?<=\1))

```

Try it online! Takes input on separate lines but link includes test suite that splits on comma for convenience. Explanation: The program consists of a single match stage that outputs the count of matches of the pattern within the string `a`. For each match:

```
(?=(.+)(.*¶)\1$)

```

The remainder of the string `a` is split into two parts, the first of which must equal string `b` (which is therefore effectively captured into `$1`). The part of the string `a` after this match of the string `b` is captured into `$2`.

```
(.(?!\2))+?

```

Advance as few characters as possible, and definitely without reaching the end of this particular match of string `b` in string `a`.

```
((?=\1)|(?<=\1))

```

Find an overlapping match of string `b`. Note that in the case of a forward overlap, the lazy quantifier ensures that this match will always stop on or before the next match of string `b`.

# Answer
> 3 votes
# , ~~90~~ 89 bytes

```
function(x,y,z=rle(diff(el(gregexpr(paste0("(?=",y,")"),x,,T)))<nchar(y)))sum(z$l[z$v]+1)

```

A byte saved by Dominic van Essen.

Try it online!

# Answer
> 2 votes
# Perl 5, 117 bytes

```
sub f{($a,$b,$f,%s,$c)=@_;!$s{$x=1+index$a,$b,$_}++&&$x&&($w=$f&&$x-$f<length$b,$f=$x,$c+=$j*$w,$j=2-$w)for 0..99;$c}

```

Try it online!

# Answer
> 2 votes
# Charcoal, 22 bytes

```
Ｉ↨Ｅ⌕Ａθη⊙↔⁻⌕Ａθηι∧λ‹λＬη¹

```

Try it online! Link is to verbose version of code. Explanation: Conveniently, Charcoal's `FindAll` command also includes overlapping matches.

```
     θ                  First input
      η                 Second input
   ⌕Ａ                   Find all matches
  Ｅ                     Map over positions
          ⌕Ａθη          All matches
        ↔⁻              Absolute difference with
              ι         Current match
       ⊙                Does any difference satisfy
                λ       Current difference
               ∧        Non-zero and
                  λ     Current difference
                 ‹      Less than
                   Ｌ    Length of
                    η   Second string
 ↨                   ¹  Take the sum
Ｉ                       Cast to string
                        Implicitly print

```

I don't use `Sum` here because it doesn't output `0` for an empty list.

# Answer
> 1 votes
# 05AB1E, 18 bytes

```
.sIÅ?ƶ0KDδαIg‹O1›O

```

Port of *@JonathanAllan*'s Jelly answer.

Try it online or verify all test cases.

**Explanation:**

```
.s                  # Get all suffices of the (implicit) input-string
  IÅ?               # Check for each if they start with the second input-string
                    # (1 if truthy; 0 if falsey)
     ƶ              # Multiply each value by their 1-based index
      0K            # Remove all 0s
         δ          # Apply double-vectorized,
        D           # with a copy of itself:
          α         #  Get the absolute different between the values
           Ig‹      # Check for each that it's lower than the length of the second input
              O     # Sum the checks of each row together
               1›   # Check for each whether it's larger than 1
                 O  # And sum those checks together again
                    # (after which the result is output implicitly)

```

# Answer
> 1 votes
# APL(Dyalog Unicode), 20 bytes SBCS

```
+/1<1⊥≢⍤⊣>∘|∘.-⍨⍤⍸⍤⍷

```

Try it on APLgolf!

A train submission which takes `b` on the left, and `a` on the right.

-2 bytes from Adám(helped trainify the function)

## Explanation

```
                   ⍷ boolean array where b occurs in a
                 ⍸⍤  indices of 1s in it
            ∘.-⍨⍤    all pairwise differences
           |         take the absolute value of it(vectorized)
      ≢⍤⊣            length of b
         >           greater than the absolute values?(vectorizes)
    1⊥               sum the columns of that result
  1<                 are they >1?
+/                   sum the result

```

# Answer
> 1 votes
# Perl 5 (`-00p`), 54 bytes

```
$_=/
(.+)(.*\1)$/?()=/(?=$1$2$2)|(?<=$1)$2$2(?!$2)/g:0

```

Try it online!

# Answer
> 1 votes
# Japt, 12 bytes

Been quite a while since I've done any Japt, probably has some room for improvement.

```
ðV
äÏ-X<Vl
è

```

Try it out here.

Explanation:

```
ðV      # Get all indices of needle in input
äÏ-X<Vl # For every consecutive pair in the result, check if their distance is small enough that they overlap
è       # Return the number of items that were true

```

---
Tags: code-golf, string, counting, subsequence
---


title: Calculate the date of Easter

text:
# Question
Title: Calculate the date of Easter
Your function or program should take a year as input and return (or print) the date (in the Gregorian calendar) of that years Easter (not the Eastern Orthodox Easter). The date returned should be formatted according to ISO 8601, but with support for years greater than 9999 (such as *312013-04-05* or *20010130*), and it only needs to work with years greater than or equal to **1583** (the year of the adoption of the Gregorian calendar), and years less than or equal to **5701583** (as that is when the sequence of Easter dates starts to repeat itself).

Examples:

```
e(5701583) = 5701583-04-10
e(2013)    = 2013-03-31
e(1583)    = 1583-04-10
e(3029)    = 30290322
e(1789)    = 17890412
e(1725)    = 17250401

```

The use of built-in functions for returning the date of easter is boring and therefore disallowed. Shortest answer (in characters) wins.

*Resources:*

# Answer
## GolfScript (85 chars)

```
~:^100/.)3*4/.@8*13+25/-^19%.19*15+@+30%.@11/+29/23--.@-^.4/++7%97--^0@.31/100*\31%)+

```

Sample usage:

```
$ golfscript.rb codegolf11132.gs <<<2013
20130331

```

Note that this uses a different algorithm to most of the current answers. To be specific, I've adapted the algorithm attributed to Lichtenberg in the resource linked by Sean Cheshire in a comment on the question.

The original algorithm, assuming sensible types (i.e. not JavaScript's numbers) and with an adaptation to give month\*31+day (using day offset of 0) is

```
K = Y/100
M = 15 + (3*K+3)/4 - (8*K+13)/25
S = 2 - (3*K+3)/4
A = Y%19
D = (19*A+M) % 30
R = (D + A/11)/29
OG = 21 + D - R
SZ = 7 - (Y + Y/4 + S) % 7
OE = 7 - (OG-SZ) % 7
return OG + OE + 92

```

I extracted a common subexpression and did some other optimisations to reduce to

```
K = y/100
k = (3*K+3)/4
A = y%19
D = (19*A+15+k-(8*K+13)/25)%30
G = 23+D-(D+A/11)/29
return 97+G-(G+y+y/4-k)%7

```

This approach has slightly more arithmetic operations than the other one (Al Petrofsky's 20-op algorithm), but it has smaller constants; GolfScript doesn't need to worry about the extra parentheses because it's stack-based, and since each intermediate value in my optimised layout is used precisely twice it fits nicely with GolfScript's limitation of easy access to the top three items on the stack.
> 5 votes

# Answer
# Python 2 - 125 120 119 chars

This is Fors's answer shamelessly ported to Python.

```
y=input()
a=y/100*1483-y/400*2225+2613
b=(y%19*3510+a/25*319)/330%29
b=148-b-(y*5/4+a-b)%7
print(y*100+b/31)*100+b%31+1

```

**Edit**: Changed last line from `print"%d-0%d-%02d"%(y,b/31,b%31+1)` to save 5 characters. I would have loved to represent `10000` as `1e4`, but that would produce floating point necessitating a call to `int`.

**Edit2**: Thanks to Peter Taylor for showing how to get rid of that `10000` and save 1 character.
> 5 votes

# Answer
# PHP 154

**150** chars if I switch to YYYYMMDD instead of YYYY-MM-DD.

```
<?$y=$argv[1];$a=$y/100|0;$b=$a>>2;$c=($y%19*351-~($b+$a*29.32+13.54)*31.9)/33%29|0;$d=56-$c-~($a-$b+$c-24-$y/.8)%7;echo$d>31?"$y-04-".($d-31):"$y-03-$d";

```

With Line Breaks:

```
<?
$y = $argv[1];
$a = $y / 100 |0;
$b = $a >> 2;
$c = ($y % 19 * 351 - ~($b + $a * 29.32 + 13.54) * 31.9) / 33 % 29 |0;
$d = 56 - $c - ~($a - $b + $c - 24 - $y / .8) % 7;
echo $d > 31 ? "$y-04-".($d - 31) : "$y-03-$d";

```

Useage: `php easter.php 1997`
Output: `1997-03-30`

Useage: `php easter.php 2001`
Output: `2001-04-15`
> 4 votes

# Answer
# dc: 106 characters

```
?[0n]smdndsy100/1483*ly400/2225*-2613+dsa25/319*ly19%3510*+330/29%sb148lb-5ly*4/la+lb-7%-d31/0nn31%1+d9>mp

```

Usage:

```
> dc -e "?[0n]smdndsy100/1483*ly400/2225*-2613+dsa25/319*ly19%3510*+330/29%sb148lb-5ly*4/la+lb-7%-d31/0nn31%1+d9>mp"
1725
17250401
>

```

This should be able to be shortened by using 'd' and 'r' instead of all the loads and stores.
> 4 votes

# Answer
# C: 151 148 characters

```
y;a;b;main(){scanf("%d",&y);a=y/100*1483-y/400*2225+2613;b=(y%19*3510+a/25*319)/330%29;b=148-b-(y*5/4+a-b)%7;printf("%d-0%d-%02d\n",y,b/31,b%31+1);}

```

And the same code, but better formatted:

```
#include <stdio.h>

int y, a, b;

int main() {
    scanf("%d", &y);

    a = y/100*1483 - y/400*2225 + 2613;
    b = (y%19*3510 + a/25*319)/330%29;
    b = 148 - b - (y*5/4 + a - b)%7;

    printf("%d-0%d-%02d\n", y, b/31, b%31 + 1);
}

```

There are frightfully many algorithms for calculating the date of Easter, but only a few of them are well suited for code golfing.
> 3 votes

# Answer
# Javascript 162 156 145

```
function e(y){alert(y+"0"+((d=56-(c=(y%19*351-~((b=(a=y/100|0)>>2)+a*29.32+13.54)*31.9)/33%29|0)-~(a-b+c-24-y/.8)%7)>(f=31)?4:3)+(d-f>0&d-f<10?0:"")+(d>f?d-f:d))}

```

Inspired by @jdstankosky's PHP solution... Provides YYYYMMDD result...

Now narrowed down to:

```
alert((y=prompt())+0+((d=56-(c=(y%19*351-~((b=(a=y/100|0)>>2)+a*29.32+13.54)*31.9)/33%29|0)-~(a-b+c-24-y/.8)%7)>(f=31)?4:3)+(d-f>0&d-f<10?0:"")+(d>f?d-f:d))

```

Now asks for input... reduced literal string of "0" to 0 and let loose typing work to my advantage! :)

Reduced further to take ES6 into account...

`e=y=>y+"0"+((d=56-(c=(y%19*351-31.9*~((b=(a=y/100|0)>>2)+29.32*a+13.54))/33%29|0)-~(a-b+c-24-y/.8)%7)>(f=31)?4:3)+(d-f>0&d-f<10?0:"")+(d>f?d-f:d)`
> 3 votes

# Answer
## APL 132

This algorithm calculates the number of days Easter lies relative to the beginning of March. The date is returned in the YYYYMMDD format as allowed in the question:

```
E y
(a b)←⌊((3 8×⌊y÷100)+¯5 13)÷4 25
c←7|y+(⌊y÷4)-a-e←⌊d-((19×d←30|(227-(11×c)-a-b))+c←19|y)÷543
+/(10*4 2 0)×y,(3+i>31),(61⍴⍳31)[i←e+28-c]

```

Taking the original test cases:

```
      E 2013
20130331
      E 1583
15830410
      E 3029
30290322
      E 1789
17890412

```
> 2 votes

# Answer
# Javascript 134 Characters

Using a slightly modified Al Petrofsky's 20-op algorithm to allow a simpler conversion into the year-month-date format.

This provides additional 14 characters shorter code from the answer provided by WallyWest

## The Original Al Petrofsky's Code:

```
    a =Y/100|0,
    b =a>>2,
    c =(Y%19*351-~(b+a*29.32+13.54)*31.9)/33%29|0,
    d =56-c-~(a-b+c-24-Y/.8)%7;

```

Last line changed to:

```
d =148-c-~(a-b+c-24-Y/.8)%7;

```

## 1. 138 Characters With the format YYYY-MM-DD

```
e=y=>(c=(y%19*351-31.9*~((b=(a=y/100|0)>>2)+29.32*a+13.54))/33%29|0,d=148-c-~(a-b+c-24-y/.8)%7,y+'-0'+(d/31|0)+"-"+((o=d%31+1)>9?o:'0'+o))

console.log(e(2021));
console.log(e(2022));
console.log(e(5701583));
console.log(e(2013));
console.log(e(1583));
console.log(e(3029));
console.log(e(1789));
console.log(e(1725));
```

## 2. 134 Characters With the format YYYYMMDD

```
e=y=>(c=(y%19*351-31.9*~((b=(a=y/100|0)>>2)+29.32*a+13.54))/33%29|0,d=148-c-~(a-b+c-24-y/.8)%7,y+'0'+(d/31|0)+((d=d%31+1)>9?d:'0'+d))

console.log(e(2021));
console.log(e(2022));
console.log(e(5701583));
console.log(e(2013));
console.log(e(1583));
console.log(e(3029));
console.log(e(1789));
console.log(e(1725));
```
> 1 votes

# Answer
# Fortran (GFortran), 179 bytes

```
READ*,I
J=I/100*2967-I/400*8875+7961
K=MOD(MOD(I,19)*6060+(MOD(MOD(J/25,59),30)+23)*319-1,9570)/330
L=K+28-MOD(I*5/4+J+K,7)
WRITE(*,'(I7,I0.2,I0.2)')I,(L-1)/31+3,MOD(L-1,31)+1
END

```

Try it online!

Uses the "Emended Gregorian Easter" algorithm (Al Petrofsky) from the second resource link. Strangely, it fails for year 5701583 (and, apparently, only for this year), predicting the Easter as one week earlier. Prints the date in `YYYYYYYMMDD` format, with some leading spaces if the year has less then seven digits.
> 0 votes

---
Tags: code-golf, date
---


title: Identify the Kaomoji!

text:
# Question
Title: Identify the Kaomoji!
## Background

This is loosely based on the now closed Kaomoji question asked a few hours ago.

Kaomojis are sequences of characters designed to express a given emotion. In this , you'll be writing a program that takes a Kaomoji as input, and must output the emotion expressed by the Kaomoji.

## Input

A Kaomoji. In this challenge, there are 13 categories of emotions the kaomojis can express:

1. Joy
2. Love
3. Embarrassment
4. Sympathy
5. Dissatisfaction
6. Anger
7. Sadness
8. Pain
9. Fear
10. Indifference
11. Confusion
12. Doubt
13. Surprise

You will be given one kaomoji from any of these lists as input. This link contains all of the kaomojis in this challenge. Here's a pastebin version.

## Output

Your program should output the emotion expressed by the kaomoji. You can express this as an integer (i.e., Joy = 1, Love = 2, etc), or output a string containing the emotion.

## Scoring

Your score is (B+1)\*exp(3W/(360-W)), where B is the number of bytes in your program, and W is the number of kaomojis that your program incorrectly categorizes. Lowest score wins!

# Answer
> 6 votes
# JavaScript (ES6), Score 643

### ~~656 651 646~~  642 bytes, no error

Returns an integer from **1** to **13**.

```
s=>`qv%s!u.r0vPyqv*s"r'yqyu@y2r%{ }1u!v(u{y8|!ru;rur&z+z,w'z-{){{0x'r*z/{Py$t w#z,xFt,}qzr.{#s$t%vv6{@s&v z$x@{!{6v,sCr6s<v z.r s*w=w,r0u5s r){,y!s-s%v8t.xrqyWr7r?z#uBz9r&v#v5yBw+w"})vNw-u4sz)y"zEu/z r"}/rqw w\\t0|(r*rw(uAw&v {uYw#x wqz*|)v2u/|'v!r#sBs}0w&r2y&s r%r6w+}){"r2{-usqw'}C|/v$y={!r!x!t/rt>r1r"svuCy*{qr>v1x2r6x#{5{.wv8wGwqr!r:vJ|#r#u%uqst-}'r"z\`zqw uHy$sYr-z0w#|3{8x7vqz.w!|Ez$uvw!z.{t'w+{5x&|.xmrt"s,u"vuqwy{$t5u&s'wAv"vsTw#z%u*z0s r/w v#}+w'r9}0r0|AvxHv,r*}qw:x r3w}!u0v(w{qvv"y.rSr0w4yr#r.}qw"}%s"v#r!w!u/| tCs u`.replace(/[ -p]/g,c=>"q".repeat(c[C='charCodeAt']()-30))[C]([...s].map((c,i)=>s^=c[C]()<<i%5)|s%8788*3672%4051)%56

```

Try it online!

Or test all kaomojis.

### How?

The input string is turned into an integer **N** with:

```
[...s].reduce((p, c, i) => p ^ c.charCodeAt() << i % 5, 0)

```

(using `.map()` instead of `.reduce()` in the golfed code)

Example for `٩(◕‿◕｡)۶`:

```
 code | << |  shifted bit-mask
------+----+--------------------
 1641 |  0 |        11001101001
   40 |  1 |            101000.
 9685 |  2 |   10010111010101..
 8255 |  3 |  10000000111111...
 9685 |  4 | 10010111010101....
65377 |  0 |   1111111101100001
   41 |  1 |            101001.
 1782 |  2 |      11011110110..
------+----+--------------------
       XOR = 110010100100101110 = 207150

```

In the lookup string:

* The emotions are encoded as `'q'` to `'}'` (ASCII codes 113 to 125).
* The characters `' '` to `'p'` (ASCII codes 32 to 112) encode a run of consecutive `'q'` (which, in addition to 'joy', also depicts an unused slot). The length of such a run is `ord(c) - 30` (minimum = 2, maximum = 82).

We first expand the lookup string to 4048 characters by replacing `/[ -p]/g` with the runs of `'q'` and then extract the relevant character with the following hash formula, which was found by brute-forcing some random values during a few minutes:

```
N % 8788 * 3672 % 4051

```

The final answer is the ASCII code of the character modulo 56.

---
Tags: code-challenge, classification
---