CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>

main_program{
	int start,end,res=0;
	cin>>start>>end;
	for(int a=start;a<=end;a++)
	{
		for(int b=a;b<=end;b++)
		{
			for(int c=b;c<=end;c++)
			{
				if(a*a+b*b-c*c==0)
				{
					int flag=0;
					for(int i=2;i<c;i++)
					{
						if(a%i==0 && b%i==0 && c%i==0)
						{
							flag=1;
							break;
						}
					}
					if(flag==0)
					{
					cout<<a<<" "<<b<<" "<<c<<endl;
					res=1;
					}	 
				}
			}
		}
	}
	if(res==0){
	cout<<"0"<<endl;
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>
main_program{
	int start , end , first , second , third ,count,check;
	float thirddraft;
	count=check=0;
	cin >> start >> end ;
	first=start;
	while (first<=end){
		for (int j=1; j <=end ; j++){
			thirddraft = sqrt(first*first + j*j);
		       	if(thirddraft == int(thirddraft) && thirddraft<=end){
				third=thirddraft;
				if (first < j && first < third && j<third){
					for(int i=2;i<=first;i++){
						if(first%i==0 && j%i==0 && third%i==0){
							check=1;
						}
					}
					if(check==0){
						cout<<first<<" "<<j<<" "<<third<<endl;
						count=1;
					}
					check=0;
				}
			}
		}
		first++;
	}
	if(count==0){
			cout<<"0";
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int a, b, k=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++){
		for(int j=i+1;j<=b;j++){
			bool t=true;
			int m=sqrt((i*i)+(j*j));
			float n=sqrt((i*i)+(j*j));
			for(int x=2; x<=i; x++){
				if((i%x==0)&&(j%x==0)&&(m%x==0)) t=false;
			}
			if((m==n)&&(m<=b)&&t){
			       	cout<<i<<" "<<j<<" "<<m<<endl;
				k++;
			}
		}
	}
	if(k==0){cout<<"0";}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int start, end, k=0;
	cin>>start>>end;
	int i = start;
	repeat(end-start-1){
		int n =0;
		double m =0.0;
		int j =  i + 1;
		while(n<=end){
		n = sqrt(i*i + j*j);
 		m = sqrt (i*i + j*j);
		int b=0;
		for(int a=2; a<i;a++){
			if(i%a == 0 && j%a == 0 ){
				b++;
			}
		}

		if (m == n && b ==0 ){
			cout<<i<<" "<<j<<" "<<n<<endl;
		k++;
		}
		
		

		j++;
		}
		i++;
	}
	if (k == 0){
		cout<<"0"<<endl;
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int n1, n2;
	cin >> n1 >> n2;
	int i = 1;
	while (n1 <= i && n2 >= i){
		
		//check if i is a prime no.
		int x=0;
		while (x<i/2){
			int divisor = 2;
			int remainder = i%divisor;
			if (remainder != 0){
				divisor++;
			}
			else{
				break;
			}
			x++;
		}
		if(x>=i/2&& i!=1&& i!=2){
			
			int cnt = 1;
			int t = i;
			while ( t <= n2){
				int a = i;
				bool no = false;
				int b = i;
				while (b<=n2){
					float c = b*b*1.0 + a*a;
					int y = 1;
					while(y<=c/2){
						if (y == c/y){
							cout << a<< " " << b<< " " << y<< endl;
							no = true;
							break;
						}
						else{
							y++;
						}
					}	
					b++;
					
				}
				if(no == true){
					break;
				}
				else {
					a = a*cnt;
					cnt++;
					t = t*cnt;
				}
			}
		}
		i++;
	}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int start, end, a, b, c, i, j, k;
	cin>>start;
	cin>>end;
	a=start;
	k=0;
	while(a<=end-2){
		b=a+1;
		while(b<=end-1){
			c=b+1;
			while(c<=end){
				i=2;
				j=0;
				while(i<=c){
					if((a%i==0 && b%i==0) || (a%i==0 && c%i==0) || (b%i==0 && c%i==0)){
					       	j++;
					}
					i++;
				}
				if((c*c == a*a + b*b) && j==0){
					cout<<a<<" "<<b<<" "<<c<<endl;
					k++;
				}

				c++;
			}
			b++;
		}
		a++;
	}
	if(k==0) cout<<"0";
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program {
	int start, end;
	cin >> start >> end;
        int a, b=0, c=0;
	a = start;
        while(c<=end){if(c*c == (a*a + b*b)){cout<<a<<b<<c;}
		else
		        while(b>=c){
			while(a>b){
				 b++;}
			c++;}
		a++;}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int start,end;
	cin>>start>>end;
	int a,b,c;
		for(a=start;a<end;a++){
			for(b=a+1;b<end;b++){
				for(c=b+1;c<=end;c++){
				

		if (a*a+b*b==c*c)
		{cout<<a<<" "<<b<<" "<<c<<endl;
		
		}
		
		
		 
			}}}
		


			
	}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>
main_program 
{
	//taking inputs
	int start;
	int end;
	cin>>start;
	cin>>end;
	
	int a,b,c=0;
	long sumsquares;
	long hyppower;
	long checksumsquares;
	long checkhyppower;
	int cnt=0;
	int cnt2=0;
	
	for(int i=start;i<=end;i++)
	{
		
		for(int j=i+1;j<=end;j++)
		{
			sumsquares= pow(i,2)+pow(j,2);
			
			for(int k=j+1;k<=end;k++)
			{
				hyppower=pow(k,2);
				
				if(hyppower==sumsquares)
				{
					
					for(int p=2;p<=i;p++)
					{
						if(i%p==0&&j%p==0&&k%p==0)
						{
							a=i/p;
							b=j/p;
							c=k/p;
							
							checksumsquares= pow(a,2)+pow(b,2);
							checkhyppower=pow(c,2);
								
							if(checkhyppower==checksumsquares)
							{
								cnt++;
							}
							
						}	
					
					}
					
					
					if(cnt==0)
					{
						cout<<i<<" ";
						cout<<j<<" ";
						cout<<k<<endl;
						cnt2++;
					}
					cnt=0;
				}
					
			}
		}
	}
	
	if(cnt2==0)
	{
		cout<<"0";
	}
	
	
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{

int start, end, a, b, t, u, c;
cin>>start>>end;

for(int j=1; j<=end; j++){

for(int i=1; i<=end; i++){

a=j;
t=a*a;

b=i;
u=b*b;
c=sqrt(t+u);

if(c<=end){

for(; a%t!=0;t++ ){
    
      
      for(; b%t!=0;){
      

      for(; c%t!=0;){
      

      cout<<a<<" "<<b<<" "<<c<<" "<<endl;
      break;
      }break;
         }break;


}break;


}


}

}




}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int smaller,larger,start,end,a,b,i,c;
	cin>>start>>end;
	a=start;b=start;c=end;
	while(a<=b && b<c){
		
	while( a<=b && b<end){
		c=sqrt(a*a+ b*b);
		if(c<=end&& c*c==a*a+b*b){
		
	cout<<a<<" "<<b<<" "<<c<<"\n";}
	b++;
	} a++;b=a;}}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
int gcd(int p ,int q){
  int r=p,s=q;
  if(q>p){
    r=q;
    s=p;
  }
  int rem;
  while(r%s!=0){
    rem=r%s;
    r=s;
    s=rem;
  }
  return s;
}
main_program{
  int start,end;
  cin>>start;
  cin>>end;
  
  int a=start,b,c;
  while(a<=end){
    b=start;  
    while(b<=end){
      c=start;
      while(c<=end){
        if((a*a)+(b*b)==(c*c) && b>a && c>b && gcd(a,b)==1 && gcd(b,c)==1 ){
	  cout<<a<<" "<<b<<" "<<c<<"\n";
	  break;
	}
	c++;
      }
    b++;
    }
    a++;
  }     
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int n; 
	cin >> n;
	int start;
	cin >> start >> n;
        int a, b, c;
	int sq1, sq2, sq3;
	for(a=start; a<n; a++){
		sq1=a*a;}
	for(b=start+1; b>a; b++){
		sq2=b*b;}
	for(c=start+2; c<n; c++){
		sq3=c*c;}
	if(sq3== sq1+sq2){cout<<a<<b<<c;
	}

}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{

int a, b, m = 1, c, d = 2;

cin >> a >> b;

c = a;
while(m<2000 && c>a-1){
m = sqrt((c*c) + (d*d));

if(c > d){
c = a;
d++;
continue;}

if( pow(m,2) == pow(c,2) + pow(d,2) && m < b+1 ){
cout << c << " " << d << " " << m << endl;
c++;
}

else{
c++;
}
}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program
{
	int a,b,u=0,r=0;
	cin>>a>>b;
	for(int i=a;i<=b;i++)
	{
		for(int j=i+1;j<=b;j++)
		{
			for(int k=j+1;k<=b;k++)
			{
				if(k*k==i*i+j*j)
				{u=0;
					for(int y=2;y<10000;y++)
					{
						if(i%y==0&&j%y==0&&k%y==0)
					u++;
					
					}
					if(u==0){r++;

							cout<<i<<" "<<j<<" "<<k<<endl;
				}}

			}}
	}
if(r==0)
	cout<<0;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>
main_program{
	
	int start,end,sum,sum1;
	sum=0;
	sum1=0;
	
	cin>>start>>end;
	
	for(int a=start+1;a<end;a++){
	
		
		

		for(int b=a;b<end;b++){
			
			for(int c=a;c<end;c++){
				if(c*c==a*a+b*b){
					for(int i=2;i<=c;i++){
						if(a%i==0 && b%i==0 && c%i==0)
							sum1=sum1+0;
					else sum1=sum1+1;}
					if(sum1==c-1){
					cout<<a<<" "<<b<<" "<<c;
					cout<<"\n";
					
					sum=sum+1;
					sum1=0;
						}
					else sum1=0;


				
			}
			}
		}
		
		}
	
	if(sum==0)
		cout<<0;
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int x,y,n;
	cin>>x>>y;
	for(int i=x; i<=y; i++){
		for(int j=x; j<=y; j++){
			for(int z=x; z<=y; z++){
				if(z*z==i*i+j*j && z>j && j>i){
				cout<<i<<" "<<j<<" "<<z<<endl;}}}}}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
#include<math.h>
main_program{
	int start;
	int end;
	cin >> start >> end;
	int a,b;
	bool yes = false;
	float c;

	while(c<=end && a<=end && b <=end) {
		
		while(pow((a*a)+(b*b),0.5)<=end){
			a = start;
			b= start;
			for(int k=2; k <= min(a,b) ; k++){
			if(a%k ==0 & b %k==0) {
				 yes == true;
				 break;}
			}c= pow((a*a *1.0)+(b*b*1.0)+0.0,0.5);
			int j = c;
		       if(c-j !=0) yes = true;
			b++;
			
	
	      	
	       if(yes == false) {
		      if (a <b ) cout << a << " "<< b<<" "<<c<<endl;
		     if(b<a) cout <<b<<" "<<a<<" "<<c<<endl;
	       }
		} a++; 
}
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>

main_program{

	int start,end,a,b,c;
	int x = -1;
	int y = -1;
	int z = -1;

	cin>>start>>end;

	for(c = start; c <= end; c++) {
	
		for(b = start; b <= end; b++) {
		
			for(a = start; a <= end; a++){
			

				if (a*a + b*b == c*c && a < b && b < c) {
	
					
					x = a; y = b; z = c;
					cout<<x<<" "<<y<<" "<<z<<endl;

				}
				
			}
		
		}
	
	}

	if ((x == -1) && (y == -1) & (z == -1)) {
	
		cout<<0<<endl;
	
	}

}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program
{
	int start, end;
	cin>>start>>end;

	int a, b, c, d;
	for(int a>=start; b<=end; a++)

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	int start,end;
	cin>>start>>end;
	while((1<=start) &&(end<=10000) &&(start<=end)){
		int a,b,c;
		}}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include<simplecpp>
main_program{
	double a,b,c,n1,n2;
	cin>>n1>>n2;
	a=n1;b=n1;c=n1;
	
	repeat(n2-n1){repeat(n2-n1){repeat(n2-n1){double k=pow(a,2);if(k==pow(b,2)+pow(c,2)){cout<<a<<b<<c;c++;}}b++;}a++;}
		}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>
main_program{
 int start,end,i=start,j=i+1,k=j+1;
 cin>>start>>end;
 while(i<=end-2){
  while(j<=end-1){
   while(k<=end){
    int pyt = i*i+j*j-k*k;
    if (pyt==0){
     cout<<i<<" "<<j<<" "<<k<<endl;
    }
   }
  }
 }
}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a program to accept two numbers from the user start and end and print the Pythagorean triplets within the range of start to end, both inclusive, but the triplets should not have any common factor. If no such triplets exist, then print 0. The triplets should be in increasing order.

Student submission:
#include <simplecpp>
main_program{
    int firstn,lastn;
    cin >> firstn >> lastn;
    int a = firstn, b=firstn, c=firstn,counter = 0;
    
    
    
    
    
    while(a <= lastn && b <=lastn && c<= lastn){
        if(c*c == a*a + b*b){
            if (a>b){
                c+=1;
                }
            else {
                int k=2;
                bool fact = false;
                while(k<a){
                    if(a%k == 0 && b%k==0 && c%k == 0){
                        fact = true;
                        break;
                    }
                    else{
                        k++;
                    }
                }
                if(!fact){
                    cout << a << " " << b << " " << c << "\n";
                    b+=1;
                    c= firstn;
                    counter ++;
                }
                else{
                    c +=1;
                }
                
            }

        }
        else{
            c+=1;
            
        }
        if(c == lastn+1){
            c = firstn;
            b+=1;

        }
        if(b == lastn +1){
            b = firstn;
            a+=1;
        }
        


        

    }
    if(counter == 0){
        cout << 0;
    }
    

}

Grading criterion: Placeholder for extra marks to be given for any reason
Rating A: Modularity, Extra Functions Defined, some corrective marks for failed testcases
Rating B: No reason for extra marks
Rating C: 0
Rating D: 0
Assigned grade: B