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 pow(int m,int n){
int i,z=1;
  for(i=1;i<=n;i++){
  z=z*m;
  }
return z;
}
int numdigits(int N){
int i,r;
  for(i=1;i>0;i++){
  r=(N%pow(10,i));
  if(r==N){break;}
  }
return i;
}
int p(int N,int p){
int l=(N%pow(10,p)-N%pow(10,p-1))/pow(10,p-1);
return l;
}
int main(void){
int N,k,i,j;
cin>>N;
k=numdigits(N);
  for (i=1;i<=k;i++){
  if(p(N,i)==0){continue;}
  else if(p(N,i)!=0){break;}
  }
if(i==k+1){cout<<0;}
else{
for(j=i;j<=k;j++){
cout<<p(N,j);
}
}
}

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 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 int n;
cin>>n;
int z=0;
while(1){
int k=n%10;
z=z*10+k;
n/=10;
if(n==0) break;
}
cout<<z;
}

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 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 T;
cin>>T;
int k;
k=T%10;
if (k==0)T=T/10;
else {cout<<k;
      T=T-k;
      T=T/10;}
while(T>0){
k=T%10;
cout<<k;
T=T-k;
T=T/10;}
return 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 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>0){
		if(n%10!=0){break;}
		n=n/10;
	}
	while(n>0){
		cout<<n%10;
		n=n/10;
	}
}

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 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 int n = 0;

	cin >> n;
	for (int x = 0; n != 0;){
		if (n%10 != 0 || x != 0){
			cout << n%10;
			x++;
		}
		n = n/10;
	}

	return 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 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 r=0;
int m=0;
if (n==0) {
cout<<"0";
}
while(n!=0){
r=n%10;
n=n/10;
m=(m*10)+r;
}
cout<<m;
}

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 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, reverse_num=0;
	cin>>n;
	while(n !=0){
		reverse_num = 10*reverse_num + (n%10);//adds the last digit of updated no. to reverse_num 
		n=n/10;
	}
	cout<<reverse_num;
}

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 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, digit;
cin >> n;
while (n%10!=0){
digit=n%10;
rev=rev*10+digit;
n=n/10;
}
cout << rev;
}

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: 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 n;cin>>n;
while(n%10==0)n=n/10;
while(n/10!=0){
cout<<n%10;
n=n/10;


}
cout<<n%10;
}

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: 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 n,x;
cin>>n;
while(n>0)
{
x=n%10;
n=(n-x)/10;
cout<<x;
}
}

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 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,m=0;
cin >> n;
float val1=n;
int val2=n,dig=0,temp;
do { dig+=1;
     val1=val1/10;}while(val1>=1);
for (int i=1;i<=dig;i++){
 temp=val2%10;
 if (temp!=0){
            for(int j=1;j<=(dig-i);j++){temp=temp*10;}
            m=m+temp;}
 val2=int(val2/10);
 }
cout << m;





}

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 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 ;
	do  {
	if (n%10!=0) break ;
	n=(n-n%10)/10;
	}
	while (n%10==0);
int x=0;
	do {
	int a=n%10 ;
	n=(n-a)/10 ;
	x=x*10+a;
	}
	while (n!=0) ;
	cout << x;
	return 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 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,i;
cin>>n;
while(n/10!=0){
i=n%10;

n=n/10;
if(i!=0)
cout<<i;
}

cout<<n;
}

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 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 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: 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>
#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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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: 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>
#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 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 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 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 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 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