akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 1e5 + 20;
const ll mod = 1e9 + 7;
map<int , int> mp;
int main()
{
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        int a = (n + x - 1) / 2 , b = (n - x - 1) / 2;
        if((n + x) % 2 == 0)
        {
            cout << 0;
            return 0;
        }
        if(n - 1 < x)
        {
            cout << 0;
            return 0;
        }
        mp[a]++;
        mp[b]++;
    }
    for(auto u : mp)
        if(u.second != 2)
        {
            cout << 0;
            return 0;
        }
    n /= 2;
    ll res = 1;
    while(n--)
    {
        res *= 2;
        res %= mod;
    }
    cout << res;
}


Measured memory_bytes: 4992
n, k = map(int, input().split())

As = list(map(int, input().split()))

pos = 1

seen = {}
seen[1] = 1

count = 0

ans = 0
loop_pos = 0

for i in range(n):
    pos -= 1
    next_pos = As[pos]
    pos = next_pos
    count += 1
    if count == k:
        ans = next_pos
        break
    elif seen.get(next_pos, None) is None:
        seen[next_pos] = 1
    else:
        loop_pos = next_pos
        break

if ans != 0:
    print(ans)
else:
    k -= count
    count = 0
    for i in range(n):
        pos -= 1
        next_pos = As[pos]
        pos = next_pos
        count += 1
        if count == k:
            ans = next_pos
            break
        elif next_pos == loop_pos:
            break

    if ans != 0:
        print(ans)
    elif k % count == 0:
        print(loop_pos)
    else:
        k = k % count
        count = 0
        for i in range(n):
            pos -= 1
            next_pos = As[pos]
            pos = next_pos
            count += 1
            if count == k:
                ans = next_pos
                break

        print(ans)


Measured memory_bytes: 32264
package main

import (
	"fmt"
)

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

	as := make([]int, n)
	for i:=0; i<n; i++ {
		fmt.Scan(&as[i])
	}

	cnt := 0
	ans := 0
	for true {
		if cnt == n {
			break
		}
		cnt1 := cnt
		cnt2 := cnt
		
		for cnt1 < n-1 && as[cnt1] <= as[cnt1+1] {
			cnt1++
		}
		
		for cnt2 < n-1 && as[cnt2] >= as[cnt2+1] {
			cnt2++
		}
		
		if cnt1 >= cnt2 {
			cnt = cnt1
		} else {
			cnt = cnt2
		}
		cnt++
		
		ans++
	}

	fmt.Print(ans)
}


Measured memory_bytes: 6912
#include<stdio.h>
#define SWAP(type,a,b) do{type tmp=a;a=b;b=tmp;}while(0)
main(){
  int a[100],i,j,n,cnt;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++) scanf("%d",&a[i]);
    for(i=0;i<n-1;i++){
      for(j=n-1;j>i;j--){
	if(a[j]<a[j-1]) SWAP(int,a[j],a[j-1]);
      }
    }

    for(i=1,cnt=0;i<n-1;i++) cnt+=a[i];
    printf("%d\n",cnt/(n-2));
  }
  return 0;
}

Measured memory_bytes: 600
n, m = map(int, input().split())
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 1
seta = set([int(input()) for _ in range(m)])

for i in range(2, n+1):
    if not i-1 in seta:
        dp[i] += dp[i-1]
    if not i-2 in seta:
        dp[i] += dp[i-2]
    dp[i] %= mod

print(dp[-1])


Measured memory_bytes: 94500
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=998244353;

const ll MAX = 1000000;
ll fac[MAX], finv[MAX], inv[MAX];
// nCk初期化
void nCkInit(const ll MOD) {//O(max(n,r)logmax(n,r) mは素数)
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll nCk(ll n, ll k,const ll MOD){//init後,O(1)
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modpow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

ll N,M,K;
int main(){
    cin>>N>>M>>K;
    nCkInit(MOD);
    ll ans=M*modpow(M-1,N-1,MOD)%MOD;
    for(ll i=1;i<=K;i++){
        ll tmp=nCk(N-1,i,MOD)*modpow(M-1,N-1-i,MOD)%MOD;
        tmp=tmp*M%MOD;
        ans=(ans+tmp)%MOD;
    }

    cout<<ans;
    return 0;
}

Measured memory_bytes: 27072
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class Z> V<Z> divisor(Z n) {
  V<Z> res;
  Z i;
  for (i = 1; i * i < n; ++i) if (n % i == 0) res.push_back(i), res.push_back(n / i);
  if (i * i == n) res.push_back(i);
  sort(rbegin(res), rend(res));
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  V<> a(n); for (auto&& e : a) cin >> e;
  for (int d : divisor(accumulate(begin(a), end(a), 0))) {
    V<> r;
    for (int e : a) {
      int t = e % d;
      if (t) r.push_back(t);
    }
    sort(begin(r), end(r));
    int m = r.size();
    lint s = 0, sr = accumulate(begin(r), end(r), 0LL);
    for (int i = 0; i <= m; ++i) {
      if (i) s += r[i - 1];
      lint t = (lint)d * (m - i) - (sr - s);
      if (s == t and s <= k) return cout << d << '\n', 0;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

#define int ll
struct UnionFind{
int uf[100010];
int rank1[100010];

//n要素で初期化
void init(int n){
  for(int i=0;i<n;i++){
    uf[i]=i;
    rank1[i]=0;
  }
}

//木の根を求める
int find(int x){
  if(uf[x]==x){
    return x;
  } else {
    return uf[x]=find(uf[x]);
  }
}

//xとyの属する集合を併合
void unite(int x,int y){
  x=find(x);
  y=find(y);
  if(x==y) return;

  if(rank1[x]<rank1[y]){
    uf[x]=y;
  }else{
    uf[y]=x;
    if(rank1[x]==rank1[y])rank1[x]++;
  }
}

//xとyが同じ集合に属するか否か
bool same(int x,int y){
return find(x)==find(y);
}
};


signed main(){
    int n, m, k; cin >> n >> m;
    int l;
    UnionFind uf;
    uf.init(n);
 
    vector<int> a[100010];
    rep(i,0,n) {
        cin >> k;
        rep(j,0,k) {
            cin >> l; l--;
            a[l].pb(i);
        }
    }
 
    rep(i,0,m) {
        rep(j,1,a[i].size()) {
            uf.unite(a[i][0], a[i][j]);
        }
    }
 
    int prev = -1;
    rep(i,0,n) {
        int p = uf.find(i);
        if(prev == -1) prev = p;
        else if(prev != -1 && prev != p) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 6268
#include <bits/stdc++.h>
using namespace std;
#define LIM 1000000000000000000

int main() {
  int N;
  cin >> N;
  long long A[N], pro = 1;
  int zero = 0;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    if (A[i] == 0)
      zero++;
  }
  if (zero > 0) {
    cout << 0 << endl;
    return 0;
  }
  for (int i=0; i<N; i++) {
    if (A[i] > LIM/pro) {
      cout << -1 << endl;
      return 0;
    }
    pro *= A[i];
  }
  if (pro > LIM)
    pro = -1;
  cout << pro << endl;
  return 0;
}


Measured memory_bytes: 4416
#include <iostream>
#include <cctype>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#define rep(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int comp(const void* a, const void* b){
	return *(int*)a - *(int*)b;
}

int main() {
	int n;
	cin >> n;
	if(n < 1000){
		cout << "ABC" << endl;
	}else{
		cout << "ABD" << endl;
	}
}

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

using namespace std;

#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.14159265
#define pb push_back
#define bits(n) __builtin_popcount(n)
#define ll long long int

void solve()
{
    int k,x;
    cin >> k >> x;
    if(k*500>=x)
    cout<<"Yes";
    else
    {
        cout<<"No";
    }
    
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

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

Measured memory_bytes: 3584
#[allow(unused_macros)]
macro_rules! input_byline {
    ($($r:tt)* ) => {
        let stdin = std::io::stdin();
        let mut q = std::collections::VecDeque::new();
        let mut next = || {
            if q.is_empty() {
                let mut s = String::new();
                stdin.read_line(&mut s);
                for v in s.split_whitespace() {
                    q.push_back(v.to_string());
                }
            }
            q.pop_front().unwrap()
        };
        input_inner!{next, $($r)*}
    };

}

#[allow(unused_macros)]
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

trait Printable {
    fn p(&self);
}

impl<T: std::fmt::Display> Printable for T {
    fn p(&self) {
        println!("{}", self);
    }
}

impl<T: std::fmt::Display> Printable for [T] {
    fn p(&self) {
        for i in 0..self.len() {
            if i != 0 {
                print!(" ");
            }
            print!("{}", self[i]);
        }
        println!("");
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

fn main() {
    input! {
        w: usize,
        h: usize,
        p: [usize; w],
        q: [usize; h],
    }
    let mut v = vec![];
    for &x in &p {
        v.push((x, 0));
    }
    for &x in &q {
        v.push((x, 1));
    }

    v.sort();
    let mut ans = 0;
    let mut r = 0;
    let mut c = 0;
    for &(x, d) in &v {
        if d == 0 {
            ans += (h + 1- c) * x;
            r += 1;
        } else {
            ans += (w + 1 - r) * x;
            c += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 14064
a,b,k = map(int, input().split(" "))
list = []
for i in range(a,min(b,a+k-1)+1):
    list.append(i)
for i in range(max(a,b-k+1),b+1):
    list.append(i)
list = set(list)
for i in range(len(list)):
    print(sorted(list)[i])

Measured memory_bytes: 3060
/*    特徴    */

/*    教訓    */

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld  = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x) == 1) return x; }
long long il() { long long x; if (scanf("%lld", &x) == 1) return x; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

#define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define begin_end(a) a.begin(),a.end() //sort(begin_end(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define p_b push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

// -------- template end - //


// - library ------------- //

// --------- library end - //


// - main() -------------- //

int main(){
  ll N = il();
  vector<ll> as;
  vector<ll> bs;
  rep(i, N){
    ll a,b;
    a = il();
    b = il();
    as.p_b(a);
    bs.p_b(b);
  }
  
  sort(begin_end(as));
  sort(begin_end(bs));
  
  ll ans;
  if (N%2==1){
    ans = bs[N/2] - as[N/2] + 1;
  }
  else{ 
    // 数を2倍して考える
    ans = (bs[N/2] + bs[N/2-1]) - (as[N/2] + as[N/2-1]) + 1;
  }
  
  cout << ans << endl;

// ---------- main() end - //
}

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

using namespace std;

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

int main() {
  long long A, B;
  cin >> A >> B;
  cout << A * B / gcd(A, B) << endl;

  return 0;
}


Measured memory_bytes: 384
N = int(input())
ans = 0
div_list = [0] * (N + 1)
for i in range(1, N + 1):
    for j in range(i, N + 1, i):
        div_list[j] += 1
# print(div_list)

for C in range(1, N):
    ans += div_list[N - C]
print(ans)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N, K;
    cin >> N >> K;
    vector<LL> v(N);
    for(int i = 0; i < N; ++i) {
        cin >> v[i];

    }
    sort(all(v));

    LL res = LINF;
    for(int i = K - 1; i < N; ++i) {
        res = min(res, v[i] - v[i - K + 1]);

    }
    cout << res << endl;

    return 0;
}



Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


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

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;

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

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

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

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

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

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

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*

	Optimizer

*/
//#pragma GCC optimize("Ofast")


int N, K;
int R, S, P;

unordered_map<char,int> mapHand2Score;

int getHandScore(char& cpu) {
	switch (cpu)
	{
	case 'r':
		return mapHand2Score['p'];
	case 's':
		return mapHand2Score['r'];
	case 'p':
		return mapHand2Score['s'];
	}
}

char getHandScoreChar(char& cpu) {
	switch (cpu)
	{
	case 'r':
		return 'p';
	case 's':
		return 'r';
	case 'p':
		return 's';
	}
}

char getExtraHand(char& c1, char& c2) {
	if(c1 == 'r' && c2 == 's') {
		return 'p';
	}
	else if (c1 == 'r' && c2 == 'p'){
		return 's';
	}
	else if (c1 == 's' && c2 == 'p') {
		return 'r';
	}
}

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

	cin >> N >> K;
	cin >> R >> S >> P;

	mapHand2Score['r'] = R;
	mapHand2Score['s'] = S;
	mapHand2Score['p'] = P;

	string T;
	cin >> T;

	char prevKHand = 'x';
	vector<char> takahashiHand(N);
	ULL ans = 0;
	for (int i = 0; i < T.size(); i++)
	{
		if((i+1) < (K+1)) {
			ans += getHandScore(T.at(i));
			takahashiHand[i] = getHandScoreChar(T.at(i));
		}
		else {
			char victoryHand = getHandScoreChar(T[i]);
			if(victoryHand != takahashiHand[i-K]) {
				// cout << "select1\n";
				takahashiHand[i] = getHandScoreChar(T[i]);
				ans += getHandScore(T.at(i));
			}
			else {
				continue;
			}
			// else if((i+K < N) && T[i] != T[i+K]){
			// 	cout << "select2\n";
			// 	takahashiHand[i] = getExtraHand(T[i], T[i+K]);
			// 	ans += mapHand2Score[getExtraHand(T[i], T[i+K])];
			// }
			// else {
			// 	cout << "select3\n";
			// 	takahashiHand[i] = T[i];
			// 	ans += 0;
			// }			
		}
		// cout << "debug -> " << ans << endl;
	}
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include<stdio.h>

int main( ){
  int i,j,N,tmp,count=0;
  int A[100],mini;

  scanf("%d",&N);
  if((N > 100) &&(N < 0)){
    printf("N is error\n");
  }
  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }

 

    for(i = 0; i <= N-1; i++){
      mini = i;
      for(j = i; j <= N-1; j++){
	if(A[j] < A[mini]){
	  mini = j;
	}
      }
      if(mini != i){
	tmp = A[i];
	A[i] = A[mini];
	A[mini] = tmp;
	count++;
      }
    }
  

  for(i = 0; i < N; i++){
    if(i > 0){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);

  return 0;
}

















Measured memory_bytes: 2076
#include <stdio.h>

int main(void)
{
	int i,j=0,n=0,k=0;
	int carda[10000],cardb[10000],suma[10000],sumb[10000];
	
	for(i=0;i<10000;i++){
		carda[i]=0;
		cardb[i]=0;
		suma[i]=0;
		sumb[i]=0;
	}
	
	while(1){
		scanf("%d",&n);
		if(n==0)
			break;
		
		for(i=0;i<n;i++)
			scanf("%d %d",&carda[i],&cardb[i]);
			
		for(i=0;i<n;i++){
			if(carda[i]>cardb[i]){
				carda[i]+=cardb[i];
				cardb[i]=0;
			}
			if(carda[i]<cardb[i]){
				cardb[i]+=carda[i];
				carda[i]=0;
			}
			if(carda[i]==cardb[i]);
		}
		
		for(i=0;i<n;i++){
			suma[j]+=carda[i];
			sumb[j]+=cardb[i];
		
		}
		j++;
	}
	
	k=j;
	for(j=0;j<k;j++) printf("%d %d\n",suma[j],sumb[j]);
	
	return 0;
}
		

Measured memory_bytes: 752
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

ll gcd(ll a, ll b) {
  ll v0=a, v1=b, v2=v0%v1;
  while(v2>0) {
    v0 = v1;
    v1 = v2;
    v2 = v0%v1;
  }
  return v1;
}

int main() {
  int N;
  cin>>N;
  ll A[N];
  for(int i=0;i<N;++i) cin>>A[i];
  vector<ll> L(N, 0), R(N, 0);
  for(int i=0;i<N;++i) {
    if(i==0) L[i] = A[i];
    else L[i] = gcd(L[i-1], A[i]);
  }
  for(int i=N-1;i>=0;--i) {
    if(i==N-1) R[i] = A[i];
    else R[i] = gcd(R[i+1], A[i]);
  }
  ll ans = 1;
  for(int i=0;i<N;++i) {
    if(i==0) ans = R[1];
    else if(i==N-1) ans = max(ans, L[i-1]);
    else ans = max(ans, gcd(L[i-1], R[i+1]));
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 5556
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;

int main(){
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    ll ans =0;
    if(a >= k) ans = k;
    else if(a+b >= k) ans = a;
    else ans = a - (k-a-b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;
#define      mxx                 LLONG_MAX
#define      mnn                 LLONG_MIN
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      MP                  make_pair
#define      flash               cout.flush()
#define      InTheNameOfGod      ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
constexpr ll MOD = 998244353;
constexpr ll mod = 1e9  + 7;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cerr<<a<<endl;
#define bug2(a,b)  cerr<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cerr<<a<<" "<<b<<" "<<c<<endl;
/*----*/
const ll N=2e5+5;
vector<ll> adj[N];
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll modpow(ll a,ll b,ll m){ll ans=1;while(b){if(b&1)ans=(ans*a)%m;b/=2;a=(a*a)%m;}return ans;}
ll nsum(ll num){return (num*(num+1))/2;}
void edge (ll u,ll v) {adj[u].PSB(v) ;adj[v].PSB(u);}
/*------------------START---------------------*/
ll dp[3000];

/*-----*/
void solve(){
   ll n;
   string s;
   cin>>n;
   dp[0]=1;
   for(ll i=3;i<=n;i++){
    for(ll j=3;j<=i;j++){
        dp[i]+=dp[i-j];
        dp[i]=dp[i]%mod;
    }
   }
   cout<<dp[n]<<endl;



}
/*-----*/
int main(){
   InTheNameOfGod

   ll Test=1;
   //cin>>Test;
   while(Test--){
     solve();
    }
  loser;
}
///////   C O D I N G  I S  L I F E   ///////


Measured memory_bytes: 8240
ans=float("INF")
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
if n==1:print(1);exit()
for i in range(n):
    for j in range(n):
        if i==j:continue
        p,q=l[i][0]-l[j][0],l[i][1]-l[j][1]
        ret=0
        pre=sorted(l,reverse=1,key=lambda x:p*x[0]+q*x[1])
        while pre:
            ret+=1
            x,y=pre.pop()
            while  [x+p,y+q] in pre:
                pre.remove([x+p,y+q])
                x,y=[x+p,y+q]
        ans=min(ans,ret)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll x,a;cin >> x >> a;
    if(x<a)cout << 0;
    else cout << 10;
    }

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]


count = len([i for i in a if i > 10**5])
a = [e for e in a if e <= 10**5]
dic = list(set(a))
for x in dic:
    if a.count(x) > x:
        count+= a.count(x) - x
    elif a.count(x) < x:
        count += a.count(x)
print(count)

Measured memory_bytes: 14620
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<cmath>
using namespace std;
#define MAX 100000010

int n;
void init(){
  n=0;
}

bool input(){
  cin>>n;
  return n;
}

string solve(){
  int ans=1;
  for(int i=2;i*i<n+1;i++){
    if(n%i==0){
      ans+=i+n/i;
      if(i*i==n)ans-=i;
    }
  }

  if(n==1)ans=0;
  if(ans==n){
    return "perfect number";
  }else if(ans<n){
    return "deficient number";
  }else if(ans>n){
    return "abundant number";
  }
}


int main(){
  while(init(),input()){
    cout<<solve()<<endl;
  }
}

Measured memory_bytes: 1192
#include "bits/stdc++.h"
using namespace std;
using long_t = int64_t;

struct Solver {
	Solver() {
		ios::sync_with_stdio( false );
		cout << fixed << setprecision( 10 );
	}

	void solve() {
		double r;
		cin >> r;
		cout << 2 * 3.141592653589793 * r << endl;
	}
};

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


Measured memory_bytes: 3796
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+1;

int H,W,N,sr,sc,r,c;
char S[maxn],T[maxn];
bool ans;

int main(){
	scanf("%d%d%d%d%d",&H,&W,&N,&sr,&sc);
	scanf("%s%s",S+1,T+1);
	swap(sr,sc);
	r=sr,c=sc;
	for (int i=1;i<=N;++i){
		if (S[i]=='U') c--;
		if (!c){ans=1;break;}
		if (c<H&&T[i]=='D') c++;
	}
	
//	cout<<ans<<endl;
	
	
	r=sr,c=sc;
	for (int i=1;i<=N;++i){
		if (S[i]=='D') c++;
		if (c>H){ans=1;break;}
		if (c>1&&T[i]=='U') c--;
	}
	
//	cout<<ans<<endl;
	
	r=sr,c=sc;
	for (int i=1;i<=N;++i){
		if (S[i]=='L') r--;
		if (!r){ans=1;break;}
		if (r<W&&T[i]=='R') r++;
	}
	
//	cout<<ans<<endl;
	
	r=sr,c=sc;
	for (int i=1;i<=N;++i){
		if (S[i]=='R') r++;
//		cout<<r<<" "<<i<<endl;
		if (r>W){ans=1;break;}
		if (r>1&&T[i]=='L') r--;
	}
	puts(ans?"NO":"YES");
}

Measured memory_bytes: 640
import itertools
import sys
input = sys.stdin.buffer.readline

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

W = [[10**10 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  a, b, c = map(int, input().split())
  W[a][b], W[b][a] = c, c
#print(W)
  
for k in range(N+1):
  for i in range(N+1):
    for j in range(N+1):
      W[i][j] = min(W[i][j], W[i][k] + W[k][j])
#print(W)

answer = 10**10
for v in itertools.permutations(r, R):
  tmp = 0
  for i in range(1, R):
    tmp += W[v[i]][v[i-1]]
  answer = min(answer, tmp)
print(answer)

Measured memory_bytes: 42476
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll  long  long
#define INF 0x3f3f3f3f
#define pll pair<long long , long long>
const int MAX=1e6+9;
const ll MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];
int prime[MAX];
int main() 
{
   int n;
   cin>>n;
   int stp=0;
   int arr[n+1];
   int g=0;
   for(int i=1;i<=n;i++)
    cin>>arr[i];
    memset(prime , false, sizeof(prime));
    for(int i=1;i<=n;i++){
        g=__gcd(arr[i] , g);
        for(int j=2;j*j<=arr[i];j++){
            while(arr[i]%j==0){
                if(prime[j]!=i and prime[j]!=0){
                    stp=1;
             //       cout<<j<<" "<<i<<endl;
                }
                prime[j]=i;
                arr[i]=arr[i]/j;
            }
        }
        if(arr[i]>1){
            if(prime[arr[i]] and prime[arr[i]]!=0){
                stp=1;
           //     cout<<arr[i]<<" "<<i<<endl;
            }
            prime[arr[i]]=i;
        }
    }
    if(!stp)
        cout<<"pairwise coprime";
    else{
     //   cout<<g<<endl;
        if(g==1)
            cout<<"setwise coprime";
        else
            cout<<"not coprime"<<endl;
    }


}


Measured memory_bytes: 34840
def cal(Ai,B,C):
    val=0
    for j in range(len(Ai)):
        val+=Ai[j]*B[j]
    val+=C
    return val>0

N,M,C=map(int,input().split())
B=list(map(int,input().split()))

ans=0
for i in range(N):
    Ai=list(map(int,input().split()))
    if cal(Ai,B,C):
        ans+=1

print(ans)

Measured memory_bytes: 38256
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;

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


int main(void) {
	string s;
	int a, b;

	cin >> s;

	a = (s[0] - '0') * 10 + (s[1] - '0');
	b = (s[2] - '0') * 10 + (s[3] - '0');

	if (a > 12) {
		if (b > 0 && b <= 12) {
			cout << "YYMM" << endl;
		}
		else {
			cout << "NA" << endl;
		}
	}
	else if (a > 0) {
		if (b > 0 && b <= 12) {
			cout << "AMBIGUOUS" << endl;
		}
		else {
			cout << "MMYY" << endl;
		}
	}
	else {
		if (b > 0 && b <= 12) {
			cout << "YYMM" << endl;
		}
		else {
			cout << "NA" << endl;;
		}
	}

	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskG solver = new TaskG();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskG {
        
        long[] f = new long[111111];
        static final long MOD = (long) (1e9+7);
        private void preprocess()
        {
            f[0] = f[1] = 1;
            for(int i=2;i<f.length;i++)
                f[i] = (f[i-1] * i) % MOD;
        }
        
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            preprocess();
            int a = in.nextInt();
            int b = in.nextInt();
            if(Math.abs(a-b)>1)
            {
                out.print(0);
            }else
            {
                if(Math.abs(a-b)==1)
                {
                    out.print((f[a] * f[b]) % MOD);
                }
                else
                {
                    out.print(((long) 2 * f[a] * f[b]) % MOD);
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


Measured memory_bytes: 21460
#include<iostream>
#include<vector>
#include<deque>
#include<tuple>
using namespace std;

struct rtree{
  int org;
  int rig;
  int lef;
};

int main(){
  vector<rtree> node;
  int n;

  cin >> n;
  node.resize(n);
  for(int i=0;i<n;i++){
    node[i].org = node[i].rig = node[i].lef = i;
  }
  for(int i=0;i<n;i++){
    int id,left,right;

    cin >> id >> left >> right;
    if(left != -1){
      node[id].lef = left;
      node[left].org = id;
    }
    if(right != -1){
      node[id].rig = right;
      node[right].org = id;
    }
  }

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

    if(i == node[i].org){
      cout << ": parent = -1";
    }else{
      cout << ": parent = " << node[i].org;
    }

    if(i == node[i].org){
      cout << ", sibling = -1";
    }else if((node[i].org == node[node[i].org].lef) || (node[i].org == node[node[i].org].rig)){
      cout << ", sibling = -1";
    }else if(i == node[node[i].org].lef){
      cout << ", sibling = " << node[node[i].org].rig;
    }else{
      cout << ", sibling = " << node[node[i].org].lef;
    }

    if((i == node[i].rig) && (i == node[i].lef)){
      cout << ", degree = 0";
    }else if((i == node[i].rig) || (i == node[i].lef)){
      cout << ", degree = 1";
    }else{
      cout << ", degree = 2";
    }

    for(int j=i,counter=0;;counter++){
      if(j == node[j].org){
        cout << ", depth = " << counter;
	break;
      }else{
        j = node[j].org;
      }
    }

    deque<tuple<int,int> > que;
    que.push_back(make_tuple(i,0));
    for(int j,counter;;){
      j = get<0>(que[0]);
      counter = get<1>(que[0]);
      que.pop_front();
      if(j != node[j].rig){
        que.push_back(make_tuple(node[j].rig,counter+1));
      }
      if(j != node[j].lef){
	que.push_back(make_tuple(node[j].lef,counter+1));
      }
      if(que.empty()){
	cout << ", height = " << counter;
        break;
      }
    }

    if(i == node[i].org){
      cout << ", root" << endl;
    }else if((i == node[i].rig) && (i == node[i].lef)){
      cout << ", leaf" << endl;
    }else{
      cout << ", internal node" << endl;
    }
  }
}


Measured memory_bytes: 3096
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { -1,0,1,0 }, dy[4] = { 0,-1,0,1 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        (wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

LL x, y;

int main() {
	cin >> x >> y;
	cout << (abs(x - y) >= 2 ? "Alice" : "Brown") << endl;
}

Measured memory_bytes: 256
n,w=map(int,input().split())
ans=[0]*(w+1)
for i in range(n):
    e,v=map(int,input().split())
    for j in range(w,-1,-1):
        if j+e<=w:
            ans[j+e]=max(ans[j]+v,ans[j+e])
print(max(ans))

Measured memory_bytes: 42348
#include <iostream>

int main (){
  int a, b;
  std::cin >> a >> b;
  if (a>b)
    std::cout << "a > b" << std::endl;
  else if (a<b)
    std::cout << "a < b" << std::endl;
  else
    std::cout << "a == b" << std::endl;
}



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

int main() {
	int n; cin >> n;
	int q; cin >> q;
	dsu d(n);
	while(q--) {
		int t, u, v; cin >> t >> u >> v;
		if(t == 0) {
			d.merge(u, v);
		} else {
			cout << d.same(u, v) << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 3976
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.C_Challenge
{
    class ABC_043
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var array = new int[n];
            string[] input = Console.ReadLine().Split(' ');
            int average = 0;
            for (int i = 0; i < n; i++)
            {
                array[i] = int.Parse(input[i]);
                average += array[i];
            }
            average /= n;
            int cost0 = 0, cost1 = 0, cost2 = 0;
            for (int i = 0; i < n; i++)
            {
                cost0 += (average - array[i])
                    * (average - array[i]);
                cost1 += (average + 1 - array[i])
                    * (average + 1 - array[i]);
                cost2 += (average - 1 - array[i])
                    * (average - 1 - array[i]);
            }
            if (cost0 < cost1 && cost0 < cost2)
            {
                Console.WriteLine(cost0);
            }
            else if (cost1 < cost0 && cost1 < cost2)
            {
                Console.WriteLine(cost1);
            }
            else
            {
                Console.WriteLine(cost1);
            }
        }
    }
}


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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int a = sc.NextInt();
        int b = sc.NextInt();
        int k = sc.NextInt();


        List<int> answers = new List<int>();

        for (int i = a; i <= b && i <= a + k - 1; i++)
        {
            answers.Add(i);
        }
        for (int i = b; i >= a && i >= b - k + 1; i--)
        {
            answers.Add(i);
        }

        answers = answers.Distinct().OrderBy(i => i).ToList();

        foreach (var answer in answers)
        {
            Console.WriteLine(answer);
        }
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "-1" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

int main(void){
    ll x;
    cin >> x;
    cout << 1-x << endl;
    
    return 0;
}



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

int solve(vector<int> &h, int n){
    vector<int> dp(n, INT32_MAX);
    dp[0] = 0;

    for(int i = 1;i < n;i++){
        if(i >= 1){
            dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]));
        }
        if(i >= 2){
            dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]));
        }
    }

    return dp[n-1];
}

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(auto &x: h){
        cin >> x;
    }

    cout << solve(h, n) << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    VI c(6), b = { 1,5,10,50,100,500 };
    cin >> c;
    int num = 0;
    FOR(i, 0, 6)num += c[i] * b[i];
    cout << (num >= 1000) << "\n";
}


Measured memory_bytes: 3160
#include<iostream>
#include<algorithm>

using namespace std;

int main() {
	int a[3], count;

	cin >> a[0] >> a[1] >> a[2];

	sort(&a[0], &a[3]);

	count = a[2] - a[1];

	if ((a[1] - a[0]) % 2 == 0) {
		count += (a[1] - a[0]) / 2;
	}
	else {
		count += (a[1] - a[0]) / 2 + 2;
	}

	cout << count;

	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()

int h,w;
ll d[1010][1010];
char c[1010][1010];

void input(){
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>c[i][j];
		}
	}
	return;
}

void solve(){
	d[0][0]=1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(c[i+1][j]!='#')d[i+1][j]=(d[i+1][j]+d[i][j])%MOD;
			if(c[i][j+1]!='#')d[i][j+1]=(d[i][j+1]+d[i][j])%MOD;
		}
	}
	cout<<d[h-1][w-1]<<endl;
	return;
}

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

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

#define rep(i, s, n) for(int i=(s);i<(int)n;i++)
int INF=1e9+7;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M+1),b(M+1);
  int i=0;
  while(M-2*i>0) {
    a[M-2*i]=i+1;
    b[M-2*i]=M-i+1;
    i++;
  }
  i=1;
  while(M-2*i+1>0) {
    a[M-2*i+1]=M+i+1;
    b[M-2*i+1]=2*M-i+2;
    i++;
  }
  rep(j,1,M+1) printf("%d %d\n",a[j],b[j]);
}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define y1 A2Dalek
#define y0 Cyberman
#define yn RoseTyler
#define j1 JackHarkness
#define fs first
#define sd second
const int N=2e5;
const int oo=1e9+5;
int du[]={-1,0,0,1};
int dv[]={0,-1,1,0};
const long long mod=1e9+7;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
long long sqr(long long x) {return x*x;}
int getbit(int state, int i) {return ((state>>i)&1);}

int n;
long long ans[N+5];
ii a[N+5];
bool cmp(ii X, ii Y)
{
    if (X.fs!=Y.fs) return X.fs>Y.fs;
    return X.sd<Y.sd;
}
int main()
{
	//freopen("Frequency.inp","r",stdin);
	//freopen("Frequency.out","w",stdout);
	ios_base::sync_with_stdio(false);
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i].fs;
        a[i].sd=i;
    }
    sort(a+1,a+1+n,cmp);
    int Min=oo;
    for (int i=1,j=1;i<=n;i++)
    {
        while (a[j].fs==a[i].fs)
        {
            Min=min(Min,a[j].sd);
            j++;
        }
        ans[Min]+=1ll*(j-1)*(a[j-1].fs-a[j].fs);
        i=j-1;
    }
    for (int i=1;i<=n;i++) cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

const int INF = 1<<30;

int main(){
    int n, m;
    cin >> n >> m;
    VI g(n, INF);
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        chmin(g[a], b);
    }

    int ans = 0, left = 0;
    while(left < n){
        if (g[left] == INF){
            left++;
            continue;
        }

        ans++;
        int i = left+1, right = g[left];
        while(i < right){
            if (g[i] != INF) chmin(right, g[i]);
            i++;
        }
        left = i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3764