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 <cstdio>

using namespace std;

#define YEAR_MAX 3000

bool reap[YEAR_MAX + 1];

int main()
{
	for (int i = 4; i < YEAR_MAX; i++){
		if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
			reap[i] = true;
		}
	}
	
	int a, b;
	bool flag;
	
	while (scanf("%d %d", &a, &b), !(a == 0 && b == 0)){
		flag = true;
		for (int i = a; i <= b; i++){
			if(reap[i]){
				printf("%d\n", i);
				flag = false;
			}
		}
		if (flag) printf("NA\n");
		puts("");
	}
}

C++: #include <iostream>
#include <vector>

using namespace std;

int main(void)
{
  int a, b;
  vector <int> leap;

  while (1) {
    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);
  if (leap.empty()) {
    cout << "NA" << endl;
    return 0;
  } else {
    for (int i = 0; i < leap.size(); i++)
      cout <<  leap[i] << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

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

C++: #include <stdio.h>
#include <stdbool.h>

int lpyrJudge(int x, int y);

int main(void)
{
    int sta, fin;
    printf("\n");
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
        }
    }
    return 0;
}

int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\??????????°????4????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
              printf("%d\n", i);
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>

int main(){

	int a,b;
	int i;
	int answer;
	int count;

	while(1){

		count = 0;

		scanf("%d %d",&a,&b);

		if(a == 0 && b == 0){
			break;
		}

		for(i = a; i < b; i++){
			if( i % 400 == 0 || i % 100 !=0 && i % 4 ==0){
				printf("%d\n",i);
				count ++;
			}
		}
		if(count == 0){
			printf("NA\n");
		}
	}

	return 0;
}

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

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

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

C++: #include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<utility>
#include<stack>

using namespace std;





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

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp make_pair
#define ERASE(v,i) (v).erase(remove(all(v),i),(v).end())
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define debug(x) cerr<<#x<<" = "<<(x)<<endl;
#define LINE cerr<<"LINE: "<<__LINE__<<endl;
inline int toInt(string s){int v;istringstream i(s);i>>v;return v;}
template<class T> inline string toString(T x){ostringstream o;o<<x;return o.str();}
template<class T> void pv(T a,T b){for(T it=a;it!=b;++it)cerr<<*it<<" ";cerr<<endl;}
const int INF = 1000000000;
const double PI = acos(-1.0), EPS = 1e-10;

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

int main() {
	bool isFirst = true;
	for(int a, b; cin >> a >> b, a || b;) {
		if(isFirst == false) cout << endl;
		bool f = false;
		for(int i = a; i <= b; i++) {
			if(isLeap(i)) {
				cout << i << endl;
				f = true;
			}
		}
		if(f == false) {
			cout << "NA" << endl;
		}
		
		isFirst = false;
	}
	return 0;
}

C++: #include<stdio.h>
/*与えられた期間の間のうるう年をすべて出力*/
void leap_year(int year1, int year2);

int main(void)
{
    while(1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else{
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{
    for(int i = year1; i <=year2; ++i){
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }
    }    
    printf("\n");
    printf("NA\n");
    printf("\n");
}

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

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

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

vector< int > LeapYear(int a, int b, vector<int > vec){
	for (int i = a; i <= b; i++){
		if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
			vec.push_back(i);
		}
	}
	return vec;
}

int main(){
	vector<int > vec;
	int a, b;
	while (cin >> a >> b, a || b){
		vec.clear();
		vec = LeapYear(a, b, vec);

		// output
		if (!vec.empty()){
			for (int i = 0; i < vec.size(); i++){
				cout << vec.at(i) << endl;
			}
		}
		else{
			cout << "NA" << endl;
		}
		cout << endl;
	}

	return 0;
}