akhauriyash/Code-Regression huggingface dataset:
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<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);
}

//↑template↑




ll n, ans = INF, cou;
int main() {
	string h;
	cin >> n >> h;
	vector<ll>lstones, rstones;
	for (int i = 0; i < h.length(); ++i) {
		lstones.push_back(cou);
		if (h[i] == '#') { ++cou; }
	}
	cou = 0;
	for (int i = h.length() - 1; i >= 0; --i) {
		rstones.push_back(cou);
		if (h[i] == '.') { ++cou; }
	}
	reverse(all(rstones));

	for (int i = 0; i < h.length(); ++i) { ans = min(ans, lstones[i] + rstones[i]); }

	cout << ans << endl;






}

Measured memory_bytes: 5108
#include <stdio.h>

int main(void)
{
	int N;
	while(scanf("%d", &N), N){
		N /= 4;
		int sum = 0;
		int a;
		for(int i =0 ; i < N; i++){
			scanf("%d", &a);
			sum += a;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include <iomanip>
using namespace std;

int main(){
    long long int n,m,k,z=0,ans=0;
    cin>>n>>m;
    vector<int>a(1000000);
    vector<int>b(1000000);
    for(int i=0;i<m;i++){
        b[i]=0;
    }
    while(z<n){
        cin>>k;
        for(int i=0;i<k;i++){
            cin>>a[i];
            b[a[i]-1]++;
        }
        z++;
    }
    for(int i=0;i<m;i++){
        if(b[i]==n){
            ans++;
        }
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 8064
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

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

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;

	int n;
	cin>>n;

	if(n&1)
	{
		cout<<0<<endl;
	}
	else
	{
		int x=10,cnt=0;
		while(n/x)
		{
			cnt+=(n/x);
			x*=5;
		}
		cout<<cnt<<endl;
	}
	

}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 305;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
int n, m, P;
int dp[MAXN][MAXN], coef[MAXN][MAXN];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
int main() {
	read(n), read(m), read(P);
	dp[0][0] = coef[0][0] = 1;
	for (int i = 0; i <= n; i++)
	for (int j = 0; j <= n; j++) {
		if (i != 0) update(coef[i][j], coef[i - 1][j]);
		if (j != 0) update(coef[i][j], 1ll * coef[i][j - 1] * (i + 1) % P);
	}
	for (int i = 1; i <= m; i++)
	for (int j = 0; j <= n; j++) {
		for (int k = 0; k <= j; k++)
			update(dp[i][j], 1ll * coef[j - k][k] * dp[i - 1][j - k] % P);
	}
	writeln(dp[m][n]);
	return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
	if(n%2==0){
		cout<<n*n/4;
	}
	else{
		cout<<(n*n-1)/4;
	}
    return 0;
}


Measured memory_bytes: 3624
#include <cstdio>
#include <array>
using namespace std;

static inline int in()
{
    int c, n = 0;
    while ((c = getchar_unlocked()) >= '0' && c <= '9')
		n = 10 * n + (c - '0');
    return n;
}

static inline void out(int n)
{
	static char buf[20];
	char *p = buf;
	if (!n)
		*p++ = '0';
	else
		while (n)
			*p++ = n % 10 + '0', n /= 10;
	while (p != buf)
		putchar_unlocked(*--p);
}

int main()
{
	int n = in(), c = n;
	array<int, 10001> b = {};

	while (n--)
		b[in()]++;

	for (int i = 0; c; i++)
		while (b[i]--) {
			out(i);
			if (--c)
				putchar_unlocked(' ');
		}
	puts("");
}


Measured memory_bytes: 2652
import sys
import collections

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    B = []

    if N == 1:
        print(0)
        exit()

    for i, v in enumerate(A):
        x = v - (i + 1)
        B.append(x)

    B.sort()

    if N & 1:
        b = B[N // 2]
        ans = 0
        for v in B:
            ans += abs(v - b)
        print(ans)
    else:
        b = (B[N // 2] + B[(N // 2) - 1]) // 2
        ans = 0
        for v in B:
            ans += abs(v - b)
        print(ans)


if __name__ == '__main__':
    main()


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

int main(){
    long a,b,k;
    cin >> a >> b >> k;
    if(k <= a){
        cout << a - k << ' ' << b << endl;
    }else if(k >= a + b){
        cout << 0 << ' ' << 0 <<endl;
    }else{
        cout << 0 << ' ' << a + b - k << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	string s;
	cin >> s;

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

	if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var X = int.Parse(Console.ReadLine());

        // A^5 < Xの範囲を算出
        long calc = 0;
        var range = 1;
        while(calc < 10000000000000)
        {
            calc = (long)Math.Pow(range, 5);
            range++;
        }

        var A = 0;
        var B = 0;
        for(int i = -range; i < range; i++)
        {
            for(int j = -range; j < range; j++)
            {
                if((long)(Math.Pow(i, 5) - Math.Pow(j, 5)) == X)
                {
                    A = i;
                    B = j;
                }
            }
        }
        Console.WriteLine($"{A} {B}");
    }
}


Measured memory_bytes: 27852
def main():
    import sys
    input = sys.stdin.readline
    
    a = sorted(input()[:-1])
    # print(a)
    if a[0] == a[1] and a[2] == a[3] and a[1] != a[2]:
        print("Yes")
    else:
        print("No")
    
    return 0

main()

Measured memory_bytes: 2940
#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
  int n,b;
  ll ans = 0;
  cin >> n;
  b = 3*n -1;
  vi v(3*n);
  rep(i,3*n)cin >> v[i];
  sort(v.begin(),v.end());
  rep(i,n){
    vi t(3);
    t[0] = v[i];
    t[1] = v[b];
    b--;
    t[2] = v[b];
    b--;
    sort(t.begin(),t.end());
    ans += t[1];
  }
  P(ans);
}

int main() {
  solve();
  return 0;
}


Measured memory_bytes: 1408
let () =
  let (h, w) = Scanf.scanf "%d %d " (fun h w -> h, w) in
  let n = Scanf.scanf "%d " (fun n -> n) in
  let a = Array.init n (fun _ -> Scanf.scanf "%d " (fun i -> i)) in
  let t = Array.make_matrix h w 0 in
  let rec doit c m = function
    | (i, _) when i = h -> ()
    | (i, j) ->
      if j = w then doit c false (i + 1, j - 1)
      else if j = (-1) then doit c true (i + 1, j + 1)
      else begin
        let c = if a.(c) = 0 then c + 1 else c in
        t.(i).(j) <- c + 1;
        a.(c) <- a.(c) - 1;
        doit c m (i, if m then j + 1 else j - 1)
      end in
  doit 0 true (0, 0);
  for i = 0 to h - 1 do
    for j = 0 to w - 1 do
      Printf.printf (if j = 0 then "%d" else " %d") t.(i).(j)
    done;
    print_newline ()
  done

Measured memory_bytes: 2816
let n, t = Scanf.sscanf (read_line ()) "%d %d" (fun n t -> (n, t))
let ct_arr = Array.init n (fun n ->
                 Scanf.sscanf (read_line ()) "%d %d" (fun c t -> (c, t)))
let cost = Array.fold_left (fun mini (c, t_) ->
               if c < mini && t_ <= t then
                 c
               else mini
             ) 1000000000 ct_arr

let ans = if cost = 1000000000 then
            "TLE"
          else
            Printf.sprintf "%d" cost
let () = print_endline ans;;


Measured memory_bytes: 640
from collections import defaultdict
N = int(input())
dct = defaultdict(int)

for i in range(N):
  s = input()
  sorted_s = "".join(sorted(s))
  dct[sorted_s] += 1

ans = 0
for k, v in dct.items():
  ans += v*(v-1)//2

print(ans)

Measured memory_bytes: 18148
using System;

class Program
{
    static void Main(string[] args)
    {
        var HW = Console.ReadLine().Split();
        var H = int.Parse(HW[0]);
        var W = int.Parse(HW[1]);

        var hw = Console.ReadLine().Split();
        var h = int.Parse(hw[0]);
        var w = int.Parse(hw[1]);

        Console.WriteLine((H - h) * (W - w));
    }
}


Measured memory_bytes: 13268
#include <iostream>
#include <string>
using namespace std;

int main() {
	int H, W, count = 0;
	bool A[8][8] = { "." }, check = true;
	string a;
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> a;
		for (int j = 0; j < W; j++) {
			if (a[j] == '#') A[i][j] = true, count++;
			else A[i][j] = false;
		}
	}
	for (int i = 0, j = 0; i < H && j < W;) {
		if (i == H - 1 && j == W - 1) break;
		if (A[i + 1][j]) i++, count--;
		else if (A[i][j + 1]) j++, count--;
		else { 
			check = false; 
			break;
		}
	}
	if (count > 1) check = false;
	if (check) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int X;
	int fif_num, five_num;

	cin >> X;

	fif_num = X / 500;
	X %= 500;
	five_num = X / 5;

	cout << fif_num * 1000 + five_num * 5 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000000+7;
static const double PI = 3.141592653589793;

long long modpow(long long x, long long n, long long mod = 0) {
  if (mod == 0) {
    long long res=1;
    while (n > 0) {
      if (n%2 == 1) {
        res = ( res*x );
      }
      x = (x*x);
      n /= 2;
    }
    return res;
  }

  long long res=1;
  while (n > 0) {
    if (n%2 == 1) {
      res = ( res*x ) % mod;
    }
    x = (x*x) % mod;
    n /= 2;
  }
  return res;
}

long long modinverse(long long x, long long mod) {
  // mod must be prime number.
  return modpow(x, mod-2, mod);
}

// メモリ不足に注意！
vector<long long> vecmodfact(2,1);
long long modfact(long long n, long long mod) {
  std::size_t n_size_t = n;
  if (vecmodfact.size()-1 >= n_size_t) return vecmodfact.at(n);
  std::size_t i=vecmodfact.size();
  vecmodfact.resize(n+1);
  for (; i<=vecmodfact.size()-1; i++) {
    vecmodfact.at(i) = vecmodfact.at(i-1)*i % mod;
  }
  return vecmodfact.at(n);
}

long long modcomb(long long m, long long n, long long mod){
  if (m < n || n < 0) return 0;
  if (n == 0 || n == m) return 1;
  long long ans = modfact(m,mod) * modinverse(modfact(n,mod), mod) % mod;
  ans = ans * modinverse(modfact(m-n,mod), mod) % mod;
  return ans;
}

map<int, int> prime_factors(long long n) {
  map<int, int> res;
  if (n <= 1) return res;
  for (int i=2; i*i<=n; i++) {
    while (n%i==0) {
      ++res[i];
      n /= i;
    }
  }
  if (n != 1) ++res[n];
  return res;
}

int main() {
  int x1, x2, x3, x4, x5;
  for (int i=1; i<6; ++i) {
    int x;
    cin >> x;
    if (x == 0) {
      cout << i << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3488
n, m = map(int, input().split())
A = list(map(int, input().split()))

dp = [-1] * (n+1)
dp[0] = 0
cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]

for i in range(n+1):
    if dp[i] == -1: continue
    for a in A:
        #print(dp[i], a)
        if i+cost[a] <= n:
            dp[i+cost[a]] = max(dp[i+cost[a]], dp[i]*10+a)

print(dp[-1])

Measured memory_bytes: 14692
using System;

namespace AGC030_A
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int a = int.Parse(input[0]);
			int b = int.Parse(input[1]);
			int c = int.Parse(input[2]);

			int count = 0;
			if (b >= c)
			{
				count += b + c;
			}
			else
			{
				count += b * 2;
				c -= b;
				if (a >= c) count += c;
				else count += a + 1;
			}
			
			
			Console.WriteLine(count);
		}
	}
}


Measured memory_bytes: 13268
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<utility>
#include<string>
#include<map>
#include<unordered_map>
#include<queue>

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; }

using namespace std;

typedef long long ll;
typedef pair<int, int> Pi;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}

int main(){
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> t(n);
    for(int i = 0; i < n; i++) cin >> t[i];

    ll bus = 0;
    int r = 0, l = 0;
    sort(t.begin(), t.end());
    while(l < n){
        ll pass = 0;
        while(t[l] + k >= t[r] && r < n && pass+1 <= c){
            r++;
            pass++;
        }
        bus++;
        // cout << "l r bus" << l << r << bus << endl;
        l = r;
    }

    cout << bus << endl;
    return 0;
}


Measured memory_bytes: 3684
# 配るDP
N,K= map(int,input().split())
h_list = list(map(int,input().split()))
INF = 10**9 + 7
DP = [INF]*N
DP[0] = 0
for i in range(N):
    for k in range(1,K+1):
        if i+k >= N:
            continue
        DP[i+k] = min(DP[i+k],DP[i]+abs(h_list[i]-h_list[i+k]))  
print(DP[-1])



Measured memory_bytes: 52448
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#include <thread>
#include <atomic>
#include <mutex>
#include <future>
#define int long long
#define endre getchar();getchar();return 0
#define INF 1000000007
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, cnt;
int dfs(int x, bool b3, bool b5, bool b7) {
	if (x > n)return cnt;
	if (b3&&b5&&b7)cnt++;
	dfs(x * 10 + 3, true, b5, b7);
	dfs(x * 10 + 5, b3, true, b7);
	dfs(x * 10 + 7, b3, b5, true);
	return cnt;
}
signed main() {
	cin >> n;
	cout << dfs(0, false, false, false) << endl;
	endre;
}


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

long long const MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    long long cnt_a[100100] = {0};
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        cnt_a[a]++;
    }

    long long cnt_b[100100] = {0};
    for (int i = 0; i < n; i++) {
        int b = abs(i - (n - (i + 1))); //abs(left - right)
        cnt_b[b]++;
    }

    for (int i = 0; i < n; i++) {
        if (cnt_a[i] != cnt_b[i]) {
            cout << 0 << endl;
            return 0;
        } 
    }

    long long ans = 1;
    for (int i = 1; i <= n / 2; i++) {
        (ans *= 2) %= MOD;
    }
    //(ans = pow(2, n / 2)) %= MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>

using namespace std;
//for (int i = 0; i < N; i++){}


int main() {
    long long x;
	cin >> x;

    long long res = 0;
    if(x%11 > 6){
        res = 2*(x/11) + 2;
    }else if(x%11==0){
        res = 2*(x/11);
    }
    else{
        res = 2*(x/11) + 1;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	static final boolean stdin = true;
	static final String filename = "";
	static FastScanner br;
	static PrintWriter pw;

	public static void main(String[] args) throws IOException {

		if (stdin) {
			br = new FastScanner();
			pw = new PrintWriter(new OutputStreamWriter(System.out));
		}

		else {
			br = new FastScanner(filename + ".in");
			pw = new PrintWriter(new FileWriter(filename + ".out"));
		}

		X solver = new X();
		solver.solve(br, pw);
	}

	static class X {
		public void solve(FastScanner br, PrintWriter pw) throws IOException {
			
			int N = br.nextInt();
			int W = br.nextInt();
			
			int[] w = new int[N];
			int[] v = new int[N];
			
			for(int i = 0; i < N; i++) {
				w[i] = br.nextInt();
				v[i] = br.nextInt();
			}
			
			long[][] dp = new long[N+1][100001];
			
			for(int i = 0; i <= N; i++) {
				for(int j = 0; j <= 100000; j++) {
					dp[i][j] = Integer.MAX_VALUE;
				}
			}
			
			dp[0][0] = 0;
			
			for(int i = 1; i <= N; i++) {
				for(int j = 0; j <= 100000; j++) {
					if(j-(v[i-1]) >= 0) {
						dp[i][j] = Math.min(dp[i-1][j], dp[i-1][j-v[i-1]]+w[i-1]);
					}
					else {
						dp[i][j] = dp[i-1][j];
					}
				}
			}
			
			long ans = 0;
			
			for(int i = 0; i <= 100000; i++) {
				if(dp[N][i] <= W) {
					ans = Math.max(ans, i);
				}
			}
			
			pw.println(ans);
			pw.close();
		}

	}

	//fastscanner class
	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(nextToken());
		}

		long nextLong() {
			return Long.parseLong(nextToken());
		}

		double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

}
 



Measured memory_bytes: 128208
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
#define mp make_pair
typedef long long ll;
int main(){
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		int n = stdIn.nextInt();

		List<Range> ranges = new ArrayList<>();
		IntStream.range(0, n).forEach(i -> ranges.add(new Range(stdIn.nextInt(), stdIn.nextInt())));

		stdIn.close();

		if(ranges.size() % 2 == 1) {
			ranges.sort(Comparator.comparing(Range::getA));
			int min = ranges.get(ranges.size()/2).getA();

			ranges.sort(Comparator.comparing(Range::getB).reversed());
			int max = ranges.get(ranges.size()/2).getB();

			System.out.println(max - min + 1);
			return;
		}

		ranges.sort(Comparator.comparing(Range::getA));
		int minN = ranges.get((ranges.size()-1)/2).getA();
		int minN1 = ranges.get((ranges.size()-1)/2 + 1).getA();

		ranges.sort(Comparator.comparing(Range::getB).reversed());
		int maxN = ranges.get((ranges.size()-1)/2).getB();
		int maxN1 = ranges.get((ranges.size()-1)/2 + 1).getB();

//
//		int nCnt = maxN - minN + 1;
//		int n1Cnt = maxN1 - minN1 + 1;
//
//		int dupl = Integer.max(0, maxN - minN1 + 1);

		System.out.println(maxN+maxN1-minN-minN1+1);

	}
}

class Range {
	private int a;
	private int b;


	public Range(int a, int b) {
		super();
		this.a = a;
		this.b = b;
	}


	public int getA() {
		return a;
	}
	public int getB() {
		return b;
	}

	public int getRange() {
		return a + b - 1;
	}

	@Override
	public String toString() {
		return "Range [a=" + a + ", b=" + b + "]";
	}


}

Measured memory_bytes: 69056
//#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<set>
#include<queue>
#include<tuple>
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
using namespace std;
set<int>s;
int main() {
    speed_up;
    ll a, b;
    cin >> a >> b;
    a = a % b;
    b = abs(a - b);
    cout << min(a, b);
}


Measured memory_bytes: 256
def main():
    N, M, K = list(map(int, input().split()))
    mod = 998244353
    r = 0
    m = 1
    inv = [0] * (N + 1)
    inv[1] = 1
    for i in range(2, N + 1):
        inv[i] = inv[mod % i] * ((mod - mod // i) % mod)
    for i in range(K + 1):
        if i > 0:
            m = (m * (N - i) * inv[i]) % mod
        r += M * pow(M - 1, N - i - 1, mod) * m

    return r % mod

print(main())


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<ll> h(n);
	rep(i, n) cin >> h[i];
	int res = 0;
	for (int i = n - 1; i >= 1 ; i--) {
		if (h[i - 1] == h[i] + 1) {
			h[i - 1]--;
		}
		else if (h[i - 1] > h[i]) {
			res++;
		}
	}

	if (res == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 1024
n, k = map(int, input().split())
mod = 10**9+7
ans = 0
for i in range(k, n+2):
    min_ = (i-1)*i//2
    max_ = n*(n+1)//2 - (n-i)*(n-i+1)//2
    #print(i, min_, max_)
    ans += (max_-min_+1)%mod
print(ans%mod)


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

int main(){
  int a, b, C;
  double S, L, h;
  double rad, c;
  double PI = acos(-1);
  
  cin >> a >> b >> C;
  rad = C * PI / 180;
  c = sqrt(pow(a, 2)+pow(b, 2)-2*a*b*cos(rad));
  
  S = a * b * sin(rad) / 2;
  L = a + b + c;
  h = b*sin(rad);
  
  printf("%lf\n%lf\n%lf\n", S, L, h);
  
  return 0;
}


Measured memory_bytes: 3520
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
/*---------------------DEBUGGING------------------------------------*/
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
/*-------------------------------------------------------------------------------------*/
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define pcc pair<char,char>
#define F first
#define S second
#define int long long
#define pi 3.141592653589793238462643383279502
#define M   998244353    //1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define N 100005
#define vi vector<int>

signed main()
{
   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int h,a;
   cin>>h>>a;
   if(h%a==0)
    cout<<h/a<<endl;
   else
    cout<<h/a +1 <<endl;

}


Measured memory_bytes: 256
def hinan():
    ans ,houi ,vector = [] ,[[0 ,1] ,[-1 ,0] ,[0 ,-1] ,[1 ,0] ,[0 ,1] ,[-1 , 0] ,[1 ,0]] ,["E" ,"N" ,"W" ,"S"]
    while True:
        n = raw_input().split(" ")
        if n == ["0" ,"0"]:
            for an in ans:
                print an
            break
        else:
            xs =[[] ,[] ,[]]
            for i in range(int(n[1])):
                n = raw_input()
                xs = [xs[l] + [[[i ,j] for j in range(len(n)) if n[j] != "#"] ,[[[i ,j] ,houi[vector.index(n[j])]] for j in range(len(n)) if n[j] in vector] ,[[i ,j] for j in range(len(n)) if n[j] == "X"]][l] for l in range(3)]
            for time in range(181):
                if len(xs[1]) == 0:
                    ans.append(time)
                    break
                else:
                    for i in xs[1]:
                        where = [l[0] for l in xs[1]]
                        if len([k for k in [[i[0][l] + houi[houi.index(i[1]) - 1 + j][l] for l in range(2)] for j in range(4)] if k in xs[0] and not k in where]) > 0:
                            i[1] = [[k for k in [[i[0][l] + houi[houi.index(i[1]) - 1 + j][l] for l in range(2)] for j in range(4)] if k in xs[0] and not k in where][0][s] - i[0][s] for s in range(2)]
                    go_point = [[i[0][l] + i[1][l] for l in range(2)] for i in xs[1]]
                    for i in range(len(go_point)):
                        if go_point[i] in where or not go_point[i] in xs[0]:
                            go_point[i] = xs[1][i][0]
                        else:
                            if go_point.count(go_point[i]) > 1:
                                for j in range(4):
                                    if xs[1][i] == [[go_point[i][l] + houi[j][l] for l in range(2)] ,houi[j + 2]]:
                                        break
                                    elif [[go_point[i][l] + houi[j][l] for l in range(2)] ,houi[j + 2]] in xs[1]:
                                        go_point[i] = xs[1][i][0]
                                        break
                    else:
                        xs[1] = [k for k in [[go_point[i] ,xs[1][i][1]] for i in range(len(xs[1]))] if not k[0] in xs[2]]
            else:
                ans.append("NA")
hinan()

Measured memory_bytes: 4484
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

def pprint(ans):
    for a in ans:
        print(a)

N,x = LI()

if N == 2:
    if x == 2:
        print('Yes')
        pprint([1,2,3])
    else:
        print('No')
else:
    if x in [1,2*N-1]:
        print('No')
    elif x == 2*N-2:
        ans = [0]*(2*N-1)
        ans[N-3],ans[N-2],ans[N-1],ans[N] = 2*N-4,2*N-1,2*N-2,2*N-3
        left = list(range(1,2*N-4))
        for i in range(2*N-1):
            if not ans[i]:
                ans[i] = left.pop()
        print('Yes')
        pprint(ans)
    else:
        ans = [0]*(2*N-1)
        ans[N-3],ans[N-2],ans[N-1],ans[N] = x+1,x-1,x,x+2
        left = list(range(1,x-1)) + list(range(x+3,2*N))
        for i in range(2*N-1):
            if not ans[i]:
                ans[i] = left.pop()
        print('Yes')
        pprint(ans)

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

int main(){
  int X;
  for (int i = 1; i < 10001; i++){
    cin >> X;
    if (X == 0){
      break;
    }
    else{
      cout << "Case" << " " << i << ": " << X << endl;
    }
  }
}



Measured memory_bytes: 3096
def main():
    H, W = (int(_) for _ in input().split())
    board = [input() for _ in range(H)]
    num = 0
    for i in range(H):
        for j in range(W):
            if board[i][j] == '#': num += 1

    def dfs(x, y, n):
        if x == H-1 and y == W-1: return n == num
        nx = x + 1
        if 0 <= nx < H and board[nx][y] == '#':
            if dfs(nx, y, n+1):
                return True
        ny = y + 1
        if 0 <= ny < W and board[x][ny] == '#':
            if dfs(x, ny, n+1):
                return True
        return False

    print('Possible' if dfs(0, 0, 1) else 'Impossible')
    return

if __name__ == '__main__':
    main()


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int xo;
int a[100010];
int cnt[32];
int ret = 0;

int main() {
	cin >> N;

	rep(i, N) {
		cin >> a[i];
		int num = __builtin_ctz(a[i]);
		++cnt[num];

		xo ^= a[i]-(1<<num);
	}

	for (int i = 30; i >= 0; --i) {
		if (cnt[i] == 0) continue;

		int mask = (1 << i) - 1;
		bool ch = ((xo >> i) & 1) != (cnt[i] & 1);

		if (!ch) {
			if (cnt[i] & 1) {
				xo ^= (1 << i);
			}
		} else {
			xo ^= mask;
			--cnt[i];
			++ret;
			if (cnt[i] & 1) {
				xo ^= (1 << i);
			}
		}
	}

	if (xo == 0) cout << ret << endl;
	else puts("-1");

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define __ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define N 200005

using namespace std;

int main()
{   __

    int n,a;

    cin >> n >> a;

    if(n%a==0) cout << n/a;

    else cout << (n/a)+1;

    return 0;
}




Measured memory_bytes: 256
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let h: usize = s.next().unwrap().parse().unwrap();
	let w: usize = s.next().unwrap().parse().unwrap();
	let k: i32 = s.next().unwrap().parse().unwrap();
	let sy = s.next().unwrap().parse::<usize>().unwrap() - 1;
	let sx = s.next().unwrap().parse::<usize>().unwrap() - 1;
	let gy = s.next().unwrap().parse::<usize>().unwrap() - 1;
	let gx = s.next().unwrap().parse::<usize>().unwrap() - 1;
	let field: Vec<Vec<_>> = s.take(h).map(|s| s.chars().collect()).collect();

	let mut dist = vec![vec![[std::i32::MAX; 4]; w]; h];
	use std::cmp::Reverse;
	let mut q = std::collections::BinaryHeap::new();
	q.push((Reverse(0), sy, sx, 4));
	while let Some((Reverse(cost), y, x, d)) = q.pop() {
		for &(ny, nx, nd) in [
			(y, x + 1, 0),
			(y.wrapping_sub(1), x, 1),
			(y, x.wrapping_sub(1), 2),
			(y + 1, x, 3),
		]
		.iter()
		.filter(|&&(ny, nx, _)| (y, x) != (ny, nx) && ny < h && nx < w && field[ny][nx] == '.')
		{
			if d == nd {
				if cost + 1 < dist[ny][nx][nd] {
					dist[ny][nx][d] = cost + 1;
					q.push((Reverse(cost + 1), ny, nx, d));
				}
			} else {
				let nc = 1 + (cost + k - 1) / k * k;
				if nc < dist[ny][nx][nd] {
					dist[ny][nx][nd] = nc;
					q.push((Reverse(nc), ny, nx, nd));
				}
			}
		}
	}
	let ans = dist[gy][gx]
		.iter()
		.map(|&d| {
			if d == std::i32::MAX {
				std::i32::MAX
			} else {
				(d + k - 1) / k
			}
		})
		.min()
		.unwrap();
	if ans == std::i32::MAX {
		println!("-1");
	} else {
		println!("{}", ans);
	}
}


Measured memory_bytes: 31128
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

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

void foo(int& i, int& x, int& y, int& d, int l, vector< vector<int> >& a, vector<int>& X, vector<int>& Y) {
	while (l--) {
		a[y][x] = i;
		X[i] = x; Y[i] = y;
		x += dx[d]; y += dy[d];
		i++;
	}
	d = (d + 3) % 4;
}

i_i bar(int i, int m, vector< vector<int> >& a, vector<int>& X, vector<int>& Y, vector<bool>& p, vector<i_i>& memo) {
	if (i > m) return i_i(0, 0);
	if (memo[i].first >= 0) return memo[i];
	int x = X[i], y = Y[i];
	int j;
	i_i maxi = i_i(0, 0);
	j = a[y + 1][x - 1]; maxi = max(maxi, bar(j, m, a, X, Y, p, memo));
	j = a[y + 1][x]; maxi = max(maxi, bar(j, m, a, X, Y, p, memo));
	j = a[y + 1][x + 1]; maxi = max(maxi, bar(j, m, a, X, Y, p, memo));
	if (p[i] && maxi.first == 0)
		return memo[i] = i_i(1, i);
	return memo[i] = i_i(maxi.first + p[i], maxi.second);
}

int main() {
	vector< vector<int> > a(2000, vector<int>(2000, INT_MAX));
	vector<int> X(2000001), Y(2000001);
	int i = 1, x = 1000, y = 1000, d = 2, l = 1;
	while (i <= 1000000) {
		foo(i, x, y, d, l, a, X, Y);
		foo(i, x, y, d, l, a, X, Y);
		l++;
		foo(i, x, y, d, l, a, X, Y);
		foo(i, x, y, d, l, a, X, Y);
		l++;
	}
	vector<bool> p(1000001, true);
	p[1] = false;
	for (int i = 2; i <= 1000000; i++)
		if (p[i])
			for (int j = i * 2; j <= 1000000; j += i)
				p[j] = false;
	for (;;) {
		int m, n; cin >> m >> n;
		if (m == 0) break;
		vector<i_i> memo(1000001, i_i(-1, -1));
		i_i ans = bar(n, m, a, X, Y, p, memo);
		cout << ans.first << ' ' << ans.second << endl;
	}
}

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

int main(){
    vector<string> ans = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string s;
    cin >> s;
    for (int i = 0; i < 7; i++){
        if (s == ans[i]){
            cout << 7 - i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	string t[4] = { "dream","dreamer","erase","eraser" };
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	REP(i, 4) reverse(t[i].begin(), t[i].end());

	bool can = true;
	for (int i = 0; i < s.size();) {
		bool can2 = false;
		REP1(j, 4) {
			string d = t[j];
			if (s.substr(i, d.size()) == d) {
				can2 = true;
				i += d.size();
			}
		}
		if (!can2) {
			can = false;
			break;
		}
	}
	if (can) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 512
#include"bits/stdc++.h"
#define rep(i,n) for(ll i=0;i<n;++i)
#define ALL(x) x.begin(),x.end()

using namespace std;
typedef long long ll;

template<typename T>
T gcd(T a, T b) {
	if (a % b == 0) {
		return(b);
	}
	else {
		return(gcd(b, a % b));
	}
}

template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

int main(void) {
	int n;
	cin >> n;
	n %= 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
		cout << "hon";
	}
	else if (n == 3) {
		cout << "bon";
	}
	else {
		cout<<"pon";
	}
}

/*

*/


Measured memory_bytes: 3672
#include<stdio.h>

int main()
{
	long long n,sum=0;
	
	scanf("%lld",&n);
	
	for(long long i=1;i<=n;i++)
	{
		if(i%3==0 || i%5==0)
			continue;
		else
			sum+=i;
	}
	
	printf("%lld",sum);
	
	return 0;
}

Measured memory_bytes: 1732
#include <stdio.h>
#include <math.h>
 
int main(void) {
double a, b, c, d, e, f, x, y;
while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) > 0) {
x = (c * e - b * f) / (a * e - b * d);
y = (a * f - c * d) / (a * e - b * d);
if (x == -0.0) x = 0.0;
if (y == -0.0) y = 0.0;
printf("%01.3lf %01.3lf\n", x, y);
}
 
 
 
return 0;
}

Measured memory_bytes: 1080
a,b,c = sorted(map(int,input().split()))



if a%2 == b%2:
  t1 = (b-a) // 2
  t2 = c - b
  print(t1 + t2)

else:
  t1 = (b-a) // 2
  t1 += 1
  t2 = c + 1 - b
  print(t1+t2)

  

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

#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 LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


LL num[51];
LL ps[51];

LL solve(LL n, LL x) {
  if (n == 0 && x <= 0) return 0;
  else if (x == num[n]) return ps[n];
  else if (x < num[n] / 2 + 1) return solve(n - 1, x - 1);
  else if (x == num[n] / 2 + 1) return solve(n - 1, num[n] / 2 - 1) + 1;
  else return solve(n - 1, num[n] / 2 - 1) + 1 + solve(n - 1, x - (num[n] / 2 + 1));
}

int main(){
  LL n, x;
  cin >> n >> x;

  num[0] = 1;
  FOR (i, 1, n + 1) {
    num[i] = num[i - 1] * 2 + 3;
  }

  ps[0] = 1;
  FOR (i, 1, n + 1) {
    ps[i] = ps[i - 1] * 2 + 1;
  }

  cout << solve(n, x) << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, m, a[111][111], b[55][55];
void rotate() {
	int z[55][55];
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			z[i][j] = b[m - j - 1][i];
		}
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < m; j++) {
			b[i][j] = z[i][j];
		}
	}
}
int main() {
	while (cin >> n >> m, n | m) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				cin >> a[i][j];
			}
		}
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < m; j++) {
				cin >> b[i][j];
			}
		}
		int rx = n, ry = n;
		for (int i = 0; i < 4; i++) {
			int sx = m;
			for (int j = m - 1; j >= 0; j--) {
				if (b[0][j] != -1) sx = j;
			}
			for (int j = 0; j <= n - m; j++) {
				for (int k = 0; k <= n - m; k++) {
					bool flag = true;
					for (int ey = j; ey < j + m; ey++) {
						for (int ex = k; ex < k + m; ex++) {
							int v = b[ey - j][ex - k];
							if (v != -1 && a[ey][ex] != v) flag = false;
						}
					}
					if (flag && (ry > j || (ry == j && rx > k + sx))) {
						rx = k + sx, ry = j;
					}
				}
			}
			rotate();
		}
		if (rx == n && ry == n) cout << "NA" << endl;
		else cout << rx + 1 << ' ' << ry + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
#define MAXN 2550
#define pii pair<int, int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x < n and y >= 0 and y < n)
using namespace std;
const ll mod = 1e9 + 7;


int main() {
    ios_base::sync_with_stdio(false);
    int a, b;

    cin >> a >> b;

    cout << max(0, a - 2*b) << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(ll i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B;
    cin>>A>>B;
    cout<<(A<=9&B<=9?A*B:-1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <math.h>

#define PI acos(-1)
using namespace std;

int main()
{
	double A, B, H, M;
	cin >> A >> B >> H >> M;

	double angle_A = (H * 60 + M) * PI / 360;
	double angle_B = M * PI / 30;
	double angle_C = angle_A - angle_B;

	cout << fixed << setprecision(12) << sqrt(A*A + B*B - 2*A*B * cos(angle_C)) << endl;
	return 0;
}

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

typedef long long ll;
//loop
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//STL
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

//const
#define MOD 1000000007 //10^9+7:合同式の法

//acronym
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

void Main() {
    string a,b,c;
    cin>>a>>b>>c;
    char s1 = a[0] + ('A' - 'a');
    char s2 = b[0] + ('A' - 'a');
    char s3 = c[0] + ('A' - 'a');
    string ans = {s1, s2, s3};
    cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	Main();
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, C, s, t, c, stc[40][114514];
	cin>>n>>C;
	int m1, m2;
	REP(i, n){
		cin>>s>>t>>c;
		FOR(j, s-1, t){
			stc[c-1][j]=1;
		}
		m1=min(m1, s-1);
		m2=max(m2, t);
	}
	int ans=0;
	FOR(i, m1, m2){
		int cnt=0;
		REP(j, C){
			cnt+=stc[j][i];
		}
		ans=max(ans, cnt);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 15488
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let x: usize = iter.next().unwrap().parse().unwrap();
    let a: usize = iter.next().unwrap().parse().unwrap();

    println!("{}", if x < a { 0 } else { 10 });
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            return Math.Max(0, N - consoleReader.Int);
        }

        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    static class Ext
    {
        public static Dictionary<TKey, int> GroupCount<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) => source.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Count());
        public static Dictionary<TKey, int> GroupCount<TKey>(this IEnumerable<TKey> source) => source.GroupCount(i => i);
    }
    public class ConsoleReader { private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries); private string[] line = Array.Empty<string>(); private int linePosition; private TextReader textReader; public ConsoleReader(TextReader tr) { textReader = tr; } public int Int => int.Parse(String); public long Long => long.Parse(String); public double Double => double.Parse(String); public string String { get { if (linePosition >= line.Length) { linePosition = 0; line = ReadLineSplit(); } return line[linePosition++]; } } public class SplitLine { private string[] splited; public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); } public int[] Int => String.Select(x => int.Parse(x)).ToArray(); public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray(); public long[] Long => String.Select(x => long.Parse(x)).ToArray(); public double[] Double => String.Select(x => double.Parse(x)).ToArray(); public string[] String => splited; } public SplitLine Split => new SplitLine(this); public class RepeatReader : IEnumerable<ConsoleReader> { ConsoleReader cr; int count; public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; } public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator(); System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator(); public IEnumerable<string> String => this.Select(cr => cr.String); public IEnumerable<int> Int => this.Select(cr => cr.Int); public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1); public IEnumerable<long> Long => this.Select(cr => cr.Long); public IEnumerable<double> Double => this.Select(cr => cr.Double); } public RepeatReader Repeat(int count) => new RepeatReader(this, count); }
    #endregion
}

Measured memory_bytes: 11220