Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func isLeapYear(y int) bool {
	return (y%4 == 0 && y%100 > 0) || (y%4 == 0 && y%400 == 0)
}

func cntLeap(y []int) {
	cnt := 0

	for i := y[0]; i <= y[1]; i++ {
		if isLeapYear(i) {
			cnt++
			fmt.Println(i)
		}
	}

	if cnt == 0 {
		fmt.Println("NA")
	}
}

func main() {
	num := 0

	for sc.Scan() {
		y := Sliceconvtoi()

		if y[0] == 0 && y[1] == 0 {
			break
		}

		if num > 0 {
			fmt.Println()
		}

		cntLeap(y)
		num++
	}

}

C++: #include <iostream>
using namespace std;
int main(void){
    int a, b;
    for(int i=0; i < 55; i++){
      cin >> a >> b;
      if(a==0 && b==0){
          break;
      }
      if(i != 0){
          cout << endl;
      }
      if(a%4 == 0){
          if(a == b && a%400 != 0 && a%100 == 0){
              cout << "NA" << endl;
          }else if(a+4 <= b){
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                  if(a%400 != 0 && a%100 == 0){
                    a += 4;
                  }else{
                    cout << a << endl;
                    a+=4;
                  }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 1){
          if(a+3 == b && a+3%400 != 0 && a+3%100 == 0){
              cout << "NA" << endl;
          }else if(a+3 <= b){
              a += 3;
              int c;
              c= b-a;
              for(int j=0; j <= c/4 ; j++){
                if(a%400 != 0 && a%100 == 0){
                a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 2){
          if(a+2 == b && a+2%400 != 0 && a+2%100 == 0){
              cout << "NA" << endl;
          }else if(a+2 <= b){
              a += 2;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                  a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
      
      if(a%4 == 3){
          if(a+1 == b && a+1%400 != 0 && a+1%100 == 0){
              cout << "NA" << endl;
          }else if(a+1 <= b){
              a += 1;
              int c;
              c = b-a;
              for(int j=0; j <= c/4; j++){
                if(a%400 != 0 && a%100 == 0){
                  a+=4;
                }else{
                  cout << a << endl;
                  a+=4;
                }
              }
          }else{
              cout << "NA" << endl;
          }
      }
    }
    
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;
const int N = 3001;

int main(void){
    bool isL[N];
    rep(i, N) isL[i] = (!(i % 4) && (i % 100 || !(i % 400)));

    for(int a, b, cnt = 0; cin >> a >> b, a;){
        if(cnt ++) cout << endl;

        bool ex = false;
        for(; a <= b; a ++) if(isL[a]) ex = cout << a << endl;

        if(!ex) cout << "NA\n";
    }
 
    return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	while (1) {
		bool check = false;
		for (int i = a; i <= b; i++) {
			if (i % 4 == 0 ) {
				if (i % 100 == 0 && i % 400 != 0) continue;
				check = true;
				cout << i << endl;
			}
		}
		if (check == false) cout << "NA" << endl;
		cin >> a >> b;
		if(a != 0 && b != 0) cout << endl;
		else break;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int a, b, count;
    while (1) {
        count = 0;
        scanf("%d %d", &a, &b);
        if ((a == 0) && (b == 0)) {
            break;
        } else {
            for (int i = a; i <= b; ++i) {
                if ((i % 4) == 0 && (!(i % 100) == 0 || (i % 400) == 0)) {
                    printf("%d\n", i);
                    ++count;
                }
            }
            if (count == 0) {
                printf("NA\n");
            }
        }
        printf("\n");
    }
    return 0;
}

C++: #include<stdio.h>
int main()
{
	int a,b,c,d=0;
	while(1){
		c=1;
		scanf("%d%d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		for(int i=a;i<=b;i++){
			if(i%4==0&&(i%100!=0||i%400==0)){
				printf("%d\n",i);
				c=0;
			}
		}
		if(c){
			printf("NA\n");
		}
		d=1;
		if(d){
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b;
	while(cin >> a >> b){
		bool flag = false, first=true;
		if(a==0 && b==0) break;
		if(!first) cout << endl;
		else first = false;
		for(int i=a; i<=b; i++){
			if(i%4==0 && ( i%100!=0 || i%400==0) ){
				cout << i << endl;
				flag = true;
			}
		}
		if(flag == false) cout << "NA" << endl;
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int start, finish;
    int exist;
    while(1){
        scanf("%d %d", &start, &finish);
        if (start == 0 && finish == 0) {
            break;
        }
        for(; start <= finish; start++) {
            if((start % 4 == 0 && start % 100 != 0) || start % 400 == 0) {
            printf("%d\n", start);
            ++exist;
            }
        }
        if (exist == 0) {
            printf("NA\n");
            exist = 0;
        }
    }
    return 0;
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (first == end) {
			printf("NA\n");
			count =count + 1;
		}
		if (i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) {
			printf("NA\n");
			count = count + 1;		
		}
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
	return first, end;
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}