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 argc, char **argv)
{
	int a, b, f;
	
	while(1){
		cin >> a >> b;
		if(a == 0 && b == 0){
			break;
		}
		cout << endl;
		
		for(f = 0; a <= b; a++){
			if(a%400 == 0 || (a%4 == 0 && a%100 != 0)){
				cout << a << endl;
				f = 1;
				a += 4;
				break;
			}
		}

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

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define sz(obj) ((int)(obj).size())
#define pb push_back

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

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

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

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

int main() {
  int a, b;
  for (int T = 0; cin >> a >> b, a | b; ++T) {
    if (T > 0) { cout << endl; }
    bool exist = false;
    for (int y = a; y <= b; ++y) {
      if ((y % 400 == 0) || (y % 4 == 0 && y % 100 != 0)) {
        cout << y << endl;
        exist = true;
      }
    }
    if (!exist) { cout << "NA" << endl; }
  }
}

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("\n");
            printf("NA\n");
        }else {
            leap_year(a, b);
        }
    }
    return 0;
}

void leap_year(int year1, int year2)
{   
    int limit = 0; /*もしも、うるう年がなかった時に使う*/
    printf("\n");
    for (int i = year1; i <= year2; ++i){ /*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");
    }
}

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

int main(){

  int a, b, valid;

  while(cin >> a >> b){
    if(a == 0 && b == 0) break;
    valid = 0;
    
    for(int i=a; i<=b; i++){
      if(i % 400 == 0 || (i % 4 == 0 && i % 100 != 0)){
        cout << i << endl;
        valid = 1;
      }
    }

    if(valid == 0) cout << "NA" << endl;
    cout << endl;

  }

  return 0;

}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int a, b;
        cin >> a >> b;
        if(a == 0)
            return 0;

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

C++: #include <iostream>
#define REP(i,k,n) for(int i=k;i<n;i++)
using namespace std;

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

		bool flag = true;
		REP(i,a,b+1)
		{
			if(i%400 == 0)
			{
				flag = false;
				cout << i << endl;
			}
			else if(i%100 != 0 && i%4 == 0)
			{
				flag = false;
				cout << i << endl;
			}
		}

		if(flag)
		{
			cout << "NA" << 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) {
      printf("\n");
      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<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;
    }
    cout << endl;
    cin >> a >> b;
  } 

}

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	while(cin >> a >> b)
	{
		if(!a && !b)
		{
			break;
		}
		bool flag = true;
		for(int i = a; i <= b; ++i)
		{
			if(i % 400 == 0)
			{
				cout << i << endl;
				flag = false;
			}
			else if(i % 100 != 0 && i % 4 == 0)
			{
				cout << i << endl;
				flag = false;
			}
		}
		if(flag)
		{
			cout << "NA" << endl;
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}