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<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;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;
	cin>>a>>b;
	while(1) 
	{
		bool f=false;
		for(int i = a; i < b+1; ++i)
		{
			if(i%400==0) 
			{
				cout<<i<<endl;
				f=true;
			}
			else if(i%100!=0)
			{
				if(i%4==0)
				{
					cout<<i<<endl;
					f=true;
				}
			}
		}
		if(!f) cout<<"NA"<<endl;
		cin>>a>>b;
		if(a==0&&b==0) break;
		else cout<<endl;
	}
  return 0;
}

C++: #include<stdio.h>
int miny,maxy;
int cou=0;

int main()
{
    while(1)
    {
        scanf("%d%d",&miny,&maxy);
        if(miny==0&&maxy==0)break;
        cou=0;
        for(int i=miny;i<=maxy;i++)
        {
            if((i%4==0&&i%100!=0)||i%400==0)
            {
                printf("%d\n",i);
                cou++;
            }
        }
        if(cou==0)printf("NA\n");
        printf("\n\n");
    }
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <algorithm>

int n;

using namespace std;


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

C++: #include <stdio.h>

int main(void)
{
    int a, b, count;
    while (1) {
        count = 0;
        scanf("%d %d", &a, &b);
        if ((a == 0) && (b == 0)) {
            break;
        } else {
            for (int i = a; i <= b; ++i) {
                if ((i % 4) == 0 && (!(i % 100) == 0 || (i % 400) == 0)) {
                    printf("%d\n", i);
                    ++count;
                }
            }
            if (count == 0) {
                printf("NA\n");
            }
        }
    }
    return 0;
}

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

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  while(true){
  int a, b;
  cin >> a >> b;
  bool f = false;
  if(a == 0 && b == 0) break;

  cout << endl;

  FOR(i,a,b+1){
    if(i % 4 == 0){
      if(i % 100 == 0){
        if(i % 400 == 0){
          cout << i << endl;
          f = true;
        }
        
      }else{
        cout << i << endl;
        f = true;
      }
    }
  }

  if(!f){
    cout << "NA" << endl;
  }
  }
  return 0;
}

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

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

C++: #include <stdio.h>

void leap_year(int year);
int leap_year_judge(int year_a, int year_b);

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

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

int leap_year_judge(int year_a, int year_b)
{
	int judge = 0;
	for (int i = year_a; i <= year_b; i++) {
		if (i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)) {
			judge = 1;
		} 
	}
	return judge;
}

C++: #include <stdio.h>

int main(void)
{
    int a, b, count;
    while (1) {
        count = 0;
        scanf("%d %d", &a, &b);
        if ((a == 0) && (b == 0)) {
            break;
        } else {
            for (int i = a; i <= b; ++i) {
                if ((i % 4) == 0 && (!(i % 100) == 0 || (i % 400) == 0)) {
                    printf("%d\n", i);
                    ++count;
                }
            }
            if (count == 0) {
                printf("NA\n");
            }
        }
    }
    return 0;
}

C++: #include <stdio.h>
void leaprinter(int start, int end);
int main(void){
    int year1=-1, year2=-1;
    while(1){
        if(year1 > 0){
            printf("\n");
        }
        scanf("%d%d", &year1, &year2);
        if (year1 == 0 && year2 == 0){
            break;
        }
        leaprinter(year1, year2);
    }

    
}
void leaprinter(int start, int end){
    int naflag = 1;
    for(int i = start; i <= end; i++){
        if(i % 4 == 0){
            if(i % 100 == 0){
                if(i % 400 == 0){
                    printf("%d\n", i);
                    naflag = 0;
                }
            }else {
                printf("%d\n", i);
                naflag = 0;
            }
        }
    }
    if(naflag){
        printf("NA\n");
    }
}