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;

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){
		f = false;
		cin >> a >> b ;
		if(a == b == 0) return 0;
		for (int i = a; i < b + 1; i++){
			if(isLeap(i)) {
				cout << i << endl;
				f = true;
			}
		}
		if(!f) 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;
        } else {
            is_input_started = false;

        }
        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>

int main(void)
{
    int a, b, y, counter;
    while(1){
        counter = 0;
        scanf("%d %d", &a, &b);
        if (a == 0&& b == 0){
            break;
        }
        y = 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\n");
        }else{
            printf("\n");
        }
    }
    return 0;
}

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

int main(){
  int i,a,b,c,con=0;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    if(con != 0) cout << endl;

    c = 0;
    for(i=a;i<=b;i++){
      if(i%400 == 0){
	c++;
	cout << i << endl;
      }
      else if(i%100 == 0) continue;
      else if(i%4 == 0){
	c++;
	cout << i << endl;
      }
    }

    if(c == 0) cout << "NA" << endl;
    con++;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main() {

    int a, b, isNA;

    while(cin >> a >> b && (a || b)) {

        isNA = 1;

        for(int i = a; i <= b; ++i) {
            if(i == 0) {
                continue;
            }
            if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
                cout << i << endl;
                isNA = 0;
            }
        }

        if(isNA == 1) {
            cout << "NA" << endl;
        }

        cout << endl;

    }

}

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

int main(){

  int a,b,c=0;

  while(true){
    
    cin>>a>>b;
    if(a==0&&b==0) break;
    if(c!=0)cout<<endl;


    vector<int> leaps;
    if(a==b){
      if(a%400==0){
        cout<<a<<endl;
        leaps.emplace_back(a);
      } else if(a%100==0) continue;
      else{
        cout<<a<<endl;
        leaps.emplace_back(a);
      }
    }
    a = 4 - a%4 + a;

    for(int i=a;i<=b;i+=4){
      if(i%400==0){
        cout<<i<<endl;
        leaps.emplace_back(i);
      }else if(i%100==0){
        continue;
      }else{
        cout<<i<<endl;
        leaps.emplace_back(i);
      }
    }

    if(leaps.size()==0) cout<<"NA"<<endl;
    ++c;

  }

  return EXIT_SUCCESS;
}

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;
	
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			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;
			}
			std::cout << std::endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>

bool judge_uruyear(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 print_uruyear(int year_begin, int year_end)
{

    int count_year = 0;

    // kono for loop no jyouken-siki ha "=" hituyou!
    for (int i = year_begin; i <= year_end; i++) {
        if (judge_uruyear(i)) {
            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if (count_year == 0) { 
        std::cout << "NA" << std::endl;
    }

    std::cout << std::endl;

}

int main()
{

    int year_begin, year_end;

    while (true) {
        
        std::cin >> year_begin >> year_end;
        std::cout << std::endl;
        if (year_begin == 0 && year_end == 0) {
            break;
        }
        
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

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);
    while ( a != 0 || b != 0) {
        printf("\n");
        print_na(a, b);
        leap_year(a, b);
        scanf("%d %d", &a, &b);
        printf("\n");
    }
    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);
        }
    }
}