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;
int main(){
  int n,m;
  bool x = false;
  while(cin >>n>>m,n||m){
    if(x) cout <<endl;
    x = true;
    bool f = false;
    for(int i=n; i<=m; i++){
      if(i%400 == 0){cout <<i<<endl;f = true;}
      else if(i%100 == 0) continue;
      else if(i%4 == 0){cout <<i<<endl;f = true;}
    }
    if(!f) cout <<"NA"<<endl;
  }
  return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>

void leap_year (void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        int i;
        for (i = year1; i <= year2; ++i) {
            if (i % 4 == 0) {
                if (i % 400 == 0) {
                    printf("%d\n", i);
                } else if (i % 100 != 0) {
                    printf("%d\n", i);
                }
            } 
        }
    }
}

int main(void)
{
    leap_year();
    return 0;
}

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;
                flag = true;
}           else if (i % 400 == 0){
                std::cout << i << std::endl;
                flag = true;
}
}
        if (flag == false){
            std::cout << "NA" << std::endl;
}
        std::cout << std::endl;
}
    return 0;
}

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

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
//is(string &s){int c; s = "";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
//void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

int main() {
	bool first = true;
	for (int a, b; a = in(), b = in(), a || b;) {
		if (first)
			first = false;
		else
			out('\n');
		bool f = false;
		for (int m = a % 4, i = a + (m ? 4 - m: 0); i <= b; i += 4)
			if (!(i % 400) || i % 100) {
				f = true;
				out(i, '\n');
			}
		out(f ? "" : "NA\n");
	}
}

C++: #include <iostream>

using namespace std;

bool input(int* m, int* n){
	cin >> *m >> *n;
	return !(*m == 0 && *n == 0);
}

int main(void){
	int a, b;
	bool line = false;
	while(input(&a, &b)){
		if(line){
			cout << endl;
		}else{
			line = true;
		}
		bool na = true;
		for(int i = a; i <= b; i++){
			if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
				cout << i << endl;
				na = false;
			}
		}
		if(na){
			cout << "NA" << endl;
		}
	}

	return 0;
}

C++: #include <stdio.h>
#include <stdbool.h>


void leapyear (int year1, int year2)
{
    printf("\n");
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
}

int main(void)
{
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
    }
    return 0;
}

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

int main(){
  int a,b,c=0;
  vector<int> year;
  for(;;){
    cin>>a>>b;
    if(!(a||b))break;

    if(c!=0)
      cout<<endl;

    for(int i=a;i<=b;i++){
      if(i%4==0){
	if(i%100==0){
	  if(i%400==0) year.push_back(i);
	  continue;
	}else{
	  year.push_back(i);
	}
      }
    }

    if(year.size()==0) {
      cout<<"NA"<<endl;
      goto NEXT;
    }

    for(vector<int>::iterator it=year.begin(); it != year.end(); ++it)
      cout<<*it<<endl;

  NEXT:
    year.clear();
    c++;
  }
}

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

C++: #include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-13
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  bool flag = true;
  vi leap;
  REP(i,3535){
    if(i%4==0 && (i%100!=0 || i%400==0))leap.push_back(i);
  }
  while(true){
    int a,b;
    cin>>a>>b;
    if(!a && !b)break;
    if(flag){
      flag = false;
    }else{
      cout<<endl;
    }
    int left = lower_bound(ALL(leap),a) - leap.begin();
    int right = upper_bound(ALL(leap),b) - 1 - leap.begin();
    if(left > right){
      cout<<"NA"<<endl;
    }else{
      FOR(i,left,right+1)cout<<leap[i]<<endl;
    }
  }
  return 0;
}

C++: #include<stdio.h>
int main(){
	int year;
	int s,l,i,j=0,k=0,m=0,flag=0,ans[300][300]={0};
	
	while(scanf("%d%d",&s,&l)!=EOF){
		if(s==0 && l==0)break;
	for(i=s;i<=l;i++){
		if(i%4==0){
			if(i%100!=0 || i%400==0){
			ans[j][k]=i;
			flag=1;
				k++;
			}
		}
	}
	if(flag==0)ans[j][k]=-10;
		flag=0;
		j++;
		k=0;
	}
	
	for(i=0;i<j;i++){
		for(k=0;;k++){
			if(ans[i][k]!=-10){
				if(ans[i][k]==0)break;
				printf("%d\n",ans[i][k]);
			}
		else printf("NA\n");
		}
		printf("\n");
	}
return 0;
}