//https://www.hackerrank.com/challenges/is-fibo
import java.io.*;
import java.util.*;

public class Solution {
    public static void main(String[] args) throws IOException {
        StringBuffer sb = new StringBuffer();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        long prevFib, curFib;
        Set<Long> fibs = new TreeSet<Long>();
        fibs.add(prevFib = 0L);
        fibs.add(curFib = 1L);
        for(int T = Integer.parseInt(br.readLine()); T > 0; --T){
            long N = Long.parseLong(br.readLine());
            while (curFib < N){
                long temp = curFib;
                fibs.add(curFib += prevFib);
                prevFib = temp;
            }
            sb.append(fibs.contains(N) ? "IsFibo\n" : "IsNotFibo\n");
        }
        System.out.print(sb);
    }
}
@@ -170,24 +170,39 @@
 xception %7B%0D%0A
+        //I/O%0D%0A
         Stri
@@ -314,24 +314,150 @@
 ystem.in));%0D
+%0A%0D%0A        //Initialize fibs, an ordered set%0D%0A        //to hold all Fibonacci numbers,%0D%0A        //with the first two numbers.%0D
 %0A        lon
@@ -583,24 +583,52 @@
 rFib = 1L);%0D
+%0A%0D%0A        //For every test%0D
 %0A        for
@@ -687,59 +687,199 @@
 )%7B%0D%0A
-            long N = Long.parseLong(br.readLine());
+%0D%0A            //Get N, the potential Fibonacci number%0D%0A            long N = Long.parseLong(br.readLine());%0D%0A%0D%0A            //Make sure we've gotten all%0D%0A            //Fibonacci numbers up to N
 %0D%0A  
@@ -1031,32 +1031,93 @@
 %0D%0A            %7D%0D
+%0A%0D%0A            //Check if the Fibonacci number is in the set%0D
 %0A            sb.
@@ -1182,16 +1182,35 @@
       %7D%0D
+%0A%0D%0A        //Print%0D
 %0A       

Add comments to is-fibo