CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
unsigned long long int n;
cin>>n;
for(int i=n%10;i==0;i=n%10)n=n/10;
for(int p=n;p!=0;p=n/10){int t=n%10;cout<<t;n=n/10;}
if(n!=0)cout<<n;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{int m=0, n;
cin>>n;
if (n==0) cout<<0;
else{
	int l, j=1;
	for (int i=0; ; ++i)
	{	if (floor(n/j)==0) break;
		j*=10;
		l=i+1;
	}
	j=1;
	int a=1, d;
	for (int p=0;p<(l-1); ++p) a=a*10;
	for (int g=0; g<l; ++g)
	{	d=(n%(j*10)-n%j)/j;
		m=m+ d*a;
		a=a/10;
		j*=10;
	}
	cout<<m;
}
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>

main_program{
	unsigned long long int n;
	cin >> n;
	unsigned long long int i = 0;
	while (n>0){
		i = i*10 + n%10;
		n=(n-n%10)/10;
	}
	cout << i;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>
main_program{
int n;
cin>>n;
while(n%10==0){
n=n/10;}
do{
cout<<n%10;
n=(n-(n%10))/10;}
while(n!=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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,m,i,NumDig,a,j;
cin>>n;
i=0;
a=n;
m=0;
while(a!=0)
{
a=a/10;
i++;
}
a=n;
for(j=1;j<=i;j++)
{
NumDig=a%10;
m=NumDig*pow(10,(i-j))+m;
a=a/10;
}
cout<<m;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int digits = log10(n)+1;
int d = 0; int f = 0;
for (int i = 0; i < digits && d==0; i++)
{
int r = pow(10,i+1);
d = (n%r)/pow(10,i);
f = i;
};
for (int i = f; i < digits; i++)
{
int r = pow(10,i+1);
d = (n%r)/pow(10,i);
cout << d;
};
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

int main(){
using namespace std;
int m,i=0,n,k=0,dig=1;
cin >> n;
m=n;

while(m>0){
m=n;
m=m/pow(10,dig);
dig=dig +1;
}
dig=dig-2;

while(dig>=0){
i=n%10;
n=(n-n%10)/10;
k=k+i*pow(10,dig);
dig--;
}
cout<<k;
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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
using namespace std;
int main(){
        long long int n, m=0;
        cin>>n;
        while (n>0){
                m=m*10+n%10;
                n=n/10;
        }
        cout<< m;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <simplecpp>

main_program{
	long long int n = 0, sum = 0;
	cin >> n;
	long long int copy = n;
	int rem = 0;
	while(copy%10 == 0){
		copy /= 10;
	}
	while(copy>0){
		rem = copy%10;
		sum = (sum +rem)*10;
		copy/=10;
	}
	sum/=10;
	cout << sum;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	unsigned int n; cin>>n;
	unsigned int N;
	int i=0;
	N=n;
	while(N>0)
	{
	N/=10;
	i++;
	}
	int rem,j;
	unsigned int m=0;
	while(n>0)
	{
	rem=n%10;
	n/=10;
	m+=rem*pow(10,i-1);
	i--;
	}
	cout<<m;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

int main(){
	long long int n,m;
	cin>>n;
	while(n>0){
		int temp=n%10;
		n/=10;
		m+=temp;
		m*=10;
		
	}
	cout<<(m/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: A
Problem: Write a C++ program that takes a positive integer n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <simplecpp>

main_program{

long long int n,reverse=0,length, i=0,remainder;
cin>>n;

length=to_string(n).length();
while (i<length){
	if (n%10==0){
		n/=10;
	};
	i+=1;
};

i=0;
length=to_string(n).length();
while (i<length){
	reverse=reverse*10;
	remainder=n%10;
	reverse=remainder+reverse;
	n=n/10;
	i+=1;
};







cout<<reverse;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
using namespace std;
int main()
{
int n,r,m=0,x=1,p=10,q=1,i;
cin>>n;
while (n>=p)
{x=x+1;
p=p*10;}
for(i=1;i<=x;i++)
{
r=n/p;
m+=10*r*q;
q=q*10;
p=p/10;
n-=r*q;}
cout<<m;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

int main(){
int n,a,x,m=0,y=1;
cin>>n;
while(n/y>=10) y=y*10;
a=y;
for(int i=0;i<log(a)/log(10)+1;i=i+1)
{x=(n/y)%10;
 m=m+x*pow(10,i);
 y=y/10;
}
cout<<m;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<simplecpp>
main_program{ 
int n,r;cin>>n;
	while(n>0){ 
	r=n%10;
    if(r==0){ n=n/10; continue;}
	else { 
	while(n>0){
		cout<<r;
		n=n/10;
		r=n%10;
	    }
	}
	}
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

int main() {
  int n,a=0,n1;
    cin>>n;
	if(n>0){
		while(n!=0){
		 n1=n%10;
   		 n=n/10;
   		 a=a*10+n1;
   		 }
		 cout<<a;
		}

}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int N;
cin>>N;
int temp=N;
int sum=0;
int i;
int temp1=N;
for( i=1;temp/10!=0;i++)
{
temp=temp/10;}

for(int j=1;j<=i;j++){
int k=temp1%10;
sum=sum+(k*pow(10,i-j));
temp1=(temp1-k)/10;
}
cout<<sum;}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,r,rev=0,a=n;
cin>>n;
while(n>0)
{
	r=n%10;

	rev=rev*10+r;
	n=n/10;}
cout<<rev;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main()
{	int n,d,p=0;
	cin>>n;
	for(int m=n;m>0 ; m/=10)
	{	int d=m%10;
		p=p*10+d;
	}
	cout<<p;
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

int main(){

int n;
cin>>n;
int m=0;
while(n){
m=10*m+n%10;
n=n/10;
}
cout<<m<<endl;
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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
while(n>0){
if(n%10==0){n=n/10;}
if (n%10!=0){
cout<<(n%10);
n= (n-(n%10))/10;}
}
}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

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

using namespace std;

int main() {

	int n;

	cin >> n;

	int nrev = 0, nc = n;

	int d = 0;

	while (nc > 0) {

		d++;
		nc /= 10;

	}

	for (int i = 0; i < d; i++) {

		nrev += (n % 10) * pow(10, d - i - 1);
		n /= 10;

	}

	cout << nrev;

}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
  using namespace std;
 int main(){
 int n,x,y;
 cin>>n;
  int a=n/1000;
  int b=(n/100)%10;
  int c=(n/10)%100 ;
  int d=n%10;
  cout<<d;
  if(c>0) cout<<c;
  if(b>0) cout<<b;
  if(a>0) cout<<a;







}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include<iostream>
using namespace std;
int main(){
int y=1,i,n,m,x=10;
cin>>n;
m=n%10;

while((n/10)!=0){
y++;
}
for(i=1;i<y;i++){
x=x*10;
m=m*10+((m%x)/x)*10;
}
cout<<m;

}

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 n as input from the user and prints a number m whose digits are in reverse order as compared to n. If the number ends in one or more zeroes, then those zeroes should be ignored while printing the reverse.

Student submission:
#include <simplecpp>
main_program{
int n,m,i;
cin>>n;
i=0;
bool flag1;
m=n;
while(n>0){
flag1 = m%10==i;
if(!flag1) break;
m=m/10;}

n=m;
for(i=n;i>0;i=i/10){
int a;
a= n%10;
cout<<a;
n=n/10;};
}

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