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>

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

int main(void)
{
    int year, from, until, num_leap_year;
    while (1) {
        num_leap_year = 0;
        scanf("%d %d", &from, &until);
        if (from == 0 && until == 0) {
            break;
        }
        for (year = from; year <= until; year++) {
            if (isLeapYear(year) == true) {
                num_leap_year++;
                printf("%d\n", year);
            }
        }
        if (num_leap_year == 0) {
            printf("NA\n");
        }
    }
    return 0;
}

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

using namespace std;

int main(void)
{
  int a, b;
  vector <int> hoge, leap;

  while (1) {
    cin  >> a >> b;
    if (a == 0 && b == 0)
      break;
    hoge.push_back(a);
    hoge.push_back(b);
  }
  for (int i = 0; i < hoge.size(); i += 2) {
    for (int j = hoge[i]; j <= hoge[i+1]; j++)
      if (j % 400 == 0 || (j % 100 && j % 4 == 0))
        leap.push_back(j);
    if (!leap.empty()) {
      for (int j = 0; j < leap.size(); j++)
        cout << leap[j] << endl;
      erase(leap.begin(), leap.end());
    } else {
      cout << "NA" << endl;
    }
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a,b;
	while(1){
	cin >> a >> b;&#160;
	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;
	bool first = true;

	while( cin >> a >> b && !( a == 0 && b == 0 ) ){
		if( first ){
			first = false;
		}else{
			cout << endl;
		}
		bool exist = false;
		for( int i = a + ( 4 - a%4 ) % 4; i <= b; i += 4 ){
			exist = true;
			if( i % 400 != 0 && i % 100 == 0 ){
				continue;
			}
			cout << i << endl;
		}
		if( !exist ){
			cout << "NA" << endl;
		}
	}

	return 0;
}

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

C++: int a, b;
while (cin >> a >> b && a != 0 && b != 0) {
  int p = 1;
  if (p) {
    cout << endl;
    p = 0;
  }
  int flag = 1;
  for (int i = a; i <= b; i++) {
    if (i % 100 == 0 && i % 400 != 0) {
      // continue;
    } else if (i % 4 == 0 && i % 100 != 0) {
      cout << i << endl;
      flag = 0;
    } else if (i % 400 == 0) {
      cout << i << endl;
      flag = 0;
    } else {
      // continue;
    }
  }
  if (flag) {
    cout << "NA" << endl;
  }
}
return 0;
}

C++: #include <iostream>
#include <vector>
 
 
void judging(int x, int y)  //start,end
{
    int count = 0;  //count the number of non-leap-year
    for (int j = x; j <= y; j++) {
        if (j % 400 == 0) {
            std::cout << j << std::endl;
        } else if (j % 100 == 0) {
            count++;
        } else if (j % 4 == 0) {
            std::cout << j << std::endl;
        } else {
            count++;
        }
    }
    if (count == y - x + 1) {
        std::cout << "NA" << std::endl;
    }
    return;
}
 
 
int main()
{
    std::vector<std::pair<int, int>> year(100);  //start,end(size of vector is temporary)
    int size = 0;                                //current array subscript
    std::cin >> year[size].first >> year[size].second;
    while (year[size].first != 0 || year[size].second != 0) {
        size++;
        std::cin >> year[size].first >> year[size].second;
    }
    for (int i = 0; i < size - 1; i++) {
        judging(year[i].first, year[i].second);
        std::cout << std::endl;
    }
    judging(year[size - 1].first, year[size - 1].second);
    return 0;
}

C++: #include <stdio.h>

int main(void)
{
    int start, finish;
    int exist = 0;
    while(1){
        scanf("%d %d", &start, &finish);
        if (start == 0 && finish == 0) {
            break;
        }
        for(; start <= finish; start++) {
            if((start % 4 == 0 && start % 100 != 0) || start % 400 == 0) {
            printf("%d\n", start);
            ++exist;
            }
        }
        if (exist == 0) {
            printf("NA\n");
        } else {
            exist = 0;
        }
        printf("\n");
    }
    return 0;
}

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

int main(void)
{ 
    while(true){
        int x, y, a;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0){
            break;
        }
        a = 0;
        for (int i = x;i <= y; ++i){
	    if(i % 400 == 0){
                printf("%d\n", i);
                a = 1;
            }else if(i % 100 == 0){
            }else if(i % 4 == 0){
                printf("%d\n", i);
                a = 1;
            } 
        }
        if(a == 0){
            printf("NA\n");
        }
        printf("\n");
    }   
    return 0;        
}

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

int main() {
	int a, b;
	int line = 0;
	while (cin >> a >> b) {
		if (line > 0) cout << "\n";
		line++;
		if ((a&b) == 0) break;
		int count = 0;
		for (int i = a; i <= b; i++) {
			if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0) {
				cout << i << "\n";
				count++;
			}
		}
		if (count == 0) cout << "NA\n";
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){

  int a,b;
  while( cin >> a >> b ){

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

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

int main(void)
{
	int a, b;
	bool i = true;
	
	do{
		scanf("%d %d", &a, &b);
		while (a++ < b){
			if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0){
				printf("%d\n", a);
				i = false;
			}
		}
		if (a != 0 && b != 0 && i == true){
			printf("NA\n");
		}
		i = true;
		printf("\n");
	}while (a != 0 && b != 0);
	
	return (0);
}

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