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

void Leap_Year(int start_year, int end_year)
{
    while ((start_year != 0) || (end_year != 0)) {
        if ((end_year - start_year >= 0) && (end_year - start_year < 4)) {
            if (((start_year % 4 == 0) && (start_year % 100 != 0)) || (start_year % 400 == 0)) {
                printf("%d\n", start_year);
            } else if (start_year % 4 < end_year % 4) {
                printf("NA\n");
            } else {
                if (start_year % 100 < end_year % 100) {
                    printf("%d\n", start_year + 4 - start_year % 4);
                } else if (start_year % 400 > start_year % 400) {
                    printf("%d\n", start_year + 4 - start_year % 4);
                } else {
                    printf("NA\n");
                }
            }
        } 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;

int main()
{
	vector<int> a;
	for(int i=1;i<4000;i++)
	{
		if(i%100==0)continue;
		if(i%4==0)a.push_back(i);
	}
	int A,B;
	bool f=false;
	while(cin>>A>>B&&A&&B)
	{
		if(f)cout<<endl;
		f=true;
		bool flag=true;
		for(int i=0;i<a.size();i++)
		{
			if(A<a[i]&&a[i]<B)
			{
				flag=false;
				cout<<a[i]<<endl;
			}
			
		}
		if(flag)cout<<"NA"<<endl;
	}
	
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a,b;
    int f = 0;
    int ans[2000] = {0};
    int cnt = 0;
    int j = 0;
    for(;;){
        cin >> a >> b;
        if(a == 0 && b == 0)break;
        else if(f == 1) printf("\n");
        for(int i = a; i <= b; i++){
            if(i%4 == 0 && i%100 != 0){cnt++;ans[j] = i;j++;}
            else if(i%400 == 0){cnt++;ans[j] = i;j++;}
        }
        if(cnt == 0)printf("NA\n");
        else {
            for(int i = 0;i < j; i++)printf("%d\n",ans[i]);
            j = 0;
            cnt = 0;
        }
        f = 1;
    }
    return 0;
}

C++: #include <stdio.h>

int leap_year(int, int);

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

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

C++: #include <cstdio>


int a, b;

bool ly[3001];

int main(){
    for(int i = 0; i <= 3000; i++){
        if(i % 400 == 0){
            ly[i] = true;
            continue;
        }

        if(i % 100 == 0){
            continue;
        }

        if(i % 4 == 0){
            ly[i] = true;
        }
    }

    bool f = false;
    while(scanf("%d %d", &a, &b) != EOF){
        if(a == 0 && b == 0) break;
        if(f) printf("\n");
        else f = true;

        bool j = true;
        for(; a < b; a++){
            if(ly[a]){
                printf("%d\n", a);
                j = false;
            }
        }

        if(j) printf("NA\n");
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, f;
	
	while(1){
		cin >> a >> b;
		if(a == 0 && b == 0){
			break;
		}
		
		for(f = 0; a <= b; a++){
			if(a%400 == 0 || (a%4 == 0 && a%100 != 0)){
				cout << a << endl;
				f = 1;
				a += 4;
				break;
			}
		}

		for(; a <= b; a += 4){
			if(a%400 == 0 || a % 100 != 0){
				cout << a << endl;
			}
		}
		
		if(f == 0){
			cout << "NA" << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>

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

int LeapYear (int x)
{
    if (x % 400 == 0) {
    return 1;
    } else if (x % 100 == 0) {
    return 0;
    } else if (x % 4 == 0) {
    return 1;
    }else {
    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()
{
    int start_year, end_year;
    while (true) {
        std::cin >> start_year >> end_year;
        if (ifEndValInput(start_year, end_year)) {
            break;
        }
        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 <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, f, l=0;
	
	while(1){
		cin >> a >> b;
		if(a == 0 && b == 0){
			break;
		}
		if(l = 1){
			cout << endl;
		}
		
		for(f = 0; a <= b; a++){
			if(a%400 == 0 || (a%4 == 0 && a%100 != 0)){
				cout << a << endl;
				f = 1;
				a += 4;
				break;
			}
		}

		for(; a <= b; a += 4){
			if(a%400 == 0 || a % 100 != 0){
				cout << a << endl;
			}
		}
		
		if(f == 0){
			cout << "NA" << endl;
		}
		l = 1;
	}
	
	return 0;
}