stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#ifndef ___Class_RMQ

#define ___Class_RMQ



#include <vector>

#include <algorithm>



template <typename Type, class Calculate> class RMQ

{

private:



	int size;



	std::vector<Type> value;



	Type _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l) { return val; }

		if (a <= l && r <= b) { return value[k]; }



		Type vl = _query(a, b, 2 * k, l, (l + r) / 2);

		Type vr = _query(a, b, 2 * k + 1, (l + r) / 2, r);



		return Calculate()(vl, vr);

	}



public:



	Type val;



	RMQ(int size_, int val_) : val(val_)

	{

		for (size = 1; size < size_;) { size <<= 1; }



		value = std::vector<Type>(size * 2, val);

	}



	void update(int i, const Type& x)

	{

		i += size; value[i] += x;



		while (i > 1) { i = i / 2; value[i] = Calculate()(value[2 * i], value[2 * i + 1]); }

	}



	Type query(int s, int t) { return _query(s, t, 1, 0, size); }

};



#endif





// ------ main ------ //



#include <cstdio>

#include <functional>



#pragma warning(disable: 4996)



int n, q, com, x, y;



int main()

{

	scanf("%d", &n);

	scanf("%d", &q);



	RMQ<long long, std::plus<long long> > r(n, 0);



	for (int i = 0; i < q; i++)

	{

		scanf("%d", &com);

		scanf("%d", &x);

		scanf("%d", &y);



		if (com == 0)

		{

			r.update(x - 1, y);

		}

		if (com == 1)

		{

			printf("%lld\n", r.query(x - 1, y));

		}

	}



	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 4.809821588016339x):
#include <stdio.h>

 

int n, q, com, x, y, bit[131073];

 

void add(int i, int c)

{

    if(c == 0) return;

    

    while(i <= n)

    {

        bit[i] += c;

         

        i += i & -i;

    }

}

 

int sum(int i)

{

    int ret = 0;

     

    while(i > 0)

    {

        ret += bit[i];

         

        i -= i & -i;

    }

     

    return ret;

}

 

int main()

{

    scanf("%d", &n);

    scanf("%d", &q);

     

    for(int i = 0; i < q; i++)

    {

        scanf("%d", &com);

        scanf("%d", &x);

        scanf("%d", &y);

         

        if(com == 0)

        {

            add(x, y);

        }

        else

        {

            printf("%d\n", sum(y) - sum(x - 1));

        }

    }

     

    return 0;

}
// Slower C++ solution:
#include <algorithm>

#include <array>

#include <iomanip>

#include <iostream>

#include <map>

#include <numeric>

#include <utility>

#include <vector>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)

#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)

#define REP(i,n) for (int i=0;i<(n);i++)

#define RREP(i,n) for (int i=(n)-1;i>=0;i--)



using namespace std;



template<typename T, int size>

class Bit {

  public:

    Bit(T z): zero(z) {

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

        bit[i] = zero;

      }

    }



    T sum(int k) const {

      T s = zero;

      for (int i = k; i > 0; i -= i&(-i)) {

        s += bit[i];

      }

      return s;

    }



    // [l,r)

    T sum(int l, int r) const {

      return sum(r-1) - sum(l-1);

    }



    void add(int k, T x) {

      for (int i = k; i <= N; i += i&(-i)) {

        bit[i] += x;

      }

    }



  private:

    int const N = size;

    T const zero;

    std::array<T, size+1> bit;

};



int main() {

  Bit<int, 100100> bit(0);

  int N, Q;

  cin >> N >> Q;

  REP(i, Q) {

    int COM, X, Y;

    cin >> COM >> X >> Y;

    if (COM) {

      cout << bit.sum(X, Y+1) << endl;

    } else {

      bit.add(X, Y);

    }

  }

  return 0;

}




// Faster C++ solution for the same problem (measured speedup: 1.3884515111262494x):
#include <algorithm>

#include <array>

#include <iomanip>

#include <iostream>

#include <map>

#include <numeric>

#include <utility>

#include <vector>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)

#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)

#define REP(i,n) for (int i=0;i<(n);i++)

#define RREP(i,n) for (int i=(n)-1;i>=0;i--)



using namespace std;



template<typename T>

class Bit {

  public:

    Bit(int size, T z): N(size), zero(z), bit(size+1, z) {

    }



    // [1,k]

    T sum(int k) const {

      T s = zero;

      for (int i = k; i > 0; i -= i&(-i)) {

        s += bit[i];

      }

      return s;

    }



    // [l,r)

    T sum(int l, int r) const {

      return sum(r-1) - sum(l-1);

    }



    void add(int k, T x) {

      for (int i = k; i <= N; i += i&(-i)) {

        bit[i] += x;

      }

    }



  private:

    int const N;

    T const zero;

    std::vector<T> bit;

};



int main() {

  int N, Q;

  cin >> N >> Q;

  Bit<int> bit(N, 0);

  REP(i, Q) {

    int COM, X, Y;

    cin >> COM >> X >> Y;

    if (COM) {

      cout << bit.sum(X, Y+1) << endl;

    } else {

      bit.add(X, Y);

    }

  }

  return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3861299420168314x):
#include<bits/stdc++.h>

using namespace std;

#define int long long

struct BIT{

  vector<int> bit;

  int n;

  //1-indexed

  BIT(){init();}

  BIT(int n):n(n){init();}

  void init(){

    bit.clear();

    bit.resize(n+1,0);

  }

  int sum(int i){

    int s=0;

    while(i>0){

      s+=bit[i];

      i-=i&-i;

    }

    return s;

  }

  void add(int i,int x){

    while(i<=n){

      bit[i]+=x;

      i+=i&-i;

    }

  }

  int sum0(int i){

    return sum(i+1);

  }

  void add0(int i,int x){

    add(i+1,x);

  }

};

signed main(){

  int n,q;

  cin>>n>>q;

  BIT bit(n);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.sum(y)-bit.sum(x-1)<<endl;

    else bit.add(x,y);

  }

  return 0;

}

/*

verified on 2017/04/22

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

 */
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3849390746983516x):
#include<bits/stdc++.h>

using namespace std;

#define int long long

//BEGIN CUT HERE

template<typename T> 

struct BIT{

  vector<T> bit;

  int n;

  //1-indexed

  BIT(){init(-1,(T)0);}

  BIT(int n_,T d){init(n_,d);}

  void init(int n_,T d){

    n=n_;

    bit.clear();

    bit.resize(n+1,d);

  }

  T sum(int i){

    T s=0;

    for(int x=i;x>0;x-=(x&-x))

      s+=bit[x];

    return s;

  }

  void add(int i,T a){

    if(i==0) return;

    for(int x=i;x<=n;x+=(x&-x))

      bit[x]+=a;

  }

  T sum0(int i){

    return sum(i+1);

  }

  void add0(int i,T a){

    add(i+1,a);

  }

};

//END CUT HERE



signed main(){

  int n,q;

  cin>>n>>q;

  BIT<int> bit(n+100,0);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.sum(y)-bit.sum(x-1)<<endl;

    else bit.add(x,y);

  }

  return 0;

}

/*

verified on 2017/09/22

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

 */
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3850506407204717x):
#include<bits/stdc++.h>

using namespace std;

using Int = long long;

//BEGIN CUT HERE

template<typename T> 

struct BIT{

  int n;

  vector<T> bit;

  //1-indexed

  BIT():n(-1){}

  BIT(int n_,T d):n(n_),bit(n_+1,d){}

  

  T sum(int i){

    T s=0;

    for(int x=i;x>0;x-=(x&-x))

      s+=bit[x];

    return s;

  }

  void add(int i,T a){

    if(i==0) return;

    for(int x=i;x<=n;x+=(x&-x))

      bit[x]+=a;

  }

  

  int lower_bound(int w){

    if(w<=0) return 0;

    int x=0,r=1;

    while(r<n) r<<=1;

    for(int k=r;k>0;k>>=1){

      if(x+k<=n&&bit[x+k]<w){

	w-=bit[x+k];

	x+=k;

      }

    }

    return x+1;

  }

  

  T sum0(int i){

    return sum(i+1);

  }

  void add0(int i,T a){

    add(i+1,a);

  }

};

//END CUT HERE



signed main(){

  int n,q;

  cin>>n>>q;

  BIT<int> bit(n+100,0);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.sum(y)-bit.sum(x-1)<<endl;

    else bit.add(x,y);

  }

  return 0;

}

/*

verified on 2017/10/29

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

 */
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3851776395887372x):
#include<bits/stdc++.h>

using namespace std;

using Int = long long;

//BEGIN CUT HERE

template<typename T> 

struct BIT{

  int n;

  vector<T> bit;

  //1-indexed

  BIT():n(-1){}

  BIT(int n_,T d):n(n_),bit(n_+1,d){}

  

  T sum(int i){

    T s=0;

    for(int x=i;x>0;x-=(x&-x))

      s+=bit[x];

    return s;

  }

  void add(int i,T a){

    if(i==0) return;

    for(int x=i;x<=n;x+=(x&-x))

      bit[x]+=a;

  }

  

  int lower_bound(int w){

    if(w<=0) return 0;

    int x=0,r=1;

    while(r<n) r<<=1;

    for(int k=r;k>0;k>>=1){

      if(x+k<=n&&bit[x+k]<w){

	w-=bit[x+k];

	x+=k;

      }

    }

    return x+1;

  }

  

  T sum0(int i){

    return sum(i+1);

  }

  void add0(int i,T a){

    add(i+1,a);

  }



  T query(int l,int r){

    return sum(r-1)-sum(l-1);

  }



  T query0(int l,int r){

    return sum(r)-sum(l);

  }

};

//END CUT HERE



signed AOJ_DSL2B(){

  int n,q;

  cin>>n>>q;

  BIT<Int> bit(n+100,0);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.query(x,y+1)<<endl;

    else bit.add(x,y);

  }

  return 0;

}

/*

  verified on 2017/12/31

  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

*/



// lower_bound

signed ARC033_C(){

  int q;

  cin>>q;

  BIT<int> bit(2e5,0);

  while(q--){

    int t,x;

    cin>>t>>x;

    if(t==1) bit.add(x,1);

    if(t==2){

      int k=bit.lower_bound(x);

      bit.add(k,-1);

      cout<<k<<endl;

    }

  }

  return 0;

}

/*

  verified on 2017/12/31

  https://beta.atcoder.jp/contests/arc033/tasks/arc033_3

*/



signed main(){

  AOJ_DSL2B();

  //ARC033_C();

  return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3769908449185932x):
#include<bits/stdc++.h>

using namespace std;

using Int = long long;

//BEGIN CUT HERE

template<typename T> 

struct BIT{

  int n;

  vector<T> bit;

  //1-indexed

  BIT():n(-1){}

  BIT(int n,T d):n(n),bit(n+1,d){}

  

  T sum(int i){

    T s=0;

    for(int x=i;x>0;x-=(x&-x))

      s+=bit[x];

    return s;

  }

  void add(int i,T a){

    if(i==0) return;

    for(int x=i;x<=n;x+=(x&-x))

      bit[x]+=a;

  }

  

  T query(int l,int r){

    return sum(r-1)-sum(l-1);

  }



  void rebuild(){

    vector<T> prev(bit);

    vector<T> dump(n+1);

    for(int i=1;i<=n;i++) dump[i]=query(i,i+1);

    bit.assign(n+1,0);

    

    for(int i=1;i<=n;i++){

      bit[i]+=dump[i];

      if(i+(i&-i)<=n) bit[i+(i&-i)]+=bit[i];

    }

    for(int i=1;i<=n;i++) assert(prev[i]==bit[i]);

  }

};

//END CUT HERE



signed AOJ_DSL2B(){

  int n,q;

  cin>>n>>q;

  BIT<Int> bit(n+100,0);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.query(x,y+1)<<endl;

    else bit.add(x,y);

    if(i%1000==0) bit.rebuild();

  }

  return 0;

}

/*

  verified on 2018/05/18

  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

*/



signed main(){

  AOJ_DSL2B();

  return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int bit[100000+1],n;

int sum(int i){

  int s=0;

  while(i>0){

    s+=bit[i];

    i-=i&-i;

  }

  return s;

}

void add(int i,int x){

  while(i<=n){

    bit[i]+=x;

    i+=i&-i;

  }

}

int main(){

  int q;

  cin >> n>>q;

  fill(bit,bit+100000+1,0);

  int a,b,c;

  while(q--){

    cin >> a >> b >> c;

    if(a==0) add(b,c);

    else{

      if(b==0) cout << sum(c) << endl;

      else cout << sum(c)-sum(b-1)<<endl;

    }

  }

}

// Faster C++ solution for the same problem (measured speedup: 1.3851871658491433x):
#include<bits/stdc++.h>

using namespace std;

using Int = long long;

//BEGIN CUT HERE

template<typename T> 

struct BIT{

  int n;

  vector<T> bit;

  //1-indexed

  BIT():n(-1){}

  BIT(int n_,T d):n(n_),bit(n_+1,d){}

  

  T sum(int i){

    T s=bit[0];

    for(int x=i;x>0;x-=(x&-x))

      s+=bit[x];

    return s;

  }

  void add(int i,T a){

    if(i==0) return;

    for(int x=i;x<=n;x+=(x&-x))

      bit[x]+=a;

  }

  

  int lower_bound(int w){

    if(w<=0) return 0;

    int x=0,r=1;

    while(r<n) r<<=1;

    for(int k=r;k>0;k>>=1){

      if(x+k<=n&&bit[x+k]<w){

	w-=bit[x+k];

	x+=k;

      }

    }

    return x+1;

  }

  

  T sum0(int i){

    return sum(i+1);

  }

  void add0(int i,T a){

    add(i+1,a);

  }



  T query(int l,int r){

    return sum(r-1)-sum(l-1);

  }



  T query0(int l,int r){

    return sum(r)-sum(l);

  }

};

//END CUT HERE



signed AOJ_DSL2B(){

  int n,q;

  cin>>n>>q;

  BIT<Int> bit(n+100,0);

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

    int c,x,y;

    cin>>c>>x>>y;

    if(c) cout<<bit.query(x,y+1)<<endl;

    else bit.add(x,y);

  }

  return 0;

}

/*

  verified on 2018/05/18

  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp

*/



// lower_bound

signed ARC033_C(){

  int q;

  cin>>q;

  BIT<int> bit(2e5,0);

  while(q--){

    int t,x;

    cin>>t>>x;

    if(t==1) bit.add(x,1);

    if(t==2){

      int k=bit.lower_bound(x);

      bit.add(k,-1);

      cout<<k<<endl;

    }

  }

  return 0;

}

/*

  verified on 2017/12/31

  https://beta.atcoder.jp/contests/arc033/tasks/arc033_3

*/



signed main(){

  AOJ_DSL2B();

  //ARC033_C();

  return 0;

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<algorithm>

#include<iomanip>

#include<cstring>

#include<cmath>

#include<cstring>

#include<string>

#include<vector>

#include<map>

using namespace std;



int main(){

	int m,n;

	while(cin>>m>>n){

		cout<<(m-1)*(n-1)<<endl;

	}

	return 0;



}



	





		



	











		



	






// Faster C++ solution for the same problem (measured speedup: 5.267356038829462x):
#include<stdio.h>

using namespace std;

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    printf("%d\n",(a-1)*(b-1));

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int main()

{

	int n,m;

	while(cin>>n>>m)

	{

		cout<<(n-1)*(m-1)<<endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.267356038829462x):
#include<stdio.h>

using namespace std;

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    printf("%d\n",(a-1)*(b-1));

    return 0;

}
// Slower C++ solution:
#include <iostream>

using namespace std;



int n, m;



int main() {

	ios::sync_with_stdio(false);

	while (cin >> n >> m) {

		cout << (n - 1) * (m - 1) << endl;

	}

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.325723929126808x):
#include<stdio.h>

using namespace std;

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    printf("%d\n",(a-1)*(b-1));

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

    int a,b;

    cin>>a>>b;

    cout<<(a-1)*(b-1);

}

// Faster C++ solution for the same problem (measured speedup: 5.318056141407306x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

int main()

{

    int a,b;

    scanf("%d%d",&a,&b);

    printf("%d",(a-1)*(b-1));

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.258742936863647x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



int main()

{

	int a,b;

	cin>>a>>b;

	cout<<(a-1)*(b-1)<<endl; 

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.327146738846914x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n,m;

    scanf("%d%d",&n,&m);

    printf("%d",(n-1)*(m-1));

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.258742936863647x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n;

int m;

int main()

{

    cin>>n>>m;

    cout<<(n-1)*(m-1);

    cout<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.327298770481419x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

    cout<<(a-1)*(b-1)<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.327146738846914x):
#include<stdio.h>

template<typename TYPE>

inline void read(TYPE&x){

	x=0;int w=1;register char c=getchar();for(;c<'0'||c>'9';c=getchar()) if (c=='-') w=-1;

	for(;c>='0'&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=getchar());x*=w;

}

int n,m;

int main(){

	read(n);read(m);

	return printf("%d\n",(n-1)*(m-1)),0;

}
// Slower C++ solution:
#include <iostream>

#define max(a,b) ((a)>(b)?(a):(b))

#define min(a,b) ((a)<(b)?(a):(b))

using namespace std;

typedef long long LL;

typedef pair<int, int> pii;

const int INF = 0x3f3f3f3f;



int main()

{

    //freopen("test.txt", "r", stdin);

    int n, m;

    while(cin >> n >> m){

        cout << (n - 1) * (m - 1) << endl;

    }

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.274361885662887x):
#include<stdio.h>



int main()

{

	int a,b;

	scanf("%d %d",&a,&b);

	printf("%d",(a-1)*(b-1));

	return 0;

}
// Slower C++ solution:
// K-city.cpp

#include <iostream>

using namespace std;



int main(){

	int n,m;

	cin >> n >> m;

	cout << (n-1)*(m-1);

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.261148384623325x):
#include<stdio.h>



int main()

{

	int a,b;

	scanf("%d %d",&a,&b);

	printf("%d",(a-1)*(b-1));

	return 0;

}
// Slower C++ solution:
#include<stdio.h>

#include<iostream>

#include<math.h>

#include<stdlib.h>

using namespace std;





int main(){

    int a,b;

    cin>>a>>b;

    a--;

    b--;

    cout<<a*b;



    return 0;



}


// Faster C++ solution for the same problem (measured speedup: 5.220770603241076x):
#include<stdio.h>



int main()

{

	int a,b;

	scanf("%d %d",&a,&b);

	printf("%d",(a-1)*(b-1));

	return 0;

}
// Slower C++ solution:
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

 

int main(){

    int N;

    cin >> N;

    vector<int> A(N);

    for (int i = 0; i < N; i++)

    {

        cin >> A[i];

    }

 

    long long ans = 0;

    int MaxNum = 0;

    for (int i = 0; i < N; i++)

    {

        //MaxNumを使い回すことで計算を抑える

        MaxNum = max(MaxNum, A[i]);

        ans += MaxNum - A[i];

    }

 

    cout << ans << endl;

}

// Faster C++ solution for the same problem (measured speedup: 4.399597966672105x):
#include <stdio.h>



int main()

{

	long long int a[2*100000+10];

	int i=0,n,max=-1;

	long long int cou=0;

	

	scanf("%d",&n);

	

	for(i=0;i<n;i++){

		scanf("%lld",&a[i]);

	}

	

	for(i=0;i<n;i++){

		max=(max>a[i])?max:a[i];

		cou+=max-a[i];

	}

	

	printf("%lld",cou);	

}
// Slower C++ solution:
#include<iostream>



using namespace std;



long long int cclt(long long int n);

long long int c(long long int n);



int main()

{

    long long int n;

    cin>>n;

    long long int rst=0;

    rst=cclt(n);

    cout<<rst<<endl;

    return 0;

}



long long int cclt(long long int n)

{

    if(n==0)

    {

        return 0;

    }

    long long int rst=0,f=1;

    while(n/f>0)

    {

        rst+=cclt(n%f)+(n/f)*c(n%f);

        f*=10;

    }

    return rst;

}



long long int c(long long int n)

{

    int t=1;

    while(n/10>0)

    {

        t*=2;

        n/=10;

    }

    return t;

}

// Faster C++ solution for the same problem (measured speedup: 5.275197407336468x):
#include<stdio.h>

#include<algorithm>

#include<string.h>

using namespace std ;

#define N 15

int main()

{

    int n,m=1,i,j;

    char x[15];

    long long sum=0,a;

    scanf("%s",x);

    n=strlen(x);

    for(i=0;i<n-1;i++)

    {

        m=m*2;

    }

    for(i=0;i<m;i++)

    {

        a=x[0]-'0';

        for(j=0;j<n;j++)

        {

            if(j==n-1||i&1<<j)

            {

            sum=sum+a;

            a=0;

            if(j==n-1) break;

            }

            a=a*10;

            a=a+x[j+1]-'0';

        }

    }

    printf("%lld",sum);

    return 0;

}