stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int main() {

  int a, b, c, d, i;

  cin >> a >> b;

  int A[114514] = {};

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

    cin >> c >> d;

    A[d]++;

    A[c]++;

  }

  for(i=1;i<=a;i++) {

    cout << A[i] << endl;

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

int main() {

  int a, b, i, c;

  cin >> a >> b;

  vector<int> way(a);

  for(i=0;i<2*b;i++) {

    cin >> c;

    way.at(c-1)++;

  }

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

    cout << way.at(i) << endl;

  }

  return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#include<vector>

     

using namespace std;

     

const int MAXN = 3e5 + 10;

     

vector <int> adj[MAXN];

     

int main() {

    int n, m;

    cin >> n >> m;

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

        int v,u;

        cin >> v >> u ;

		v--;

		u--;

        adj[v].push_back(u);

		adj[u].push_back(v);

    }

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

		cout << adj[i].size() << endl;

	}

}

// Optimized solution to the same problem (faster):
#include<iostream>

using namespace std;

int m,n,a[1001];

int main(){

	cin>>m>>n;

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

   int x,y;

		cin>>x>>y;

		a[x]++;

		a[y]++;

	}

	for(int i=1;i<=m;i++)cout<<a[i]<<endl;

	return 0; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <bits/stdc++.h>

#define pb push_back

#define ob pop_back

#define xx first

#define yy second

#define dob double

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

#define int long long int

#define ss size()

using namespace std;

const int M=1e9+7,maxn=100010;

std::vector<int> adj[maxn];

std::vector<int> v1;

int ans,n,k,m,x,y,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn];

bool mark[maxn],bpart[maxn];

string s,s1,s2;

map <string ,int> mp;

bool markchaild[maxn];

bool dfsmach(int v){

    if(v==-1) return true;

    if(mark[v]==1) return false;

    mark[v]=1;

    for(int i=0;i<adj[v].ss;i++){

        int u=adj[v][i];

        if(dfsmach(mach[u])){

            bpart[u]=((bpart[v]+1)%2);

            mach[u]=v;

            mach[v]=u;

            return true;

        }

    }

    return false;

}





int32_t main() {

    cin>>n>>m;

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

        cin>>x>>y;

        h[x]++;

        h[y]++;

    }

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

        cout<<h[i]<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <set>

using namespace std;



int a[51];

int main(){

	int n,m;

	int u,v;

	

	cin >> n >> m;

	while(m--){

		cin >> u >> v;

		a[u]++;

		a[v]++;

	}

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

		cout << a[i] << endl;

	}

} 

// Fastest known solution for this problem:
// Original C++ solution (slower):
#define _USE_MATH_DEFINES

#include<iostream>

#include<iomanip>

#include<algorithm>

#include<cctype>

#include<cmath>

#include<cstdio>

#include<deque>

#include<list>

#include<set>

#include<stack>

#include<string>

#include<sstream>

#include<map>

#include<queue>

#include<vector>

using namespace std;



int main() {

	int a[1001] = {};

	for (int i = 1; i <= 1000; i++)

		a[i] = a[i - 1] + i;



	for (int N; cin >> N&&N;) {

		int cnt = 0;

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

			for (int j = i + 2; j <= 1000; j++)

				if (a[j] - a[i] == N)

					cnt++;



		cout << cnt << endl;

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#define _USE_MATH_DEFINES

#include<iostream>

#include<iomanip>

#include<algorithm>

#include<cctype>

#include<cmath>

#include<cstdio>

#include<deque>

#include<list>

#include<set>

#include<stack>

#include<string>

#include<sstream>

#include<map>

#include<queue>

#include<vector>

using namespace std;



int main() {

	int a[1001] = {};

	for (int i = 1; i <= 1000; i++)

		a[i] = a[i - 1] + i;



	for (int N; cin >> N&&N;) {

		int cnt = 0;

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

			for (int j = i + 2; j <= 1000; j++)

				if (a[j] - a[i] > N)

					break;

				else if (a[j] - a[i] == N)

					cnt++;

		cout << cnt << endl;

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int solve(int N) {

    int ans = 0;

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

        for (int j = 1; j <= N; ++j) {

            int sum = 0;

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

                sum += j + k;

            }

            if (sum == N) {

                ++ans;

            }

        }

    }

    return ans;

}



int main() {

    while (1) {

        int N; cin >> N;

        if (N == 0) {

            break;

        }

        cout << solve(N) << endl;

    }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>



using namespace std;



int solve(int N) {

    int ans = 0;

    for (int i = 2; i <= N; ++i) { // i???

        for (int j = 1; j <= N; ++j) { // j???????§???????

            // if ( j + (j+1) + ... + (j+i-1) == N ) {

            //     ++ans;

            // }

            int sum = (2*j+i-1)*i/2;

            if (sum == N) {

                ++ans;

            }

        }

    }

    return ans;

}



int main() {

    while (1) {

        int N; cin >> N;

        if (N == 0) {

            break;

        }

        cout << solve(N) << endl;

    }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>



using namespace std;



int main()

{

    int n;

    

    while(true)

    {

        scanf("%d", &n);

        

        if(n == 0) break;

        

        int ret = 0;

        

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

        {

            for(int j = 2; j <= n / i; j++)

            {

                int sum = 0;

                

                for(int k = i; k < i + j; k++)

                {

                    sum += k;

                }

                

                if(sum == n) ret++;

            }

        }

        

        printf("%d\n", ret);

    }

    

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

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

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

				if(sum > n) break;

			}

		}

		printf("%d\n", ret);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

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

			for(int r = l + 1; r <= n; r++) {

				int sum = 0;

				for(int k = l; k <= r; k++) sum += k;

				if(sum == n) ret++;

			}

		}

		printf("%d\n", ret);

	}

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int n;

int main() {

	while(scanf("%d", &n), n) {

		int ret = 0;

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

			int sum = l;

			for(int r = l + 1; r <= n; r++) {

				sum += r;

				if(sum == n) ret++;

				if(sum > n) break;

			}

		}

		printf("%d\n", ret);

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

 

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

#define all(vec) vec.begin(),vec.end()



using namespace std;



int main(int argc, char const* argv[])

{

    while (1) {

        int N; cin >> N;

        if (!N) break;

        int ans = 0;

        loop (1001, i) loop (1001, j) if (i < j) {

            if (!i || !j) continue;

            if ((i + j) * (j - i + 1) == N * 2) ans++;

        }

        cout << ans << endl;

    }

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

 

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

#define all(vec) vec.begin(),vec.end()



using namespace std;



int main(int argc, char const* argv[])

{

    while (1) {

        int N; cin >> N;

        if (!N) break;

        int ans = 0;

        for (int i = 1; i <= 1000; i++) for (int j = i+1; j < 1000; j++) {

            if ((i + j) * (j - i + 1) == N * 2) ans++;

        }

        cout << ans << endl;

    }

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;

int n, m, k;

int main() {

	int i, j;

	cin>>n>>m>>k;

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

		if((n-i)*j + (m-j)*i == k) {cout<<"Yes"; return 0;}

	}

    cout<<"No";

    return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

int n, m, k, i, j;

int main() {

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

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

		if((n-i)*j + (m-j)*i == k) return puts("Yes"), 0;

	puts("No");

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

typedef long long ll;

int main(){

  ll n,m,k,tmp;

  bool can[1000001]={};

  cin >> n >> m >> k;

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

    for(ll j=0;j<=m;j++){

      tmp = i*m+j*n;

      tmp -= (i*j)*2;

      can[tmp]=true;

    }

  }

  if(can[k])cout <<"Yes\n";

  else cout <<"No\n";

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<vector>

#include<algorithm>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;

signed main(){

  ll n,m,k,tmp;

  bool can=false;

  cin >> n >> m >> k;

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

    for(int j=0;j<=m;j++){

      tmp = (i*m)+(j*n)-(i*j)*2;

      if(tmp==k){

        can=true;

        break;

      }

    }

  }

  if(can){

    cout <<"Yes\n";

  }else{

    cout <<"No\n";

  }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<algorithm>

using namespace std;



struct segtree{

  int n;

  int data[262143];

  segtree(int _n){

    n = 1;

    while(n<_n) n *= 2;

    fill(data,data+2*n-1,0);

  }

  void add(int i,int x){

    i += n-2;

    data[i] += x;

    while(i>0){

      i = (i-1)/2;

      data[i] += x;

    }

  }

  int getSum(int s,int t){

    return getSum(s-1,t,0,0,n);

  }

  int getSum(int a,int b,int k,int l,int r){

    if(a<=l&&r<=b) return data[k];

    else if(a>=r||b<=l) return 0;

    else{

      int vl = getSum(a,b,2*k+1,l,(l+r)/2);

      int vr = getSum(a,b,2*k+2,(l+r)/2,r);

      return vl + vr;

    }

  }

};



int main(){

  int n,q;

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

  segtree st(n);

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

    int cmd,x,y;

    scanf("%d%d%d",&cmd,&x,&y);

    if(cmd==0) st.add(x,y);

    else if(cmd==1) printf("%d\n",st.getSum(x,y));

  }

  return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int bit[100001];

int n,q;



void add(int i,int v){

	while(i<=n){

		bit[i] += v;

		i += i & -i;

	}

}



int sum(int i){

	int res = 0;

	while(i>0){

		res += bit[i];

		i -= i & -i;

	}

	return res;

}





int main(){

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

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

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

		int cmd,x,y;

		scanf("%d %d %d",&cmd,&x,&y);

		if(cmd==0){

			add(x,y);

		}else{

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

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



struct segtree {

  int id; // identity element

  vector<int> node;

  function<int(int, int)> f;

  static const int N = 1 << 18;



  segtree(int id, function<int(int, int)> f) : id(id), f(f), node(2 * N, id){}



  void init(vector<int> &v) {

    for (int i = 0; i < v.size(); ++i) {

      node[i + N - 1] = v[i];

    }

    for (int i = N - 2; i >= 0; --i) {

      node[i] = f(node[2 * i + 1], node[2 * i + 2]);

    }

  }



  int find(int a, int b, int k, int l, int r) {

    if (r <= a || b <= l) return id;

    if (a <= l && r <= b) return node[k];

    return f(

      find(a, b, 2 * k + 1, l, (l + r) / 2),

      find(a, b, 2 * k + 2, (l + r) / 2, r)

    );

  }



  int find(int a, int b) {

    return find(a, b, 0, 0, N);

  }



  void update(int k, int x) {

    k += N - 1;

    node[k] = x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }



  void add(int k, int x) {

    k += N - 1;

    node[k] += x;

    while (k) {

      k = (k - 1) / 2;

      node[k] = f(node[2 * k + 1], node[2 * k + 2]);

    }

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  segtree seg(0, [&](int a, int b) { return a + b; } );

  while (q--) {

    int f, a, b;

    cin >> f >> a >> b;



    if (f) cout << seg.find(a, b + 1) << endl;

    else seg.add(a, b);

  }

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;



struct BinaryIndexedTree {

  BinaryIndexedTree() {}

  BinaryIndexedTree(int n) : n(n), v(n + 1, 0) {}



  vector<int> v;

  int n;



  int sum(int i) {

    int ret = 0;

    while (i) {

      ret += v[i];

      i -= i & -i;

    }

    return ret;

  }



  void add(int i, int x) {

    while (i <= n) {

      v[i] += x;

      i += i & -i;

    }

  }

};



int main() {

  int n, q;

  cin >> n >> q;



  BinaryIndexedTree bit(n);

  while (q--) {

    int c, x, y;

    cin >> c >> x >> y;

    if (c) {

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

    } else {

      bit.add(x, y);

    }

  }

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}




// Optimized solution to the same problem (faster):
#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;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;



}



	





		



	











		



	






// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

using namespace std;



int main()

{

	int n,m;

	while(cin>>n>>m)

	{

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

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

using namespace std;

int main(){

    int a,b;

    cin>>a>>b;

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

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

int main()

{

    int a,b;

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

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

    return 0;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>



using namespace std;



int main()

{

	int a,b;

	cin>>a>>b;

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

	return 0;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b;

    cin>>a>>b;

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

    return 0;

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a,b;

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

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

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
// K-city.cpp

#include <iostream>

using namespace std;



int main(){

	int n,m;

	cin >> n >> m;

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

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

	int a,b;

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

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

	return 0;

}

// Fastest known solution for this problem: