akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template<class _T> static void getint(_T& a) {
	if (sizeof(_T) > sizeof(int)) {
		scanf("%lld", &a);
	}
	else {
		scanf("%d", &a);
	}
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int N;
	get(N);

	int now = 0, start = 0;
	int end = N;
	std::string ans;

	printf("%d\n", now);
	fflush(stdout);
	get(ans);
	std::string even = ans;
	std::string odd = "Female";
	if (even == odd) odd = "Male";

	while (ans != "Vacant") {
		now = (start + end) / 2;

		printf("%d\n", now);
		fflush(stdout);
		get(ans);

		if (((now % 2) && (ans == odd)) || ((now % 2 == 0) && (ans == even))) {
			start = now;
		}
		else {
			end = now;
		}
	}
}


Measured memory_bytes: 3852
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  if(s.size() > t.size()){
    cout << "No" << endl;
    return 0;
  }
  string tmp = t.substr(0, int(s.size()));
  if(tmp == s && t.size() - 1 == s.size()) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 3616
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=105;
int n,a[MAXN*2],Ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=2*n;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+2*n+1);
	for(int i=2*n-1;i>=1;i-=2)
		Ans+=a[i];
	printf("%d\n",Ans);
}


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int A = 0, B = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0)
      A += a[i];
    else
      B += a[i];
  }
  cout << A - B << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
   
public class Main {
  public static void main(String[] args) throws Exception {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] inputs = br.readLine().split(" ");
    int w = Integer.parseInt(inputs[0]), h = Integer.parseInt(inputs[1]);
    int x = Integer.parseInt(inputs[2]), y = Integer.parseInt(inputs[3]), r = Integer.parseInt(inputs[4]);

    if (x - r >= 0 && x + r <= w && y - r >= 0 && y + r <= h) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}

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

using namespace std;
typedef long long ll;
#define int ll
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FOR(i, a, b) for (int i = a; i < b; ++i)

typedef pair<int, int> pii;
typedef pair<double, int> pdi;

const int INF = 1000 * 1000 * 1000 + 10;
const ll INFLL = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000 * 2;

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

int lower(int a, int b, int val) {
    return (a + val - 1) / val;
}

int upper(int a, int b, int val) {
    return b / val;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int val = c * d / gcd(c, d);

    int k = max(0ll, upper(a, b, c) - lower(a, b, c) + 1);
    int l = max(0ll, upper(a, b, d) - lower(a, b, d) + 1);
    int m = max(0ll, upper(a, b, val) - lower(a, b, val) + 1);

    cout << (b - a + 1) - (k + l - m);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
LL MOD = 1e9 + 7;
void solve(int u, int p, auto &G, auto &dp) {
    for (auto &v : G[u]) {
        if (v == p) continue;
        solve(v, u, G, dp);
        (dp[u] *= (1 + dp[v])) %= MOD;
    }
}
void solve2(int u, int p, LL pre, auto &G, auto &dp, auto &ans) {
    vector<int> ids;
    for (auto &v : G[u]) {
        if (v == p) continue;
        ids.push_back(v);
    }
    int n = ids.size();
    vector<LL> preM{1}, sufM{1};
    for (int i = 0 ; i < n ; i++)
        preM.push_back(preM.back() * (dp[ids[i]] + 1) % MOD);
    for (int i = n - 1 ; i >= 0 ; i--)
        sufM.push_back(sufM.back() * (dp[ids[i]] + 1) % MOD);
    ans[u] = preM.back() * (pre + 1) % MOD;
    for (int i = 0 ; i < n ; i++) {
        int v = ids[i];
        solve2(v, u, preM[i] * sufM[n - i - 1] % MOD * (pre + 1) % MOD, G, dp, ans);
    }
}
void marmot0814() {
    int n; cin >> n >> MOD;
    vector<vector<int>> G(n);
    for (int i = 1 ; i < n ; i++) {
        int u, v; cin >> u >> v; u--, v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    vector<LL> dp(n, 1);
    solve(0, 0, G, dp);
    vector<LL> ans(n, 1);
    solve2(0, 0, 0, G, dp, ans);
    for (int i = 0 ; i < n ; i++)
        cout << ans[i] << '\n';
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int t = 1, kase = 0; // cin >> t;
    while (t--) {
        // cout << "Case #" << ++kase << ":";
        marmot0814();
    }
}

Measured memory_bytes: 32972
#include<bits/stdc++.h>
using namespace std;
#define ssd ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug_x(x) cout<< #x <<"---> : "<<x<<endl;
#define debug_ve(x) for(auto it: x) cout<<it<<" ";
#define rep(i,a,n) for (int i=a;i<n;i++)
#define _rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> PII;
typedef double db;
//std::mt19937 mrand(random_device{}());
//int rnd(int x) { return mrand() % x ; }
const ll mod=1e7;
ll ksm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

/***********************/

int main(){
    ssd;
    string s;
    cin>> s;
    if(s[2] == s[3] && s[4] == s[5]) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;
const ll mod = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  if (s[2] == s[3] && s[4] == s[5]) {
	  cout << "Yes" << endl;
	} else {
	  cout << "No" << endl;
	}
  return 0;
}


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

int main()
{
	ll n,i,j,no;
	cin>>n;
	ll ans=0;
	vector<ll> vec;
	ll maxm=-1;
	for(i=0; i<n; i++)
	{
      cin>>no;
      vec.push_back(no);
      maxm=max(no,maxm);
	}
	unordered_map<ll,ll>m;
	for(i=0; i<n;i++)
	{
		for(j=vec[i]; j<=maxm; j+=vec[i])
		{
			m[j]+=1;
		}
	}
	for(i=0; i<n; i++)
	{  
		if(m[vec[i]]<=1)
			ans++;
	}
	cout<<ans;
	return 0;
}

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

void solve(){
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    map<ll, ll> mp;
    REP(i, N) mp[A[i]]++;

    ll dp[200000] = {0};
    REP(k,N){
        ll index = mp[A[k]];
        if(dp[index]==0){
            mp[A[k]]--;
            ll res = 0;
            for(auto it=mp.begin(); it!=mp.end(); it++){
                ll tmp = it->second;
                res += tmp*(tmp-1)/2;
                //cout << res << endl;
            }
            dp[index] = res;
            mp[A[k]]++;
        }
        cout << dp[index] << endl;
    }
}

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

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int l;
    cin>>l;
    double a= 1.0*l/3;
    cout << std::fixed;
    cout << std::setprecision(10);
    cout << a*a*a << endl;
    return 0;
}

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

int main(void) {

	int N, i, j,count=0, tmp;
	int p[50]={0};
	int p_sort[50] = {0};

	scanf("%d", &N);

	for(i = 0; i < N; i++){
		scanf("%d",&p[i]);
	}

	for(i = 0; i < N; i++){
		p_sort [i] =p[i];
	}

	for(i = 0; i < N-1; i++){
		for(j = i+1; j < N; j++){
			if(p_sort[i] > p_sort[j]){
				tmp = p_sort[i];
				p_sort[i] = p_sort [j];
				p_sort[j] = tmp;
			}
		}
	}

	for(i = 0; i < N; i++){
		if(p[i] != p_sort[i] )
			count++;
	}

	if(count ==0 || count ==2){
		printf("YES");
	}else{
		printf("NO");
	}

	return EXIT_SUCCESS;
}

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


int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if( (a==b && b!=c) || (a==c && b!=c) || (b==c && a!=b) ) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Data.List

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  [n,k] <- getParms
  as    <- getParms
  print $ f n k as

f :: Int -> Int -> [Int] -> Int
f n k as 
  | k >= l = 0
  | k <  l = g as'' (l-k) 0
  where
    as'  = group . sort $ as
    l    = length as'
    as'' = sortOn length as'

    g :: [[Int]] -> Int -> Int -> Int
    g _      0 x = x
    g (b:bs) k x = g bs (k-1) (x + length b)

Measured memory_bytes: 44412
#include <iostream>
#include<string>
using namespace std;
int main()
{
	string a;
	int mark = 0;
	cin >> a;
	while (a.length() != 0)
	{
		if (a.substr(0, 6) == "eraser")
		{
			a.erase(0, 6);
		}
		else if (a.substr(0, 7) == "dreamer"&&a.substr(5, 5)!="erase")
		{
			a.erase(0, 7);
		}
		else if (a.substr(0, 5) == "dream" || a.substr(0,5) == "erase")
		{
			a.erase(0,5);
		}
		else
		{
			mark = 1;
			cout << "NO";
			break;
		}
	}
	if (mark == 0)
		cout << "YES";
}




Measured memory_bytes: 3752
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n, x, y; cin >> n >> x >> y;
	--x, --y;
	vector<vector<int>> v(n, vector<int>(n, 0));
	rep(i, n)
	{
		for (int j = i + 1; j < n; ++j)
		{
			v[i][j] = min({ j - i , abs(x - i) + 1 + abs(y - j),abs(y - i) + 1 + abs(x - j) });
		}
	}
	vector<int> res(n, 0);
	rep(i, n)for (int j = i + 1; j < n; ++j)++res[v[i][j]];
	for (int i = 1; i < n; ++i)cout << res[i] << endl;
}

Measured memory_bytes: 16000
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
// const lint MOD = 998244353;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int lcm(int x, int y){
	int g = gcd(x,y);
	return x/g*y;
}

int facctorialMethod(int k){
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum = (sum%MOD*i%MOD)%MOD;
    }
    return sum;
}

int main(){
	ll x; cin >> x;
	if (x%11){
		if (x%11 > 6){
			cout << (x/11)*2 + 2 << endl;
		}else{
			cout << (x/11)*2 + 1 << endl;
		}
	}else{
		cout << (x/11)*2 << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 10
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
int n,A[N];
int solve(){
  if(n == 1) return A[0];
  if(n == 2) return A[0] + A[1] - 1;
  if(n == 3) return A[0] + A[1] - 1 + A[2] - 2;
  int cost = A[0] + A[1] - 1 + A[2] - 2;
  if(cost == 3 || cost == 4) cost =  4;
  else cost =  cost + max(0LL,A[3] - 3);
  if(n == 4) return cost;
  
  if(cost == 4) return A[0] == 3? 5:4;
  if(A[4] == 2) return cost;
  if(count(A,A+n,3) >= 4) return cost + 1;
  return cost + max(0LL,A[4] - 4);
}

signed main(){
  cin>>n;
  for(int i=0;i<n;i++) cin>>A[i];
  sort(A,A+n,greater<int>());
  cout<<solve()<<endl;   
  return 0;
}

Measured memory_bytes: 3148
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
/*
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//cpp_int 多倍長
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007

signed main(){
    int A,B;
    cin>>A>>B;
    cout<<A*B<<endl;
}


Measured memory_bytes: 3196
import java.util.*;
public class Main 
{
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		int[] aIn = new int[3];
		int[] aOut = new int[3];
		int[] bIn = new int[3];
		int[] bOut = new int[3];
		int[] cIn = new int[3];
		int[] cOut = new int[3];
		for(int i = 0; i < 3; ++i)
		{
			aIn[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 3; ++i)
		{
			aOut[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 3; ++i)
		{
			bIn[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 3; ++i)
		{
			bOut[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 3; ++i)
		{
			cIn[i] = stdIn.nextInt();
		}
		for(int i = 0; i < 3; ++i)
		{
			cOut[i] = stdIn.nextInt();
		}
		int a = 0, b = 0, c = 0;
		a += 3600 * (aOut[0] - aIn[0]) + 60 * (aOut[1] - aIn[1]) + (aOut[2] - aIn[2]);
		System.out.println((a / 3600) + " " + ((a % 3600) / 60) + " " + ((a % 3600) % 60));
		b += 3600 * (bOut[0] - bIn[0]) + 60 * (bOut[1] - bIn[1]) + (bOut[2] - bIn[2]);
		System.out.println((b / 3600) + " " + ((b % 3600) / 60) + " " + ((b % 3600) % 60));
		c += 3600 * (cOut[0] - cIn[0]) + 60 * (cOut[1] - cIn[1]) + (cOut[2] - cIn[2]);
		System.out.println((c / 3600) + " " + ((c % 3600) / 60) + " " + ((c % 3600) % 60));
	}
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

int main(){
    ll N, M; cin >> N >> M;
    vector<int> X(M); REP(i, M) cin >> X[i];

    if(M == 1 || N >= M) {
        cout << 0 << endl;
    } else {
        sort(all(X));
        vector<ll> minus(M - 1);

        for(int i = 0; i < M - 1; ++i) {
            minus[i] = abs(X[i + 1] - X[i]);
        }

        sort(all(minus), greater<int>());

        ll res = X.at(M - 1) - X.at(0);
        for(int i = 0; i < N - 1; ++i) {
            res -= minus.at(i);
        }

        cout << res << endl;
    }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF (ll)1e18
#define INF (int)1e9
#define ll_1e9 (ll)1e9
using namespace std;

using P = pair<ll,ll>;
using PQ = priority_queue<P,vector<P>,greater<P>>;


struct edge{
    ll to,cost;  
};

void dijkstra(vector<vector<edge> > &G,vector<ll> &d,ll s){
    PQ que;
    fill(d.begin(),d.end(), LINF);
    d[s] = 0;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top(); que.pop();
        ll v = p.second;
        if(d[v] < p.first) continue;

        rep(i,0,G[v].size()){
            edge e = G[v][i];
            if(d[e.to] > d[v] + e.cost){
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to],e.to));
            }

        }
    }


}

int main(){
    ll n;
    cin >> n;
    vector<vector<edge> > G(n);
    vector<ll> d(n);

    ll a,b,c;
    edge e;
    rep(i,0,n-1){
        cin >> a >> b >> c;
        e.to = b-1;
        e.cost = c;
        G[a-1].push_back(e);
        e.to = a-1;
        G[b-1].push_back(e);
    }

    

    ll q,k;
    cin >> q >> k;
    dijkstra(G,d,k-1);

    rep(i,0,q){
        ll x,y;
        cin >> x >> y;
        cout << d[x-1] + d[y-1] << endl;
    }
    
 
    return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

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


Measured memory_bytes: 256
/**
*	created: 21.08.2020 14:28:05
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = LLONG_MAX;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    int b = 2, t = 0;
    vector<int> v;
    if (n == 0) {cout << 0 << endl; return 0;}
    while (true) {
        if (n == 0) break;

        if (n % b != 0) {
            v.push_back(1);
            if (t % 2 == 0) n -= b/2;
            else n += b/2;
        }
        else v.push_back(0);

        t++; b *= 2;
    }
    reverse(all(v));
    for (auto p : v) cout << p;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <cmath>

int main()
{
  int N;
  std::cin >> N;
  int T, A;
  int H[N];
  std::cin >> T >> A;
  for ( int i = 0; i < N; i++ ) std::cin >> H[i];

  int pos = 1;
  double min = std::abs(A - T + H[0] * 0.006);
  for ( int i = 1; i < N; i++ ) {
    double dis = std::abs(A - T + H[i] * 0.006);
    if ( dis < min ) {
      min = dis;
      pos = i + 1;
    }
  }

  std::cout << pos << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<pair<string,int>,int> a[110];
  for(int i=0; i<n; i++) {
    string s;
    int p;
    cin >> s >> p;
    a[i] = make_pair(make_pair(s,-p),i);
  }
  sort(a, a+n);
  for(int i=0; i<n; i++){
    cout << a[i].second + 1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define print(x) cout << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T> >
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int masu[100][100];
int main() {
  int a, b;
  cin >> a >> b;
  int h = 100, w = 100;

  rep(i, h / 2) { rep(j, w) masu[i][j] = 1; }
  int cnt = 0;
  for (int y = 0; y < h / 2; y += 2) {
    for (int x = 0; x < 100; x += 2) {
      if (cnt >= (b - 1)) break;
      masu[y][x] = 0;
      cnt++;
      
    }
    if (cnt >= (b - 1)) break;
  }
  cnt = 0;
  for (int y = h-1; y >=0; y -= 2) {
    for (int x = 0; x < 100; x += 2) {
      if (cnt >= (a - 1)) break;
      masu[y][x] = 1;
      cnt++;
      
    }
    if (cnt >= (a - 1)) break;
  }

  cout << h << " " << w << endl;
  rep(i, h) {
    rep(j, w) {
      if (masu[i][j])
        cout << ".";
      else
        cout << "#";
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int d[3],i,j,t;
		scanf("%d %d %d",&d[0],&d[1],&d[2]);
	
	for(i=0;i<3;i++){
		for(j=0;j<2;j++){
			if(d[i]<d[j]){
				t=d[i];
				d[i]=d[j];
				d[j]=t;
			}
		}
	}
	
	printf("%d %d %d\n",d[0],d[1],d[2]);
	return 0 ;
}

Measured memory_bytes: 596
import java.util.Scanner;
//import java.io.*;
//import java.util.Arrays;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		//InputStreamReader is = new InputStreamReader(System.in);
		//BufferedReader br = new BufferedReader(is);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int score[] = new int[N];
		int target[] = new int[M];
		for(int i = 0 ; i < M ; i++){
			target[i] = scan.nextInt();
		}
		int game[] = new int[N];
		for(int i = 0 ; i < M ; i++){
			for(int j = 0 ; j < N ; j++){
				game[j] = scan.nextInt();
			}
			int cun = 0;
			for(int j = 0 ; j < N ; j++){
				if(target[i] == game[j]){
					score[j]++;
				}else{
					cun++;
				}
			}
			score[target[i]-1] += cun;
		}
		for(int i = 0 ; i < N ; i++){
			System.out.println(score[i]);
		}
	}
}

Measured memory_bytes: 38476
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int count = 0,en[26] = {};
  string s;
  cin >> s;
  for(int i=0; i<4; i++) en[s[i] - 'A']++;
  for(int i=0; i<26; i++){
    if(en[i] == 2) count++;
  }
  if(count == 2) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

class Program
{
    public static IO IO = new IO();
    static void Main(string[] args)
    {
        int n  = IO.INT();
        int[] m = IO.INT(n);
        List<int> g = new List<int>();
        int c = 0;
        g.Add(1);
        for (int i = 0; 3 * g[i] + 1 < n; i++) { g.Add(3 * g[i] + 1); }
        g.Reverse();
        for (int k = 0; k < g.Count(); k++)
        {
            int gg = g[k];
            for (int i = gg; i < n; i++)
            {
                int v = m[i];
                int j;
                for (j = i - gg; j >= 0 && m[j] > v; j -= gg) { m[j + gg] = m[j]; c++; }
                m[j + gg] = v;
            }
        }
        IO.WRITE(g.Count());
        IO.WRITE(string.Join(" ", g.Select(s => s.ToString()).ToArray()));
        IO.WRITE(c);
        for (int i = 0; i < n; i++) { IO.WRITE(m[i]); }
        IO.FLUSH();
    }
}

namespace LIB
{
    public class IO
    {
        private const int WMAX = 1000;
        private StringBuilder S = new StringBuilder();
        private T R<T>(Func<string, T> f) { return f(Console.ReadLine()); }
        private T[] R<T>(Func<string, T> f, char c) { return STRING().Split(c).Select(f).ToArray(); }
        private T[] R<T>(Func<string, T> f, int l) { T[] r = new T[l]; for (int i = 0; i < l; i++) { r[i] = R(f); } return r; }
        private T[][] R<T>(Func<string, T> f, int l, char c) { T[][] r = new T[l][]; for (int i = 0; i < l; i++) { r[i] = R<T>(f, c); } return r; }
        private void W<T>(Func<T, string> f, T v, bool lf = true) { S.Append(f(v)); if (lf == true) { S.Append('\n'); } if (S.Length >= WMAX) { FLUSH(); } }
        public string STRING() { return R(s => s); }
        public string[] STRING(char c) { return R(s => s, c); }
        public string[] STRING(int l) { return R(s => s, l); }
        public string[][] STRING(int l, char c) { return R(s => s, l, c); }
        public int INT() { return R(int.Parse); }
        public int[] INT(char c) { return R(int.Parse, c); }
        public int[] INT(int l) { return R(int.Parse, l); }
        public int[][] INT(int l, char c) { return R(int.Parse, l, c); }
        public long LONG() { return R(long.Parse); }
        public long[] LONG(char c) { return R(long.Parse, c); }
        public long[] LONG(int l) { return R(long.Parse, l); }
        public long[][] LONG(int l, char c) { return R(long.Parse, l, c); }
        public double DOUBLE() { return R(double.Parse); }
        public double[] DOUBLE(char c) { return R(double.Parse, c); }
        public double[] DOUBLE(int l) { return R(double.Parse, l); }
        public double[][] DOUBLE(int l, char c) { return R(double.Parse, l, c); }
        public void WRITE(string s, bool lf = true) { W(v => v, s, lf); }
        public void WRITE(int s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(long s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void WRITE(double s, bool lf = true) { W(v => v.ToString(), s, lf); }
        public void FLUSH() { Console.Write(S); S.Length = 0; }
    }
}

Measured memory_bytes: 17028
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<queue>
#define Vmaxn 100010
#define Emaxn 200010

using namespace std;

struct Node
{
    int x,y,pre;
};
//邻接表存储方法
int g_[Vmaxn];
Node g[Emaxn];

int n,m,cnt=0;
int dfn[Vmaxn],low[Vmaxn],h[Vmaxn],parent[Vmaxn],result[Vmaxn];

void dfs(int u){
    int i,j,sonCnt=0;
    h[u]=1;dfn[u]=low[u]=cnt++;

    j=g_[u];
    while(j!=-1){
        int v=g[j].y;
        if(h[v]==0){//正常边
            sonCnt++;
            parent[v]=u;
            dfs(v);
            low[u]=min(low[u],low[v]);
            if(u!=0&&low[v]>=dfn[u])
                result[u]=1;
        }else if(parent[u]!=v){//回边
            low[u]=min(low[u],dfn[v]);
        }
        j=g[j].pre;
    }
    if(u==0&&sonCnt>1) result[0]=1;
}

int main(){

    int i;
    cin>>n>>m;
    memset(g_,-1,sizeof g_);
    for(i=0;i<2*m;i++)
    {
        cin>>g[i].x>>g[i].y;
        g[i].pre=g_[g[i].x];
        g_[g[i].x]=i;

        g[i+1].x=g[i].y;g[i+1].y=g[i].x;
        g[i+1].pre=g_[g[i+1].x];
        g_[g[i+1].x]=i+1;
        i++;
    }
    memset(h,0,sizeof h);
    memset(result,0,sizeof result);
    dfs(0);
    for(i=0;i<n;i++)
        if(result[i]==1)
            cout<<i<<endl;
    return 0;
}



Measured memory_bytes: 5948
import itertools
import math
N = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

P=[]
Q=[]
for i in itertools.permutations(p):
    P.append(i)
for i in itertools.permutations(q):
    Q.append(i)
P=sorted(P)
Q=sorted(Q)
p=tuple(p)
q=tuple(q)
for i in range(math.factorial(N)):
    if P[i]==p:
        a=i+1
        break
for i in range(math.factorial(N)):
    if Q[i]==q:
        b=i+1
        break

print(abs(a-b))



Measured memory_bytes: 82480
#include <stdio.h>

int main(void)
{
    int a,b,d,r;
    double f;
    scanf("%d %d",&a,&b);

    d = a/b;
    r = a%b;
    f = (double)a/b;

    printf("%d %d %.5lf\n",d,r,f);
    return 0;
}

Measured memory_bytes: 640
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    N = ii()
    A = iml(2)
    ans = 0
    for i in range(1, N + 1):
        ans = max(ans, sum(A[0][:i]) + sum(A[1][i - 1 :]))
    return ans


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void wri(ll a){write(a); putchar(' ');}
inline void writeln(ll a){write(a); puts("");}
const int mod=1000000007;
ll ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
signed main(){
	int h=read(),w=read(),k=read(),n=h+w,s1=0,s2=0;
	for(int i=2;i<=k;i++)s1=(s1+(ll)i*(i-1))%mod;
	s2=(ll)k*(k+1)/2%mod*(h+w)%mod*ksm(n,mod-2)%mod;
	s1=(ll)s1*h%mod*w%mod*ksm((ll)n*(n-1)%mod,mod-2)%mod;
	int ans=((ll)s1+s2+k)%mod;
	for(int i=n;i>n-k;i--)ans=(ll)ans*i%mod;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int N, K;
	char S[55];
	
	scanf("%d%d", &N, &K);
	scanf("%s", &S);
	
	K=K-1;
	S[K]=S[K]+32;
	
	printf("%s",S);
	
	return 0;
}

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

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  int n, k;
  cin >> n >> k;
  set<int> s;
  for(int i=0; i<k; i++){
    int d;
    cin >> d;
    for(int j=0; j<d; j++){
      int a;
      cin >> a;
      if(!s.count(a))
	s.insert(a);
    }
  }
  cout << n-s.size() << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main()
{
    int a, need;
    cin >> a >> need;

    int ans = 0;
    int total = 1;
    while (need > total) {
        total = (total - 1) + a;
        ans++;
    }

    cout << ans << endl;

    return 0;
}


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


struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node *Node;
#define NIL NULL
Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z=malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x=x->right;
    }
  }
  z->parent = y;
  if(y == NIL){
      root = z;
    }else {
    if(z->key<y->key)
      {
        y->left=z;
      }
    else{
      y->right=z;
    }
  }
}
void inorder(Node u){
  if(u!=NIL){
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
  }
}
void preorder(Node u){
  if(u!=NIL)
    {
      printf(" %d",u->key);
      preorder(u->left);
      preorder(u->right);
    }
}

int main(){
  int n,i,x;
  char com[20];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s",com);
    if(com[0]== 'i'){
      scanf("%d",&x);
      insert(x);
    }else if(com[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}



Measured memory_bytes: 25164
n = int(input())
s = list(map(int, input().split()))

ans = 0

for d in range(1, n):
    temp = 0
    L = 0
    R = n-1
    if (n-1) % d == 0:
        while L < R:
            temp += s[L] + s[R]
            ans = max(ans, temp)
            L += d
            R -= d
    else:
        while L + d < n-1:
            temp += s[L] + s[R]
            ans = max(ans, temp)
            L += d
            R -= d

print(ans)

Measured memory_bytes: 63216
"""
N=int(input())

print(800*N-int(N/15)*200)
"""
"""
N=int(input())
S=input()

max_n=0
temp=0
for strng in S:
	if strng=="I":
		temp+=1
		if max_n<temp:
			max_n=temp
	else:
		temp-=1
print(max_n)
"""
"""
N=int(input())

Q=1000000007
p=1
for i in range(1,N+1):
	p*=i
	p=p%Q
print(p%Q)
"""

"""
n=int(input())
S=[input() for i in range(n)]
alphabet_dict={chr(97+i):100 for i in range(26)}
for s in S:
	temp={chr(97+i):0 for i in range(26)}
	for i in s:
		temp[i]+=1

	for key in alphabet_dict.keys():
		if alphabet_dict[key]>temp[key]:
			alphabet_dict[key]=temp[key]
result=""
for item in alphabet_dict.items():
	for i in range(item[1]):
		result+=item[0]
if result=="":
	print("\n")
else:
	print(result)
"""
"""
(N,M) = [int(i)for i in input().split()]

if N>int(M/2):
	print(int(M/2))
else:
	hoge=int(M/2)-N
	print(N+int(hoge/2))
"""
(N,A,B) = [int(i)for i in input().split()]
X=[int(i) for i in input().split()]

hirou=0
for i in range(N-1):
	length=X[i+1]-X[i]
	if length*A <= B:
		hirou+=length*A
	else:
		hirou+=B
print(hirou)

Measured memory_bytes: 14252
#include<bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod=1e9+7;

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


int32_t  main()
{ 
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
 
  #ifndef ONLINE_JUDGE
  freopen("input.txt","rt",stdin);
  freopen("output.txt","wt",stdout);
  #endif

  int x;
  cin>>x;
  if(x>=30)cout<<"Yes\n";
  else cout<<"No\n";

}

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

int main() {
int64_t a, s;
  s=0;
  cin >>a;
  for(int64_t i=1;i<a+1;i++){if((i%3)!=0&&(i%5)!=0){s+=i;}}
  cout<<s<<endl;
  
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    int A,B,M,amin,bmin;
    cin>>A>>B>>M;
    int a[A],b[B];
    int ans=0;
    amin=bmin=100000;
    REP(i,A){
        cin>>a[i];
        amin=min(amin,a[i]);   
    }
    ans+=amin;
    REP(i,B){
        cin>>b[i];
        bmin=min(bmin,b[i]);   
    }
    ans+=bmin;
    REP(i,M){
        int x,y,c;
        cin>>x>>y>>c;
        ans=min(ans,a[x-1]+b[y-1]-c);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1920
#include <stdio.h>

#define S_MAX 100000
#define T_MAX 1000

int main(){
  int S[S_MAX], T[T_MAX];
  int n, q, i, j, num=0;

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &S[i]);
  }

  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d", &T[i]);
  }

  for(i = 0 ; i < q ; i++){
    for(j = 0 ; j < n ; j++){
      if(S[j] == T[i]){
        num++;
        break;
      }
    }
  }

  printf("%d\n", num);
  
  
  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
long long max(long long a,long long b){
	if(a>=b) return a;
	return b;
}
int main(){
	int n;
	cin>>n;
	vector<long long> a(n);
	for(int i=0;i<n;i++) cin>>a[i];
	long long curr=1000;
	for(int i=0;i<n;i++){
		int j=i+1;
		while(j<n&&a[j]>=a[j-1]) j++;
		j--;
		long long diff=a[j]-a[i];
		if(diff<=0){
			i=j;
			continue;
		}
		long long nmax=curr/a[i];
		long long remain=curr%a[i];
		long long pro=(a[j])*nmax;
		curr=remain+pro;
		i=j;
	}
	cout<<max(curr,(long long)1000)<<endl;
}

Measured memory_bytes: 3536
/* DELAPAN.3gp */
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
using namespace std;

#ifdef DEBUG
	#define debug(...) printf(__VA_ARGS__)
	#define GetTime() fprintf(stderr,"Running time: %.3lf second\n",((double)clock())/CLOCKS_PER_SEC)
#else
	#define debug(...) 
	#define GetTime() 
#endif

//type definitions
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vint;

//abbreviations
#define A first
#define B second
#define MP make_pair
#define PB push_back

//macros
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n)-1; 0 <= i; --i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for (int i = (a); (b) <= i; --i)
#define FORIT(it,c) for (__typeof ((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define RESET(a,x) memset(a,x,sizeof(a))
#define EXIST(a,s) ((s).find(a) != (s).end())
#define MX(a,b) a = max((a),(b));
#define MN(a,b) a = min((a),(b));

inline void OPEN(const string &s) {
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

/* -------------- end of DELAPAN.3gp's template -------------- */

#define MAXN 100100

int r, c, n;
int x[MAXN], y[MAXN];
ll ans[11];

int main(){
	scanf("%d%d%d", &r, &c, &n);
	vector<pii> points;
	set<pii> colored;
	REP(i, n) {
		scanf("%d%d", &x[i], &y[i]);
		colored.insert(MP(x[i], y[i]));
		for (int ix = x[i] - 2; ix <= x[i]; ++ix) {
			for (int iy = y[i] - 2; iy <= y[i]; ++iy) {
				if (ix >= 1 && iy >= 1 && ix + 2 <= r && iy + 2 <= c) {
					points.PB(MP(ix, iy));
				}
			}
		}
	}
	sort(ALL(points));
	points.resize(unique(ALL(points)) - points.begin());
	
	FORIT(it, points) {
		int xx = it->A, yy = it->B;
		int tot = 0;
		REP(i, 3) REP(j, 3) {
			if (EXIST(MP(xx + i, yy + j), colored)) {
				tot++;
			}
		}
		ans[tot]++;
	}
	ans[0] = 1LL * (r - 2) * (c - 2);
	FOR(i, 1, 9) {
		ans[0] -= ans[i];
	}
	FOR(i, 0, 9) {
		printf("%lld\n", ans[i]);
	}

	return 0;
}


Measured memory_bytes: 12776
// User: el_heffeh
// Date: 6/16/20

#include <bits/stdc++.h>

using namespace std;

int x, n, ans, diff;

void solve() {
	cin >> x >> n;
	vector<int> a(n, 0);
	set<int> st;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		st.insert(a[i]);
	}
	ans = diff = 2147483647;
	for (int i = x; i < 1000; ++i) {
		if (st.find(i) == st.end()) {
			ans = i, diff = i - x;
			break;
		}
	}
	for (int i = x - 1; i > -1000; --i) {
		if (x - i > diff) {
			break;
		}
		if (st.find(i) == st.end()) {
			ans = i;
			diff = x - i;
		}
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);    
    //freopen("input.txt", "r", stdin);
	solve();
	return 0;
}

/* 
	When writing code, be sure to look out for:
 	* Array out of bounds access
 	* Integer overflow
 	* Variable scopes and names
 	* Be proactive and make sure to completely think a whole problem through before writing any code
 	Coding is a fun activity, and it should be treated that way. Don't get mad over some failed test cases or time limit exceeded verdicts. Keep your cool and stay calm!
*/


Measured memory_bytes: 3628
// ProblemURL : https://atcoder.jp/contests/abc104/tasks/abc104_c
// ---------------------------------------------
package main

import "fmt"

var inf = 1 << 60

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n, targetScore int
	fmt.Scan(&n, &targetScore)
	type problem struct {
		point int
		count int
		bonus int
	}
	problems := make([]problem, n)
	for i := 0; i < n; i++ {
		var p, c int
		fmt.Scan(&p, &c)
		problems[i] = problem{
			point: (i + 1) * 100,
			count: p,
			bonus: c,
		}
	}

	ctSolvedMin := inf
	for i := 0; i < (1 << uint(n)); i++ {
		ctSolved := 0
		score := 0
		for j := 0; j < n; j++ {
			if i>>uint(j)&1 == 1 {
				ctSolved += problems[j].count
				score += problems[j].point * problems[j].count
				score += problems[j].bonus
			}
		}

		if score >= targetScore {
			ctSolvedMin = smaller(ctSolvedMin, ctSolved)
		} else {
			for j := n - 1; j >= 0; j-- {
				if i>>uint(j)&1 == 1 {
					continue
				}

				for h := 0; h < problems[j].count-1; h++ {
					ctSolved++
					score += problems[j].point
					if score >= targetScore {
						break
					}
				}
				if score >= targetScore {
					break
				}
			}

			if score >= targetScore {
				ctSolvedMin = smaller(ctSolvedMin, ctSolved)
			}
		}
	}
	fmt.Println(ctSolvedMin)
}


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

ll gcd(ll m, ll n){
    ll tmp;
    while(m%n){
        tmp = n;
        n = m % n;
        m = tmp;
    }
    return n;
}

ll lcm(ll m, ll n){
    return m / gcd(m, n) * n;
}

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

    ll n, m;
    cin >> n >> m;
    
    string s, t;
    cin >> s >> t;

    ll l = lcm(n, m);

    ll ss = l/n;
    ll st = l/m;
    ll ptr_s = 0;
    ll ptr_t = 0;
  	ll ps = 0;
    ll pt = 0;
  
    while(ptr_s<l || ptr_t<l){
        if(ptr_s == ptr_t){
            if(s[ps] != t[pt]){
                cout << -1 << endl;
                return 0;
            }
            ptr_s += ss;
            ptr_t += st;
          	++ps;
          	++pt;
        }
        
        else if(ptr_s < ptr_t) {
          	ptr_s += ss;
          	++ps;
        }
        else {
          	ptr_t += st;
          	++pt;
        }
    }

    cout << l << endl;

    return 0;
}

Measured memory_bytes: 640
package main

import (
	"fmt"
)

var (
	x int
	i int
)

func endCheck(n int) bool {
	i++
	if i <= n {
		call1(n)
	}
	return true
}

func call(n int) {
	i = 1
	call1(n)
	fmt.Println()
}

func call1(n int) {
	x = i
	if x%3 == 0 {
		fmt.Printf(" %d", i)
		if endCheck(n) {
			return
		}
	}
	for {
		if x%10 == 3 {
			fmt.Printf(" %d", i)
			if endCheck(n) {
				return
			}
		}
		x /= 10
		if x == 0 {
			break
		}
	}
	endCheck(n)
}

func main() {
	var n int
	fmt.Scan(&n)
	call(n)
}



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

int main() {
    int n,m,c;
    cin >> n >> m >> c;
    int b[m];
    for(int i=0;i<m;i++){
        cin >> b[i];
    }
    int a[n][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a[i][j];
        }
    }
    int count = 0;
    int total = 0;
    for(int i=0;i<n;i++){
        total=0;
        for(int j=0;j<m;j++){
            total+=b[j]*a[i][j];
        }
        total+=c;
        if(total>0){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

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

    ll ans = 1LL<<60;

    for(int i = 1; i < sqrt(n)+1; i++){
        if(n%i==0){
            ans = min(ans, (i-1)+(n/i-1));
        }
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};



int main(){
    Stream io;

    int x;
    io.read(x);
    if(x == 0) cout << 1;
    else cout << 0;

    return 0;
}


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

int bai(int s, int t){
    for(int i=0; i<t; i++){
        s = 2*s;
    }
    return s;
}

int main() {
    int a, b, c, k;
    cin>>a>>b>>c;
    cin>>k;
    int sum;
    
    if(a>=b and a>=c){
        sum = bai(a,k)+b+c;
    }else if(b>a and b>=c){
        sum = a+bai(b,k)+c;
    }else{
        sum=a+b+bai(c,k);
    }
    cout<<sum<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    D, T, S = map(int, readline().split())

    if S * T >= D:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 61636
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L

bool isPrime(long long x) {
    if (x == 1) return true;
    for (long long i = 2; i * i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

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

vector<long long> common_divisors(long long a, long long b) {
    long long n = gcd(a, b);
    vector<long long> ans;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            if (n / i == i) {
                ans.push_back(i);
            }
            else {
                ans.push_back(n / i);
                ans.push_back(i);
            }
        }
    }
    return ans;
}

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int sum = 0;
    vector<int> a(n);
    for (int i = 0; i < q; i++) {
        int x;cin >> x; x--;
        a[x]++;
        sum++;
    }
    for (int i = 0; i < n; i++) {
        if (k - sum + a[i] > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3776
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 10**9 + 7
dp = [-1] * (1 << n)
dp[0] = 1


def solve(bits, i):
    if dp[bits] != -1:
        return dp[bits]

    total = 0
    for j in range(n):
        if bits & (1 << j) and a[i][j]:
            total += solve(bits ^ (1 << j), i-1)

    dp[bits] = total % mod
    return dp[bits]


print(solve((1 << n) - 1, n-1))


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

int main(){
    ll n;
    cin >> n;
    vector<ll> d(n);
    rep(i, 0, n) cin >> d[i];
    sort(d.begin(), d.end());
    cout << d[n/2] - d[n/2-1] << endl;
    return 0;
}

Measured memory_bytes: 3972