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>

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

C++: #include <stdio.h>

void leap_year(int first_year, int last_year);

int main(void)
{
    int first_year, last_year;
    static int dataset_number = 0; 
    scanf("%d %d", &first_year, &last_year);
    while (1) {
        if (first_year == 0 && last_year == 0) {
            break;
        } else {
            if (dataset_number != 0) {
                printf("\n");
            }
            leap_year(first_year, last_year);
            scanf("%d %d", &first_year, &last_year);
        ++dataset_number;
        }
    }
    return 0;
}

void leap_year(int first_year, int last_year)
{
    int count = 0;
    for (int year = first_year; year <= last_year; ++year) {
        if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
           printf("%d\n", year);
        } else {
            ++count;
        }
    }
    if (count == last_year - first_year + 1) {
        printf("NA\n");
    }
}

C++: #include<iostream>
using namespace std;
int main(){
  int a,b;
  while(true){
    cin>>a>>b;
    if(!a&&!b)break;
    a--;
    if (b/4-a/4-b/100+a/100+b/400-a/400){
      for(int i=a/4*4+4;i<b+1;i+=4)
	cout<<i<<endl;
    }
    else{
      cout<<"NA"<<endl;
    }
    cout<<endl;
  }
  return 0;
}

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

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

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

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; year++) {
            if (leap_year(year) == true){
                printf("%d\n", year);
                count++;
            }
        }
        
        if (count == 0) {
            printf("NA\n");
        }
        
        printf("\n");
        
        count = 0;
    }
            
    return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    bool first = true;
    while(true) {
        if(!first) cout << endl;
        int a, b;
        cin >> a >> b;
        if(!a && !b) break;
        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 <iostream>
using namespace std;

int main(){
  int f,e;

  while(1){
    int cnt = 0;
    cin >> f >> e;
    if(f == 0 && e == 0) break;

    for(int i = f ; i <= e ; i++){
      if(i%4 == 0){
        if(i%100 == 0 && i%400 != 0) continue;
        cout << i << endl;
        cnt++;
      }
    }
    if(cnt == 0) cout << "NA" << endl;
    cout << endl;
  }

  return 0;
}

C++: #include <stdio.h>

void judge_leap_year(int a, int b);

int existance_leap_year(int a, int b);

int main(void)
{
    while(1) {
      int exist;
      int start_year, end_year;
      scanf("%d %d", &start_year, &end_year);
      if (start_year == 0 && end_year == 0) {
        break;
      } else {exist = existance_leap_year(start_year, end_year);
        if (exist == 1) {
          judge_leap_year(start_year, end_year);
          printf("\n");
        } else {
          printf("NA\n");
          printf("\n");
        }
      }
    }
    return 0;
}//fucking presentation error                                                                                                                                                        

void judge_leap_year(int a, int b)
{
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        printf("%d\n", year);
      } else if (year % 4 == 0 && year % 100 != 0) {
        printf("%d\n", year);
      }
    }
}
//閏年を記述する                                                                                                                                                                     

int existance_leap_year(int a, int b)
{
    int n = 0;
    int year;
    for (year = a; year <= b; year++) {
      if (year % 400 == 0) {
        n = 1;
        break;
      } else if (year % 4 == 0 && year % 100 != 0) {
        n = 1;
        break;//一度閏年を検出した時点でループを抜ける。                                                                                                                             
      }
    }
    return n;
}
//閏年があった時、１を返す

C++: #include <bits/stdc++.h>
using namespace std;

int main(){

  int a,b,c=0;

  while(true){
    
    cin>>a>>b;
    if(a==0&&b==0) break;
    if(c!=0)cout<<endl;

    a = 4 - a%4 + a;

    vector<int> leaps;
    for(int i=a;i<=b;i+=4){
      if(i%400==0){
        cout<<i<<endl;
        leaps.emplace_back(i);
      }else if(i%100==0){
        continue;
      }else{
        cout<<i<<endl;
        leaps.emplace_back(i);
      }
    }

    if(leaps.size()==0) cout<<"NA"<<endl;
    ++c;

  }

  return EXIT_SUCCESS;
}

C++: #include <bits/stdc++.h>
using namespace std;

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

C++: #include <iostream>
using namespace std;
int main(){
	int a,b,x=0;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		for(int i=a;i<=b;i++){
			if(i%400==0){
				cout<<i<<endl;
				x=1;
			}else if(i%100==0){

			}else if(i%4==0){
				cout<<i<<endl;
				x=1;
			}
		}
		if(x==0)cout<<"NA"<<endl;
		cout<<endl;
		x=0;
	}
	return 0;
}