akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N;
  cin >> N;
  vi A(N);
  cin >> A;
  sort(rng(A));
  i64 l = 0, r = N - 2, m;
  if(A[l]>=(A[N-1]-A[l])){
    cout << A[N-1] << " " << A[l] << "\n";
    return;
  }
  if(A[r]<=(A[N-1]-A[r])){
    cout << A[N-1] << " " << A[r] << "\n";
    return;
  }

  m = (l + r) / 2;

  while(l + 1 < r){
    m = (l + r) / 2;
    if(A[m] == A[N-1] - A[m]){
      l = m;
      r = m;
      break;
    } 
    if(A[m] < A[N-1] - A[m]) {
      l = m;
      continue;
    }
    r = m;
  }
  if(l==r){
    cout << A[N-1] << " " << A[l] << "\n";
    return;
  }
  if(A[l] > A[N-1] - A[r]){
    cout << A[N-1] << " " << A[l] << "\n";
    return;
  }
  cout << A[N-1] << " " << A[r] << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Measured memory_bytes: 1024
S = list(input())
a=0
b=0
for i in S[::2]:
    if i=="1":
        a+=1
for k in S[1::2]:
    if k=="0":
        a+=1

for i in S[::2]:
    if i=="0":
        b+=1
for k in S[1::2]:
    if k=="1":
        b+=1
print(min(a,b))

Measured memory_bytes: 4268
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
 
int main() {
    int n;
    cin >> n;
    cout << (n-2)*180 << endl;
}


Measured memory_bytes: 3636
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;


int main(){
  int n,m;
  long long a;
  long long total = 0;
  priority_queue<int> p;
  cin >> n >> m;
  for(int i=0;i<n;i++){
    cin >> a;
    p.push(a);
    total += a;
  }

  for(int i=0;i<m;i++){
    a = p.top();
    p.pop();
    total -= (a+1)/2;
    p.push(a/2);
  }

  cout << total << endl;

  return 0;
}

Measured memory_bytes: 892
open System

// prelude
let readStr () = stdin.ReadLine()

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N = read int ()
let A = reads (int >> dec) ()

let result =
  let r = Array.create N 0
  A |> Array.iter (fun x -> Array.modify r x inc)
  r

result |> Array.iter (printfn "%d")

Measured memory_bytes: 51816
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main(){
    int n;
    int a = 0;
    int b = 0;
    int temp;
    vector<int> v;

    cin >> n;

    for(int i = 0; i < n; i++){
      cin >> temp;
      v.push_back(temp);
    }

    while (v.size() > 0){
      sort(v.begin(), v.end());
      a += v[v.size()-1];
      v.pop_back();
      if (v.size() == 0) break;

      sort(v.begin(), v.end());
      b += v[v.size()-1];
      v.pop_back();
      if (v.size() == 0) break;
    }

    cout << a-b << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void say(bool yes){cout<<(yes?"YES":"NO")<<endl;};

int main(){

    ll N, A;
    cin >> N >> A;
    cout << N * N - A << endl;

    return 0;
}

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

int main(){
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  
  int dx = tx - sx, dy = ty - sy;
  string ans = "";
  for (int i = 0; i < dx; i++) ans += "R";
  for (int i = 0; i < dy; i++) ans += "U";
  for (int i = 0; i < dx; i++) ans += "L";
  for (int i = 0; i < dy + 1; i++) ans += "D";
  for (int i = 0; i < dx + 1; i++) ans += "R";
  for (int i = 0; i < dy + 1; i++) ans += "U";
  for (int i = 0; i < 1; i++) ans += "LU";
  for (int i = 0; i < dx + 1; i++) ans += "L";
  for (int i = 0; i < dy + 1; i++) ans += "D";
  for (int i = 0; i < 1; i++) ans += "R";
  
  cout << ans << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <map>
#include <string>
constexpr int MOD = 1'000'000'007;
int main() {
    int n;
    std::string s;
    std::cin >> n >> s;
    std::map<char, int> mp;
    for (const char c : s)
        ++mp[c];
    long long ans = 1;
    for (const auto e : mp) {
        ans *= (e.second + 1);
        ans %= MOD;
    }
    ans += (MOD - 1);
    ans %= MOD;
    std::cout << ans << '\n';
}

Measured memory_bytes: 512
import java.util.Scanner;
import java.util.TreeSet;

class Main{

	public static void main(String[] args) {


		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int M = scan.nextInt();
		int[] pArray = new int[N];
		int[] x = new int[M];
		int[] y = new int[M];
		for(int i = 0;i < N;i++){
			pArray[i] = scan.nextInt()-1;
		}
		UnionFind uf = new UnionFind(N);
		for(int i = 0;i < M;i++){
			x[i] = scan.nextInt()-1;
			y[i] = scan.nextInt()-1;
			uf.unite(x[i], y[i]);
		}
		int count = 0;
		for(int i = 0;i < N;i++){
			if(uf.same(i, pArray[i])){
				count++;
			}
		}
		System.out.println(count);

	}


}

class UnionFind{
	int[] parent;
	public UnionFind(int N){
		this.parent = new int[N];
		for(int i = 0; i < N;i++){
			parent[i] = i;
		}
	}
	public int root(int x){			//根要素を取得
		if(parent[x] == x){			//初期状態
			return x;
		}else{
			return parent[x] = root(parent[x]);    	//再帰によって根を取得
		}
	}
	public void unite(int x,int y){ 	//統合メソッド
		if(same(x,y)){					//同じ根なら終了
			return;
		}
		int xroot = root(x);
		int yroot = root(y);
		parent[xroot] = yroot;			//統合
		return;

	}
	
	public boolean same(int x,int y){			//根が同じか（同じグループに属しているか）を判定
		return(root(x) == root(y));
	}
}






Measured memory_bytes: 93740
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

vvi tree(200005);
vi score(200005,0);
void dfs(ll p,ll x){
  for(ll k:tree[p]){
    if(k!=x){
      score[k]+=score[p];
      dfs(k,p);
    }
  }
  return;
}
void solve(){
  ll n,q;
  cin>>n>>q;
  rep(i,n-1){
    ll a,b;
    cin>>a>>b;
    tree[a-1].eb(b-1);
    tree[b-1].eb(a-1);
  }
  rep(i,q){
    ll p,x;
    cin>>p>>x;
    score[p-1]+=x;
  }
  dfs(0,-1);
  cout<<score[0];
  REP(i,1,n) cout<<" "<<score[i];
  cout<<'\n';
}

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


Measured memory_bytes: 24320
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll n,g;
cin >> n >> g;
vector<ll> nums(n),extra(n);
for(ll i = 0; i < n; i++){
    cin >> nums[i] >> extra[i];
}
ll ans = 100000000;
for(ll bit = 0; bit < (1 << n); bit++) {
    ll sum = 0;
    ll howmany = 0;
    vector<ll> tmp;
    set<ll> st;
    for (ll i = 0; i < n; i++) {
        if (bit & (1 << i)) {
            tmp.emplace_back(i);
            st.insert(i);
        }
    }
        for (ll i = 0; i < tmp.size(); i++) {
            sum += (tmp[i] + 1) * 100 * nums[tmp[i]];
            sum += extra[tmp[i]];
            howmany += nums[tmp[i]];
        }
        if (sum >= g) {
            ans = min(ans, howmany);
        } else {
            sort(tmp.rbegin(), tmp.rend());
            ll need = 0;
            for (ll i = n - 1; i >= 0; i--) {
                if (!st.count(i)) {
                    need = i;
                    break;
                }
            }
        for(ll i = 1; i <= nums[need] - 1; i++){
            sum += (need + 1) * 100;
            howmany++;
            if(sum >= g)
                ans = min(ans,howmany);
        }

        }

}
cout << ans << endl;
}

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

using namespace std;
typedef long long ll;

const long long MOD = 1e9 + 7;

int kat[5001][2501];
ll dp[20][5001];
ll res[5001];
int adds[5001];
ll pref[5001][5001];
ll Get[5001];
int n, m;
string s;


/*
5
000

ans = 9
*/
long long get(int cnt)
{
    if (cnt < 0)
        return 0;
    return Get[cnt];
}

int main()
{
    kat[0][0] = 1;
    for (int i = 0; i < 5000; i++)
    {
        for (int j = 0; j <= 2500; j++)
        {
            if (j + 1 <= 2500)
            {
                kat[i + 1][j + 1] = kat[i][j];
                kat[i + 1][j + 1] %= MOD;
            }
            if (j - 1 >= 0)
            {
                kat[i + 1][j - 1] += kat[i][j];
                kat[i + 1][j - 1] %= MOD;
            }
        }
    }
    long long x = 2;
    adds[0] = 1;
    for (int i = 2; i <= 5000; i += 2)
    {
        adds[i] = ((ll)kat[i][0] * x) % MOD;
        //cout << kat[i][0] << " ";
        x *= 2;
        x %= MOD;
    }
    cin >> n >> s;
    m = s.size();
    for (int i = 0; i <= 5000; i++)
    {
        dp[0][i] = adds[i];
    }
    for (int j = 1; j < 20; j++)
    {
        for (int i = 0; i < 5000; i++)
        {
            for (int h1 = 0; h1 <= i; h1++)
            {
                int h2 = i - h1;
                dp[j][i] = (dp[j][i] + dp[j - 1][h1] * dp[j - 1][h2]) % MOD;
            }
        }
    }
    vector<int> pw;
    for (int i = 0; i < 20; i++)
    {
        pw.push_back(m % 2);
        m /= 2;
    }
    //reverse(pw.begin(), pw.end());
    m = s.size();
    Get[0] = 1;
    for (int j = 0; j < 20; j++)
    {
        if (pw[j] == 1)
        {
            for (int i = 5000; i > 0; i--)
            {
                for (int k = 1; k <= i; k++)
                {
                    Get[i] = (Get[i] + Get[i - k] * dp[j][k]) % MOD;
                }
            }
        }
    }
    for (int i = 0; i <= n; i++)
    {
        ;//cout << Get[i] << " ";
    }
    //cout << endl;


    pref[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            pref[i + 1][j + 1] = (pref[i + 1][j + 1] + 2 * pref[i][j]) % MOD;
            pref[i + 1][max(0, j - 1)] = (pref[i + 1][max(0, j - 1)] + pref[i][j]) % MOD;
        }
    }
    ll ans = 0;
    for (int i = 0; i <= n; i++)
    {
        //cout << i << " " << pref[n - i][0] << " " << get(i - m) << endl;
        ans += pref[n - i][0] * get(i - m);
        ans %= MOD;
    }
    cout << ans % MOD;
}


Measured memory_bytes: 245376
#include <bits/stdc++.h>
#include <iomanip> 
using namespace std; 
#define rep(i,a,b)		for(long int i=a;i<=b;i++)
#define MOD 1e9+7

int solve(int x)
{
	vector<bool> ans(x+1);
	ans[1]=1;
	int v;
	for(int b=2;b<=x;b++)
	{
		v = b*b;
		while(v<=x)
		{
			ans[v]=1;
			v*=b;
		}
	}
	for(int i=x;i>=1;i--)
	{
		if(ans[i])
		{
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

int x,ans=0;
int main() 
{ 
	ios::sync_with_stdio(false);
    cin.tie(NULL);  
	cin>>x;
	solve(x);	
}
	

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

using namespace std;

typedef struct process{
  string name;
  int time;
} process;

int n, head, tail;
process arr[100000];

void enqueue(process x){
  arr[tail] = x;

  if(tail + 1 == 100000) tail = 0;
  else tail++;
}

process dequeue(){
  process x = arr[head];

  if(head + 1 == 100000) head = 0;
  else head++;

  return x;
}

int main(){

  int q, t, total = 0;
  process x;

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

  head = 0;
  tail = n;

  while(head != tail){
    x = dequeue();
    t = min(x.time, q);
    x.time -= t;
    total += t;
    if(x.time != 0) enqueue(x);
    else cout << x.name << " " << total << endl;
  }

  return 0;
}



Measured memory_bytes: 7060
#include <iostream>
#include <cstring>

using namespace std;

int cnt[28];
long long c[40][40];


long long combination(int n,int k){
    if(c[n][k] != -1) return c[n][k];

    if(k == 0 || n == k){
        return c[n][k] = 1;
    }
    c[n][k] = combination(n-1,k) + combination(n-1,k-1);
    return c[n][k];
}

int main(){
    string str;
    cin >> str;
    long long ret = 1;
    int n = str.size();
    memset(cnt,0,sizeof(cnt));
    memset(c,-1,sizeof(c));

    for(int i=0;i<n;i++){
        cnt[str[i] - 'a']++;
    }

    int timesodd = 0;
    for(int i=0;i<26;i++){
        if(cnt[i] % 2){
            timesodd++;
            cnt[i]--;
        }
        cnt[i] /= 2;
    }
    if(timesodd > 1){
        cout << 0 << endl;
    }else{
        int len = n/2;
        for(int i=0;i<26;i++){
            if(cnt[i] != 0){
                ret *= combination(len,cnt[i]);
                len -= cnt[i];
            }
        }
        cout << ret << endl;
    }    
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define lint long long
#define inf 100000000000000000
#define mod 1000000007
#define MAX 100005
#define pb push_back
#define vit vector<int>::iterator
typedef pair<lint,lint> pii;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    lint n,m;
    cin>>n;
    cout<<n+n*n+n*n*n;
    return 0;
}


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

int main(){

        int a,b,c;

        cin >> a >> b >> c;

        if(a<b){
                if(b<c){
                        cout << "Yes" <<endl;
                        return 0;
                }
        }

        cout << "No" <<endl;
        return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
using namespace std;
using lli = long long;

int main() {
    size_t N;
    lli K;
    cin >> N >> K;
    vector<int> A(N);
    for (int &Ai : A) cin >> Ai;

    vector<lli> visited_town_count(N + 1UL, 0LL);

    size_t i      = 0UL;
    bool repeated = false;
    for (lli visited = 1LL; visited <= K; visited++) {
        if (visited_town_count.at(A.at(i)) == 0LL) {
            visited_town_count.at(A.at(i)) = visited;
        } else if (!repeated) {
            lli repetition = visited - visited_town_count.at(A.at(i));
            visited += ((K - visited) / repetition) * repetition;
            repeated = true;
        }
        i = A.at(i) - 1;
    }

    cout << i + 1UL << "\n";

    return 0;
}


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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

const ll inf = 1e18;
const int nax = 1e5 + 5;

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

	ll a[n];
	ll mini = inf;
	forn(i,0,n)
	{
		cin>>a[i];
	}

	ll ans = 0;
	forn(i,0,n)
	{
		if(a[i]<=mini)
			ans++;
		mini = min(a[i],mini);
	}

	cout<<ans;

	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include<list>
#include<map>
#include<utility>
#include<tuple>
#include<numeric>
#include<set>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(a) (a).begin(),a.end()
using namespace std;

int main()
{
	int n;
	int cnt = 0;
	vector <int> a;
	cin >> n;
	rep(i, n) {
		int x;
		cin >> x;
		auto it = find(all(a), x);
		if (it == a.end())cnt++;
		a.push_back(x);
	}
	cout << cnt << endl;
}



Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> config;

const int MOD = 1000000007;
ll modpow(ll b, ll e, ll m) {
  ll r = 1;
  while(e) {
    if(e%2) {
      r*=b;
      r%=m;
    }
    b*=b;
    b%=m;
    e/=2;
  }
  return r;
}

ll choose(int n, int k) {
  ll ret = 1;
  for(int i = 1; i <= k; i++) {
    ret *= n-i+1;
    ret %= MOD;
    ret *= modpow(i, MOD-2, MOD);
    ret %= MOD;
  }
  return ret;
}

void solve() {
  int n, a, b;
  cin >> n >> a >> b;
  ll ret = modpow(2, n, MOD);
  ret += MOD-1; ret %= MOD;
  ret += MOD - choose(n, a);
  ret += MOD - choose(n, b);
  ret %= MOD;
  cout << ret << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	int ans = 0;
	REP(i, n)
	{
		int a, b; cin >> a >> b;
		ans += b - a + 1;
	}
	cout << ans << endl;
	return 0;
}

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

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        long INF = Long.MAX_VALUE / 3;

        int N = ni(), W = ni();
        int[] v = new int[N];
        int[] w = new int[N];
        for (int i = 0; i < N; i++) {
            v[i] = ni();
            w[i] = ni();
        }

        long[][] dp = new long[101][10001];
        for (int i = 1; i <= 10000; i++) {
            dp[0][i] = INF;
        }

        for (int i = 0; i < N; i++) {
            for (int j = 0; j <= 10000; j++) {
                if (j < v[i]) {
                    dp[i + 1][j] = dp[i][j];
                } else {
                    dp[i + 1][j] = Math.min(dp[i][j], dp[i][j - v[i]] + w[i]);
                }
            }
        }

        int ans = 0;
        for (int i = 0; i <= 10000; i++) {
            if (dp[N][i] <= W) {
                ans = i;
            }
        }

        out.println(ans);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 33696
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    int n,m;
    cin >> n >> m;
    if(abs(n-m)>1){
        cout << 0 << endl;
        return 0;
    }
    ll ans=1;
    if(n==m){
        for(int i=0;i<n;i++){
            ans*=(n-i);
            ans%=MOD;
            ans*=(n-i);
            ans%=MOD;
        }
        ans*=2;
        ans%=MOD;
    }
    else{
        for(int i=0;i<n;i++){
            ans*=(n-i);
            ans%=MOD;
        }
        for(int i=0;i<m;i++){
            ans*=(m-i);
            ans%=MOD;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();

        int[][] arr = new int[n][2];
        for (int i = 0; i < n; i++) {
            arr[i] = new int[] {sc.nextInt(), sc.nextInt()};
        }
        Arrays.sort(arr, (a1, a2) -> a2[1] - a1[1]);

        long sum = 0;
        long kind = 0;

        int[] countKind = new int[n+1];
        for (int i = 0; i < k; i++) {
            sum += arr[i][1];   // summing delicious
            if (countKind[arr[i][0]] == 0) kind++;
            countKind[arr[i][0]]++;
        }

        long ans = kind * kind + sum;
        int idx = k-1;
        for (int i = k; i < n; i++) {
            if (countKind[arr[i][0]] == 0) {
                while (idx > 0 && countKind[arr[idx][0]] == 1) idx--;

                if (idx > 0) {
                    countKind[arr[i][0]]++;
                    countKind[arr[idx][0]]--;
                    kind++;

                    sum = sum - arr[idx--][1] + arr[i][1];
                    ans = Math.max(ans, sum + kind * kind);
                }
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 95568
import Data.List

main = interact $ show' . solve . read' . lines
  where
    solve (matA,matB) = [
                          [sum $ zipWith (*) u v  | v <- (transpose matB)]
                        | u <- matA]
    show' = unlines . map (unwords . map show)
    read' (nml:xs) = (f matA, f matB)
      where
        n = head . map readInt . words $ nml
        f = map (map readInt . words)
        (matA, matB) = splitAt n xs
        readInt = read :: String -> Int



Measured memory_bytes: 12200
#include<stdio.h>
#define X 1000000007

int main(void){
	unsigned long long int si[1024]={0},p[1024]={0},in,i,j,r=1,mem;
	scanf("%llu",&in);
	for(i = 2;i <= 1023;i++){
		if(p[i] == 0){
			for(j = 2*i;j <= 1023;j+=i){p[j] = 1;}
		}
	}
	for(i = 2;i <= in;i++){
		mem = i;
		for(j = 2;j <= 1023;j++){
			if(p[j] == 1){continue;}
			while(!(mem % j)){si[j]++;mem/=j;}
		}
	}
	for(i = 2;i <= 1023;i++){
		r*=(si[i]+1);r%=X;
	}
	printf("%llu\n",r);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 2019/3/2
Solved on 2019/3/
@author: shinjisu
"""


# ABC 108 C Triangular Relationship
def getInt(): return int(input())


def getIntList(): return [int(x) for x in input().split()]


def dmp(x, cmt=''):
    global debug
    if debug:
        if cmt != '':
            print(cmt, ':  ', end='')
        print(x)
    return x


def probC():
    N, K = getIntList()
    dmp((N, K))
    n = N // K
    if K % 2 == 0:
        h = n + (N % K) // (K//2)
    else:
        h = 0
    dmp((n, h), 'n,h')
    cn = n**3
    ch = h**3
    dmp((cn, ch), 'n**3,h**3')
    return cn + ch


debug = False  # True False
print(probC())


Measured memory_bytes: 3064
import fractions
from functools import reduce
from collections import deque

n = int(input())
a = deque(map(int,input().split()))

#累積GCD
left = deque([0])
right = deque([0])
for i in range(n):
    left.append(fractions.gcd(left[i],a[i]))
    right.appendleft(fractions.gcd(right[0],a[n - 1 - i]))

ans = 0
for i in range(n):
    ans = max(ans,fractions.gcd(left[i],right[i + 1]))
print(ans)

Measured memory_bytes: 16144
#include <iostream>

using namespace std;

int main (){
  int R0, W0, C, R;
  while (cin >> R0 >> W0 >> C >> R, R0) {
    double c = (double)R0 / W0;
    int ans = 0;
    if (c < C) {
      ans = (C * W0 - R0 + R - 1) / R;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3012
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1LL << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	if (x < 100) {
		cout << 0 << endl;
		return 0;
	}
	while (1) {
		if (x < 100 && x > 0) {
			cout << 0 << endl;
			break;
		}
		if (x % 100 >= 5) {
			x -= 105;
		}
		else {
			cout << 1 << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX_N 300000
using namespace std;

int main(void) {
  int N;
  cin >> N;
  string S;
  cin >> S;

  int OK = 0;
  int NG = 0;
  for (uint i = 1; i < S.size(); i++) {
    if(S[i] == 'E') NG++;
    else OK++;
  }

  int Ans = NG;
  for (uint i = 1; i < S.size(); i++) {
    if (S[i - 1] == 'E')
      OK++;
    else
      NG++;
    if (S[i] == 'E')
      NG--;
    else
      OK--;
    Ans = min(Ans, NG);
  }
  cout << Ans << endl;
  return 0;
}

Measured memory_bytes: 900
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    val day: Int = sc.nextLine.toInt

    val dayName: String = day match {
      case 25 => "Christmas"
      case 24 => "Christmas Eve"
      case 23 => "Christmas Eve Eve"
      case 22 => "Christmas Eve Eve Eve"
    }
    println(dayName)
  }
}


Measured memory_bytes: 25932
import java.util.Scanner;

class Main{
	public static void main(String[] main) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();

		if((a%1000)%111==0) {
			System.out.println("Yes");
		}
		else if((a/10)%111==0) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

#define FIND 0
#define END 1

int  N;
bool Path[101][101] = {false};
int  TIME[101][2] = {0};
int time_tt;


void DFS(int i){
    if(TIME[i][FIND] != 0) return;
    time_tt++;
    TIME[i][FIND] = time_tt;
    
    for (int p = 1; p <= N; p++) {
        if (Path[i][p]) DFS(p);
    }
    
    time_tt++;
    TIME[i][END] = time_tt;
}

int main(){
    cin >> N;
    int bb;
    for (int i = 1; i <= N; i++) {
        int K;
        scanf("%d %d",&bb,&K);
        for (int k = 0; k < K; k++) {
            int p;
            scanf("%d",&p);
            
            Path[i][p] = true;
        }
    }
    
    time_tt = 0;
    
    for (int i = 1; i <= N; i++) {
        DFS(i);
    }
    for (int i = 1; i <= N; i++) {
        printf("%d %d %d\n",i,TIME[i][FIND],TIME[i][END]);
    }
    
    return 0;
}

Measured memory_bytes: 1236
k, n = map(int, input().split())
a = list(map(int, input().split()))
ma = -1
mi = -1
for i in range(n-1):
    if abs(a[i] - a[i+1]) > ma:
        ma = abs(a[i] - a[i+1])
        mi = i
flag = False
if abs(a[n-1]-k-a[0]) > ma:
    ma = abs(a[n-1]-k-a[0])
    mi = n-1
    flag = True
sum = 0
if flag:
    for i in range(0, n-1):
        sum += abs(a[i] - a[i+1])
else:
    for i in range(0, mi):
        sum += abs(a[i] - a[i+1])
    for i in range(mi+1, n-1):
        sum += abs(a[i] - a[i+1])
    sum += abs(a[n-1]-k-a[0])
print(sum)

Measured memory_bytes: 77516
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
const ll mod =1000000007;
int main(){
    int n,k;
    string s;
    cin>>n>>k>>s;
    int r1 =0;
    int r2=0;
    char form ='R';
    for(int i=0; i<n; i++){
        if(s[i]=='L' && form =='R'){
            if(i==0) r1++;
            else r2++;
        }
        if(i==n-1 && s[i]=='R') r1++;
        form = s[i];
    }
    int can =0;
    int tmpr2=r2;
    while(k>0&&r2>0){
        if(r2==1&&r1==0) can++;
        else can += 2;
        k--;
        r2--;
    }
    if(r1==2&& k>0) can++;
    cout<<n-r1-2*tmpr2+can<<endl;
}

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

ll solve() {
    ll N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    ll ans = 0;
    ll c = 0;
    for ( int i = 0; i < N-1; i++ ) {
        if ( S[i] == S[i+1] ) ans++;
        else c++;
    }
    ans += min( K*2 , c );
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

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

class UnionFindTree
{
    vector<int> parent;
    vector<int> depth;
    vector<int> cnt;

public:
    UnionFindTree(int n) : parent(n), depth(n), cnt(n)
    {
        for (int i = 0; i < n; i++)
        {
            parent[i] = i;
            depth[i] = 0;
            cnt[i] = 1;
        }
    }

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

    //xとyの属する集合を併合
    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (depth[x] < depth[y])
        {
            parent[x] = y;
            cnt[y] += cnt[x];
        }
        else
        {
            parent[y] = x;
            cnt[x] += cnt[y];
            if (depth[x] == depth[y])
                depth[x]++;
        }
    }
    // 同じ集合に属しているか判定
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
    // 集合のサイズを取得
    int size(int x)
    {
        return cnt[find(x)];
    }
};

int main()
{
    int n, m;
    cin >> n >> m;
    UnionFindTree utree(100100);
    vector<int> p(n + 1, 0);
    rep(i, n)
    {
        cin >> p[i + 1];
    }
    rep(i, m)
    {
        int x, y;
        cin >> x >> y;
        utree.unite(x, y);
    }
    int ans = 0;
    rep(i, n + 1)
    {
        if (i == 0)
            continue;
        if (utree.same(p[i], i))
        {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

struct q_pair {
    int a;
    int b;
    int c;
    int d;
};

int main(){
    int n, m, q;
    cin >> n >> m >> q;

    vector<q_pair> p(q);
    for (auto i = 0; i < q; i++) cin >> p[i].a >> p[i].b >> p[i].c >> p[i].d;

    queue<vector<int>> que;
    for (auto i = 1; i <= m; i++) que.push((vector<int>(1, i)));
    vector<int> a = que.front(); vector<int> last(n, m);
    while (a.size() != last.size()) {
        for (auto j = a.back(); j <= m; j++) {
            vector<int> tmp = a;
            tmp.push_back(j);
            que.push(tmp);
        }
        a = que.front();
        que.pop();
    }

    int ans = 0;
    while(not que.empty()) {
        a = que.front();
        que.pop();
        int tmp = 0;
        for (auto i = 0; i < q; i++) {
            if(a[p[i].b - 1] - a[p[i].a - 1] == p[i].c) tmp += p[i].d;
        }
        ans = max(ans, tmp);
//        for (auto elm : a) {
//            cout << elm << " ";
//        }
//        cout << endl;
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 13280
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io, flush := NewIO()
	defer flush()

	bingo := io.ScanInts(9)
	n := io.ScanInt()
	nums := io.ScanInts(n)
	for _, n := range nums {
		for i, cell := range bingo {
			if n == cell {
				bingo[i] = 0
			}
		}
	}
	bingoPatterns := [][]int{
		{0, 1, 2}, {3, 4, 5}, {6, 7, 8},
		{0, 3, 6}, {1, 4, 7}, {2, 5, 8},
		{0, 4, 8}, {2, 4, 6},
	}
	for _, bingoPattern := range bingoPatterns {
		if bingo[bingoPattern[0]] == 0 && bingo[bingoPattern[1]] == 0 && bingo[bingoPattern[2]] == 0 {
			io.Println("Yes")
			return
		}
	}
	io.Println("No")
}

type IO struct {
	scanner *bufio.Scanner
	writer  *bufio.Writer
}

func NewIO() (*IO, func()) {
	io := &IO{
		scanner: newScanner(),
		writer:  newWriter(),
	}
	return io, func() { io.writer.Flush() }
}

func newScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Buffer(make([]byte, 1000005), 1000005)
	s.Split(bufio.ScanWords)
	return s
}

func newWriter() *bufio.Writer {
	return bufio.NewWriter(os.Stdout)
}

func (io *IO) ScanBytes() []byte {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Bytes()
}

func (io *IO) ScanString() string {
	if !io.scanner.Scan() {
		panic("scan string failed")
	}
	return io.scanner.Text()
}

func (io *IO) ScanStrings(n int) []string {
	strs := make([]string, n)
	for i := 0; i < n; i++ {
		strs[i] = io.ScanString()
	}
	return strs
}

func (io *IO) Scan2DStrings(y, x int) [][]string {
	strings := make([][]string, y)
	for i := 0; i < y; i++ {
		strings[i] = io.ScanStrings(x)
	}
	return strings
}

func (io *IO) Scan2DGraph(y int) [][]string {
	strs := make([][]string, y)
	for i := 0; i < y; i++ {
		strs[i] = strings.Split(io.ScanString(), "")
	}
	return strs
}

func (io *IO) ScanInt() int {
	return int(io.ScanInt64())
}

func (io *IO) ScanInts(n int) []int {
	ints := make([]int, n)
	for i := 0; i < n; i++ {
		ints[i] = io.ScanInt()
	}
	return ints
}

func (io *IO) Scan2DInts(y, x int) [][]int {
	ints := make([][]int, y)
	for i := 0; i < y; i++ {
		ints[i] = io.ScanInts(x)
	}
	return ints
}

func (io *IO) ScanInt64() int64 {
	i, err := strconv.ParseInt(io.ScanString(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *IO) ScanFloat64() float64 {
	i, _ := strconv.ParseFloat(io.ScanString(), 64)
	return i
}

func (io *IO) ScanFloat64s(n int) []float64 {
	floats := make([]float64, n)
	for i := 0; i < n; i++ {
		floats[i] = io.ScanFloat64()
	}
	return floats
}

func (io *IO) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


Measured memory_bytes: 640
#include <iostream>

using namespace std;
 
int main(){
    int d,X,Y,W,H,n,x,y;
 
    cin >> d;
    while(d--){
        int cnt = 0;
         
        cin >> X >> Y >> W >> H;
        cin >> n;
        while(n--){
            cin >> x >> y;
             
            if((X <= x && x <= X+W)&&(Y <= y && y <= Y+H)) cnt++;
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 3080
H, W, K = map(int, input().split())
c = [input() for _ in range(H)]

#print(c)

ans = 0
for R in range(2**H):
  for C in range(2**W):
    n = 0
    for y in range(H):
      for x in range(W):
        if C>>x&1 and R>>y&1:
          if c[y][x]=="#":
            n += 1
    if n==K:
      ans += 1
print(ans)

Measured memory_bytes: 9076
# C - Strange Bank
import math
N = int(input())

INF = 10**10

dp = [0]*(N+1)

for i in range(N+1):
    dp[i] = INF

dp[0] = 0
W = [1,6,9]

# dp{N} に最小値を記録する
# 今の金額
for v in range(1,N+1):
    for w in range(3):
        for x in range(int(math.log(N+1,6))+1):
            # 選ぶ数
            n = W[w]**x
            if v-n < 0:
                continue
            dp[v] = min(dp[v],dp[v-n] + 1)
print(dp[N])

Measured memory_bytes: 9428
import math
n,h=map(int,input().split())
ans=0
m=0
b=[]
for i in range(n):
    a,B=map(int,input().split())
    b.append(B)
    m=max(m,a)
b=sorted(b,reverse=True)
for i in range(len(b)):
    if b[i]<m:
        break
    else:
        h-=b[i]
        ans=i+1
        if h<1:
            print(ans)
            exit()
print(ans+math.ceil(h/m))


Measured memory_bytes: 8280
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;
using static System.Array;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, R) = ReadStream<int,int>();
        if (N <= 10)
        {
            WriteLine(R+100*(10-N));
        }
        else
        {
            WriteLine(R);
        }
    }
}

class Scanner
{
    public static int RInt() => int.Parse(Console.ReadLine());
    public static long RLong() => long.Parse(Console.ReadLine());
    public static string RString() => Console.ReadLine();
    public static double RDouble() => double.Parse(Console.ReadLine());

    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static string[] RStrings() => Console.ReadLine().Split();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static T1 ReadStream<T1>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadStream<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadStream<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadStream<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}

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

using namespace std;

#define PI 3.1415926535897932

int main(){
    int mod=1000000007;
    int n;
    long long ans=1;
    scanf("%d",&n);
    for (int i=1;i<=n;i++) {
        ans*=i;
        ans%=mod;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char S[1000];
	int N,K;
	cin>>N;
	cin>>S;
	cin>>K;
	K--;
	for(int i=0;i<N;i++)
	{
		if(S[i]==S[K])
		cout<<S[i];
		else
		cout<<"*";
	}
	return 0;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
#define pb push_back
#define M 1000000007
#define f first
#define s second
typedef long long int ll;

void solve(){
	
	ll x, k, d, temp;
	cin >> x >> k >> d;
	x = abs(x);
	temp = min(k, x/d)*d;
	k -= min(k, x/d);
	x -= temp;
	// cout << x << " " << k << endl;
	if(k%2 == 0)
		cout << abs(x) << endl;
	else
		cout << abs(x-d) << endl;
}		

int main(){

	int t;
	// cin >> t;
	t = 1;
	for(int q = 0; q < t; q++){
		solve();
	}

	return 0;
}

Measured memory_bytes: 3632
function Main(input) {
    input = input.split(" ");
    a = parseInt(input[0]);
    b = parseInt(input[1]);
    x = parseInt(input[2]);
    possible = true;

    if((x < a) || (a + b < x)){
        possible = false;
    }

    if(possible){
        console.log("YES");
    }
    else{
        console.log("NO");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ld a, b, x, rag;
  cin >> a >> b >> x;
  double s = a * b - x / a;
  if (s <= a * b / 2) {
    double h = 2 * (a * b - x / a) / a;
    rag = atan2(h, a);
  } else {
    double w = 2 * x / a / b;
    rag = atan2(b, w);
  }

  double PI = acos(-1);
  double ans = rag / PI * 180;
  printf("%.10f", ans);
  return 0;
}


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

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> c(h);
    for(int i=0;i<h;i++){
        cin>>c[i];
    }

    vector<pair<int,int>> pos;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(c[i][j]=='B') pos.push_back(make_pair(i,j));
        }
    }

    int res=0;
    for(auto p1:pos){
        for(auto p2:pos){
            int d=abs(p1.first-p2.first)+abs(p1.second-p2.second);
            res=max(res,d);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3216
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

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

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
template<class T> int size(T &&x) {
  return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
  return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
  out << '{';
  for(auto it = x.begin(); it != x.end(); ++it)
    out << *it << (it == prev(x.end()) ? "" : ", ");
  return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
  cerr << x << ";  ";
  dump(args...);
}
struct Nl{~Nl(){cerr << '\n';}};
# define print(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#define int long long


int32_t main(){
    
  fast;
  int n; cin >> n;
  vector<pair<int,int>> vp;

  for(int i=0;i<n;i++){
    int x; cin >> x;
    vp.pb({x,i+1});
  }

  sort(all(vp));

  for(auto p : vp){
    cout << p.s << " ";
  }


  return 0;
}

Measured memory_bytes: 2544