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>
using namespace std; 
bool na=true;
void uruu(int a){
    if(a%4==0&&a%100==0&&a%400==0){cout<<a<<endl;na=false;return;}
    else if(a%4==0&&a%100==0){return;}
    else if(a%4==0){cout<<a<<endl;na=false;return;}
    else return;
}


int main ()
{
    int a,b;
    bool first=true;
    while(cin>>a>>b){
        
        if(a==0&&b==0){return 0;}
        if(first)first=false;
        else cout<<endl;
        na=true;
        while(a<=b){
            uruu(a);
            a++;
        }
        if(na)cout<<"NA"<<endl;
        
        
    }
    }

C++: #include <iostream>

void leapYear(int, int);
int main()
{
    while (true) {
        int a, b;
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        leapYear(a, b);
        std::cout << std::endl;
    }
    return 0;
}
void leapYear(int a, int b)
{
    int i = 0;
    for (int year = a; year <= b; ++year) {
        if ((year % 4 == 0 && year % 100 !=0) || (year % 400 == 0)) {
            std::cout << year <<std::endl;
            ++i;
        }
    }
    if (i == 0) {
        std::cout << "NA" <<std::endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
int p=0;
int main(void){
    // Your code here!
    while (true){
    int a,b,n=0;
    cin >> a >> b;
    if (a==0 && b==0) break;
    if (p!=0) cout << endl;
    for (int i=a;i<b+1;i++){
        if (i%400==0) {n=1;cout << i << endl;}
        else if (i%100==0) continue;
        else if (i%4==0) {n=1;cout << i << endl;}
    }
    if (n==0) cout << "NA" << endl;
    p++;
    }
}

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

int main()
{
  int y, yy, i;
  bool f, ff;

  ff = false;
  while (cin>>y>>yy, y||yy) {
    if (ff) cout<<endl;
    f = true;
    if (y%4)
      y += 4-y%4;
    for(i = y; i <= yy; i += 4) {
      if( ( !(i%100) + !(i%400) ) == 1) continue;
      cout<<i<<endl;
      f = false;
    }
    if (f) cout<<"NA"<<endl;
    ff = true;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

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

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;
	}
	return 0;
}

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

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

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

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

int main(){
  int a,b,k,i;
  
  while(1){
    cin>>a>>b;
    if(a==0&&b==0)break;
    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;}
    }    
    if(k==0)cout<<"NA"<<endl;
  cout<<endl;
  }
return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>
  
int lpyrJudge(int x, int y);
  
int main(void)
{
    int sta, fin;
    while (true) {
        scanf("%d %d", &sta, &fin);
        if (sta == 0 && fin == 0) {
            break;
        } else {
            lpyrJudge(sta, fin);
        }
    }
    return 0;
}
  
int lpyrJudge(int x, int y)
{
    int minmod4x;   //x??\????????????°????4??????????°
    if (x % 4 == 0){
        minmod4x = x;
    } else {
        minmod4x = x - x % 4 + 4;
    }
    if (y - minmod4x < 4) {
        printf("NA\n");
    } else {
        int firstline = 0;
        for (int i = minmod4x; i <= y; i = i + 4) {
            if (firstline != 0) {
                printf("\n");
            }
            if (i % 100 == 0) {
                if(i % 400 == 0) {
                    printf("%d\n", i);
                } else {    //??????????????????????????????
                }
            } else {
                printf("%d\n", i);
            }
            firstline++;
        }
    }
    return 0;
}

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

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

C++: #include <iostream>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <math.h>
using namespace std;

int main(){
	
	int a,b,l=0;
	while(1){
		scanf("%d %d",&a,&b);
		if(a==0&&b==0)return 0;
		if(l==1)cout<<endl;
		int k=0;
		for(int i=0;i<b-a+1;i++){
			if((a+i)%4==0&&(a+i)%400!=100&&(a+i)%400!=200&&(a+i)%400!=300){cout<<a+i<<endl;k=1;}
		}
		if(k==0)cout<<"NA"<<endl;
		l=1;
	}
}

C++: #include <iostream>

using namespace std; 

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

C++: #include <iostream>

using namespace std;

int main(){

	int a,b;

	while(1){

		int count = 0;

		cin >> a >> b;
		cout << endl;
		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;
				count++;
			}

		}

		if(count == 0){
			cout << "NA" << endl;
		}

		cout << endl;
	}

	return 0;
}