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 <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

bool isleap(int year) {
    return year%4==0 && (year%100!=0 || year%400==0);
}

void solve93(int a, int b) {
    int cnt = 0;
    FOR(i,a,b+1) {
        if (isleap(i)) cout << i << endl, cnt++;
    }
    if (cnt == 0) cout << "NA" << endl;
}

int main() {
    int a, b;
    bool start = true;
    while(cin >> a >> b, a+b) {
        if (!start) cout << endl;
        solve93(a, b);
        start = false;
    }
    return 0;
}

C++: #include <iostream>

int LeapYear (int x);
int main()
{
    int a,b;
    std::cin >> a >> b;
    while (true) {
        int n = 0;
        if (a == 0 && b == 0) {
	        break;
        } else {
            for (int i = a; i <= b; i++) {
                if (LeapYear (i) == 1) {
                    std::cout << i << std::endl;
                    n++;
            }				
        }
        if (n == 0) {
            std::cout << "NA" << std::endl;
        }
        std::cin >> a >> b;
        }
    }
    return 0;
}

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

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

int main(){
    int A=-1,B=-1;
    while(cin>>A>>B, A||B){
        if(~A || ~B) puts("");
        bool no = true;
        for(int i=A;i<=B;i++){
            if(i%4==0 || (i%100!=0 || i%400==0)) printf("%d\n",i);
        }
        if(no) puts("NA");
    }
    return 0;
}

C++: #include <iostream>

using std::cin;
using std::cout;
using std::endl;

bool is_leap(int y) {
	return (y%400 == 0) || (y%4 == 0 && y%100 != 0);
}

int main() {
	while (true) {
		int a,b;
		cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		}
		int delta = 1;
		bool have = false;
		for (int y = a;y <= b;y += delta) {
			if (is_leap(y)) {
				if (!have) {
					have = true;
				}
				if (delta == 1) {
					delta = 4;
				}
				cout << y << endl;
			}
		}
		if (!have) {
			cout << "NA" << endl;
		}
		cout << endl;
	}
}

C++: #include <stdio.h>
#include <stdbool.h>
 
bool is_leap_year(int y);
int  get_leap_years(int list[], int begin, int end);
 
int main(void)
{
    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]);
            }
        }
 
    }
}

int  get_leap_years(int list[], int begin, int end)
{
    int j;
    for (int year = begin; year <= end; year++) {
    if (is_leap_year(year)) {
    list[j] = year;
    j++;
    }
    }
    return j;
}

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

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

C++: #include <iostream>

int leap_year(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;
	}
}

int main()
{
	int a, b;
	
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int i = 0;
			for (int j = 0; a + j <= b; j++) {
				if (leap_year(a + j) == 0) {
					i++;
				} else {
					std::cout << a + j << std::endl;
				}
			}
			if ( i == a - b + 1) {
				std::cout << "NA" << std::endl;
			}
		}
		std::cout << std::endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

bool isleap (int year )
{
	return ( ( year % 4 == 0 ) && ( ( year % 100 != 0 ) || ( year % 400 == 0 ) ) );
}

int main()
{
	string str = "";
	vector < vector <int> > res;
	int size = 0;
	int i,j;

	while (getline (cin, str ) ){

		int a, b;
		stringstream ss(str);

		ss >> a >> b;

		if (a == 0 && b == 0){
			break;
		} // end if

		++size;
		res.resize(size);

		for (i = a; i <= b; ++i){
			if (isleap (i ) ){
				res[size - 1].push_back (i );
			} // end if
		}

		if (res[size - 1].empty() ){
			res[size - 1].push_back (-1 );
		} // end if

	} // end while

	for (i = 0; i < res.size(); ++i){
		for (j = 0; j < res[i].size(); ++j){
			if (res[i][j] == -1){
				cout << "NA" << endl;
				break;
			}else{
		 		cout << res[i][j] << endl;
			} // end if
		} // end for

		if (i != res.size() - 1){
			cout << endl;
		} // end for

	} // end loop
		
	return 0;
}

C++: #include <stdio.h>

int count_number(void);

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

C++: #include <iostream>

using namespace std;

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