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(){
long long int n,cn,rev=0,d;
cin>>n;



if(n/10!=0){
cn=n;
rev=0;
while(cn>0){
d=cn%10;
rev=rev*10+d;
cn=cn/10;
//cout<<rev<<endl;
}
cout<<rev;}
else if(n/10==0){
cout<<n;}
return 0;}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,b,c;
int ans=0;
cin>>n;
while (n!=0){
c=n/10;
b=n-c*10;
ans=ans*10+b;
n=c;
}
cout<<ans;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 m=0,n,d;
cin>>n;
while (n!=0)
{
 d=n%10;
 m=10*m+d;
 n=n/10;
 }
 cout<<m;
 return 0;
 }

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,b=0,rem=0;
	cin>>n;
	while(n>0){
		rem =n%10;
		b=(b*10)+rem;
		n/=10;}
	cout<<b;}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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, m=0, remainder;
 cin >> n;
 while (n >= 1)
  {
    remainder = n%10;
    n = (n-remainder)/10;
    m = (m + remainder)*10;
 }
cout << m/10;
return 0;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 int n,a,b;
	cin>>n;
	b=0;
	while(n!=0)
	{
		a=n%10;
		n=n/10;
		b=b*10+a;
	}
	cout<<b;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,m,rev;
	cin >> n;
	m = n;
	rev = 0;
	while(m > 0){
		rev = 10*rev + (m%10);
		m = (m - (m%10))/10;
	}
	cout << rev;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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, m=0;
	cin>>n;
	while(n>0){
		int rem=n%10;
		m*=10;
		m+=rem;
		n/=10;
	}
	cout<<m<<endl;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 a,b,c,d,n,i;
cin>>n;
 
a = n%10;
n=n/10;

while(n>0){
b=n%10;
a=10*a+b;
n=n/10;

}
cout<<a;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 ,digit ;
    cin >> n;
    int num = n;
    int a1 = n , a2;
    int i = 0;
    int num2 = 0 ;
    while (num!=0)
    {
        digit= num%10;
        num = num/10;
        i++;
    }

    float j=i-1;
    // cout << i;
    while (a1 != 0)
    {
        a2=a1%10; // a2 is digit
        a1=a1/10;
       float k=a2*pow(10,j);
        num2 = num2 + k;
        j--;
       // cout << num2 << endl;

    }

    cout << num2;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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, count=0,m=0;
   cin>>n;
   
   while(n>0){
   if (n%10 == 0){ n=n/10; continue; }
   if(n%10 != 0){ break; }}
  
  while(n>0){
     m=m*10+(n%10);
   n=n/10; }

  cout<<m;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,x,m;
x=1;
cin>>n;
m=pow(10,x);
while((n%m)<=9 && (n%m)>=0)
{if (n%m!=0) {cout<<n%m;}
else {continue;}
x++;}}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,i,d=0,p,m;
cin>>n;
while(n%10==0)n=n/10;
do{
m=n%10; cout<<m;
n=n/10;
}while(n>0);

}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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:
//number reversal
//22B1068
//27/11/22 11.30 - 1.30 B group

#include <iostream>
using namespace std;

int main(){
	unsigned int n, m = 0;	  //unsigned coz they're given positive, so why not :)
	cin >> n;

	while(n > 0){
		m = m * 10 + n % 10;  //essentially, take leftmost digit of n and stack it in m
		n = n / 10; 		  // remove leftmost digit of n, now 2nd leftmost becomes the leftmost. later it will be added to m
	}						  // on the left of the previous digit, hence reversing the order.
	
	cout << m;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,d,c=0,num=0,cop;
cin>>n;
cop=n;
while(cop>0)
{
c++;
cop=cop/10;
}
while(n>0)
{
d=n%10;
num+=d*pow(10,c-1);
c--;
n=n/10;
}
cout<<num;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 r, n; cin>>n;
while (n%10==0) (n=n/10);
while (n!=0)
{
r=n%10;
n=n/10;
cout<<r;
}
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,m=0,a,i=0,b=0,p,q=1,x=1;
	cin>>n;
while(n%10==0){
n=n/10;}
p=n;
	while(n%10!=0){
		a=n%10;
		n=n/10;
		i++;
}
		
while(p%10!=0){
b=p%10;
while(x<i){
q*=10;
x++;

}x=1;
m+=b*q;
q=1;
i--;p=p/10;
}cout<<m;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,k;
cin>>n;   
      {
       while(n>0)
         {
           k=n%10; 
         if(k>0)
         { cout<<k;}
          n=n/10;
         }
      }

}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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=0, div=0, num=0;
	cin>>n;
	while(n>0) {
	div=n%10;
	num=num*10 + div;
	n=n/10;
	}
	cout<<num;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 i=0;
while(n>0){
int rem=n%10;
i=i*10+rem;
}
cout<<i;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 m,n;
	m=0;
	cin >> n;
  while(n!=0)
  {
	m=m*10+n%10;
	n=n/10;
}
	
	cout <<m;
	
	
	
	
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,q;
cin>>n;
if(n%1000==0) cout<<n/1000;
else if(n%100==0) n=n/100;
else if(n%10==0) n=n/10;
while(n!=0)
{
q=n%10;
n=n/10;
cout<<q;}
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,k,b=10;
	cin>>n;
	for(int i=0;i<n;b=b*10)
	{
		k=n/b;
		if(k==0) break;
	}
    b=b/10;
	int s=0;
	int z=b;
	for(int j=0;j<n;b=b/10)
	{
		int a=n/b;
		n=n-a*b;
		s=s+(a*z/b);
		if (b==1) break;
	}
	cout<<s;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 unsigned int n,m=0,d;
	cin>>n;
	while(n>0){
	
		d = n%10;
		m = m*10; m = m + d;
		n = n - d; n = n/10;
	
	}
	
	cout<<m;

return 0;}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,sum=0,m;cin>>n;
while(n>=1)
{r=n%10;
sum=(sum*10)+r;
n=n/10;
}
cout<<sum;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 pow(int a, int b) {
	int result = 1;
	for (int i = 0; i < b; i++) result *= a;
	return result;
}

int getLen(int n) {
	int result = 0;
	while ((n / pow(10, result)) > 0) result++;
	return result;
}

int main() {
	int n; cin >> n;
	int m = n;
	int len = getLen(n);
	int result = 0;
// *** make sure zero case is satisfied
for (int i = 1; i <= len; i++) {
	int val = 0;
	val = m / pow(10, i-1);
	val -= 10*(m / pow(10, i));
	result += val * pow (10, len - i);
}
cout << result << endl;
return 0;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,num=0;
cin>>n;
int remainder;
for(int i=1;1<=n;i++){
remainder=n%10;
n/=10;
num=num*10;
num+=remainder;
}
cout<<num;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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, num; cin>>n; num=n;
while(n)
{
m*=10;
m+=(n%10);
n/=10;
}
cout<<m;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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>
#include <iomanip>
using namespace std;

int main(){
	
	unsigned long long n; cin>>n; 
	unsigned long long ans = 0;

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

	cout<<ans;



	return 0;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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,rev;
 rev = 0;
 cin>>n;
 //First we try to find the number  of digits of  n
 int i = 0;
 int temp = n;
 while(temp!=0)
      {
       i++;
       temp= temp/10;
      }
// Now, we just take every digit of n and multiply it by a suitable power of 10 to get the reverse number
 int j = 0;
 while(n!=0)
      {
       unsigned int k = n%10;
       int l = i - j - 1;
       unsigned int m = pow(10,l);
       unsigned int p = k*m;
       rev = rev + p;
       j++;
       n=n/10;
      }
 cout<<rev;
 return 0 ;
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 numval,digit,revval=0.0;
cin >> numval;
while(numval!=0)
{
digit=numval%10;
revval=(revval*10)+digit;
numval=numval/10;
}
cout << revval;








}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 digit;
	int reverse=0;
	
	while (n>0)
	{	
		digit = n%10;
		n = n/10;
		reverse = (reverse*10)+digit;
	}
	
cout << reverse;	
	}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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(){
long int n;
cin>>n;
int digit,rev=0;
while (n!=0){
digit=n%10;
rev=(rev*10)+digit;	
n=n/10;			  
}
cout<<rev;	
}

Grading criterion: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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 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: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
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: Storing the reverse of number in a variable
Rating A: Correct output stored
Rating B: No output or wrong output stored
Rating C: 0
Rating D: 0
Assigned grade: A