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>

bool is_leap_year(int y);

int get_leap_years(int leap_years_list[1000], int year_begin, int 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 leap_years_count[1000], int year_begin, int year_end)
{
    int k = 0;
    for (int n = year_begin; n <= year_end ; n++) {
      if ( is_leap_year(n) == false ) {
        //false の時何も処理しない                                                                                                                                                   
      } else {
        leap_years_count[k] = n;  //k番目のメモリに閏年の年を入力する                                                                                                                
        k++;
      }
    }
    return k;　//使ったメモリの数を返す                                                                                                                                              
}

C++: #include <iostream>

void leapYear(int, int);
int main()
{
  int check1 = 0;
    while (true) {
        int a, b;
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        if (check1 == 1) {
            std::cout << std::endl;
        }
        check1 = 1;
        leapYear(a, b);
    }
    return 0;
}
void leapYear(int a, int b)
{
    int check2 = 0;
    for (int year = a; year <= b; ++year) {
      if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            std::cout << year <<std::endl;
            check2 = 1;
      }
    }
    if (check2 == 0) {
        std::cout << "NA" <<std::endl;
    }
}

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

void leapyear(int a, int b);
int a, b;
bool flag = true;
int main(void)
{
    while (1) {
        flag =true;
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) {
            break;
        }
        leapyear(a, b);
        printf("\n");
    }
    return 0;
}

void leapyear(int a, int b)
{
    for (int i = a; b >= i; ++i) {
        if (i % 4 == 0) {
            if (i % 100 == 0) {
                if (i % 400 == 0) {
                    printf("%d\n", i);
                    flag = false;
                }
            } else {
                printf("%d\n", i);
                flag = false;
            } 
        }
    }
    if (flag == true) {
        printf("NA\n");
    }
}

C++: #include<stdio.h>
int main(void)
{
	int i,a,b,w,x,flg,cnt;
	cnt=0;
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		flg=0;
		if(cnt!=0){
			printf("\n");
		}
		for(i=a;i<=b;i++){
			if(i%4==0 && i%100!=0){
			//	if(i%100!=0){
					printf("%d\n",i);
					flg=1;
				//}
			}
			else if(i%400==0){
				printf("%d\n",i);
				flg=1;
			}
			cnt++;
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d %d",&a,&b);
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int leapyear(int year){
  return (year%4!=0||(year%100==0&&year%400!=0) ?0:1);
}
int main(){
int a,b;
int e=0;
while(cin>>a>>b,a||b){
int co=0;
if(e!=0)cout<<endl;
loop(i,a,b+1){
if(leapyear(i)==1){co++;cout<<i<<endl;}
}
if(co==0)cout<<"NA"<<endl;
e++;
}
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <unordered_map>

using namespace std;
using LL = long long;

constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;

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

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");
		}
		printf("\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;
	}
}