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

bool isLeap(int y) {
  if(y % 400 == 0) return true;
  if(y % 100 == 0) return false;
  return y % 4 == 0;
}

int main() {
  int a, b;
  bool first = true;
  while(cin >> a >> b && (a|b)) {
    if(first) first = false;
    else cout << endl;
    bool flag = false;
    for(int i = a; i <= b; ++i) {
      if(isLeap(i)) {
        cout << i << endl;
        flag = true;
      }
    }
    if(!flag) cout << "NA" << endl;
  }
  return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<utility>

#define NMAX 1000000

using namespace std;

int main(void){

	int a,b;
	bool f;
	bool f2=false;

	while(1){
		cin>>a>>b;
		if(a==0&&b==0) break;
		if(f2) cout<<endl;
		f2=true;
		f=false;
		for(int i=a;i<=b;i++){
			if(i%4==0){
				if(i%100!=0||i%400==0){
					cout<<i<<endl;
					f=true;
				}
			}
		}
		if(!f) cout<<"NA"<<endl;
	}

	return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>
 
int lpyrJudge(int x, int y);
 
int main(void)
{
    int sta, fin;
    printf("\n");
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
        }
    }
    return 0;
}
 
int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\???????????°????4?????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        int firstline = 0;
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (firstline =! 0) {
                printf("\n");
            }
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
                printf("%d\n", i);
            }
            firstline++;
        }
    }
    return 0;
}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if ((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", 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);
}

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>
#include <stdbool.h>

int lpyrJudge(int x, int y);

int main(void)
{
    int sta, fin;
    printf("\n");
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
        }
    }
    return 0;
}

int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\??????????°????4????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        int firstline = 0;
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (firstline =! 0) {
                printf("\n");
            }
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
                printf("%d\n", i);
            }
            firstline++;
        }
    }
    return 0;
}

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

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

int main(){
  int a, b;

  for(int SET = 1; cin >> a >> b, a || b; SET++){
    if(SET != 1){
      cout << endl;
    }

    bool ans = false;

    for(int i = a; i <= b; i++){
      if(leap(i)){
        cout << i << endl;
        ans = true;
      }
    }

    if(!ans) cout << "NA\n";
  }
}

C++: #include<iostream>
using namespace std;
int main(){
int a;
int b;
bool first=true;
while(cin>>a>>b,a*b){
if(first!=true){
cout<<endl;
}else{
first=false;
}
bool j=false;
for(int i=a;i<b+1;i++){
if(i%4==0){
if(i%400==0){
j=true;
cout<<i<<endl;
}else if(i%100==0){
}else{
j=true;
cout<<i<<endl;
}
}else{
}
}
if(j==false)cout<<"NA"<<endl;
}
return 0;
}

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

bool isLeapYear(int year){
	if (year % 400 == 0)
		return true;
	if (year % 4 == 0){
		if (year % 100 == 0)
			return false;
		else
			return true;
	}
	return false;
}

int main(){
	int a, b, count;

	while (true){
		cin >> a >> b;
		if (a == 0 && b == 0)break;

		count = 0;
		for (int i = a; i <= b; ++i){
			if (isLeapYear(i)){
				++count;
				cout << i << endl;
			}
		}
		if (count == 0)
			cout << "NA" << endl;

		cout << endl;
	}



	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    while(1){
        int a,b,count=0;
        cin>>a>>b;if(a==0&&b==0||a>=3000&&b>=3000)return 0;
        for(;a<=b;++a){
            if(a%4==0){
                if(a%100==0){
                    if(a%400==0){
                        cout<<a<<endl;++count;continue;
                        }
                        continue;
                }
                cout<<a<<endl;++count;
            }
        }
        if(count==0)cout<<"NA"<<endl;
        cout<<endl;
    }
}

C++: #include <iostream>
using namespace std;
int main(){
  int a,b;
  cin >> a>>b;
  while(1){  
    bool f=0;
    if(a==0&&b==0)break;
    for(int i=a;i<=b;i++){
      if(i%400==0){cout<<i<<endl;f=1;}
      else if(i%4==0&&i%100!=0){cout<<i<<endl;f=1;}
    }
    if(f==0)cout<<"NA"<<endl; 
    if(cin>>a>>b&& a && b)cout<<endl;
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int a,b;
	while(1){
		int count=0;
		cin >> 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) {
				cout << i << "\n";
				count++;
			} 
		}
		if(count==0) cout << "NA" << "\n";
	}		

	return 0;
}