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 <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>
#include <numeric>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	vector<int> a, b;
	while (1) {
		int aa, bb;
		cin >> aa >> bb;
		if (aa == 0 && bb == 0)break;
		a.push_back(aa);
		b.push_back(bb);
	}
	rep(j, (int)a.size()) {

		int ans = 0;

		Rep(i, a[j], b[j] + 1) {
			if (i % 4 == 0) {
				if (i % 100 != 0) {
					ans++;
					cout << i << endl;
				}
				else if (i % 400 == 0) {
					ans++;
					cout << i << endl;
				}
			}
		}

		if (ans == 0) {
			cout << endl << "NA" << endl << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
int main(){
  int a,b;
  for(int c=0; cin >>a>>b,a||b; c++){
    if(c){cout<<endl;}
    vector<int> year;
    for(int i=a; i<=b; i++){
      if(!(i%4) && i%100){year.push_back(i);}
      else if(!(i%400)){year.push_back(i);}
    }
    if(year.empty()){cout<<"NA"<<endl;}
    else{for(int i=0; i<year.size(); i++){cout <<year[i]<<endl;}}
  }
  return 0;
}

C++: #include <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
	return 0;
}

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) 
            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");
    }
    return 0;
}

C++: #include <stdio.h>

int leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    scanf("%d %d", &first_year, &last_year);
    while (1) {
        if (first_year == 0 && last_year == 0) {
            break;
        } else {
            leap_year(first_year, last_year);
        }
        scanf("%d %d", &first_year, &last_year);
        }
    return 0;
}

int leap_year(int first_year, int last_year)
{
    int count = 0;
    printf("\n");
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
}

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) {
          judge_leap_year(start_year, end_year);
        } else {
          printf("NA\n");
        }
      }
    printf("\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);
        }
      }
    printf("\n");
}
//閏年を記述する                                                                                                                                                                     

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_year(int year1, int year2);

int main(void)
{
    while(1){
        int a, b; /*a は year1　, b は year2*/
        scanf("%d %d", &a, &b);
        if (a == 0 && b == 0){
            break;
        }else if (a == b){
            printf("NA\n");
            printf("\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit; /*もしも、うるう年がなかった時に使う*/
    for(int i = year1; i <= year2; ++i){
        if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
            printf("%d\n", i);
        }else{
            ++limit;
        }
    }
    if (limit == (year2 - year1 + 1)){/*うるう年がない場合*/
        printf("NA\n");
        printf("\n");
    }else{    /*うるう年がある場合*/
    printf("\n");
    }
}

C++: #include <iostream>

using namespace std;

int main() {
  int a, b;
  bool flag2 = false;
  while (cin >> a >> b) {
    if (a == 0 && b == 0) break;
    if (flag2) cout << endl;
    flag2 = true;

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

  return 0;
}

C++: #include <cstdio>
int main(){
	int a, b, d = 0;
	while(scanf("%d%d", &a, &b), a){
		if(d++)puts("");
		int c = 0;
		for(;a<=b;a++){
			if(a % 4 < 1)
				if(a % 100)c++, printf("%d\n", a);
				else 
					if(a % 400 < 1){c++, printf("%d\n", a);}
		}
		if(!c)puts("NA");
	}
}