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;
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 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: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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>
#include<cmath>
main_program{
int n,k;cin>>n;
k=log(n)/2.303;
k=k+1;
int i=k;
bool flag=1;
int m;
if(k%2==0){m=k/2;}
else{m=(k-1)/2;}
repeat(m){
int l=pow(10,i-1);
if(n%10!=n/l){
flag=0;
}
n=n%l;
n=n/10;
i=i-2;
}
if(flag==1){cout<<1<<endl;}
else{cout<<0<<endl;}
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 num;

cin >> num;

float z;

z=log(num)/log(10);

int n = floor(z)+1;

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

for(int i=1;i<=n/2;i++){

int a;

int a1 = pow(10,i);

int a2 = pow(10,i-1);

a= ((num % a1) - (num % a2))/a2;


int a3 = pow(10,n-i+1);

int a4 = pow(10,n-i);

int b;

b= ((num% a3)-(num % a4))/a4;

if(a!=b){ cout << "0" ;break;}

if (i==n/2){cout << "1";}

}


}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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,m;

cin>>n;
swap(n,m);
if(m==n){
cout<<"0"<<endl;
}
else if (m!=n) cout<<"1"<<endl;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
int ncop=n;
int nnew=0;
while(ncop!=0)

{ 
nnew=nnew*10;
nnew+=ncop%10;
ncop=ncop/10;

}

if(n==nnew)
cout<<"1";
else
cout<<"0";









}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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, i = 0, a, pali = 0, k;
	cin >> n;
	a = n;
	k = n;
	for (;a >= 1; i++) a = a / 10;
	i--;
	for (;n >= 1; n = n / 10){
		int digit;
		digit = n % 10;
		pali = pali + (digit * pow(10,i));
		i--;
	}
	if (pali == k) cout << "1";
	else cout << "0";
	
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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 ;
cin >> n ;
	if(n=1) {cout<< "if palidrom " ;}
	if(n=0){cout<<"not a palidrom " ; }
	cout<<1 ;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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()
{
long long int n, reverse_n=0, num; cin>>n;
num=n;
while(n)
{
reverse_n*=10;
reverse_n += (n%10);
n/=10;
}
if(num==reverse_n) cout<<1;
else cout<<0;
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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,p,flag=0,q;
cin>>n;
q=n;
while(n%10!=0)
{
p=n%10;
n=n/10;
flag=(flag*10)+p;
}
if(flag==q)
cout<<"1";
else
cout<<"0";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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>

int main() {
    int n,sum=0,f1,l1,k=1,i=1,a,x,y;
    cin>>n;
    a=n;
    
    while(a>1) {
    	k++;
        a=a/10;    }
 
    if(k%2==0) { 
    while(i<(k)/2) {
    	x=pow(10,i);
        f1=n%x;
        y=pow(10,k-1);
        l1=n/y; i++;

        if(f1==l1) {
        	sum=sum+1; }
        else {sum=sum;}	

        n=n%y;
        n=n/10;          
                    }   }



    else { 
    while(i<(k-1)/2) {
    	x=pow(10,i);
        f1=n%x;
        y=pow(10,k-1);
        l1=n/y; i++;

        if(f1==l1) {
        	sum=sum+1; }
        else {sum=sum;}	

        n=n%y;
        n=n/10;          
                    }   }

    if(k%2==0) { 
         if (sum==k/2) {cout<<"1";}
         else {cout<<"0";}       }
    else {
         if (sum==(k-1)/2) {cout<<"1";}
         else {cout<<"0";}

     }  
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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,z;
z=0;
cin>>n;
int t=floor(log10(n))+1;
for(int i=0;i<floor(t/2);i++){
int p,q;
p=(n%int(pow(10,t-i))-n%int(pow(10,t-i-1)))/int(pow(10,t-i-1));
q=(n%int(pow(10,i+1))-n%int(pow(10,i)))/int(pow(10,i));
if(p!=q){cout<<"0"; break;}
if(p==q) z++;                                            }
if(z==floor(t/2)) cout<<"1";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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,temp,r,reverse=0;
	cin >> n;
	temp=n;
	while (temp>0) {
		r= temp%10;
		reverse = reverse*10 + r;
		temp=temp/10;

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

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
bool num1,num2,num3;
cin>>n;
for(int i=10;i<=n;i=i*10)
{int b=n/i;
switch(b)
{case1:num1=1;break;
case2:num2=1;break;
case3:num3=1;break;}}
if(num1=num2)
{cout<<"1";}
else(cout<<"0");
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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, quo, rim, z=0;
	cin>>a;
	quo=a;
	while ( quo != 0 ) {
		rim = quo % 10;
		quo = quo / 10;
		z = (z*10) + rim;		
	}
	if (z == a){
		cout<<"1";
	}
	else 
		cout<<"0";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;
int rev=0;
int n2;
int digit;
n2=n;
while(n>0)
{ digit=n%10;
rev=rev*10+digit;
n=n/10;
}
if(rev==n2)
{
cout<<"1";
}
else 
cout<<"0";
}

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
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;

 if ("n" is palindrome); cout<<"1";
 else cout<<"0";
 }

Grading criterion: Overall program correctness
Rating A: "Common requirements  of a Program are correct - i.e.
 
- header (includes, using namespace, etc)
- main syntax
- variables declaration
- overall syntax"
Rating B: Problems are present in the code(eg: printing unnecessary strings, missing semicolons & braces, wrong/missing declarations, wrong header files)
Rating C: 0
Rating D: 0
Assigned grade: B