Problem: In this problem, you need to check if a given finite sequence appears as a sub-sequence in the Fibonacci sequence. A finite sequence is said to be a Fibonacci sub-sequence if it is contained in the Fibonacci sequence in the same relative order but not necessarily consecutively. 
For example, the finite sequence 2, 5, 8 is a Fibonacci sub-sequence.  But 2, 8, 5 is not. Write a C++ program to accept an integer M followed by a finite sequence of M numbers. Your task is to determine if this finite sequence is a Fibonacci sub-sequence. You should output the following:
●	true or false
○	true: if the given finite sequence is a Fibonacci sub-sequence. E.g. on inputs “3 3 8 13”  and “3 3 5 8”
○	false  otherwise
Input Format An integer M followed by M integers

Assumptions on Input
●	Assume that the integer M will be between 1 and 19, both inclusive 
●	Assume that the sub-sequence numbers will be between 0 and 5000, both inclusive

Student submission:
#include <simplecpp>

int fib (int n)
{
    if (n == 1)
    {
        return 0;
    }
    else if ( n == 2)
    {
        return 1;
    }
    else
    {
        return fib ( n-1 ) + fib (n - 2);
    }
}

main_program
{
    int M;
    cin>>M; //2
    int position = 0;
    int position_prev = 0;
    int position_prev_prev = 0;
    bool seq = false;

    for (int i = 0; i < M; i++)//i < 2
    {
        seq = false;
        int inp; //1 4
        cin>>inp;


        //check if inp belongs to fib and record n such that fib(n) = inp; if not cout false
        //if inp < 8 check values of fib till n = 7
        //if inp >= 8, check values of fib till n = inp
        bool belongs = false;
        if (inp < 8) //this case
        {
            for(int j = 1; j < 7; j++)
            {
                if(fib(j) == inp) //j = 2
                {
                    //inp is jth term of fib
                    position = j;
                    belongs = true;
                } //position = 2; belongs = true;
            }
        }
        else
        {
            for (int j = 7; j <= inp; j++)
            {
                if (fib (j) == inp)
                {
                    position = j; //7
                    belongs = true;
                }
            }
        }
        //if belongs is true then check ahead
        if (belongs)
        {
            if(position == 3)
            {
                if(position_prev == 3)
                {
                    if(position_prev_prev == 2 || position_prev_prev == 3)
                    {
                        seq = false;
                        break;
                    }
                    position_prev = 2;
                }
            }
            if(position > position_prev)
            {
                seq = true; //seq = true
            }
        }
        if (!seq)
        {
            break;
        }
                position_prev_prev = position_prev;
        position_prev = position;

        //2

    }
            if (seq)
        {
            cout<<"true";
        }
        else
        {
            cout<<"false";
        }
}

Grading criterion: Output
Rating A: correctly prints the output
Rating B: Some issue
Rating C: Major issue
Rating D: 0
Assigned grade: A