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<cmath>
using namespace std;
int main()
{
 int n,d=0;
 cin>>n;
 int t=n;
 int i=0;
 while (t>0)
 { i++;
   t/=10;
   
 }
 t=n;
 for(;i>0;i--)
 { d+=(t%10)*pow(10,i-1);
   t/=10;
 }
 if(d==n)
  { cout<<"1";
  }
 else
  { cout<<"0";
  }
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 <math.h>
using namespace std;
int main()
{int n,c;
 cin>>n;
for(int p=0;n>pow(10,p);p++)
c=p+1;
for(int i=1;i<c;i++)
int x=n/pow(10,c-i-1);
int y=n%10+i;
if(x==y)
cout<<"1";
else cout <<"0";
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,m,d,k=0;
cin>>n;
m=n;
while (m>0)
{
d=m%10;
m=(m-d)/10;
k=(k*10)+d;
}
if (k==n)
{
cout<<"1";
}
else 
{
cout<<"0";
}
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,d,j,i,rev,r,m;
	cin >> n;
	d=1;
	i=0;
	while(n>d)
	{	
		d=d*10;
		i++;
	}
	d=d/10;
	rev=0;
	m=n;
	for(j=1;j<=i;j++)
	{
		r=m%10;
		rev= rev + d*r;
		m=(m-r)/10; 
		d=d/10;		
	}
	if( rev==n)
	{
		cout << "1";
	}
	else
	{
		cout << "0";
	}
		
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 i,n,z,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;
cin>>n;
b=n;
for( i=0;z!=0;i++){

z=z/10;


}
if(i%2==0){
for (int j=1;n!=0;j++){
switch(n%10){
case 0:a+=j;break;
case 1: b+=j;break;
case 2:c+=j;break;
case 3:d+=j;break;
case 4:e+=j;break;
case 5:f+=j;break;
case 6:g+=j;break;
case 7:h+=j;break;
case 8:i+=j;break;
case 9:j+=j;break;

}
n=n/10;
}
if((a==0 ||a==i+1)&(b==0 ||b==i+1)&(c==0 ||c==i+1)&(d==0 ||d==i+1)&(e==0 ||e==i+1)&(f==0 ||f==i+1)&(g==0 ||g==i+1)&(h==0 ||h==i+1)&(i==0 ||i==i+1)&(j==0 ||j==i+1))
{cout<<1;}
else cout<<0;
}

}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 m= log10(n)+1 ;int i=m;
int k= pow(10,i);int b=1;
for(int j=1;j<=m/2;j++)
{int k= pow(10,i);int a=m-i+1;i--;
int l= pow(10,a);b=b*1;
if(n%k!=n%l){b=0;}
}
cout<<b;}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,sum=0,a,n2;
cin>>n;
n2=n;
while(n!=0)
{
a=n%10;
sum=sum*10+a;
n=n/10;
}
if (sum==n2)
cout<<"1";
else cout<<"0";
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 <bits/stdc++.h>
using namespace std;


int main(){

	 int temp, n, dig, rev = 0;
     cin >> n;

     temp = n;

     do {
         dig = n % 10;
         rev = (rev * 10) + dig;
         n /= 10;
     } while (n != 0);

     if (temp == rev)
         cout << "1";
     else
         cout << "0";

    return 0;

}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,x,y,a,b,c,d,e,f;

cin >>n;

a=n;
x=n;
y=0;
c=1;
e=0;

while(x!=0)
{
x=x/10;
y=y+1;
}

repeat(y)
{
c=c*10;
}
c=c/10;

repeat(y)
{
b=a%10;
d=b*c;
c=c/10;
a=a/10;
e=e+d;
}

if(e==n)
{
f=1;
}
else
{
f=0;
}
cout <<f;

}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,a,b,c,d,e,f,g,q,r,s,t,u,v;
cin >> n;
a=n%10;
q=n%100;
r=n%1000;
s=n%10000;
t=n%100000;
u=n%1000000;
v=n%10000000;
b=(q-a)/10;
c=(r-q)/100;
d=(s-r)/1000;
e=(t-s)/10000;
f=(u-t)/100000;
g=(v-u)/1000000;
if(n>10)
{if(a==b) cout << "1";
else cout <<  "0" ;}
if(n>100)
{if(a==c) cout << "1";
else cout << "0" ;}
if(n>1000)
{if(a==d && b==c) cout << "1";
else cout << "0";}
if(n>10000)
{if(a==e && b==d) cout << "1";
else cout << "0";}
if(n>100000)
{if(a==f && b==e && c==d) cout << "1";
  else cout << "0";}
if(n>1000000)
{if(a==g && b==f && c==e) cout << "1";
 else cout << "0";}
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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;

    return 0;
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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(){
	long long int n;
	cin>>n;
 	long long int m=n;
	if(n%10==0){cout<<0;return 0;}
	int i=0;
	while(m>0){
		i++;m/=10;
	}
	for(int j=1;j<=(i/2);j++){
		if((long long int)((n%(long long int)pow(10,j))/(long long int)pow(10,j-1))==(n/(long long int)pow(10,i-j))%10){}	
		else {cout<<0;return 0;}
	}
	cout<<1;
	
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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{
unsigned int a,u,v,x,y,z;
a=uvxyz;
cin>>a;
if (u=z,v=y;) cout<<"1";
	else cout<<"0";

	
			
				}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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;
int j=0;
cin>>n;
int i=1;
int a=n;
int l=10;
while (pow(10,i)<n){i++;}
i=i-1;if (i>=2){int p=i;
for (int k=1;k<((p/2)+1);k++){
int t=pow(10,k); int s=pow(10,i);
int z;int d=a/s;
if (a%l==0) {z=a/l;l=l*10;} else z=a; 
if( (z%10)==(a/s)) {j++;} else break;
i=i-1;a=a-(a%t)-s*d;
}
int q=pow(10,j);
int w=1;
while (pow(10,w)<n){w++;}
w=w-1;
if (j==(w/2)) cout<<"1";
else cout<<"0";

}}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,j=1;
cin>>n;
m=n;
int i,p=1;
while(i>=0)
{i=m/10;
m=i;
if(m==0) break;
 j++;}
int rem,quot;
rem=n%10;
for(int k=1;k<j;k++)
{p=p*10;}
quot=n/p;
if(quot==rem) cout<<"1" ;
else cout<<"0";
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 i=1;
int m,j,p,q,r,g;
m=pow(10,i);
j=pow(10,i-1);
p=n%m;
q=n%j;
r=(n-q)/j;
g=r%10;
while (p<4){i=i+1;
}
int nd=i-1,palino=0;
int M,J,P,Q,R,G,I=1;
M=pow(10,I);
J=pow(10,I-1);
P=n%M;
Q=n%J;
R=(n-Q)/J;
G=R%10;
while(I<=nd){
palino=palino+G*(pow(10,nd-I-1));
I=I+1;
}
if (palino==n){cout<<"1";}
else {cout<<"0";}
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 l=10,m=1,x,k;
   cin>>k;
x=k;
while(k/l !=0){
  l*=10;
  m++;
}

int new_=0,digit;

for(int i=1; i<=m; i++){
  digit=k%10;
  new_=new_*10+digit;
  k/=10;
}


 if(new_==x)
 cout<<"1";
 else
 cout<<"0";
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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,org,rev=0;
cin>>n;
org=n;
while(n>0)
{rev=rev*10+(n%10);
n=n/10;
}
if (org==rev)
cout<<"1";
else
cout<<"0";
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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;
int b;
int c;
int d;
int e;
int n;
int p ;
cin>>n;
 p= a*100000000 + b*10000000 + c*1000000 + d*100000 + e*10000 + d* 1000 + c*100 + b*10 + a*1 ;
 if (n == p ) {
cout << "1";
}
else
cout<< 0;
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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;
  cin>>n;
  int i = 1;
  int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9;
  if(n!=0){
  a0 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a1 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a2 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a3 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a4 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a5 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a6 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a7 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a8 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a9 = n%10;
  i++;}
  n = n/10;
  




return 0;
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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;
#include<math.h>
int main(){
//to find length
int n,r,l,s;
bool flag=1;
cin>>n;
for (int i=0;;i++){
s=n/pow(10,i);
if (s>0) continue;
s=i;
break;
}
for (int i=0;i<floor((s+1)/2);i++){
r=floor(n/pow(10,i))-floor((n/pow(10,i+1)))*10;
l=floor(n/pow(10,s-i-1))-floor((n/pow(10,s-i)))*10;
if (r!=l) flag=0;
if (flag==0) break;
}
cout <<flag;
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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(){
   
    ;
   unsigned long long int n, a=10,k,i=1,l=10;

   cin >> n;

 while(i<n){
 
    i=i*10;
           }

  k=i/10;


 while(n>10){

   if(n%a==ceil(n/k)){

       n=(n-a)/10;
       n=n%(k/l);
      l=l*10;
    cout << "1";break;}
 
  else if(n%a!=ceil(n/k)) {cout << "0";break;}
  }


}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 a,b,i,rem,c,n;
i=0;
cin>>a;
c=a;
b=a;
n=0;
while(1>0){
b=b/10;
i=i+1;
if(b==0){break;}

}
for(int x=i-1;x>=0;x--){
rem=a%10;
a=a/10;
n=n+rem*pow(10,x);
}
if(n==c){cout<<"1";}
else{cout<<"0";}
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
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 a,y;
cin>>a;
y=log10(a)+1;
for(float n=1; n<=(y+1)/2 ;n++){
int b=pow(10,n); int c=pow(10,y-n);
 if(a%b==a-a%c){continue;}
else if( a%b != a-a%c){
cout<<"0"; break;}
cout<<"1";
}
}

Grading criterion: Is the loop iterated correctly for updating all digits of the number to the final number
Rating A: Correct while or for loop which runs till the correct reversal happens and then terminates
Rating B: Wrong loop which runs for an incorrect number of times causing a different final number
Rating C: 0
Rating D: 0
Assigned grade: A