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 a,b,i,j;
  cin >> a >> b;
  while(a!=0 || b!=0){
    j=0;
    for(i=1;i<=3000;i++){
      if(i>=a && i<=b && i%4==0){
	if( (i%100==0 && i%400==0)  || i%100!=0 ){
	  j++;
	  cout << i << endl;
	}
      }
    }
    if(j==0){
      cout << "NA" <<endl;
    }
    
    cin >> a >> b;
    cout << endl;
  } 

}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>

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

C++: #include <bits/stdc++.h>
using namespace std;
/* {{{ */
/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()
#define PB push_back
#define pb push_back
#define mp make_pair
#define FI first
#define SE second

inline int in(){int x;std::cin>>x;return x;}

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;
/*-------------------------------*/
/* }}} */

int main(void)
{
  while (1){
    int a, b;
    bool frag = false;

    cin >> a >> b;
    if (a == 0 && b == 0) break;
    else cout << endl;

    for (int i = a; i <= b; i++){
      if (i % 4 == 0 && i % 100 != 0){
        cout << i << endl;
        frag = true;
      }
      if (i % 100 == 0 && i % 400 == 0){
        cout << i << endl;
        frag = true;
      }
    }
    if (!frag) cout << "NA" << endl;
  }

  return 0;
}

C++: #include <stdio.h>

void uruu(int a, int b);
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0093#
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>


int leap_year(int y) {
	if( y % 400 == 0) {
		return 1;/*???????????´*/
	} else if (y % 100 == 0 && y % 400 != 0) {
		return 0;/*???????????´??§??????*/
	} else if (y % 4 == 0 && y % 100 != 0) {
		return 1;
	} else {
		return 0;
	}
}
int main()
{
	int a;
	int b;
	while (true) {
		std::cin >> a >> b;
		if (a == 0 && b == 0) {
			break;
		} else {
			int sum = 0;
			for (int k = a; k <= b; k++) {
				sum = sum + leap_year(k);
			}
			if (sum == 0 /*????????????????????´?????????*/) {
				std::cout << "NA" << std::endl;
			} else {
			    for (int i =a; i <= b; i++) {
					if (leap_year(i) == 1) {
						std::cout << i << std::endl;
					}
				}
			}
			std::cout << std::endl;
			std::cout << std::endl;
		}
	}
	return 0;
}

C++: #include <stdio.h>

void leapyear(int start, int end);

int main(void)
{
    int start, end;
    while (1){
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0){
            break;
        } else {
            // 2回目の出力からは前回の出力とのあいだに空行をおく
            static int first_output = 1; 
            if (first_output != 1){
                printf("\n");
            }
            first_output = 0;

            leapyear(start, end);
        }
    }

    return 0;
}

void leapyear(int start, int end)
{
    int cnt = 0;
    for (int year = start; year <= end; year++){
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)){
            printf("%d\n", year);
            cnt++;
        }
    }
    if (cnt == 0){
        printf("NA\n");
    }
}

C++: #include <stdio.h>

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

C++: #include <stdio.h>
#include <stdbool.h>
 
bool is_leap_year(int y);
int  get_leap_years(int list[], int begin, int end);
 
int main(void)
{
    int leap_years_list[1000]; //A.D. 0 - A.D. 3000 の間に閏年は高々1000個しかない
 
    bool first_set = true; //一つ目のセットの前にだけは改行を入れてはいけないので
 
    while (true) {
        int year_begin, year_end;
 
        //読み込み
        scanf("%d %d", &year_begin, &year_end);
 
        //終了判定
        if (year_begin == 0 && year_end == 0) {
            break;
        }
 
        //閏年を計算する
        int leap_years_count = get_leap_years(leap_years_list, year_begin, year_end);
 
        //セットとセットの間には空行を入れる
        if (first_set) {
            first_set = false;
        } else {
            putchar('\n'); //putcharは一文字だけ出力する関数です
        }
 
        //閏年を出力
        if (leap_years_count == 0) {
            puts("NA"); //putsは与えられた文字列を出力した後改行する関数です
        } else {
            for (int i = 0; i < leap_years_count; i++) {
                printf("%d\n", leap_years_list[i]);
            }
        }
 
    }
}

int  get_leap_years(int list[], int begin, int end)
{
    int i;
    for (int year = begin; year <= end; year++) {
    if (is_leap_year(year)) {
    i++
    }
    return i;
}

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

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

bool isLeapYear(int year){
    return ( year%4 == 0 && year%100 != 0 || year%400 == 0 )? true : false ;
}

int main(){
	int a,b;
	bool flag, iniFlag = true;
	
	while( cin >> a >> b , a || b ){
		flag = true;
		if( iniFlag == false ){
			cout << endl;
		}else{
			iniFlag = false;
		}	

		for(int i=a ; i<=b ; i++){
			if( isLeapYear(i) ){
				flag = false;
				cout << i << endl;
			}
		}
		if( flag ) cout << "NA" << endl;		
	}
}