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 leap_year(int year1, int year2);

int main(void)
{
    while(1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else if (a == b){
            printf("NA\n");
            printf("\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    for(int i = year1; i <= year2; ++i){
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
        printf("\n");
    }else{    /*うるう年がある場合*/
    printf("\n");
    }
}

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

C++: #include <stdio.h>

int hantei(int year);
//???????????´????????????????????????????????????

int main(void)
{
	int year[2];
	int NA;
	for(;;) {
		scanf("%d %d", &year[0], &year[1]);
		if(year[0] == 0 && year[1] == 0) {
			break;
		}
		printf("\n");
		NA = 0;
		for(int i = year[0]; i <= year[1]; i++) {
			if(hantei(i) == 1) {
			printf("%d\n", i);
			NA++;
			}
		}
		if(NA == 0) {
			printf("NA\n");
		}
	}
	return 0;
}

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

C++: #include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	int number = 0;
	
	while (true) {
		int check = 0;
		
		std::cin >> start >> end;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		if (number != 0) {
			std::cout << std::endl;
		}
		
		number = 1;
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		

	}
	return 0;
}


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

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

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

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;


signed main(){
  int a,b;
  while(cin>>a>>b,a){
    vector<int> y;
    for(int i=a;i<=b;i++){
      if(i%400==0){
        y.PB(i);
        continue;
      }else if(i%100==0)continue;
      else if(i%4==0)y.PB(i);
    }
    if(y.size()==0){
      cout<<"NA"<<endl;
    }else{
      for(auto x:y)cout<<x<<endl;
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int a,b,c;
int main(){
	while(1){
		cin>>a>>b;c=1;
		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<<endl;c=0;
			}
			
		}
		if(c)cout<<"NA"<<endl;
	}
	return 0;
}

C++: #include <stdio.h>

void leap_year_judge(int year);

int main(void)
{
	int year_a, year_b;
	while (1) {
		scanf("%d %d", &year_a, &year_b);
		if (year_a == 0 && year_b == 0){
			break;
		} else {
			printf("NA\n");
			for (int i = year_a; i <= year_b; i++) {
				leap_year_judge(i);
			}
		}
	}
	return 0;
}

void leap_year_judge(int year)
{
	if (year % 400 == 0) {
		printf("%d\n", year);
	} else if (year % 4 == 0 && year % 100 != 0){
		printf("%d\n", year);
	}
}

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)
   {
     if(start==0&&end==0)
     {
       cout<<"NA"<<endl;
       break;                    
     }
     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 <iostream>
using namespace std;
int main()
{
	int a, b, i;
	bool f, g = false;
	while (cin >> a >> b)
	{
		if (a == 0 && b == 0) break;
		if (g) cout << endl;
		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;
		g = true;
	}
}

C++: #include <iostream>

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

C++: #include<stdio.h>
int main(void)
{
	int a,b,i,c,cnt;
	cnt=0;
	scanf("%d %d",&a,&b);
	while(a!=0&&b!=0){
		c=0;
		for(i=a;i<=b;i++){
			if(i%4==0 && i%100!=0){
				cnt++;
				printf("%d\n",i);
				c=1;
			}
			else if(i%400==0){
				cnt++;
				printf("%d\n",i);
				c=1;
			}
		}
		if(c==0){
			printf("NA\n");
		}if(cnt>=0){
			printf("\n");
		}
		scanf("%d %d",&a,&b);
		
	}
	return 0;
}

C++: #include <cstdio>

int main(void)
{
    int a, b;
    bool flag, first = false;
    
    while (1){
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0) break;
        if (first) printf("\n");
        else first = true;
        
        flag = false;
        
        while (a != b){
            if ((a % 4 == 0) && ((a % 100 != 0) || (a % 400 == 0))){
                printf("%d\n", a);
                flag = true;
            }
            a++;
        }
        if (!flag) printf("NA\n");
    }
    
    return (0);
}