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 <bits/stdc++.h>

using namespace std;

int main(){
    int a,b;
    bool first=true;
    while(true){
        cin>>a>>b;
        if(a==0&&b==0)break;
        else if(first)first=false;
        else cout<<endl;
        bool f=true;
        for (int i = a; i <= b; ++i) {
            if(i%4==0){
                if(i%100==0){
                    if(i%400==0){
                        cout<<i<<endl;
                        f=false;
                    }
                }
                else {
                    cout<<i<<endl;
                    f=false;
                }
            }
        }
        if(f)cout<<"NA"<<endl;
    }

    return 0;
}

C++: #include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

int leapYear(int year)
{
  if(year%4==0 && year%100!=0)
    return 1;
  else if(year%400==0)
    return 1;
  else
     return 0;  
}
queue<int> q;
int main(void)
{
  int a,b;
  int i=-1;

  while(1){
    bool ans=true;
    cin>>a>>b;
    if(a==0 && b==0)break;
    if(i>=0)
      cout<<endl;
    for(i=a;i<=b;i++)
      if(leapYear(i)){
	cout<<i<<endl;
	ans=false;
      }
    if(ans)
      cout<<"NA"<<endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,us,ue;
    while(cin>>a>>b&&a!=0&&b!=0){
        for(int i=0;i<8;i++){
            if(((a+i)%4==0&&(a+i)%100!=0)||(a+i)%400==0){
                us=a+i;
                break;
            }
        }
        for(int j=0;j<8;j++){
            if(((b-j)%4==0&&(b-j)%100!=0)||(b-j)%400==0){
                ue=b-j;
                break;
            }
        }
        if(us>=ue) cout<<"NA"<<endl;
        else{
            for(int k=us;k<=ue;k+=4){
                if((k%4==0&&k%100!=0)||k%400==0){
                    cout<<k<<endl;
                } 
            }
        }
    cout<<endl<<endl;    
    }
}

C++: #include<stdio.h>

void leap_year(int start_year, int end_year);

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

void leap_year(int start_year, int end_year)
{
 int n = 0;
 int year = start_year;
   while (year <= end_year){
     if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)){
     printf("%d\n", year);
     n++;
   }
     year++;
 }
 if (n == 0){
   printf("NA\n");
  }
}

C++: #include <cstdio>

using namespace std;

#define YEAR_MAX 3000

bool reap[YEAR_MAX + 1];

int main()
{
	for (int i = 4; i < YEAR_MAX; i++){
		if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
			reap[i] = true;
		}
	}
	
	int a[10000], b[10000];
	bool flag;
	int num = 0;
	
	while (scanf("%d %d", &a[num], &b[num]), !(a[num] == 0 && b[num] == 0)){
		num++;
	}
	
	for (int j = 0; j < num; j++){
		flag = true;
		for (int i = a[j]; i <= b[j]; i++){
			if(reap[i]){
				printf("%d\n", i);
				flag = false;
			}
		}
		if (flag) printf("NA\n");
		if (j < num - 1) puts("");
	}
}

C++: #include <stdio.h>

void leap_year(int x, int y)
{
    while (x <= y) {
        if (((x % 4 == 0) && (x % 100 != 0)) || (x % 400 == 0)) {
            printf("%d\n", x);
        }
        x += 1;
    }    
}

int main(void)
{
    int x, y;
    scanf("%d %d", &x, &y);
    while(!(x == 0 && y == 0)) {
        leap_year(x, y);
        scanf("%d %d", &x, &y);
    }
    return 0;
}

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

C++: #include <iostream>
#include <vector>
using namespace std;
bool isLeap(int year)
{
	if (year % 400 == 0) return true;
	if (year % 100 == 0) return false;
	return year % 4 == 0;
}
int main()
{
	int a, b, k = 0;
	while (cin >> a >> b) {
		if (a == 0 && b == 0) break;
		if (k++) cout << endl;
		vector<int> res;
		for (int i=a; i<=b; ++i) if (isLeap(i)) res.push_back(i);
		if (res.empty()) {
			cout << "NA" << endl;
		}
		else {
			for (int i=0; i<res.size(); ++i) cout << res[i] << endl;
		}
	}
	return 0;
}

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

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

bool leap_year(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;
    }
}

int main(void)
{
    int y_ini, y_fin;
    int count = 0;
    int new_line = 0;
    while(1) {
        scanf("%d %d", &y_ini, &y_fin);
    
        if (y_ini == 0 && y_fin == 0) {
            break;
        }
        
        if (new_line != 0) {
            printf("\n");
        }

        for (int year = y_ini; year <= y_fin; year++) {
            if (leap_year(year) == true){
                printf("%d\n", year);
                count++;
            }
        }
        
        if (count == 0) {
            printf("NA\n");
        }
        
        new_line++;        
        count = 0;
    }
            
    return 0;
}

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

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

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

int judge(int n){
  if(n%4 == 0){
    if(n%400 == 0) return 1;
    else if(n%100 == 0) return 0;
    return 1; 
   }
  return 0;
}

int main(){
  int f,e;

  while(1){
    int cnt = 0;
    cin >> f >> e;
    if(f == 0 && e == 0) break;

    for(int i = f ; i <= e ; i++){
      if(judge(i)){
        cout << i << endl;
        cnt++;
      }
    }
    if(cnt == 0) cout << "NA" << endl;
    cout << endl;
    cout << endl;
  }

  return 0;
}