akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    string s;
    int k;
    cin >> k >> s;
    if(s.length() <= k){
        cout << s << endl;
    }else{
        cout << s.substr(0, k) << "..." << endl;
    }
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<ll mod> struct Mod_Int{
    ll x;
    Mod_Int() {}
    Mod_Int(ll y) : x (y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    Mod_Int &operator += (const Mod_Int &p) {
        x = (x + p.x) % mod;
        return *this;
    }

    Mod_Int &operator -= (const Mod_Int &p) {
        x = (x + mod - p.x) % mod;
        return *this;
    }

    Mod_Int &operator *= (const Mod_Int &p) {
        x = (x * p.x) % mod;
        return *this;
    }

    Mod_Int &operator /= (const Mod_Int &p) {
        *this *= p.inverse();
        return *this;
    }

    Mod_Int &operator ++ () {return *this += (Mod_Int)1;}

    Mod_Int operator ++ (int) {
        Mod_Int tmp = *this;
        ++*this;
        return tmp;
    }

    Mod_Int &operator -- () {return *this -= (Mod_Int)1;}

    Mod_Int operator -- (int) {
        Mod_Int tmp = *this;
        --*this;
        return tmp;
    }

    Mod_Int operator - () const {return Mod_Int(-x);}

    Mod_Int operator + (const Mod_Int &p) const {return Mod_Int(*this) += p;}

    Mod_Int operator - (const Mod_Int &p) const {return Mod_Int(*this) -= p;}

    Mod_Int operator * (const Mod_Int &p) const {return Mod_Int(*this) *= p;}

    Mod_Int operator / (const Mod_Int &p) const {return Mod_Int(*this) /= p;}

    bool operator == (const Mod_Int &p) const {return x == p.x;}

    bool operator != (const Mod_Int &p) const {return x != p.x;}

    Mod_Int pow (ll n) const {
        Mod_Int now = *this, ret = 1;
        while(n > 0){
            if(n & 1) ret *= now;
            now *= now, n >>= 1;
        }
        return ret;
    }

    Mod_Int inverse () const {
        return pow(mod-2);
    }
};

using mint = Mod_Int<MOD>;
const int MAX_N = 1e6;
mint fac[MAX_N+1], ifac[MAX_N+1];

void init(){
    fac[0] = 1;
    rep2(i, 1, MAX_N){
        fac[i] = fac[i-1]*i;
    }
    ifac[MAX_N] = fac[MAX_N].inverse();
    rep3(i, MAX_N, 1){
        ifac[i-1] = ifac[i]*i;
    }
}

mint comb(int n, int k){
    return fac[n]*ifac[n-k]*ifac[k];
}

mint perm(int n, int k){
    return fac[n]*ifac[n-k];
}

int main(){
    int N; string S;
    cin >> N >> S;
    mint cnt[26];
    fill(cnt, cnt+26, 1);
    rep(i, N) cnt[S[i]-'a']++;
    mint ans = 1;
    rep(i, 26) ans *= cnt[i];
    ans--;
    cout << ans.x << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int n,m;
const int maxn=101000;
typedef long long ll;
const int N=1e5+100;
const int mod=1e9+7;
ll qpow(ll x,ll y){
    ll sum=1;
    while(y){
        if(y&1)
            sum=sum*x%mod;
        y/=2;
        x=x*x%mod;
    }
    return sum;
}
ll fac[N];
ll C(ll m,ll n){
    return fac[n]*qpow(fac[m],mod-2)%mod*qpow(fac[n-m],mod-2)%mod;
}
ll a[N];
int main()
{
    fac[0]=1;

    ll n,k;
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    sort(a+1,a+1+n);//cout<<"a"<<endl;
    for(int i=1;i<=n;i++){
        fac[i]=fac[i-1]*i%mod;
    }
    ll sum1=0,sum2=0;
    for(int i=k;i<=n;i++){
        sum1=(sum1+(a[i]*C(k-1,i-1))%mod)%mod;
    }
    //cout<<sum1<<endl;
    for(int i=1;n-i>=k-1;i++){
        sum2=(sum2+(a[i]*C(k-1,n-i))%mod)%mod;
    }
    printf("%lld",(sum1-sum2+mod)%mod);
    return 0;
}
/*
3
10 3
1 2 3
0 1 2
100 7
3 4 5 6 7 8 9
1 2 3 4 5 6 7
10000 10
1 2 3 4 5 6 7 8 9 10
0 1 2 3 4 5 6 7 8 9
*/



Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const int N = 1010, P = 1000000007;

struct Mat {
	int g[2][2];

	Mat() { memset(g, 0, sizeof(g)); }

	Mat(const Mat& rhs) { memcpy(g, rhs.g, sizeof(g)); }

	Mat operator*(const Mat& rhs) const {
		Mat ret = Mat();
		for (int i = 0; i < 2; ++i)
			for (int j = 0; j < 2; ++j)
				for (int k = 0; k < 2; ++k)
					ret.g[i][k] = (ret.g[i][k] + g[i][j] * (ll)rhs.g[j][k]) % P;
		return ret;
	}
};

int n, m;
bool f[N][N], tmp[N][N];
char s[N];

int mpow(int x, int k) {
	int ret = 1;
	while (k) {
		if (k & 1)
			ret = ret * (ll)x % P;
		x = x * (ll)x % P;
		k >>= 1;
	}
	return ret;
}

int main() {


	ll k;
	scanf("%d%d%lld", &n, &m, &k);
	if (k <= 1) {
		puts("1");
		return 0;
	}
	for (int i = 0; i < n; ++i) {
		scanf("%s", s);
		for (int j = 0; j < m; ++j)
			f[i][j] = s[j] == '#';
	}
	bool r = false, c = false;
	for (int i = 0; i < n; ++i)
		r |= f[i][0] && f[i][m - 1];
	for (int j = 0; j < m; ++j)
		c |= f[0][j] && f[n - 1][j];
	if (r && c) {
		puts("1");
		return 0;
	}
	if (!r && !c) {
		printf("%d\n", mpow(count(f[0], f[n], true), (k - 1) % (P - 1)));
		return 0;
	}
	if (c) {
		for (int i = 0; i < n; ++i)
			for (int j = 0; j < m; ++j)
				tmp[j][i] = f[i][j];
		swap(n, m);
		memcpy(f, tmp, sizeof(f));
	}
	Mat ans = Mat(), t = Mat();
	ans.g[0][1] = 1;
	t.g[1][1] = count(f[0], f[n], true);
	int gc = mpow(t.g[1][1], (k - 1) % (P - 1));
	for (int i = 0; i < n; ++i) {
		if (f[i][0] && f[i][m - 1])
			++t.g[0][0];
		for (int j = 1; j < m; ++j)
			if (f[i][j] && f[i][j - 1])
				++t.g[1][0];
	}
	--k;
	while (k) {
		if (k & 1)
			ans = ans * t;
		t = t * t;
		k >>= 1;
	}
	printf("%d\n", (gc - ans.g[0][0] + P) % P);

	return 0;
}


Measured memory_bytes: 2176
let n, k = Scanf.scanf "%d %d" @@ fun a b -> a, b
let fs = Array.make 10 true
let rec f n = n = 0 || fs.(n mod 10) && f (n / 10)
let _ = for _ = 1 to k do Scanf.scanf " %d" @@ fun d -> fs.(d) <- false done; for i = n to 900100 do if f i then (Printf.printf "%d\n" i; exit 0) done

Measured memory_bytes: 2432
N = int(input())
A = [int(x) for x in input().split()]

dp = [[0]*3]*N

dp[0][0] = 0  # ((i+1)-1)/2
dp[0][1] = 0 # (i+1)/2
dp[0][2] = A[0]  # ((i+1)+1)/2

for i in range(1, N):
    
    if i % 2 == 0:
        dp[i][0] = dp[i-1][0] + A[i]
        dp[i][1] = max(dp[i-1][1], dp[i-1][2])
        dp[i][2] = dp[i-1][2] + A[i]
    else:
        dp[i][0] = max(dp[i-1][0], dp[i-1][1])
        dp[i][1] = dp[i-1][1] + A[i]
        dp[i][2] = dp[i-1][2]

if N % 2 == 0:
    print(max(dp[N-1][1],dp[N-1][2]))
else:
    print(max(dp[N-1][0],dp[N-1][1]))

Measured memory_bytes: 31164
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,...) do { cerr << #v << " = "; array_out(v , __VA_ARGS__ );} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
using P = pair<int,int>;
using vp = vector<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
/////////////////

void solve(){
  ini(N,K);
  ins(S);
  int ans = 0;
  rep(i,N-1){
    if(S[i] == S[i+1]) ans++;
  }
  out(min(N-1 , ans + 2 * K));
}

Measured memory_bytes: 512
#pragma warning(disable:4996)
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<time.h>
#include<iomanip>
#include<vector>
using namespace std;
typedef unsigned long long ull;

int main() {
	char s[4];
	for (int i = 0; i < 3; ++i) {
		cin >> s[i];
	}
	
	switch (s[1]) {
	case 'A':
		cout << 1;
		return 0;
	case 'O':
		cout << 6;
		return 0;
	case 'U':
		if (s[2] == 'N') {
			cout << 7;
			return 0;
		}
		cout << 5;
		return 0;
	case 'E':
		cout << 4;
		return 0;
	case 'H':
		cout << 3;
		return 0;
	case 'R':
		cout << 2;
		return 0;
	}
}

/*

*/

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

using namespace std;

struct edge{
  int n1, n2, cost;
};

struct UnionFind {
  vector<int> par;//parent

  vector<int>nodes;

  UnionFind(int N): par(N), nodes(N)
  {
    for(int i = 0; i < N; i++){
      par[i] = i;
      nodes[i] = 1;
    }
  }

  int root(int x) {//find the root and path compression
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    nodes[ry] += nodes[rx];
    par[rx] = ry;
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }

};


bool comp(const edge& e1, const edge& e2){
  return e1.cost < e2.cost;
}

int main(){
  int v, e;
  long long ans = 0;
  cin >> v >> e;
  UnionFind U = (v);
  vector<edge> G;
  for(int i = 0; i < e ; i++){
    int a,b,c;
    cin >> a >> b >> c;
    G.push_back((edge){a, b, c});
  }
  sort(G.begin(), G.end(), comp);
  for(int i = 0; i < G.size(); i++){
    edge now = G[i];
    if(!U.same(now.n1, now.n2)){
      U.unite(now.n1, now.n2);
      ans += now.cost;
    }
  }
  cout << ans << endl;
}



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

main(){
  int n,q;
  cin>>n;
  vector<int>v(n+1);
  r(i,n)cin>>v[i];
  v[n]=1e9+7;
  cin>>q;
  while(q--){
    int a;
    cin>>a;
    int b=lower_bound(v.begin(),v.end(),a)-v.begin();
    cout<<b<<endl;
  }
}



Measured memory_bytes: 3112
#include <iostream>
int main() {
  int n;
  std::cin >> n;
  int S[n];
  for (int i = 0; i < n; i++) {
    std::cin >> S[i];
  }
  int q;
  std::cin >> q;
  int T;
  int count = 0;
  for (int i = 0; i < q; i++) {
    std::cin >> T;
    S[n] = T;
    int j = 0;
    while (S[j] != T) {
      j++;
    }
    if (j == n) {
      continue;
    }
    count++;
  }
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
using namespace std;
const int TT=1e9+7;
int n,k,F[2005][2005],fact[5005000];
inline int power(int base,int p,int ret=1) {
	for (;p;base=1ll*base*base%TT,p>>=1) if (p&1) ret=1ll*ret*base%TT; return ret;
}
inline int C(int x,int y) {
	return 1ll*fact[x]*power(1ll*fact[y]*fact[x-y]%TT,TT-2)%TT;
}
inline void M(int &x) {
	if (x>=TT) x-=TT;
}
int main() {
	cin>>n>>k;
	fact[0]=1; for (int i=1;i<=n*k;i++) fact[i]=1ll*fact[i-1]*i%TT;
	if (k==1) return cout<<1<<endl, 0;
	for (int i=1;i<=n;i++) F[i][0]=1;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=i;j++) 
			F[i][j]=F[i-1][j]+1ll*(n-j+1)*F[i][j-1]%TT*C(n*k-i-(k-1)*(j-1)-1,k-2)%TT, M(F[i][j]);
	return cout<<F[n][n], 0;
}
/*
	

*/

Measured memory_bytes: 32988
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    ll x; cin >> x;
    ll sum = 100, y = 0;
    while (x > sum) {
        sum *= 1.01;
        y++;
    }
    cout << y << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;

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


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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

int main(int argc, char const* argv[])
{
  int n;
  cin >> n;
  int ans = 0;
  int min_ = 1001001001;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (min_ >= p) {
      min_ = p;
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ios>
#include <iomanip>
#include <bitset>
#include <cstdlib>

#define INF 200000000
#define MOD 1000000007
//#define int long long int
#define ll long long int
#define _tilde_ ~

using namespace std;

int main()
{
    int D, G;
    cin >> D >> G;
    vector<int> P, C;

    for (int i = 0; i < D; i++)
    {
        int tmp_p = 0, tmp_c = 0;
        cin >> tmp_p >> tmp_c;
        P.push_back(tmp_p);
        C.push_back(tmp_c);
    }

    int ans = INF;
    for (int bits = 0; bits < (1 << D); ++bits)
    {
        int tmp_sum = 0, tmp_ans = 0;
        for (int i = 0; i < D; ++i)
        {
            if (bits & (1 << i))
            {
                tmp_sum += 100 * (i+1) * P[i] + C[i];   
                tmp_ans += P[i];
            }
        }

        if (tmp_sum < G)
        {
            for (int i = D - 1; i >= 0; --i)
            {
                if(!(bits & (1 << i)))
                {
                    for(int j = 0;j<P[i];j++)
                    {
                        tmp_sum += 100*(i+1);
                        tmp_ans ++;

                        if(tmp_sum >= G)
                        {
                            break;
                        }
                    }
                }

                if(tmp_sum >= G)
                {
                    break;
                }

                
            }

        }
        
        ans = min(tmp_ans,ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< int,vector<int> ,greater< int >>
 
using namespace std;
 
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
 
int power(int a,int n)
{
    a %= mod;
    if(n == 1)return a;
    if(n == 0)return 1;
    if(n%2)return (a*(power((a*a)%mod,n/2)%mod))%mod;
    return power((a*a)%mod,n/2)%mod;
}
const int inf = (int) 1e18;
 
int inverse(int x){
    return power(x,mod-2)%mod;//little fermat....
}


signed main()
{
    showoff;
    int n;
    cin >> n;
    cout << n*n*n;
    return 0;
}
//*->for large size of matrix take int not long long if possible......
//*->always take maximum as inf for safer side ...   

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

int main(){
  int64_t A, B, C, D;
  cin >> A >> B >> C >> D;
  
  int64_t count = 0;
  
  int64_t CN = 0;
  int64_t DN = 0;
  int64_t CDN = 0;
  
  CN = B / C - (A-1) / C;
  DN = B / D - (A-1) / D;

  
  int64_t CD = 0;
  
  
  
  int64_t a, b, r;
  a = max(C, D);
  b = min(C, D);
  r = a % b;
  
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  CD = (C * D) / b;
  
  
  
  CDN = B / CD - (A-1) / CD;
  
  
  
  count = B - A + 1 - CN - DN + CDN;
  cout << count << endl;
  
  
  
    
    
    
  return 0;
}
    

Measured memory_bytes: 256
#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(void){
  string s;
  cin >> s;
  int n = s.size();
  bool ok = true;
  int a = n / 2;
  rep(i,a) if(s[i] != s[n-1-i]) ok = false;
  int b = (n-1)/2;
  int c = b / 2;
  rep(i,c) if(s[i] != s[b-1-i]) ok = false;
  int d = (n+3)/2;
  int e = d / 2;
  for(int i = d; i < e; i++){
    if(s[i-1] != s[i+e-1]) ok = false;
  }
  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3624
n = STDIN.gets.to_i
sequence = STDIN.gets.split[0...n].map(&:to_i)
m = STDIN.gets.to_i
questions = STDIN.gets.split[0...m].map(&:to_i)

combination = []
1.upto(n) do |i|
	sequence.combination(i).each { |e| combination << e.inject(:+) }
end

questions.each do |q|
	puts combination.find { |c| q == c } ? "yes" : "no"
end

Measured memory_bytes: 14500
/* Author - thiolhub */

#include <bits/stdc++.h>

using namespace std;

#define ll              long long int
#define ld              long double
#define db              double
#define pi              3.1415926535897932384626
#define PI              acos(-1.0)
#define endl            "\n"
#define mod             1000000007
#define mk              make_pair
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(t)            ll t; cin>>t; while(t--)
#define sc(a)	        scanf("%lld",&a);
#define pr(a)	        printf("%lld\n",a)
#define f(i,a,n)		for(ll i=a;i<n;i++)
#define m(a)		    memset(a,0,sizeof(a))
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)



int main(){ FastIO;

int n,x,j,y,i;cin>>n>>x>>y;
int ans[n]={0};
for(i=1;i<n;i++)
{
	for(j=i+1;j<n+1;j++)
	{
		ans[min(j-i,min(abs(x-i)+abs(y-j)+1,abs(y-i)+abs(x-j)+1))]++;
	}
}
for(i=1;i<n;i++) cout<<ans[i]<<endl;
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF ((double)(1e9))

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<int> a(N, 0);
	rep (i, N){
		cin >> a[i];
	} // end rep

	double sum = 0.0;
	rep (i, N){
		sum += (double)a[i];
	} // end rep
	sum /= (double)N;

	int res = -1;
	double ans = INF;
	rep (i, N){
		double curr = abs((double)a[i] - sum);
		if (curr < ans){
			ans = curr;
			res = i;
		} // end if
	} // end rep

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
struct Node{
	int data;
	Node *left;
	Node *right;
	Node(int val=0){
		data=val;
		left=NULL;
		right=NULL;
	}
};
Node *root;
void insert(Node *&root,int x){
	if(root==NULL){
		root=new Node(x);
		return;
	}
	else{
		if(x==root->data) return;
		else if(x<root->data) insert(root->left,x);
		else insert(root->right,x);
	}
	return;
}
void Inorder(Node *node){
	if(node==NULL) return;
	Inorder(node->left);
	cout<<' '<<node->data;
	Inorder(node->right);
}
void Preorder(Node *node){
	if(node==NULL) return;
	cout<<' '<<node->data;
	Preorder(node->left);
	Preorder(node->right);
}
bool find(Node *&root,int x){
	if(root==NULL) return false;
	if(root->data==x) return true;
	else if(root->data<x){
		return find(root->right,x);
	}
	else{
		return find(root->left,x);
	}
}
int main(){
	root=NULL;
	int m;
	cin>>m;
	while(m--){
		string str;
		cin>>str;
		if(str[0]=='i'){
			int data;
			cin>>data;
			insert(root,data);
		}
		else if(str[0]=='f'){
			int data;
			cin>>data;
			if(find(root,data)) cout<<"yes"<<endl;
			else cout<<"no"<<endl;
		}
		else{
			Inorder(root);
			cout<<endl;
			Preorder(root);
			cout<<endl;
		}
	}
} 

Measured memory_bytes: 15676
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var K = myconv(input[1],1);
  var list = myconv(input[2],4);
  var output = 0;
  for(var i = 0; i < N; i++){
    output += Math.min(list[i], K - list[i])*2;
  }
  myout(output);
}
Main(myin());

Measured memory_bytes: 7500
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

int main(void){
    ll n;
    cin >> n;
    ll a[n+10][n+10];
    rep(i,n){
        rep(j,n-1) {
            cin >> a[i][j];a[i][j]--;
        }
    }
    bool OK=true;
    ll ans=0;
    bool d[n];//その日試合をしているか
    ll next[n];
    rep(i,n) next[i]=0;
    while(OK){
        OK=false;
        ans++;
        rep(i,n) d[i]=false;
        for(ll i=0;i<n;i++){
            if(next[i]!=n-1){
                    ll aite=a[i][next[i]];
                    if(!d[i] && !d[aite] && i==a[aite][next[aite]]){
                        d[i]=true;
                        d[aite]=true;
                        next[i]++;
                        next[aite]++;
                        OK=true;
                    }
            }
        }
    }
    ll loop=true;
    for(ll j=0;j<n;j++) if(next[j]!=n-1) loop=false;
    if(loop) cout << ans-1 << endl;
    else cout << -1 << endl;
}



Measured memory_bytes: 8192
#include <bits/stdc++.h>
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)

int main()
{
    int n, x;
    cin >> n >> x;
    int l;
    int ans = 1;
    int d = 0;
    REP(i, n)
    {
        cin >> l;
        if (d + l <= x)
        {
            ans += 1;
        }
        d = d + l;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
        int a, number[255], n, ans = 0, i = 0, copy = 546461;
        scanf("%d", &a);
        for (n = 0; n <= a - 1; n++) {
                scanf("%d", &number[n]);
        }
        do
        {
                if (number[i] % 2 == 0) {
                        number[i] /= 2;
                        ans++;
                }
                if (number[i] % 2 != 0) {
                        if (ans < copy) {
                                copy = ans;
                        }
                        i++;
                        ans = 0;
                }
                if (i == n) {
                        break;
                }
        } while (1);
        printf("%d", copy);
}

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

int main(){
    int n;
    cin>>n;
    int a[n];
    int count=0;
    int f=0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<10000;i++){
        for(int j=0;j<n;j++){
            if(a[j]%2==0)a[j]=a[j]/2;
            else f=1;
        }
        if(f==0){
            count++;
        }
    }
    cout<<count;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const int INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int n,k;
    cin >> n>>k;
    vector<int> h(n+1);
    for(int i = 1; i <= n; i++){
        cin >> h[i];
    }

    vector<int> dp(n+1,INF);
    dp[1] = 0;
    dp[2] = abs(h[2]-h[1]);
    for(int i = 3; i <= n; i++){
        for(int j = max(i-k,1); j < i; j++){
            dp[i] = min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout << dp[n] << endl;

    return 0;
}

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

int main(){
  int n;
  cin >>n;
  int num[100100] = {0};
  int M = 0;
  rep(i,n){
    int a; cin >>a;
    a++;
    num[a-1]++; num[a]++;
    num[a+1]++;
    if(a+1>M) M = a+1;
  }
  int ans = 0;
  for(int i = 1; i<=M; i++){
    if(num[i]>ans) ans = num[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    ll dp[M+1][1<<N];
  	rep(i,M+1){
      	rep(j,1<<N){
          	dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    rep(i,M){
        ll a,b;
        cin >> a >> b;
        vl c(b);
        ll now_bit=0;
        rep(j,b){
            cin >> c[j];
            now_bit+=(pow(2,c[j]-1)+1e-5);
        }
        rep(j,1<<N){
            dp[i+1][j]=min(dp[i][j],a+dp[i][j-(j&now_bit)]);
        }
    }
    if(dp[M][(1<<N)-1]==INF){
        cout << -1 << endl;
    }
    else{
        cout << dp[M][(1<<N)-1] << endl;
    }
  	/*rep(i,M+1){
      	rep(j,(1<<N)){
          	cout << i << " " << j << endl;
          	cout << dp[i][j] << endl;
        }
    }*/
}

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

int main() {
	string S;
	cin >> S;
	int N = S.size();
	vector<int> difference(N - 2);
	
	for (int i = 0; i < N - 2; i++) {
		int a = S.at(i)-48;
		int b = S.at(i + 1)-48;
		int c = S.at(i + 2)-48;
		difference.at(i) = abs(753 - (a * 100 + b * 10 + c));
	}

	sort(difference.begin(), difference.end());
	cout << difference.at(0) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    string a, b;
    cin >> a >> b;
    if(a.size() > b.size()){
        cout << "GREATER" << endl;
        return 0;
    }else if(a.size() < b.size()){
        cout << "LESS" << endl;
        return 0;
    }else{
        for(ll i = 0; i < a.size(); i++){
            int A = a[i]-'0';
            int B = b[i]-'0';
            if(A > B){
                cout << "GREATER" << endl;
                return 0;
            }else if(A < B){
                cout << "LESS" << endl;
                return 0;
            }else{
                continue;
            }
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <set>
using namespace std;
int func(int n);
int main()
{
    int s;
    cin >> s;
    set<int> a;
    int p = s;
    for(long int i=1; i<=1000000; i++)
    {
       a.insert(p);
       if(a.size()!=i){
         cout << i << endl;
         return 0;
       }
       p = func(p);
    }

	return 0;
}

int func(int n)
{
   if(n%2==0) return n/2;
   else return 3*n+1;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000001;
typedef pair<int, int> P;

int main(){
    int N, M;  cin >> N >> M;
    vector<P> edge[N];
    for(int i=0; i<M; i++){
        int L, R, D;  cin >> L >> R >> D;
        L--;  R--;
        edge[L].push_back(P(R,D));
        edge[R].push_back(P(L,-D));
    }

    bool ans = true;
    vector<int> dist(N);
    fill(dist.begin(), dist.end(), inf);
    for(int i=0; i<N; i++){
        queue<int> que;
        que.push(i);
        if(dist[i] == inf) dist[i] = 0;
        while(!que.empty()){
            int now = que.front();  que.pop();
            if(edge[now].size()==0) continue;
            int nEdge = edge[now].size();
            for(int j=0; j<nEdge; j++){
                int next = edge[now][j].first;
                int cost = edge[now][j].second;
                if(dist[next] == inf){
                    dist[next] = dist[now] + cost;
                    que.push(next);
                }else if(dist[next] != dist[now] + cost){
                    ans = false;
                }
                if(!ans) break;
            }
            if(!ans) break;
        }
        if(!ans) break;
    }

    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 9344
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b; cin>>a>>b;
	cout<<max({a+b,a-b,a*b});
	
	return 0;
}

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

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

using namespace std;
int di[]={1,0,-1,-1,0,1};
int dj[]={0,-1,-1,0,1,1};

void draw(const vector<vector<int>> &tb, vector<vector<bool>> &live, int i, int j) {
  int n=tb.size();
  live[i][j] = true;
  REP(k,6){
    int ni=i+di[k];
    int nj=j+dj[k];
    if(ni<0 || ni>=n || nj<0 || nj>ni || tb[ni][nj]!=tb[i][j] || live[ni][nj])continue;
    draw(tb,live,ni,nj);
  }
}

int calc(const vector<vector<int>> &tb, int c) {
  int n=tb.size();
  vector<vector<bool>> live(n);
  REP(i,n) live[i] = vector<bool>(i+1, false);
  REP(i,n)REP(j,i+1) {
    if (tb[i][j] == 0) {
      live[i][j] = true;
      REP(k,6){
        int ni=i+di[k];
        int nj=j+dj[k];
        if(ni<0 || ni>=n || nj<0 || nj>ni) continue;
        draw(tb,live,ni,nj);
      }
    }
  }
  int pt = 0;
  REP(i,n)REP(j,i+1) {
    if (!live[i][j]) {
      if (tb[i][j] == c) --pt;
      else ++pt;
    }
  }
  return pt;
}

int main() {
  while(1){
    int n,c;
    cin>>n>>c;
    if(!n)break;
    vector<vector<int>> tb(n);
    REP(i,n) {
      tb[i] = vector<int>(i+1);
      REP(j,i+1) cin>>tb[i][j];
    }
    int maxp = -10000;
    REP(i,n)REP(j,i+1) {
      if (tb[i][j] == 0) {
        auto cp = tb;
        cp[i][j] = c;
        maxp = max(maxp, calc(cp,c));
      }
    }
    cout << maxp << endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 55);
int main(){
  int n;
  cin >> n;
  vector<int> d(2);
  d[0] = 6, d[1] = 9;

  vector<int> dp(n+1,0);
  rep(i,n+1) dp[i] = i;

  for (int j = 0; j < 2; j++) {
    for (int i = d[j]; i <= n; i *= d[j]) {
      for (int k = i; k <= n; k++) {
        dp[k] = min(dp[k], dp[k - i] + 1);
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
} 

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int nCol = in.nextInt();
		int[][] arr = new int[3][nCol + 1];
		for(int i = 1; i <= 2; i++) 
			for(int j = 1; j <= nCol; j++)
				arr[i][j] = in.nextInt();
		int[][] dp = new int[3][nCol + 1];
		for(int j = 1; j <= nCol; j++) {
			for(int i = 1; i <= 2; i++) {
				dp[i][j] = arr[i][j] + Math.max(dp[i - 1][j], dp[i][j - 1]);
			}
		}
		System.out.println(dp[2][nCol]);
	}

}


Measured memory_bytes: 23764
#include <stdio.h>
#include <string.h>
int main()
{
    int i,r1,r2;
    char s[100],s1[]="ABC",s2[]="ARC";
    scanf("%s", s);
    r1=strcmp(s,s1);
    r2=strcmp(s,s2);
    if(r1==0)
    {
        printf("ARC\n");
    }
    else if(r2==0)
    {
        printf("ABC\n");
    }
    return 0;
}


Measured memory_bytes: 1616
N, *L = map(int, open(0).read().split())

count = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            a = L[i]
            b = L[j]
            c = L[k]
            if a == b or b == c or c == a:
                continue
            if abs(b - c) < a < b + c:
                count += 1

print(count)


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

int INF = 1001001001;

int main() {
    int d, g;
    cin >> d >> g;
    vector<int> p(d);
    vector<int> c(d);
    rep(i, d) {
        cin >> p[i] >> c[i];
    }

    int ans = INF;
    for (int bit = 0; bit < (1<<d); bit++) {
        int sum = 0;
        int cnt = 0;
        rep(i, d) {
            if (bit & (1<<i)) {
                sum += (i + 1) * 100 * p[i] + c[i];
                cnt += p[i];
            }
        }
        if (sum >= g) {
            ans = min(ans, cnt);
        } else {
            for (int i = d-1; i >= 0; i--) {
                if (bit & (1<<i)) continue;
                rep(j, p[i]) {
                    if (sum >= g) break;
                    sum += 100 * (i + 1);
                    cnt++;
                }
            }
            ans = min(ans, cnt);
        }     
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define INF 1000007
#define MOD 1000000007
#define int long long int
#define maxn 100
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)

typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b) { return a / gcd(a, b) * b; }

int mpow(int N, int P, int M)  //繰り返し自乗法
{
    if (P == 0)
        return 1;
    if (P % 2 == 0) {
        int t = mpow(N, P / 2, M);
        return t * t % M;
    }
    return N * mpow(N, P - 1, M) % M;
}

int counter(int x) {           //bit計算
    if (x == 0) return 0;
    return counter(x >> 1) + (x & 1);
}

vector<bool> prime(maxn + 1, true); //素数テーブル
void prime_table(void) {
    prime[0] = false;
    prime[1] = false;
    for (int i = 2; i * i <= maxn; i++) {
        if (!prime[i]) {
            continue;
        }
        for (int j = i + i; j <= maxn; j += j + i) {
            prime[j] = false;
        }
    }
}

bool IsPrime(int num) {   //素数判定
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            return false;
        }
    }

    return true;
}

int H, W;
vector<string> S;
int d[20][20];
int sx = 0;
int sy = 0;
int mturn = 0;


signed main() {
    int N, K;
    vector<int> h;
    cin >> N >> K;
    rep(i, N) {
        int H;
        cin >> H;
        h.push_back(H);
    }
    int ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        if (h[i] >= K) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1400
import java.util.Scanner;
import java.util.Arrays;
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long N=sc.nextLong();
    long K=sc.nextLong();
        if (K>N) {
          if(K-N<N){
            System.out.println(K-N);
          }else{
            System.out.println(N);
          }

        }else if(K==N){
          System.out.println(0);
        }else if(N>K){
          if(N%K>K-N%K){
            System.out.println(K-N%K);
          }else{
            System.out.println(N%K);
          }
        }

        }
      }


Measured memory_bytes: 24020
n = int(input())
a = [_-1 for _ in map(int, input().split())]
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
p = -99999
for ind, i in enumerate(a):
  ans += b[i]
  if ind != 0:
    if i-1 == p:
      ans += c[i-1]
  p = i
print(ans)

Measured memory_bytes: 3064
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:#)(b:#));
    let a = a.chars().collect::<Vec<_>>();
    let b = b.chars().collect::<Vec<_>>();
    let len = a.len();
    if a.len() != b.len() {
        return "No".to_string();
    } else {
        for i in 0..a.len() {
            //aの後ろi個を先頭に
            if a.clone()
                .into_iter()
                .skip(len - i)
                .chain(a.clone().into_iter().take(len - i))
                .collect::<Vec<_>>() == b
            {
                return "Yes".to_string();
            }
        }
        return "No".to_string();
    }
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "kyoto\ntokyo" => "Yes",
    test2: "abc\narc" => "No",
    test3: "aaaaaaaaaaaaaaab\naaaaaaaaaaaaaaab" => "Yes",
}


Measured memory_bytes: 4352
n = int(input())
c0 = 0
c1 = 0
c2 = 0
c3 = 0
for _ in range(n):
    word = input()
    if word=='AC':
        c0 +=1
    elif word == 'WA':
        c1 +=1
    elif word == 'TLE':
        c2 +=1
    else:
        c3 +=1
print('AC x '+str(c0))
print('WA x '+str(c1))
print('TLE x '+str(c2))
print('RE x '+str(c3))

Measured memory_bytes: 9204
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
using namespace std;


int main() {
    int A, B;
    cin >> A >> B;
    cout << max(max(A+A-1, B+B-1), A+B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <vector>
#include <bitset>
#include <queue>
using namespace std;

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    char d, e, f;
    d = a[0] + 'A' - 'a';
    e = b[0] + 'A' - 'a';
    f = c[0] + 'A' - 'a';
    cout << d << e << f << endl;
    return 0;
}   

Measured memory_bytes: 256
/*g++ main.cpp -o main.out*/
/*./main.out*/
/*std::ios::sync_with_stdio(false);cin.tie(0);*/

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

#define LL long long
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define ree(n,a) memset(n,a,sizeof(n));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

string a,b;

int main()
{
    cin>>a>>b;
    if(a.size()<b.size())
        cout<<"LESS"<<endl;
    else if(a.size()>b.size())
        cout<<"GREATER"<<endl;
    else 
    {
        if(a>b)cout<<"GREATER"<<endl;
        else if(a<b)cout<<"LESS"<<endl;
        else cout<<"EQUAL"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
#define Forr(i,j,k) for(int i=j;i>=k;--i)
#define ll long long 
using namespace std;
const int N=2010,INF=0x3f3f3f3f;
template<class T>void read(T &x){
	x=0;char c=getchar();
	while(!isdigit(c))c=getchar();
	while( isdigit(c))x=x*10+c-48,c=getchar();
}
int n,a[N];
inline void file(){
	freopen("will.in","r",stdin);
	freopen("will.out","w",stdout);
}
void init(){
	read(n);
	For(i,1,n)read(a[i]);
}
bitset<N*N>dp[2];
int main(){

	init();
	int sum=0,now=0,pre=1,s=0;
	dp[1][0]=1;
	For(i,1,n){
		s+=a[i];
		dp[now]=dp[pre]|(dp[pre]<<a[i]);
		dp[pre].reset(0);swap(now,pre);
	}
	sum=(s+1)/2;
	For(i,sum,s)
		if(dp[pre][i]&1){
			printf("%d\n",i);break;
		}
	return 0;
}


Measured memory_bytes: 2688
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, std::vector<long long> A){
    sort(A.begin(), A.end());
    cout << A[N-1]-A[0] << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iostream>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <list>
#include <stack>
#include <climits>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#define m7 1000000007
#define m9 1000000009
#define ll long long
#define pii pair<int,int>
#define F first
#define S second

using namespace std;

int main()
{
	int n,k;
	cin >> n>>k;
	vector<int> dp(k + 1,0), ar(n);
	for (int i = 0; i < n; i++){
		cin>>ar[i];
	}
	for (int i = 0; i < n; i++) {
		dp[ar[i]] = 1;
	}
	for (int i = 1; i <= k; i++) {
		if (dp[i] == 1) continue;
		bool f = true;
		for (int j = 0; j < n; j++) {
			if (i - ar[j] < 0) break;
			if (dp[i - ar[j]] == 0) {
				dp[i] = 1;
				f = false;
				break;
			}
		}
		if (f) dp[i] = 0;
	}
	if (dp[k]) cout << "First";
	else cout << "Second";
	return 0;
}

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

using namespace std;

int main(){
  int h,w,i,j,n;
  cin >> h >> w;
  n = h*w-1;
  int a[h+1][w+1];
  for(i=1;i<=h;i++)for(j=1;j<=w;j++)cin >> a[i][j];
  //cout << h*w-1 << endl;
  //for(i=1;i<=h;i++)if(a[i][1]==0)--n;
  for(i=1;i<=h;i++){
    for(j=1;j<w;j++){
      if(a[i][j]%2!=0){
        //cout << i << " " << j << " " << i << " " << j+1 << endl;
        a[i][j+1]+=a[i][j];
      }else --n;
    }
  }
  for(i=1;i<h;i++){
    if(a[i][w]%2!=0){
      //cout << i << " " << w << " " << i+1 << " " << w << endl;
      a[i+1][w]+=a[i][w];
    }else --n;
  }
  cout << n << endl;
  for(i=1;i<=h;i++){
    for(j=1;j<w;j++){
      if(a[i][j]%2!=0){
        cout << i << " " << j << " " << i << " " << j+1 << endl;
        //a[i][j+1]+=a[i][j];
      }//else --n;
    }
  }
  for(i=1;i<h;i++){
    if(a[i][w]%2!=0){
      cout << i << " " << w << " " << i+1 << " " << w << endl;
      //a[i+1][w]+=a[i][w];
    }//else --n;
  }
  return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <climits>
#include <cmath>
#include <algorithm>
#include <cassert>

#define TEST_ASSERT(msg, cond) do { if (cond) { cout << msg << " => pass" << endl;} else { cout << msg << " => failed" << endl;} } while(0)

using namespace std;

int main() {

  int N, A, B;
  cin >> N >> A >> B;
  cout << min(A * N, B) << endl;

  return 0;
}


Measured memory_bytes: 256