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 <stdio.h>
#include <stdbool.h>


void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
    printf("\n");
}

int main(void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

C++: #include <stdio.h>

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

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  bool fi=true;
  while(cin >> a >> b,a||b){
    if(!fi)cout << endl;
    fi=false;
    bool f=false;
    for(int i=a;i<=b;i++){
      if(i%400==0) {
	cout << i << endl;
	f=true;
      }else if(i%100==0) {
      }else if(i%4==0){
	cout << i << endl;
	f=true;
      }
    }
    if(!f) cout << "NA" << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

int a, b;

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

int main()
{
  cin >> a >> b;

  while(a && b){
    int res = 0;
    bool flag = false;
    erep(i, a, b) if(isLeap(i)){
      flag = true;
      cout << i << endl;
    }
    if(!flag) cout << "NA" << endl;
    if((cin >> a >> b) && a && b) cout << endl;
  }

  return 0;
}

C++: // yet

#include <iostream>
#include <complex>
#include <array>

using namespace std;

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)

int main(){
    int a,b;
    bool f=0;
    while(cin>>a>>b,a||b){
        if(f) cout<<endl;
        f=1;
        int n=0;
        int ans[3000];
        loop(y,a,b+1){
            if(y%400==0||(y%4==0&&y%100!=0)) ans[n++]=y;
        }
        if(n) rep(i,n) cout<<ans[i]<<endl;
        else cout<<"NA"<<endl;
    }
}

C++: 

#include<bits/stdc++.h>

using namespace std;

int main(){

  while(1)
    {
  int a,b;
  cin>>a>>b;
    if(a==0)break;

  vector<int> ans;

  for(int i=min(a,b);i<=max(a,b);i++){
    if(i%400 == 0 || (i%100!=0 && i%4==0)){
      ans.push_back(i);
    }
  }


  if(ans.size()!=0)
    {
      for(auto i:ans){
	cout<<i<<endl;
      }
    }
  else{
    puts("NA");
  }
  puts("");
    }
}

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

int main(){
    int a,b,m=0;
    while(cin>>a>>b){
        if(!(a||b))break;
        if(m>0)cout<<endl;
        m++;
        
        int c=0;
        for(int i=a;i<=b;i++)
            if((i%4==0)&&(i%100!=0||i%400)){cout<<i<<endl;c++;}
        if(!c)cout<<"NA"<<endl;
    }
}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end;
	while (1) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
	return 0;
}

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

bool is_leap_year(int y);
int get_leap_years(int* ly_list, int y_bgn, int 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, int y_bgn, int 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;
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;


signed main(){
  int a,b;
  while(cin>>a>>b,a){
    vector<int> y;
    for(int i=a;i<b+1;i++){
      if(i%400==0)y.PB(i);
      else if(i%100==0)continue;
      else if(i%4==0)y.PB(i);
    }
    if(y.size()==0){
      cout<<"NA"<<endl;
    }else{
      for(auto x:y)cout<<x<<endl;
    }
    cout<<endl;
  }
  return 0;
}