akhauriyash/Code-Regression huggingface dataset:
// header {{{
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    LL ans = 0;
    int cnt = 0;
    LL mmin = 1000000005;
    inc(i, 0, n){
        LL a;cin >> a;
        ans += abs(a);
        if(a < 0){
            cnt++;
        }
        mmin = min(mmin, abs(a));
    }
    if(cnt%2 == 0){
        cout << ans << endl;
    }else{
        cout << ans-mmin*2 << endl;
    }
    return 0;
}


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

using namespace std;

#define int long long
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define rep(i, j) FOR(i, 0, j)
#define INF 1e9
#define LINF 1e18

typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> Pi;
typedef pair<P, P> PP;

const int MOD = 1e9 + 7;
const int dy[]={0, 0, 1, -1};
const int dx[]={1, -1, 0, 0};

template <class T> void chmin(T& a, const T& b) { a = min(a, b); }
template <class T> void chmax(T& a, const T& b) { a = max(a, b); }

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

    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    int res = INF;
    rep(i, max(X, Y) + 1) {
        int temp = i * 2 * C;
        int latte = X - i, malta = Y - i;
        if(latte >= 0) temp += latte * A;
        if(malta >= 0) temp += malta * B;
        chmin(res, temp); 
    }
    cout << res << endl;
    return 0;
}

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

int main(){
	int a,b,c;
	int ans;
	
	string cunning="7";
	
	for(int i=0;i<104;i++){
		cin>>a>>b;c=a+b;
		//-----test-----
		if(i<cunning.size()){
			cout<<cunning[i]<<endl;
			continue;
		}
		//--------------
		ans=1;
		while(10<=c){
			c/=10;
			ans++;
		}
		cout<<ans<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1204
/*
 * 
 * 
         _Likhon_
 *
 * 
 */ 

#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	
   char a;
   cin>>a;
   if( a>= 'A' and a <= 'Z' )
   cout<<"A"<<"\n";
   else if( a>= 'a' and a <= 'z' )
   cout<<"a"<<"\n";
    return 0;
}












Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<string> v(N);
  bool ans=true;
  for (int i=0;i<N;i++){
    cin >> v[i];
    if (i>0){
      if (v[i-1][v[i-1].size()-1]!=v[i][0]){
        ans=false;
      }
    }
  }
  for (int i=0;i<N;i++){
    for (int j=0;j<i;j++){
      if (v[i]==v[j]){
        ans=false;
      }
    }
  }
  if (ans){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define PI (3.14159265358979323846)
#define INF (2147483647)
#define INF_LL (9223372036854775807)
#define DIV_NUM (1000000007)


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {

    int N, K, L;
    cin >> N >> K >> L;

    UnionFind road(N + 1);
    for (int i = 0; i < K; i++) {
        int p, q;
        cin >> p >> q;
        road.unite(p, q);
    }

    UnionFind train(N + 1);
    for (int i = 0; i < L; i++) {
        int r, s;
        cin >> r >> s;
        train.unite(r, s);
    }

    map<pair<int,int>,int> roots;

    for (int i = 1; i < N + 1; i++) {
        int root_road = road.root(i);
        int root_train = train.root(i);
        
        //要素の検索
        map<pair<int, int>, int>::iterator ite;
        ite = roots.find(make_pair(root_road, root_train));
        if (ite != roots.end()) {
            //値の取得
            int value = ite->second;
            //要素の削除
            roots.erase(make_pair(root_road, root_train));
            //要素の代入
            roots.insert(make_pair(make_pair(root_road, root_train), value+1));
        }
        else {
            roots.insert(make_pair(make_pair(root_road, root_train), 1));
        }
    }

    for (int i = 1; i < N + 1; i++) {
        int root_road = road.root(i);
        int root_train = train.root(i);
        cout << roots[make_pair(root_road, root_train)] << " ";
    }

    cout << endl;

	return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

constexpr ll MOD = 1'000'000'007;
int N, K, sq;
ll dp1[40100][110], dp2[40100][110], dp3[40100][110];

ll f(int n, int k);
ll g(int n, int k);
ll h(int n, int k);

ll g(int n, int k){
    if(n == 0){
        return 0;
    }

    if(dp2[n][k] != -1){
        return dp2[n][k];
    }

    dp2[n][k] = (f(n, k) + g(n - 1, k)) % MOD;
    return dp2[n][k];
}

ll h(int n, int k){
    if(n == 0){
        return 0;
    }

    if(dp3[n][k] != -1){
        return dp3[n][k];
    }

    dp3[n][k] = (f(n, k) * (N / n - sq) % MOD + h(n - 1, k)) % MOD;
    return dp3[n][k];
}

ll f(int n, int k){
    if(k == 0){
        return 1;
    }else if(k == 1){
        return N / n;
    }
    
    if(dp1[n][k] != -1){
        return dp1[n][k];
    }

    ll res = g(sq, k - 1);

    res = res + g(n, k - 2) * (N / n - sq) % MOD + (h(sq, k - 2) + MOD - h(n, k - 2));

    // for(int i=1;i<=sq;++i){
    //     int l = std::min(N / i, N / n) - sq;

    //     res = res + f(i, k - 2) * l % MOD;
    // }

    res %= MOD;

    return dp1[n][k] = res;
}


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

    std::cin >> N >> K;

    memset(dp1, -1, sizeof(dp1));
    memset(dp2, -1, sizeof(dp2));
    memset(dp3, -1, sizeof(dp3));

    sq = (int)std::sqrt(N);

    ll res = f(1, K);
    std::cout << res << std::endl;
}


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

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

#define endl '\n'
#define ff first
#define ss second
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=1e5+5,mod=1e9+7,bit=61;



signed main()
{
    fast;

    ll t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        if(s=="ABC")
        {
            cout<<"ARC\n";
        }
        else
        {
            cout<<"ABC\n";
        }
    }
    return 0;
}


















Measured memory_bytes: 3648
# -*- coding: utf-8 -*-
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
sum = 0
l = []
for i in A:
    heapq.heappush(l, i*-1)
for i in range(M):
    c = int(heapq.heappop(l)*-1/2)
    heapq.heappush(l, c*-1)
for a in l:
    sum += a*-1
print(sum)

Measured memory_bytes: 14180
#include <cstdio>
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main(void){
    int result = 0;
    int N;

    cin >> N;

    for (int i=N; i!=0; --i) {
        (int)(log10(i)+1)%2==1?++result:0;
    }
    cout << result;

    return 0;
}


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

int main(){
    int n;
double summ;
cin>>n;
int a[n];
for (int i=0;i<n;i++){
    cin>>a[i];
    }
    sort(a,a+n);
    summ=a[0];

for (int i=1;i<n;i++){
    summ=(summ+a[i])/2;
}
    cout<<summ;


}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1619&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 
 ================================================================
 */

ll n,m;

string b[505];

// 22*22 = 484, 25*20 = 500

// n <= 22 , 1 <= m <= 500
bool ok[501];

// 22 < n <= 500 , m <= 20
int bit[501];
int dp[2][1<<22];

int solve(){
    int res = 0;
    for(int i = 0; i < n;i++) cin >> b[i];
    if(n <= 22){
        for(int i = 0; i < (1<<n);i++){
            if(res >= __builtin_popcount(i)) continue;
            fill(ok,ok+501,false);
            for(int j = 0; j < n;j++){
                if(!((i>>j)&1)) continue;
                for(int k = 0; k < m;k++){
                    if(b[j][k] == '1') ok[k] = !ok[k];
                }
            }
            if(accumulate(ok,ok+m,0)) continue;
            res = max(res,__builtin_popcount(i));
        }
    }else{
        fill(bit,bit+n,0);
        for(int i = 0; i < n;i++){
            for(int j = 0; j < m;j++){
                if(b[i][j] == '1'){
                    bit[i] |= (1<<j);
                }
            }
        }
        for(int i = 0; i < 2;i++) for(int j = 0; j < (1<<m);j++) dp[i][j] = -1;
        dp[0][0] = 0;
        int cur = 0, next = 1;
        for(int i = 0; i < n;i++){
            for(int j = 0; j < (1<<m);j++){
                if(dp[cur][j] == -1) continue;
                dp[next][j] = max(dp[next][j],dp[cur][j]);
                dp[next][j^bit[i]] = max(dp[next][j^bit[i]],dp[cur][j]+1);
                
                dp[cur][j] = -1;
            }
            swap(cur,next);
        }
        res = dp[cur][0];
    }
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> n >> m,n){
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 19580
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#define ll long long
using namespace std;

const int mod=1e9+7;
ll n;
ll f[2333];

int main()
{
	cin>>n;
	f[0]=1;
	f[1]=0;
	f[2]=0;
	for(int i=3;i<=n;i++)
		for(int j=0;j+3<=i;j++)
		{
			f[i]+=f[j];
			f[i]%=mod;
		}
	cout<<f[n];
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	string s;

	cin >> s;

	ll a[4];
	rep(i, s.size()) {
		a[i] = s[i] - '0';
	}

	ll op[3];
	ll val;
	string t;
	string ans;
	rep(i, 1 << 3) {
		rep(j, 3) {
			op[j] = (i >> j) & 1;
		}
		val = a[0];
		ans = s[0];
		rep(k, 3) {
			t = s[k + 1];
			if (op[k] == 1) {
				val += a[k + 1];
				ans += string("+") + t;
			}
			else {
				val -= a[k + 1];
				ans += string("-") + t;
			}
		}
		if (val == 7) {
			ans += "=7";
			cout << ans << "\n";
			return;
		}
	}
}

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

	solve_abc_c();

	return 0;
}

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

int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    if(b%2!=0){
        cout<<"No";
    }
    else{
        if(b>=2*a && b<=4*a){
            cout<<"Yes";
        }
        else{
            cout<<"No";
        }
    }
     return 0;
    
}





Measured memory_bytes: 3036
#ifdef LOCAL
#  define _GLIBCXX_DEBUG
#  define _GLIBCXX_DEBUG_PEDANTIC
#endif

#include "bits/stdc++.h"
#define ff first
#define ss second
#define szof(_x) ((int) (_x).size())
#define TASK_NAME ""

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const ll INFL = 1e18 + 123;
const double PI = atan2(0, -1);
mt19937 tw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(tw) % (y - x + 1) + x; }


void solve() {
	int n, x;
	cin >> n >> x;
	vector<int> inp;
	for (int i = 0; i < n; ++i) {
		int num;
		cin >> num;
		inp.push_back(num);
	}
	sort(inp.begin(), inp.end());
	int ans = 0;
	for (int num : inp) {
		if (x >= num) {
			x -= num;
			++ans;
		}
	}
	if (ans == n && x) {
		--ans;
	}
	cout << ans << "\n";
}


int main() {
	//freopen(TASK_NAME ".in", "r", stdin);
	//freopen(TASK_NAME ".out", "w", stdout);
	cerr << fixed << setprecision(15);
	cout << fixed << setprecision(15);
	ios::sync_with_stdio(false);

	int tests = 1;
	// cin >> tests;
	for (int it = 1; it <= tests; ++it) {
		solve();
	}
	
	#ifdef LOCAL
		cerr << "time: " << clock() << " ms\n";
	#endif
	return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    int n;
    while(sf("%d",&n)==1)
    {
        bool f=true;
        int t=0,px=0,py=0;
        for(int i=0;i<n;i++)
        {
            int ti,xi,yi;
            sf("%d %d %d",&ti,&xi,&yi);
            if(f)
            {
                int dis=abs(xi-px)+abs(yi-py);
                if(dis==ti-t)
                {
                    t=ti;
                    px=xi;
                    py=yi;
                }
                else if(dis>ti-t)f=false;
                else
                {
                    if((ti-t)%2!=dis%2)f=false;
                    else
                    {
                        t=ti;
                        px=xi;
                        py=yi;
                    }
                }   
            }
        }
        if(f)puts("Yes");
        else puts("No");
    }    
    return 0;
}
 









 




























Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(int argc, const char * argv[]) {
    int n,k;
    cin >> n >> k;
    int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    vector<ll> rui(n+1);
    vector<ll> rui2(n+1);
    for(int i=0;i<n;i++){
        rui[i+1] = rui[i] + a[i];
        if(a[i]>0){
            rui2[i+1] = rui2[i] + a[i];
        }else{
            rui2[i+1] = rui2[i];
        }
    }
    ll res = 0;
    for(int i=k;i<=n;i++){
        long long int temp = rui[i] - rui[i-k];
        if(temp<0) temp = 0;
        long long int rem = rui2[n] - (rui2[i]-rui2[i-k]);
        
        long long int ans = temp+rem;
        res = max(ans, res);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 2176
n = int(input())
a = list(map(int, input().split()))
ans = 0
side = []
a.sort(reverse=True)
last = a[0]
for i in range(1, n):
    if last == a[i]:
        side.append(a[i])
        last = 0
    else:
        last = a[i]
    
    if len(side) == 2:
        ans = side[0] * side[1]
        break

print(ans)

        

Measured memory_bytes: 15020
N=int(input())
W=[input() for _ in range(N)]
Ws=len(list(set(W)))
if Ws!=len(W):
    print("No")
    exit()
for i in range(N-1):
    if W[i][-1]!=W[i+1][0]:
        print("No")
        exit()
print("Yes")


Measured memory_bytes: 3060
def main():
    from collections import defaultdict
    n, *a = map(int, open(0).read().split())
    d = defaultdict(lambda: [0, 0])

    ans = 0
    for i, x in enumerate(a, 1):
        d[i + x][0] += 1
        d[i - x][1] += 1
        ans += d[i + x][1] + d[i - x][0]

    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int n, m, sum;
  double judge_num;
  string ans;
  ans = "Yes";
  sum = 0;
  cin >> n >> m;
  vector<int> vote(n);
  for(int i = 0; i < n; i++){
    cin >> vote.at(i);
    sum += vote.at(i);
  }
  judge_num = 4 * m;
  judge_num = sum/judge_num;
  sort(vote.begin(), vote.end());
  reverse(vote.begin(), vote.end());
  for(int i = 0; i < m; i++){
	if(vote.at(i) < judge_num){
      ans = "No";
      break;
    }
  }
  cout << ans << endl;
//  cout << judge_num << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, x, y;cin>>n>>x>>y;
	vector<int> edges[n+1];
	for(int i = 1; i < n ; ++i){
		edges[i].push_back(i+1);
		edges[i+1].push_back(i);
	}
	edges[x].push_back(y);
	edges[y].push_back(x);
	int level[n+1][n+1];
	map<int, int> mp;
	for(auto &x : level) for(auto &y : x) y = -1;
	for(int i = 1; i <=n; ++i){
		queue<int> q;
		q.push(i);
		level[i][i] = 0;
		while(!q.empty()){
			int u = q.front();
			q.pop();
			for(auto x : edges[u]){
				if(level[i][x]==-1){
					level[i][x] = level[i][u] + 1;
					q.push(x);
				}
			}
		}
	}
	for(int i = 1; i < n; ++i){
		for(int j = i + 1; j<=n; ++j){
			//cout<<i<<" "<<j<<" "<<level[i][j]<<endl;
			mp[level[i][j]]++;
		}
	}
	for(int i = 1; i<n; ++i){
		cout<<mp[i]<<endl;
	}

	return 0;
}



Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
using Graph = vector<vector<int>>;
using ll = long long;
const int INF = 1000000007;
ll dp[3000][3000];
int main(){ 
  ll s;
  cin >> s;
  ll ans = 0;
  dp[0][3] = 1;
  REP(i,0,s){
    rep(j,2000)dp[i][j + 1] += dp[i][j] % INF,dp[i][j + 1] % INF;
    REP(j,3,s - 3 + 1)dp[i + 1][j + 3] += dp[i][j] % INF,dp[i + 1][j + 3] % INF;
  }
  rep(i,2100){
    ans += dp[i][s];
    ans %= INF;
  }
  cout << ans << endl;
}


Measured memory_bytes: 42824
n=int(input())
s=input()
l=len(s)
if((l%2)==1):
  print('No')
else:
  kq=1
  for i in range(l//2):
    if(s[i]!=s[i+l//2]):
      kq=0
      break
  if(kq==0):
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 3060
#include <stdio.h>
int main(){
  int a;
  scanf("%d",&a);
  int c=a;
  int b[a];
  for(int i=0;i<a;i++){
    scanf("%d",&b[i]);
    for(int j=0;j<i;j++){
      if(j!=i&&b[j]==b[i]){
        c--;
        break;
      }
    }
  }
  printf("%d\n",c);
  return 0;
}

Measured memory_bytes: 128
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
  list_num = list(str(num))
  sum_digit = 0
  for i in range(len(list_num)):
    sum_digit += int(list_num[i])
  if sum_digit >= A and sum_digit <= B:
    ans += num
print(ans)

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


int main(void){
    // Your code here!
    int n;
    cin>>n;
    
    vector<int> v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    
    sort(v.begin(), v.end(), greater<int>());
    
    int sum=v[0]/2;
    
    for(int i=1; i<n; i++){
        sum+=v[i];
    }
    
    cout<<sum<<endl;
}


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

ll add(ll n,ll a){
  return -a*(a+1)*(2*a+1)/6+a*(a+1)*(n+1)/2+a;
}


int main(){
  ll n,k;
  cin >> n >> k;
  ll ans =0;
  ans+= add(n,n+1);
  ans-= add(n,k-1);
  cout << ans%1000000007;
  
  return 0;
}

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

#define int long long
#define pb push_back 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()

typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;

signed main() {
  int a, b, N;
  bool flag = false;
  cin >> a >> b;
  cin >> N;
  Rep(i, N) {
    int c, d;
    cin >> c >> d;
    if ( (a <= c && c < b) || (a < d && d <= b) || (a >= c && d >= b) ) flag = true;
  }

  if ( flag ) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}

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

int main(){
	string str1, str2;
	int count = 0;
	cin >> str1;
	cin >> str2;

	for(int i=0; i<str1.length(); i++){
		if(str1[i] != str2[i])
			count++;
	}
	cout << count << endl;
}

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

int main(){
  int N;
  cin >> N;
  int a;
  a = N - 7;
  bool ans = false;
  if(a % 10 == 0) ans = true;
  a = N /10 -7;
  if(a % 10 == 0) ans = true;
  a = N / 100 -7;
  if(a % 10 == 0) ans = true;
  if(ans == true) cout << "Yes" << endl;
  if(ans == false) cout << "No" << endl;
}


Measured memory_bytes: 3584
A2Z="abcdefghijklmnopqrstuvwxyz"

def decode(L1,L2,msg):
    x=[]
    for c in msg:
        if 'a'<=c<='z':
            c = L2[L1.index(c)]
        x.append(c)
    return "".join(x)
        
def affine(msg, key):
    a,b = key
    L = [A2Z[(i*a+b)%26] for i in range(26)]
    L = "".join(L)
    return decode(A2Z,L,msg)

def rot(msg, a):
    if a==0: return msg
    a = a % 26
    L = A2Z[a:]+A2Z[:a]
    return decode(A2Z,L,msg)

def find(msg):
    c0=ord('t')
    for i in range(26):
        x = affine(msg,[i,0])
        a = (c0-ord(x[0]))%26
        x = rot(x,a)
        if x in['this','that']: return [i,a]
    return []

n = input()
for i in range(n):
    msg = raw_input()
    for w in msg.split():
        if len(w)==4:
            key = find(w)
            if key!=[]: break
    print affine(msg,key)

Measured memory_bytes: 4288
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a * b == c * d) {
		cout << a * b << endl;
	} else if(a * b < c * d) {
		cout << c * d << endl;
	} else {
		cout << a * b << endl;
	}

	return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int l = 0, r = n;

	string v = "Vacant",m = "Male",f = "Female";

	string one;

	cout << 0 << endl;
	cin >> one;
	if(one==v)
	{
		return 0;
	}
	while(1)
	{
		int m = (r+l)/2;
		cout << m << endl;
		string s;
		cin >> s;
		if(s==v)return 0;

		if(m%2==0)
		{
			if(s==one)
			{
				l = m;
			}
			else
			{
				r = m;
			}
		}
		else if(m%2==1)
		{
			if(s==one)
			{
				r = m;
			}
			else
			{
				l = m;
			}
		}
	}
}


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

int main()
{
	ll N;
	cin >> N;
	vector<ll> A(N), B(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
	}
	ll res = 0;
	for (int i = N - 1; i >= 0; i--) {
		A[i] += res;
		ll now = (B[i] - A[i] % B[i]) % B[i];
		res += now;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
int main()
{
	int n,front=0,last,ans=0,pos=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&last);
		if(last==front) pos++;
		else ans+=pos/2,pos=1,front=last;
	}
	ans+=pos/2;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
int a=0, b=0,c=0;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);

if(0<=a&&b<=100&&c<=100)
{
if(a<b&&b<c)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int n=s.size();
  auto f=[](string str){return str==string(str.rbegin(),str.rend());};
  cout<<(f(s)&&f(string(s.rbegin(),s.rbegin()+(n-1)/2))?"Yes":"No");
}

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

int main(){
  int64_t N ; 
  cin >> N ; 
  vector<int64_t> H(N) ;
  
  for(int i = 0 ; i < N ; i++){
    cin >> H.at(i) ; 
  }
  int64_t max_cnt = H.at(0) ;  ; 
  
  for(int i = 1 ; i < N ; i++){
    //cout << max_cnt << endl ;         
    if( H.at(i) >= max_cnt - 1){
      H.at(i) = H.at(i)  ; 
    }
    else if(H.at(i) < max_cnt ){
      cout << "No" <<endl ;
      return 0 ; 
    }

    
    max_cnt = max(max_cnt,H.at(i)) ; 
    
  }
  

  
  cout << "Yes" << endl ;
}

Measured memory_bytes: 4028
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main(void){
	int n; cin >> n;
	vector<int> v(n);
	rep(i, n) cin >> v[i];

	int ans = 0;
	for (int i = n - 2; i >= 0; --i){
		for (int j = 0; j <= i; ++j){
			if(v[j] > v[j + 1]){
				swap(v[j], v[j + 1]);
				ans++;
			}
		}
	}
	rep(i, v.size() - 1){
		cout << v[i] << " ";
	}
	cout << v[n - 1] << endl;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3072
#include"iostream"
#include <string>
#include <numeric>

int distance(int x, int y)
{
  return std::abs(x-y);
}

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

using namespace std;

int main(){

int N,X;
cin >> N >> X ;

int city;
cin >> city;
int Gcd = distance(city,X);
for(int i=1;i<N;i++)
{
  cin >> city;
  int dst = distance(city,X);
  Gcd = gcd(Gcd,dst);
}
  

cout << Gcd << endl;

return 0;
}

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

using namespace std;

typedef long long ll;

#ifdef iq
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

typedef complex <long double> pt;

int main() {
#ifdef iq
  freopen("a.in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n;
  ll l;
  cin >> n >> l;
  vector <pt> p(n);
  const long double pi = acos(-1);
  vector <double> me(n);
  for (int i = 0; i < n; i++) {
    ll alpha;
    cin >> alpha;
    me[i] = 2 * pi * alpha / l;
    pt x = pt(cos(2 * pi * alpha / l), sin(2 * pi * alpha / l));
    p[i] = sqrt(x);
  }
  const long double eps = 1e-9;
  pt ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      pt cur = -p[i] * p[j];
      if (i > j) cur *= -1;
      long double ret = atan2(cur.imag(), cur.real());
      if (ret < 0) ret += 2 * pi;
      int mid = (i < j ? j - i - 1 : n - (i - j + 1));
      int ot = n - 2 - mid;
      if (((i < j) && (me[i] - eps <= ret && ret <= me[j] + eps)) || (i > j && (ret <= me[j] + eps || ret >= me[i] + eps))) {
        pt value = cur;
        value *= mid;
        ans += value;
      } else {
        pt value = cur;
        value *= ot;
        ans += value;
      }
    }
  }
  ll cnt = n * (n - 1) * (n - 2) / 6;
  ans /= cnt;
  cout << fixed << setprecision(20) << -ans.real() << ' ' << -ans.imag() << '\n';
}


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


  ll w[110], v[110];
  ll dp[110][100100]={0};

int main(){
  int N;
  ll W;
  cin >> N >> W;
  //vector<ll> w(110), v(110);

  rep(i,N) cin >> w[i] >> v[i];

  //vector<vector<ll>> dp(110, vector<ll> (100100,0));

  rep(i,N){
    rep(j,W+1){
      dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
      if(j - w[i] < 0) continue;
      dp[i+1][j] = max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
    }
  }
  cout << dp[N][W] << endl;

}


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

int main(void) {

    int A1,A2,A3;
    cin >> A1 >> A2 >> A3;

    if ((A1+A2+A3) >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
h,w=map(int,input().split())
lists=[0 for _ in range(h)]
for _ in range(h):
    s=list(map(int,input().split()))
    lists[_]=s

subanswer=0
anslist=[0]*w
uselist=[]
if h>=2:
    for _ in range(w):
        s=[lists[j][_]%2 for j in range(h)]
        for i in range(h-1):
            if s[i]==0 and s[i+1]==0:
                s[i]=0 
                s[i+1]=0
     
            elif s[i]==0 and s[i+1]==1:
                s[i]=0
                s[i+1]=1
     
            elif s[i]==1 and s[i+1]==0:
                s[i]=0
                s[i+1]=1
                uselist.append([i+1,_+1,i+2,_+1])
                subanswer+=1
      
            elif s[i]==1 and s[i+1]==1:
                s[i]=0
                s[i+1]=0
                uselist.append([i+1,_+1,i+2,_+1])
                subanswer+=1

        anslist[_]=s[h-1]
        
else:
    anslist=[lists[0][_]%2 for _ in range(w)]


for i in range(w-1):
    if anslist[i]==0 and anslist[i+1]==0:
        anslist[i]=0 
        anslist[i+1]=0
     
    elif anslist[i]==0 and anslist[i+1]==1:
        anslist[i]=0
          
        anslist[i+1]=1
     
    elif anslist[i]==1 and anslist[i+1]==0:
        anslist[i]=0
        anslist[i+1]=1
        uselist.append([h,i+1,h,i+2])
        subanswer+=1
      
    elif anslist[i]==1 and anslist[i+1]==1:
        anslist[i]=0
        anslist[i+1]=0
        uselist.append([h,i+1,h,i+2])
        subanswer+=1  
  


print(subanswer)  
for some in uselist:
    print(*some)


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

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

        int[][] info = new int[N][N];
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                info[i][j] = -1;
            }
        }

        for (int i = 0; i < N; ++i) {
            int A = sc.nextInt();
            for (int j = 0; j < A; ++j) {
                int X = sc.nextInt();
                int Y = sc.nextInt();
                info[i][X - 1] = Y;
            }
        }

        int ans = 0;
        for (int i = 0; i < (1 << N); ++i) {
            boolean ok = true;  
            for (int j = 0; j < N; ++j) {
                if ((i & (1 << j)) == 0) continue;
                for (int k = 0; k < N; ++k) {
                    if (info[j][k] == -1) continue;
                    if (info[j][k] != (((i & (1 << k)) != 0) ? 1 : 0)) {
                        ok = false;
                    }
                }
                if (!ok) break;
            }
            if (ok) {
                int cnt = 0;
                for (int j = 0; j < N; ++j) {
                    if ((i & (1 << j)) > 0) {
                        ++cnt;
                    }
                }
                if (ans < cnt) {
                    ans = cnt;
                }
            }
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 22100
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		long n = sc.nextLong();
        long ans = 0;
        long count = 1;
        while(true){
          if(n >= count * count){
          ans = count * count;   
          }else{
              System.out.println(ans);  
              System.exit(0);            
          }
          count +=1;
        }
    }
}

Measured memory_bytes: 35908
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second

using namespace std;

const long long MOD = (long long)1e9 + 7;

string s;
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
    if (s[5] == '0') {
        if (s[6] <= '4') {
            cout << "Heisei\n";
            return 0;
        }
    }
    cout << "TBD\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
/*
 
                              Jai Shree Krishna !!
                                 Radhe Radhe !!
                                 
             उद्यमेन हि सिद्ध्यन्ति कार्याणि न मनोरथैः। नहि सुप्तस्य सिंहस्य मुखे प्रविशन्ति मृगाः।।
             
*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vvi vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(int j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
#define ins insert
#define rep(i,s,e)   for(int i=s;i<=e;i++)
#define repd(i,s,e)  for(int i=e;i>=s;i--)
#define vb vector<bool>
#define read2(n,m) int n,m; cin >> n >> m;
#define range(v) v.begin(),v.end()
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define sorti(v) sort(v.begin(),v.end())
 
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
 
signed main()
{
 
    fast;
    read(n);
    readarr(a,n+1);
    // vi a(n+1);
    int pr = 1,s=0;
    vi v(n+1);
    rep(i,0,n){
    
    	v[i]=pr;
    	if(pr-a[i]<0) {
    		cout<<-1;
    		return 0;
    	}
    	if(pr<1e18)
    	pr = 2ll*(pr-a[i]);
    	if(pr>=1e18){
    		pr = inf;
    	}
    }
    
    s+=a[n];
    v[n]=a[n];
    repd(i,0,n-1){
    	int mr = a[i] + v[i+1]/2;
    	if(v[i+1]%2==1) mr++;
    	
    	v[i]=min(v[i],a[i]+v[i+1]);
    	if(mr>v[i]) {
    		cout<<-1<<endl;
    		return 0;
    	}
    	s+=v[i];
    }
    cout<<s<<endl;
    return 0;
}
 
/* Pooja Yadav */

Measured memory_bytes: 4780
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9 + 10;
const double INF = 1e12, EPS = 1e-9;

const int MX = 100010;
int n, m, p[MX];
int s[MX], t[MX];

int main(){
	vi v;
	scanf("%d%d", &n, &m);
	rep(i, n) scanf("%d%d", s + i, t + i), v.pb(s[i]), v.pb(t[i]);
	rep(i, m) scanf("%d", p + i), v.pb(p[i]);
	v.pb(p[m++] = -inf); v.pb(p[m++] = inf);
	sort(p, p + m);
	sort(all(v));
	v.erase(unique(all(v)), v.end());
	
	vi d[2];
	d[0].resize(v.size()); d[1].resize(v.size());
	
	rep(i, n){
		int a = lower_bound(all(v), s[i]) - v.begin();
		int b = lower_bound(all(v), t[i]) - v.begin();
		
		int p1 = (upper_bound(p, p + m, s[i]) - 1 - p) % 2;
		
		if(a < b) d[p1][a]++, d[p1][b]--;
		else d[p1][b]++, d[p1][a]--;
	}
	ll ans = 0, parity = 1, s0 = 0, s1 = 0;
	rep(i, v.size()){
		if(i){
			if(parity % 2 == 0) ans += s0 * (v[i] - v[i - 1]);
			else ans += s1 * (v[i] - v[i - 1]);
		}
		s0 += d[0][i]; s1 += d[1][i];
		if(binary_search(p, p + m, v[i])) parity ^= 1;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	ll n, m; cin >> n >> m;
	priority_queue<ll> a;
	rep(i, 0, n) {
		int A; cin >> A;
		a.push(A);
	}

	rep(i, 0, m) {
		a.push(a.top() / 2);
		a.pop();
	}
	ll ans = 0;
	rep(i, 0, n) {
		ans += a.top();
		a.pop();
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	for(int i=0;i<b.size();i++)
		cout<<a[i]<<b[i];
	if(a.size()>b.size())
		cout<<a[a.size()-1];
	cout<<'\n';
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] n = new int[10];
        for (int i = 0; i < 4; i++) {
            n[sc.nextInt()]++;
        }
        if (n[1] == 1 && n[9] == 1 && n[7] == 1 && n[4] == 1) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21972
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	int x;
	cin >> x;
	if(x >= 30)
		puts("Yes");
	else
		puts("No");

	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  char op;
  cin >> a >> op >> b ;
  int output;
  if(op=='+'){
    output = a+b;
  }else{
    output = a-b;
  }
  cout << output << endl;
  
}

Measured memory_bytes: 256
def main():  
  import sys
  input = sys.stdin.readline
  n, d, a = [int(i) for i in input().split()]
  chk = []
  for i in range(n):
    x, h = [int(i) for i in input().split()]
    chk.append((x, 0, h))

  from heapq import heapify, heappop, heappush
  heapify(chk)
  atk_cnt = 0; ans = 0
  while chk:
    x, t, h = heappop(chk)
    if t == 0:
      if atk_cnt * a >= h:
          continue
      remain = h - atk_cnt * a
      new_atk = (remain - 1) // a + 1
      heappush(chk, (x + 2 * d, 1, new_atk))
      ans += new_atk
      atk_cnt += new_atk
    else:
      atk_cnt -= h
  print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 35664
#include<iostream>

using namespace std;

long long  n,a[200000],mysum,ans=1e20,x,y;

long long ze(long long i){
	if(i>=0) return i;
	else return -1*i;
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		mysum+=a[i];
	}
	for(int i=0;i<n-1;i++){
		x+=a[i];
		y=mysum-x;
		long long nowans;
		nowans=ze(x-y);
		if(ans>=nowans) ans=nowans;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<iostream>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

const int INF = 1000000000;

class Rule : public vector<int>{
	public:
	int parent;
};


int n,e,t;
vector<int> dp;
vector<Rule> rule; 

bool input(){
	cin>>n>>e>>t;
	t--;
	dp.resize(n);
	rule.resize(e);
	
	rep(i,n)cin>>dp[i];
	rep(i,e){
		cin>>rule[i].parent;
		rule[i].parent--;
		int a;
		cin>>a;
		rule[i].resize(a);
		rep(j,a){
			cin>>rule[i][j];
			rule[i][j]--;
		}
	}
	
	return true;
}


int solve(){
	
	while(1){
		int mini = INF;
		int minp = -1;
		
		rep(i,e){
			if(dp[rule[i].parent]==0){
				bool ok = true;
				rep(j,rule[i].size())if(dp[rule[i][j]]==0)ok=false;
				if(ok){
					vector<int> st(rule[i].size());
					rep(j,rule[i].size()) st[j] = dp[rule[i][j]];
					sort(st.rbegin(), st.rend());
					
					int value = 0;
					rep(j,st.size()) value = max(value, j+st[j]);
					
					if(mini > value){
						mini = value;
						minp = i;
					}
				}
			}
		}
		if(minp==-1)break;
		
		dp[rule[minp].parent] = mini;
	}
	/*
	rep(i,n){
		printf("%d | %d\n",i,dp[i]);
	}*/
	
	if(dp[t]==0)return -1;
	return dp[t];
}

void call(){
	cout<<solve()<<endl;
}

int main(){
	input();call();
}

Measured memory_bytes: 1268
def c_Daydream(S):
    # Sを逆にしたものから一覧にある文字列を逆にしたものを除いていき、空文字にできるか？
    s = S[::-1]
    while True:
        if len(s) >= 5 and s[0:5] == 'maerd':
            s = s[5:]
        elif len(s) >= 7 and s[0:7] == 'remaerd':
            s = s[7:]
        elif len(s) >= 5 and s[0:5] == 'esare':
            s = s[5:]
        elif len(s) >= 6 and s[0:6] == 'resare':
            s = s[6:]
        elif len(s) == 0:
            return 'YES'
        else:
            return 'NO'
S = input().strip()
print(c_Daydream(S))

Measured memory_bytes: 3316
#include <stdio.h>
#include <string.h>

int main(void){
     
	int a,b,c,rec=0,rho=0;
	char str[100],*line;
	for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
		line=strtok(str,",");
		sscanf(line,"%d",&a);
		line=strtok(NULL,",");
		sscanf(line,"%d",&b); 
		line=strtok(NULL,",");
		sscanf(line,"%d",&c); 
		if(a*a+b*b==c*c)
			rec++;
		if(a==b)		
			rho++;
	}
	printf("%d\n%d\n",rec,rho);	
	return 0;
}

Measured memory_bytes: 604
/*Coded by::
    **Avinash Tiwary**
    **BE/10298/2015**
    **Production Engineer**
    **Producing <code>**
*/
#include<bits/stdc++.h>
#define bf ios_base::sync_with_stdio (0), cin.tie (0)
typedef long long ll;
typedef double d;
#define MAX 1000009
#define MIN -1
#define M 1000000007
#define INF 5e17
using namespace std;
typedef vector<ll> Vector;
typedef queue<ll > Queue;
typedef stack<ll> Stack;
typedef pair<ll,ll> Pair;
#define mp make_pair
#define pb push_back
bool desc(ll i, ll j) { return i > j; }
ll gcd(ll a, ll b)
{   if (a == 0) return b;
    return gcd(b%a, a);
}
ll power(ll x,ll n)
{   if(n==0) return 1;
    else if(n%2 == 0) return power((x*x)%M,n/2);
    else return (x*power((x*x)%M,(n-1)/2))%M;
}
ll ar[MAX],not_prime[MAX],nc[100][200]; 
void sieve(){
    not_prime[1]=1; not_prime[0]=1;
    for(ll p=2;p*p<=MAX;p++){
        if(!not_prime[p]){
            for(ll i=p*2;i<=MAX;i+=p) not_prime[i]=1;
        }
    }
}
int main(){
    bf; 
    //sieve();
    ll x=1,n,t,i=0,j=0,p=60,c,flag,t1,ta1,ta2,t2,ans=0,k=0; string s[1001],a,b;
    cin>>n;
    for(i=1;i<=n;i++) {
        cin>>s[i];
        for(j=0;j<s[i].size();j++){
            nc[i][s[i][j]]++;
        }
    }
    for(i=97;i<=122;i++){
        t=101;
        for(j=1;j<=n;j++){
            t=min(t,nc[j][i]);
        }
        char c=i; k=1;
        while(k<=t) {cout<<c; k++;}
    }
    return 0;
} 

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

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

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

int main(void) {
    int n,m;

    cin>>n>>m;

    if(n==m){
        cout<<"Yes"<<endl;
    }else {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
n, m = map(int, input().split())
road = [[0]*n for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    road[a-1][b-1] += 1
    road[b-1][a-1] += 1
for r in road:
    print(sum(r))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime>
#include <cstdlib>
#include <map>
#include <set>
using namespace std;
#pragma comment(linker, "/stck:1024000000,1024000000")
#define lowbit(x) (x&(-x))
#define max(x,y) (x>=y?x:y)
#define min(x,y) (x<=y?x:y)
//#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.1415926535897932384626433832
#define ios() ios::sync_with_stdio(true)
#define INF (1<<31)-1;
#define mem(a) (memset(a,0,sizeof(a)))
int main()
{
    double MAX = INF;
    int N,T,A;
    int pre;
    int deg;
    double result;
    cin>>N;
    cin>>T>>A;
    for(int i=1;i<=N;i++){
        cin>>deg;
        result = abs(A - (T-deg*0.006));
        if(result < MAX){
            MAX = result;
            pre = i;
            //cout<<MAX<<endl;
        }
    }
    cout<<pre<<endl;
    return 0;
}


Measured memory_bytes: 256