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 <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>
#include <numeric>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector<int> a, b;
	while (1) {
		int aa, bb;
		cin >> aa >> bb;
		if (aa == 0 && bb == 0)break;
		a.push_back(aa);
		b.push_back(bb);
	}
	rep(j, (int)a.size()) {

		int ans = 0;

		Rep(i, a[j], b[j] + 1) {
			if (i % 4 == 0) {
				if (i % 100 != 0) {
					ans++;
					cout << i << endl;
				}
				else if (i % 400 == 0) {
					ans++;
					cout << i << endl << endl;
				}
			}
		}

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

C++: #include <bits/stdc++.h>

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int inf = 1e9 + 7;

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

C++: #include <stdio.h>

int hantei(int year);
//???????????´????????????????????????????????????

int main(void)
{
	int year[2];
	int NA;
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(hantei(i) == 1) {
			printf("%d\n", i);
			NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
		printf("\n");
	}
	return 0;
}

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

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        if(end_year - start_year < 3) {
            if((start_year % 4) < (end_year % 4)) { 
                printf("NA");
            }
        } 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);
                }
            }
        }
    }
}

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>
#include <vector>
using namespace std;

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

int main(){
    int a, b, c = 0;
    while (1){
	cin >> a >> b;
	if (a == 0 && b == 0) break;
	if (c != 0) cout << endl;
	c = 1;
	vector<int> y;
	for (int i = a; i <= b; i++){
	    if (isLeap(i)) y.push_back(i);
	}
	if (y.empty()) cout << "NA" << endl;
	else for (int i = 0; i < y.size(); i++)
		 cout << y[i] << endl;
    }
}

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

using namespace std;

bool isLeap(int i);

int main()
{
    int a, b;
    bool flag = false;
    while (cin >> a >> b, a || b) {
        bool fl = false;
        if (flag) {
            puts("");
        } else {
            flag = true;
        }
        for (int i = a; i <= b; i++) {
            if (isLeap(i)) {
                fl = true;
                cout << i << '\n';
            }
        }
        if (!fl) {
            puts("NA");
        }
    }
    return 0;
}

bool isLeap(int i)
{
    if (!(i % 400) ) {
        return true;
    } else if (!(i % 100) ) {
        return false;
    } else if (!(i % 4) ) {
        return true;
    } else {
        return false;
    }
}

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;
	int first = 0;
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		}
		if (first != 0) {
			std::cout << std::endl;
		}
		
		first = 1;
		int i = 0;
		
		for (int j = a; j <= b; j++) {
			if (leap_year(j) == 0) {
				i++;
			} else {
				std::cout << j << std::endl;
			}
		}
		if ( i == a - b + 1) {
			std::cout << "NA" << std::endl;
		}
	}
	return 0;
}

C++: /*
    2014.07.04 1230~1237
    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>

using namespace std;

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