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(int argc, char const* argv[])
{
	int a,b;

	while( cin >> a >> b && a ){
		int count = 0;
		for( int i = a;i <= b;i++ ){
			if( !(i % 4) ){
				if( !(i % 400) ){count++; cout << i << endl; continue;}
				else if( !(i%100) ) continue;
				cout << i << endl;
				count++;
			}
		}
		if( count == 0 ) cout << "NA" << endl;
		cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void)
{
	int i,a,b;
	bool year [3001]={0},s=0;
	
	for(i=1; i<3000; i++){
		if(i % 4 == 0){
			year[i] = 1;
		}
	}
	
	for(i=100; i<3000; i+=100){
		year[i] = 0;
	}
	for(i=400; i<3000; i+=400){
		year[i] = 1;
	}
	while(1){
		bool flag=0;
		scanf("%d %d", &a, &b);
		s=1;
		if(a==0)break;
		for(i=a;i<=b;i++){
			if(year[i] == 1){
				printf("%d\n",i);
				flag=1;
			}
		}
		if(flag==0)printf("NA\n");
		if(s==1)puts("");
	}
	
	return 0;
}

C++: #include <stdio.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

bool leap(int y) {
    if (y%4) return false;
    if (y%400==0) return true;
    return y%100;
}

int main() {
    for (int _q = 0;; _q++) {
        int a, b;
        scanf("%d%d", &a, &b);
        if (a == 0 && b == 0) return 0;
        if (_q) puts("");
        int c = 0;
        for (int i = a; i <= b; i++) if (leap(i)) {
            printf("%d\n", i);
            c++;
        }
        if (c == 0) puts("NA");
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>
#include <complex>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }





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

C++: #include <iostream>

using std::cin;
using std::cout;
using std::endl;

bool is_leap(int y) {
	return (y%400 == 0) || (y%4 == 0 && y%100 != 0);
}

int main() {
	bool first = true;
	while (true) {
		int a,b;
		cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		}
		if (first) {
			first = false;
		} else {
			cout << endl;
		}
		int delta = 1;
		bool have = false;
		for (int y = a;y <= b;y += delta) {
			if (is_leap(y)) {
				if (!have) {
					have = true;
				}
				if (delta == 1) {
					delta = 4;
				}
				cout << y << endl;
			}
		}
		if (!have) {
			cout << "NA" << endl;
		}
	}
}

C++: #include <iostream>
#include <vector>
 
using namespace std;
 
int main(void)
{
  int a, b;
  vector <int> leap;
 
  while (true) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      break;
    for (int i = a; i <= b; i++)
      if (i % 400 == 0 || (i % 100 && i % 4 == 0))
        leap.push_back(i);
    leap.push_back(-1);
  }
  
  bool hoge = false;
  for (int i = 0; i < leap.size()-1; i++) {
    if (leap[i] < 0 && hoge) {
      cout << "NA\n" << endl;
      hoge = false;
    } else if (leap[i] < 0) {
      cout << endl;
      hoge = true;
    } else {
      cout <<  leap[i] << endl;
      hoge = false;
    }
  }
  return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
 
int main()
{
	int a,b;	
	while(1){
		cin>>a>>b;		
		if(a==0 && b==0) return 0;

		if(a%4!=0) a=a-(a%4)+4;
		if((a%100==0)&&(a%400!=0)) a+=4;

		if(a>b) cout<< "NA" <<endl;
		else {
			for(int i=0;a<=b;a=a+i){
				if((a%100==0)&&(a%400!=0)) continue;
				cout << a << endl;
				i=4;	
			}
		}
		cout<<endl;
	}
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) 
	{	
		if (i % 400 == 0) {
		    count = count + 1;
			printf("%d\n", i);
		} 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 0;
}
	
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");
		}
	}
}

C++: #include <stdio.h>

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

C++: #include <cstdio>


int a, b;

bool ly[3001];

int main(){
    for(int i = 0; i <= 3000; i++){
        if(i % 400 == 0){
            ly[i] = true;
            continue;
        }

        if(i % 100 == 0){
            continue;
        }

        if(i % 4 == 0){
            ly[i] = true;
        }
    }

    bool f = false;
    while(scanf("%d %d", &a, &b) != EOF){
        if(a == 0 && b == 0) break;
        if(f) printf("\n");
        else f = true;

        bool j = true;
        for(; a <= b; a++){
            if(ly[a]){
                printf("%d\n", a);
                j = false;
            }
        }

        if(j) printf("NA\n");
    }

    return 0;
}