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>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          printf("\n");
          judge_leap_year(start_year, end_year);
          printf("\n");
        } else {
          printf("NA\n");
        }
      }
    }
    return 0;
}

void judge_leap_year(int a, int b)
{
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        printf("%d\n", year);
      } else if (year % 4 == 0 && year % 100 != 0) {
        printf("%d\n", year);
      }
    }
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

C++: #include <stdio.h>

void leap(int start, int end);

int main(void)
{
    int start, end;
    while (1){
        scanf("%d %d", &start, &end);
        if (start == 0 && end == 0){
            break;
        } else {
            leap(start, end);
        }
    }

    return 0;
}

void leap(int start, int end)
{
    int year;
    int cnt = 0;

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

    printf("\n");
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }


int a, b;

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

int main() {
    int con = 0;
    while (cin >> a >> b) {
        if (a == 0 && b == 0) break;
        if (con != 0) cout << endl;
        
        int res = 0;
        for (int i = a; i <= b; ++i) {
            if (check(i)) {
                ++res;
                cout << i << endl;
            }
        }
        if (res == 0) puts("NA");
        ++con;
    }
    return 0;
}

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

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

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

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

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

int main(void)
{
  int a, b;
  int flag;
  
  while(1)
    {
      cin >> a >> b;
      if(a == 0 && b == 0) break;
      flag = 0;

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

C++: #include <stdio.h>

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

int main(void)
{
    int year, from, until, num_leap_year;
    while (1) {
        num_leap_year = 0;
        scanf("%d %d", &from, &until);
        if (from == 0 && until == 0) {
            break;
        }
        for (year = from; year <= until; year++) {
            if (isLeapYear(year) == true) {
                num_leap_year++;
                printf("%d\n", year);
            }
        }
        if (num_leap_year == 0) {
            printf("NA\n");
        }
        printf("\n");
    }
    return 0;
}

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

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

void solve(int b, int e) {
    bool leap_exist = false;
    for (int i = b; i <= e; i++) {
        if (is_leap(i)) {
            leap_exist = true;
            cout << i << endl;
        } 
    }
    if (!leap_exist) {
        cout << "NA" << endl;
    }
}


int main() {
    int b, e;
    while (cin >> b >> e) {
        if (b == 0 && e == 0) break;
        solve(b, e);
        cout << endl;
    }
    return 0;
}

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

int main(){
	int a,b;
	int line =0;
	while(++line){
		cin >> a >> b;
		if(a==0 && b==0) break;
		int count=0;
		if(line > 1) cout << "\n";
		for(int i=a; i < b; i++){
			if((i % 4==0 && i % 100 !=0) || i % 400 ==0){
				cout << i << "\n";
				count++;
			} 
		}
		if(count ==0) cout << "NA\n";
	}

	return 0;
}