akhauriyash/Code-Regression huggingface dataset:
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int N = 200010;
int eu[N], ev[N], n, m, flag, mid;
char s[N];
void error(){
	printf("-1\n");
	exit(0);
}
int main(){
	scanf("\n%s", s + 1);
	n = strlen(s + 1);
	if (s[n] == '1') error();
	if (n % 2 == 0){
		if (s[n / 2] == '1') flag = 1; else flag = -1;
		for (int i = 1; i < n / 2; i++)
			if (s[i] != s[n - i]) error();
		m = n / 2 - 1; mid = m + 1;
	}
	else {
		flag = 0;
		for (int i = 1; i <= n / 2; i++)
			if (s[i] != s[n - i]) error();
		m = n / 2; mid = m + 1;
	}
	if (s[1] == '0') error();
	int now = 1;
	for (int i = 1; i <= m; i++){
		eu[i] = now, ev[i] = i + 1;
		if (s[i] == '1') now = i + 1;
	}
	for (int i = 1; i <= m; i++){
		if (eu[i] == now) eu[i] = mid;
			else if (eu[i] == mid) eu[i] = now;
		if (ev[i] == now) ev[i] = mid;
			else if (ev[i] == mid) ev[i] = now;
	}
	if (flag == 1){
		printf("%d %d\n", n / 2, n / 2 + 1);
		for (int i = 1; i <= m; i++){
			printf("%d %d\n", eu[i], ev[i]);
			printf("%d %d\n", n - eu[i] + 1, n - ev[i] + 1);
		}
	}
	if (flag == -1){
		printf("%d %d\n", n / 2, n);
		for (int i = 1; i <= m; i++){
			printf("%d %d\n", eu[i], ev[i]);
			printf("%d %d\n", n - eu[i], n - ev[i]);
		}
	}
	if (flag == 0){
		for (int i = 1; i <= m; i++){
			printf("%d %d\n", eu[i], ev[i]);
			printf("%d %d\n", n - eu[i] + 1, n - ev[i] + 1);
		}
	}
	return 0;
}



Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

int n, q;
std::string s;
std::vector<int> ans;

int main(){

    ans.resize(111111);

    cin >> n >> q;
    cin >> s;

    ans[1] = ans[0] = 0;
    for(int i = 1; i < s.size(); i++){
        ans[i+1] = ans[i];
        if(s[i-1] == 'A' && s[i] == 'C'){
            ans[i+1]++;
        }
    }

    for(int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        cout << ans[r] - ans[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  int n, k;
  cin >> n >> k;
  vector<double> p(n);
  for (auto& x : p) {
    cin >> x;
    x = x * (x + 1) / 2 / x;
  }
  
  vector<double> sum(n + 1);
  for (int i = 0; i < n; i++) {
    sum[i + 1] = sum[i] + p[i];
  }

  double ans = 0;
  for (int i = k; i <= n; i++) {
    ans = max(ans, sum[i] - sum[i - k]);
  }
  cout << fixed << setprecision(12) <<  ans << endl;
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <iostream>
#include <string>
 
using namespace std;

int main() {
    int a;
    string s;
    cin >> a;
    cin >> s;
    if (a >= 3200) {
        cout << s << endl;
    } else {
        cout << "red" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define PP std::pair<int,int>
#define LL long long
int N, A;
int main() {
	std::cin >> N >> A;
	if (N % 500 <= A)std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main() {
    long long N;
    cin >> N; 
    vector <long long> A(N);
    for (long long i=0; i<N; i++) cin >> A.at(i);
    sort(A.begin(), A.end());
//    vector <vector <bool>> dp(1000000, vector<bool>(1000000, true));
    vector <bool> dp(A.at(N-1)+1, true);
    vector <bool> seen(A.at(N-1)+1, false);
    long long ans=0;
    for (long long i=0; i<N; i++) {
        long long x = A.at(i);
        if (dp.at(x)==false) continue;
        if (seen.at(x)) {
            dp.at(x)=false;
            continue;
        }
        seen.at(x)=true;
        for (long long j=2*x; j<=A.at(N-1); j+=x) dp.at(j) = false;
    }
    for (long long i=0; i<N; i++) {
        if (dp.at(A.at(i))) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 5020
import numpy as np

n,m,c = map(int,input().split())
b = list(map(int,input().split()))
a = []
ans = 0
for i in range(n): 
    a.append(list(map(int,input().split())))
    if np.dot(a[i],b)+c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 12504
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;
// }}}

ll N, K;
ll x[100000];
ll m[100001];

void init()
{
}

void solve()
{
    ll ret = LINF;
    REP(i, N-K+1){
        ll v1 = abs(x[i]) + abs(x[i+K-1] - x[i]);
        ll v2 = abs(x[i+K-1]) + abs(x[i+K-1] - x[i]);
        ret = min(ret, min(v1, v2));
    }
    cout << ret << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i, N) cin >> x[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 1024
N,M = map(int,input().split())
edges = []
for _ in range(M):
    a,b = map(int,input().split())
    edges.append((a-1,b-1))
edges.reverse()
parents = list(range(N))
size = [1 for _ in range(N)]
rank = [0 for _ in range(N)]

def root(x):
    px = parents[x]
    if px == x:
        return(x)
    else:
        r = root(px)
        parents[x] = r
        return(r)

def same(x,y):
    return(root(x) == root(y))

def union(x,y):
    rx = root(x)
    ry = root(y)
    if rx == ry:
        return(0)
    if rank[ry] > rank[rx]:
        parents[rx] = ry
        size[ry] += size[rx]
    else:
        parents[ry] = rx
        size[rx] += size[ry]
        if rank[rx] == rank[ry]:
            rank[rx] += 1
    return(1)

inconvinience = N*(N-1)//2
answers=[inconvinience]

for edge in edges:
    x,y = edge
    rx = root(x)
    ry = root(y)
    sx = size[rx]
    sy = size[ry]
    res = union(rx,ry)
    if res == 1:
        inconvinience -= sx*sy
    answers.append(inconvinience)

answers.reverse()

for answer in answers[1:]:
    print(answer)

Measured memory_bytes: 24868
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
ll modinv(ll a, ll mod) { return modpow(a, mod - 2, mod); }

int main() {
  string S;
  cin >> S;
  reverse(all(S));

  ll dp[S.size() + 1][13];
  rep(i, S.size() + 1) {
    rep(j, 13) { dp[i][j] = 0; }
  }

  if (S[0] == '?') {
    rep(i, 10) { dp[1][i]++; }
  } else {
    dp[1][S[0] - '0']++;
  }

  repp(i, 2, S.size()) {
    if (S[i - 1] == '?') {
      rep(k, 10) {
        int res = k;
        res *= modpow(10, i - 1, 13);
        res %= 13;
        rep(j, 13) {
          dp[i][(j + res) % 13] += dp[i - 1][j];
          dp[i][(j + res) % 13] %= MOD;
        }
      }
    } else {
      int res = S[i - 1] - '0';
      res *= modpow(10, i - 1, 13);
      res %= 13;
      rep(j, 13) {
        dp[i][(j + res) % 13] += dp[i - 1][j];
        dp[i][(j + res) % 13] %= MOD;
      }
    }
  }
  cout << dp[S.size()][5] << endl;
}

Measured memory_bytes: 10624
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

int main() {
    using namespace std;
    int L,R,d,sum=0;
    cin>>L>>R>>d;
    for (int i = L; i <=R ; ++i) {
        if ((float)i/d==i/d)
            sum++;
    }
    cout<<sum;
    return 0;
    }

Measured memory_bytes: 3620
(let* ((n (read))
       (a (make-array `(,(+ n 1)) :initial-element 0))
       (m 0)
       (dp)
       (r 0))
  ;; read
  (loop :for i :from 1 :to n
        :do (setf (aref a i) (read)))
  ;;
  (setf a (sort a #'<))
  (setf m (aref a (1- (length a))))
  (setf dp (make-array `(,(1+ m)) :initial-element t))
  ;;
  (loop :for i :from 1 :to n
        :do (let ((x (aref a i)))
              (when (aref dp x)
                (loop :for y :from (* x 2) :upto m :by x
                      :do (setf (aref dp y) nil)))))
  ;;
  (loop :for i :from 1 :to n
        :if (and (or (= i n) (/= (aref a i) (aref a (1+ i))))
                 (or (= i 1) (/= (aref a (1- i)) (aref a i)))
                 (aref dp (aref a i)))
        :do (incf r))
  (format t "~A~%" r))


Measured memory_bytes: 80292
#include <iostream>
#include <cmath>
using namespace std;

int main() {
	int n, num[30];
	num[0] = 1;
	num[1] = 2;
	num[2] = 4;
	for (int i = 3; i < 30; i++) num[i] = num[i - 3] + num[i - 2] + num[i - 1];
	while (cin >> n,n) {
		cout << (int)ceil((double)num[n - 1] / 3650.0) << endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <cstdio>
#include <algorithm>
#include <utility>
typedef long long int64;
static const int MAXN = 200004;
static const int   INF32 = 0x7fff0fff;
static const int64 INF64 = 0x7fffffffffffffffLL;

int n, x[MAXN], y[MAXN];

std::pair<int, int> ev[MAXN * 2];
int occ[MAXN] = { 0 };

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d%d", &x[i], &y[i]);
        if (x[i] > y[i]) std::swap(x[i], y[i]);
    }

    auto x_mm = std::minmax_element(x, x + n);
    auto y_mm = std::minmax_element(y, y + n);
    int p = std::min(*x_mm.first, *y_mm.first),
        q = std::max(*x_mm.second, *y_mm.second);

    int64 ans = INF64;
    // Case 1: p and q are in different colours
    int min[2] = { p, q }, max[2] = { p, q };
    for (int i = 0; i < n; ++i) {
        min[0] = std::min(min[0], x[i]);
        max[0] = std::max(max[0], x[i]);
        min[1] = std::min(min[1], y[i]);
        max[1] = std::max(max[1], y[i]);
    }
    ans = std::min(ans, (int64)(max[0] - min[0]) * (max[1] - min[1]));
    // Case 2: p and q are in the same colour
    int valid = 0;
    for (int i = 0; i < n; ++i) {
        if ((x[i] == p && y[i] != q) || (x[i] != p && y[i] == q)) { valid = 2; break; }
        if (x[i] == p && y[i] == q && ++valid == 2) break;
    }
    if (valid >= 2) {
        int ev_ct = 0;
        for (int i = 0; i < n; ++i) {
            ev[ev_ct++] = { x[i], i };
            ev[ev_ct++] = { y[i], i };
        }
        if (ev_ct == 0) { ans = 0; goto print; }
        std::sort(ev, ev + ev_ct);
        int head = 0, tail = 0;
        int occ_ct = 0;
        while (occ_ct < n) {
            if (++occ[ev[tail].second] == 1) ++occ_ct;
            ++tail;
        }
        int range = ev[tail - 1].first - ev[head].first;
        while (tail < ev_ct) {
            if (--occ[ev[head].second] == 0) --occ_ct;
            ++head;
            while (tail < ev_ct && occ_ct < n) {
                if (++occ[ev[tail].second] == 1) ++occ_ct;
                ++tail;
            }
            if (occ_ct == n)
                range = std::min(range, ev[tail - 1].first - ev[head].first);
        }
        ans = std::min(ans, (int64)(q - p) * range);
    } //else fputs("> <\n", stderr);

print:
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 5760
import math as mt

def kock(n, p1, p2):
    if n == 0:
        return
    s =[(2 * p1[0] + p2[0]) / 3 , (2 * p1[1] + p2[1]) / 3]
    t = [(p1[0] + 2 * p2[0]) / 3, (p1[1] + 2 * p2[1]) / 3]
    u = [(t[0]-s[0])*mt.cos(mt.radians(60))
        -(t[1]-s[1])*mt.sin(mt.radians(60)) + s[0],
         (t[0]-s[0])*mt.sin(mt.radians(60))
         +(t[1]-s[1])*mt.cos(mt.radians(60)) + s[1]]

    kock(n-1, p1, s)
    print("{0:.8f} {1:.8f}".format(s[0],s[1]))
    kock(n-1, s, u)
    print("{0:.8f} {1:.8f}".format(u[0],u[1]))
    kock(n-1, u, t)
    print("{0:.8f} {1:.8f}".format(t[0],t[1]))
    kock(n-1, t, p2)


if __name__ == '__main__':
    n = int(input())
    p1 = (0,0)
    p2 = (100,0)
    print("{0:.8f} {1:.8f}".format(p1[0],p1[1]))
    kock(n, p1, p2)
    print("{0:.8f} {1:.8f}".format(p2[0],p2[1]))

Measured memory_bytes: 7992
#include <stdio.h>
#define Fori(g) for(int i=0;i<g;i++)
#define	Forj(g) for(int j=0;j<g;j++)
#define min(a,b) return (a<b)?a:b
#define max(a,b) return (a<b)?b:a
#define gcd(a,b) return (!b)?a:gcd(b,a%b)

struct per{
	int num;
	int time;
};

int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	/*struct per a[n],tmo;
	Fori(n)scanf("%d",&a[i].time);a[i].num=i;

	Fori(n)
		Forj(n)
			if
	*/
	int b;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&b);
		a[b]=i;
	}

	for(int i=1;i<=n;i++){
		printf("%d\t",a[i]);
	}



	return 0;
}

Measured memory_bytes: 1152
#[allow(unused_imports)]
use std::cmp::Reverse;

#[allow(unused_imports)]
use proconio::{fastout, input, marker::Chars};

#[allow(unused_imports)]
use itertools::Itertools;

#[fastout]
pub fn main() {
    input! {
        n: usize,
        k: usize,
        h: [i64; n],
    }

    let mut dp = vec![std::i64::MAX; n];
    dp[0] = 0;
    for i in 0..n {
        for j in 1..=k {
            if i + j >= n {
                break;
            }
            if dp[i + j] == std::i64::MAX {
                dp[i + j] = dp[i] + (h[i + j] - h[i]).abs();
            } else {
                dp[i + j] = dp[i + j].min(dp[i] + (h[i + j] - h[i]).abs());
            }
        }
    }
    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 4048
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>

#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORN(i, a, b) for (int i = a; i <= b; i++)
#define P(s) cout << s << endl
#define PC(condition, _true, _false) if (condition) _true; else _false;
#define toInt(_char) _char - '0'

using namespace std;
//
// Created by karayuu on 2018-12-18.
//

int main() {
    int n = 0;
    cin >> n;

    int a[100] = {0};
    FOR(i, 0, n) {
        cin >> a[i];
    }

    //forは for (初期条件; 〇〇; ××) で〇〇を満たす間××するなので
    //i >= 0にしなければいけないことに注意！(i <= 0ではない！)
    for (int i = n - 1; i >= 0; i--) {
        cout << a[i];
        if (i != 0) {
            cout << " ";
        }
    }

    cout << endl;
}


Measured memory_bytes: 3104
#include <stdio.h>
int main (){
	
	int A1, A2, A3;
	scanf("%d %d %d", &A1, &A2, &A3);
	if(A1 + A2 + A3 >= 22){
		
	puts("bust");	
	} else { puts("win");
	}
	return 0;
	
}

Measured memory_bytes: 1664
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<assert.h>
//#include<unordered_map>
//#include<unordered_set>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include <iomanip>
#include<bits/stdc++.h>

using namespace std;
#define lead_zero(x)    __builtin_clzll(x)
#define trail_zero(x)   __builtin_ctz(x)
#define total_1s(x)     __builtin_popcount(x)
#define ll long long int
#define pi 3.14159265358979323846
#define filein freopen("input.txt", "r", stdin)
#define forn(i,n) for(int i=0;i<n;i++)
#define maxx 1000000005
#define nullptr NULL

int main()
{
    ll t;


        int n;
        cin>>n;
        int v[n+5],c[n+5],sum=0;
        forn(i,n)
        {
            cin>>v[i];
        }
        forn(i,n)
        {
            cin>>c[i];
        }
        forn(i,n)
        {
            if((v[i]-c[i])>0)
                sum+=(v[i]-c[i]);
        }
        cout<<sum<<endl;


    return 0;

}


Measured memory_bytes: 3568
from sys import stdin

def main():
    import heapq
    input = stdin.readline
    input()
    a = [-1 * int(i) for i in input().split()]
    heapq.heapify(a)
    while len(a) > 1:
        u = heapq.heappop(a)
        v = heapq.heappop(a)
        if u + 1 < 0:
            heapq.heappush(a, u + 1)
        if v + 1 < 0:
            heapq.heappush(a, v + 1)
    if len(a) == 0:
        print(0)
    else:
        print(abs(a[0] + 1))
main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF (int)1e9
#define endl "\n"
#define ll long long
#define ull unsigned long long

#define MOD ((int)1e9 + 7)

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<vector<ll>> arr(10, vector<ll>(10));
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        int f = pow(10, (int)log10(i));
        int l = i % 10;

        if (l != 0)
        {
            arr[i / f][l]++;
        }
    }

    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            ans += arr[i][j] * arr[j][i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long
#define pi pair<ll,ll>
#define __   ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define mod 1000000007

ll Set(ll N,ll pos){ return N=N | (1<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1<<pos)); }


ll ar[]={0,0,1,-1};
ll br[]={1,-1,0,0};

string s,s1,s2;
ll n,m;
ll arr[500000];
ll brr[500000];
vector<ll>v,v1;

map<ll,ll>mp;
ll vis[500005];
int main()
{__
        ll i,j,a,b,c,d,e,f,g,x,y,z,t,k,l;

        ll ans=0;

        cin>>n;

        for(i=0;i<n;i++){
            cin>>a;
            if(mp[a]==1){
                cout<<"NO"<<endl;
                return 0;
            }
            mp[a]=1;
        }
        cout<<"YES"<<endl;
}





Measured memory_bytes: 14848
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int K = scanner.nextInt();

		int gcd = gcd(A, B);
		int count = 0;
		int answer = 0;
		for(int i = 1;count < K ; i ++) {
			if(gcd % i == 0) {
				answer = gcd / i;
				count ++;
			}
		}

		System.out.println(answer);
	}

	static int gcd(int a, int b) {
		int temp;
		while ((temp = a % b) != 0) {
			a = b;
			b = temp;
		}
		return b;
	}
}

Measured memory_bytes: 23508
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <cstring>
#include <map> 
#include<set>
#include<queue>
#include <iomanip>

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h,n, w,m,t; string s;
ll R, C;
ll sy, sx, gy, gx;
char maze[20][20];
ll dis[20][20];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);
}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

ll GetDigit(ll num) {
	return log10(num) + 1;
}
ll Combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> numerator(r);
	vector<ll> denominator(r);

	for (int k = 0; k < r; k++)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	for (int p = 2; p <= r; p++)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	for (int k = 0; k < r; k++)
	{
		if (numerator[k] > 1) result *= numerator[k];
		result %= ma;
	}

	return result;
}

ll bfs() {
	queue<P> que;
	for (int i = 0; i < R; i++) {
		for (int j = 0; j < C; j++) dis[i][j] = INF;
	}
	que.push(P(sy - 1, sx - 1));
	dis[sy - 1][sx - 1] = 0;

	while (que.size() > 0) {
		P p = que.front();
		que.pop();
		if (p.first == gy - 1 && p.second == gx - 1) break;
		for (ll i = 0; i < 4; i++) {
			ll ny = p.first + dy[i];
			ll nx = p.second + dx[i];
			if (0 <= ny && ny < R && 0 <= nx && nx < C && maze[ny][nx] == '.' && dis[ny][nx] == INF) {
				que.push(P(ny, nx));
				dis[ny][nx] = dis[p.first][p.second] + 1;
			}
		}
	}
	return dis[gy - 1][gx - 1];
}

int main() {
	cin >> n;
	vector<P> lr(n);
	ll res = 0;
	rep(i, n) {
		ll a, l;
		cin >> a >> l;
		lr[i].first = a + l;
		lr[i].second = a - l;
	}
	sort(lr.begin(), lr.end());
	ll k = -INF;
	rep(i, n) {
		if (k > lr[i].second) {
		}
		else {
			res++;
			k = lr[i].first;
		}
	}
	cout << res << endl;
}



Measured memory_bytes: 1792
import sys,queue,math,copy,itertools,bisect,collections,heapq
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
N = NI()
a = LI()

dp = [[0] * (N+1) for _ in range(N+1)]

for i in range(N-1,-1,-1):
    for j in range(i+1):
        dp[i][j] = max(a[i-j]-dp[i+1][j],a[N-j-1]-dp[i+1][j+1])

print(dp[0][0])

Measured memory_bytes: 114008
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)

int main() {
	ll N, K; cin >> N >> K;
	ll ans = K;
	if (N > 1) {
		rep(i, 0, N - 1) {
			ans *= (K - 1);
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int n, A[50];

int solve(int p, int t){
  if ( p >= n ) return 0;
  if ( A[p] == t ) return 1;
  if ( solve(p+1, t) ) return 1;
  if ( solve(p+1, t-A[p]) ) return 1;
  return 0;
}

int main(){
  int q, M, i;
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  scanf("%d", &q);
  for ( i = 0; i < q; i++ ) {
    scanf("%d", &M);
    if ( solve(0, M) ) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 2108
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Min_Max
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            List<int> nums = new List<int>();
            for (int i = 0; i < input.Length; ++i)
            {
                nums.Add(int.Parse(input[i]));
            }

            nums.Sort();

            Console.WriteLine(nums[0]+" "+nums[2]);
        }
    }
}



Measured memory_bytes: 16040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[11];
int main() {
	// 코틀린 ,문자열 알고리즘 보기, 앳코더, (시간되면 코드포스까지)
	ios_base::sync_with_stdio(false); cin.tie(NULL); //9 90 900 
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		int x; cin >> x; a[x] = 1;
	}
	while (1) {
		int tmp = n;
		bool f = false;
		while (tmp > 0) {
			if (a[tmp % 10]) { f = true; break; }
			tmp /= 10;
		}
		if (!f) {
			cout << n << '\n'; break;
		}
		n += 1;
	}



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int H, W;
  int h, w;
  cin >> H >> W >> h >> w;
  cout << (H-h)*(W-w) << endl;
  return 0;
}

Measured memory_bytes: 256
import queue

S = int(input())

q = queue.Queue()
for i in range(1, 10):
    q.put(i)

cnt = 9
num = 9
digit = 0

if S <= 9:
    print(S)
else:
    while cnt <= S:
        num = q.get()
        digit = int(str(num)[-1])
        num = num * 10

        if digit == 0:
            for i in range(2):
                cnt += 1
                if cnt == S:
                    print(num + i)
                    exit()
                else:
                    q.put(num + i)

        elif digit == 9:
            num += digit - 1
            for i in range(2):
                cnt += 1
                if cnt == S:
                    print(num + i)
                    exit()
                else:
                    q.put(num+i)
        else:
            num += digit - 1
            for i in range(3):
                cnt += 1
                if cnt == S:
                    print(num + i)
                    exit()
                else:
                    q.put(num+i)


Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
const ll INF = 1LL << 60;

int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n/2 << endl;
    }
    else{
        cout << n/2 +1 << endl;
    }
}

Measured memory_bytes: 3548
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

#define ll long long

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;

void input() {
  cin >> a >> b;
}

void solve1() {
  cout << max({2 * a - 1, 2 * b - 1, a + b});
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve1();
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
#define RREP(i,n) for (int i = n - 1; i >= 0; i--)
typedef long long ll;

int N,P;
vector<int> A;

int main() {

    cin >> N >> P;
    A.resize(N);
    REP(i,N) cin >> A[i];

    int one = 0;
    int zero = 0;

    REP(i,N) {
        if(A[i] % 2 == 1) one++;
        else zero++;
    }
    
    if (one == 0) {
        if (P == 0) {
            cout << (1LL << N) << endl;
        } else {
            cout << 0 << endl;
        }
    } else {
        cout << (1LL << (N - 1)) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
def main
  lines = []
  while line = gets
      lines << line.chomp.split(' ').map(&:to_i)
  end
  box_count = lines.shift
  numbers = lines.first
  
  count = 0
  numbers.each.with_index do |number, index|
    next if (index+1).even?
    count += 1 if number.odd?
  end
  return puts count

  
end

main

Measured memory_bytes: 14192
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
//#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
std::random_device rd;
std::mt19937 mt(rd());
constexpr int MOD = 1e9 + 7; constexpr int MAX = 200020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e16;
typedef array<int, 3>arr3;
int readInt() {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch - '0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result * 10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}

bool dp[4005000];
int cum[2020];
int A[2020];
void solve() {
	int N; cin >> N;
	REP(i, N) {
		A[i] = readInt();
		cum[i + 1] = cum[i] + A[i];
	}
	int mid = (cum[N] + 1) / 2;
	dp[0] = true;

	REP(i, N) {
		int mn = min(mid, cum[i]+1);
		REPR(j, mn) {
			dp[j + A[i]] |= dp[j];
		}
	}
	FOR(i, mid, cum[N] + 1) {
		if (dp[i]) {
			print(i); return;
		}
	}
}

signed main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
		solve();
}



Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
    double a,b,x;
    cin>>a>>b>>x;
    double s=x/a;
    double h,rad;
    if(s>=a*b/2){
        h=2*(a*b-s)/a;
        rad=atan2(h,a);
    }else{
        h=2*s/b;
        rad=atan2(b,h);
    }
    double PI=acos(-1);
    printf("%.10lf\n",rad/(2*PI)*360);
    return 0;
}


Measured memory_bytes: 256
S = str(input())
SL = ["L", "U", "D"]
SR = ["R", "U", "D"]
for i in range(0, len(S)):
    if i & 1:
        if not(S[i] in SL):
            print("No")
            exit()
    else:
        if not(S[i] in SR):
            print("No")
            exit()
print("Yes")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;
  vector<int> d(4);
  char D[4] = {'N', 'W', 'S', 'E'};
  for(auto c : s)
    for(int i = 0; i < 4; i++)
      if(c == D[i]) d[i] = 1;
  if(d[0] ^ d[2] || d[1] ^ d[3])
    printf("No\n");
  else
    printf("Yes\n");
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define pb push_back
#define pii pair<int,int>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define nl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;

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

    vector<int>v;
    for(int i=0; i<n; i++) {
        if(i%2 == 0) {
            v.pb(arr[i]^arr[i+1]);
        }
    }
    int xo=0;
    for(auto x:v) xo^=x;

    for(int i=0; i<n; i++)cout<<(xo^arr[i])<<" ";
    cout<<"\n";
}

Measured memory_bytes: 5848
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int N = sc.nextInt();
      	int temp[];
      	temp = new int[N];
      	int dist[];
      	dist = new int[N];
      	int result = 0;
      	for (int i=0; i<N; i++){
          temp[i] = sc.nextInt();
        }
   		dist[0] = temp[0];
      	for(int i=1; i<N; i++){
          dist[i] = temp[i]-temp[i-1];
        }
      	dist[0] += (K-temp[N-1]);
      	Arrays.sort(dist);
      	// result
      	for(int i=0; i<N-1; i++){
          result += dist[i];
        }
      	System.out.println(result);
    }
}

Measured memory_bytes: 81448
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int K = sc.nextInt();
		System.out.println(K/2 * (K - K/2));
	}
}

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: 21204
#include<stdio.h>

int main(void)
{
    int a,b,k,d;

    scanf("%d%d",&a,&b);
    d=abs(a+b);
    k=(d)/2;



    if((d)%2==0)
    {
        printf("%d",k);
    }
    else
        printf("IMPOSSIBLE");

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(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;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

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<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main() {
    int N;
    cin >> N;

    map<string, ll> mp;

    REP(i, N) {
        string s;
        cin >> s;
        sort(all(s));

        mp[s]++;
    }

    ll ans = 0;
    for(auto&& m : mp) {
        ans += m.second * (m.second - 1) / 2;
    }

    pl(ans)

    return 0;
}


Measured memory_bytes: 13184
#include<algorithm>
#include<cstdio>
#define s(A)std::sort(A,A+10);
main(){
int Z[20],i=0;
for(;i<20;)
scanf("%d",Z+i++);
s(Z);
s(Z+10);
printf("%d %d\n",Z[7] + Z[8] + Z[9],Z[17] + Z[18] + Z[19]);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	long long int n; cin >> n;
	cout << ceil((n * 1.0) / 2) << endl;
	return 0;
}


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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(A, B);
  int ans = (A - 1) * (B - 1);
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 892
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;

int N;

int main() {
    cin >> N;
    vector<int> a(N);
    int mx = 0;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        a[i] = tmp;
        mx = max(mx, tmp);
    }
    int r = -1;
    for (int i = 0; i < N; i++) {
        if (abs(mx - a[i] * 2) < abs(mx - r * 2) && a[i] != mx) {
            r = a[i];
        }
    }
    cout << mx << " " << r << endl;
}



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

#define ll long long

using namespace std;

const int N = 1e5 + 123;

ll n, a, b;

ll h[N], c[N];

int main () {
    cin >> n >> a >> b;
    for (int i = 1;i <= n;i ++) {
        cin >> h[i];
        c[i] = h[i];
    }sort (h + 1, h + n + 1);
    sort (c + 1, c + n + 1);
    ll l = 1, r = 1e9, ans = 1;
    while (l <= r) {
        ll mid = (l + r) / 2, cnt = 0;
        for (int i = 1;i <= n;i ++) {
            c[i] -= mid * b;
        }
        for (int i = n;i >= 1;i --) {
            if (c[i] > 0) {
                ll val = c[i] / (a - b);
                if (c[i] % (a - b)) val ++;
                cnt += val;
            }
        }
        if (cnt <= mid) {
            r = mid - 1;
            ans = mid;
        }else {
            l = mid + 1;
        }
        for (int i = 1;i <= n;i ++) {
            c[i] = h[i];
        }
    }cout << ans;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define  all(v)     (v).begin(),(v).end()
#define  rall(v)    (v).rbegin(),(v).rend()
#define  pb         push_back
#define  eb         emplace_back
#define  mp         make_pair
#define  ff         first
#define  ss         second
#define  pf         push_front
#define  bs         binary_search
#define  lb         lower_bound
#define  ub         upper_bound
#define  dec(x)   fixed<<setprecision(x)
#define  lcm(a,b)   (a*b/__gcd(a,b))
const ll inf=LLONG_MAX;
const ll mod=1e9+7;
const ld pi=acos(-1);
                    
void solution(){
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans=(b*c);
    if(a<=ans) cout<<"Yes";
    else cout<<"No";
    
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int N;
  cin >> N;
  int a;
  int min = 1001, max = -1;
  for (int i = 0; i < N; i++) {
    cin >> a;
    if (a < min) min = a;
    if (a > max) max = a;
  }
  cout << max - min << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int k,ones=0,no;
  string s;
  cin>>s>>k;
  bool one = false;
  if(s[0]=='1') one = true;
  for(int i=0; ; i++){
    if(s[i]=='1') ones++;
    else {
      no=i;
      break;
    }
  }
  if(one && ones>=k) cout<<'1';
  else cout<<s[no];
}

Measured memory_bytes: 256
from _collections import deque
from _ast import Num


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
from collections import deque
from math import sqrt
from math import floor
# https://atcoder.jp/contests/arc067/tasks/arc067_a
# C - Factors of Factorial
"""
need to consider the case that ticket is not enough to lower everything
"""

N = gi()
A = [0] * N
B = [0] * N
C = [0] * N
sB = [0] * N
sC = [0] * N

for i in range(N):
    A[i] = gi()
A.sort()

for i in range(N):
    B[i] = gi()
B.sort()

nai = 0

for i in range(N):
    while nai < N and A[nai] < B[i]:
        nai += 1
    sB[i] = nai
    if i > 0:
        sB[i] += sB[i - 1]

for i in range(N):
    C[i] = gi()
C.sort()

nbi = 0
for i in range(N):
    while nbi < N and B[nbi] < C[i]:
        nbi += 1
    if nbi:
        sC[i] = sB[nbi - 1]

    if i > 0:
        sC[i] += sC[i - 1]

print(sC[-1])


Measured memory_bytes: 42644
#include <bits/stdc++.h>
 
using namespace std;
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i< (int) n; i++)
#define PI  3.14159265358979323846264338327950
 
 
int main () {
    int N, L;
    cin >> N >> L;

    vector<string>S(N);
    rep(i,N)cin >> S[i];

    sort(S.begin(),S.end());

    string ans;
    rep(i,N){
        ans += S[i];
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
#include <stdio.h>

int height,width;
int map[10][10000];

int main(void) {
	int tansaku,t_max;
	int i,j;
	int result,result_max;
	int count0,count1;
	while(1) {
		scanf("%d%d",&height,&width);
		if(height==0 && width==0)break;
		for(i=0;i<height;i++) {
			for(j=0;j<width;j++)scanf("%d",&map[i][j]);
		}
		t_max=1<<height;
		result_max=0;
		for(tansaku=0;tansaku<t_max;tansaku++) {
			result=0;
			for(j=0;j<width;j++) {
				count0=count1=0;
				for(i=0;i<height;i++) {
					if(tansaku & (1<<i)) {
						if(map[i][j])count0++; else count1++;
					} else {
						if(map[i][j])count1++; else count0++;
					}
				}
				if(count0>count1)result+=count0; else result+=count1;
			}
			if(result>result_max)result_max=result;
		}
		printf("%d\n",result_max);
	}
	return 0;
}

Measured memory_bytes: 804
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>

#define INF_LL 9000000000000000000
#define INF 2000000000

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int main(void){
int five = 0;
int seven = 0;
int a;
REP(i, 3){
cin >> a;
if(a == 5)
    five++;
else if(a == 7)
    seven++;
}
if(five == 2 && seven == 1)
    cout << "YES" << endl;
else
    cout << "NO" << endl;
}


Measured memory_bytes: 764
#include <cstdio>

using namespace std;

int getGCD(int *x, int *y) {
    int a = *x < *y ? *y : *x;
    int b = *x < *y ? *x : *y;
    for (;;) {
        if (b == 0) {
            return a;
        }
        int c = a %b;
        a = b;
        b = c;
    }
}

int main() {
    int x, y;
    scanf("%d %d", &x, &y);
    printf("%d\n", getGCD(&x, &y));

    return 0;
}


Measured memory_bytes: 2732
#include <bits/stdc++.h>
using namespace std;

long long x[100009];
long long a[100009], d[100009], id[100009], go[100009], ans[100009];
bool vs[100009];

int main() {
    int N, M; long long K; scanf("%d",&N);
    for(int i=1; i<=N; i++) scanf("%lld",&x[i]);
    for(int i=1; i<N; i++) d[i] = x[i+1] - x[i], id[i] = i;
    scanf("%d%lld",&M,&K);
    for(int i=1; i<=M; i++) {
        scanf("%lld",&a[i]);
        swap(id[a[i]], id[a[i]-1]);
    }
    for(int i=1; i<N; i++) go[id[i]] = i;
    for(int i=1; i<N; i++) {
        if(!vs[i]) {
            int now = i;
            vector<int> S;
            while(!vs[now]) {
                vs[now] = 1;
                S.push_back(now);
                now = go[now];
            }
            int sz = S.size();
            for(int i=0; i<sz; i++) {
                ans[S[i]] = S[(i-K%sz+sz)%sz];
            }
        }
    }
    long long s = x[1];
    for(int i=1; i<=N; i++) {
        printf("%lld\n", s);
        s += d[ans[i]];
    }
    return 0;
}


Measured memory_bytes: 6128