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 <algorithm>
using namespace std;


const int n_day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
struct Date {
  // year, month, day, a day of the week
  int y, m, d, e;
  Date() {}
  Date(int y, int m, int d, int e) : y(y), m(m), d(d), e(e) {}
 
  bool operator < (const Date &o) const {
    if(y != o.y) return y < o.y;
    if(m != o.m) return m < o.m;
    return d < o.d;
  }
 
  bool isLeapYear() {
    if(y % 400 == 0) return true;
    if(y % 100 == 0) return false;
    if(y % 4 == 0) return true;
    return false;
  }

  int getDays() {
    int nd = n_day[m];
    if(m == 2) nd += isLeapYear();
    return nd;
  }

  void next() {
    e = (e+1)%7;
    if(d == getDays()) {
      d = 1;
      if(m == 12) {
        m = 1;
        ++y;
      } else {
        ++m;
      }
    } else {
      ++d;
    }
  }
 
  void back() {
    e = (e+6)%7;
    if(d == 1) {
      if(m == 1) {
        m = 12;
        --y;
      } else {
        --m;
      }
      d = getDays();
    } else {
      --d;
    }
  }
};

// AOJ 0093
int main() {
  for(int tc = 0; ; ++tc)  {
    int a, b;
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    Date d(a,1,1,-1), end(b+1,1,1,-1);
    int res = 0;
    if(tc) cout << endl;
    while(d < end) {
      if(d.isLeapYear()) {
	cout << d.y << endl;
	++res;
      }
      ++d.y;
    }
    if(res == 0) cout << "NA" << endl;
  }
  return 0;
}

C++: #include <iostream>

int LeapYear (int x);
int main()
{
    int a,b;
    std::cin >> a >> b;
    while (true) {
        int n = 0;
        if (a == 0 && b == 0) {
	        break;
        } else {
            for (int i = a; i <= b; i++) {
                if (LeapYear (i) == 1) {
                    std::cout << i << std::endl;
                    n++;
            }				
        }
        if (n == 0) {
            std::cout << "NA" << std::endl;
        }
        std::cout << std::endl;
        std::cin >> a >> b;
        }
    }
    return 0;
}

int LeapYear (int x)
{
    if (x % 400 == 0) {
    return 1;
    } else if (x % 100 == 0) {
    return 0;
    } else if (x % 4 == 0) {
    return 1;
    }else {
    return 0;
    }
}

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

int z;

int leap(int year){
	if(year % 400 == 0){
		cout << year << endl;
		z++;
	}
	else if (year % 4 == 0){
		if(year % 100 != 0){
			cout << year << endl;
			z++;
		}
	}
	return 0;
}

int main(){
	int a, b;
	z == -1;
	while(cin >> a >> b){
		if (a == 0 && b == 0) { break; }
		if (z != -1) {
			cout << endl;
		}
		z = 0;
		for ( int i = a;i<=b;i++){
			leap(i);
		}
		if (z == 0){
			cout << "NA" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
bool isLeapYear(int year)
{
    return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}

bool printLeapYears(int from, int to)
{
    bool found = false;
    for (int i = from; i <= to; i++) {
        if (isLeapYear(i)) {
            std::cout << i << std::endl;
            found = true;
        }
    }
    return found;
}

int main()
{
    int from, to;
    bool found;
    bool isFirst = true;
    while (true) {
        std::cin >> from >> to;
        if (from == 0 && to == 0) {
            break;
        }
        if (!isFirst) {
            std::cout << std::endl;
        }
        isFirst = false;
        if (!printLeapYears(from, to)) {
            std::cout << "NA" << std::endl;
        }
    }
}

C++: #include <iostream>
using namespace std;
int main() {
  bool f = 0;
  int a, b;
  while (cin >> a >> b) {
    if (a == b && a == 0) break;
    if (f) cout << endl;
    for (f = 0; a <= b; a++) {
      if ((a % 4 == 0) && ((a % 400 != 0) || (a % 400 == 0))) {
        cout << a << endl;
        f = 1;
      }
    }
    if (!f) cout << "NA" << endl;
    f = 1;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
void uruu(int, bool&);

int main() {
	int a, b;
	cin >> a >> b;

	while (true) {
		
		bool write = false;

		for (int i = a;i <= b;i++) {
			uruu(i, write);
		}
		if (!write)cout << "NA" << endl;
		
		cin >> a >> b;
		if (a == 0 && b == 0) break;
		cout << endl;
	}

	return 0;
}

void uruu(int year, bool& write) {
	if (year % 400 == 0) {
		cout << year << endl;
		write = true;
		return;
	}
	else if (year % 100 == 0) {
		return;
	}
	else if (year % 4 == 0) {
		cout << year << endl;
		write = true;
		return;
	}
	else {
		return;
	}
}

C++: #include <stdio.h>

int leap_year(int, int);

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

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

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

int main()
{
    int a,b;
    int t = 0;

    while(cin >> a >> b , a || b)
    {
        bool NAflag = true;

        if(t != 0)cout << '\n';
        for(int i=a; i<=b; i++){
            if(i%4 == 0 && (i%100 != 0 || i%400 == 0)){
                cout << i << endl;
                NAflag = false;
            }
        }
        if(NAflag){
            cout << "NA" << endl;
        }
        
        t++;
    }

    return 0;
}

C++: #include<iostream>
 
using namespace std;
 
int main() {
    int a[3000], b[3000],n=0;
    while(1){
        cin >> a[n] >> b[n];
    if (a[n] == 0 && b[n] == 0)break;
        n++;
    }
    for(int j=0;j<=n;j++){
        if (a[j] == 0 && b[j] == 0)break;
        int cnt = 0;
        if (j != 0)cout << endl;
        for (int i = a[j]; i <= b[j]; i++) {
             
             
            if (i % 4 == 0) {
                if (i % 100 == 0) {
                    if (i % 400 == 0) {
                        cnt++;
                        cout << i << endl;
                    }
                }
                else {
                    cnt++;
                    cout << i << endl;
                }
            }
            if (i == b[j]) {
                if (cnt == 0)cout << "NA" << endl;
            }
        }
    }
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

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