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 = &quot;0&quot;
m2 = &quot;1&quot;
d1 = &quot;2&quot;
d2 = &quot;8&quot;


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

# The main program code.
# Each line must have the format:
# &lt;variable_name&gt; = T[&lt;string formed by concatenating string literals or other variables&gt;]
# Example:
variable_1 = T[&quot;12&quot; + m1 + &quot;3&quot; + &quot;4&quot;]
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 = &quot;0&quot; 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 (&quot;Solution 2&quot;), 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) -&gt; 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 &quot;combined score&quot; 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.
Score: 679685 (A=64, B=6)

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

# (d2 + 6) % 7 = (d2 - 1) % 7
d2_0d1 = T[&quot;6&quot; + 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[&quot;0&quot; + m1 + m2]

output = T[month_start + day_of_month]

Try it online! and try the Generator / Testing program!