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<cstdio>
main(){int a,b,c,d=0;while(scanf("%d%d",&a,&b),a){d++&&puts("");for(c=0;a<=b;a++)if(a%4<1&&a%25|a%16<1)printf("%d\n",c=a);!c&&puts("NA");}}

C++: #include<iostream>

using namespace std;


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

}

C++: #include <cstdio>

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

int main(void){
	int a, b, n_data;
	bool flag;//うるう年があるかどうか
	n_data=0;//いくつ目のデータセットか

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		}

		if (n_data != 0) {//もし最初のデータセットでなければ
			printf("\n");
		}

		flag = false;
		for (int i=a; i < b; i++) {
			if (judge(i)) {
				printf("%d\n", i);
				flag = true;
			}
		}
		if (!flag) {//もしうるう年がなければ
			printf("NA\n");
		}

		n_data++;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int a,b;

	while( cin >> a >> b && a ){
		int count = 0;
		for( int i = a;i <= b;i++ ){
			if( !(i % 4) ){
				if( !(i % 400) ){count++; cout << i << endl; continue;}
				else if( !(i%100) ) continue;
				cout << i << endl;
				count++;
			}
		}
		if( count == 0 ) cout << "NA" << endl;
		cout << 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;

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 == 0 && 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>
using namespace std;
	void judge(int a, int b);
	
	int main(void){
		int a, b;
		while(1){
			cin >> a >> b;
			if(a == 0 && b == 0){
				break;
			}
			judge(a, b);
			cout << endl;
		}
		return 0;	
	}
	void judge(int a, int b){
		int ans[1000] = {0};
		int j = 0;
		for(int i = a; i <= b; i++){
			if(i%400 == 0){
				ans[j] = i;
				j++;
			}else if(i%4 == 0 && i%100 != 0){
				ans[j] = i;
				j++;
			}
		}
		if(j == 0){
			cout << "NA" << endl;
 		}else{
 			int i;
 			for(i = 0; i < j ; i++){
 				cout << ans[i] << endl;
 			}
 		}
	}

C++: #include <stdio.h>
	
void uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	int first, end;
	while (1) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			uruu(first, end);
		}
	}
	return 0;
}

C++: #include<stdio.h>
int main(){
	int year;
	int s,l,i,flag=0;
	
	while(scanf("%d%d",&s,&l)!=EOF){
		if(s==0 && l==0)break;
	for(i=s;i<=l;i++){
		if(i%4==0){
			if(i%100!=0 || i%400==0){
			printf("%d\n",i);
			flag=1;
			}
		}
	}
	if(flag==0)printf("NA\n");
	}
return 0;
}

C++: #include <iostream>
#include <array>

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

int main()
{
        int start;
        int end;
        while(true) {
        std::cin >> start;
        std::cin >> end;

        if (start == 0 && end == 0) {
            break;
        }

        if (start >= end) {
            std::cout << "NA" << std::endl;
        }

        for (int i = start; i <= end; i++) {
            if (isLeapYear(i) == true) {
                std::cout << i << std::endl;
            }
        }

        std::cout << std::endl;

    }
}

C++: #include <stdio.h>
#include <stdbool.h>

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n\n", i);
                exist = true;
            } 
        }
        if (exist == 0) {
            printf("NA\n\n");
        }
    }   
    return 0;        
}

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

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

int main(void) {
	int start, end;
	bool first = true;

	while(cin >> start >> end, start | end) {
		bool flag = false;
		if(!first)
			cout << endl;
		else
			first = false;
		for(int i = start; i < end + 1; i++) {
			if(i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) {
				cout << i << endl;
				flag = true;
			}
		}
		
		if(!flag)
			cout << "NA" << endl;
	}
}

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

bool isLeapYear(int y){
    return ( year%4 == 0 && year%100 != 0 || year%400 == 0 )? true : false ;
}

int main(){
	int a,b;
	bool flag, iniFlag = true;
	
	while( cin >> a >> b , a || b ){
		flag = true;
		if( iniFlag == false ){
			cout << endl;
		}else{
			iniFlag = false;
		}	

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

C++: #include<iostream>
using namespace std;
int x[10000], y[10000][10000], a, b, cnt2;

void uruu(int s) {
	for (int i = 0; i < s; i++) {
		if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
			x[i] = 1;
		}
	}
}

void hantei(int start, int end) {
	int cnt = 0;
	for (int i = start; i <= end; i++) {
		if (x[i]) { cout << i << endl; cnt++; }
	}
	if (!cnt) { cout << "NA" << endl; }
}

int main() {
	uruu(10000);
	while (true) {
		cin >> a >> b; if (!a) { break; }
		if (cnt2) { cout << endl; }
		cnt2++;
		hantei(a, b);
	}
}