[Question]
  [
Given a snippet of ***fizz buzz*** output with all numbers removed, fill in the correct numbers with the lowest possible values such that the ***fizz buzz*** snippet is correct. For the purposes of this challenge, `fizz` and `buzz` have their usual values of 3 and 5, respectively.
If the input is an invalid sequence of `fizz`, `buzz` and empty lines, then instead output just `zzubzzif` (with or without newlines).
Input and output may be newline separated lines, or whatever array-of-strings format is convenient to your language.
You may ignore or do whatever you like with capitalisation.
You will need to choose to handle one or more of these: `fizzbuzz`, `fizz buzz`, `buzz fizz`, etc, but you must choose at least one of these formats.
You may assume that all input is some sequence of `fizz`, `buzz` and empty lines.
# Examples
Input:
```
fizz
```
 
Output:
```
2
fizz
4
```
Input:
```
buzz
fizz
```
Output:
```
buzz
fizz
7
```
Input:
```
fizzbuzz
```
Output:
```
13
14
fizzbuzz
16
17
```
Input:
```
```
Output:
```
1
```
Input:
```
fizz
fizz
```
Output:
```
zzubzzif
```
Input:
```
```
Output:
```
zzubzzif
```
  
[Answer]
# Java, 205 bytes
```
s->{o:for(int i=0,j,h=s.length;++i<16;){for(j=h;j-->0;)if(s[j].contains("fizz")^(i+j)%3<1||s[j].contains("buzz")^(i+j)%5<1)continue o;String z=i+"";for(j=1;j<h;)z+="\n"+(i+j++);return z;}return"zzubzzif";}
```
Takes a `String[]` as input and returns a `String`.
Expanded, runnable code:
```
public class C {
    static final java.util.function.Function<String[], String> f = s -> {
        o:
        for (int i = 0, j, h = s.length; ++i < 16;) {
            for (j = h; j --> 0;) {
                if (s[j].contains("fizz") ^ (i + j) % 3 < 1 ||
                    s[j].contains("buzz") ^ (i + j) % 5 < 1) {
                    continue o;
                }
            }
            String z = i + "";
            for (j = 1; j < h;) {
                z += "\n" + (i + j++);
            }
            return z;
        }
        return "zzubzzif";
    };
    public static void main(String[] args) {
        System.out.print(f.apply(new String[]{"fizz", "", "buzz"}));
    }
}
```
[Answer]
# C#, 212 bytes
I did the unthinkable. I used a `goto` statement to break out of a loop!
```
string[]R(string[]a){for(int i,l=a.Length,n=0;n++<15;){for(i=l;i-->0;)if(((n+i)%3<1?"fizz":"")+((n+i)%5<1?"buzz":"")!=a[i])goto z;for(i=l;i-->0;)a[i]=a[i]==""?""+(n+i):a[i];return a;z:;}return new[]{"zzubzzif"};}
```
This takes advantage of the fact that the sequence must start within the first 15 elements.
Indentation and new lines for readability:
```
string[]R(string[]a){
    for(int i,l=a.Length,n=0;n++<15;){
        for(i=l;i-->0;)
            if(((n+i)%3<1?"fizz":"")+((n+i)%5<1?"buzz":"")!=a[i])
                goto z;
        for(i=l;i-->0;)
            a[i]=a[i]==""?""+(n+i):a[i];
        return a;
    z:;
    }
    return new[]{"zzubzzif"};
}
```
[Answer]
# CJam, 72 bytes
```
"zzubzzif":MaqN/:Q,_F+{)_[Z5]f%:!MW%4/.*s\e|}%ew{:sQ1$A,sff&:s.e|=}=N*o;
```
The program will [exit with an error](https://codegolf.meta.stackexchange.com/a/4781) if it has to print **zzubzzif**. 
Using the Java interpreter, STDERR can be closed to suppress an eventual error message. If you try the program in the [CJam interpreter](http://cjam.aditsu.net/#code=%22zzubzzif%22%3AMaqN%2F%3AQ%2C_F%2B%7B)_%5BZ5%5Df%25%3A!MW%254%2F.*s%5Ce%7C%7D%25ew%7B%3AsQ1%24A%2Csff%26%3As.e%7C%3D%7D%3DN*o%3B&input=%0A%0Afizzbuzz%0A%0A), ignore all output after the first line.
### How it works
```
"zzubzzif" e# Push that string.
:Ma        e# Save it in M and wrap in in an array.
qN/:Q      e# Split the input into lines and save in Q.
,_F+       e# Count the lines and add 15 to a copy of the result.
{          e# For each integer I between 0 and lines+14:
  )_       e#   Increment I and push a copy.
  [Z5]     e#   Push [3 5].
  f%       e#   Map % to push [(I+1)%3 (I+1)%5].
  :!       e#   Apply logical NOT to each remainder.
  MW%4/    e#   Push ["fizz" "buzz"].
  .*       e#   Vectorized string repetition.
  s\       e#   Flatten the result and swap it with I+1.
  e|       e#   Logical OR; if `s' pushed an empty string, replace it with I+1.    
}%         e#
ew         e# Push the overlapping slices of length "lines".
{          e# Find; for each slice:
  :s       e#   Cast its elements to string (e.g., 1 -> "1").
  Q1$      e#   Push the input and a copy of the slice.
  A,s      e#   Push "0123456789".
  ff&      e#   Intersect the slice's strings' characters with that string.
  :s       e#   Cast the results to string. This replaces "fizz", "buzz"
           e#   and "fizzbuzz" with empty strings.
  .e|      e#   Vectorized logical OR; replace empty lines of the input
           e#   with the corresponding elements of the slice.
  =        e#   Check the original slice and the modified input for equality.
}=         e# Push the first match or nothing.
           e# We now have ["zzubzzif"] and possibly a solution on the stack.
N*         e# Join the topmost stack item, separating by linefeeds.         
o          e# Print the result.
;          e# Discard the remaining stack item, if any.
```
[Answer]
# Perl, 140 bytes
```
$f=fizz;$b=buzz;@a=<>;@x=map{s!\d!!gr.$/}@s=map{$_%15?$_%3?$_%5?$_:$b:$f:$f.$b}(++$c..$c+$#a)while$c<15&&"@x"ne"@a";print$c<15?"@s":zzubzzif
```
**Explanation**
1. `@a` is the array of input lines
2. Inside the `while` loop,
3. `@s` has the generated fizz-buzz sequence
4. `@x` is the same as `@s` but with numbers replaced with empty strings and a new line appened to every element (to match with `@a`)
5. `$c` is a counter from 1 to 15
6. The loop runs till `@x` becomes the same as the input `@a`
7. Outside the loop, the output is `@s` or zzufzzib based on whether `$c` was in its limits or not
[Answer]
# Python, 176 Bytes
Could probably do a lot better, but first attempt at Golf. Tips appreciated :)
Shrunk
```
def f(a):l=len(a);g=lambda n:'fizz'*(n%3<1)+'buzz'*(n%5<1);r=range;return next(([g(x)or x for x in r(i%15,i%15+l)]for i in r(1,16)if all(g(i+x)==a[x]for x in r(l))),g(0)[::-1])
```
Original
```
def f(a):
  l = len(a)
  g = lambda n: 'fizz'*(n%3<1)+'buzz'*(n%5<1)
  r = range
  return next(
    (
      [g(x) or x for x in r(i % 15,i % 15 + l)]
      for i in r(1,16)
      if all(
        g(i + x) == a[x] for x in r(l)
      )
    ),
    g(0)[::-1]
  )
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 127 bytes
```
f=(n,j=1)=>j<99?(M=n.map((e,i)=>e?e:j+i)).some((e,i)=>e!=((J=j+i)%3?J%5?J:'buzz':'fizz'+(J%5?'':'buzz')))?f(n,j+1):M:'zzubzzif'
```
[Try it online!](https://tio.run/##jZNda4MwFIbv9yuyi5KEZorfRmaFDXZR1l@wDmpt7BSrUu0G/vnuWGuYYV8XITnnxPd5Lkwev8dNcszq9q6sduJ8TkNSsjw0aLjI7zmPyCostUNcEyJYBk0RiSCfZ5RqTXUQsnsbErIM@8HMipYzJ1oGeHvqOhzgNINtTvomxtcupTRKe9DcoMEqwF132nZdluJzUpVNVQitqPYkJS8YMzQkwI5fKb1RL1zy/rp0GVwvjR/8fPm75hj/L8wv8RuDIZOhJ4hhyGbo4dQfhtJjyB/PQ98wxtqwYNlDdZ25sDw559MsEyCmNU0zXTkFjsm/pllAsqSYpZhZwLEUN1u62cCxJ242kGzpZituDnAcxc2Rbg5wnImbCyRXurmKmwscV3HzpJsHHG/i5gHJk26e4uYDx1fcfOnmA8efuHEgcenGFTcOHD5x22hHURdxIojOkL6Hn2RdYnhMdZG1ZDj3r00UKFwgUUDRJm9EX@90GsEPFfS9tnquPsTxMW4EgZdEz58 "JavaScript (Node.js) – Try It Online")
I came across this challenge by accident after clicking on one of the answerers' profiles. Expects an array of lowercase strings.
## How?
FizzBuzz loops every 15 lines, which means that we can reasonably expect that by the time the start counter reaches 99, we will have looped through fizzbuzz a few times, hence allowing us to stop the recursion and instead output "zzubzzif".
If the counter is still less than 99, then we first fill in the falsy lines (empty strings) with their numbers, and check if it makes a valid FizzBuzz snippet using `some`. If one doesn't fit in, then recall the function with `j+1`. Otherwise return `M`.
[Answer]
# [Python 2](https://docs.python.org/2/), 173 bytes
```
import re
def f(u,i=0,s=""):
 exec"s+=`i%3/2*'Fizz'+i%5/4*'Buzz'or-~i`+' ';i+=1;"*100;s=s.replace("'","");return re.findall(' '.join(['\d+'if not x else x for x in u]),s)[0]
```
[Try it online!](https://tio.run/##JY67isMwFER7f4UQhCtZiuM8tlmjZov9CceQEF@RGxzJ6AFZF/l1ryDNDFOcmZn/0t27w5pND6Dhl5alGAwrPWcfEgtYjWiZFVmTaXU0nMvviuELbzwqc6HNcXeoP5yizdfuVMNPLsGH7ZsuChh0pMy@4/W@bbtoYhNwnq43FBy4Lm1dwJSDK0uNJTdep0kUqHl4cqKH86iALHM@sRfDKWIx60NRciwPUkfZt8M6B3JJlJdSrv8 "Python 2 – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 200 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 25 bytes
```
L:↵ƛ₍₃₅kF½ɽ*∑∴;l'vSǍ?⁼;h:[|kF⇩Ṙ
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyI9IiwiIiwiTDrihrXGm+KCjeKCg+KChWtGwr3JvSriiJHiiLQ7bCd2U8eNP+KBvDtoOlt8a0bih6nhuZgiLCIiLCJbXCJidXp6XCIsIFwiZml6elwiLCBcIlwiXSJd)
Modern golfing languages with fractional byte encodings amiright.
I got this down from 27.something bytes to 25 bytes in drafts through a lot of fiddling with element ordering.
## Explained
```
L:↵ƛ₍₃₅kF½ɽ*∑∴;l'vSǍ?⁼;h:[|kF⇩Ṙ
L:↵ƛ₍₃₅kF½ɽ*∑∴;                   # Generate fizzbuzz for the first (10 ** len(input)) numbers using the standard fizzbuzz approach.
               l                  # in windows of len(input)
                '                 # filtered to keep only
                 vSǍ              #   windows where all converted to string with digits removed
                    ?⁼            #   exactly equals the input
                       h:[|kF⇩Ṙ   # if that's an empty list, return the string "zzibzzuf", else the first item.
```
]