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>
#include<vector>

using namespace std;

int main(){
  int i, a, b, leap, count=0;
  vector<int> leapyear;

  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    else if(count != 0) cout << endl;

    for(i=a; i<=b; ++i){
      if(i%400 == 0)
	leap = 1;
      else if(i%100 == 0)
	leap = 0;
      else if(i%4 == 0)
	leap = 1;
      else
	leap = 0;

      if(leap == 1)
	leapyear.push_back(i);
    }

    if(leapyear.size() == 0){
      cout << "NA" << endl;
    }else{
      for(vector<int>::size_type i=0; i != leapyear.size(); ++i)
	cout << leapyear[i] << endl;
    }

    leapyear.clear();
    ++count;
  }

C++: #include <iostream>
#include <cstdio>
int main(){
	int a, b, d = 0;
	while(scanf("%d%d", &a, &b), a && b){
		if(d)puts("");
		else d = 1;
		int c = 0;
		for(;a<=b;a++){
			if(a % 4 == 0){
				if(a % 100 == 0){
					if(a % 400 == 0){c++, printf("%d\n", a);}
				}
				else c++, printf("%d\n", a);
			}
		}
		if(!c)puts("NA");
	}
}

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");
	}
}
	
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 <cstdio>
using namespace std;

int a, b;
bool is_first = true;

int main() {
  while (1) {
    scanf("%d%d", &a, &b);
    if (a == 0 && b == 0) return 0;
    if (!is_first) puts("");
    is_first = false;

    bool found = false;
    for (int i=a; i<=b; i++) {
      if (i%400 == 0) {
        printf("%d\n", i);
        found = true;
      } else if (i%100 == 0);
      else if (i%4 == 0) {
        printf("%d\n", i);
        found = true;
      }
    }

    if (!found) puts("NA");
  }
}

C++: #include <stdio.h>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          judge_leap_year(start_year, end_year);
        } else {
          printf("NA\n");
         printf("\n");
        }
      }
    }
    return 0;
}

void judge_leap_year(int a, int b)
{
      int year;
      for (year = a; year <= b; year++) {
        if (year % 400 == 0) {
          printf("%d\n", year);
        } else if (year % 4 == 0 && year % 100 != 0) {
          printf("%d\n", year);
        }
      }
    printf("\n");
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define np string::npos
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define repc(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

typedef long long ll ;
typedef deque<int> di ;
typedef deque<ll> dl ;
typedef map<string,int> dict;
typedef complex<double> comd;
typedef pair<int,int> pii;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

double CalcDist(comd p1, comd p2){
  return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0));
}

  template <typename T>
void out(deque < T > d)
{
  for(size_t i = 0; i < d.size(); i++)
  {
    debug(d[i]);
  }
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

int a,b,x;
vector<int> leaps(3000,0);

void FilterLeap(){
  rep(i,3000){
    if((i+1) % 400 == 0 ||( (i+1) % 4 == 0 && (i+1)%100 != 0)){
      leaps[i+1] = 1;
    }
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  FilterLeap();
  string s  = "";
  while(cin >> a >> b){
    if(a + b == 0) break;
    if(s.size() != 0) s+= "\n";
    x = 0;
    for(int i = a; i <=b ;++i){
      if(leaps[i] == 1){
        s += std::to_string(i)+"\n";
      }
      else{
        ++x;
      }
    }
    if(x == b-a+1){
      s += "NA\n";
    }
  }
  cout << s;
  return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<(b); i++)

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007



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


int main(){
	int a,b;
	bool f=false;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		if(f)cout<<endl;
		else f=true;
		vi v;
		for(int i=a; i<=b; i++){
			if(is_Leap(i))v.pb(i);
		}
		if(v.empty())cout<<"NA"<<endl;
		else{
			rep(i,v.size()){
				cout<<v[i]<<endl;
			}
		}
	}
}

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

int main(void){
  int y1, y2;
  int ind = 0;
  while(1){
    cin >> y1 >> y2;
    if(!(y1 | y2)){
      break;
    }
    if(ind == 0){
      ind++;
    }else{
      cout << endl;
    }

    int cnt = 0;

    for(int i=y1; i <= y2; i++){
      if(i%4 == 0){
	if(i%100 == 0){
	  if(i%400 == 0){
	    cout << i << endl;
	    cnt++;
	    continue;
	  }else{
	    continue;
	  }
	}else{
	  cout << i << endl;
	  cnt++;
	}
      }else{
	continue;
      }
    }
    if(cnt == 0)
      cout << "NA" << endl;
  }
  return 0;
}