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>
#include <stdbool.h>

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
            }
        } 
        if (exist == 0) {
            printf("NA\n");
        }
        printf("\n");
           
    }
    return 0;        
}

C++: #include<cstdio>
main(){int a,b,d=0,c;while(scanf("%d%d",&a,&b),a){if(d++)puts("");c=0;for(;a<=b;a++)if(a%4<1)if(a%25||a%16<1)c++,printf("%d\n",a);if(!c)puts("NA");}}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

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

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

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

int main(void){
	int a,b;
	bool first = true;

	while(cin>>a>>b && (a||b)){
		if(first) first = false;
		else cout<<endl;

		int count = 0;

		for(int i=a;i<=b;i++){
			if(isLeap(i)){
				cout<<i<<endl;
				count++;
			}
		}

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

	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<map>
#include<cstdio>
#include<cmath>
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
	int a,b;
	bool h=true;
	while(cin>>a>>b,a|b){
		if(!h)cout<<endl;
		h=false;
		int co=0;
		loop(i,a,b){
			if(i%4!=0||(i%100==0&&i%400!=0));
			else{cout<<i<<endl;co++;}
		}
		if(!co)cout<<"NA"<<endl;
	}	
}

C++: #include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

inline bool isleap(int year){
	if(year%400==0)
		return true;
	if(year%100==0)
		return false;
	if(year%4==0)
		return true;
	return false;
}

int main(void){
	int a,b;
	bool space=false;
	while(cin >> a >> b,a|b){
		if(space) puts("");
		bool ans=false;
		range(i,a,b+1) if(isleap(i)) cout << i << endl,ans=true;
		if(!ans) puts("NA");
		space=true;
	}
	return 0;
}

C++: #include<iostream>

bool isuru( int y )
{
 	return ( y % 4 == 0 && y % 100 != 0 ) || y % 400 == 0;
}

int main()
{
	int a, b;
	
	while( 1 ){
		std::cin >> a >> b;
		
		if( !a && !b ) break;
		
		bool f = false;
		
		for( int i = a; i <= b; i++ ){
			if( isuru( i ) ){
				std::cout << i << std::endl;
				f = true;
			}
		}
		
		if( !f ){
		 	std::cout << "NA" << std::endl;
		}
		
		std::cout << std::endl;
	}

 	return 0;
}

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

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

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
 
int main()
{
	int a,b;
	bool first = true;	
	for(;;){
		cin>>a>>b;		
		if(a==0) return 0;
		if(!first)
            		cout << endl;
       		else
            		first = false;
		if(a%4!=0) a=a-(a%4)+4;
		if((a%100==0)&&(a%400!=0)) a+=4;
		bool na=true;
		for(int i=a;a<=b;a=a+4){
			if((a%100==0)&&(a%400!=0)) continue;
			cout << a << endl;
			na=false;
		}
		if(na) cout<<"NA"<<endl;
	}
}

C++: #include <stdio.h>

void leap(int a, int b);

int main(void)
{
    int a, b, n;
    n = 0;
    while (1){
	scanf("%d %d", &a, &b);
	if (a == 0 && b == 0) {
	    break;
	}
	if (n != 0) {
	    printf("\n");
	}
	leap(a, b);
	n ++;
    }
    return 0;
}

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

C++: #include <stdio.h>

void uruu(int a, int b);

int main(void)
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0) {
        uruu(a, b);
        scanf("%d %d", &a, &b);
        printf("\n")
    }
    return 0;
}


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}

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

int main() {
	int c,d,i,j,k,f;
	vector<int> a,b;
	while(cin >> c >> d) {
		if (c+d==0) break;
		a.push_back(c); b.push_back(d);
		}
	k=a.size();
	for (i=0;i<k;i++) {
		if (i>0) cout << endl;
		j=(a[i] % 4 == 0) ? a[i] : (a[i]/4)*4+4;
		f=0; 
		for (j;j<=b[i];j+=4) {
			if (j % 100 ==0 && j % 400!=0) continue;
			cout << j << endl;
			f=1;
		}
		if (f==0) cout << "NA" << endl;
	}
   return 0;
}

C++: #include <iostream>

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