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 <stdio.h>
#include <stdbool.h>

void printLeapYear(int, int);
bool judgeLeapYear(int);

int main(void)
{
    int start_year, end_year;
    
    while (true) {
        scanf("%d%d", &start_year, &end_year);
        
        if (start_year == 0 && end_year == 0) {
            break;
        }
        
        printLeapYear(start_year, end_year);
        printf("\n");
    }
    
    return 0;
}

void printLeapYear(int start_year, int end_year)
{
    bool exist_leap_year = false;
    
    for (int year = start_year; year <= end_year; year++) {
        if (judgeLeapYear(year)) {
            exist_leap_year = true;
            printf("%d\n", year);
        }
    }

    if(!exist_leap_year) {
        printf("NA\n");
    }
}

bool judgeLeapYear(int year)
{
    if (year % 400 == 0) {
        return true;
    } else if (year % 100 == 0) {
        return false;
    } else if (year % 4 == 0) {
        return true;
    } else {
        return false;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

inline int in(){int x;std::cin>>x;return x;}

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */

int main(void)
{
  while (1){
    int a, b;
    bool frag = false;

    cin >> a >> b;
    if (a == 0 && b == 0) break;

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

  return 0;
}

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();
  while(cin >> a >> b){
    if(a + b == 0) break;
    x = 0;
    for(int i = a; i <=b ;++i){
      if(leaps[i] == 1){
        cout << i << endl;
      }
      else{
        ++x;
      }
    }
    if(x == b-a+1){
      cout << "NA" << endl;
    }
    cout << endl;
  }
  return 0;
}

C++: #include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int a[100], b[100];

int main() {

	int i;

	for (i = 0; i < 100 ; i++)
	{
		cin >> a[i] >> b[i];
		if (a[i] == 0 && b[i] == 0) break;
	}

	//iは要素数

	for (int j = 0; j < i; j++)
	{
		if (a[j] == 0 && b[j] == 0) break;

		bool ans = false;

		for (int k = a[j]; k <= b[j]; k++)
		{
			if (k % 4 == 0)
			{
				if (k % 400 == 0)
				{
					ans = true;
					cout << k << endl;
					continue;
				}
				if (k % 100 == 0)
					continue;
				ans = true;
				cout << k << endl;
			}
		}
		if (ans == false) cout << "NA" << endl;
		if (j != i - 1) cout << endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

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

C++: #include<cstdio>
#include<iostream>
using namespace std;
main(){
  int a,b,n[3000],i,l;
  while(1){
    cin >> a >> b;
    if(a==0 && b==0){
      break;
    }
    l=0;
    for(i=a;i<=b;i++){
      if(i%400==0){
	n[l]=i;
	l++;
      }
      else if(i%100!=0 && i%4==0){
	n[l]=i;
	l++;
      }
    }
    if(l==0){
      cout << "NA" << endl;
    }
    else{
      for(i=0;i<l;i++){
	cout << n[i] << endl;
      }
    }
  }
}

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

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