#include <bits/stdc++.h>
 
using namespace std;
 
const int N = 1024;

//---------------------------------------------------------------------------
// An update to shuffle the random samples using algorithm::random_shuffle()

const int M=3;

int random_sample[M][N*N]; 

inline void shuffle_matrix(int p)
{
    for(int i = 0; i < p; ++i)
    	for(int r = rand(), m = 0; m < M; ++m)
    		random_sample[m][i] = r;
    	
    random_shuffle(random_sample[1],random_sample[1]+p);
}

using bits   = bitset<N>; 
using matrix =   bits[N]; 
//---------------------------------------------------------------------------

int GetRank(matrix a[], int m, int n) 
{
	bits used;
	
	for (int pivot, row, col = 0; col < n; ++col) 
	{
    	for (pivot = -1, row = 0; row < n; ++row) 
    		if (!used[row] && a[m][row][col]) 
    		{
        		pivot = row; break;
    		}
   
    	if (pivot != -1) 
    		for(used[pivot] = true, row = 0; row < n; ++row)
    			if (row != pivot and a[m][row][col]) 
    				a[m][row] ^= a[m][pivot];
	}
	
	return used.count();
}
 
matrix a[M]; map<int,int> rank_reduction[M];

inline void generate_bit_matrix(int n)
{
    for (int k = 0, i = 0; i < n; ++i) 
    	for (int j = 0; j < n; ++j, ++k) 
        	a[0][i][j] = random_sample[0][k] % 1000007 % 2,
        	a[1][i][j] = random_sample[1][k] & 1,
        	a[2][i][j] = random_sample[2][k] & 1;
}

inline void compute_rank(int m, int n)
{
	int p = GetRank(a,m,n), q = n-p;
	
	rank_reduction[m][q]++;
}

int main() 
{
	int l, r; 
	
	cin >> l >> r, assert(l >= 1 and l <= r and r <= N), srand(time(NULL));
	
	for (int n = l; n < r; n++)
		shuffle_matrix(n*n),
		generate_bit_matrix(n),
		compute_rank(0,n),
		compute_rank(1,n),
		compute_rank(2,n);
		
	const string method[] = 
		{ "With % operator", "With random_shuffle", "Original" };
		
	cout << "rank_reduction(order-rank) summary:" << endl;
	
	for(int m = 0; m < M; ++m)
	{	
		cout << method[m] << endl; 
		
		for(auto p: rank_reduction[m])
			cout << p.first << ' ' << p.second << endl; 
	}
}
