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 <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

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

int main() {
  int A, B;
  while(cin >>A >>B && (A || B)){
    bool f = false;
    FOR(i, A, B + 1){
      if(is_uruu(i)){ f = true; cout <<i <<endl; }
    }
    if(!f) cout <<"NA" <<endl;
    cout <<endl;
  }
  return 0;
}

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

C++: #include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int a,b;
	
	while(cin >> a >> b){
		if(a==0  && b==0 || cin.eof()) break;
		int cnt=0;
		while(1){
			if(a%400 == 0 || a%100 != 0 && a%4 == 0 ){
				cout << a << endl;
				cnt++;
			}
			a++;
			if(a > b) break;
		}	
		if(cnt==0) cout << "NA\n";
		cout << endl;
	}
	return 0;
	
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 
 using namespace std;
 
 bool isLeap(int year)
 {
   if(year%4!=0) return false;
   else
   {
     if(year%100==0)
     {
       if(year%400==0) return true;
       else return false;               
     }
     else return true;    
   }     
 }
 
 int main()
 {
   int start,end;
   while(cin>>start>>end&&(start||end))
   {
     int count=0;
     for(int i=start;i<=end;i++)
     {
       if(isLeap(i))
       {
         cout<<i<<endl; 
         count++;
       }        
     }                       
     if(!count) cout<<"NA"<<endl;
     cout<<endl;             
   }
   //while(1);
   return 0;
 }

C++: #include<iostream>
using namespace std;
int main(){
  int bell,hess,aizu,riri=0;
  while(1){
    aizu=0;
    cin >> bell >> hess;
    if(bell==0 && hess==0){
      break;
    }
    if(riri!=0){
      cout << endl;
    }
    riri++;
    for(int i=bell;i<=hess;i++){
      if(i%4==0){
	if(i%100!=0){
	  cout << i << endl;
	  aizu++;
	}
	else if(i%400==0){
	  cout << i << endl;
	  aizu++;
	}
      }
    }
    if(aizu==0){
      cout << "NA" << endl;
    }
    aizu=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");
		}
	}
	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<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    bool x = true;
    for(;;){
        int a, b;
        cin>>a>>b;
        if(a==0&&b==0)return 0;
        if(!x)cout<<endl;
        else x=false;

        bool y=true;
        for(int i=a;i<=b;++i){
            if(i%400 == 0||(i%100!=0&&i%4==0)){
                cout<<i<<endl;
                y=false;
            }
        }
        if(y)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) {
		printf("\n");
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
		}
	}
	return 0;
}

C++: #include<stdio.h>

void leap_year(int)


int main(void)
{
    int start_year, end_year, check;
    check = 0;
    scanf(%d %d,&start_year, &end_year);
    for(int i = start_year; i =<end_year; i++){
        leap_year(i);
        check += leap_year(i);
    } 
    if(check = 0){
        printf("NA");
    }
    return 0;
}


int leap_year(int = x)
{
    if(x % 4 = 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

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

bool is_leap_year(int y);
int get_leap_years(int* a, int b, int c);// a = leap_year_list , b = year_begin , c = year_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* a, int b, int c)
{   
    int i = 0;
    for (int year = b; year <= c; ++year) {
        while (is_leap_year(year)){
            *a = year; //引数として与えられた配列に閏年を表す数字を格納
            ++a;
            ++i;
        }
    }
    return i;
 }