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>
#include <cstdio>

using namespace std;

bool isLeap(int i);

int main()
{
    int a, b;
    while (cin >> a >> b, a || b) {
        bool fl = false;
        for (int i = a; i <= b; i++) {
            if (isLeap(i)) {
                fl = true;
                cout << i << '\n';
            }
        }
        if (!fl) {
            puts("NA");
        }
        puts("");
    }
    return 0;
}

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

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

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	while(cin >> a >> b){
		z = -1;
		if (a == 0 && b == 0) { break; }
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == -1){
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  int a,b;
  while( cin >> a >> b ){

    bool flag = false;
    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;
	flag = true;
      }
    }
    if(flag) cout << endl;
    else cout << "NA" << endl << endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){
	int a,b,count;
	bool First=true;

	while(true){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0)break;

		if(!First)printf("\n");

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

				}else{
					printf("%d\n",i);
					count++;
				}
			}
		}

		if(count == 0)printf("NA\n");
		if(First)First = false;

	}
    return 0;
}

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

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

int main()
{
	int a, b;
	bool isFirstDataSet = true;

	while (cin >> a >> b, a + b)
	{
		if (!isFirstDataSet) cout << endl;

		isFirstDataSet = false;
		bool existsLeapYear = false;

		for (int y = a; y <= b; y++)
		{
			if (isLeapYear(y))
			{
				existsLeapYear = true;
				cout << y << endl;
			}
		}
		if (!existsLeapYear) cout << "NA" << endl;
	}

	return 0;
}

C++: #include <iostream>

bool ifEndValInput(int input_n1, int input_n2);
bool inputValRangeCheck(int input_n1, int input_n2);
void printLeapYear(int start_y, int end_y);
bool isLeapYear(int year);


int main()
{
    bool is_input_started = true;
    while (true) {
        int start_year, end_year;
        std::cin >> start_year >> end_year;
        if (ifEndValInput(start_year, end_year)) {
            break;
        }
        if (!is_input_started) {
            is_input_started = false;
        } else {
            std::cout << std::endl;
        }
        if (inputValRangeCheck(start_year, end_year)) {
            printLeapYear(start_year, end_year);
        }  
    }
    return 0;
}

bool ifEndValInput(int input_n1, int input_n2)
{
    if (input_n1 == 0 && input_n2 == 0) {
        return true;
    }
    return false;
}

bool inputValRangeCheck(int input_n1, int input_n2)
{
    if (input_n1 <= 0 || input_n1 > input_n2 || input_n2 >= 3000) {
        return false;
    }
    return true;
}


bool isLeapYear(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 printLeapYear(int start_y, int end_y)
{
    bool does_leap_year_exist = false;
    for (int i = start_y; i <= end_y; i++) {
        if (isLeapYear(i)) {
            std::cout << i << std::endl;
            does_leap_year_exist = true;
        }
    }
    if (!does_leap_year_exist) {
        std::cout << "NA" << std::endl;
    }
}

C++: #include <stdio.h>

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

int main(void)
{
    int a,b;
    int e = 0;
    while(1){
        scanf("%d %d",&a,&b);
        if(e >= 1 && (a != 0 && b != 0)){
            printf("\n");
        }
        if(a == 0 && b == 0){
            break;
        }else{
        leap(a,b);
        ++e;
        }
    }
    return 0;
}

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

bool isLeapYear(int y) {
  if(!(y % 4)) {
    if(!(y % 100)) {
      if(!(y % 400)) return true;
      return false;
    }
    return true;
  }
  else return false;
}

int main() {
  int a, b;
  bool flag;
  while(cin >> a >> b && a && b) {
    flag = 0;
    for(int i = a; i <= b; ++i) {
      if(isLeapYear(i)) {
        flag = 1;
        cout << i << endl;
      }

    }
    if(!flag) cout << "NA" << endl;
  }
  return 0;
}

C++: #include <stdio.h>

int j = 0;

void uru(int year);

int main(void)
{
    int a, b;
    int year;
    while (1) {
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) {
            break;
        } else  {
            for (year = a; year < b; ++year) {
                uru(year);
            }            
            if (j == 0) {
                printf("NA\n");
            }
        }
        printf("\n");
    }
    return 0;
}

void uru(int year)
{
    int R4, R100, R400;
    R4 = year % 4;
    R100 = year % 100;
    R400 = year % 400;
    if (R4 == 0 && R100 != 0) {
        printf("%d\n", year);
        ++j;
    } else if (R400 == 0) {
        printf("%d\n", year);
        ++j;
    }
}

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

int main(){
    int a, b;
    int leap;

    while(1){
        leap = 0;
        cin >> a >> b;
        if(a == 0 && b == 0) break;
        for(int y = a; y<=b; y++){
            if(y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)){
                leap++;
                cout << y << endl;
            }
        }

        if(leap == 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*/
        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)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    printf("\n");
    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");
    }
}