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>
 
bool inputValCheck(int input_n1, int input_n2);
void printLeapYear(int start_y, int end_y);
bool isLeapYear(int year);
 
 
int main()
{
    int start_year, end_year;
    std::cin >> start_year >> end_year;
    if (inputValCheck(start_year, end_year)) {
        printLeapYear(start_year, end_year);
    }
    return 0;
}
 
bool inputValCheck(int input_n1, int input_n2);
{
    if (input_n1 <= 0 || input_n1 > input_n2 || input_n2 >= 1000) {
        return false;
    }
    return true;
}
 
 
bool isLeapYear(int year)
{
    if (year % 400 == 0) {
        return true;
    } else if (year % 100 == 0) {
        return false;
    } else if (year % 4 == 0) {
        return true;
    } else {
        return false;
    }
}
 
void printLeapYear(int start_y, int end_y)
{
    bool is_leap_year = false;
    for (int i = start_y; i <= end_y; i++) {
        if (isLeapYear(i) == true) {
            std::cout << i << std::endl;
        }
    }
}

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

int main() {
  int from,end,check;
  while(cin >> from >> end) {
    check = 0;
    if((from == 0) && (end == 0)) break;
    for(int i=0;i<end - from + 1;i++) {
      if((from + i) % 4 == 0) {
        if((from + i) % 100 == 0) {
          if((from + i) % 400 == 0) {
            cout << from + i << endl;
            check = 1;
          }
        }
        else {
          cout << from + i << endl;
          check = 1;
        }
      }
    }
    if(check == 0)
      cout << "NA" << endl;
    cout << endl;
  }
}

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;
    if (cin >> b >> e) {
        if (b == 0 && e == 0) return 0;
        solve(b, e);
    }
    while (cin >> b >> e) {
        if (b == 0 && e == 0) break;
        cout << endl;
        solve(b, e);
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

bool isleap(int year) {
    return year%4==0 && (year%100!=0 || year%400==0);
}

void solve93(int a, int b) {
    int cnt = 0;
    FOR(i,a+1,b) {
        if (isleap(i)) cout << i << endl, cnt++;
    }
    if (cnt == 0) cout << "NA" << endl;
}

int main() {
    int a, b;
    bool start = true;
    while(cin >> a >> b, a+b) {
        if (!start) cout << endl;
        solve93(a, b);
        start = false;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
bool leap(int Y){
  if(Y%4==0)
    return( (Y%100==0)?( (Y%400==0)?true:false ):true ); 
  else return false;
}

int main(){
  int Y,aY;
  int cont=0;
  while(cin>>Y>>aY){
    if(Y==0 && aY==0) break;
    for(int i=Y;i<=aY;i++) if(leap(i)){
	cout<<i<<endl;
	cont++;
      }
    if(cont==0) cout<<"NA"<<endl;
    //cout<<endl;
    cont=0;
  }
}

C++: #include <iostream>
using namespace std;
#define p(dis) cout << dis << endl

int func(int a, int b){
	int f = 1;
	for(int i = a;i <= b;i++){
		if(i % 4 == 0){
			if(i % 100 == 0){
				if(i % 400 == 0)p(i), f = 0;
				continue;
			}
			p(i), f = 0;
		}
	}
	return f;
}

int main(){
	int a = 1, b;
	while(cin >> a >> b, a+b){
		if(func(a, b))cout << "NA" <<endl;
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int a,b;

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

C++: #include <cstdio>

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

int main(void){
	int s_year, e_year, n_data;
	bool flag;//うるう年があるかどうか
	n_data=0;//いくつ目のデータセットか

	while (1) {
		scanf("%d%d", &s_year, &e_year);
		if (s_year == 0 && e_year == 0) {
			break;
		}

		if (n_data != 0) {//もし最初のデータセットでなければ
			printf("\n");
		}

		flag = false;
		for (int i=s_year; i <= e_year; i++) {
			if (judge(i)) {
				printf("%d\n", i);
				flag = true;
			}
		}
		if (!flag) {//もしうるう年がなければ
			printf("NA\n");
		}

		n_data++;
	}

	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<iostream>
#include<cstdio>
#include<vector>

using namespace std;

#define loop(i, a, b) for(int i = a; i < b; i++)

int main()
{
  int a, b, c = 0;
  
  while(1) {
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    if (c++)cout << endl;
    int cnt = 0;
    loop(i, a, b + 1) {
      if(i % 400 == 0) { cout << i << endl; cnt++; }
      else if(i % 100 && i % 4 == 0) { cout << i << endl; cnt++; }
    }
    if (!cnt)  cout << "NA" << endl;

  }
}

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

int main()
{
	int a, b;

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

		if (check){
			printf("NA\n");
		}

		printf("\n");
	}

	return (0);
}

C++: #include <iostream>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

int a,b;
	
	while(cin >> a >> b){
		if(a==0  && b==0 || cin.eof()) break;
		int cnt=0;
		cout << endl;
		while(1){
			if(a%400 == 0 || a%100 != 0 && a%4 == 0 ){
				cout << a << endl;
				cnt++;
			}
			a++;
			if(a > b) break;
		}	
		if(cnt==0) cout << "NA" << endl;
//		cout << endl;
	}
	return 0;
	
}