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 <cstdlib>

using namespace std;

class Date{
private:
	int m_year, m_month, m_day;
	bool m_hasDate;
public:
	Date(int year, int month, int day){
//		cout<<"Date(int year, int month, int day) called"<<endl;
		this->setDate(year, month, day);
	}
	Date(){
//		cout<<"Date() called"<<endl;
		this->setDate(0,0,0);
	}
	virtual ~Date(){
//		cout<<"~Date() called"<<endl;
	}
	void setDate(int year, int month, int day){
		m_year = year; m_month = month; m_day = day;
		m_hasDate = true;
//		cout<<"setDate(int year, int month, int day) called"<<endl;
	}
	void getDate(int &year, int &month, int &day){
		year = m_year; month = m_month; day = m_day;
	}
	int isLeapYear(){
		try{
			if(!m_hasDate){ throw "Date_is_not_setted"; }
		}catch(char* str){
			return -1;
		}
		if (m_year % 400 == 0){ return true;}
		if (m_year % 100 == 0){ return false;}
		if (m_year % 4 == 0){ return true;}
		return false;
	}
};

int main(){

	int a, b;
	class Date date;
	int isLeapYear;
	int nYear;

	while(cin>>a>>b){
		if (a==0 && b==0){break;}
		nYear = 0;
		for(int i=a;i<b;++i){
			date.setDate(i,0,0);
			isLeapYear = date.isLeapYear();
			if(isLeapYear == (-1)){
				cout<<"Data is not set"<<endl;
			}
			if(isLeapYear == 1){cout<<i<<endl; ++nYear;}
		}
		if (nYear == 0){cout<<"NA"<<endl;}
		cout<<""<<endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <cctype>
#include <iostream>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
int size(string x){
	string::size_type size=x.size();
	return size;
}
#define fu(l,k) for(int i=l;i<k;i++)
#define fd(l,k) for(int i=l;i>k;i--)
typedef  vector<string> vs;
typedef  vector<int> vi;
double pi(){
	return M_PI;
}
typedef set<int> set_i;
typedef set<string> set_s;
int INF=1000000;
int main(){
	int a,b,ss;
	while(1){
		cin>>a>>b;
		if(a==0&&b==0) break;
		ss=0;
		for(int sr=a;sr<=b;sr++){
			if(sr%4==0){
				if(sr%100!=0){
					cout<<sr<<endl;
					ss++;
				}
				else if(sr%400==0){
					cout<<sr<<endl;
					ss++;
				}
			}
		}
		if(ss==0) cout<<"NA"<<endl;
		cout<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        for(int i=0;(fiyear+i)<finyear;i++){
            if((fiyear+i)%4==0){
                co=1;
                if((fiyear+i)%100!=0||(fiyear+i)%400==0)cout<<fiyear+i<<endl<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl<<endl;
    }
}

C++: #include <cstdio>
using namespace std;
 
int main()
{
    int a, b;
    bool first = true;
 
    while (scanf("%d%d", &a, &b), a){
        if (!first){
            printf("\n");
        }
 
        first = false;
 
        bool na = true;
        for (int i = a; i <= b; i++){
            if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
                printf("%d\n", i);
                na = false;
            }
        }
 
        if (na){
            printf("NA\n");
        }
    }
 
    return (0);
}

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

int main(){
	int a,b,count=0;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			cout<<endl;
			break;
		}
		while(a<=b){
			if(a%4==0){
				if(a%100==0){
					if(a%400==0){
						cout<<a<<endl;
						count++;
					}
				}else{
					cout<<a<<endl;
					count++;
				}
			}
			a++;
		}
		if(count==0){
			if(a==0 && b==0){
				break;
			}else{
				cout<<"NA"<<endl;
			}
		}
		cout<<endl;
		count=0;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#define int long long
#define range(i, a, b) for(auto i = a; i < b; i++)
#define rep(i, a) range(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const long double EPS = 1e-8;
using vi = vector <int>;
using vvi = vector <vi>;

signed main() {
	int a, b;
	bool first = true;
	while (cin >> a >> b, a) {
		if (!first) cout << endl;
		first = false;
		bool na = true;
		range (i, a, b + 1) {
			if (i % 4 == 0) {
				if (i % 400 == 0) {
					na = false;
					cout << i << endl;
				}
				else if (i % 100 != 0) {
					na = false;
					cout << i << endl;
				}
			}
		}
		if (na) cout << "NA" << endl;
	}
	return 0;
}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    while ((start_year != 0) || (end_year != 0)) {
        if (end_year - start_year < 3) {
            if (((start_year % 4) <= (end_year % 4)) || ((start_year % 100) >= (end_year % 100))) { 
                if ((start_year % 400) <= (end_year % 400)) {
                    printf("NA\n");
                } else {
                    printf("%d\n", start_year + 4 - start_year % 4);
                }
            }
        } else {
            for (int i = start_year; i <= end_year; ++i) {
                if (i % 400 != 0) {
                    if ((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n", i);
                    }
                } else {
                    printf("%d\n", i);
                }
            }
        }
        printf("\n");
        scanf("%d %d", &start_year, &end_year);
    }
}

int main(void)
{
    
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}

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

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

int main(){
	int a, b;
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		int uru[1000];
		int count = 0;
		for(int i = a; i <= b; i++){
			if(is_uruu(i)){
				uru[count++] = i;
			}
		}
		if(count == 0){
			cout << "NA" << endl;
		} else {
			for(int j = 0; j < count; j++)
				cout << uru[j] << endl;
		}
		cout << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	bool leap[3001];
	for (int i = 0; i < 3001; i++) {
		int y = i;
		if (y % 4 != 0) { leap[i] = false; }
		else if(y%100!=0){
			leap[i] = true;
		}
		else if (y % 400 != 0) {
			leap[i] = false;
		}
		else {
			leap[i] = true;
		}
	}
	int a, b;
	bool first = true;
	while (cin >> a >> b) {
		bool ever = false;
		if (a == 0 && b == 0) { break; }
		if (!first) { cout << endl; }
		for (int i = a; i <= b; i++) {
			if (leap[i]) { ever = true; cout << i << endl; }
		}
		if (!ever)
		{
			cout << "NA" << endl;
		}first = false;
	}
	return 0;
}