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>
    
int leap_year(int x);
    
    
int main(void)
{
    int start_year, end_year, counter;
    while(1){
        scanf("%d %d", &start_year, &end_year);
        if(start_year == 0 && end_year == 0){
            break;
        }else{
            counter = 0;
            for(int i = start_year; i <= end_year; i++){
                leap_year(i);
                counter += leap_year(i); 
                }
            if( counter == 0){
                printf("NA");
            }
        }
    }
    return 0;
}
    
    
int leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <climits>
#include <cfloat>


using namespace std;

int main()
{
	while (true)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0)
			break;

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

	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;

    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::endl(std::cout);

}

int main()
{

    int year_begin, year_end;

    while(year_begin != 0 || year_end != 0) {
        
        std::cin >> year_begin >> year_end;
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int a, b;
bool isUruu(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool update = false;
    for(int r = a; r <= b; r++) {
        if(isUruu(r)){ cout << r << endl; update = true; }
    }
    if(!update) cout << "NA" << endl;
}

int main(void) {
    while(cin >> a >> b, a|b) {
        solve();
    }
    return(0);
}

C++:  #include<iostream>
 #include<stdio.h>
 #include<cstdlib>
 #include<cstdio>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 #include<list>
 
 using namespace std;
 
 bool isLeap(int year)
 {
   if(year%4!=0) return false;
   else
   {
     if(year%4==100)
     {
       if(year%4==400) return true;
       else return false;               
     }
     else return true;    
   }     
 }
 
 int main()
 {
   int start,end;
   while(cin>>start>>end&&(start||end))
   {
     int count=0;
     for(int i=start+1;i<end;i++)
     {
       if(isLeap(i))
       {
         cout<<i<<endl; 
         count++;
       }        
     }                       
     if(!count) cout<<"NA"<<endl;
     cout<<endl;             
   }
   //while(1);
   return 0;
 }

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

#define NMAX 1000000

using namespace std;

int main(void){

	int a,b;
	bool f;

	while(1){
		cin>>a>>b;
		if(a==0&&b==0) break;
		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 <iostream>
using namespace std;
int main(){
	int a,b,x=0,num=0;;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		if(num!=0)cout<<endl;
		for(int i=a;i<=b;i++){
			if(i%400==0){
				cout<<i<<endl;
				x=1;
			}else if(i%100==0){

			}else if(i%4==0){
				cout<<i<<endl;
				x=1;
			}
		}
		if(x==0)cout<<"NA"<<endl;
		x=0;
		num=1;
	}
	return 0;
}

C++: #include<stdio.h>

int isleap(int y)
{
	int leap=0;
	if(y%4==0)
	{
		leap=1;
		if(y%100==0)
		{
			leap=0;
			if(y%400==0)
			{
				leap=1;
			}
		}
	}
	return leap;
}

int main()
{
	int a,b,i,isNA;

	while(1)
	{
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)
		{
			break;
		}
		isNA=1;
		for(i=a;i<=b;i++)
		{
			if(isleap(i))
			{
				isNA=0;
				printf("%d\n",i);
			}
		}
		if(isNA)
		{
			puts("NA");
		}
		putchar('\n');
	}
	return 0;
}

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

int main(){
  int a,b;
  vector<int> year;
  for(;;){
    cin>>a>>b;
    if(!(a||b))break;

    for(int i=a;i<=b;i++){
      if(i%4==0){
	if(i%100==0){
	  if(i%400==0) year.push_back(i);
	  continue;
	}else{
	  year.push_back(i);
	}
      }
    }

    if(year.size()==0) {
      cout<<"NA"<<endl;
      goto NEXT;
    }

    for(vector<int>::iterator it=year.begin(); it != year.end(); ++it)
      cout<<*it<<endl;

  NEXT:
    year.clear();
    cout<<endl;
  }
}

C++: #include <stdio.h>
	
int 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)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
		}
	}
	return 0;
}

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

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

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

int main(){
	int a, b;
	while(cin >> a >> b){
		if(a == 0 && b == 0) break;
		int uru[1000];
		int count = 0;
		for(int i = a; i <= b; i++){
			if(is_uruu(i)){
				uru[count++] = i;
			}
		}
		if(count == 0){
			cout << "NA" << endl;
		} else {
			for(int j = 0; j < count; j++)
				cout << uru[j] << endl;
		}
		cout << endl;
	}
	cout << endl;
	return 0;
}