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;
int main(){
  int a,b,p=0;
  while(cin>>a>>b,b){
    if(p)cout<<endl;
    p++;
    int s=0;
    for(int i=a;i<=b;i++){
      if(i%4==0){
        if(i%400==0)cout<<i<<endl;
        else if(i%100==0)continue;
        else cout<<i<<endl;
        s++;
      }
    }
    if(!s)cout<<"NA"<<endl;
  }
}

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

int main(){
	int a,b;
	int line =0;
	while(++line){
		cin >> a >> b;
		if(a==0 && b==0) break;
		int count=0;
		if(line > 1) cout << "\n";
		for(int i=a; i < b; i++){
			if((i % 4==0 && i % 100 !=0) || i % 400 ==0){
				cout << i << "\n";
				count++;
			} 
		}
		if(count ==0) cout << "NA\n";
	}

	return 0;
}

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

bool is_reap(int i){
	if(!(i%100)) return false;
	if(!(i%4)) return true;
	return false;
}

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

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        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 if(i % 400 == 0) {
                printf("%d\n", i);
            }
        }
    }
}

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(void) {
	int a, b, count = 0;
	while (cin>> a>> b, a || b) {
		if (count)
			cout << endl;
		bool NAflag = 0;
		for (int i = a; i <= b; i += 4-i%4) {
			bool flag;
			if (i % 4 == 0) {
				if (i % 100 == 0) {
					if (i% 400 == 0) {
						flag = 1;
					} else {
						flag = 0;
					}
				} else {
					flag = 1;
				}
			} else {
				flag = 0;
			}
			if (flag) {
				NAflag = 1;
				cout<< i<< endl;
			}
		}
		if (!NAflag)
			cout<< "NA"<< endl;
		++count;
	}
	return 0;
}

C++: #include<iostream>

bool isuru( int y )
{
 	return ( y % 4 == 0 && y % 100 != 0 ) || y % 400 == 0;
}

int main()
{
	int a, b;
	bool init = true;
	
	while( 1 ){
		if( !init ){
			std::cout << std::endl;
		}
		
		init = false;
	
		std::cin >> a >> b;
		
		if( !a && !b ) break;
		
		bool f = false;
		
		for( int i = a; i <= b; i++ ){
			if( isuru( i ) ){
				std::cout << i << std::endl;
				f = true;
			}
		}
		
		if( !f ){
		 	std::cout << "NA" << std::endl;
		}
	}

 	return 0;
}

C++: #include <iostream>

int leap_year(int year)
{
	if ( year % 4 == 0) {
		if ( year % 100 == 0) {
			if ( year % 400 == 0) {
				return 1;
			} else {
				return 0;
			}
		} else {
			return 1;
		}
	} else {
		return 0;
	}
}

int main()
{
	int a, b;
	int first = 0;
	while (true) {
		std::cin >> a >> b;
		std::cout << std::endl;
		if (a == 0 && b == 0) {
			break;
		}
		if (first != 0) {
			std::cout << std::endl;
		}
		
		first = 1;
		int i = 0;
		
		for (int j = a; j <= b; j++) {
			if (leap_year(j) == 0) {
				i++;
			} else {
				std::cout << j << std::endl;
			}
		}
		if ( i == a - b + 1) {
			std::cout << "NA" << std::endl;
		}
	}
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int a,b,c,d=0;
	while(1){
		if(d){
			printf("\n");
		}
		c=1;
		scanf("%d%d",&a,&b);
		if(a==0&&b==0){
			break;
		}
		for(int i=a;i<=b;i++){
			if(i%4==0&&(i%100!=0||i%400==0)){
				printf("%d\n",i);
				c=0;
			}
		}
		if(c){
			printf("NA\n");
		}
		d=1;
	}
	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;
    for (int i = 0; b <= c; ++b) {        
        if (is_leap_year(b) == true) {
        a[i] = b;
        ++s;
        ++i;
        }
    }
    return s;
}

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

int main() {
    int a,b;
    while (true) {
        scanf("%d%d", &a, &b);
        if (a == 0&&b == 0) {
            break;
        }
        bool isN = true;
        for (int i=a;i<=b;++i){
            if ((i%4==0)&&((i%100!=0)||(i%400==0))){
                printf("%d\n", i);
                isN = false;
            }

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