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,count=0;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			break;
		}
		while(a<=b){
			if(a%4==0){
				if(a%100==0){
					if(a%400==0){
						cout<<a<<endl;
						count++;
					}
				}else{
					cout<<a<<endl;
					count++;
				}
			}
			a++;
		}
		if(count==0){
			cout<<"NA"<<endl;
		}
		count=0;
		cout<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

bool isLeap(int Y)
{
    if (Y % 400 == 0) return 1;
    if (Y % 100 == 0) return 0;
    if (Y % 4 == 0) return 1;
    return 0;
}

int main()
{
    int a, b;
    bool br = 0;
    while (cin >> a >> b, a) {
        if (br) cout << endl;
        br = 1;
        bool found = 0;        
        for (int i = a; i <= b; i++) {
            if (isLeap(i)) {
                found = 1;
                cout << i << endl;
            }
        }
        if (!found) {
            cout << "NA" << endl;
        }
    }
    
    return 0;
}

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

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

bool is_leap_year(int y);

int get_leap_years(int* lyl,int yb,int ye)
{
  int n=0;
  for(int i=yb;i<=ye;i++) {
      if(is_leap_year(i)) {
	  lyl[n]=i;
	  n++;
	}
    }
  return n;
}

int main()
{
    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]);
            }
        }
        
    }
}

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 na=true;
void uruu(int a){
    if(a%4==0&&a%100==0&&a%400==0){cout<<a<<endl;na=false;return;}
    else if(a%4==0&&a%100==0){return;}
    else if(a%4==0){cout<<a<<endl;na=false;return;}
    else return;
}


int main (int argc, const char * argv[])
{
    int a,b;
    bool first=true;
    while(cin>>a>>b){
        if(first)first=false;
        else cout<<endl;
        if(a==0&&b==0){return 0;}
        na=true;
        while(a<=b){
            uruu(a);
            a++;
        }
        if(na)cout<<"NA"<<endl;
        
    }
    }

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 << "NA" << endl;
		}
		if(j != (int)a.size() - 1)
			cout << endl;
	}
	return 0;
}

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

    if(a==0 && b==0) break;

    flag=0;

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

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;

typedef long long ll;
vector<int>V;

bool check_leap(int yr)
{
    if ((yr % 4 == 0) && !(yr % 100 == 0)|| (yr % 400 == 0))return true;
    else return false;
}


int main()
{
    #ifdef shibli
       //freopen("input.txt","r",stdin);
    #endif // shibli

    int A,B;
    bool line = false;
    while( scanf("%d %d",&A,&B) == 2 )
    {
        if( A == 0 && B == 0 )break;

        if( line )cout<<endl;

        line = true;

        for(int i = A; i<= B; i++ )
        {
            if( check_leap(i) )V.push_back(i);
        }

        if( V.size() == 0 )
        {
            cout<<"NA"<<endl;
        }
        else
        {
            for(int j = 0; j < V.size(); j++ )
            {
                cout<<V[j]<<endl;
            }
        }

        V.clear();
    }
}
/* Most men die at 25 , We just don't bury them until they are 70 - Benjamin Franklin */

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

using namespace std;

void uru(int c, int d) {
	int counter = 0;

	for (int i = c; i <= d; i++) {
		if (i % 4 == 0) {
			if (i % 100 == 0) {
				if (i % 400 == 0) {
					cout << i << endl;
					counter++;
				} 
			} else {
				cout << i << endl;
				counter++;
			}
		}
	}
	if (counter == 0) {
		cout << "NA" << endl;
	}
	cout << endl;
	return;
}

int main() {
	int a,b;

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0) {
			break;
		} else {
			uru(a,b);
		}
	}
	return 0;
}