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;
int main(void){
    int a,b,us,ue,loop=0;
    while(cin>>a>>b&&a!=0&&b!=0){
        if(loop!=0) cout<<endl;
        for(int i=0;i<8;i++){
            if(((a+i)%4==0&&(a+i)%100!=0)||(a+i)%400==0){
                us=a+i;
                break;
            }
        }
        for(int j=0;j<8;j++){
            if(((b-j)%4==0&&(b-j)%100!=0)||(b-j)%400==0){
                ue=b-j;
                break;
            }
        }
        if(us>ue) cout<<"NA"<<endl;
        else{
            for(int k=us;k<=ue;k+=4){
                if((k%4==0&&k%100!=0)||k%400==0){
                    cout<<k<<endl;
                } 
            }
        }
    loop++;    
    }
}

C++: #include <iostream>

using namespace std;

int main(){

	int a,b;

	while(1){

		int count = 0;

		cin >> a >> b;
		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;
		}
		
		cout << endl;
	}

	return 0;
}

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

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<iostream>
using namespace std;
int main(){
	int a,b;
	bool first = true;
	while(cin >> a >> b){
		bool flag = false;
		if(a==0 && b==0) break;
		if(!first) cout << endl;
		else first = false;
		for(int i=a; i<=b; i++){
			if(i%4==0 && ( i%100!=0 || i%400==0) ){
				cout << i << endl;
				flag = true;
			}
		}
		if(flag == false) cout << "NA" << endl;
	}
	return 0;
}

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

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<iostream>
using namespace std;
int main(){
	int a,b;
	while(1){
	cin >> a >> b; 
	if(a ==0 && b == 0) return 0;
	int k = 0;
	
	for(int i = a;;i++){
		if(i % 4 == 0){
		a = i; break;
		}
	}
	
	for(int i = a ;i<=b;){
		if(i % 100 == 0){
			if(i % 400 == 0){
			cout << i << endl; k++;
			}
		} else if(i % 4 == 0){
		cout << i << endl; k++;
			}
		i+=4;
		}
		
		if(k ==0) cout << "NA" << endl ;
		cout << endl;		
		
		}
	
	}

C++: #include<iostream>
using namespace std;
int main(){

  int a,b,cnt,cnt2=0;

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

   
    
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
int main()
{
	int a,b,ans;
	bool up=false;
	while(1)
	{
		cin >> a >> b;
		if(a==0&&b==0)break;
		if(up)cout << endl;
		up=true;
		bool check=false;
		for(int i=a;i<=b;i++)
		{
			if(i%400==0)
			{
				cout << i << endl;
				check=true;
			}
			else if(i%100==0)
			{
			}
			else if(i%4==0)
			{
				cout << i << endl;
				check=true;
			}
		}
		if(!(check))cout << "NA" << endl;
	}
	return 0;
}

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

int main() {
  int a, b, c, k;
  bool first = true;
  while (1) {
    scanf("%d %d", &a, &b);
    if (!a && !b) break;
    if (!first) puts("");
    else first = false;
    k = a;
    while (k%4) ++k;
    c = 0;
    for (; k<=b; k+=4) {
      if (k%400 && !(k%100)) continue;
      printf("%d\n", k);
      ++c;
    }
    if (!c) printf("NA\n");
  }

  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0,now=0;
    while(cin>>fiyear>>finyear&&fiyear!=0&&finyear!=0){
        if(now!=0)cout<<endl;
        else now=1;
        for(int i=fiyear;i<=finyear;i++){
            if(i%4==0){
                co=1;
                if(i%100!=0||i%400==0)cout<<i<<endl;
            }
        }
        if(co==0)cout<<"NA"<<endl;
        co=0;
    }
}