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>

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

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

int uru(int y);

int main(void){
	bool f;
	int a,b;
	while(cin>>a>>b,a!=0||b!=0){
		f=true;
		for(int i=a;i<=b;i++){
			if(uru(i)){
				f=false;
				cout<<i<<endl;
			}
		}
		if(f)cout<<"NA"<<endl;
		cout<<endl;
	}

}


int uru(int y){
	if(y%4==0){
		if(y%100==0){
			if(y%400==0)return 1;
			return 0;
		}
		return 1;
	}
	return 0;
}

C++: #include <stdio.h>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          printf("\n");
          judge_leap_year(start_year, end_year);
       } else {
          printf("\n");
          printf("NA\n");
        }
      }
    }
    return 0;
}

void judge_leap_year(int a, int b)
{
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        printf("%d\n", year);
      } else if (year % 4 == 0 && year % 100 != 0) {
        printf("%d\n", year);
      }
    }
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

C++: #include <iostream>
 
using namespace std;
 
bool isLeap(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 f;
    while(true){
        cin >> a >> b ;
        if(a == 0 && b == 0) return 0;
        if(f) cout << endl;
        f = false;
        for (int i = a; i < b + 1; i++){
            if(isLeap(i)) {
                cout << i << endl;
                f = true;
            }
        }
        if(!f) { cout << "NA" << endl; f = true;}
    }
    return 0;
}

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

int 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) {
		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;
			}
		}
		else { cout << "NA" << endl; }
		cout << '\n';
		va.erase(va.begin(), va.end());
	}
	return 0;
}

C++: #include <stdio.h>

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

int main(void)
{
    int a,b;
    leap(a,b); 
    return 0;
}

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

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

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 <stdio.h>


void uru(int year);

int j;

int main(void)
{
    while (1) {    
        int a, b;
        int year;
        j = 0;
        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 (R400 == 0 || (R4 == 0 && R100 != 0)) {
        printf("%d\n", year);
        ++j;
    }
}

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

bool isLeapYear(int n) {
    if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {
        return true;
    }
    return false;
}

int main() {
    bool spaceFlag = false;
    while (true) {
        int a, b;
        cin >> a >> b;
        if (a == 0 && b ==0) {
            break;
        }
        if (spaceFlag) {
            cout << endl;
        } else {
            spaceFlag = true;
        }
        bool NAFlag = true;
        for (int i = a; i <= b; i++) {
            if (isLeapYear(i)) {
                cout << i << endl;
                NAFlag = false;
            }
        }
        if (NAFlag) {
            cout << "NA" << endl;
        }
    }
}

C++: #include <stdio.h>

void print_na(int a, int b);
void leap_year(int a, int b);

int main(void)
{
    int a, b;
    scanf("%d %d", &a, &b);
    if ( a != 0 || b != 0) {
        print_na(a, b);
        leap_year(a, b);
    printf("\n");
    }
    return 0;
}

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

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