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 uru(int y);

int main(void){
	bool f;
	int a,b;	
	cin>>a>>b;
	while(1){
		f=true;
		for(int i=a;i<=b;i++){
			if(uru(i)){
				f=false;
				cout<<i<<endl;
			}
		}
		if(f)cout<<"NA"<<endl;
		cin>>a>>b;
		if(a==0&&b==0)break; else cout<<endl;
	}

}


int uru(int y){
	if(y%4==0){
		if(y%100==0){
			if(y%400==0)return 1;
			return 0;
		}
		return 1;
	}
	return 0;
}

C++: #include <iostream>

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

C++: #include <stdio.h>

int main(void) {

  int a,b;
  int i,flag;

  while(1) {

    scanf("%d %d",&a,&b);

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

    flag=0;

    for(i=a;i<=b;i++) {
      
      if((i%4==0 && i%100!=0) || i%400==0) {
	printf("%d\n",i);
	flag=1;
      }

    }

    if(flag==0) printf("NA\n");

    printf("\n");
  }

  return 0;

}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=9000000009;


signed main(){
  int a,b;
  while(cin>>a>>b,a){
    vector<int> y;
    for(int i=a;i<=b;i++){
      if(i%400==0){
        y.PB(i);
        continue;
      }
      if(i%100==0)continue;
      if(i%4==0)y.PB(i);
    }
    if(y.size()==0){
      cout<<"NA"<<endl;
    }else{
      for(auto x:y)cout<<x<<endl;
    }
    cout<<endl;
  }
  return 0;
}

C++: #include<cstdio>
main(){int a,b,c,d=0;while(scanf("%d%d",&a,&b),a){d++&&puts("");for(c=0;a<=b;a++)
c/=printf(a%4<1&&a%25|a%16<1?"%d\n":0,a);c&&puts("NA");}}

C++: #include <iostream>

int LeapYear (int x);
int main()
{
    int a,b;
    std::cin >> a >> b;
    while (true) {
        int n = 0;
        if (a == 0 && b == 0) {
	        break;
        } else {
            for (int i = a; i <= b; i++) {
                if (LeapYear (i) == 1) {
                    std::cout << i << std::endl;
                    n++;
            }				
        }
        if (n == 0) {
            std::cout << "NA" << std::endl;
        }
        std::cout << std::endl;
        std::cin >> a >> b;
        }
    }
    return 0;
}

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

C++: #include <iostream>

using namespace std;

void solve()
{
	int a, b;
	bool init = true;
	while(cin >> a >> b, a || b)
	{
		if(!init)
		{
			cout << endl;
		}
		init = false;
		bool ok = false;
		for(int i = a; i < b; ++i)
		{
			if((i % 4 == 0 && i % 100 != 0) || i % 400 == 0)
			{
				cout << i << endl;
				ok = true;
			}
		}

		if(!ok)
		{
			cout << "NA" << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <stdio.h>

void uruu(int a, int b);

int main(void)
{
    int a;
    int b;
    scanf("%d %d", &a, &b);
    while (a != 0 || b != 0) {
        uruu(a, b);
        printf("\n");
        scanf("%d %d", &a, &b);
        printf("\n");
    }
    return 0;
}


void uruu(int a, int b)
{
    int count = 0;
    for (int year = a; year <= b; ++year) {
        if (year % 4 == 0) {
            if (year % 100 != 0) {
                printf("%d\n", year);
                ++count;
            } else {
                if (year % 400 == 0) {
                    printf("%d\n", year);
                    ++count;
                }
            }
        }   
    }
    if (count == 0) {
        printf("NA\n");
    }
}

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

int main() {

  int a,b;
  bool kai = false;

  while(true) {

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

    if ( kai ) cout << endl;
    kai = true;

    bool flag = true;

    for ( int i = a; i <= b; i++ ) {

      bool f = false;
      if ( i % 4 == 0 ) f = true;
      if ( i % 100 == 0 ) f = false;
      if ( i % 400 == 0 ) f = true;

      if ( f ) {
	cout << i << endl;
	flag = false;
      }

    }

    if ( flag ) cout << "NA" << endl;

  }

  return 0;

}

C++: #include <stdio.h>

void Leap_Year(int start_year, int end_year)
{
    if((start_year != 0) || (end_year != 0)) {
        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("NA");
                }
} 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++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;
int main(){
	
	long long a,b;
	int k=0;
	while(cin>>a>>b,a!=0||b!=0){
		if(k!=0)
			cout<<endl;
		int f=0;
		for(int i=a;i<=b;i++){
			if(i%400==0||(i%4==0&&i%100!=0)){
				cout<<i<<endl;
				f=1;
			}
		}
		if(f==0)
			cout<<"NA"<<endl;
		k=1;
	}
}

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) {
			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");
	}
	return 0;
}
	
int main(void)
{	
	int first, end, a;
	a = 0;
	while (a == 0) {
		scanf("%d %d", &first, &end);
		if (first == 0 && end == 0) {
			break;
		} else {
			printf("\n");
			a = uruu(first, end);
		}
	}
	return 0;
}