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>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        if(end_year - start_year < 3) {
            if((start_year % 4) < (end_year % 4)) { 
                printf("NA\n");
            }
        } else {
            for(int i = start_year; i <= end_year; ++i) {
                if(i % 400 != 0) {
                    if((i % 100 != 0) && (i % 4 == 0)) {
                        printf("%d\n", i);
                    }
                } else {
                    printf("%d\n", i);
                }
            }
        }
    }
}

int main(void)
{
    int start_year, end_year;
    scanf("%d %d", &start_year, &end_year);
    Leap_Year(start_year, end_year);
    return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
vector<int>aa;
vector<int>bb;
int main() {
	int a, b;
	while (cin >> a >> b) {
		if (a == 0 && b == 0)break;
		aa.push_back(a);
		bb.push_back(b);
	}
	for (int i = 0; i != aa.size(); i++){
		if (bb[i] - aa[i] < 4) {
			cout << "NA\n";
			goto U;
		}
		for (int j = aa[i]; j <= bb[i]; j++){
			if (j % 4 == 0) {
				if (j % 100 == 0){
					if (j % 400 == 0){
						cout << j << endl;
					}
				}
				else cout << j << endl;
			}
		}
	U:cout << endl;
	}
}

C++: #include<stdio.h>

void leap_year(int a, int b);

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

void leap_year(int a, int b)
{
    int count = 0;
    for (int i = a; i <= b; i++){
        int j = i;
        if (i - j / 400 * 400 == 0) { //iが４００の倍数の時
            printf("%d\n", i);
            count = + 1;
            j = i;
        } else if (!(i - j / 100 * 100 == 0)) { //iが100の倍数のでないとき
            int j = i;  
            if ( i - j / 4 * 4 == 0) {//iが四の倍数のとき
                printf("%d\n", i);
                count = + 1;                
            }
        }
    }
    if (count == 0) { //閏年が0のとき        
        printf("\nNA\n\n");
    }    
}

C++: #include <iostream>
using namespace std;
#define p(dis) cout << dis << endl

int func(int a, int b){
	int f = 1;
	for(int i = a;i <= b;i++){
		if(i % 4 == 0){
			if(i % 100 == 0){
				if(i % 400 == 0)p(i), f = 0;
				continue;
			}
			p(i), f = 0;
		}
	}
	return f;
}

int main(){
	int a, b, f = 0;
	while(cin >> a >> b, a+b){
		if(f)cout << endl;f = 1;
		if(func(a, b))cout << "NA" <<endl;
	}
	return 0;
}

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

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

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

C++: #include <stdio.h>
 int main(void)
 {
     int a, b;
     int c = 0;
     scanf("%d %d", &a, &b);
     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");
     }
     return 0;
 }

C++: #include <bits/stdc++.h>
#define range(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define rep(i,n) range(i,0,n)
using namespace std;

inline bool isleap(int year){
	if(year%400==0)
		return true;
	if(year%100==0)
		return false;
	if(year%4==0)
		return true;
	return false;
}

int main(void){
	int a,b;
	bool space=false;
	while(cin >> a >> b,a|b){
		bool ans=false;
		range(i,a,b+1) if(isleap(i)) cout << i << endl,ans=true;
		if(!ans) puts("NA");
		if(space) puts("");
		space=true;
	}
	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;
	if(b - a < 4){
	for(int i = a;i<=b;i++){
		 if(i % 100 == 0){
		if(i % 400 == 0){
		cout << i << endl; k++; 
		}
		
		} else if(i % 4 == 0){
			cout << i << endl; k++;
		
		}
	}
	if(k == 0){
	cout << "NA" << endl ;
	} else {cout << endl; return 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;
			}
		} else if(i % 4 == 0){
		cout << i << endl;
		
		}
		i+=4;
		}
		cout << endl;		
		}
	}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b,ans;
	while (1) {
		cin >> a >> b;
		ans = 0;
		if (a == 0 && b == 0) {
			goto a;
		}
		cout << endl;
		for (int i = a; i <= b; i++) {
			if (i % 4 == 0) {
				if (i % 100==0) {
					if (i % 400==0) {
						cout << i << endl;
						ans = ans + 1;
					}
				}
				else {
					cout << i << endl;
					ans = ans + 1;
				}
			}
		}
		if (ans == 0) {
			cout << "NA" << endl;
		}
		cout << endl;
	}
a:;
}

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;

    // kono for loop no jyouken-siki ha "=" hituyou!
    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::cout << std::endl;

}

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 k=0;
	while(1){
		int a, b, x[3000];
		int l=0;
		
		cin >> a >> b;
		
		if(a==0 && b==0) break;
		else if(k!=0) cout << endl;
		
		k++;
		
		for(int i=a; i<=b; i++){
			if(0==i%4 && 0!=i%100 ){
				x[l]=i;
				l++;
			}else if(0==i%400){
				x[l]=i;
				l++;
			}
		}
		
		if(l==0) cout << "NA" <<endl;
		
		for(int m=0; m<l && l!=0; m++){
			cout << x[m] <<endl;
		}
		
	}
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  int ans=0,c=0,h=0;
  while(cin>>a>>b){
    if(a==0&&b==0) break;
    if(c!=0) cout << endl;
    for(int i=a;i<=b;i++){
      if(i%4==0){
	if(i%100==0){
	  if(i%400==0){
	    ans = i;
	  }
	  if(ans==0) continue;
	}
	ans = i;
      }
      else continue;
      cout << ans << endl;
    }
    if(ans==0) cout << "NA" << endl;
    ans = 0;
    c++;
  }
  return 0;
}