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;

#define N 3000

int main(void) {
	bool table[N]; //table[i]がtrueならうるう年
	int a, b;
	bool first;
	bool flag; //a-b間にうるう年があったらtrue;
	
	table[0] = 1;
	for(int i = 1; i < N; ++i) {
		if(i % 4 == 0) {
			if(i % 400 == 0) {
				table[i] = true;
			} else if(i % 100 == 0) {
				table[i] = false;
			} else {
				table[i] = true;
			}
		} else {
			table[i] = false;
		}
	}
	
	
	first = true;
	while(cin >> a >> b) {
		if(a == 0 && b == 0) break;
		
		if(!first) cout << endl;
		
		flag = false;
		for(int i = a; i <= b; ++i) {
			if(table[i]) {
				cout << i << endl;
				flag = true;
			}
		}
		
		if(!flag) cout << "NA" << endl;
		
		first = false;
	}
	
	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 % 400 == 0){
				year[i] = true;
			}
			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 <iostream>

using namespace std;

int main(){

    int a,b;
    int cou = -1;
    while(1){

        int count = 0;

        cin >> a >> b;
        if(a == 0 && b == 0) break;
        if(cou != -1) cout << endl;

        for(int i = a; i <= b; i++){
            cou++;
            if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
                cout << i << endl;
                count++;
            }

        }

        if(count == 0){
            cout << "NA" << endl;
        }
    }

    return 0;
}

C++: #include<stdio.h>
#include<stdbool.h>
//declare function                                                              
bool judgelpyear(int fstyear,int lastyear);

/*==============end of delaration====================================*/

int main(void){
    int fstimp;//first imput                                                    
    int secimp;//second imput                                                   
    do {
        scanf("%d %d", &fstimp, &secimp);
    }while(judgelpyear(fstimp, secimp) == true);
    return 0;
}

bool judgelpyear(int fstyear,int lastyear) {
    bool discovery = false;//if he can discover a leap year                     

    if(fstyear == 0 && lastyear == 0){
        return false;//end main                                                 
    }
    for(int i = fstyear; i <= lastyear; i++) {
        if(i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) {
            printf("%d\n", i);
            discovery = true;//he discovered at least one leap year             
        }
    }
    if(discovery == false) {
        printf("NA\n");
    }

    printf("\n");
    return true;//repeat scanning years                                         
}

C++: #include <stdio.h>

int main(void)
{
    int a, b, year, answer, i;
    i = 0;
    while(1) {
	scanf("%d %d", &a, &b);
	if (a == 0 && b == 0) {
	    break;
	}
	if (i != 0) {
	    printf("\n");
	}
	i++;
	answer = 0;
	for (year = a; year <= b; year++) {
	    if (year % 4 == 0) {
		if (year % 100 != 0) {
		    printf("%d\n", year);
		    answer++;
		} else if (year % 400 == 0) {
		    printf("%d\n", year);
		    answer++;
		}
	    }
	}
	if (answer == 0) {
   	    printf("NA\n");
	}
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
#include <algorithm>
#include <stdio.h>
int main(void)
{
	int a[1000], b[1000], i = 0, j, k;
	bool flag = false;
	while (1){
		cin >> a[i] >> b[i];
		if (a[i] == 0 && b[i] == 0) break;
		if (a[i] % 400 < 400 - 4 && a[i] % 400 != 0){ a[i] += 4 - (a[i] % 4); }
		i++;
	}
	for (j = 0; j < i; j++){
		if (j != 0) { printf("\n"); }
		for (k = a[j]; k <= b[j];k+=4){
			if (k % 100 == 0){
				if (k % 400 == 0) {
					printf("%d\n", k); 
					flag = true; 
				}
			}
			else {
				printf("%d\n", k);
				if (k % 400 > 400 - 4){
					printf( "%d\n", k + (400 - (k % 400)) ); 
				}
				flag = true;
			}
		}
		if (flag == false) { printf("NA\n"); }
		flag = false;
	}

	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;
		s=1;
		scanf("%d %d", &a, &b);
		if(s==1)puts("");
		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");
	}
	
	return 0;
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int hoge[1010];

int main() {
	int n,m;bool fir=true;
	while(n=in(),m=in()){
		if(!fir)cout<<endl;
		fir=false;
		int i;bool na=true;
		for(i=n;i<=m;i++){
			if(i%4?false:i%100?true:i%400?false:true){
				cout<<i<<endl;
				na=false;
			}
		}
		if(na)cout<<"NA\n";
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;


signed main(){
  int a,b;
  while(cin>>a>>b,a){
    vector<int> y;
    for(int i=a;i<=b;i++){
      if(i%4==0){
        if(i%100!=0)y.PB(i);
        else if(i%400==0)y.PB(i);
      }
    }
    if(y.size()==0){
      cout<<"NA"<<endl;
    }else{
      for(auto x:y)cout<<x<<endl;
    }
    cout<<endl;
  }
  return 0;
}

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