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<stdio.h>
  
int leap_year(int x);
  
  
int main(void)
{
    int start_year, end_year, counter;
    counter = 0;
    scanf("%d %d", &start_year, &end_year);
    for(int i = start_year; i =< end_year; i++){
        leap_year(i);
        counter += leap_year(i);
    } 
    if( counter = 0){
        printf("NA");
    }
    return 0;
}
  
  
int leap_year(int x)
{
    if(x % 4 = 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}

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

C++: #include<cstdio>
main(){int a,b,c,d=0;while(scanf("%d%d",&a,&b),c=a){d++&&puts("");for(;a<=b;a++)c*=printf(a%4<1&&a%25|a%16<1?"%d\n":0,a)<0;c&&puts("NA");}}

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

int main()
{
	vector<int> a;
	for(int i=1;i<4000;i++)
	{
		if(i%400!=0&&i%100==0)continue;
		if(i%4==0)a.push_back(i);
	}
	int A,B;
	bool f=false;
	while(cin>>A>>B&&A&&B)
	{
		if(f)cout<<endl;
		f=true;
		bool flag=true;
		for(int i=0;i<a.size();i++)
		{
			if(A<=a[i]&&a[i]<=B)
			{
				flag=false;
				cout<<a[i]<<endl;
			}
			
		}
		if(flag)cout<<"NA"<<endl;
	}
	
}

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);
        }
      }
}
//閏年を記述する                                                                                                                                                                     

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 <iostream>

using namespace std;

int main(){

	int a,b;

	while(1){

		int count = 0;

		cin >> a >> b;
		cout << endl;
		if(a == 0 && b == 0) break;

		for(int i = a; i <= b; i++){

			if(i % 4 == 0 && i % 100 != 0 || i % 400 == 0){
				cout << i << endl;
				count++;
			}

		}

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

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>

using namespace std;

int main()
{
    bool is_leap[3000] = {};
    for( int i=1; i<3000; ++i ) {
        if ( i % 4 == 0 ) {
            if ( i % 100 == 0 ) {
                if ( i % 400 == 0 ) {
                    is_leap[i] = true;
                }
            } else {
                is_leap[i] = true;
            }
        }
    }

    int a, b;
    bool d=false;
    while( cin >> a >> b, a||b ) {
        vector<int> v;
        for( int i=a; i<=b; ++i ) {
            if ( is_leap[i] )
                v.push_back( i );
        }

        if ( d )
            cout << endl;
        else
            d = true;

        if ( v.empty() ) {
            cout << "NA" << endl;
        } else {
            copy( v.cbegin(), v.cend(), ostream_iterator<int>( cout, "\n" ) );
        }
        
    }
}

C++: #include <iostream>

bool judge_uruyear(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 print_uruyear(int year_begin, int year_end)
{

    int count_year = 0;

    for(int i = year_begin; i < year_end; i++) {
        if (judge_uruyear(i)) {
            count_year += 1;
            std::cout << i << std::endl;
        }    
    }

    if(count_year == 0) {
        std::cout << "NA" << std::endl;
    }

    std::endl(std::cout);

}

int main()
{

    int year_begin, year_end;

    while(true) {
        
        std::cin >> year_begin >> year_end;
        
        if(year_begin == 0 && year_end ==0) {
            break;
        }
        
        print_uruyear(year_begin, year_end);

    }
    
    return 0;
}

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

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




  }

}

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");
            } 
            printf("\n");
        }
    }
    return 0;
}
    
    
int leap_year(int x)
{
    if((x % 4 == 0 && !(x % 100 == 0)) || x % 400 == 0){
        printf("%d\n", x);
        return 1;
    }
    return 0;
}