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>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int t=0;
	while(1){
		int a,b;
		cin>>a>>b;
		if(a==0&&b==0)break;
		if(!)puts("");
		int fg=0;
		for(int  i=a;i<=b;i++){
			if(!(i%400)){
				cout<<i<<endl;
				fg=1;
			}
			else if(!(i%100))continue;
			else if(!(i%4)){
				cout<<i<<endl;
				fg=1;
			}
		}
		if(!fg)cout<<"NA"<<endl;
		t++;
	}
	return 0;
}

C++: #include <stdio.h>
 
int leap_year(int, int);
 
int main(void)
{
    int a, b;
    while (1) {
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) {
            break;
        }
        leap_year(a, b);
//        printf("\n");
    }
    return 0;
}
 
int leap_year(int a, int b)
{
    int leap_year_number = 0;
    for (int i = a; i <= b; i++) {
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
            printf("%d\n", i);
            leap_year_number += 1;
        }
    }
    if (leap_year_number == 0) {
        printf("NA\n");
    }
    return 0;
}

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

using namespace std;

void uru(int c, int d) {
	int counter = 0;

	for (int i = c; i <= d; i++) {
		if (i % 4 == 0) {
			if (i % 100 == 0) {
				if (i % 400 == 0) {
					cout << i << endl;
					counter++;
				} 
			} else {
				cout << i << endl;
				counter++;
			}
		}
	}
	if (counter == 0) {
		cout << "NA" << endl;
	}
	
	return;
}

int main() {
	int a,b;

	while (cin >> a >> b) {
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
	}
	return 0;
}

C++: /*
    2014.07.04 1230~1238
    C language Lecture week ∞
*/

#include <stdio.h>

int leap_chk ( int year );

int main (void) {
    
    int init;
    int last;
    
    int count = 0;
    
    scanf ( "%d", &init );
    scanf ( "%d", &last );
    
    for ( int ly = init; ly <= last; ly ++ ) {
        if ( leap_chk ( ly ) ) {
            printf ( "%d\n", ly );
            count ++;
        }
    }
    
    if ( count == 0 ) {
        printf ( "NA\n" );
    }
    printf ( "\n" );
    
    return 0;
    
}

int leap_chk ( int year ) {
    
    if ( year % 4 == 0 ) {
        if ( year % 100 == 0 ) {
            if ( year % 400 == 0 ) {
                return 1;
            } else {
                return 0;
            }
        } else {
            return 1;
        }
    } else {
        return 0;
    }
    
}

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

using namespace std;

class Solver{
public:
	static void solve() {
		int a, b;
		cin >> a >> b;
		vector<string> res;

		while (a != 0 && b != 0) {
			int cnt = 0;
			for (int i = a; i <= b; i++) {
				if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
					res.push_back(to_string(i));
					cnt++;
				}
			}
			if (cnt == 0)res.push_back("NA");
			cin >> a >> b;
			if (a != 0 && b != 0)res.push_back("");
		}

		for (int i = 0; i < res.size(); i++)cout << res[i] << endl;
	}
};

int main() {
	Solver::solve();
}

C++: #include<cstdio>
#include<iostream>
#include<utility>

#define NMAX 1000000

using namespace std;

int main(void){

	int a,b;
	bool f=false;

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

	return 0;
}

C++: #include <iostream>
#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 <ctime>
using namespace std;
 
#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999
 
#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
 
typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;
 
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
 
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;
 
namespace std {
    bool operator<(const P a, const P b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}
 
int main() {
    int a,b;
    while(cin >> a >> b) {
        vector<int> ans;
        rep(i,a,b+1) {
            if(i % 400 == 0) ans.pb(i);
            else if(i % 100 != 0 && i % 4 == 0) ans.pb(i);
        }
        if(ans.empty()) cout << "NA" << endl;
        else {
            rep(i,0,ans.size()) cout << ans[i] << endl;
        }
        cout << endl;
    }
    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;
		if(s==1)puts("");
		s=1;
		scanf("%d %d", &a, &b);
		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 <stdio.h>
#include <stdbool.h>

bool is_leap_year(int y);
int get_leap_years(int* ly_list, y_bgn, y_end);

int main()
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々1000個しかない

    bool first_set = true; //一つ目のセットの前にだけは改行を入れてはいけないので

    while (true) {
        int year_begin, year_end;

        //読み込み
        scanf("%d %d", &year_begin, &year_end);

        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }

        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);

        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //putcharは一文字だけ出力する関数です
        }

        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
        
    }
}

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

int get_leap_years(int* ly_list, y_bgn, y_end)
{
    int count = 0;
    for ( int ly = y_bgn; ly <= y_end; ly ++ ) {
        if ( is_leap_year ( ly ) == true ) {
            ly_list[count] = ly;
            count ++;
        }
    }
    return count;
}