Problem:


うるう年

 西暦 a 年から b 年までの間にあるすべてのうるう年を出力するプログラムを作成してください。

 うるう年の条件は、次のとおりとします。ただし、0 < a ≤ b < 3,000 とします。与えられた期間にうるう年がない場合には "NA"と出力してください。

 西暦年が 4 で割り切れる年であること。

 ただし、100 で割り切れる年はうるう年としない。

 しかし、400 で割り切れる年はうるう年である。

Input

複数のデータセットが与えられます。各データセットの形式は以下のとおりです：

a b

a, b がともに 0 のとき入力の終了とします。データセットの数は 50 を超えません。

Output

データセットごとに、西暦または NA を出力してください。

データセットの間に１つの空行を入れてください。

Sample Input

2001 2010
2005 2005
2001 2010
0 0

Output for the Sample Input

2004
2008

NA

2004
2008



Sample input:
2001 2010
2005 2005
2001 2010
0 0


Sample output:
2004
2008

NA

2004
2008

Submission status: Accepted

Solution code:
result = []
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    result.append("\n".join([str(i) for i in range(a, b+1) if i%400 == 0 or i%4 == 0 and i%100]) or "NA")

print("\n\n".join(result))

Submission status: Runtime Error

Solution code:
f=0
while 1:
  a,　b = map(int, raw_input().split())
  if a==b==0: break
  x = [i for i in range(a, b+1) if (i%4　==　0 and (i%100　!= 0 or i%400 == 0))]
  if x==[]: x=["NA"]

  if f: print
  for e in x: print e
  f=1

Submission status: Runtime Error

Solution code:
from calendar import isleap
f = lambda x: map(str, x) if x else ["NA"]
ans = []
while True:
    a, b = map(int, raw_input().split())
    if b == 0:
        break
    ans += f(filter(isleap, xrange(a, b+1))) + [""]
print("\n".join(ans).strip())

Submission status: Runtime Error

Solution code:
from calendar import isleap
f = lambda x: map(str, x) if x else ["NA"]
ans = []
while True:
    a, b = map(int, input().split())
    if b == 0:
        break
    ans += f(filter(isleap, range(a, b+1))) + [""]
print("\n".join(ans).strip())

Submission status: Runtime Error

Solution code:
line = False
while True:
    a,b = map(int, raw_input().split())
    if line: print ""
    line = True
    count = 0
    for i in range(a, b+1):
        if (i % 4 == 0 and i % 100 != 0) or i % 400 == 0:
            print i
            count += 1
    if count == 0: print "NA"

Submission status: Runtime Error

Solution code:
<?php
	$jikan = 0;
	while(true) {
		$cnt = 0;
		$stdin = trim(fgets(STDIN));
		
		if($stdin === '0 0') {
			break;
		}
		$years = explode(' ', $stdin);
		for ($i=$years[0]; $i < $years[1]; $i++) { 
			if($i%4 === 0 && $i%100 !== 0 || $i%400 === 0) {
				print($i . "\n");
				$cnt++;			
			}
		}
		if ($cnt == 0){
			print("NA\n");
		}
		print("\n");
	}

Submission status: Runtime Error

Solution code:
year = input()
bb = year.split(' ')
a = bb[0]
b = bb[1]
ans = 0
for i in range(a,b+1):
    if i%4==0:
        ans += 1
    if 1%100==0:
        ans -= 1
    if 1%400==0:
        ans += 1
if ans == 0:
    print('NA')
else:
    print(ans)

Submission status: Runtime Error

Solution code:
f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)

while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in t:
    print(y)
  if lent(it) == 0:
    print('NA')
  print (' ')

Submission status: Runtime Error

Solution code:
from calender import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    print(sum(isleap(i) for i in range(a, b+1)))

Submission status: Runtime Error

Solution code:
b=0
for e in iter(input,'0 0'):
 if b:print()
 b=u=1
 s,t=map(int,e.split())
 for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0:print(y);u=0
 if u:print('NA')

Submission status: Runtime Error

Solution code:
p=print
b=0
for e in iter(input,'0 0'):
 if b:p()
 b=f=1;s,t=map(int,e.split())
 for y in range(s,t+1):
  if(y%4==0)*(y%100)or y%400==0:p(y);f=0
 if u:p('NA')

Submission status: Runtime Error

Solution code:
[year for year in xrange(2000, 2100 + 1) if (year % 4 ==0) and (year % 100 != 0)]



#!/usr/bin/env python
# coding: utf-8

import sys


def is_bis_year(year):
  if (year % 4 == 0) and (year % 100 != 0):
    return True
  elif (year % 400 == 0):
    return True
  return False


def main():
  params = []
  
  while 1:
    input_line = sys.stdin.readline().rstrip()
    if input_line == "0 0":
      break
    else:
      params.append([int(year) for year in input_line.split(" ")])
  
  for param in params:
    min_year, max_year = param
    bis_years = [year for year in xrange(min_year, max_year + 1) if is_bis_year(year)]
    
    if len(bis_years) == 0:
      print "NA"
    else:
      print "\n".join(bis_years)
    print


if __name__ == "__main__":
  main()

Submission status: Runtime Error

Solution code:
import sys

a = int(sys.argv[1])
b = int(sys.argv[2])
flag = False

if a < 0 or a > b or a > 3000 or b > 3000:
         print "exit"
         sys.exit()
for y in range(a, b + 1):
         if y % 4 == 0:
                 if y % 100 == 0 and y % 400 == 0:
                         print y
                         flag = True
                 elif y % 100 != 0:
                         print y
                         flag = True
else:
         if not bool(flag):
                 print "NA"
 print ""

Submission status: Runtime Error

Solution code:
import sys

a = int(sys.argv[1])
b = int(sys.argv[2])
flag = False

if a < 0 or a > b or a > 3000 or b > 3000:
         print "exit"
         sys.exit()
for y in range(a, b + 1):
         if y % 4 == 0:
                 if y % 100 == 0 and y % 400 == 0:
                         print y
                         flag = True
                 elif y % 100 != 0:
                         print y
                         flag = True
else:
         if not bool(flag):
                 print "NA"
print ""

Submission status: Runtime Error

Solution code:
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])
flag = False

if a < 0 or a > b or a > 3000 or b > 3000:
         print "exit"
         sys.exit()

for y in range(a, b + 1):
         if y % 4 == 0:
                 if y % 100 == 0 and y % 400 == 0:
                         print y
                         flag = True
                 elif y % 100 != 0:
                         print y
                         flag = True
else:
        if not bool(flag):
                print "NA"
print ""

Submission status: WA: Presentation Error

Solution code:
import sys;

#file = open("text.txt")
file = sys.stdin

def is_leap_year(year) :
    if  year % 400 == 0 : return True
    if year % 100 == 0 : return False
    if year % 4 == 0 : return True
    return False

while True :
    a, b = map(int, file.readline().split(" "))
    if a==0 and b==0 : break

    v = 0
    for y in range(a, b+1) :
        if is_leap_year(y) :
            v = 1
            print(y)
    pass
    if v == 0: print("NA")
    print()
pass

Submission status: WA: Presentation Error

Solution code:
import sys

for s in sys.stdin:
  a,b = map(int,s.split())
  if a==b==0: break
  x=[]
  for i in range(a,b+1):
    if i % 4 ==0:
      if i%100 ==0:
        if i%400==0: f=1
        else: f=0
      else: f=1
    else: f=0
    if f==1: x.append(i)
  if x==[]: print "NA"
  else:
    for e in x: print e
  print

Submission status: WA: Presentation Error

Solution code:
import sys
f = sys.stdin

def is_leapyear(year):
    return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)

while True:
    a, b = map(int, f.readline().split())
    if a == b == 0:
        break
    leapyear = [year for year in range(a, b + 1) if is_leapyear(year)]
    print('\n'.join(map(str, leapyear)) if leapyear else 'NA')
    print()

Submission status: WA: Presentation Error

Solution code:
while True:
    a,b=map(int,raw_input().split(" "))
    if a==0 and b==0:
        break
    uruu=[]
    for i in [year for year in range(b+1) if year >=a]:
        if i%4==0 and i%100!=0 or i%400==0:
            uruu.append(str(i))
    if len(uruu)!=0:
        print '\n'.join(uruu)
    else:
        print "NA"
    print ''

Submission status: WA: Presentation Error

Solution code:
while True:
    a,b = map(int,raw_input().split())
    if (a,b)==(0,0): break
    
    ls=[i for i in range(a,b+1)]
    ans=[]
    for j in ls:
        if j%4==0 and j%100!=0:
            ans.append(j)
        elif j%400==0:
            ans.append(j)
    
    if ans==[]:
        print 'NA'
        print ''
    else:
        for y in ans:
            print y
            print ''

Submission status: WA: Presentation Error

Solution code:
n=0
while True:
    if n>0: print ''
    a,b = map(int,raw_input().split())
    if (a,b)==(0,0): break
    
    ls=[i for i in range(a,b+1)]
    ans=[]
    for j in ls:
        if j%4==0 and j%100!=0:
            ans.append(j)
        elif j%400==0:
            ans.append(j)
    
    if ans==[]:
        print 'NA'
    else:
        for y in ans:
            print y
    n+=1

Submission status: WA: Presentation Error

Solution code:
import sys

for line in sys.stdin:
    a,b = map(int, line.rstrip().split())
    if a != 0 and b != 0:
        flag = False
        for y in range(a, b+1):
            if (y % 4 == 0 and y % 400 == 0) or (y % 4 == 0 and y % 100 != 0):
                flag = True
                print y
        else:
            if not flag:
                print 'NA'
            flag = False
    print ''

Submission status: WA: Presentation Error

Solution code:
import sys

for line in sys.stdin:
    a,b = map(int, line.rstrip().split())
    if a != 0 and b != 0:
        flag = False
        for y in range(a, b+1):
            if (y % 4 == 0 and y % 400 == 0) or (y % 4 == 0 and y % 100 != 0):
                flag = True
                print y
        else:
            if not flag:
                print 'NA'
            flag = False
        print ''

Submission status: WA: Presentation Error

Solution code:
while 1:
    a,b=map(int,raw_input().split())
    if a==0:
        break
    f=0
    for i in range(a,b+1):
        if i%400==0 or (i%4==0 and i%100!=0):
            f=1
            print i
    if f==0:
        print "NA"
    print

Submission status: WA: Presentation Error

Solution code:
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    fla = False
    for y in range(a, b+1):
        if y % 4 == 0:
            if y % 100 != 0:
                fla = True
                print(y)
            else:
                if y % 400 == 0:
                    fla = True
                    print(y)
    else:
        if not fla:
            print('NA')

Submission status: WA: Presentation Error

Solution code:
def f(a, b):
    flg = False
    for x in range(a, b + 1):
        if (x % 4 == 0 and x % 100 != 0) or x % 400 == 0:
            if not flg:
                flg = True
            print(x)
    if not flg:
        print('NA')


while True:
    _a, _b = map(int, input().split())
    if _a == _b == 0:
        break
    f(_a, _b)

Submission status: WA: Presentation Error

Solution code:
def isUruu(t):
    if t%4==0:
        if t%100==0:
            if t%400==0:return True
            return False
        return True
    return False

while 1:
    a,b=map(int,raw_input().split())
    if a==b==0:break
    cnt=0
    for i in xrange(a,b+1):
        if isUruu(i):
            print(i)
            cnt+=1
    if cnt==0:
        print('NA')
    print

Submission status: WA: Presentation Error

Solution code:
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break
    
    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')

Submission status: WA: Presentation Error

Solution code:
# -*- coding: utf-8 -*-
while True:
    a, b = map(int, input().split())

    if a == 0 and b == 0:
        break

    found = False
    for y in range(a, b + 1):
        if y % 4 == 0 and (y % 100 != 0 or y % 400 == 0):
            found = True
            print(y)
    if not found:
        print('NA')
    print()

Submission status: WA: Presentation Error

Solution code:
while True:
    a, b = map(int, input().split())
    if a + b == 0: break

    uru = [str(i) for i in range(a, b+1) if i % 400 == 0 or (i % 4 == 0 and i % 100 != 0)]
    result = '\n'.join(uru)

    if not result:
        result = 'NA'
    print(result)
    print()

Submission status: WA: Presentation Error

Solution code:
while True:
    num = 0
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        break
    for i in range(a,b + 1):
        if i % 400 == 0:
            print(i)
            num += 1
        elif i % 100 == 0:
            continue
        elif i % 4 == 0:
            print(i)
            num += 1
    if num == 0:
        print("NA")
    print()

Submission status: WA: Presentation Error

Solution code:
import calendar as C
while 1:
    a,b=map(int, input().split())
    if a==0:break
    if sum([1 for i in range(a,b+1) if C.isleap(i)])==0:
        print("NA")
    else:
        for i in range(a,b+1):
            if C.isleap(i):print(i)
    print()

Submission status: WA: Presentation Error

Solution code:
while True:
    A,B = map(int,input().split())
    if A == 0:
        break
    ans = []
    for i in range(A,B + 1):
        if i % 400 == 0 or (i % 100 != 0 and i % 4 == 0):
            ans.append(i)
    if len(ans) != 0:
        for i in ans:
            print(i)
    else:
        print('NA')
    print('')

Submission status: WA: Presentation Error

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0093
???????????´
"""
import sys

def is_leap(year):
    ''' ?????????????????´??? ???????????´ ???????????????True/False??§?????? '''
    if year % 400 == 0:
        return True
    elif year % 100 == 0:
        return False
    elif year % 4 == 0:
        return True
    else:
        return False


def main(args):
    leap_years = []  # ???????????´????????????
    # ??????????????\???
    while True:
        start_year, end_year = [int(x) for x in input().strip().split(' ')]
        if start_year == 0 and end_year == 0:
            break
        else:
            # ???????????????
            leap_years = []
            for year in range(start_year, end_year+1):
                if is_leap(year):
                    leap_years.append(year)

        # ???????????????
        if len(leap_years) == 0:
            print('NA')
        else:
            print('{0}'.format('\n'.join(map(str, leap_years))))
        print('')  # ????????????????????????1????????????

if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: WA: Presentation Error

Solution code:
def check(x) :
    if x % 4 == 0 :
        if   x % 100 != 0 : return x
        elif x % 400 == 0 : return x

def make(a, b):
    count = 0
    for _ in range(a, b+1) :
        if box[0] <= _ <= box[-1] :
            if _ in box :
                count = 1
                print(_)
        else :
            temp = check(_)
            if temp != None : 
                box.append(temp)
                count = 1
                print(_)
    if count == 0 : print('NA')
    
from sys import stdin
box = [2004]
for _ in stdin.readlines() :
    a, b = map(int, _.split())
    if a == b == 0 : break
    make(a, b)
    print()

Submission status: WA: Presentation Error

Solution code:
f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)
 
while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in it:
    print(y)
  if len(it) == 0:
    print('NA')
  print (' ')

Submission status: WA: Presentation Error

Solution code:
f = set(range(0,3000,4))
h = set(range(0,3000,100))
fh = set(range(0,3000,400))
lp = (f -h).union(fh)
 
a = False
while True:
  f,l = list(map(int, input().split()))
  if f == 0 and l == 0:
    break
  if a:
    print (' ')
  t = set(range(f,l+1))
  it = sorted(list(lp.intersection(t)))
  for y in it:
    print(y)
  if len(it) == 0:
    print('NA')
  a = True

Submission status: WA: Presentation Error

Solution code:
from calendar import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    ans = [i for i in range(a, b+1) if isleap(i)]
    print("\n".join(map(str, ans)) if len(ans) else "NA")

Submission status: WA: Presentation Error

Solution code:
from calendar import isleap

while True:
    a, b = map(int, input().split())
    if a == 0:
        break
    ans = [i for i in range(a, b+1) if isleap(i)]
    print("\n".join(map(str, ans)) if len(ans) else "NA")
    print()

Submission status: WA: Presentation Error

Solution code:
while True:
    a, b = map(int, input().split())
    if a == b == 0:
        quit()
    count = 0
    for i in range(a, b+1):
        if i % 400 == 0:
            print(i)
            count += 1
        elif i % 100 != 0 and i % 4 == 0:
            print(i)
            count += 1
    if count == 0:
        print('NA')
    print()

Submission status: WA: Presentation Error

Solution code:
for e in iter(input,'0 0'):
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')
 print()

Submission status: WA: Presentation Error

Solution code:
b=1
for e in iter(input,'0 0'):
 if b:print();b=0
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')

Submission status: WA: Presentation Error

Solution code:
b=0
for e in iter(input,'0 0'):
 if b:print();b=1
 s,t=map(int,e.split())
 u=[y for y in range(s,t+1)if y%4==0 and y%100!=0 or y%400==0]
 if u:
  for y in u:print(y)
 else:print('NA')

Submission status: WA: Presentation Error

Solution code:
# AOJ 0093 Leap Year
# Python3 2018.6.11 bal4u

def leap_year(y):
    return y % 4 == 0 and (y % 100 != 0 or y % 400 == 0)

import sys
first = True
for line in sys.stdin:
    a, b = list(map(int, line.split()))
    if first:
        first = False
    else:
        print()

    if a is 0:
        break
    else:
        f = False
        for y in range(a, b+1):
            if leap_year(y):
                print(y)
                f = True
        if not f:
            print('NA')

Submission status: WA: Presentation Error

Solution code:
def uy(y):
  if not y%4:
    if not y%100:
      if not y%400:
        return y
      return 0
    return y
  return 0

while 1:
  a,b=list(map(int,input().split()))
  if not a and not b:break
  t=[i for i in map(uy,range(a,b+1)) if i]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print("")

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a and not b:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print("")

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a and not b:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  print("")
  if not t:
    print("NA")
  else:
    [print(i) for i in t]

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    print("")
    [print(i) for i in t]

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print("")

Submission status: WA: Presentation Error

Solution code:
while 1:
  a,b=list(map(int,input().split()))
  if not a:break
  t=[i for i in range(a,b+1) if not i%4 and i%100 or not i%400]
  if not t:
    print("NA")
  else:
    [print(i) for i in t]
  print()

Submission status: WA: Presentation Error

Solution code:
#!/usr/bin/env python
# coding: utf-8


def is_bis_year(year):
  if (year % 4 == 0) and (year % 100 != 0):
    return True
  elif (year % 400 == 0):
    return True
  return False


def main():
  params = []
  
  while 1:
    input_line = raw_input()
    if input_line == "0 0":
      break
    else:
      params.append([int(year) for year in input_line.split(" ")])
  
  for param in params:
    min_year, max_year = param
    bis_years = [year for year in xrange(min_year, max_year + 1) if is_bis_year(year)]
    
    if len(bis_years) == 0:
      print "NA"
    else:
      for bis_year in bis_years:
        print bis_year
    print


if __name__ == "__main__":
  main()

Submission status: WA: Presentation Error

Solution code:
while True:
    a,b=map(int,raw_input().split())
    if (a,b)==(0,0):
        break
    ans=[y for y in xrange(a,b+1) if (y%4==0 and not y%100==0) or y%400==0]
    if not ans:
        print "NA"
    else:
        print "\n".join(map(str,ans))
    print

Submission status: WA: Presentation Error

Solution code:
flag=False
while True:
    a,b=map(int,raw_input().split())
    if (a,b)==(0,0):
        break
    ans=[y for y in xrange(a,b+1) if (y%4==0 and not y%100==0) or y%400==0]
    if not ans:
        print "NA"
    else:
        print "\n".join(map(str,ans))
    if not flag:
        flag=True
    else:
        print

Submission status: WA: Presentation Error

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit


def main(readline=stdin.readline):
    leap_year = [not y % 4 and y % 100 or not y % 400 for y in range(3001)]
    while 1:
        a, b = (int(s) for s in readline().split())
        if not a and not b:
            exit()

        result = 'NA\n'
        for year, leap in enumerate(leap_year[a:b+1], a):
            if leap:
                print(year)
                result = ''

        print(result)


main()

Submission status: WA: Presentation Error

Solution code:
while True:
    try:
        a, b = map(int, raw_input().split())
        if a + b == 0:
            break
        flag = 0
        for i in range(a,b+1):
            if i%4 == 0 and (i%100 != 0 or i%400 == 0):
                print i
                flag = 1
        if flag == 0:
            print "NA"
        print ""
    except:
        break

Submission status: WA: Presentation Error

Solution code:
count = 0
while True:
    try:
        a, b = map(int, raw_input().split())
        if a + b == 0:
            break
        if count > 0: print ""; count = 1
        flag = 0
        for i in range(a,b+1):
            if i%4 == 0 and (i%100 != 0 or i%400 == 0):
                print i
                flag = 1
        if flag == 0:
            print "NA"
    except:
        break

Submission status: WA: Presentation Error

Solution code:
while True:
	a, b = map(int, raw_input().split())
	if a + b == 0: break
	flag = 0
	for i in range(a, b+1):
		if i % 4 == 0:
			if i % 400 == 0:
				print i
				flag += 1
			elif i % 100 == 0:
				continue
			else:
				print i
				flag += 1
	if flag == 0:
		print "NA"
	print

Submission status: WA: Presentation Error

Solution code:
while True:
	a, b = map(int, raw_input().split())
	if a + b == 0: break
	flag = 0
	for i in range(a, b+1):
		if i % 4 == 0:
			if i % 400 == 0:
				print i
				flag += 1
			elif i % 100 == 0:
				continue
			else:
				print i
				flag += 1
	if flag == 0:
		print "NA"
	print 
print

Submission status: WA: Presentation Error

Solution code:
ans = []
while True:
	a, b = map(int, raw_input().split())
	if a + b == 0: break
	tmp = []
	for i in range(a, b+1):
		if i % 4 == 0:
			if i % 400 == 0:
				tmp.append(i)
			elif i % 100 == 0:
				continue
			else:
				tmp.append(i)
	if len(tmp) == 0: tmp.append("NA")
	ans.append(tmp)
for a in ans:
	for t in a:
		print t
	print

Submission status: WA: Presentation Error

Solution code:
while True:
    a, b = map(int, input().split())
    if a == b == 0: break

    count = 0
    for y in range(a, b + 1):
        if y % 400 == 0 or y % 4 == 0 and y % 100 != 0:
            count += 1
            print(y)
    if count == 0:
        print('NA')
    print()