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>
using namespace std;
bool chk(int n){
  return (n % 4 == 0) - (n%100 != 0) + (n%400 ==0);
}

int main(void){
  int a,b,res = 0;
  bool first = false;
  while(cin>>a>>b,a+b){
    bool used = false;
    for(int i = a ; i <= b ; i ++)
      if(!chk(i)){
	cout<<i<<endl;
	used = true;
      }
    if(!used)cout<<"NA"<<endl;
    if(first)cout<<endl;
    first = true;
  }
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int a, b;
bool isUruu(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool update = false;
    for(int r = a; r < b; r++) {
        if(isUruu(r)){ cout << r << endl; update = true; }
    }
    if(!update) cout << "NA" << endl;
}

int main(void) {
    while(cin >> a >> b, a|b) {
        solve();
    }
    return(0);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
int fiyear,finyear,co=0,now=0;
while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
if(now!=0)cout<<endl;
else now=1;
for(int i=fiyear;i<=finyear;i++){
if(i%4==0){
co=1;
if(i%100!=0||i%400==0)cout<<i<<endl;
}
}
if(co==0)cout<<"NA"<<endl;
co=0;
}
}

C++: #include <stdio.h>
#include <stdbool.h>
   
int lpyrJudge(int x, int y);
   
int main(void)
{
    int sta, fin;
    int judgecount = 0;
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            if (judgecount != 0) {
                printf("\n");
            }
            lpyrJudge(sta, fin);
        }
        judgecount++;
    }
    return 0;
}
   
int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\?????????????°????4???????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
                printf("%d\n", i);
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>

int isLeap(int y){
	if (y%4) return 0;
	if (y%100) return 1;
	if (y%400) return 0;
	return 1;
}

int main(void){
	int y1, y2;
	
	while (scanf("%d%d",&y1, &y2),y1){
		int isNA = 1;
		for (int i=y1; i<=y2; i++){
			if (isLeap(i)){
				printf("%d\n", i);
				isNA=0;
			}
		}
		if (isNA) puts("NA");
		puts("");
	}
	
	return 0;
}

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

int judge(int n){
  if(n%4 == 0){
    if(n%100 == 0 && n%400 != 0) return 0;
    else return 1;
  }
  return 0;
}


int main(){
  int f,e;

  while(1){
    int cnt = 0;
    cin >> f >> e;
    if(f == 0 && e == 0) break;

    for(int i = f ; i <= e ; i++){
      if(judge(i) == 1){
        cout << i << endl;
        cnt++;
      }
    }
    if(cnt == 0) cout << "NA" << endl;
    cout << endl;
  }

  return 0;
}

C++: #include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
#define INF 100000000
typedef long long ll;

int main(void) {
    while (1) {
        int a, b, flag = 0;
        cin >> a >> b;
        if (a == 0 && b == 0) break;
        for (int i = a; i <= b; i++) {
            if (i % 400 == 0) {
                cout << i << endl;
                flag = 1;
            } else if (i % 100 == 0) {
                /* do nothing */
            } else if (i % 4 == 0) {
                cout << i << endl;
                flag = 1;
            }
        }
        if (flag == 0) cout << "NA" << endl;
    }
    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*/
         /*cは一行目の空行をさせないために使う*/
        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)
{   
    static int c = 0;
    ++c;
    if (c != 1){
        printf("\n");
    }
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    for (int i = year1; i <= year2; ++i){ /*i は年を表す*/     
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
    }
}

C++: #include<stdio.h>
     
int leap_year(int x);
         
int main(void)
{
    int start_year, end_year, counter;
    while(1){
        scanf("%d %d", &start_year, &end_year);
        if(start_year == 0 && end_year == 0){
            break;
        }else{
            counter = 0;
            for(int i = start_year; i <= end_year; i++){
                counter += leap_year(i); 
                }
            if( counter == 0){
                printf("NA\n");
            } 
            printf("\r\n");
        }
    }
    return 0;
}
     
     
int leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>

using namespace std;

class Solver{
public:
	static void solve() {
		int a, b;
		cin >> a >> b;
		vector<string> res;

		while (a != 0 && b != 0) {
			int cnt = 0;
			for (int i = a; i <= b; i++) {
				if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
					res.push_back(to_string(i));
					cnt++;
				}
			}
			if (cnt == 0)res.push_back("NA");
			cin >> a >> b;
			if (a != 0 && b != 0)res.push_back("");
		}

		for (int i = 0; i < res.size(); i++)cout << res[i] << endl;
	}
};

int main() {
	Solver::solve();
}

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