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 <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

//define
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

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

C++: #include<stdio.h>

void leap_year(int start_year, int end_year);

int main(void)
{
  int start_year;
  int end_year;
    while(1){
    scanf("%d %d", &start_year, &end_year);
    if (start_year == 0 && end_year == 0) {
      break;
	} else {
    leap_year(start_year, end_year);
    }
    }
    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 <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 <stdio.h>

int main(void)
{
	while (1){
		int a, b;
		int n = 0;
		scanf("%d %d", &a, &b);

		if (a == 0 && b == 0) {
			break;
		}

		for (int i = a; i <= b; i++) {
			if (i % 4 == 0) {
				if (i % 100 == 0) {
					if (i % 400 == 0) {
						printf("%d\n", i);
						n++;
					}
				} else
				{
					printf("%d\n", i);
					n++;
				}
			}
		}

		if (n == 0) {
			printf("NA\n");
		}

		printf("\n\n");
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
	void judge(int a, int b);
	
	int main(void){
		int a, b;
		cin >> a >> b;
		if(a != 0 && b != 0){
			judge(a, b);
		}
		while(1){

			cin >> a >> b;
			if(a == 0 && b == 0){
				break;
			}
			cout << endl;
			judge(a, b);
		}
		return 0;	
	}
	void judge(int a, int b){
		int ans[1000] = {0};
		int j = 0;
		for(int i = a; i <= b; i++){
			if(i%400 == 0){
				ans[j] = i;
				j++;
			}else if(i%4 == 0 && i%100 != 0){
				ans[j] = i;
				j++;
			}
		}
		if(j == 0){
			cout << "NA" << endl;
 		}else{
 			int i;
 			for(i = 0; i < j ; i++){
 				cout << ans[i] << endl;
 			}
 		}
	}

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

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

int main(void){
    
    int leepyear[1000][745] = {0};
    int i,j=0,k = 0,l=0,m = 0,n= 0;
    int yearA,yearB;
    int checyear = 0;

    while(cin >> yearA >> yearB,yearA+yearB)
    {
        FOR(i, yearA, yearB+1)
        {
            checyear = i;
            if(checyear % 400 == 0)
            {
                leepyear[j][k] = checyear;
                k++;
                
            }else if((checyear % 4 == 0) && (checyear % 100 != 0))
            {
                leepyear[j][k] = checyear;
                k++;
            }
        }
        k = 0;
        j++;
    }
    REP(l, j)
    {
        n = 0;
        if(leepyear[l][0])
        {
            while (leepyear[l][n])
            {
                cout << leepyear[l][n] << endl;
                n++;
                
            }
            if( l != (j-1))
            cout << endl ;
        }
        else cout << "NA" << endl << endl;
    }
    
    return 0;
}

C++: #include <stdio.h>

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) break;

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA");

    printf("\n");
  }

  printf("\n");

  return 0;

}

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


using namespace std;

int main()
{
	bool first = true;
	while (true)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0)
			break;

		if (first)
			first = false;
		else
			printf("\n");

		bool notFound = true;
		for (int i = a; i <= b; ++i)
		{
			if (i % 4 == 0 && (i % 100 != 0 || i % 400 == 0))
			{
				printf("%d\n", i);
				notFound = false;
			}
		}
		if (notFound)
			puts("NA");
	}

	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <complex>

using namespace std;

//define
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF (INT_MAX/3)
#define PI (2*acos(0.0))
#define EPS (1e-8)

typedef long long ll;
typedef unsigned long long ull;

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