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++: /*
    2014.07.04 1230~1243
    C language Lecture week ∞
*/

#include <stdio.h>

int leap_chk ( int year );

int main (void) {
    
    int init;
    int last;
    
    int rcode = 0;
    
    int count;
    
    while (1) {
        
        count = 0;
        
        scanf ( "%d", &init );
        scanf ( "%d", &last );
        
        if ( init == 0 && last == 0 ) {
            break;
        }
        
        if ( rcode == 0 ) {
            rcode = 1;
            printf ( "\n" );
        }
        
        for ( int ly = init; ly <= last; ly ++ ) {
            if ( leap_chk ( ly ) ) {
                printf ( "%d\n", ly );
                count ++;
            }
        }
        
        if ( count == 0 ) {
            printf ( "NA\n" );
        }
        
    }
    
    return 0;
    
}

int leap_chk ( int year ) {
    
    if ( year % 4 == 0 ) {
        if ( year % 100 == 0 ) {
            if ( year % 400 == 0 ) {
                return 1;
            } else {
                return 0;
            }
        } else {
            return 1;
        }
    } else {
        return 0;
    }
    
}

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;
}

C++: #include <iostream>



bool judge(int year);

int main() 
{
	int start, end;
	
	while (true) {
		int check = 0;
		std::cin >> start >> end;
		
		std::cout << std::endl;
		
		if (start == 0 && end == 0) {
			break;
		}
		
		for (int i = start; i <= end; i++) {
			if (judge(i)) {
				std::cout << i << std::endl;
				check = 1;
			}
		}
		
		if (check == 0) {
			std::cout << "NA" << std::endl;
		}
		
	}
	return 0;
}


bool judge(int year){
	if ((year % 4 == 0 && !(year % 100 == 0)) || year % 400 == 0) {
		return true;
	} else {
		return false;
	}
}

C++: #include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;a++) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	bool leap[3001];
	for (int i = 0; i < 3001; i++) {
		int y = i;
		if (y % 4 != 0) { leap[i] = false; }
		else if(y%100!=0){
			leap[i] = true;
		}
		else if (y % 400 != 0) {
			leap[i] = false;
		}
		else {
			leap[i] = true;
		}
	}
	int a, b;
	bool first = true;
	while (cin >> a >> b) {
		bool ever = false;
		if (a == 0 && b == 0) { break; }
		if (!first) { cout << endl; }
		for (int i = a; i <= b; i++) {
			if (leap[i]) { ever = true; cout << i << endl; }
		}
		if (!ever)
		{
			cout << "NA" << endl;
		}first = false;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

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

    return 0;
}

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::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 <stdio.h>

int main(void)
{
	int i,a,b;
	bool year [3001]={0},s=0;
	
	for(i=1; i<3000; i++){
		if(i % 4 == 0){
			year[i] = 1;
		}
	}
	
	for(i=100; i<3000; i+=100){
		year[i] = 0;
	}
	for(i=400; i<3000; i+=400){
		year[i] = 1;
	}
	while(1){
		bool flag=0;
		scanf("%d %d", &a, &b);
		s=1;
		if(a==0){
			puts("");
			break;
		}
		for(i=a;i<=b;i++){
			if(year[i] == 1){
				printf("%d\n",i);
				flag=1;
			}
		}
		if(flag==0)printf("NA\n");
		if(s==1)puts("");
	}
	
	return 0;
}

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

C++: #include <iostream>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    bool first = true;
    while(true) {
        int a, b;
        cin >> a >> b;
        if(!a && !b) break;
        if(!first) cout << endl;
        bool found = false;
        for(int i = a; i <= b; ++i) {
            if(i % 4 == 0) {
                if(i % 400 == 0 || i % 100 != 0) {
                    cout << i << endl;
                    found = true;
                }
            }
        }
        if(!found) cout << "NA" << endl;
        first = false;
    }
    return 0;
}

C++: #include <stdio.h>

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