akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 998244353;
#define SIZE 500000
ll inv[SIZE + 1];
ll kai[SIZE + 1];
ll invkai[SIZE + 1];
void invinit()
{
	inv[1] = 1;
	for (int i = 2; i <= SIZE; i++)
	{
		inv[i] = mod - (mod / i)*inv[mod%i] % mod;
	}
	kai[0] = invkai[0] = 1;
	for (int i = 1; i <= SIZE; i++)
	{
		kai[i] = kai[i - 1] * i%mod;
		invkai[i] = invkai[i - 1] * inv[i] % mod;
	}
}
ll com(ll a, ll b)
{
	if (b < 0 || a < b)return 0;
	return (invkai[b] * invkai[a - b]) % mod*kai[a] % mod;
}
int count(string s)
{
	int r = 0;
	for (int i = 0; i < s.size(); i++)r += s[i] - '0';
	return r;
}
ll a1[200000], a2[200000];
ll solve(int mx, int my, string a, string b, string c, string d)
{
	int s = count(a);
	int now = 0;
	bool f = true;
	for (int i = 0; i < my; i++)
	{
		if (c[i] == '1' || d[i] == '1')
		{
			a1[i] = com(now + s - 1, s - 1);
			if (s == 0 && f)a1[i] = 1, f = false;
		}
		else a1[i] = 0;
		now += c[i] - '0' + d[i] - '0';
	}
	s = count(b);
	now = 0;
	f = true;
	for (int i = my - 1; i >= 0; i--)
	{
		if (c[i] == '1' || d[i] == '1')
		{
			a2[i] = com(now + s - 1, s - 1);
			if (s == 0 && f)a2[i] = 1, f = false;
		}
		else a2[i] = 0;
		now += c[i] - '0' + d[i] - '0';
	}
	ll ret = 0;
	ll sum = 0;
	for (int i = 0; i < my; i++)
	{
		sum += a1[i];
		if (c[i] == '1'&&d[i] == '1')sum *= 2;
		sum %= mod;
		ret += sum*a2[i];
		ret %= mod;
	}
	return ret;
}
int main()
{
	int mx, my;
	scanf("%d%d", &mx, &my);
	string a, b, c, d;
	cin >> a >> b >> c >> d;
	invinit();
	if (count(a) + count(b) + count(c) + count(d) == 0)printf("1\n");
	else printf("%I64d\n", (solve(mx, my, a, b, c, d) + solve(my, mx, c, d, a, b)) % mod);
}

Measured memory_bytes: 15216
#include<bits/stdc++.h>
#include <vector>
#define endl '\n';
using namespace std;

int main()
{
    string x; cin >> x;
    int a = x.find('A');
    int z, sz = (int)x.size();
    for(int i = sz - 1 ; i > a ; --i)
    {
        if (x[i] == 'Z') { z = i; break; }
    }
    cout << z - a + 1;
    return 0;
}

Measured memory_bytes: 3724
#include"bits/stdc++.h"
#include<unordered_set>
#include<unordered_map>
#include<random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; // 998'244'353LL
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
int dx[4]={ 1,0,-1,0 };
int dy[4]={ 0,1,0,-1 };

int N;
ll A[100001];
ll sum[100002] ={};

void fin(){
    cout << -1 << endl;
    exit(0);
}

signed main(){
    cin >> N;
    rep(i, N+1) cin >> A[i];
    for(int i=N; i>=0; i--){
        sum[i] = sum[i+1] + A[i];
    }

    if(N == 0){
        if(A[0] == 1) cout << 1 << endl;
        else cout << -1 << endl;
        return 0;
    }
    if(A[0] >= 1) fin();

    ll b = 1;
    ll ans = 1;
    for(int i=1; i<=N; i++){
        if(b*2 < A[i]) fin();
        ll tmp = min(b * 2, sum[i]);
        ans += tmp;
        b = tmp - A[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 5156
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
using namespace std;

int main() {
	int P, Q, R;
	cin >> P >> Q >> R;

	vector<int> vec = { P, Q, R };
	sort(vec.begin(), vec.end());

	int ans = vec[0] + vec[1];
	cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    if (a <= 8 && b <= 8) {
      System.out.println("Yay!");
    } else {
      System.out.println(":(");
    }
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  FOR(i, 1, n + 1) FOR(j, 1, n + 1) FOR(k, 1, n + 1) {
    ll t = gcd(i, j);
    t = gcd(t, k);
    ans += t;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
int main(){

  stack <int> sa;
  string m;
  int cnt=0,result=0,high=0,tmp=0,h[20000],i;
  vector <int> amo;

  cin>>m;
  for(i=m.size()-1;i!=-1;i--){
    if(m[i]=='\\') tmp++;
    if(m[i]=='/') tmp--;
    high=max(high,tmp);
    h[i]=high;
  }

  for(i=0;i<m.size();i++){
    if(m[i]=='\\'){
      sa.push(i);
    } else if(m[i]=='/' && !sa.empty()) {
      cnt+=i-sa.top();
      sa.pop();
      if(sa.empty()){
        amo.push_back(cnt);
        result+=cnt;
        cnt=0;
      }
    }
    if(i<m.size()-1) if(h[i+1]-h[i]) sa.pop();
  }
  if(amo.empty()) cout<<"0"<<endl<<"0"<<endl;
  else{
    cout<<result<<endl<<amo.size()<<" ";
    for(i=0;i<amo.size()-1;i++) cout<<amo[i]<<" ";
    cout<<amo[amo.size()-1]<<endl;
  }
  return 0;

}

Measured memory_bytes: 3324
#include<iostream>
using namespace std;
int main()
{
          string a;
          cin>>a;
          for(int i=0;i<a.length();i++)
          {
                    if(a[i]!='z')
                    {
                    if(islower(a[i]))
                              a[i]=a[i]+1;}
          }
          cout<<a<<endl;
return 0;
}


Measured memory_bytes: 3604
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n,k=parseMap(split(readline()))
    a=parseMap(split(readline()))
    cnt=Dict{Int,Int}()
    for i in a
        if haskey(cnt,i)
            cnt[i]+=1
        else
            cnt[i]=1
        end
    end
    val=sort(collect(values(cnt)),rev=true)
    ans=0
    len=length(val)
    if len>k
        for i in k+1:len
            ans+=val[i]
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 152472
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

// UnionFind
// coding: https://youtu.be/TdR816rqc3s?t=726
// comment: https://youtu.be/TdR816rqc3s?t=6822
struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};

int main() {
    ll N;
    cin >> N;
    map<ll,vector<ll>> xmp,ymp;
    for(int i=0;i<N;i++){
        int x,y;
        cin >> x >> y;
        xmp[x].push_back(y);
        ymp[y].push_back(x);
    }
    UnionFind uf = UnionFind(int(1e5)+5);

    for(auto itr = ymp.begin();itr != ymp.end();itr++){
        vector<ll> vec = itr->second;
        for(ll v:vec){
            uf.unite(vec[0],v);
        }
    }
    map<ll,set<ll>> candidates;
    for(auto itr= xmp.begin();itr != xmp.end();++itr){
        for(ll v:itr->second){
            candidates[uf.find(itr->first)].insert(v);
        }
    }
    ll ans =0;
    for(auto itr= xmp.begin();itr != xmp.end();++itr){
        ans  += (candidates[uf.find(itr->first)].size() -(itr->second).size());
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 17484
#include <iostream>
#include <stdlib.h>
#include <utility>
#include <math.h>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cassert>
using namespace std;
#define   FOR(i,n) for(int i=0;i<n;i++)

typedef long long int lld;
typedef vector<lld> vi;

lld a,b,c,d,x,y,N;

//int arr[N]
////sort(arr,arr +N)

//vector <int> hoge
////sort(hoge.begin(),hoge.end());

int main() {
	int a,b,c,N,ans;
	char S[100],out;
	vi A(1000000);
	cin >> S;
	if(S[5]=='1'){
		cout<<"TBD";
		return 0;
	}
	if(S[6]=='4' ||S[6]=='3'||S[6]=='2'||S[6]=='1'){
		cout<<"Heisei";
		return 0;
	}
	else{
		cout<<"TBD";
		return 0;

	}



}







Measured memory_bytes: 8064
// inputに入力データ全体が入る
function Main(input) {
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var tmpSyuuhen = parseInt(input[0], 10) * 2 *3.14;
  	ans =( tmpSyuuhen ).toFixed(3);
	//出力
	console.log('%d',ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29608
#include <bits/stdc++.h>

// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */
// using mint = modint1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n, k;
  cin >> n >> k;
  ll ans = 0;
  ans = (-(n + 1) * (n + 2) * (2 * n + 3) / 6) % MOD+MOD +
        k * (k - 1) * (2 * k - 1) / 6 % MOD +
        ((n + 1) * ((n + 1) * (n + 2) / 2 - k * (k - 1) / 2)) % MOD + n - k + 2;
  cout << ans%MOD << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    cout << (1000 - n%1000) % 1000 << endl;
 }


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
const ll inf=1e18;

vector<pair<char,ll>> rle(string s) {
  vector<pair<char,ll>> res;
  char temp=s[0];
  ll count=0;
  for(ll i=0;i<s.size();i++) {
    if(temp==s[i]) {
      count++;
    }
    else {
      res.push_back(pair<char,ll>(temp,count));
      temp=s[i];
      count=1;
    }
    if(i==s.size()-1) {
      res.push_back(pair<char,ll>(temp,count));
    }
  }
  return res;
}

int main() {
  ll n,k;
  string s;
  cin >> n >> k >> s;
  vector<pair<char,ll>> t=rle(s);
  ll ans=0;
  ll temp=0;
  if(t[0].first=='0') {
    for(ll i=0;i<min((ll)t.size(),2*k);i++) {
      temp+=t[i].second;
    }
    ans=temp;
    for(ll i=2*k;i<t.size();i+=2) {
      temp+=t[i].second;
      if(i+1<t.size()) temp+=t[i+1].second;
      temp-=t[i-2*k].second;
      if(i!=2*k) {
        temp-=t[i-2*k-1].second;
      }
      ans=max(ans,temp);
    }
  }
  else {
    for(ll i=0;i<min((ll)t.size(),2*k+1);i++) {
      temp+=t[i].second;
    }
    ans=temp;
    for(ll i=2*k+1;i<t.size();i+=2) {
      temp+=t[i].second;
      if(i+1<t.size()) temp+=t[i+1].second;
      temp-=t[i-2*k-1].second;
      temp-=t[i-2*k].second;
      ans=max(ans,temp);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2676
#include <iostream>


using namespace std;


int main()
{
  int n, a[100000], idx=1, flag=1;

  cin >> n;
  for (int i=0; i<n; i++) cin >> a[i];

  for (int i=1; i<n+1; i++){
    idx = a[idx-1];
    if (idx == 2){
      cout << i << endl;
      flag--;
      break;
    }
  }
  if (flag) cout << -1 << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef pair<string , int> s_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<typename T> void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

    ll Q, H, S, D, N;
    vel value(4);
    cin >> Q >> H >> S >> D >> N;
    value[0] = 8 * Q; value[1] = 4 * H; value[2] = 2 * S; value[3] = D;
    sort(all(value));

    if(N % 2 == 0) cout << (N / 2) * value[0] << endl;
    else {
        if(value[0] == D and value[0] != value[1]) {
            cout << (N - 1) / 2 * value[0] + value[1]  / 2 << endl;
        }
        else {
            cout << value[0] / 2 * N << endl;
        }
    } 
    return 0;
}









Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

a = list(set(A))
a.sort()
R = {}
for i in range(len(a)):
  R[a[i]] = i

n = len(a)
L = [[] for _ in range(n)]
P = [[0, 0] for _ in range(N)]
for i in range(N):
  P[i][0] = R[A[i]]
  P[i][1] = len(L[R[A[i]]])
  L[R[A[i]]].append(i)

s = [R[A[0]], 0]
D = [0]

while True:
  while s[1] < len(L[s[0]]) - 1:
    t = L[s[0]][s[1] + 1]
    if t != N - 1:
      s = P[t + 1]
    else:
      break
  else:
    if L[s[0]][0] == N - 1:
      D.append(N)
      break
    s = P[L[s[0]][0] + 1]
    D.append(L[s[0]][s[1]])
    continue
  break

M = len(D)
m = (K - 1) % M

if m == M - 1:
  print()
  exit()
ans = []
s = P[D[m]]
t = L[s[0]][s[1]]

while t != N:
  if s[1] == len(L[s[0]]) - 1:
    ans.append(A[t])
    t += 1
  else:
    t = L[s[0]][s[1] + 1] + 1
  if t == N:
    break
  s = P[t]

print(" ".join(list(map(str, ans))))

Measured memory_bytes: 130928
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int A,B,Q;
  cin >> A >> B >> Q;
  vector<ll> s;
  vector<ll> t;
  s.push_back((-1) * (Mod) * (Mod));
  t.push_back((-1) * (Mod) * (Mod));
  for (int i = 0; i < A; i++) {
    ll a;
    cin >> a;
    s.push_back(a);
  } 
  for (int i = 0; i < B; i++) {
    ll b;
    cin >> b;
    t.push_back(b);
  }
  s.push_back((Mod) * (Mod));
  t.push_back((Mod) * (Mod));
  for (int i = 0; i < Q; i++) {
    ll x;
    cin >> x;
    auto itr1 = lower_bound(s.begin(),s.end(),x);
    auto itr2 = prev(itr1,1);
    auto itr3 = lower_bound(t.begin(),t.end(),x);
    auto itr4 = prev(itr3,1);
    ll ans = Mod * Mod;
    ans = min(ans, max(*itr1,*itr3) - x);
    ans = min(ans, x - min(*itr2,*itr4));
    ans = min(ans, ((*itr3 - x) * 2) + (x - *itr2));
    ans = min(ans, ((*itr1 - x) * 2) + (x - *itr4));
    ans = min(ans, ((x - *itr2) * 2) + (*itr3 - x));
    ans = min(ans, ((x - *itr4) * 2) + (*itr1 - x));
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 5560
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 2e5;

int s[30];
int a[2][30][N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;

  for(int k = 0; k < 2; k++) {
    for(int i = 0; i < n; i++) {
      int x; cin >> x;
      int t = 0;
      for(int j = 0; j < 30; j++) {
        t |= x & (1 << j);
        a[k][j][i] = t;
        if((!!(x & (1 << j))) & (n & 1)) s[j] ^= 1;
      }
    }
  }

  for(int j = 0; j < 29; j++) {
    sort(a[1][j], a[1][j] + n);
    for(int i = 0; i < n; i++) {
      int p = lower_bound(a[1][j], a[1][j] + n, (1 << (j + 1)) - a[0][j][i]) - a[1][j];
      s[j + 1] ^= (n - p) & 1;
    }
  }

  int ans = 0;
  for(int i = 29; i >= 0; i--) (ans <<= 1) |= s[i];
  cout << ans << endl;
}


Measured memory_bytes: 47104
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}

const int mod = INF+7;
int main(){
    ll a,b;cin>>a>>b;
    ll n = gcd(a,b);
    ll res = 1;
    for(int i=2;i<=pow(n,0.5);i++){
        if(n%i!=0)continue;
        res++;
        while(n%i==0)n /= i;
    }
    if(n!=1)res++;
    cout<<res<<endl;
}



Measured memory_bytes: 512
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
D = parse(readline())
if D == 25
    println("Christmas")
elseif D == 24
    println("Christmas Eve")    
elseif D == 23
    println("Christmas Eve Eve")
elseif D == 22
    println("Christmas Eve Eve Eve")    
end    

Measured memory_bytes: 162728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = Long.parseLong(sc.next());
        long B = Long.parseLong(sc.next());

        long ans = A * B / gcd(A, B);
        System.out.println(ans);
    }

    public static long gcd(long a, long b) {
        if(a < b) return gcd(b, a);
        if(b == 0) return a;
        return gcd(b, a % b);
    }
}


Measured memory_bytes: 25300
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

public class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int k = sc.nextInt();
        String s = sc.next();
        if(s.length() <= k){
            System.out.println(s);
        }else{
            System.out.println(s.substring(0, k) + "...");
        }
    }


    private static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte())
                return buffer[ptr++];
            else
                return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr]))
                ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext())
                throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext())
                throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
                throw new NumberFormatException();
            return (int) nl;
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}


Measured memory_bytes: 36108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    ull n;
    cin >> n;
    ull ans;
    ull num,num2;
    cin >> ans;
    num = ans;
    int state = 0;
    rep(i,n-1){
        cin >> num2;
        if(num2 == 0){
            cout << 0 << endl;
            return 0;
        }
        ans *= num2;
        if(ans/num2 != num){
            state = 1;
            ans = 1;
        }
        if(ans > 1000000000000000000){
            state = 1;
        }
        num = ans;
    }
    if(state == 1){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

ll ans = 0;
multiset<ll> A, B;
void go(ll a){
  if(A.size()==0){
    A.insert(a);
    B.insert(a);
  }else{
    auto ita=A.end();
    ita--;
    if(*B.begin()<=a){
      ll after = *B.begin();
      ans += a - after;
      A.insert(*B.begin());
      B.erase(B.begin());
      B.insert(a);
      B.insert(a);
    }else if(*ita>=a){
      ll before = *ita;
      B.insert(*ita);
      A.erase(ita);
      A.insert(a);
      A.insert(a);
      ans += before - a;
    }else{
      A.insert(a);
      B.insert(a);
    }
  }
}
int main(int argc, char const *argv[]) {
  ll Q, x, a, b;
  ll bsum=0;
  std::cin >> Q;
  for(int i=0;i<Q;i++){
    std::cin >> x;
    if(x==1){
      std::cin >> a >> b;
      bsum+=b;
      go(a);
    }else{
      auto ita=A.end();
      ita--;
      std::cout << *ita << " " << ans + bsum << '\n';
    }
  }
  //std::cout << A.size() << B.size() << '\n';
  return 0;
}


Measured memory_bytes: 19072
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>

typedef long long ll;
typedef unsigned short int unsi;
typedef unsigned int uni;
typedef unsigned long int unli;

using namespace std;

int main(){
	int X, Y;
	cin >> X >> Y;
	
	if (X == 1 && Y == 1) {
		cout << 300000 + 300000 + 400000 << endl;
	} else {
		X = max(4 - X, 0);
		Y = max(4 - Y, 0);
		cout << (X + Y) * 100000 << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];

int main() {
  int N, K; cin >> N >> K;
  
  int atmost =  (N - 2)*(N - 1) / 2;
  
  if ( K > atmost ) {
    cout << -1 << endl;
  } else {
    vector<Pi> res;

    for (int i = 1; i <= N - 1; i++) res.push_back(Pi(i, N));

    int ci = 1, cj = 2;

    
    int break_connection = atmost - K;

    for (int i = 0; i < break_connection; i++) {
      res.push_back(Pi(ci, cj));
      cj++;
      if (cj == N) {
        ci++;
        cj = ci + 1;
      }
    }

    cout << res.size() << endl;
    for (auto p: res) cout << p.first << " " << p.second << endl;
  }
}



Measured memory_bytes: 384
# -*- coding: utf-8 -*-
A = int(input()) #通常の電車切符の値段の入力
B = int(input()) #乗り放題電車切符の値段の入力
C = int(input()) #バスの通常の料金の入力
D = int(input()) #バスの乗り放題料金の入力
S = min(A,B)
T = min(C,D)
print(S+T)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int n, k;
    string s;
    cin >> n >> s >> k;
    char kth = s[k - 1];
    for(int i = 0; i < n; i++)
    {
        if(s[i] != kth)
        {
            s[i] = '*';
        }
    }
    cout << s;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const int INF = 1e9;

int main(void){

	string S; cin >> S;
	int l = S.length()/2;
	string ans = "";
	REP(i,l) ans += "hi";

	if(S == ans) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

int main() {
    int n, q;
    cin >> n >> q;
    string s; cin >> s;
    vector<int> l(q), r(q);
    rep(i, q) cin >> l[i] >> r[i];

    vector<int> ac(n); //i文字目までにAC何個含むか
    ac[0] = 0;
    rep(i, n-1) {
        if (s[i] == 'A' && s[i+1] == 'C') {
            ac[i+1] = ac[i] + 1;
        }
        else {
            ac[i+1] = ac[i];
        }
    }

    rep(i, q) {
        int ans = ac[r[i]-1] - ac[l[i]-1];
        cout << ans << endl;
    }

}

Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String s = scan.next();
		scan.close();

		int x=0;
		int max=0;
		char sc[]=s.toCharArray();
		
		for(int i=0;i<n;i++) {
			if(sc[i]=='I') x++;
			else x--;
			
			if(x>max)max=x;
		}
		System.out.println(max);
	}
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
#define rep(i,n) for(int (i) = 0; (i) < (n); ++i);
using namespace std;
typedef long long ll;

int main() {
	string s;
	cin >> s;
	vector<int> vec(s.size(), 1);
	vector<pair<int,int>> rlvec;
	vector<pair<int, int>> ansp;
	rlvec.push_back(pair<int,int>(0,0));
	int index = 0;
	int sp = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s.at(i) == 'R') rlvec.back().first++;
		else rlvec.back().second++;
		if (i != s.size() - 1 && s.at(i) == 'L' && s.at(i + 1) == 'R') {
			rlvec.push_back(pair<int, int>(0, 0));
		}
	}
	for (pair<int,int> p : rlvec) {
		int a = p.first;
		int b = p.second;
		int c = (a + (b + 1)) / 2;
		int d = a + b - c;
		//printf("%d,%d %d:%d\n", a, b, c, d);
		pair<int, int> t;
		if (a >= b) {
			if (a % 2 == 0) t = make_pair(d, c);
			else t = make_pair(c, d);
		}
		else {
			if (b % 2 == 0) t = make_pair(c, d);
			else t = make_pair(d, c);
		}
		ansp.push_back(t);
	}
	for (pair<int, int> p : ansp) {
		int a = p.first;
		int b = p.second;
		//printf("%d,%d\n", a, b);
	}
	for (int i = 0; i < s.size(); i++) {
		
		if (i != s.size() - 1 && s.at(i) == 'R' && s.at(i + 1) == 'L') {
			cout << ansp.at(index).first << ' ' << ansp.at(index).second << ' ';
			index++;
			i ++;
		}
		else {
			cout << 0 << ' ';
		}
	}
}

Measured memory_bytes: 1976
import scala.io.StdIn.{readLine, readInt}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val arr = readLine.split(" ").map(_.toLong)
        readInt
        val ret = readLine.split(" ").map(_.toLong).foldLeft(0) {(num, v) =>
            if (binSearch(v, arr, len)) num + 1 else num
        }
        println(ret)
    }
    def binSearch(needle: Long, arr: Array[Long], length: Int): Boolean = {
        def go(leftPtr: Int, rightPtr: Int): Boolean = ((leftPtr + rightPtr) / 2) match {
            case median if needle == arr(median) => true
            case median if  leftPtr == rightPtr => false 
            case median if needle > arr(median) => go(median + 1, rightPtr)
            case median if needle < arr(median) => go(leftPtr, median)
        }
        go(0, length - 1)
    }
}


Measured memory_bytes: 76636
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
#define rep(i,n) for(int i=0;i<n;i++)

lli n;

lli gcd(lli a, lli b){
	if(b == 0) return a;
	return gcd(b, a%b);
}

int main(void){
	cin >> n;
	lli ans = 0;
	rep(i, n){
		lli a;
		cin >> a;
		ans = gcd(ans, a);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3648
lst = list(map(int, input().split()))

sorted_lst = sorted(lst)

diff1 = sorted_lst[2] - sorted_lst[1]
diff2 = sorted_lst[2] - sorted_lst[0]
ans = 0
if (diff1 % 2 == 0 and diff2 % 2 == 0):
  ans = diff1 // 2 + diff2 // 2
elif (diff1 % 2 != 0 and diff2 % 2 != 0):
  ans = (diff1 - 1) // 2 + (diff2 - 1) // 2 + 1
elif (diff1 % 2 != 0 and diff2 % 2 == 0):
  ans = (diff1 - 1) // 2 + diff2 // 2 + 2
elif (diff1 % 2 == 0 and diff2 % 2 != 0):
  ans = (diff2 - 1) // 2 + diff1 // 2 + 2
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
//関数
const long INF=10000000000;

void display(long j,vector<long> x){
    cout<<"data "<<j<<" display_start"<<endl;
    for(int i=0;i<x.size();i++){
        cout<<x.at(i)<<" ";
    }
    cout<<endl<<"display_end"<<endl<<endl;
}


//main
int main() {
    
    //入力
    long N;
    cin>>N;
    vector<double> x(N);
    vector<string> u(N);
    for(int i=0;i<N;i++){
        cin>>x.at(i)>>u.at(i);
    }
    
    //計算
    double ans=0;
    for(int i=0;i<N;i++){
        if(u.at(i)=="JPY"){
            ans+=x.at(i);
        }else{
            ans+=380000.00000000*x.at(i);
        }
    }
    
    
    
    
    //出力
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)

int n, a[200];

int main() {
    scanf("%d", &n);
    rep(i, n) scanf("%d", a+i);
    int m=0, c0=0, c1=0;
    rep(i, n) {
        if(a[i]==0) c0++;
        else if(a[i]==1) c1++;
        else a[m++] = a[i];
    }
    sort(a, a+m);
    rep(i, c0) a[m+i] = 0;
    rep(i, c1) a[m+c0+i] = 1;
    if(c0%2) {
        if(c1) swap(a[m+c0-1], a[m+c0]);
        else if(m) {
            const int mini = a[0];
            rep(i, m+c0-2) a[i]=a[i+1];
            a[m+c0-2] = mini;
            m--;
        }
    }
    if(m>=2 && a[m-2]==2 && a[m-1]==3) swap(a[m-2], a[m-1]);
    rep(i, n) printf("%d\n", a[i]);
    return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<map>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm> 
using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;

int main()
{
    int n;cin >> n ;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);

    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        cin >> c[i];
    }
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());

    long long int res=0;
    for(auto t:b){
        auto i_a = lower_bound(a.begin(),a.end(),t);
        auto i_c = upper_bound(c.begin(),c.end(),t);

        long long int i = i_a - a.begin();
        long long int k = c.end() - i_c;
        res += i*k;
    }
    p(res)
} 

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    ll b[55],ans=0;
    string a[55],str;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    cin>>str;
    int i=0;
    while(str!=a[i])
        i++;
    for(i++;i<n;i++)
        ans+=b[i];
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

#define N 101

int main() {
    int n, i, count1 = 0, count2 = 0;;
    char s1[N], s2[N];

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%*c%s%*c%s", s1, s2);

        if (strcmp(s1, s2) == 0) {
            count1++;
            count2++;
        }
        else if (strcmp(s1, s2) > 0) {
            count1 += 3;
        }
        else {
            count2 += 3;
        }

    }

    printf("%d %d\n", count1, count2);

    return 0;
}



Measured memory_bytes: 2060
N = int(input())

ans=0

def calc(N,ans):
    M = N //5
    ans += M
    
    if M < 5:
        return ans
    else :
        return calc(M,ans)
    
if N%2 != 0:
    ans = 0
else:
    ans=calc(N//2,ans)
        
print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Max=1e5+7;
ll a[Max];
ll temp[Max];
ll n,m,v,p;
bool check(ll x){
    ll cnt=0;
    for(int i=1;i<=n;i++){
        temp[i]=a[i];
    }
    for(int i=1;i<p;i++){
        temp[i]+=m;
        cnt++;
    }
    for(int i=x;i<=n;i++){
        temp[i]+=m;
        cnt++;
    }
    if(cnt>=v){
        return temp[p]<=temp[x];
    }else{
        ll left=1ll*(v-cnt)*m;
        for(int i=p;i<x;i++){
            if(temp[i]>temp[x]){
                return 0;
            }
            ll t=min(temp[x]-temp[i],1ll*m);
            left-=t;
        }
        return left<=0;
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m>>v>>p;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+1+n,greater<ll>());
    ll l=p;
    ll r=n;
    while(l<r){
        ll mid=l+r>>1;
        if(check(mid)){
            l=mid+1;
        }else{
            r=mid-1;
        }
    }
    if(!check(l)){
        l--;
    }
    cout<<l<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

const int maxn = 500000 + 5;

struct Node{
	int value;
	Node *Left_Child,*Right_Child;
}pool[maxn],*tail = pool;

Node *root,*NUL;

void Insert(int key){
	Node *x = tail++;
	Node *fa = NUL;
	Node *cur = root;
	
	x->value = key;
	x->Left_Child = NUL;
	x->Right_Child = NUL;
	
	while(cur != NUL){
		fa = cur;
		if(cur->value > x->value)cur = cur->Left_Child;
		else cur = cur->Right_Child;
	}
	
	if(fa == NUL)root = x;
	else {
		if(fa->value > x->value)fa->Left_Child = x;
		else fa->Right_Child = x;
	}
}

void Preorder(Node *cur){
	if(cur == NUL)return;
	printf(" %d",cur->value);
	Preorder(cur->Left_Child);
	Preorder(cur->Right_Child);
}

void Inorder(Node *cur){
	if(cur == NUL)return;
	Inorder(cur->Left_Child);
	printf(" %d",cur->value);
	Inorder(cur->Right_Child);
}

bool find(int key){
	Node *cur = root;
	while(cur != NUL){
		if(cur->value > key)cur = cur->Left_Child;
		else if(cur->value < key)cur = cur->Right_Child;
		else return true;
	}
	return false;
}

int main(){
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n; i++){
		char s[15];
		scanf("%s",s);
		if(strcmp(s,"insert") == 0){
			int key;
			scanf("%d",&key);
			Insert(key);
		}
		else if(strcmp(s,"print") == 0){
			Inorder(root);
			printf("\n");
			Preorder(root);
			printf("\n");
		}
		else {
			int key;
			scanf("%d",&key);
			if(find(key))printf("yes\n");
			else printf("no\n");
		}
	}
}

Measured memory_bytes: 12508
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1ll << 60;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[int(1e5)];

int main(){
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", A + i);
  sort(A, A + N, greater<int>());

  int now = A[0], ans = A[0];
  for (int i = 1; i < N; i++){
    if (now > abs(A[i] - A[0] / 2)){
      now = abs(A[i] - A[0] / 2);
      ans = A[i];
    }
  }
  printf("%d %d\n", A[0], ans);

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template<typename T>
ostream& operator << (ostream& os, vector<T> v)
{
  os << "(";
  each (i, v) os << i << ",";
  os << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int a, b;
  while (cin >> a >> b) {
    cout << (a - 1) * (b - 1) << endl;
  }
  
  return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }
    ll ans = 0;
    while (true) {
        bool flag = true;
        for (int i = 0; i < N; i++) {
            if (A[i] >= N) {
                ll num = A[i] / N;
                for (int j = 0; j < N; j++) {
                    A[j] += num;
                }
                A[i] -= num * (N + 1);
                ans += num;
                flag = false;
            }
        }
        if (flag) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}/*char to int*/
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}/*MAX*/
int lcm(ll a,ll b){return a*b/gcd(a,b);}/*MIN*/
bool primecheck(ll n){/*sosuu*/if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int  main(){
int n;
cin  >> n;
ll yonn = 0,guu=0,ki=0;
for(int i=0;i<n;i++){
    ll z;
    cin >> z;
 if(z%4==0)yonn++;
 else if(z%2==0)guu++;
 else ki++;
}
if(guu==0){
    int sum =0;

    if(yonn>=1){
        ki-=2;
        yonn--;
    }   
    ki-=yonn;
    if(ki<=0){
        cout<<"Yes"<<endl;
        return 0;
    }
}
else {
        int sum = yonn-ki;
        if(sum>=0){
            cout<<"Yes"<<endl;
            return 0;
        }
}
cout<<"No"<<endl;
}







Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;

namespace atcoder_past_problem
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new Input(Console.In));
        }

        public void Solve(Input input)
        {
            if (Solve2(input))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        public bool Solve2(Input input)
        {
            var n = input.ReadInt;
            var plan = new List<int[]>();
            for (var i = 0; i < n; i++)
            {
                plan.Add(input.ReadIntArray);
            }

            var axis = new int[] { 0, 0 };
            var time = 0;

            foreach (var p in plan)
            {
                var limit = p[0] - time;
                time = p[0];

                var distance = Math.Abs(axis[0] - p[1]) + Math.Abs(axis[1] - p[2]);
                if (limit < distance) return false;

                if (Math.Abs(limit - distance) % 2 != 0) return false;
                axis = new int[] {p[1], p[2]};
            }
            return true;
        }
    }

    public class Input
    {
        private TextReader Stream { get; }
        private char Separator { get; }
        private Queue<string> InputStream { get; }

        public Input(TextReader stream, char separator = ' ')
        {
            Stream = stream;
            Separator = separator;
            InputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (InputStream.Count != 0) return InputStream.Dequeue();
                string[] tmp = Stream.ReadLine().Split(Separator);
                for (int i = 0; i < tmp.Length; ++i)
                    InputStream.Enqueue(tmp[i]);
                return InputStream.Dequeue();
            }
        }

        public string ReadLine => Stream.ReadLine();
        public int ReadInt => int.Parse(Read);
        public long ReadLong => long.Parse(Read);
        public double ReadDouble => double.Parse(Read);
        public int[] ReadIntArray => Stream.ReadLine().Split(Separator).Select(i => int.Parse(i)).ToArray();
        public long[] ReadLongArray => Stream.ReadLine().Split(Separator).Select(l => long.Parse(l)).ToArray();
    }
}


Measured memory_bytes: 26036
n,k = map(lambda x:int(x),input().split())
snakhold = [0]*n
for i in range(k):
  snaknum = input()
  snakholders = list(map(lambda x:int(x),input().split()))
  for s in snakholders:
    snakhold[s-1] = 1
victim = 0
for s in snakhold:
  if s==0:
    victim += 1
print(victim)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define all(v) (v).begin(),(v).end()
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int h,w;
  cin>>h>>w;
  int ans=(h*w+1)/2;
  if(h==1||w==1){
    ans=1;
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
//R<3S
#include <bits/stdc++.h>
#define hell 1000000007
#define PI 3.14159265358979323844
#define mp make_pair
#define pb push_back
#define fi first 
#define se second
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))  
#define REVERSE(v) reverse(ALL(v))
#define endl "\n"
#define vecmax(v) max_element(all(v))
#define vecmin(v) min_element(all(v))
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(x) for(auto i : x)
#define sz(a) (int)a.size()
#define sl(a) (int)a.length()
#define int long long
#define ld long double 
#define pii std::pair<int, int> 
#define pll std::pair<ll, ll>  
#define vi vector<int>  
#define vl vector<ll>
#define vvi vector<vi > 
#define vii vector<pii >
#define mii map<int,int>
#define mll map<ll,ll>


using namespace std;

void solve()
  {

	int n,d;
	cin>>n>>d;
	int cnt=0;
	rep(i,n)
	{
		int x,y;
		cin>>x>>y;
		if(x*x+y*y<=d*d)cnt++;
	}
	cout<<cnt;
	

  }



signed main()
{
   std::ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   int t;
   t=1;
   //cin>>t;
   while(t--)
    {
        solve();
    }


   return 0;
}
	

Measured memory_bytes: 3692