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 leapmaker(int start, int end);
int main(void){
    int Year1 = -1, Year2 = -1;
    while(1)
    {
        scanf("%d %d", &Year1, &Year2);
        if(!(Year1 == -1 && Year2 == -1))
        {
            printf("\n");
        }
        if (Year1 == 0 && Year2 == 0)
        {
            break;
        }
        leapmaker(Year1, Year2);
    }
    return 0;
}
void leapmaker(int start, int end){
    int naflag = 1;
    for(int i = start - start % 4; i <= end; i += 4){
        if (i >= start) if (i % 100 == 0)
        {
            if (i % 400 == 0)
            {
                printf("%d\n", i);
                naflag = 0;
            }
        } else {
            naflag = 0;
            printf("%d\n", i);
        }
    }
    if (naflag == 1)
    {
        printf("NA\n");
    }
}

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 < 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 if(start_year == end_year) {
            if (((start_year % 4 == 0) && (start_year % 100 != 0)) || (start_year % 400 == 0)) {
                printf("%d\n", start_year);
            } 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 <stdio.h>

void leapyear(int start, int end);

int main(void)
{
    int start, end;
    while (1){
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0){
            break;
        } else {
            leapyear(start, end);
        }
    }

    return 0;
}

void leapyear(int start, int end)
{
    static int first_output = 1;
    if (first_output != 1){
        printf("\n");
    }
    first_output = 0;

    int cnt = 0;
    for (int year = start; year <= end; year++){
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)){
            printf("%d\n", year);
            cnt++;
        }
    }
    if (cnt == 0){
        printf("NA\n");
    }
}

C++: #include<stdio.h>

void leap_year(int a, int b);

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

void leap_year(int a, int b)
{
    for(int i = a; i <= b; i++){
        int j = i;
        if (i - j / 400 * 400 == 0) { //iが４００の倍数の時
            printf("%d\n", i);
            j = i;
        } else if (!(i - j / 100 * 100 == 0)) { //iが100の倍数のでないとき
            int j = i;  
            if ( i - j / 4 * 4 == 0) {//iが四の倍数のとき
                printf("%d\n", i);
            }
        }
    }
}

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");
        }
        printf("\n");
    }
    return;
    
}

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

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

int main (int argc, char const* argv[]) {
  int begin, end;
  while (true) {
    cin >> begin >> end;
    if (begin == 0 && end == 0) break;
    bool flag = true;
    for (int i = begin; i <= end; i += 1) {
      if (i % 400 == 0) {
        flag = false;
        cout << i << endl;
        continue;
      }
      if (i % 4 == 0 && i % 100 != 0) {
        flag = false;
        cout << i << endl;
      }
    }
    if (flag) {
      cout << "NA" << endl;
    }
    cout << endl;
  }
  return 0;
}

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

int start, end;
int ans[800], count;
int cont = 0;
int main(){
	while(cin >> start >> end, start || end){
		if(cont != 0) cout << endl;
		count = 0;
		for(; start <= end; start++){
			if(start % 4 == 0){
				if(start % 100 == 0){
					if(start % 400 == 0){
						ans[count] = start;
						count++;
					}
				}
				ans[count] = start;
				count++;
			}
		}
		if(count == 0) cout << "NA" << endl;
		else{
			for(int i=0; i < count; i++){
				cout << ans[i] << endl;
			}
		}
		cont++;
	}
}

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) {
		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; }
		va.erase(va.begin(), va.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) {
        print_na(a, b);
        leap_year(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
    }
    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);
        }
    }
}

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

int main()
{
	int a, b;
	bool first = false;

	while (scanf("%d%d", &a, &b), a){
		bool check = true;
		for (int i = a; i <= b; i++){
			if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
				printf("%d\n", i);
				check = false;
			}
		}

		if (check){
			printf("NA\n");
		}

		if (first){
		   printf("\n");		
		   first = true;
		}
	}

	return (0);
}