Help me in solving SMXR problem

My issue

CAN U PLEASE EXPLAIN ME HOW TO SOLVE THIS PROBLEM
I AM NOT GETTING THE APPROACH TO SOLVE IT

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int T;
	cin>>T;
	while(T--)
	{
	    int N;
	    int M;
	    cin>>N>>M;
	    long long sum = (long long) N * M * (N * M + 1)/2;
	    cout<<sum<<endl;
	}
	return 0;
}

Problem Link: Sum of Xors Practice Coding Problem

The editorial is out. Check it.

1 Like