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 <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

int main()
{
//	cut here before submit 
//	freopen ("testcase.leap_year", "r", stdin );

	int a, b;
	int cnt = 0;
	while (scanf ("%d %d", &a, &b ), a, b  ){
		vector<int> res; res.clear();
		for (int i = a; i <= b; i++ ){
			if (is_leap (i ) ){
				res.push_back (i );
			} // end if
		} // end for
		if (cnt != 0 ) cout << endl;
		cnt++;
		if (res.empty() ){
			cout << "NA" << endl;
		}else{
			rep (i, res.size() ){
				printf ("%d\n", res[i] );
			} // end rep
		} // end if
	} // end while

	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int a, b;
V vi;

int main(){
	while (cin >> a >> b&&a+b){
		for (int i = a; i <= b; i++){
			if (i % 4 == 0){
				if (i % 100 == 0){
					if (i % 400 == 0){
						vi.push_back(i);
					}
					continue;
				}
				vi.push_back(i);
			}
		}
		if (vi.empty())cout << "NA" << endl;
		REP(i, vi.size()){
			cout << vi[i] << endl;
		}
		cout << "" << endl;
		vi.clear();
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,us,ue;
    while(cin>>a>>b&&a!=0&&b!=0){
        for(int i=0;i<8;i++){
            if(((a+i)%4==0&&(a+i)%100!=0)||(a+i)%400==0){
                us=a+i;
                break;
            }
        }
        for(int j=0;j<8;j++){
            if(((b-j)%4==0&&(b-j)%100!=0)||(b-j)%400==0){
                ue=b-j;
                break;
            }
        }
        if(us>=ue) cout<<"NA"<<endl;
        else{
            for(int k=us;k<=ue;k+=4){
                if((k%4==0&&k%100!=0)||k%400==0){
                    cout<<k<<endl;
                } 
            }
        }
    cout<<endl<<endl;    
    }
}

C++: #include <iostream>

int main()
{
	while (true) {
        int x;
	    int y;
	    int z[3];
	    bool flag[2];
	    int n;
	    std::cin >> x >> y;
	    if (x == 0 && y == 0) break;
	    n = y-x+1;
	    flag[1] = false;
	    for (int i=0; i < n; i ++) {
		    z[0] = (x+i) % 4;
		    z[1] = (x+i) % 100;
		    z[2] = (x+i) % 400;
		    if (z[0] == 0) {
			    if(z[1] == 0) {
				    if(z[2] == 0) {
					    flag[0] = true;
					    flag[1] = true;
				    } else {
					    flag[0] = false;
				    }
			    } else {
				    flag[0] = true;
			    }
		    } else {
	  	  	    flag[0] = false;
	  	    }
	  	    if (flag[0]) std::cout << x+i << std::endl;
	  	 }
	  	 if (~flag[1]) std::cout << "NA" << std::endl;
	}
}

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

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

int main()
{
	int a,b,i,flag;
	cin>>a>>b;
	flag = 0;
	while(b!=0){
		for(i=a;i<=b;i++){
			if(i%400==0){
				cout<<i<<"\n";
				flag=1;
			}
			else if(i%4==0 && i%100!=0){
				cout<<i<<"\n";
				flag = 1;
			}
		}
	     if(flag !=1)
			 cout<<"NA\n\n";
		 else cout<<"\n";
		cin>>a>>b;
		flag = 0;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

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

int main(){
	int a, b;
	bool f;
	while(true){
		f = false;
		cin >> a >> b ;
		if(a == 0 && b == 0) return 0;
		for (int i = a; i < b + 1; i++){
			if(isLeap(i)) {
				cout << i << endl;
				f = true;
			}
		}
		if(!f) cout << "NA" << endl;
		cout << 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) {
    static bool judgefst = false;
    bool discovery = false;//if he can discover a leap year                     

    if(fstyear == 0 && lastyear == 0){
        return false;//end main                                                 
    }
    if(judgefst == true) {//make a space between outputs                        
        printf("\n");
    }

    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");
    judgefst = true;//he did this function at least one time                    
    return true;//repeat scanning years                                         
}