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

C++: #include <stdio.h>

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

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>
#include<vector>
using namespace std;

bool leap(int x) {
	int flg=0;
	if (x % 4 == 0) { flg = 1; }
	if (x % 100 == 0) { flg = 0; }
	if (x % 400 == 0) { flg = 1; }

	return flg;
}

int main() {
	int a, b;
	vector<int>va;
	while (cin >> a >> b,a,b) {
		if (a == 0 && b == 0)break;
		for (int i = a; i <=b; i++) {
			int c = leap(i);
			if (c==1) { va.push_back(i); }
		}
		if (!va.empty()) {
			for (int i = 0; i < va.size(); i++) {
				cout << va[i] << endl;
			}
			cout << endl<<endl;
		}
		else { cout << "NA" << endl << endl<<endl; }
		va.erase(va.begin(), va.end());
	}
	return 0;
}

C++: #include <iostream>
using namespace std; bool na=true;
void uruu(int a){
    if(a%4==0&&a%100==0&&a%400==0){cout<<a<<endl;na=false;return;}
    else if(a%4==0&&a%100==0){return;}
    else if(a%4==0){cout<<a<<endl;na=false;return;}
    else return;
}


int main (int argc, const char * argv[])
{
    int a,b;
   
    while(cin>>a>>b){
        if(a==0&&b==0){return 0;}
        na=true;
        while(a<=b){
            uruu(a);
            a++;
        }
        if(na)cout<<"NA"<<endl;
        cout<<endl;
    }
    }

C++: #include <stdio.h>

void leap_year(int year);
int leap_year_judge(int year_a, int year_b);

int main(void)
{
	int year_a, year_b, exist;
	while (1) {
		scanf("%d %d", &year_a, &year_b);
		exist = leap_year_judge(year_a, year_b);
		if (year_a == 0 && year_b == 0){
			break;
		} else if (exist == 1){
			for (int i = year_a; i <= year_b; i++) {
				leap_year(i);
			}
		} else {
			printf("NA\n");
		}
		
	}
	return 0;
}

void leap_year(int year)
{
	if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
		printf("%d\n", year);
	} 
}

int leap_year_judge(int year_a, int year_b)
{
	int judge = 0;
	for (int i = year_a; i <= year_b; i++) {
		if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
			judge = 1;
		} 
	}
	return judge;
}

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

using namespace std;

bool leap_year(int year)
{
	if (year % 400 == 0) { return true; }

	if (year % 100 == 0) { return false; }

	if (year % 4 == 0) { return true; }

	return false;
}

int main()
{
	vector<int> a;
	vector<int> b;

	while (true)
	{
		int temp[2];

		cin >> temp[0] >> temp[1];

		if (temp[0] == 0 && temp[1] == 0) { goto Exit; }

		a.push_back(temp[0]);
		b.push_back(temp[1]);
	}

Exit:;

	for (vector<int>::size_type i = 0; i < a.size(); i++)
	{
		int counter = 0;

		for (int j = a[i]; j <= b[i]; j++)
		{
			if (leap_year(j) == true) { cout << j << endl; counter++; }
		}

		if (counter == 0) { cout << "NA" << endl; }

		if (i != a.size() - 1) { cout << 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");
		}
		d=1;
	}
	return 0;
}

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

bool Judge_Leap_Year( int x )
{
    bool j = false;
    if( x % 4 == 0 )
        j = true;
    if( x % 100 == 0 )
        j = false;
    if( x % 400 == 0 )
        j = true;
    return j;
}

int main()
{
    int a, b, cnt = 0;
    while( cin >> a >> b )
    {
        if( a == 0 && b == 0 )
            break;
        if( cnt != 0 )          //最初の一回を除いて、空行を出力。
            cout << endl;       //嫌がらせ。
        cnt++;
        bool j = false;
        for( int i = a; i <= b; i++ )
        {
            if( Judge_Leap_Year(i) == true )
            {
                j = true;
                cout << i << endl;
            }
        }
        if( j == false )
            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) {
            std::cout << std::endl;
            is_input_started = false;
        }
        if (inputValRangeCheck(start_year, end_year)) {
            printLeapYear(start_year, end_year);
        }  
    }
    std::cout << std::endl;
    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 <cstdio>
using namespace std; 

int main()
{
	int a, b;
	bool x = true;
	
	while (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);
				x = false;
			}
		}
		if (x == true){
			printf("NA\n");
		}
		x = true;
		printf("\n");
	}
	
	return (0);
}