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

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

void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
    printf("\n");
}

int main(void)
{
    int k = 0;
    while (true) {
        if (k != 0) {
            printf("\n");
        }
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        leapyear(year1, year2);
        ++k;
    }
    return 0;
}

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<<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 <stdio.h>
	
int uruu(int first, int end)
{
	int count = 0;
	for (int i = first; i < end + 1; i++) {	
		if (i % 400 != 0 && i % 100 == 0 && i - first <= 3 && end - i <= 3) {
			printf("NA\n");
			count = count + 1;		
		}
		if (i % 400 == 0) {
			printf("%d\n", i);
			count = count + 1;
		} else if (i % 100 == 0) {
			i = i + 3;
		} else if (i % 4 == 0) {
			printf("%d\n", i);
			count = count + 1;
		}
	}
	if (count == 0) {
		printf("NA\n");
	}
}
	
int main(void)
{	
	while (1) {
		static int first, end;
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			uruu(first, end);
			printf("\n");
		}
	}
}

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

int main(){
	while(1){
		int a, b, x[3000];
		int l=0;
		
		cin >> a >> b;
		
		if(a==0 && b==0) break;
		
		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;
		}
		
		cout <<endl;
		
	}
}

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

int main(void)
{
  bool flag = false;
  while (true)
  {
    vector<int> result;
    int a, b;
    cin >> a >> b;
    if (a==0 and b==0) break;
    if (flag) cout << endl;
    flag = true;
    for (int i = a; i <= b; ++i)
    {
      if ((i % 4 == 0 and i % 100 != 0) or i % 400 == 0)
      {
        result.push_back(i);
      }
    }
    if (result.empty())
    {
      cout << "NA" << endl;
    }
    else
    {
      for (int year : result)
      {
        cout << year << endl;
      }
    }
  }
  return 0;
}

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

C++: #include <iostream>

using namespace std;

int main(void){

  int a,b;
  bool f = false;
  while( cin >> a >> b && a && b ){

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

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

C++: #include <bits/stdc++.h>
using namespace std;
int a, b;
bool isLeap(int year) {
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}

void solve() {
    bool f = false;
    for(int r = a; r <= b; r++) {
        if(isLeap(r)){f = true; cout << r << endl;}
    }
    if(!f) {
        cout << "NA" << endl;
    }
}

int main(void) {
    int d = 0;
    while(cin >> a >> b, a|b) {
        if(d++) putchar('\n');
        solve();
    }
    return(0);
}

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

int main(void)
{
  while (1){
    int a, b;
    bool frag = false;

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

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

  return 0;
}

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

vector< int > LeapYear(int a, int b, vector<int > vec){
	for (int i = a; i <= b; i++){
		if ((i % 4 == 0 && i % 100 != 0) || i % 400 == 0){
			vec.push_back(i);
		}
	}
	return vec;
}

int main(){
	vector<int > vec;
	int a, b;
	while (cin >> a >> b, a || b){
		vec.clear();
		vec = LeapYear(a, b, vec);

		// output
		if (!vec.empty()){
			for (int i = 0; i < vec.size(); i++){
				cout << vec.at(i) << endl;
			}
		}
		else{
			cout << "NA" << endl;
		}
		//cout << endl;
	}

	return 0;
}

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

bool leap_year(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;
    }
}

int main(void)
{
    int y_ini, y_fin;
    int count = 0;
    while(1) {
        scanf("%d %d", &y_ini, &y_fin);
    
        if (y_ini == 0 && y_fin == 0) {
            break;
        }

        for (int year = y_ini; year < y_fin + 1; year++) {
            if (leap_year(year) == true){
                printf("%d\n", year);
                count++;
            }
        }
        
        if (count == 0) {
            printf("NA\n");
        }
        
        printf("\n");
    }
            
    return 0;
}