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 <bits/stdc++.h>

using namespace std;

bool is_leap(int y) {
    if (!(y % 4) && (y % 100) || !(y % 400)) return true;
    return false;
}

int main() {
    int a, b;
    bool flag = false;

    while (scanf("%d %d", &a, &b), a) {
        if (flag) cout << endl;
        flag = true;

        bool flag_ans = false;
        for (int i = a; i <= b; i++) {
            if (!is_leap(i)) continue;
            flag_ans = true;
            cout << i << endl;
        }

        if (!flag_ans) cout << "NA\n";
    }

    return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  bool is_leap[3010] = {};
  for (int i = 0; i <= 3000; i++) {
    is_leap[i] = i % 400 == 0 || (i % 100 != 0 && i % 4 == 0);
  }
  int a, b;
  bool flag = false;
  while (cin >> a >> b, a) {
    if (flag) cout << endl;
    vector<int> ans;
    for (int i = a; i <= b; i++) {
      if (is_leap[i]) ans.emplace_back(i);
    }
    if (ans.empty()) cout << "NA" << endl;
    else {
      for (auto i : ans) {
        cout << i << endl;
      }
    }
    flag = true;
  }

  return 0;
}

C++: #include <stdio.h>

int main(void)
{
	while (1){
		int a, b;
		int n = 0;
		scanf("%d %d", &a, &b);

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

		for (int i = a; i <= b; i++) {
			if (i % 4 == 0) {
				if (i % 100 == 0) {
					if (i % 400 == 0) {
						printf("%d\n", i);
						n++;
					}
				} else
				{
					printf("%d\n", i);
					n++;
				}
			}
		}

		if (n == 0) {
			printf("NA\n");
		}

		printf("\n");
	}

	return 0;
}

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

#define ALL(a) (a).begin(), (a).end()
#define llong long long

using namespace std;

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

	return 0;
}

C++: #include <iostream>

bool judge_uruyear(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;
    }

}

void print_uruyear(int year_begin, int year_end)
{

    int count_year = 0;

    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if(count_year == 0) {
        std::cout << "NA" << std::endl;
    }

}

int main()
{

    int year_begin, year_end;

    while(year_begin != 0 || year_end != 0) {
        
        std::cin >> year_begin >> year_end;
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

C++: #include <stdio.h>

void leap_year(int start, int end)
{
    int y = 0;
    for (int x = start; x <= end; ++x) {
        if (x % 4 == 0 && (x % 100 != 0 || x % 400 == 0)) {
            printf("%d\n", x);
            ++y;
        }
    }
    if (y == 0) {
        printf("NA\n");
    }
}
        
int main(void)
{
    while (1) {
        int start, end;
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0) {
            break;
        } else {
            leap_year(start, end);
            printf("\n");
        }
    }
    return 0;
}

C++: #include<stdio.h>
/*与えられた期間の間のうるう年をすべて出力*/
void leap_year(int year1, int year2);

int main(void)
{
    while(1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else{
            leap_year(a, b);
        }
    }
    return 0;
}

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

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

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

int main(){
  int a, b;
  while(std::cin >> a >> b, a){
    bool flag = false;
    for (int i = a; i <= b; i++) {
      if(isUruu(i)){
        std::cout << i << std::endl;
        flag = true;
      }
    }
    if(flag == false)std::cout << "NA" << std::endl;
    std::cout << std::endl;
  }
  return 0;
}

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

int leap(int x) {
	int flg=0;
	if (x % 4 == 0) { flg = 1; }
	if (x % 100 == 0) { flg = 0; }
	if (x % 400 == 0) { flg = 1; }

	return flg;
}

int main() {
	int a, b;
	vector<int>va;
	while (cin >> a >> b,a,b) {
		for (int i = a; i <=b; i++) {
			int c = leap(i);
			if (c==1) { va.push_back(i); }
		}
		if (!va.empty()) {
			for (int i = 0; i < va.size(); i++) {
				cout << va[i] << endl;
			}
			cout << endl;
		}
		else { cout << "NA" << endl <<endl; }
		va.erase(va.begin(), va.end());
	}
	return 0;
}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    scanf("%d %d", &first_year, &last_year);
    while (1) {
        if (first_year == 0 && last_year == 0) {
            break;
        } else {
            leap_year(first_year, last_year);
            printf("\n");
        }
        scanf("%d %d", &first_year, &last_year);
        }
    return 0;
}

int leap_year(int first_year, int last_year)
{
    int count = 0;
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
    return 0;
}