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<string>
using namespace std;
int main(){
	int a,b,count;
	while(true){
	    cin>>a>>b;
		cout<<endl;
		count=0;
		if(a==0&&b==0)
			break;
		bool h=false;
		for(int i=a;i<=b;i++){
			bool t=false;
			if(i%4==0)
				t=true;
			if(i%100==0)
				t=false;
			if(i%400==0)
				t=true;
			if(t==true){
				cout<<i<<endl;
				h=true;
			}
		}
		if(h==false)
			cout<<"NA"<<endl;
	}
    return 0;
}

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

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	while(cin >> a >> b){
		z = -1;
		if (a == 0 && b == 0) { break; }
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == -1){
			cout << "NA" << endl;
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

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

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

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

int main(void){
	int a,b;
	bool f = false;
	while(cin >> a >> b){
		if(a==0&&b==0)break;
		if(f) cout << "\n";
		f = true;
		bool na = false;
		for(int i=a;i<=b;i++){
			if(isleapyear(i)){
				cout << i << "\n";
				na = true;
			}
		}
		if(!na)cout << "NA\n";
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    //cout << fixed << setprecision(7);

    int a, b;
    int cnt = 0;
    while (cin >> a >> b)
    {
        if (a == 0 && b == 0)
            break;
        if (cnt)
            cout << endl;
        vector<int> ans;
        for (int year = a; year <= b; ++year)
        {
            if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
                ans.push_back(year);
        }
        cnt++;
        if (ans.size() == 0)
        {
            cout << "NA" << endl;
        }
        else
        {
            for (auto e : ans)
                cout << e << endl;
        }
    }
    return 0;
}

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

int main(){
  int a, b;
  int j = 0;
  while(1){
    cin >> a >> b;
    if( !a && !b){
      break;
    }
    if(j != 0) cout << endl;
    int cnt = 0;
    for(int i = a; i <= b; i++){

      if(i%4 == 0){
	if(i%400 == 0){
	  cout << i << endl;
	  cnt++;
	}
	else if(i%100 != 0){
	  cnt++;
	  cout << i << endl;
	}
      }
    }
    if(cnt == 0) cout << "NA" << endl;
    j = 1;




  }

}

C++: // #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

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

signed main() {
    int A, B;
    while(cin >> A >> B, A || B) {
        int cnt = 0;
        for(int i=A; i<=B; i++) {
            if(is_leapyear(i)) {
                cout << i << endl;
                cnt++;
            }
        }

        if(cnt == 0) cout << "NA" << endl;
        cout << endl;
    }
    return 0;
}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    scanf("%d %d", &first_year, &last_year);
    while (1) {
        if (first_year == 0 && last_year == 0) {
            break;
        } else {
            printf("\n");
            leap_year(first_year, last_year);
            scanf("%d %d", &first_year, &last_year);
        }
    }
    return 0;
}

int leap_year(int first_year, int last_year)
{
    int count = 0;
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
    return 0;
}

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

int main(){
	bool flag = true;
	int i,j,count;
	static bool year[3001];
	for(int i=0;i<3001;i++){
		if(i % 4 == 0){
			if (i % 100 == 0){
				if(i % 400 == 0){
					year[i] = true;
				}
			}
			else{
				year[i] = true;
			}
		}
	}
	while(cin >> i >> j && (i!=0&&j!=0)){
		if(!flag) cout << "\n";
		flag = false;
		count = 0;
		for(int x = i;x<=j;x++){
			if(year[x] == true){
				cout << x << endl;;
				count++;
			}
		}
		if(count == 0) cout << "NA" << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int main(void)
{
    int start, finish;
    int exist;
    while(1){
        exist = 0;
        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 = 1;
            }
        }
        if (exist == 0) {
            printf("NA\n");
        }
        printf("\n");
    }
    return 0;
}