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>

void leap_year(int x, int y)
{
    int z = 0;
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
            z += 1;
        }
        x += 1;
    }
    if (z == 0) {
        printf("NA\n");
    }       
}

int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    while(!(a == 0 && b == 0)) {
        leap_year(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    return 0;
}

C++: // #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

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

signed main() {
    int A, B;
    int line_cnt = 0;
    while(cin >> A >> B, A || B) {
        if(line_cnt > 0) cout << endl;
        line_cnt++;
        
        int cnt = 0;
        for(int i=A; i<=B; i++) {
            if(is_leapyear(i)) {
                cout << i << endl;
                cnt++;
            }
        }

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

C++: #include <iostream>

using namespace std;

int main(void)
{
	int in1,in2;

	while(cin >> in1 >> in2, in1 | in2){
		int c = 0;
		for(int i = in1; i <= in2; i++){
			if(i % 4 == 0 && ( (i % 100 > 0 || i % 400 == 0) ) ){
				cout << i << endl;
				c++;
			}
		}
		if(c == 0)
			cout << "NA" << endl;
		cout << endl;


	}

	return 0;
}

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) {
      break;
    }

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  return 0;

}

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

bool is_leap_year(int y);

int get_leap_years(int* leap_years_list, int year_begin, int year_end)
{
    int j = 0;
    for (int i = year_begin, i < year_end + 1, i++) {
        if (is_leap_year(i) == true) {
            leap_years_list[j] = i;
            j++;
        }
    }
    return j;   
}

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;
    }
}

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

using namespace std;

int main(){
	
	int a, b;
	
	bool first, first2;
	
	cin >> a >> b;
	
	first2 = true;
	
	while(a != 0 && b != 0){
		
		if(!first2){
			printf("\n");
		}
		
		first2 = false;
		first = false;
		
		for(int i = a; i <= b; i++){
			if(i % 4 == 0){
				if(i % 100 == 0){
					if(i % 400 == 0){
						printf("%d\n", i);
						first = true;
						continue;
					}
					continue;
				}
				printf("%d\n", i);
				first = true;
				continue;
			}
		}
		
		if(!first){
			printf("NA\n");
		}
		
		cin >> a >> b;
	}
	
	return 0;
}

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

C++: #include <cstdio>
#include <vector>
using namespace std;
int main() {
    bool flag=false;
    int a, b;
    while (scanf("%d%d",&a,&b)) {
        if (!a&&!b) break;
        if (flag) puts("");
        flag=true;
        vector<int> leap;
        for (int i=a; i<=b; i++) {
            if (i%4==0&&(i%100!=0||i%400==0)) {
                leap.push_back(i);
            }
        }
        if (leap.size()==0) puts("NA");
        else {
            for (int i=0; i<leap.size(); i++) printf("%d\n",leap[i]);
        }
    }
}

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

void printLeapYear(int, int);
bool judgeLeapYear(int);

int main(void)
{
    int start_year, end_year;
    bool first_data = true;
    
    while (true) {
        scanf("%d%d", &start_year, &end_year);
        
        if (start_year == 0 && end_year == 0) {
            break;
        }
        
        if (first_data) { //各データセットの間に空行入れる用
            first_data = false;
        } else {
            printf("\n");
        }
        
        printLeapYear(start_year, end_year);

    }
    
    return 0;
}

void printLeapYear(int start_year, int end_year)
{
    bool exist_leap_year = false;
    
    for (int year = start_year; year <= end_year; year++) {
        if (judgeLeapYear(year)) {
            exist_leap_year = true;
            printf("%d\n", year);
        }
    }

    if(!exist_leap_year) {
        printf("NA\n");
    }
}

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