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<bits/stdc++.h>
using namespace std;

bool is_uruu(int x){
    return x%400==0||(x%4==0&&x%100!=0);
}
int main(){
    int a,b;
    bool flag=false;
    while(cin>>a>>b,a||b){
        if(flag)cout<<endl;
        else flag=true;

        bool latte=false;
        for(int i=a;i<=b;i++){
            if(is_uruu(i)){
                latte=true;
                cout<<i<<endl;
            }
        }
        if(!latte)cout<<"NA"<<endl;

    }
    return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b,count;
	bool f=false;
	while(true){
	    cin>>a>>b;
		if(f==true)
		    cout<<endl;
		f=true;
		count=0;
		if(a==0&&b==0)
			break;
		bool h=false;
		for(int i=a;i<=b;i++){
			bool t=false;
			if(i%4==0)
				t=true;
			if(i%100==0)
				t=false;
			if(i%400==0)
				t=true;
			if(t==true){
				cout<<i<<endl;
				h=true;
			}
		}
		if(h==false)
			cout<<"NA"<<endl;
	}
    return 0;
}

C++: #include <iostream>

using namespace std;

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

C++: #include<stdio.h>
int main(void)
{
	int i,a,b,w,x,flg,cnt;
	cnt=0;
	scanf("%d %d",&a,&b);
	while(a!=0 && b!=0){
		flg=0;
		if(cnt!=0){
			printf("\n");
		}
		for(i=a;i<b;i++){
			if(i%4==0){
				if(i%100!=0){
					printf("%d\n",i);
					flg=1;
				}
			}
			else if(i%400==0){
				printf("%d\n",i);
				flg=1;
			}
			cnt++;
		}
		if(flg==0){
			printf("NA\n");
		}
		scanf("%d %d",&a,&b);
	}
	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<iostream>
using namespace std;

int main(){
	int year[3001];
	for(int i=0;i<3001;i++){
		if(i%4==0){
			year[i]=1;
		}else year[i]=0;
		if(i%100==0){
			year[i]=0;
		}
		if(i%400==0){
			year[i]=1;
		}
	}
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			break;
		}
		int cnt=0;
		for(int j=a;j<=b;j++){
			if(year[j]==1){
				cout<<j<<endl;
				cnt++;
			}
		}
		if(cnt==0)cout<<"NA"<<endl;
	}
	return 0;
}

C++: #include<iostream>
int main(){for(int a,b,c;std::cin>>a>>b,a||b;){c=0;for(;a<=b;a++)if(!(a%400)||!(a%4)&&(a%100))c++,std::cout<<a<<'\n';if(!c)std::cout<<"NA\n";puts("");}}

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

vector< int > LeapYear(int a, int b, vector<int > vec){
	for (int i = a; i <= b; i++){
		if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
			vec.push_back(i);
		}
	}
	return vec;
}

int main(){
	vector<int > vec;
	int a, b;

	// first input
	cin >> a >> b;

	while (a || b){
		vec.clear();
		vec = LeapYear(a, b, vec);

		// output
		if (!vec.empty()){
			for (int i = 0; i < vec.size(); i++){
				cout << vec.at(i) << endl;
			}
		}
		else{
			cout << "NA" << endl;
		}

		// input
		cin >> a >> b;
		if (a || b){
			cout << endl;
		}
	}

	return 0;
}

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

bool is_leap_year(int y);

int get_leap_years(int* leap_year_array, int start_year, int final_year);
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;
    }
}

int get_leap_years(int* leap_year_array, int start_year, int final_year)
{
    int count = 0;
    for(int i = start_year; i <= final_year; i++){
        if(is_leap_year(i)){
            leap_year_array[count] = i;
            count++;
        }
    }
    return count + 1;
}

C++: #include<iostream>

using namespace std;

int main(){

  int start, end;

  int roll = 0;

  while(cin >> start >> end){
    if(start == 0 && end == 0) break;
    if(roll != 0) cout << endl;
    int sum = 0;

    for(int i = start; i <= end; i++){
      if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
	cout << i << endl;
	sum++;
      }
    }
    if(sum == 0) cout << "NA" << endl;
    roll++;
  }

  return 0;
}

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

int main(){
  queue<int> year;
  int a,b,cou,count,tmp,i;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    cou = b - a + 1;
    for(i=0;i<cou;i++){
      tmp = a + i;
      if(tmp%4 == 0 && tmp%100 != 0 || tmp%400 == 0){
	year.push(tmp);
      }
    }
    count = year.size();
    if(count == 0){
      cout << "NA" << endl;
    }
    else{
      for(i=0;i<count;i++){
	cout << year.front() << endl;
	year.pop();
      }
    }
  }
}

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

int n;

using namespace std;


int main(){
    int a,b;
    while(cin>>a>>b){
        if(a==0&&b==0)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){
                
            }else if( i%4==0){
                cout<<i<<endl;
                flag=false;
            }
        }
        
        if(flag)cout<<"NA"<<endl;
        cout<<endl;
    }
}

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

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

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