akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int Maxn = 200010;
const int inf = 1<<23;
int a[Maxn], n, b[Maxn];
int seg[2][Maxn<<2];
int ans[Maxn];
void build_tree(int now, int L, int R) {
	seg[0][now] = seg[1][now] = -inf;
	if(L < R){
		int mid = L+R>>1, lc = now<<1, rc = now<<1|1;
		build_tree(lc, L, mid);
		build_tree(rc, mid+1, R);
	}
}
int _max(int x, int y) { return x > y ? x : y; }
int _min(int x, int y) { return x < y ? x : y; }
void chg(int op, int now, int L, int R, int x, int k) {
	if(L == R){ seg[op][now] = k; return; }
	int mid = L+R>>1, lc = now<<1, rc = now<<1|1;
	if(x <= mid) chg(op, lc, L, mid, x, k);
	else chg(op, rc, mid+1, R, x, k);
	seg[op][now] = _max(seg[op][lc], seg[op][rc]);
}
int qry(int op, int now, int L, int R, int l, int r) {
	if(L == l && R == r) return seg[op][now];
	int mid = L+R>>1, lc = now<<1, rc = now<<1|1;
	if(r <= mid) return qry(op, lc, L, mid, l, r);
	else if(l > mid) return qry(op, rc, mid+1, R, l, r);
	else return _max(qry(op, lc, L, mid, l, mid), qry(op, rc, mid+1, R, mid+1, r));
}
int main() {
	int i, j, k;
	scanf("%d", &n);
	for(i = 1; i <= n; i++) scanf("%d", &a[i]);
	int mx = 0, sum = 0;
	for(i = 1; i <= n; i++){
		b[i] = 1;
		if(a[i] > mx) b[i]++, mx = a[i], sum++;
	}
	a[n+1] = n+1;
	n++;
	build_tree(1, 1, n);
	chg(0, 1, 1, n, n, 0);
	for(i = n-1; i >= 1; i--){
		int o = b[i]&1;
		int p = qry(o, 1, 1, n, a[i]+1, n);
		if(p >= 0) chg(0, 1, 1, n, a[i], p+b[i]);
		p = qry(o^1, 1, 1, n, a[i]+1, n);
		if(p >= 0) chg(1, 1, 1, n, a[i], p+b[i]);
	}
	int c1 = 0, c2 = 0, h1 = 0, h2 = 0;
	sum--;
	chg(0, 1, 1, n, a[1], -inf); chg(1, 1, 1, n, a[1], -inf);
	if(qry((1+sum)&1, 1, 1, n, 1, n) >= 1+sum) c1++, h1 = a[1], ans[1] = 0;
	else if(qry((sum-1)&1, 1, 1, n, a[1]+1, n) >= sum-1) c2++, h2 = a[1], ans[1] = 1;
	else { printf("-1\n"); return 0; }
	for(i = 2; i <= n-1; i++){
		if(b[i] == 2) sum--;
		chg(0, 1, 1, n, a[i], -inf); chg(1, 1, 1, n, a[i], -inf);
		int nc, nh;
		if(a[i] > h1) nc = c1+1, nh = a[i];
		else nc = c1, nh = h1;
		int p = inf;
		if(nc-c2+sum >= 0) p = _min(p, nc-c2+sum);
		if(c2-nc+sum >= 0) p = _min(p, c2-nc+sum);
		if(qry(p&1, 1, 1, n, h2+1, n) >= p){
			ans[i] = 0;
			c1 = nc; h1 = nh;
		} else {
			ans[i] = 1;
			if(a[i] > h2) c2++, h2 = a[i];
		}
	}
	for(i = 1; i <= n-1; i++) printf("%d", ans[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 8960
#ITP1_7_D
n,m,l=map(int,input().split())
a=[]
b=[]
for _ in range(n):
    a.append(list(map(int,input().split())))
for _ in range(m):
    b.append(list(map(int,input().split())))

c=[[0 for _ in range(l)] for _ in range(n)]

for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j]+=a[i][k]*b[k][j]

for i in range(n):
    for j in range(l-1):
        print(c[i][j],end=" ")
    print(c[i][-1])


Measured memory_bytes: 7064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans;
  t1 = n / k;
  t2 = n - k * t1;
  cout << min(t2,abs(t2 - k)) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#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 fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = 2147483647;
const ll LLINF = 1LL<<60;

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

ll n,m,ans;
cin >> n >> m;
ans = min(n,m/2);
if(n<m){
    ans += (m-n*2)/4;
}
fin(ans);

//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
#include<math.h>
using namespace std;
vector<long long> code(26, 0);

vector<long long> button(10001, 0);

int main() {
	int A, B;
	cin >> A >> B;
	if ((A % 3) == 0 || (B % 3) == 0 || (A + B) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}

	return 0;
}


Measured memory_bytes: 384
N, M = map(int,input().split())
par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
    size[y] += size[x]
    size[x] = 0

for i in range(M):
    x, y, z= map(int,input().split())
    unite(x,y)

Ans = 0
for j in size[1:]:
    if j != 0:
        Ans +=1
print(Ans)


Measured memory_bytes: 14488
import java.util.Random;
import java.util.Scanner;

public class Main {
    static int d = 365;
    static int[] c = new int[26];
    static int[][] s = new int[d][26];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Random random = new Random();
        sc.nextInt();
        for (int i=0;i<26;i++){
            c[i]=sc.nextInt();
        }
        for (int i=0;i<d;i++){
            for (int j=0;j<26;j++){
                s[i][j]=sc.nextInt();
            }
        }
        int[] contest = new int[d];
        int count = 100000;
        for (int i=0;i<d;i++)contest[i]=random.nextInt(26);
        for (int i=0;i<count;i++){
            int[] instance = contest.clone();
            int times = random.nextInt(3)+3;
            int[] choose = new int[times];
            for (int j=0;j<times;j++)choose[j]=random.nextInt(d);
            for (int j=0;j<times;j++)instance[choose[j]]=random.nextInt(26);
            if (function(contest)<function(instance))contest=instance;
        }
        for (int i=0;i<d;i++)System.out.println(contest[i]+1);
    }
    static long function(int[] contest){
        long satisfaction = 0;
        int[] interval = new int[26];
        for (int i=0;i<d;i++){
            satisfaction+=s[i][contest[i]];
            for (int j=0;j<26;j++)interval[j]++;
            interval[contest[i]]=0;
            for (int j=0;j<26;j++)satisfaction-=c[j]*interval[j];
        }
        return  satisfaction;
    }
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
 
int main() {
 
    zoom;
    ll N, K, i;
    cin >> N >> K;
    vector<ll> A(N);
    map<ll, ll> cnt;
    for(i = 0; i < N; i += 1) {
        cin >> A[i];
        if(cnt.find(A[i]) == cnt.end())
            cnt[A[i]] = 0;
        cnt[A[i]] += 1;
    }
    ll tot = N;
    map<ll, ll>::reverse_iterator it;
    map<ll, ll> look;
    for(it = cnt.rbegin(); it != cnt.rend(); it++) {
        tot -= it -> second;
        look[it -> first] = tot;
    }
    vector<ll> dp(N, 0);
    multiset<ll> x;
    x.insert(A[N - 1]);
    for(i = N - 2; i >= 0; i -= 1) {
        multiset<ll>::iterator it1 = x.lower_bound(A[i]);
        dp[i] = (ll)distance(x.begin(), it1);
        x.insert(A[i]);
    }
    ll ans = 0;
    for(i = 0; i < N; i += 1) {
        ll one = (look[A[i]] * (((K * (K - 1)) / 2) % MOD)) % MOD;
        ll two = (K * dp[i]) % MOD;
        one = (one + two) % MOD;
        ans = (ans + one) % MOD;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
using namespace std;
using ll = long long int;
const ll MOD = 1000000007;

ll mod_pow(ll A, ll K) {
    ll ret = 1;
    for(; K>0; K>>=1) {
        if(K & 1) (ret *= A) %= MOD;
        (A *= A) %= MOD;
    }
    return ret;
}

ll sum[100010][4];
int main() {
    string s, pat = "ABC?"; cin >> s;
    int N = s.length();

    // 累積和を出す
    for(int i=0; i<N; i++) {
        int f = pat.find(s[i]);
        for(int k=0; k<4; k++) {
            sum[i+1][k] = sum[i][k] + (f == k);
        }
    }

    ll ans = 0;
    for(int i=0; i<N; i++) {
        // 'B' になる可能性のあるところについて
        if(s[i] == 'B' or s[i] == '?') {
            // 左に 'A'、及び右に 'C' がいくつできるか？
            ll l_a =             sum[i  ][0], l_q =             sum[i  ][3];
            ll r_c = sum[N][2] - sum[i+1][2], r_q = sum[N][3] - sum[i+1][3];

            ll val_l = (l_a * mod_pow(3, l_q) + l_q * mod_pow(3, l_q - 1)) % MOD;
            ll val_r = (r_c * mod_pow(3, r_q) + r_q * mod_pow(3, r_q - 1)) % MOD;
            (ans += val_l * val_r) %= MOD;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define vi vector<int>
typedef long long ll;

using namespace std;

inline int f(int x){
	return ((x + 1) % 2) + ((x - 1) % 2) + (x % 2);	
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(0); 

	int n;
	cin >> n;
	int ans = pow(3 , n);
	int odd = 1;
	rep(i , n){
		int x;
		cin >> x;
		odd *= f(x);
	}
	
	cout << ans - odd;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    if( (n%2 == 0)^(s.front() == s.back()) ) {
        cout << "Second";
    }
    else {
        cout << "First";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 512
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  execute(sc.nextInt(), sc.nextInt(), sc.nextInt())

  def execute(m: Int, f: Int, r: Int): Unit = {
    (m, f, r) match {
      case (-1, -1, -1) => sc.close()
      case _ =>
        printGrade((m,f,r))
        execute(sc.nextInt(), sc.nextInt(), sc.nextInt())
    }

    def printGrade(set: (Int, Int, Int)) = {
      set match {
        case _ if set._1 == -1 || set._2 == -1 || set._1 + set._2 < 30 => println("F")
        case _ if set._1 + set._2 >= 80 => println("A")
        case _ if set._1 + set._2 >= 65 => println("B")
        case _ if set._1 + set._2 >= 50 => println("C")
        case _ if set._1 + set._2 >= 30 => if (set._3 >= 50) println("C") else println("D")
      }
    }
  }
}

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

sum = 0
for n in range(N):
    x, u = map(str, input().split())
    x = float(x)

    if u == "JPY":
        yen = 1.0
    elif u == "BTC":
        yen = 380000.0
    sum += x * yen
    
print(sum)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;

namespace ITP1_3_B_Print_Test_Cases
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            var list = new List<int>();
            while ( ( s = Console.ReadLine() ) != "0" )
                list.Add( int.Parse( s ) );
            var counter = 1;
            foreach ( var i in list )
                Console.WriteLine( "Case " + counter++ + ": " + i );
        }
    }
}

Measured memory_bytes: 5860
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b;
    cin>>a>>b;
    if(a>b)swap(a,b);
    if(a == 1 and b == 2)cout << 3 << endl;
    else if(a == 1 and b == 3)cout << 2 << endl;
    else cout << 1 << endl;
    return 0;
}



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

using namespace std;

int main()
{
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    // 連続で並んでいる数値の数を数える。
    // 1-0-1-0-1-... の順番で数値を見る。
    vector<int> v;
    int cur = 1;
    int count = 0;
    for(int i = 0; i < n; i++) {
        if (s[i] == (char)('0' + cur)) {
            count++;
        } else {
            cur = 1 - cur;
            v.push_back(count);
            count = 1;
        }
    }
    
    // 1-0-1-0-1 と並ぶような配列を作る
    if(count != 0) v.push_back(count);
    if(v.size()%2 == 0) v.push_back(0);

    // 累積和
    vector<int> sum(v.size()+1);
    for (int i = 0; i < v.size(); i++) {
        sum[i+1] = sum[i] + v[i];
    }

    // 計算。偶数番目を見る
    int add = 2 * k + 1;
    int ans = 0;
    for (int i = 0; i < v.size(); i+=2) {
        int left = i;
        int right = min(i + add, (int)v.size());
        int tmp = sum[right] - sum[left];
        ans = max(tmp, ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1272
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;
typedef pair<ll  ,ll > pll;

const ll maxn =9e5+100;
const ll mod = 1e9+7;
const ld PI = 4 * atan((ld) 1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
#define ms(x , y) memset(x , y , sizeof x);
ll pw(ll a, ll b) {
    return (!b ? 1 : (b & 1 ? a * pw(a * a % mod, b / 2) % mod : pw(a * a % mod, b / 2) % mod));
}

int a[3][3];
int n , b[maxn];
bool c[maxn];

int main(){
    migmig
    for (int i = 0 ; i < 3 ; i ++){
        for (int j = 0 ; j < 3 ; j ++){
            cin >> a[i][j];
        }
    }
    cin >> n;
    for (int i = 0 ; i < n ; i ++){
        cin >> b[i];
        c[b[i]] = 1;
    }
    for (int i = 0 ; i < 3 ; i ++){
        bool f = 1;
        f&=c[a[i][0]];
        f&=c[a[i][1]];
        f&=c[a[i][2]];
        if(f){
            dokme("Yes");
        }
        f = 1;
        f&=c[a[0][i]];
        f&=c[a[1][i]];
        f&=c[a[2][i]];
        if(f){
            dokme("Yes");
        }
        f = 1;
        f&=c[a[0][0]];
        f&=c[a[1][1]];
        f&=c[a[2][2]];
        if(f){
            dokme("Yes");
        }
        f = 1;
        f&=c[a[0][2]];
        f&=c[a[1][1]];
        f&=c[a[2][0]];
        if(f){
            dokme("Yes");
        }
    }
    cout << "No";
    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#define rep0(i, n) for (i = 0; i < n; i++)
#define rep(s, i, n) for (i = s; i < n; i++)
#define N_MAX 10000
using namespace std;

int N;

int main()
{
    cin >> N;
    int ans = N % 1000 == 0 ? 0 : 1000 - N % 1000;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
struct edge{int to,cost;};
typedef pair<int,int> P;
typedef long long ll;
const ll INF=2147483647;
const ll MOD=1000000007LL;
const ll MAX=200000;
ll n,dat[2*MAX];
//初期化
void init(ll n_){
	n=1;
	while(n<n_){
		n*=2;
	}
	for(ll i=0;i<2*n-1;i++){
		dat[i]=INF;
	}
}
//k番目の値をaに変更
void update(ll k,ll a){
	k+=n-1;
	dat[k]=a;
	while(k>0){
		k=(k-1)/2;
		dat[k]=min(dat[k*2+1],dat[k*2+2]);
	}
}
//[a,b)の最小値を求める query(a,b,0,0,n)と呼ぶ
ll query(ll a,ll b,ll k,ll l,ll r){
	if(r<=a||b<=l){
		return INF;
	}
	if(a<=l&&r<=b){
		return dat[k];
	}
	ll vl=query(a,b,k*2+1,l,(l+r)/2);
	ll vr=query(a,b,k*2+2,(l+r)/2,r);
	return min(vl,vr);
}

int main(){
	ll q;
	cin>>n>>q;
	init(n);
	for(ll i=0;i<q;i++){
		ll com,x,y;
		cin>>com>>x>>y;
		if(com){
			cout<<query(x,y+1,0,0,n)<<endl;
		}else{
			update(x,y);
		}
	}
	return 0;
}



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

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
static long mod=(long)1e9+7;
//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
				assign();
				int t=1;//int_v(read()),cn=1;
				while(t--!=0){
					int n=int_v(read());
					int[] arr=int_arr();
					int[] f=new int[n];
					for(int i:arr){f[i]++;}
					boolean b=true;
					if((n%2==0&&f[0]>0)||f[0]>1){b=false;}
					if(n%2==0){
						for(int i=1;i<n;i+=2){
							if(f[i]!=2){
								b=false;break;
							}
						}
					}
					if(n%2==1){
						for(int i=2;i<n;i+=2){
							if(f[i]!=2){
								b=false;break;
							}
						}
					}
					if(!b){
						out.write("0");
					}
					else{
						out.write(Modpow(2l,n/2,mod)+"");
					}
					
				}
			    
			    out.flush();

	}
}

Measured memory_bytes: 47136
X,Y=map(int,input().split())
A=1,3,5,7,8,10,12
B=4,6,9,11
C=2
ans="No"
if X in A and Y in A:
    ans="Yes"
elif X in B and Y in B:
    ans="Yes"
elif X==Y==2:
    ans="Yes"
print(ans)

Measured memory_bytes: 9188
#include <stdio.h>
#include <math.h>

main()
{
int h,w;
while(1){
	scanf("%d %d",&h,&w);
	if((h|w)==0)break;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			printf("%c",j==0||j==w-1||i==0||i==h-1?'#':'.');
		}
		printf("\n");
	}
	printf("\n");
}
}


Measured memory_bytes: 2112
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a,b;
    int x,y;
    scanf("%d %d",&a,&b);
    x = a * b;
    y = a*2 + b*2;
    printf("%d %d\n",x,y);
    return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll r,g,b,n; cin>>r>>g>>b>>n;
  ll ans=0;
  rep(i,n+1){
    rep(j,n+1){
      ll k=n-i*r-j*g;
      if(k<0 || k%b) continue;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()

int main() {
  int c,d,e,f,g,h,i,j,k;
bool ans=false; 
 cin>>c>>d>>e>>f>>g>>h>>i>>j>>k;
  for(int a1=-100;a1<=100;a1++){
    for(int a2=-100;a2<=100;a2++){
       for(int a3=-100;a3<=100;a3++){
     int b1=c-a1;
     int b2=d-a1;
     int b3=e-a1;
         if(f==a2+b1&&g==a2+b2&&h==a2+b3&&i==a3+b1&&j==a3+b2&&k==a3+b3){
         ans=true;}
   }
   }
  }
  if(ans){
cout<<"Yes"<<endl;
}else{
 cout<<"No"<<endl; }
}


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

int main(){
  char s[100005];
  scanf("%s", s);
  int n = strlen(s);
  if(s[0] - s[n-1] <= 0) n = 0;
  for(int i = 0; i < n-1; i++)
    if(s[i] != s[n-2-i]) n = 0;
  for(int i = n-2; i >= 0; i--){
    printf("%d %d\n", i+1, n);
    if(s[i] == '1') n = i+1;
  }
  if(!n) puts("-1");
}


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

int main(){
  int n; cin >> n;
  string S; cin >> S;
  
  int c=0;
  for(int i=0; i<n; i++){
    if('R'==S[i]){c++;}
    else{c--;}
  }
  
  if(c>0){cout << "Yes";}
  else{cout << "No";}
  
  return 0;
}

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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 3005;

const long double PI = acos(-1);

int n, L, a[N];

int main() {
	read(n), read(L);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	long double ansx = 0, ansy = 0;
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (i != j) {
				long long li = a[i], lj = a[j] > a[i] ? a[j] : a[j] + L;
				int t = (n + j - i) % n + 1;
				ansx += (n - t) * cos(PI * (li + lj) / L);
				ansy += (n - t) * sin(PI * (li + lj) / L);
			}
		}
	}
	long long c = 1ll * n * (n - 1) * (n - 2) / 6;
	printf("%.15lf %.15lf\n", (double)ansx / c, (double)ansy / c);
}


Measured memory_bytes: 4168
import sys
from collections import deque
from heapq import heapify, heappop, heappush
from itertools import combinations, permutations
from bisect import bisect, bisect_left

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    c = a * b
    while a % b > 0:
        a, b = b, a % b
    return b

def solve():
    input = sys.stdin.readline
    mod = 7 + 10 ** 9
    N = int(input())
    A = [int(a) for a in input().split()]
    if N == 1: print(1)
    else:
        lcm = A[0]
        for i in range(1, N):
            gcd_a = gcd(lcm, A[i])
            lcm = lcm * A[i] // gcd_a
        lcm %= mod
        sumB = 0
        for i,a in enumerate(A):
            sumB += lcm * pow(a, mod - 2, mod)
            sumB %= mod

        print(sumB)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 4460
from itertools import combinations
n=int(input())
march=[0,0,0,0,0]
for _ in range(n):
  s=input()
  if s[0]=="M":
    march[0]+=1
  if s[0]=="A":
    march[1]+=1
  if s[0]=="R":
    march[2]+=1
  if s[0]=="C":
    march[3]+=1
  if s[0]=="H":
    march[4]+=1
ans=0
for a,b,c in combinations([0,1,2,3,4],3):
  ans+=march[a]*march[b]*march[c]
print(ans)

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

int main()
{
	int h, w;
	int i, n;

	while (1) {
		cin >> h >> w;
		
		if (h < 1 || 300 < w) {
			break;
		}

		for (i = 0; i < h; i++) {
			for (n = 0; n < w; n++) {
				//(偶数、偶数)
				if (i % 2 == 0 && n % 2 == 0) {
					cout << "#";
				}
				else if (i % 2 == 1 && n % 2 == 1) {
					cout << "#";
				}
				else if (i % 2 == 1 && n % 2 == 0) {
					cout << ".";
				}
				else {
					cout << ".";
				}
			}
			cout << endl;
		}
		cout << endl;
	}
    return 0;
}




Measured memory_bytes: 3084
import java.util.Arrays;
import java.util.Scanner;


public class Main {

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

		int n = sc.nextInt();
		int m = sc.nextInt();

		int[] c = new int[m];
		for (int i = 0; i < m; i++) {
			c[i] = sc.nextInt();
		}

		int[] dp = new int[n + 1];
		Arrays.fill(dp, Integer.MAX_VALUE);
		dp[0] = 0;
		
		for (int i = 1; i <= n; i++) {
			for (int j = 0; j < m; j++) {
				if (i - c[j] >= 0) {
					dp[i] = Math.min(dp[i], dp[i - c[j]] + 1);
				}
			}
		}
		
		System.out.println(dp[n]);

		sc.close();
	}
}

Measured memory_bytes: 19912
import numpy as np
import copy as cp

def isTree(graph,know=[],now=0):
    if not know: know = [0]*len(graph[0])
    know[now] = 1
    for next in range(n):
        if know[next]==1 or graph[now][next]==0: continue
        else: isTree(graph,know,next)
    if all(know): return 1
    else: return 0

n,m = map(int,input().split())
ab = np.array([list(map(int,input().split()))for i in range(m)])
a,b = ab.T[0]-1, ab.T[1]-1

G = [[0]*n for i in range(n)]
for i in range(m):
    aa,bb = a[i],b[i]
    G[aa][bb],G[bb][aa] = 1,1

# 除外する辺を決めてループ
ans = 0
for i in range(m):
    aa,bb = a[i],b[i]
    tree = cp.deepcopy(G)
    tree[aa][bb],tree[bb][aa] = 0,0
    if not isTree(tree): ans += 1

print(ans)


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

using namespace std;
typedef long long ll;

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;
    ll res;
    if (a > b || (n == 1 && a != b))
        cout << 0;
    else
    {
        ll l = n * a + (b - a);
        ll r = n * b - (b - a);
        res = r - l + 1;
        cout << res;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long ans = 0;
		for(int i = 0; i < n; i++) {
			long a = sc.nextInt();
			while(a % 2 == 0) {
				ans++;
				a /= 2;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 34120
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x;
  cin >> x;

  cout << "ABC" << x << endl;
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split(' '))
if N >= M:
    print(0)
else:
    points = sorted(tuple(map(int, input().split(' '))))
    distances = sorted([abs(p1 - p2) for p1, p2 in zip(points, points[1:])], reverse=True)
    print(sum(distances[N - 1:]))


Measured memory_bytes: 13968
#include<stdio.h>
#include<math.h>
int main(void)
{
  int n,k,pown[100010];
  double e=0;
  scanf("%d%d",&n,&k);
  for(int i=0;i<n;i++){
    for(int j=0;j<20;j++){
      if((i+1)*pow(2,j)>=k){
        pown[i]=j;
        break;
      }
    }
    e+=((double)1/n)*pow(0.5,pown[i]);
  }
  printf("%.12f",e);
  return 0;
}


Measured memory_bytes: 512
import sys
s = input()

l1 = ['L', 'U', 'D']
l2 = ['R', 'U', 'D']

cnt = 0
for i in range(len(s)):
  if i == 0 or i%2 == 0:
    if s[i] not in l2:
      print('No')
      sys.exit()
  else:
    if s[i] not in l1:
      print('No')
      sys.exit()

print('Yes')

Measured memory_bytes: 9128
N, M = map(int, input().split())
H = list(map(int, input().split()))
li = [True]*N
for i in range(M):
    a, b = map(int, input().split())
    if H[a-1] >= H[b-1]:
        li[b-1] = False
    if H[b-1] >= H[a-1]:
        li[a-1] = False
ans = 0
for i in range(N):
    if li[i]:
        ans += 1
print(ans)

Measured memory_bytes: 84932
from sys import stdin
n = input().split(' ')
c = 0
K = int(n[0])
S = int(n[1])
for i in range(int(K)+1):
    for j in range(int(K)+1):
        if(S-(i+j) <= K and S>=i+j):
            c+=1
                
print(c)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std ;
	#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	#define lli long long int
	#define ulli unsigned long long int
	#define ff first
	#define ss second
	#define mp make_pair
	#define pb push_back
	#define pf pop_front()
	#define lb lower_bound
	#define ub upper_bound
	#define bs binary_search
	#define loop(i,a,b) for(lli i=a;i<b;i++)
	#define loopi(i,a,b) for(int i=a;i<b;i++)
	#define all(v) v.begin(), v.end()
	#define mod 1000000007
	#define inf 100000000000000000
	#define lld long double
	#define pll pair<long long int,long long int>
	#define pii pair<int,int>
	#define vll vector<lli>
	#define vii vector<int>
	#define endl '\n'
	#define setp(k, x) fixed << setprecision(k) << (x)
	#define deb(x) cerr << #x << ": " << x << " " << endl;
	#define debug(x) cout << "m here-" <<#x<<" ..."<<"\n";
	#define printa(a,n) for(lli i=0;i<n;i++) cout<<a[i]<<" "; cout<<"\n";
  #define printv(a) for(lli i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<"\n";
	bool sortcol( const vector<lli>& v1, const vector<lli>& v2 ) //sort on basis of column //use- sort(vect.begin(), vect.end(),sortcol);
      { return v1[1] < v2[1]; }//[] o based indexing in column
	bool sortpair(const pair<char, lli> &a, const pair<char, lli> &b)
				{return a.second < b.second;}


int main ()
{
	// fastio
// 	lli  t;
 //	cin>>t;
 	//while(t--)
 	{
		lli n,i,d,a,b,c,j,k=0,f=0,x,y,ans,tt=0;
    cin>>k;
    for(i=1;i<=k;i++)
    {
      for(j=1;j<=k;j++)
      {
        for(tt=1;tt<=k;tt++)
          f+=__gcd(__gcd(i,j),tt);

      }
    }
      cout<<f<<"\n";
 	}

	return 0;
}


Measured memory_bytes: 3584
#include<stdio.h>


int main(void) {
  int cooking[5];
  int least = 10, least_idx = -1;
  for(int i=0;i<5;i++){
    scanf("%d", &cooking[i]);
    if(cooking[i]%10 ==0)continue;
    if(least > cooking[i]%10) {
      least = cooking[i]%10;
      least_idx = i;
    }
  }

  int sum = cooking[least_idx];
  for(int i=0;i<5;i++) {
    if(i != least_idx) {
      sum += ((cooking[i] + 9) / 10) * 10;
    }
  }
  printf("%d\n", sum);

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    int k;
    cin >> k;
    int nodd;
    int neven;
    if(k % 2 == 0){
        nodd = k / 2;
        neven = k - nodd;
    }else{
        nodd = k / 2 + 1;
        neven = k - nodd;
    }
    cout << nodd * neven;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
const int maxn=1e9;
void read(int &xxxxx){scanf("%d",&xxxxx);}
int a[100010];
ll sum[100010];

int main()
{
    int n;cin>>n;
    rep(i,1,n+1) read(a[i]);sort(a+1,a+n+1);
    rep(i,1,n+1) sum[i]=sum[i-1]+(ll)a[i];
    if(n%2==0) printf("%lld\n",2*sum[n]-4*sum[n/2]-(ll)(a[n/2+1]-a[n/2]));
    else{
        ll aa=2*sum[n]-4*sum[n/2]-(ll)a[n/2+1]-(ll)a[n/2+2];
        ll bb=2*sum[n]-4*sum[n/2+1]+(ll)a[n/2+1]+(ll)a[n/2];
        printf("%lld\n",max(aa,bb));
    }
    return 0;
}


Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		long [] in = new long [a];        
        for(int i=0;i<a;i++){
                             in[i] = sc.nextLong();
                            }       
		long ans = 1000;
        long kabu = 0;
        int i = 0;
        while(i<a){long max = in[i];if(i==a-1){i=a;}
                   for(int j=i+1;j<a;j++){         
          if(in[j]<max){          
          kabu = ans/in[i];
        ans+=(max-in[i])*kabu;
            i=j;
            break;}
          else{max = in[j];
              if(j==a-1){kabu = ans/in[i];
                         ans+=(max-in[i])*kabu;
                         i=j;
                        }
              }                                                                                                       
        }                                                                                     
                  }        
		System.out.println(ans);
	}
}

Measured memory_bytes: 35788
import sys
#import numpy as np

#+++++
		
def main2():
	n = int(input())
	water_list=list(map(int, input().split()))
	
	mw=water_list[-1]
	for i in range(mw+1):
		cv = mw - i
		init_cv=cv
		for w in water_list[::-1]:
			#print(w,cv, w-cv)
			cv = w - cv
			if cv < 0:
				break
		else:
			#print('hhh', cv, init_cv, mw)
			if init_cv == cv:
				ret = [0 for _ in range(n)]
				cv=init_cv
				for ii, ww in enumerate(water_list):
					ret[ii] = cv*2
					cv = ww - cv
					#print(ret)
				return ret
				
	return 'hoge'
	
def main():
	n = int(input())
	water_list=list(map(int, input().split()))
	a = sum(water_list) - 2*sum(water_list[1::2])
	ret = [a]
	next=a
	for v in water_list[:-1]:
		next = (v*2 - next)
		ret.append(next)
	
	print(*ret)
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		
	ret = main()
	if ret is not None:
		print(' '.join([str(i) for i in ret]))

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> x(N),y(N),h(N);
    int candx, candy, candh;
    for (int i=0;i<N;i++) {
        cin >> x[i] >> y[i] >> h[i];
        if (h[i]>0) {
            candx = x[i];
            candy = y[i];
            candh = h[i];
        }
    }
    bool end = false;
    int ansx, ansy;ll ansh;
    for (int xx=0;xx<=100;xx++){
        for (int yy=0;yy<=100;yy++){
            ll H = candh + abs(candx - xx) + abs(candy - yy);
            for (int i=0;i<N;i++){
                ll hh = H - abs(x[i] - xx) - abs(y[i]-yy);
                if (max(hh,0LL) != h[i]) break;
                if (i==N-1){
                    ansx = xx;
                    ansy = yy;
                    ansh = H;
                    end = true;
                    break;
                }
            }
            if (end) break;
        }
        if (end) break;
    }
    cout << ansx << " " << ansy << " " << ansh << "\n";
}

Measured memory_bytes: 3620
import std.stdio;
import std.conv;
import std.string;

void main() {
    auto n = readln.chomp.to!int;
    string[] words = [];
    auto ans = "Yes";
    foreach (i; 0..n) {
        auto word = readln.chomp;
        foreach (w; words) {
            if (w == word){
                "No".writeln;
                return;
            }
        }
        words ~= word;
    }

    foreach (i; 1..n){
        if (words[i - 1][$ - 1] != words[i][0]) {
            ans = "No";
            break;
        }
    }
    ans.writeln;
}


Measured memory_bytes: 256
N, M = [int(s) for s in input().split(' ')]
hypo = []

for _ in range(N):
  hypo.append([int(s) for s in input().split(' ')][1:])

like_counts = [0] * M
for h in hypo:
  h_ = list(set(h))
  for i in h_:
    like_counts[i - 1] += 1

counts = 0
for i in like_counts:
  if i == N:
    counts += 1
print(counts)


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define fs first
#define sc second

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

int main(){
	int n,d; cin >> n >> d;
	cout << ceil(n/(double)(d*2+1)) << endl;
}

Measured memory_bytes: 3772
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a)
	fmt.Scan(&b)

	c := 1
	d := 0

	for i := 1; c < b; i++ {
		c = c - 1
		c += a
		d++
	}

	fmt.Println(d)
}


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

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

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

int main() {
  int x, y;
  cin >> x >> y;
  if (x == y) {
    cout << "Yes" << endl;
  } else if ((x == 4 || x == 6 || x == 9 || x == 11) && (y == 4 || y == 6 || y == 9 || y == 11)) {
    cout << "Yes" << endl;
  } else if ((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) && (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val inputLine = readLine()!!.split(" ").map(String::toInt)
    val numN = inputLine[0]
    val numM = inputLine[1]

    val aList = readLine()!!.split(" ").map(String::toInt).toMutableList()

    aList.sortDescending()
    val sumA = aList.sum()
    val aSize = aList.filter{it >= sumA / (numM * 4).toDouble()}.size

    val result = if(aSize >= numM) "Yes" else "No"
    println(result)

}

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

int main(void){
  int n;
  vector<int> v;
  
  cin >> n;
  for (int i=0; i<n; i++){
    int q;
    cin >> q;
    if (q==0){
      int x;
      cin >> x;
      v.push_back(x);
    } else if (q==1){
      int p;
      cin >> p;
      cout << v[p] << endl;
    } else { // q==2
      v.pop_back();
    }
  }
  //cout << ans << endl;
  return 0;
}


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

    #define NIL NULL

    struct node{
      struct node *right;
      struct node *left;
      struct node *parent;
      int key;
    };
    typedef struct node * Node;

    Node root;

    Node treeMinimum(Node x){
      while(x->left!=NIL)
        x =x->left;
        return x;
    }

    Node treeMaximum(Node y){
      while(y->right != NIL)
        y = y->right;
        return y;
    }

    Node treeSearch(Node u, int c){
      while(u!=NIL && c!=u->key){

      if(c< u->key) u=u->left;

      else u=u->right;
      }
      return u;

    }

    Node treeSuccessor(Node x){
      Node y;
      if(x->right != NIL) return treeMinimum(x->right);
      y = x->parent;
      while(y != NIL && x == y->right){
        x = y;
        y = y->parent;
      }
      return y;

    }

    void treeDelete(Node z){
      Node y; // node to be deleted
      Node x; // child of y
      if(z->left==NIL || z->right==NIL) y = z;
      else y = treeSuccessor(z);

      if(y->left != NIL) x=y->left;
      else x = y->right;

      if(x!=NIL) x->parent = y->parent;
      if(y->parent==NIL) root = x;
      else if(y == y->parent->left) y->parent->left = x;
      else y->parent->right =x;

      if(y!= z) z->key = y->key;
      free(y);
    }

    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)return;
        inorder(u->left);
        printf(" %d",u->key);
        inorder(u->right);

    }
    void preorder(Node u){
      if(u ==NIL)return;
        printf(" %d",u->key);
        preorder(u->left);
        preorder(u->right);

    }


    int main(){
      int  i, x ,n;
      char c[20];
      scanf("%d", &n);

      for ( i = 0; i < n; i++ ){

        scanf("%s", c);

        if ( c[0] == 'f' ){

          scanf("%d", &x);
          Node t = treeSearch(root, x);
          if ( t != NIL ) printf("yes\n");
          else printf("no\n");
        } else if ( c[0] == 'i' ){

          scanf("%d", &x);
          insert(x);
        } else if ( c[0] == 'p' ){

          inorder(root);
          printf("\n");
          preorder(root);
          printf("\n");
        } else if ( c[0] == 'd' ){

          scanf("%d", &x);
          treeDelete(treeSearch(root, x));
        }
      }


      return 0;
    }



Measured memory_bytes: 20456
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
int main(void)
{
    lli A, B, C, K;
    cin >> A >> B >> C >> K;
    lli tmpA, tmpB, tmpC;
    /*for (lli i = 0; i < K; i++)
    {
        tmpA = B + C;
        tmpB = C + A;
        tmpC = A + B;
        A = tmpA;
        B = tmpB;
        C = tmpC;
    }*/
    if (abs(A - B) > pow(10, 18))
    {
        cout << "Unfair" << endl;
    }
    else if(K%2==0)
    {
        cout << A-B << endl;
    }else if(K%2==1){
    	cout << B - A <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Contest: AtCoder Beginner Contest 153 (https://atcoder.jp/contests/abc153)
// Problem: E: Crested Ibis vs Monster (https://atcoder.jp/contests/abc153/tasks/abc153_e)


// region {{{ boilerplate
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <exception>
#include <forward_list>
#include <functional>
#include <initializer_list>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#if __cplusplus >= 201703L
#   include <optional>
#   include <string_view>
#   include <variant>
#endif

using namespace std;

#if __cpp_lib_nonmember_container_access >= 201411
#   define sz(x) ((int)size(x))
#else
#   define sz(x) ((int)(x).size())
#endif

#define rep(a, b)      for(int a = 0; a < (b); ++a)
#define reps(a, b, c)  for(int a = (b); a < (c); ++a)
#define all(a)         (a).begin(),(a).end()
#define trav(a, b)     for(auto& a : b)

using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;

using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;

#if __has_cpp_attribute(maybe_unused) >= 201603
#   define MAYBE_UNUSED [[maybe_unused]]
#else
#   define MAYBE_UNUSED
#endif

MAYBE_UNUSED static constexpr int INF = (int)1e9;
MAYBE_UNUSED static constexpr ll INFL = (ll)1e18;
//endregion }}}

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

    int h, n; cin >> h >> n;
    vpi s(n);
    trav(si, s) cin >> si.first >> si.second;

    vl dp(h+1, INFL);
    dp[0] = 0;
    reps(i, 1, h+1) {
        trav(si, s)
            dp[i] = min(dp[i], dp[max(0, i-si.first)]+si.second);
    }

    cout << dp.back() << '\n';
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    int x1, y1, x2, y2;

    cin >> x1 >> y1 >> x2 >> y2;

    int x3, y3, x4, y4;

    x4 = x1 - (y2 - y1);
    y4 = y1 + (x2 - x1);
    x3 = x4 + (x2 - x1);
    y3 = y4 + (y2 - y1);

    cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}


Measured memory_bytes: 256