CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n,m;
cin>>n;
int c=0;
m=n;
while (m>0){
m=m/10;
c++;
}
int p,t=0,i=1,r,q;
q=n;
r=c;
while (i<=c){
p=q%10;
t=t+(pow(10,r))*p;
r=r-1;
i++;
q=q/10;
}
if (n==t/10) cout<<"1";
else cout<<"0";
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
using namespace std;

int main(){
int n, remainder, reverse;
cin>>n;
int m=n;
reverse=0;

while(n/10>0){
remainder=n%10;
reverse=reverse*10+remainder;
n=n/10;
}

remainder=n%10;
reverse=reverse*10+remainder;

if(reverse==m) cout<<1<<endl;
else cout<<0<<endl;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
int q;
int a=1;
int b=0;
cin>>q;

if(q==121){
cout<<a;}
else if(q==1221){
cout<<a;}
else if(q==12321){
cout<<a;}
else if(q==1234321){
cout<<a;}
else if(q==62326){
cout<<a;}
else{cout<<b;}
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
	int n,k=0,j=n,a=1;
	cin>>n;
	//to find how many digits are in 'n'
	for(int i=1;i<100;i++){
		j = j/10;
			k++;
			if(j==0){
				break;
			}
	}
	for(int l=1;l<k;l++){
		a = a*10;
	}
	if(k==1){
		cout<<"1";
	}
	if(k==3 || k==2){
	if(n%10 == n/a){
		 // if((n%100)/10 == (n/(a/10))%10){
		 // 	if((n%1000)/100 == (n/(a/100))%100){
		 // 		if((n%10000)/1000 == (n/(a/1000))%1000){
		 cout<<"1";
		 // }
		 // 	}
		 // }
	}
	else{
		cout<<"0";
	}
	}
	if(k==4 || k==5){
	if(n%10 == n/a){
		  if((n%100)/10 == (n/(a/10))%10){
		 // 	if((n%1000)/100 == (n/(a/100))%100){
		 // 		if((n%10000)/1000 == (n/(a/1000))%1000){
		 cout<<"1";
		 // }
		 // 	}
		 }
	}
	else{
		cout<<"0";
	}
	}
	if(k==6 || k==7){
	if(n%10 == n/a){
		  if((n%100)/10 == (n/(a/10))%10){
		 	if((n%1000)/100 == (n/(a/100))%100){
		 // 		if((n%10000)/1000 == (n/(a/1000))%1000){
		  cout<<"1";
		 // }
		 	}
		  }
	}
	else{
		cout<<"0";
	}
	}
	if(k==8 || k==9){
	if(n%10 == n/a){
		  if((n%100)/10 == (n/(a/10))%10){
		  	if((n%1000)/100 == (n/(a/100))%100){
		 		if((n%10000)/1000 == (n/(a/1000))%1000){
		  cout<<"1";
		      }
		 	}
		  }
	}
	else{
		cout<<"0";
	}
	}
	
	return 0;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main (){
int n,num,digit,rev=0;
cin>>num;
n=num;
do{
digit=num%10;
rev=(rev*10) +digit;
num=num/10;}
while(num !=0);
if(n==rev)
cout<<"1";

else
cout<<"0";

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
int n , p = 0, i = 0, q , j = 0,r;
cin >> n ;
r = q = n ;
while(r >0)
{
j++;
r = r/10;
}
//cout << j << endl;
while (n > 0)
{

p += (n%10)*int(pow(10,j-i-1)) ;
n = n/10 ;
i++;
//cout << p << endl ;

}
// p = p/100 ;
//cout << p << endl;
//cout << q << endl;
if( q == p)
{
cout << "1";
}
else
{
cout << "0";
}


}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
using namespace std;
int main() {
int n;
cin>> n;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>
main_program{
	int n;
	cin>>n,a,b,c;
	if (n=a+10b+100c+1000b+10000a) cout<<"1";
	else cout<<"0";

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
int d=0,c=0,res=0;
int a=n,a1=n;
while(a1>0)
{
c++;
a1=a1/10;
}
while(a>0)
{
c--;
d=a%10;
res=res+(int)(d*pow(10,c));
;
a=a/10;
}
if(res==n)
{cout<<"1";}
else
{cout<<"0";}
return 0;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <simplecpp>
main_program{
int n,s,p;
cin>>n;
int a=n;s=0;
while(a!=0){
p=a%10;
s=p+s*10;a=a/10;}
if(s==n){cout<<"1"<<endl;}
else{cout<<"0"<<endl;}
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>
main_program
{int n,a,k=1,num;
cin>>n;
a=n;
for (k=1;k>=1;k++)
{

num= a%10;
cout<<"num"<<k<<" "<<num<<endl;
a=n/10;
}









}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int n(int a){
int i=0;
while (a>0){i++;a=a/10}
return i;
}

int f(int n){
int r=n(n),k=0,a=0;
for (int i=0;i<n(n);i++){
r--;
a=
k=k+n/pow(10,r)
}
return k;
}
int main (){

int a;
cin >> a;
cout << f(a);

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>

using namespace std;
int main(){
int n,i,d=0;
cin>>n;
i=n;
while(i>0){
   int rem=i%10;
   d=d*10+rem;
   i/=10;
   }
 if(n==d) cout<<"1";
 else cout<<"0";
 }

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <simplecpp>
main_program{
int n, k;
cin>>n;
k=n/11;
if (n%11==0 && k%11==0) cout<<"1";
else cout<<"0";


}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>

using namespace std;

int main(){

int n;
cin>>n;
int i=1;
while(i>0){
        int t=n/pow(10,i);
        if (t==0) i++;
        else break;
}
int h= i - 1;
int l=1;
while(l<=h/2){
        int x=(pow(10,h-l));
        int y=pow(10,l+1);
                if (n/x - 10*(n/(10*x)) == n/y - 10*(n/(10*y)))
                        l++;
                else break;
        }
if (l==h/2 + 1) cout<<"1";
else cout<<"0";

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
float n;
int m ;
cin >> n;
int a = n ;
int i =0 ;
cout << n;
/*
do{
	m = a%10;
	a = a/10;
	i++;
	cout << i;
}
while (a!=0);
cout << i;


int b = (i-1);
int j = 0;
int num = n , w=0 ;
do
{
	int e = num%10; // e represents the end digits
	int num = num/10;
	
	int u;
	
	
	int z=pow(10,j);
	int x= pow(10,b);
	int y= n/x; 
	if(z>1)
	{int u=y%z;}// u represents the starting digits
	else{u=y;}
	j++; 
	b--;
	
	if(e==u){w++;}
}
while (num!=0);

if (w=i){cout << "1";}
else {cout << "0";}


*/



}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
	int x,y;
	y=pow(10,i);
	x=n%y;
		if(x==0) {
	while(n%10!=0){
                int term;
                term=n%10;
		for(int j=i;j>=1;j--){
		int term2,a=0;
		term2=term * pow(10,j);
		a=a+term2;
                n=n/10;

		if(a==n){ cout<<"1";}
		else {cout<<"0";}
		}
	}
}
}
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
int a,n,y=0,x;
cin>>n;
a=n;
while(n>0){
x=n%10;
y=y*10+x;
n=n/10;
}
if(a==y)
cout<<1;
else
cout<<0;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,rv=0,ld,c;
cin>>n;
c=n;
while(n>0){
ld=n%10;
rv=rv*10+ld;
n=n/10;
}
if (c==rv){cout<<"1";}
else{cout<<"0";}
return 0;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,c;
int s=0;
cin >> n;
int num1=n;
while(num1>0)
{
  c=num1%10;
  s=(s*10)+c;
  num1=num1/10;
}
if(s==n)
cout << 1;
else 
cout << 0;
return 0;
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <simplecpp>

main_program{
	
	int a;cin >> a;int i;int s=0;const int y = a;


	while(a%10!=0){i=a%10;a=a/10;s=s*10+i;}


	if(s==y){cout << "1";}
	else if (a!=s){cout << "0";}

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main ()
{
int n,s=0,m=0,r=0;
cin>>n;
m=n;
while(m!=0)
{
r=m%10;
s=s*10+r;
m/=10;
}
if(s==n)
cout<<"1";
else
cout<<"0";
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
#include <cmath>
using namespace std;

int main() {
float a, x;
int n;
result =0.0;
if (n<16){
for (i=1; i<=n; i++) {
 l=1;
 for (j=1; j<=(2*n-1); j++) {
 l=x*l; }
 m=1;
 for (k=1; k<=(n+1); k++) {
 m=m*(-1) }
 q=1;
 for (c=1; c<= (2*n-1); c++) {
 q=c*q; }
 nthterm=[l*m]/q;
 result = result + nthterm;
 }
 }
 else if (n>16) {
 for (i=1; i<=n; i++) {
 l=1;
 for (j=1; j<=(2*n-1); j++) {
 l=x*l; }
 m=1;
 for (k=1; k<=(n+1); k++) {
 m=m*(-1) }
 q=1;
 for (c=1; c<=30; c++) {
 q=c*q; }
 nthterm=[l*m]/q;
 result = result + nthterm;
 }
 
 cout << result;

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

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



int main(){
	
	long long int n;
	cin>>n;
	int flag =1;;
	while(n>9){
		long long int k = log10(n);
		k = pow(10,k);
		if(n/k != n%10){flag = 0; break;}
		n = n%k;
		n/=10;
		
	}
	cout<<flag;
	return 0;

}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
#include <cmath>
using namespace std;

int is_palindrome(int n) {
	int res = 0, temp = n;
	while (temp > 0) {
		res *= 10;
		res += (temp % 10);
		temp /= 10;
	} if (res == n) {
		return 1;
	} else {
		return 0;
	}
}

int main() {
	int n; cin >> n;
	cout << is_palindrome(n);
}

Grading criterion: Are the digits being correctly updated and utilised to calculate the number's reverse
Rating A: The digits from last to first digit of the number are correctly added to the reversed number
Rating B: The update of the number's reverse isn't done correctly
Rating C: 0
Rating D: 0
Assigned grade: A