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>

int main(void)
{
    int a, b, y, counter;
    while(1){
        counter = 0;
        scanf("%d %d", &a, &b);
        if (a == 0&& b == 0){
            break;
        }
        if (b >= 3000 || a < 0){
            printf("NA");
        }else{
            y = a;
            //printf("%d\n", a);
            for (int i = a; i < b; i++){//  y == i
                if (!(y%400)){
                    printf("%d\n", y);
                    counter++;
                }else if((!(y%4)) && y%100){
                    printf("%d\n", y);
                    counter++;
                }
                y++;
            }
            if (counter == 0){
                printf("NA\n");
            }else{
                printf("\n");
            }
        }
    }
    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);

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]);
            }
        }
        
    }
    return 0;
}

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 s = 0;
    for (int i = 0; b <= c; ++b) {        
        if (is_leap_year(b) == true) {
        a[i] = b;
        ++s;
        ++i;
        }
    }
    return s;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int a,b;

int main(){
	bool S=0;
	while(1){
		cin>>a>>b;
		if(!a&&!b) break;
		if(S) cout<<endl;
		bool flag=0;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100==0){
					if(i%400==0){
						flag=1;
						cout<<i<<endl;
					}
					continue;
				}
				flag=1;
				cout<<i<<endl;
			}
		}
		if(!flag) cout<<"NA"<<endl;
		S=1;
	}
}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if ((start_year != 0) || (end_year != 0)) {
        if (end_year - start_year < 3) {
            if (((start_year % 4) < (end_year % 4)) || ((start_year % 100) > (end_year % 100))) { 
                if ((start_year % 400) < (end_year % 400)) {
                    printf("NA\n");
                } else {
                    printf("%d", start_year + 4 - start_year % 4);
                }
            }
        } else {
            for (int i = start_year; i <= end_year; ++i) {
                if (i % 400 != 0) {
                    if ((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n", i);
                    }
                } else {
                    printf("%d\n", i);
                }
            }
        }
        scanf("%d %d", &start_year, &end_year);
    }
}

int main(void)
{
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
  int a,b;
  while(cin>>a>>b&&a){
    bool f=true;
    if(!(a%4)&&(a%100||!(a%400))){
	cout<<a<<endl;f=false;
      }
    for(int i=a-a%4+4;i<=b;i+=4){
      if(i%100||!(i%400)){
	cout<<i<<endl;f=false;
      }
    }
    if(f) cout<<"NA"<<endl;
    cout<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

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

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

C++: #include<stdio.h>
int main(){
	int year;
	int s,l,i,flag=0;
	
	while(scanf("%d%d",&s,&l)!=EOF){
		if(s==0 && l==0)break;
	for(i=s;i<=l;i++){
		if(i%4==0){
			if(i%100!=0 || i%400==0){
			printf("%d\n",i);
			flag=1;
			}
		}
	}
	if(flag==0)printf("NA\n");
		flag=0;
		printf("\n");
	}
return 0;
}

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

int main()
{
  int a,b;
  bool cf=false;
  for(;cin>>a>>b,a||b;)
    {
      if(cf)
	cout<<endl;
      cf=true;
      bool c=true;
      for(;a<=b;a++)
	{
	  if(a%4==0 && (a%100!=0 || a%400==0))
	    {
	      cout<<a<<endl;
	      c=false;
	    }
	}
      if(c)
	cout<<"NA"<<endl;

    }
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if ((i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) || (first == end)) {
			printf("NA\n");
			count = count + 1;		
		}
		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)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}