Create a FizzBuzz compiler Welcome to the world of compiler golf. Your task is to write a program that generates another program to play a variant of FizzBuzz on spec.

Your compiler

Write a compiler that generates variants of the FizzBuzz program to spec. The spec of this variant is expressed in the form of an array of integer/string pairs.


The input may be in any form that is convenient to your language. (My examples use n:xxxx, but this is just for illustrative purposes.)
Each integer input may only be used once per invocation of your compiler. 
The integer of each pair will have a value of at least one. 
The string of each pair will be made of only exactly four ASCII letters.
The output must be a single complete program that conforms to the rules below.
The output may be in any convenient form, as long as it is a textual program. (So no returning lambda expressions.)


Behavior is undefined for inputs not conforming to the above rules.

Your generated FizzBuzz program

The program generated by your compiler will take a single integer, n, as input. It will output a sequence of numbers starting from one up to and including n, replacing numbers with FizzBuzz strings when required.


The generated program must be in the same language as the compiler.
The input n may be in any form convenient to your language.
n will have a value of at least one.
A number that is a multiple of at least one of the integers input to the compiler must be replaced by all of the strings paired with those integers joined together.
A number that is not to be replaced by a FizzBuzz string must be output in decimal ASCII.


For example;

&gt; GenFizzBuzz 3:Fizz 5:Buzz
&gt; a.out 5
1
2
Fizz
4
Buzz


Scoring

Your entry will be scored by the length of the programs your compiler generates added to the length of your compiler. Run your compiler many times with each the following parameters and add the lengths of the generated programs together with the length of the compiler to find your score.


Just Count. (No inputs - The generated program will count 1 to n without replacements.)
Just Golf. (1:Golf - The generated program will output "Golf" n times.)
Classic FizzBuzz. (3:Fizz, 5:Buzz)


(Note that your compiler is required to generate code for any valid input, not just these listed.)
Python 3 - 168 162 + 230 = 392
Oh, Python, you try so hard, but multiplying the import sys;sys.argv stuff by 4 really hurts!
import sys;a=eval(sys.argv[1])
print(&quot;import sys\nfor i in range(1,int(sys.argv[1])+1):print(&quot;+&quot;+&quot;.join('&quot;%s&quot;*(i%%%d==0)'%t for t in a)+(a and&quot;or str(i))&quot;or&quot;i)&quot;))

Output programs:
import sys
for i in range(1,int(sys.argv[1])+1):print(i)
import sys
for i in range(1,int(sys.argv[1])+1):print(&quot;Golf&quot;*(i%1==0)or str(i))
import sys
for i in range(1,int(sys.argv[1])+1):print(&quot;Fizz&quot;*(i%3==0)+&quot;Buzz&quot;*(i%5==0)or str(i))


Expected input for the main program is an eval-able sequence of Python tuples or '()' for no input. (You did say &quot;convenient&quot;.) Example input: '()', '(&quot;Golf&quot;,1),', '(&quot;Fizz&quot;,3),(&quot;Buzz&quot;,5)' Note quoting for shell and trailing comma for one input.

Fixed 1am mistake by changing from dict (undefined ordering!) to tuples.

Expected input for the other programs is just the number