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>

void leapYear(int, int);
int main()
{
    while (true) {
        int a, b;
        std::cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        leapYear(a, b);
    }
    return 0;
}
void leapYear(int a, int b)
{
    int i = 0;
    for (int year = a; year <= b; ++year) {
        if ((year % 4 == 0 && year % 100 !=0) || (year % 400 == 0)) {
            std::cout << year << " " <<std::endl;
            ++i;
        }
    }
    if (i == 0) {
        std::cout << "NA" <<std::endl;
    }
}

C++: #include<stdio.h>
#include<stdbool.h>
//declare function                                                              
bool judgelpyear(int fstyear,int lastyear);

/*==============end of delaration====================================*/

int main(void){
    int fstimp;//first imput                                                    
    int secimp;//second imput                                                   
    do {
        scanf("%d %d", &fstimp, &secimp);
    }while(judgelpyear(fstimp, secimp) == true);
    return 0;
}

bool judgelpyear(int fstyear,int lastyear) {
    bool discovery = false;//if he can discover a leap year                     

    if(fstyear == 0 && lastyear == 0){
        return false;//end main                                                 
    }
    for(int i = fstyear; i <= lastyear; i++) {
        if(i % 4 == 0 && (i % 100 != 0 || i % 400 == 0)) {
            printf("%d\n", i);
            discovery = true;//he discovered at least one leap year             
        }
    }
    if(discovery == false) {
        printf("NA\n");
    }

    return true;//repeat scanning years                                         
}

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

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

int main()
{
    do {
        int start;
        int end;

        std::cin >> start;
        std::cin >> end;

        if (start == 0 && end == 0) {
            break;
        }

        if (start >= end) {
            std::cout << "NA" << std::endl;
        }

        for (int i = start; i <= end; i++) {
            if (isLeapYear(i) == true) {
                std::cout << i << std::endl;
            }
        }

        std::cout << std::endl;

    } while (true);
}

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

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

int main(void)
{ 
    while (true) {
        int x, y;
        bool exist = false;
        int number = 0;
        scanf("%d%d", &x, &y);
        if (x == 0 && y == 0) {
            break;
        }
        for (int i = x;i <= y; ++i) {
            if (number != 0) {
                   printf("\n");
            }
            bool flag = judge(i);
	    if (flag == true) {
                printf("%d\n", i);
                exist = true;
            }
        } 
        if (exist == false) {
            printf("NA\n");
        }  
        number++;     
    }
    return 0;        
}

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

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

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int fiyear,finyear,co=0;
    while(cin>>fiyear>>finyear&&fiyear!=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<<endl;
    }
}

C++: #include <iostream>
#include <cstdio>
int main(){
	int a, b;
	while(scanf("%d%d", &a, &b), a && b){
		int c = 0;
		for(;a++<=b;){
			if(a % 4 == 0){
				if(a % 100){
					if(a % 400 == 0)c++, printf("%d\n", a);
				}
				else c++, printf("%d\n", a);
			}
		}
		if(!c)puts("NA");
	}
}

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

int main(){
  queue<int> year;
  int a,b,cou,count,tmp,i,as=0;
  while(1){
    cin >> a >> b;
    if(a == 0 && b == 0) break;
    if(as != 0){
      cout << endl;
    }
    cou = b - a + 1;
    for(i=0;i<cou;i++){
      tmp = a + i;
      if(tmp%4 == 0 && tmp%100 != 0 || tmp%400 == 0){
	year.push(tmp);
      }
    }
    count = year.size();
    if(count == 0){
      cout << "NA" << endl;
    }
    else{
      for(i=0;i<count;i++){
	cout << year.front() << endl;
	year.pop();
      }
    }
    as = 1;
  }
}

C++: #include<stdio.h>

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

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

using namespace std;

int main(){

	int from,to;
	while(cin>>from>>to&&!(from==0&&to==0)){
		bool f=false;
		for(int i = from; i <= to; i++){
			if(i%4==0&&i%100!=0){
				f=true;
				cout<<i<<endl;
			}
			else if(i%400==0){
				f=true;
				cout<<i<<endl;
			}
		}
		if(!f){
			cout<<"NA"<<endl;
		}
		cout<<endl;
	}


	return 0;
}

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

int main(){
	int a,b,count=0;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){
			break;
		}
		while(a<=b){
			if(a%4==0){
				if(a%100==0){
					if(a%400==0){
						cout<<a<<endl;
						count++;
					}
				}else{
					cout<<a<<endl;
					count++;
				}
			}
			a++;
		}
		if(count==0){
			if(a==0 && b==0){
				break;
			}else{
				cout<<"NA"<<endl;
			}
		}
		cout<<endl;
		count=0;
	}
	return 0;
}

C++: #include <stdio.h>

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