akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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

/*（๑•﹏•๑｀) */
int main() {
    ll N,C;
    cin >> N >> C;
    static ll x[100002] = {};
    static ll v[100002] = {};
    static ll s[100002] = {};

    FORq(i,1,N){
        cin >> x[i] >> v[i];
        s[i] = v[i] + s[i-1];
    }

    s[N+1] = s[N];
    v[N+1] = 0;
    x[N+1] = C;

    static ll f1[100002] = {};
    static ll g1[100002] = {};
    static ll f2[100002] = {};
    static ll g2[100002] = {};

    ll ans1 = 0;
    ll ans2 = 0;

    FORq(i,1,N){
        f1[i] = f1[i-1] + v[i] - (x[i] - x[i-1]);
        g1[i] = max(g1[i-1],f1[i]);
    }


    FORq(i,1,N){
        chmax(ans1,g1[N]);
        chmax(ans1,-2*(C-x[i]) + s[N] - s[i-1] + g1[i-1]);
    }

    FORqr(i,1,N){
        f2[i] = f2[i+1] + v[i] - (x[i+1] - x[i]);
        g2[i] = max(g2[i+1],f2[i]);
    }

    FORq(i,1,N){
        chmax(ans2,g2[1]);
        chmax(ans2,g2[i+1]+s[i] - 2 * x[i]);
    }

    cout << max(ans1,ans2) << endl;

}


Measured memory_bytes: 5760
D,G=map(int,input().split())
iPC=[None]*D
S=list(range(D))
for i in range(D):
  p,c=map(int,input().split())
  iPC[i]=[p,100*(i+1)*p+c]

ret = 1000
for i in range(2 ** D):
  s=S[:]
  tot=0
  top=0
  m=0
  am=0
  for j in range(D):
    if (i >> j) & 1:
      s.remove(j)
      tot += iPC[j][0]
      top += iPC[j][1]
  if top<G and len(s)>0:
    m=max(s)
    am=(G-top+((m+1)*100-1))//((m+1)*100)
    if am<iPC[m][0]:
      tot+=am
    else:
      tot=1000
#  print(i,m,am,top,tot)
  ret=min(ret,tot)
print(ret)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){


    int n;
    cin >> n;

    vector<int> d(n+2, 0);
    rep(i, n){
        cin >> d[i+1];
    }
    sort(d.begin(), d.end()-1);
    rep(i, n+1){
        if(i%2) d[i] = 24-d[i];
    }
    sort(d.begin(), d.end()-1);
    int ans = INF;
    rep(i, n+1){
        int gap = abs(d[i+1]-d[i]);
        chmin(ans, min(24-gap, gap));
    }

    ppp(ans);

    return 0;
}


Measured memory_bytes: 256
S=input()
W=("dream","dreamer","erase","eraser")
s=[0]
while s:
  i=s.pop()
  if i==len(S):
    print("YES")
    break
  for w in W:
    if S[i:i+len(w)]==w:
      s.append(i+len(w))
else:
  print("NO")

Measured memory_bytes: 3432
#include<bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    ll q,h,s,d,n;
    cin>>q>>h>>s>>d>>n;
    double a[]={2,1,0.5,0.25};
    ll ans=0;
    vector<pair<ll,double> > b(4);
    b[0].first=(d);
    b[1].first=(s*2);
    b[2].first=(h*4);
    b[3].first=(q*8);
    for(ll i=0;i<4;i++)
    {
        b[i].second=a[i];
    }
    sort(b.begin(),b.end());
    if(n%2==0)
    {
        cout<<b[0].first*(n/2);
    }
    else
    {
        if(b[0].second==2)
        {
            ll a1=((n-1)/2)*(b[0].first);
            cout<<a1+(b[1].first/2);
        }
        else
        {
            cout<<(b[0].first/2)*(n);
        }
    }
    //cout<<ans;
    return 0;
}


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

const ll INF = 1ll << 60;
ll MOD = 998244353;

int main()
{

    int n, l;
    cin >> n;
    cin >> l;

    int L = l;
    int R = l + n - 1;

    int eat;
    if (R <= 0)
        eat = R;
    else if (L >= 0)
        eat = L;
    else
        eat = 0;

    int ans = (R + L) * (R - L + 1) / 2 - eat;

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,i,j,ans=1,z=0;
	cin>>n;
	long long int a[n];
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==0)z=1;
	}
	if(z==1)cout<<"0"<<endl;
	else {
		for(i=0;i<n;i++)
		{
			if(ans<=1000000000000000000/a[i])
			{
				ans=ans*a[i];
			}
			else{
				ans=-1;
				break;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 4408
#include<iostream>
#include<array>

int main() {
	int l, r;
	std::array<int, 4> ar;

	for (auto&& x : ar) {
		std::cin >> x;
	}

	for (int i = 0; i < 2; i++) {
		l += ar[i];
		r += ar[2 + i];
	}
	

	std::cout << (l > r ? "Left" : l < r ? "Right" : "Balanced") << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// typedef
typedef std::vector<int> VI;
typedef std::vector<VI> VII;
typedef std::vector<bool> VB;
typedef std::vector<std::string> VS;

std::string yes = "Yes\n";
std::string no = "No\n";

void solve();

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

void solve() {
  int a, b;
  std::cin >> a >> b;
  
  int total = 0;
  if (a == std::max(a, b)) {
    total += a;
    a--;
  } else {
    total += b;
    b--;
  }
  total += std::max(a, b);
  
  cout(total);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9

int main(){
	int n,m;
	while(cin>>n>>m,n){
        vi code(m);
        rep(i,m)cin>>code[i];
        vvi dp(2,vi(256,INF));
        dp[0][128]=0;
        range(i,1,n+1){
            int num; cin>>num;
            fill(all(dp[i%2]),INF);
            rep(j,256){
                rep(k,m){
                    int next=min(max(j+code[k],0),255);
                    int diff=num-next;
                    dp[i%2][next]=min(dp[i%2][next],dp[1-i%2][j]+diff*diff);
                }
            }
        }
        cout<<*min_element(all(dp[n%2]))<<endl;
	}
	return 0;
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;

/**
 * dp[i][j]: 上からi桁目まで見た時の両者の使う紙幣の枚数
 * "両者の"なので、i+1桁目の数字をdにするとき、dp[i+1][j] += d していく
 * 払いすぎてもよくなることはないので、ぎりぎりを払い続ける
 * sを下回らないように遷移させる
 * j = true: 前の桁で既に1多く払う -> これ以上払う必要はなく、おつりだけ考えればよい =>というのは間違いで、もうちょい出してもいい
 * -> j = true: ちょうど前の桁で1多く払う -> おつりだけ払う
 * j = false: 前の桁でちょうど払う -> 一枚多く払うか、ちょうど払うと良い
 */
i32 dp[1000100][4];
/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    string s; cin >> s;
    rep(i, 1000100)rep(j,2) dp[i][j] = inf;
    dp[0][0] = 0;
    dp[0][1] = 1;
//    rep(j,2)rep(i,10) cout << dp[i][j] << (i==9 ? '\n' : ' ');  // Debug

    for(i32 digit = 0; digit < s.size(); ++digit) {  // 各桁に対し
        rep(bl, 2) {
            if(bl) {
                chmin(dp[digit+1][0], dp[digit][bl] + (10 - (s[digit]-'0')));  // 店員が払うおつりだけ加算
                chmin(dp[digit+1][1], dp[digit][bl] + (10 - (s[digit]-'0'+1)));  // 店員が払うおつりが、次の桁で繰り下げを行う分1少なくなる。
            }
            else {
                chmin(dp[digit+1][1], dp[digit][bl] + (s[digit]-'0') + 1);  // 1多く払う
                chmin(dp[digit+1][0], dp[digit][bl] + (s[digit]-'0'));  // ちょうど払う
            }
        }
    }
    cout << dp[s.size()][0] << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 32668
import collections
n = int(input())
s = [input() for _ in range(n)]
s = collections.Counter(s).most_common()
ans = []
for i in range(1, len(s) + 1):
    ans.append(s[i - 1][0])
    if i == len(s):
        break
    if s[i - 1][1] != s[i][1]:
        break
ans.sort()
print(*ans, sep='\n')

Measured memory_bytes: 45040
#include <stdio.h>
#include <iostream>

using namespace std;

#define REP(a, i, n) for (int i = a; i < n; ++i)

int main() {
    int A, B;
    cin >> A >> B;

    if (A % 3 == 0) {
        cout << "Possible" << endl;
    } else if (B % 3 == 0) {
        cout << "Possible" << endl;
    } else if ((A + B) % 3 == 0) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    if a < b:
        a, b = b, a
    if mem[a][b]:
        return mem[a][b]
    if b == 0:
        return a
    mem[a][b] = gcd(b, a % b)
    return mem[a][b]

k = int(input())
ans = 0
mem = [[0 for a in range(k+1)]for b in range(k+1)]
n = k+1
for i in range(1,n):
    for j in range(1,n):
        d = gcd(i,j)
        for k in range(1,n):
            ans += gcd(d,k)
print(ans)


Measured memory_bytes: 9468
#include <stdio.h>

int main(void)
{
	int W,H,C,amari,big,small,gcd,tate,yoko;
	scanf("%d %d %d",&W,&H,&C);
	big=W;
	small=H;
	while(big%small!=0){
		amari=big%small;
		big=small;
		small=amari;
	}
	gcd=small;
	yoko=W/gcd;
	tate=H/gcd;
	printf("%d\n",(tate*yoko)*C);
	return 0;
}
	

Measured memory_bytes: 1816
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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

  for (int i = N-2; i >= 0; --i) {
    if (H[i] <= H[i+1]) continue;
    else if (H[i] - H[i+1] == 1) {
      H[i]--;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}

Measured memory_bytes: 1024
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    A = [False] * (N+1)
    W = [0] * (N+1)
    wans = 0
    for _p, _s in zip(p, S):
        if A[_p]:
            continue
        if _s == 'WA':
            W[_p] += 1
        else:
            A[_p] = True
            wans += W[_p]
    ans = sum(A)
    print(ans, wans)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14876
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
using P = pair<int, int>;
int H, W;
vector<vector<int>> G;
vector<vector<int>> used;
void dfs(P v) {
  used[v.first][v.second] = true;
  if(v.first == H && v.second == W) return;

  if(G[v.first+1][v.second] && !used[v.first+1][v.second]) dfs(make_pair(v.first+1, v.second));
  if(G[v.first-1][v.second] && !used[v.first-1][v.second]) dfs(make_pair(v.first-1, v.second));
  if(G[v.first][v.second-1] && !used[v.first][v.second-1]) dfs(make_pair(v.first, v.second-1));
  if(G[v.first][v.second+1] && !used[v.first][v.second+1]) dfs(make_pair(v.first, v.second+1));
}
int main() {
  int h, w;
  cin >> h >> w;
  H = h; W = w;
  G.resize(h+2);
  rep(i, h+2) G[i].resize(w+2);
  used = G;
  rep(i, h) rep(j, w) {
    if((i+1) % 2 == 0 && (j+1) % 2 == 0) {
      char c;
      cin >> c;
    }
    else {
      char c;
      cin >> c;
      if(c == '#') G[i+1][j+1] = 0;
      else G[i+1][j+1] = c - '0';
    }
  }
  if(G[h][w] == 0) {
    cout << "NO" << endl;
    return 0;
  }
  rep(i, h) rep(j, w) {
    if((i+1) % 2 == 0 && (j+1) % 2 == 0) continue;
    int x = (j+1) % 4;
    int y = (i+1) % 4;
    if(y == 1) {
      if(x == 1) {
        if(G[i+1][j+1] != 6) G[i+1][j+1] = 0;
      }
      else if(x == 2) {
        if(G[i+1][j+1] != 3) G[i+1][j+1] = 0;
      }
      else if(x == 3) {
        if(G[i+1][j+1] != 1) G[i+1][j+1] = 0;
      }
      else if(x == 0) {
        if(G[i+1][j+1] != 4) G[i+1][j+1] = 0;
      }
    }
    else if(y == 2) {
      if(G[i+1][j+1] != 2) G[i+1][j+1] = 0;
    }
    else if(y == 3) {
      if(x == 1) {
        if(G[i+1][j+1] != 1) G[i+1][j+1] = 0;
      }
      else if(x == 2) {
        if(G[i+1][j+1] != 3) G[i+1][j+1] = 0;
      }
      else if(x == 3) {
        if(G[i+1][j+1] != 6) G[i+1][j+1] = 0;
      }
      else if(x == 0) {
        if(G[i+1][j+1] != 4) G[i+1][j+1] = 0;
      }
    }
    else if( y == 0) {
      if(G[i+1][j+1] != 5) G[i+1][j+1] = 0;
    }
  }
  if(G[h][w] == 0) {
    cout << "NO" << endl;
    return 0;
  }
  P init = make_pair(1, 1);
  dfs(init);
  if(used[h][w]) cout << "YES" << endl;
  else cout << "NO" << endl;
}



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

int main(){
    vector<int>a(10);
    for(int i=0; i<10; i++) cin >> a[i];

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

    cout << a[9] << endl;
    cout << a[8] << endl;
    cout << a[7] << endl;

    return 0;
}


Measured memory_bytes: 3056
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_imports)]
fn main() {
    use std::cmp::max;
    use std::cmp::min;

    input!{
        r: i16,
        g: i16,
    }
    println!("{}", g + g - r);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
vector<int> h(N);
const int INF=1e9+5;
vector<int> dp(N,INF);
int n;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;++i){
        scanf("%d",&h[i]);
    }
    dp[1]=0;
    for(int i=1;i<=n;++i){
        for(int j:{i+1,i+2}){
            if(j<=n){
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
    }
    cout<<dp[n];
    // while(1);
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007

int main() {
  int N;
  cin >> N;
  vi d(N);
  rep(i,N) cin >> d[i];
  sort(all(d));
  cout << d[N/2] - d[N/2 - 1] << endl;

}


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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string a, b, c;
  cin >> a >> b >> c;
  cout << a[0] << b[0] << c[0] << endl;

  return 0;
}


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

#define f first
#define s second
#define ll long long
#define pb push_back
#define mp make_pair
#define inp(x) cin>>x
#define print(x) cout<<x
#define pii pair<int,int>
#define pll pair<ll,ll>
#define gcd(a,b) __gcd(a,b)
#define reset(d,val) memset(d,val,sizeof(d))
#define sort(v) sort(v.begin(),v.end())
#define sort_arr(arr,i,f) sort(arr+i,arr+f)
#define pq priority_queue<int,vector<int>,greater<int> >
#define pq1 priority_queue<pll,vector<pll>,greater<pll> >

const int mod = 1e9+7;

int arr[200005];

int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	int cnt=0;

	int val = 0;
	int pm = 1;
	ll ans = 0;
	arr[val]++;
	for (int i = s.length()-1; i>=0; i--)
	{
		val = (val+pm*(s[i]-'0'))%2019;
		//val%=2019;
		pm = (pm*10)%2019;
		ans += arr[val];
		arr[val]++;
	}
	cout<<ans;
	return 0;

}


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

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//ユークリッドの互除法
//最大公約数
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

//最小公倍数
ll lcm(ll x, ll y){
	ll g = gcd(x,y);
	return x/g*y;
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

int main() {
	int a, b;
	cin >> a >> b;
	if(b==1){
		cout << 0 << endl;
		return 0;
	}
	int count = 0;
	int now = a;
	count++;
	while (now < b)
	{
		count++;
		now += a - 1;
	}
	cout << count << endl;
}


Measured memory_bytes: 256
program abc099_c
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,ans,i,cc,t
    read*, n

    ans = n


    do i=0,n
        cc = 0
        t = i
        do while(t > 0)
            cc=cc+mod(t,6)
            t=t/6
        end do
        t = n-i
        do while(t>0)
            cc=cc+mod(t,9)
            t=t/9
        end do
        ans=min(ans,cc)
    end do
    print'(i0)', ans
end program abc099_c

Measured memory_bytes: 384
N = int(input())
A = list(map(int,input().split()))
A.insert(0,0)
A.insert(0,0)
G = {i:[] for i in range(1,N+1)}
for i in range(2,N+1):
    G[A[i]].append(i)
for i in range(1,N+1):
    print(len(G[i]))

Measured memory_bytes: 60332
use proconio::input;
use proconio::marker::Usize1;

macro_rules! chmax {
    ($max_v: expr, $v: expr) => {
        if $v > $max_v {
            $max_v = $v;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        xy: [(Usize1, Usize1); m],
    };
    let mut e = vec![vec![]; n];
    let mut d = vec![0; n]; // 入次数 (indegree)
    for &(x_i, y_i) in xy.iter() {
        e[x_i].push(y_i);
        d[y_i] += 1;
    }

    let mut q = d
        .iter()
        .enumerate()
        .filter(|&(_, &d_i)| d_i == 0)
        .map(|(v_i, _)| v_i)
        .collect::<std::collections::VecDeque<usize>>();

    let mut dp = vec![0; n];
    while let Some(u) = q.pop_front() {
        for &v in e[u].iter() {
            chmax!(dp[v], dp[u] + 1);
            d[v] -= 1;
            if d[v] == 0 {
                q.push_back(v);
            }
        }
    }

    let ans = dp.iter().max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 11040
s=input()
if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
  print('AMBIGUOUS')
elif 0 < int(s[:2]) <= 12 and int(s[2:]) >= 0:
  print('MMYY')
elif 0 < int(s[2:]) <= 12 and int(s[:2]) >= 0:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 9196
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<string>

using namespace std;

int main() {
	long long N, K;
	cin >> N >> K;
	long long ans = 0;
	if (K == 0) {
		cout << N * N << endl;
		system("pause");
		return 0;
	}
	for (int b = 1; b <= N; b++) {
		long long M = N % b;
		long long Q = N / b;
		if(b > K) ans += Q * (b - K);
		if (M >= K) ans += M - K + 1;
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

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

int main()
{
  string S; cin >> S;
  int N = S.size();
  int cnt = 0;

  for (int i = 0; i < N / 2; i++) {
    if (S[i] != S[N - i-1])cnt++;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 60);
constexpr ll MOD = 998244353ll;

// structure ------------------------------------------

// function -------------------------------------------

ll llabs(ll &a) { return (a < 0) ? (-a) : (a); }


// べき乗を計算　指数を計算
ll llpow(ll a, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

// aの逆元　MODをとる
ll llinv(ll a){
    ll b = MOD, u = 1, v = 0;
    while(b){
        ll t = a/b;
        a -= t*b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= MOD;
    if(u<0) u += MOD;
    return u;
}


// main -----------------------------------------------

int main() {
    ll n, s;
    cin >> n >> s;
    vector<ll> a(n);
    REP(i, n){
        cin >> a[i];
    }

    // dp[i+1][j][k] := A_iまでのなかからj個選んだとき、総和がkとなるような選び方の個数
    // vector<vector<vector<ll>>> dp(n+1, vector<vector<ll>>(n+1, vector<ll>(s+1, 0)));
    
    // 上記のdpからjを削除
    vector<vector<ll>> dp(n+1, vector<ll>(s+1, 0));
    // 初期化 : 0個選んだ時の総和は0で、組み合わせ的には1通りです
    dp[0][0] = llpow(2, n);

    ll ninogyakugen = llinv(2);

    REP(i, n){
        
            REP(k, s+1){
                dp[i+1][k] = dp[i][k];
                if(k - a[i] < 0) continue;
                dp[i+1][k] += (dp[i][k-a[i]] * ninogyakugen) % MOD;
                dp[i+1][k] %= MOD;
            }
        
    }
    // ll ans = 0;
    // REP(j, n){
    //     ans += (dp[n][j+1][s] * llpow(2, n-(j+1))) % MOD;
    //     ans %= MOD;
    // }
    cout << dp[n][s] << endl;
    return 0;
}


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

int a[4], b[4];

int main(){
	while(scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]) != EOF){
		scanf("%d %d %d %d", &b[0], &b[1], &b[2], &b[3]);
		int hit = 0, blow = 0;
		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 4; j++){
				if(a[i] == b[j] && i == j) hit++;
				else if(a[i] == b[j] && i != j) blow++;
			}
		}
		cout << hit << " " << blow << endl;
	}
	return 0;
}

Measured memory_bytes: 3040
#include <algorithm>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

int main() {
    using VertexId = std::uint32_t;
    using EdgeId = std::uint64_t;
    using EdgeWeight = std::uint64_t;
    using AdjData = std::pair<VertexId, EdgeWeight>;
    using AdjList = std::vector<AdjData>;

    auto n = VertexId(0);
    auto m = EdgeId(0);
    auto start_vertex = VertexId(0);
    std::cin >> n >> m >> start_vertex;

    auto adjacency_list = std::vector<AdjList>(n, AdjList());
    for (auto i_ = 0; i_ < m; ++i_) {
        auto source = VertexId(0);
        auto target = VertexId(0);
        auto weight = EdgeWeight(0);
        std::cin >> source >> target >> weight;

        adjacency_list[source].emplace_back(target, weight);
    }

    const auto invalid_distance = std::numeric_limits<EdgeWeight>::max();
    auto distance = std::vector<EdgeWeight>(n, invalid_distance);
    distance[start_vertex] = EdgeWeight(0);

    auto checked = std::vector<bool>(n);

    auto comp = [](const auto& a, const auto& b) { return a.second > b.second; };
    auto q = std::priority_queue<std::pair<VertexId, EdgeWeight>, std::vector<std::pair<VertexId, EdgeWeight>>,
                                 decltype(comp)>(comp);
    q.emplace(start_vertex, 0);

    while (!q.empty()) {
        const auto next = q.top();
        const auto v = next.first;
        const auto d = next.second;
        q.pop();

        if (checked[v]) continue;

        checked[v] = true;
        distance[v] = d;

        for (const auto& e : adjacency_list[v]) {
            const auto target = e.first;
            const auto weight = e.second;

            if (d + weight >= distance[target]) continue;

            q.emplace(target, d + weight);
        }
    }

    for (const auto& d : distance) {
        if (d == invalid_distance) {
            std::cout << "INF" << std::endl;
        } else {
            std::cout << d << std::endl;
        }
    }

    return 0;
}


Measured memory_bytes: 21576
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 100000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
 
int main() {
    LL x,y;
    scanf("%lld%lld",&x,&y);
    if(llabs(x-y)>=2)
        printf("Alice\n");
    else
        printf("Brown\n");
    return 0;
}

Measured memory_bytes: 3720
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  set<int> st;
  int query; cin >> query;

  for (int i = 0; i < query; ++i) {
    int op, x; cin >> op >> x;
    if (op == 0) {
      st.insert(x);
      cout << st.size() << '\n';
    } else if (op == 1) {
      cout << (st.find(x) != st.end()) << '\n';
    } else {
      st.erase(x);
    }
  }

  return 0;
}


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

int main(){
	int Min_dou;
	int mass_nokori;
	int X;
	int N;
	cin>>N>>X;
	mass_nokori=X;
	int i;
	for(i=0;i<N;i++){	
		int m;
		cin>>m;
		mass_nokori -= m;
		if(i==0){
			Min_dou = m;
		}
		if(i != 0){
			if(Min_dou>m){
				Min_dou = m;
			}
		}
	}
	while(Min_dou<=mass_nokori){
		i += 1;
		mass_nokori -= Min_dou;
	}
	cout<<i;
	return 0;
}
		
		


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		if(a < 1000) {
			System.out.println("ABC");
		}else {
			System.out.println("ABD");
		}
	}

}


Measured memory_bytes: 22868
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};

fn main() {
  let n = read::<i32>();
  let mut idx_7 = 0;
  let mut idx_4 = 0;
  let mut memo = vec![false; (n + 1) as usize];

  while idx_7 <= n {
    idx_4 = idx_7;
    while idx_4 <= n {
      memo[idx_4 as usize] = true;
      idx_4 += 4;
    }
    memo[idx_7 as usize] = true;
    idx_7 += 7
  }

  if memo[n as usize] {
    println!("Yes");
  } else {
    println!("No");
  }

}



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

public class Hello{
    public static List<Item> Items;
    public static void Main(){
        Items = new List<Item>();
        while(true){
            // Init
            Items.Clear();
            // Input Item Data
            int ItemNum = int.Parse(System.Console.ReadLine());
            if(ItemNum <= 0) break;
            for(int i = 0; i < ItemNum; i++){
                string[] ItemData = System.Console.ReadLine().Split(' ');
                Items.Add(new Item(ItemData[0], int.Parse(ItemData[1])));
            }
            // Input Recipe Data
            int RecipeNum = int.Parse(System.Console.ReadLine());
            for(int i = 0; i < RecipeNum; i++){
                string[] RecipeData = System.Console.ReadLine().Split(' ');
                int RecipeItemNum = int.Parse(RecipeData[1]);
                string[] Recipe = new String[RecipeItemNum];
                Array.Copy(RecipeData, 2, Recipe, 0, RecipeItemNum);
                int Idx = Items.FindIndex(item => item.Name == RecipeData[0]);
                if(Idx >= 0){
                    Items[Idx].SetRecipe(Recipe);
                }
            }
            /*
            for(int i = 0; i < Items.Count; i++){
                Items[i].Print();
            }
            */
            // Input Carft Item
            string CraftItem = System.Console.ReadLine();
            // Solve
            System.Console.WriteLine(Solve(CraftItem));
        }
    }
    
    public static int Solve(string CraftItem){
        int CraftItemIdx = Items.FindIndex(item => item.Name == CraftItem);
        return GetMinPrice(CraftItemIdx);
    }
    
    public static int GetMinPrice(int CraftItemIdx){
        int MinPrice = Items[CraftItemIdx].Price;
        if(Items[CraftItemIdx].Recipe != null){
            int ConbinePrice = 0;
            for(int i = 0; i < Items[CraftItemIdx].Recipe.Length; i++){
                ConbinePrice += GetMinPrice(
                    Items.FindIndex(item => item.Name == Items[CraftItemIdx].Recipe[i])
                    );
            }
            MinPrice = MinPrice > ConbinePrice ? ConbinePrice : MinPrice;
        }
        return MinPrice;
    }
}


public class Item{
    public string Name{set;get;}
    public int Price{set;get;}
    public string[] Recipe{set;get;}
    public Item(string InName, int InPrice){
        Name = InName;
        Price = InPrice;
    }
    public void SetRecipe(string[] InRecipe){
        Recipe = InRecipe;
    }
    public void Print(){
        System.Console.WriteLine(Name + " " + Price);
        if(Recipe != null){
            System.Console.Write("\t");
            for(int i = 0; i < Recipe.Length; i++){
                System.Console.Write(Recipe[i] + " ");
            }
            System.Console.WriteLine();
        }
    }
}

Measured memory_bytes: 9240
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl
#define wa()  cout<<"No"<<endl
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
#define SZ(x) x.size()
#define epp empty()
#define all(x) x.begin(),x.end()
typedef vector<int> VE;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=1e5+5;


signed main(){
    int n=re;
    pr(n/2+n%2);

    return 0;
}


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

int main(){
	int a, b, c, x, ans=0;

	cin >> a >> b >> c >> x;

	for(int i=0; i<=a; i++){
		for(int j=0; j<=b; j++){
			for(int k=0; k<=c; k++){
				if(x==500*i+100*j+50*k) ans++;
			}
		}
	}

	cout << ans <<endl;

}

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

int main()
{
    int N;
    cin >> N;
    bool flg = true;
    
    for(int i = 0; i < N; ++i) {
        fgetc(stdin);
        if(fgetc(stdin) == 'Y') flg = false;
    }
    if(flg) cout << "Three" << endl;
    else cout << "Four" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
typedef long long ll; 
const ll mod=1e9+7;
ll qpow(ll a,ll b)
{
	if(b==0)
	{
		return 1;
	}
	else if(b==1)
	{
		return a;
	}
	else if(b%2==0)
	{
		ll c=qpow(a,b/2);
		return c*c%mod;
	}
	else
	{
		ll c=qpow(a,b/2);
		return ((c*c)%mod*a)%mod;
	}
}
ll njie(ll l,ll r)
{
	ll a=1;
	for(ll i=l;i<=r;i++)
	{
		a*=i;
		a%=mod;
	}
	a%=mod;
	return a;
}
ll cnm(ll n,ll k)
{
	ll nn=njie(n-k+1,n);
	ll nk=njie(1,k);
	nk=qpow(nk,mod-2);
	nn=nn*nk%mod;
	nn%=mod;
	return nn;
}
int main(void)
{
	ll n,a,b;
	scanf("%lld%lld%lld",&n,&a,&b);
	ll ans=qpow(2,n)-1;
	ans=(ans+mod)%mod;
	ll na=cnm(n,a);
	ll nb=cnm(n,b);
	ans-=na+nb;
	ans+=10*mod;
	ans%=mod;
	printf("%lld",ans);
}

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

int main(){
	int m; cin >> m;
	string s;
	for(int i=0; i<m; i++){
		cin >> s;
		set<string> ss;
		ss.insert(s);
		for(int j=1; j<s.size(); j++){
			string l = s.substr(0, j);
			string r = s.substr(j, s.size()-j);
			ss.insert(r+l);
			reverse(l.begin(), l.end());
			ss.insert(l+r);
			ss.insert(r+l);
			reverse(r.begin(), r.end());
			ss.insert(l+r);
			ss.insert(r+l);
			reverse(l.begin(), l.end());
			ss.insert(l+r);
			ss.insert(r+l);
		}
		cout << ss.size() << endl;
	}
}


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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] arr = new int[n];
    for (int i = 0; i < n; i++) {
      arr[i] = sc.nextInt();
    }
    Arrays.sort(arr);
    int alice = 0;
    for (int i = n - 1; i >= 0; i -= 2) {
      alice += arr[i];
    }
    int bob = 0;
    for (int i = n - 2; i >= 0; i -= 2) {
      bob += arr[i];
    }
    System.out.println(alice - bob);
  }
}


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

void my_max(int len, int *A, int *m1, int *m2) {
  for (int i = 0; i < len; i++) {
    if (A[i] >= *m1) {
      *m2 = *m1;
      *m1 = A[i];
    } else if (A[i] >= *m2) {
      *m2 = A[i];
    }
  }
}

int main() {
  int N;
  cin >> N;
  int A[200000];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  int m1 = 0, m2 = 0;
  my_max(N, A, &m1, &m2);
  for (int i = 0; i < N; i++) {
    if (A[i] == m1) cout << m2 << endl;
    else cout << m1 << endl;
  }
  return 0;
}

Measured memory_bytes: 2432
N = int(input())
DX = list(int(i) for i in input().split())
A = []
for i in range(N):
     A.append(int(input())) 
ai =[]
ans = N + DX[1]
for i in range(N):
    for n in range(DX[0]):
        if n*A[i]+1 <= DX[0]:
            ai.append(n)
    ans += max(ai)
    ai = []
print(ans)

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

int main() {
  string s;
  int count=0;
  getline(cin,s);
  
  for (int i=0; i<s.size(); i++) {
    if (s.at(i)>='A' && s.at(i) <='Z') {
      count++;
      if (count == 1)
        cout << s.at(i);
      else if (count == 3)
        cout << s.at(i);
      else if (count == 4)
        cout << s.at(i) << endl;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int N, A, B;
	int one, two, three, four, five;
	int store[10001];
	for (int i = 0; i < 10001; i++)
	{
		store[i] = 0;
	}
	scanf("%d %d %d", &N, &A, &B);

	int sum;

	for (int i = 1; i <= N; i++)
	{
		one = i % 10;
		two = (i / 10) % 10;
		three = (i / 100) % 10;
		four = (i / 1000) % 10;
		five = (i / 10000) % 10;

		sum= one + two + three + four + five;
		
		if (sum>=A&&sum<=B)
		{
			store[i] = i;
		}
	}

	int result = 0;
	for (int i = 1; i <= N; i++)
	{
		result += store[i];
	}

	printf("%d", result);
}

Measured memory_bytes: 256
N=int(input()); A=list(map(int,input().split()))
L=[[1,399],[400,799],[800,1199],[1200,1599],[1600,1999],[2000,2399],[2400,2799],[2800,3199],[3200,4800]]
S=[0]*9;cnt=0;cnt1=0
for i in range(N):
  for j in range(9):
    if L[j][0]<=A[i]<=L[j][1]:
      S[j]=S[j]+1
for i in range(8):
  if S[i]!=0:
    cnt=cnt+1
cnt1=max(1,cnt)
print(cnt1,cnt+S[-1])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define MP make_pair

#define REP(i, n) for(int i=0;i<(int)(n);++i)
#define FOR(i,l,h) for(int i=(int)(l);i<=(int)(h);++i)
#define FORD(i,h,l) for(int i=(int)(h);i>=(int)(l);--i)

//#define max(a,b) a>b?a:b
//#define min(a,b) a>b?b:a

ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

#define dump(x)  cerr << #x << " = " << (x) << endl
#define ALL(t) (t).begin(),(t).end()

using namespace std;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int sum() { return 0; }

template<typename T, typename... Args>
T sum(T a, Args... args) { return a + sum(args...); }


int n;
std::vector<int> v;
bool ok(int mid , int k ){
    if (mid == 0) return false;
    int ko ;
    for(int i = 0;i<n;i++){
        ko = (v[i]-1)/mid;
        k -= ko;
    }
    if(k >=0 ) return true;
    else return false;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int k;cin>>n>>k;
    //std::vector<int> v(n);
    v.resize(n);

    REP(i,n)cin>>v[i];
    sort(v.begin() , v.end());
    int l = 0 , r = v[n-1]+1;
    int mid , ans = 0;
    while (l <= r)
    {
        mid = l + (r-l)/2;

        if(ok(mid , k)){
            ans = mid;//min(mid , ans);
            r = mid-1;
        }
        else{
            l = mid + 1;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3980
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

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

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.

	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}

	return 0;
}

Measured memory_bytes: 256