akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        if (floor(i * (double)1.08) == n) {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
        long int a[10001],i,j,n;
        a[1]=2;
        for(i=2;i<=10000;i++)
        {
                a[i]=i+a[i-1];
        }
        while(scanf("%d",&n)!=EOF){
        printf("%ld\n",a[n]);
        }
        return 0;
}

Measured memory_bytes: 672
#include <bits/stdc++.h>
typedef long long ll;
#define vstroku() to_string()
#define vchislo() to_ulong()
#define gcd(x,y) __builtin_gcd(x,y)
#define numberof1(x) __builtin_popcount(x)
#define povsemelementam(i,mnozh) for(auto i: mnozh)
#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back 
#define pii pair <int, int>
#define F first
#define S second
#define mipletsplay ios_base::sync_with_stdio(0); cin.tie(0); 


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 3e5;
const ll INF = 1e9;
const ll kek=998244353;

int main() {
mipletsplay;
int n;
cin>>n;
vector <int> a(n);
for (int i=0;i<n;i++)
cin>>a[i];
sort(a.begin(),a.end());
int f=n/2;
int cnt=0;

if (a[f]==a[f-1])
{
    cout<<0;
    return 0;
    
}
else
{
cnt=a[f]-a[f-1];
cout<<cnt;
}}


Measured memory_bytes: 640
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;

const int mod = 1e9 + 7;
const int N = 2e5 + 5;

ll f[N], fr[N];

ll cnk(int n, int k) {
    if (n < k) {
        return 0;
    }
    return f[n] * fr[k] % mod * fr[n - k] % mod;
}

ll binpow(ll a, int p) {
    ll res = 1;
    while (p) {
        if (p & 1) {
            (res *= a) %= mod;
        }
        (a *= a) %= mod;
        p >>= 1;
    }
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int b, w;
    cin >> b >> w;
    f[0] = fr[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = f[i - 1] * i % mod;
        fr[i] = binpow(f[i], mod - 2);
    }
    ll p = 0, q = 0;
    ll pw = 1;
    ll kek = binpow(2, mod - 2);
    cout << kek << '\n';
    for (int i = 1; i < b + w; i++) {
        pw = pw * kek % mod;
        (p += cnk(i - 1, b - 1) * pw) %= mod;
        (q += cnk(i - 1, w - 1) * pw) %= mod;
        cout << (1 - p + q + mod) * kek % mod << '\n';
    }
    return 0;  
}

Measured memory_bytes: 5376
#include"bits/stdc++.h"

using namespace std;

int main() {
	long long N;
	cin >> N;
	vector<long long>L(N+1);
	long long ans = 0;

	for (int i = 0; i <= N; i++) {
		if (i == 0) {
			L[i] = 2;
			ans = L[i];
		}
		else if (i == 1) {
			L[i] = 1;
			ans = L[i];
		}
		else {
			L[i] = L[i - 1] + L[i - 2];
			ans = L[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s = input()

a = 0
b = 0
c = 0
for char in s:
    if char == 'a':
        a = 1
    if char == 'b':
        b = 1
    if char == 'c':
        c = 1
if a * b * c == 0:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x, y, ans = 0;
	cin >> x >> y;
	if( x == 1 && y == 1 ){
		puts("1000000");
		return 0;
	}
	if( x == 1 ) ans += 300000;
	if( x == 2 ) ans += 200000;
	if( x == 3 ) ans += 100000;
	if( y == 1 ) ans += 300000;
	if( y == 2 ) ans += 200000;
	if( y == 3 ) ans += 100000;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using llong = long long;

llong n;
vector<llong> v;

int main() {
    cin >> n;
    v.resize(n);
    for (auto &vs:v) cin >> vs;

    sort(v.rbegin(), v.rend());
    llong ans = v[0];
    n -= 2;
    for (int i = 1; i < v.size() && n > 0; i++) {
        ans += v[i] * min(2ll, n);
        n -= 2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 4780
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<string>
#include<numeric>
#include<limits.h>
#include<utility>
#include<cstdlib>
#include<bitset>
#define LP(i,n) for(int i=0;i<n;i++)
#define LPIN(n,a) for(int i=0;i<n;i++)cin >> a[i]
using namespace std;

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <random>

using ll = long long;

//各種nil
template <class T>
constexpr T nil = static_cast<T>(-1);

constexpr int nil_i = nil<int>;
constexpr int nil_ll = nil<ll>;
constexpr double nil_d = nil<double>;

//vector
template <class T>
using vec = std::vector<T>;

template <class T>
struct Vec2D
{
    T x, y;
};

//void Q01_MaximumSum()
//{
//    //n個の整数 a[0], a[1], ..., a[n-1]が与えられる。これらの整数から何個かの整数を選んで総和をとったときの、総和の最大値を求めよ。また、何も選ばない場合の総和は 0 であるものとする。
//
//    using namespace std;
//    int n; cin >> n;
//
//    vec<int> v(n), dp(n);
//    for (auto& x : v) cin >> x;
//
//    dp[0] = max(v[0], 0);
//
//    for (int i = 1; i < n; ++i)
//        dp[i] = max(dp[i - 1], dp[i - 1] + v[i]);
//
//    cout << dp[n - 1] << endl;
//}

struct Item
{
    int value;
    int weight;
};

void Q02_Knapsack()
{
    //AOJ DPL_1_B

    using namespace std;

    int n, W; cin >> n >> W;


    vec<Item> items(n);
    for (auto& x : items) cin >> x.value >> x.weight;

    //dp[i+1][W] : i番目の品物までで、重さがWを超えないようにしたときの価値の最大値
    vec<vec<int>> dp(n + 1, vec<int>(W + 1, 0));

    for (int i = 0; i < n; ++i)
        for (int w = 1; w <= W; ++w)
        {
            if (items[i].weight <= w)
                dp[i + 1][w] = max(dp[i][w], dp[i][w - items[i].weight] + items[i].value);
            else
                dp[i + 1][w] = dp[i][w];
        }

    cout << dp[n][W] << endl;
}

void solve()
{
    Q02_Knapsack();
}

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


Measured memory_bytes: 6732
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

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

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;
bool win[100100];


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i,N) cin >> a[i];
    srep(i,1,K+1) {
        rep(j,N) {
            win[i] |= i>=a[j] && !win[i-a[j]];
        }
    }
    if (win[K]) puts("First");
    else puts("Second");
    return 0;
}


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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	int S,W;
	cin >> S >> W;
  if(W >= S){
cout << "unsafe";
  }else{
    cout << "safe";
  }
}

Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}
template<class T> bool lcmp(const pair<T, T>& l, const pair<T, T>& r) {
  return l.first < r.first;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int a, b, c;
  cin >> a >> b >> c;
  cout << (a * b / 2);
}
#endif


Measured memory_bytes: 3652
import java.util.*;
public class Main {
static Scanner scan=new Scanner(System.in);
static int id[];
static void connect(int u,int v){
	int i = root(u);
	int j = root(v);
	id[i] = j;
	
}

static int root(int i) {
	while(i!=id[i]) {
		i=id[i];
		
	}
	return i;
}
static int connected(int u,int v){
	if( root(u)==root(v))
		return 1;
	else return 0;
}
	public static void main(String[] args) {
	//	int isconetted[]=new int [1000];
		id = new int[1000000];
		for (int i = 0; i < 1000000; i++) id[i] = i;		
int n=scan.nextInt(),Q=scan.nextInt();
int i=0;
while(i!=Q) {
	int q=scan.nextInt();
int u=scan.nextInt();
int v=scan.nextInt();
if(q==0) 
	connect(u, v);
	else if(q==1)
	System.out.println(connected(u, v));
	
i++;
}
/*for(int j=0;j<isconetted.length;j++)
{
System.out.println(isconetted[j]);	
}
	}
*/
}}


Measured memory_bytes: 71912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
const int INF_i = 1 << 30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(pair<int, int> a, pair<int, int> b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};
int main() {
    while(1){
        ll N;
        cin >> N;
        if(N == 0) break;
        vector<ll> tetra;
        ll n = 1;
        while(n*(n+1)*(n+2)/6 <= N){
            tetra.pb(n*(n+1)*(n+2)/6);
 
            n++;

        }
        
        vector<ll> dp(N+2,INF);
        dp[0] = 0;
        vector<ll> odp(N+2,INF);
        odp[0] = 0;
        rep(i,tetra.size()){
            rep(j,N+1){
                if(j-tetra[i]>=0){
                    dp[j] = min({dp[j], dp[j-tetra[i]]+1}); 
                    if(tetra[i]%2 == 1){
                        odp[j] = min({odp[j], odp[j-tetra[i]]+1});
                    }
                }
                
            }
        }

        
        /*rep(i,otetra.size()){
            rep(j,N+1){
                if(j-otetra[i]>=0){
                    odp[j] = min({odp[j], odp[j-otetra[i]]+1}); ;
                }
            }
        }*/
        
        cout << dp[N]<<" "<< odp[N]<< endl;
    }



    return 0;
    

}


Measured memory_bytes: 25060
#include <cstdio>
#include <cmath>
using namespace std;

int main() {
  int n, h, m;
  double hr, mr, dr;
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d:%d", &h, &m);
    mr = m * 6;
    hr = h * 30 + m * 0.5;
    dr = fabs(mr - hr);
    if (dr > 180.0) {
      dr = 360.0 - dr;
    }
    if (dr < 30.0) {
      printf("alert\n");
    } else if (dr < 90.0) {
      printf("warning\n");
    } else {
      printf("safe\n");
    }
  }
  return 0;
}

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

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

const long long INF=1LL<<60;

long long h[100010];
long long dp[100010];

int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;++i) cin>>h[i];

    for(int i=0;i<100010;++i)dp[i]=INF;
    dp[0]=0;

    for(int i=0;i<n;++i)
    {
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i>1) chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }

    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
<?php
list($n) = ints();
list($a) = strs();
list($b) = strs();
list($c) = strs();
$cnt = 0;
for ($i = 0; $i < $n; ++$i)
    $cnt += count(array_unique([$a[$i], $b[$i], $c[$i]])) - 1;
echo $cnt;
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 16108
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#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 ALL(a) (a).begin(), (a).end()

int main() {
    int N, M, x, y, max_x, min_y;
    cin >> N >> M >> max_x >> min_y;
    REP(i, N) {
        cin >> x;
        max_x = max(max_x, x);
    }
    REP(i, M) {
        cin >> y;
        min_y = min(min_y, y);
    }

    if (max_x < min_y) cout << "No War" << endl;
    else             cout << "War" << endl;
    return 0;
}

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

int main() {
  int num, i, f;
  char a;
  i = 0;
  f = 0;
  cin >> num;

  while(i<num){
    cin >> a;
    if ( a == 'Y'){
      f = 1;
      break;}
    else
      i++;
  	}
  if (f==0)
    cout << "Three";
  else
    cout << "Four";

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <list>
#include <queue>
#include <stack>
#include <map>
#include <set>
#define mod 1000000007
#define MAX 20000000009
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int tot = 0;
    for(int i = 0; i < m; i++) {
        int val;
        cin >> val;
        tot += val;
    }
    if(tot > n) cout << -1 << endl;
    else cout << n - tot << endl;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int H;
    int N;
    
    cin >> H >> N;
    
    vector<int> A(N);
    
    for(int i=0; i<N; i++) {
        cin >> A.at(i);
    }
    
    sort(A.begin(), A.end());
    
    for (int i=N-1; i>=0; i--) {
        H -= A.at(i);
    }
    
    if( H > 0) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
    
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
ll dp[101][100005];
int main()
{
     ll n,we,i,j;
     cin>>n>>we;
  ll w[n+1],v[n+1];
  for(i=1;i<=n;i++)
  {
    cin>>w[i]>>v[i];
  }
    for(i=1;i<=n;i++)
    {
      for(j=0;j<=we;j++)
      {
        dp[i][j]=(j<w[i])?dp[i-1][j]:max(dp[i-1][j],dp[i-1][j-w[i]]+v[i]);//necessary to carry the previous row entries as we need to take into account that first i items have been used
      }
    }
  cout<<dp[n][we];
    return 0;
}


Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    
   vi aa(a);
    f(i,a) cin >> aa[i];
    
   vi bb(b);
    f(i,b) cin >> bb[i];
   
   vi cc(c);
    f(i,c) cin >> cc[i];
    
   sort(aa.begin(),aa.end());
   sort(bb.begin(),bb.end());
   sort(cc.begin(),cc.end());
 
   int res = 0;
   int pta = a-1;
   int sa = 0;
   int ptb = b-1;
   int sb = 0;
   int ssum = 0;
   int taken = 0;
    
   for(int i=0;i<min(c,x+y);i++) ssum+=cc[c-i-1];
      
   for(int i=min(c,x+y);i>=0;i--)
   {  
      
   int need = x+y-i;
       
   while(need > taken)
   {
       taken++;
       
       if(a-1-pta < x && b-1-ptb < y)
       {
           if(aa[pta] > bb[ptb])
           {
               sa+=aa[pta];
               pta--;
           }
           else
           {
               sb+=bb[ptb];
               ptb--;
           }
             
       }
       else if(a-1-pta < x)
       {
           sa+=aa[pta];
           pta--;
       }
       else
       {
           sb+=bb[ptb];
           ptb--;
       }      
   }
       
    res=max(res,ssum+sa+sb);

    if(c-i < c) ssum-=cc[c-i];  
       
   }
   
        
   cout << res; 
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 2560
unittest
{
	assert( [ "3", "1 2 3" ].solve == 6 );
	assert( [ "10", "3 1 4 1 5 9 2 6 5 3" ].solve == 237 );
	assert( [ "10", "3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820" ].solve == 103715602 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	
	// ビットごとに立っている数を集計
	auto cs = new long[ 60 ];
	foreach( a; as )
	{
		foreach( i, ref c; cs )
		{
			if( a & ( 1L << i ) ) c++;
		}
	}
	
	// 合計を計算
	const M = 10L ^^ 9 + 7;
	auto ans = ModWorld!M( 0L );
	foreach( a; as )
	{
		n--;
		foreach( i, ref c; cs )
		{
			auto b = 1L << i;
			if( a & b )
			{
				c--;		// csから自分を除外
				ans += ModWorld!M( b ) * ( n - c );
			}
			else
			{
				ans += ModWorld!M( b ) * c;
			}
		}
	}
	return ans;
}

// モジュラ整数型（n mod M）
struct ModWorld( long M )
{
	long n;
	
	this( long n ){ this.n = n % M; }
	void opUnary( string OP )() if( OP == "++" ){ this.n = ( this.n + 1 ) % M; }
	void opUnary( string OP )() if( OP == "--" ){ this.n = ( this.n + M - 1 ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "+"  ){ this.n = ( this.n + r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "-"  ){ this.n = ( this.n + M - r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "*"  ){ this.n = ( this.n * r.n ) % M; }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "/"  ){ this *= r ^^ ModWorld( M - 2 ); }
	void opOpAssign( string OP )( ModWorld r ) if( OP == "^^" )
	{
		auto a = this.n;
		this.n = 1L;
		for( auto i = r.n; 0 < i; i >>= 1 )
		{
			if( i & 1 ) this.n = ( this.n * a ) % M;
			a = ( a * a ) % M;
		}
	}
	auto opBinary( string OP )( ModWorld r ){ auto l = this; l.opOpAssign!OP( r ); return l; }
	auto opEquals( ModWorld r ){ return this.n == r.n; }
	
	void opAssign( long r ){ this.n = r % M; }
	void opOpAssign( string OP )( long r ){ this.opOpAssign!OP( ModWorld( r ) ); }
	auto opBinary( string OP )( long r ){ return this.opBinary!OP( ModWorld( r ) ); }
	auto opBinaryRight( string OP )( long l ){ return ModWorld( l ).opBinary!OP( this ); }
	auto opEquals( long r ){ return this.n == r; }
	
	auto toString(){ return this.n.to!string; }
}


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

int main() {
 int A, B, C, X;
 cin >> A >> B >> C >> X;
 int res = 0  ;

  for (int a = 0; a <= A ; ++a){
    for (int b = 0; b <= B ; ++b){
      for (int c = 0; c <= C ; ++c){
        int total = 500 * a + 100 * b + 50 * c;
        if (total == X) ++ res;
      }
    }
  }
 cout << res << endl; 
  
}

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

int main(void){
    string s,t;
    cin >> s >> t;

    int ans = 0;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int N = sc.nextInt();
			long[] A = new long[N];
			int minus = 0;
			for(int i = 0; i < N; i++) {
				A[i] = sc.nextInt();
				if(A[i] < 0) {
					minus++;
					A[i] = -A[i];
				}
			}
			long ans = 0;
			Arrays.sort(A);
			for(int i = 0; i < N; i++) {
				ans += A[i];
			}
			if(minus % 2 == 0) System.out.println(ans);
			else System.out.println(ans - 2 * A[0]);
		}
	}
}

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

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

    if(s.front() == 'W' || s.back() == 'W') {
        cout << 0 << endl;
        return 0;
    }

    int cntL = 1, cntR = 0;
    int flagL = 1;
    vector<ll> L(2*n), R(2*n);
    vector<int> posR;
    for(int i = 1; i < 2*n; i++) {

        L[i] = cntL;
        R[i] = cntR;

        if(s[i-1] == s[i]) {
            flagL ^= 1;
        }

        if(flagL) {
            cntL++;
        }
        else {
            cntR++;
            posR.push_back(i);
        }

    }

    if(cntL != cntR) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1LL;
    rep(i, posR.size()) {
        ans *= (L[posR[i]] - R[posR[i]]);
        ans %= mod;
    }

    while(n >= 1) {
        ans *= n;
        ans %= mod;
        n--;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4224
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    if (W % w == 0 && H % h == 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    int low = -1e9;
    int high = (-low - 1) / (h * w - 1);
    for (int i = 1; i < H + 1; i++) {
        for (int j = 1; j < W + 1; j++) {
            if (i % h == 0 && j % w == 0) {
                cout << low;
            } else {
                cout << high;
            }
            if (j != W) {
                cout << " ";
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int n, a[N];
int main() {
    cin >> n;
    int avg = 0;
    for (int i = 0; i < n; ++i)  {
        cin >> a[i];
        avg += a[i];
    }
    avg /= n;
    int res = 2e9;
    for (int j = 0; j < 2; ++j) {
        int cur = 0;
        for (int i = 0; i < n; ++i) {
            cur += (a[i] - avg) * (a[i] - avg);
        }
        ++avg;
        res = min(res, cur);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
// ~maqsat~

// #pragma GCC target ("avx2")
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define F first
#define S second
#define in insert
#define pb push_back
#define eb emplace_back
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define count1 __builtin_popcountl
#define debug(x) cerr << (#x) << " = " << (x) << "\n"
#define ACCELERATE ios_base::sync_with_stdio(false),cin.tie(nullptr)
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)
#define ever ;;

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T> inline void cmin(T &a, T b) { a = min(a, b); }
template <class T> inline void cmax(T &a, T b) { a = max(a, b); }

const int oo = 0x3f3f3f3f;
const ll N = 1e6 + 345;
const ll MOD = 998244353;
const ll INF = 1e15 + 9;
const db EPS = 1e-9;
const db PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
	fre("");
	ACCELERATE;
	
	ll a, b, k;
	cin >> a >> b >> k;
	
	if (k >= a) {
		k -= a;
		a = 0;
	} 
	else {
		a -= k;
		k = 0;
	}
	
	if (k > 0) {
		if (k >= b) {
			k -= b;
			b = 0;
		}
		else {
			b -= k;
			k = 0;
		}
	}
	
	cout << a << ' ' << b;
	return 0;
}
/*
 
*/


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int x=100000,i,n;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        x=x*1.05;
        if(x%1000!=0){
            x=(x/1000+1)*1000;
        }
    }
    printf("%d\n",x);
    
    return 0;
}

Measured memory_bytes: 592
#include <cmath>
#include <iostream>
#include <map>

int main(int argc, char const* argv[])
{
    int a, b, c;
    std::cin >> a >> b >> c;

    std::map<int, int> cache;

    int sum = 0;
    while(true)
    {
        sum += a;
        int tmp = sum % b;
        /* std::cout << a * i << " " << sum << std::endl; */

        if(sum % b == c)
        {
            std::cout << "YES" << std::endl;
            return 0;
        }

        int count = cache.count(tmp);
        if(count == 0)
        {
            cache[tmp] = 1;
        }
        else
        {
            break;
        }
    }
    std::cout << "NO" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
#include <cassert>
using namespace std;

typedef long long ll;


int main() {
	int n; cin >> n;
	vector<int> b(n), ans;
	for (int i = 0; i < n; i++) cin >> b[i];
	for (int iter = 0; iter < n; iter++) {
		for (int i = n - 1 - iter; i >= 0; i--) {
			if (b[i] == i + 1) {
				ans.push_back(b[i]);
				for (int j = i; j < (int)b.size() - 1; j++) {
					b[j] = b[j + 1];
				}
				b.pop_back();
				break;
			}
		}
	}
	if (ans.size() != n) cout << -1 << endl;
	else {
		for (int i = n - 1; i >= 0; i--) cout << ans[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import itertools
a = int(input())

A = ['0', '3', '5', '7']
B = []
count=0
for i, j, k, l, m, n, o, p, q, r in itertools.product(A, A, A, A, A, A, A, A, A, A):
    ans= i + j + k + l + m + n + o + p + q + r
    ans = int(ans)
    if(ans <=a):
        ans = list(str(ans))
        if('0' not in ans and '3' in ans and '5' in ans and '7' in ans):
            count+=1
    else:
        break
print(count)

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

int main(){
	// your code goes here
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	cout.tie(NULL);
	
	long long int n;
	cin>>n;
	long long int i;
	long long int arr[n];
	for(i=0;i<n;i++){
	    cin>>arr[i];
	}
	long long int sml[n];
	sml[0]=arr[0];
	for(i=1;i<n;i++){
	    if(arr[i]<sml[i-1]){
	        sml[i]=arr[i];
	    }
	    else{
	        sml[i]=sml[i-1];
	    }
	}
	long long int ans=0;
	for(i=0;i<n;i++){
	    if(arr[i]<=sml[i]){
	        ans++;
	    }
	}
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
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; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	string S;
	cin >> S;
	S[3] = '8';
	cout << S;
}

Measured memory_bytes: 256
import java.util.*;

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

        if(S.equals("SAT")) System.out.println("1");
        else if(S.equals("SUN")) System.out.println("7");
        else if(S.equals("MON")) System.out.println("6");
        else if(S.equals("TUE")) System.out.println("5");
        else if(S.equals("WED")) System.out.println("4");
        else if(S.equals("THU")) System.out.println("3");
        else if(S.equals("FRI")) System.out.println("2");
        
    }
}

Measured memory_bytes: 23124
#include <stdio.h>

int main(void)
{
  int N;
  scanf("%d", &N);
  int ans = N - ((N>=100000)? ((N>=1000000)? 900000: N-99999):0)
              - ((N>=1000)?   ((N>=10000)?   9000:   N-999):  0)
              - ((N>=10)?     ((N>=100)?     90:     N-9):    0);
  printf("%d\n", ans);
  
  return 0;
}


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

int main() {
 int N;
  cin >> N;
  vector<tuple<string,int,int>> a(N);
  for (int i; i<N; i++){
   string S;
    int P;
    cin >> S >> P;
    P=P*(-1);
    a[i]=make_tuple(S,P,i);
  }
  sort (a.begin(),a.end());
  for(auto b : a){
   cout << get<2>(b)+1 << endl; 
  }
}


Measured memory_bytes: 256
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
ans = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if i>>j & 1:
      rest -= P[j]*(j+1)*100+C[j]
      cnt += P[j]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  elif rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//(maxdgt+1)+1)
print(int(ans))

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

int main() {
    int N,K;
    cin>>N>>K;
    vector<int> d(K);
    vector<int> sunuke(N);
    vector<int> a(N);
    rep(i,K){
        cin>>d.at(i);
        rep(k,d.at(i)){
            cin>>a.at(k);
            sunuke.at(a.at(k)-1)++;
        }
    }
    int sum=0;
    rep(i,N){
        if(sunuke.at(i)==0){
            sum++;
        }
    }
    cout<<sum<<endl;

}

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

template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))

int main(){
    int N, K;
    cin >> N >> K;
    cout << (N + K - 3) / (K - 1) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,sum;
	cin>>a>>b>>c;
	if(a==b&&a!=c||a==c&&a!=b||b==c&&b!=a) 
		cout<<"Yes";
	else
		cout<<"No";
	return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    string s1, s2;
    cin >> s1 >> s2;
    int l = s1.length();
    map<char, int> mp1, mp2;
    rep(i, l) {
        mp1[s1[i]]++;
        mp2[s2[i]]++;
    }
    rep(i, l) {
        if (mp1[s1[i]] != mp2[s2[i]]) {
            puts("No");
            return 0;
        }
    }
    puts("Yes");
    return 0;
}

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

using namespace std;

const int maxW = 1e5+10;

long long dp[maxW];

int main() {
	int n, W;
	cin >> n >> W;

	dp[0] = 1;
	for(int i = 0; i < n; i++) {
		int w, v;
		cin >> w >> v;

		for(int j = W-w; j >= 0; j--) {
			if(dp[j]) {
				dp[j+w] = max(dp[j+w], dp[j]+v);
			}
		}
	}

	//for(int i = 0; i <= W; i++) cout << dp[i] << " ";
	//cout << endl;
	cout << *max_element(dp, dp+W+1)-1;
}

Measured memory_bytes: 4324
#include <iostream>
#include <utility>
#include <map>
using namespace std;

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

    int ans1 = 0;
    int ans2 = 0;
    for (auto p : mp)
    {
        if (p.second >= 4)
        {
            if (p.first > ans1)
            {
                ans1 = p.first;
            }
            if (p.first > ans2)
            {
                ans2 = p.first;
            }
        }
        else if (p.second >= 2)
        {
            if (p.first > ans2)
            {
                ans2 = p.first;
            }
        }

        if (ans1 < ans2)
        {
            swap(ans1, ans2);
        }
    }

    cout << (long long)ans1 * ans2 << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <limits>
#include <map>
#include <bitset>

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

using namespace std;
using p = pair<int, int>;
using ll = long long;



int main() {
	string s;
	cin >> s;
	string ans = "hon";
	if (s[s.size() - 1] == '0' || s[s.size() - 1] == '1' || s[s.size() - 1] == '6' || s[s.size() - 1] == '8') {
		ans = "pon";
	}
	else if (s[s.size() - 1] == '3') {
		ans = "bon";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3596
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll i = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll i = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll i = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
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;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll a, b;
	cin >> a >> b;
	co(a * b);

	return 0;
}


Measured memory_bytes: 3632
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
using namespace std;

bool Check(string a)
{
    int i, j;

    for(i = 0, j = (signed)a.size() - 1; i < j; i ++, j --)
        if(a[i] != a[j])
            return false;

    return true;
}

int main(void)
{
    string a;

    cin >> a;
    cout << (Check(a) && Check(a.substr(0, (a.size() - 1) / 2)) && Check(a.substr((a.size() + 3) / 2 - 1, a.size() - (a.size() + 3) / 2 + 1)) ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int a,b,c,d,e;
    cin>>a>>b>>c>>d;
    if(a==0) cout<<"1"<<endl;
    else if(b==0) cout<<"2"<<endl;
    else if(c==0) cout<<"3"<<endl;
    else if(d==0) cout<<"4"<<endl;
    else if(e==0) cout<<"5"<<endl;
    return 0;
}


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

int main() {
  int count =0;
  int l,r,d;
  cin>>l>>r>>d;
  for(int i=1;i<=100;i++){
    if(i*d>=l&&i*d<=r)count++;
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 3580
#define MYDEBUG
#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <algorithm>
#include <queue>
#include <set>
#include <cstdio>
#include <unordered_map>

#ifdef MYDEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x)
#endif
#define ll long long
#define ull unsigned long long
#define eps 1e-14
using namespace std;

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last)
			out << ",";
	}
	out << "]";
	return out;
}

void solve() {
	string at, mid, con;
	cin >> at >> mid >> con;
	cout << "A" << mid[0] << "C";
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
/*
    Reference :-
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forn1(i, n) for (int i = 1; i < int(n); i++)
#define PI pair<int,int>
#define all(vec) vec.begin(),vec.end()
ll mod=1e9+7;
ll fac[100001];
ll power(ll n,ll k){
    ll ans=1;
    while(k){
        if(k&1)ans=(ans*n)%mod;
        k/=2;
        n=(n*n)%mod;
    }
    //ans=(ans-1+mod)%mod;
    return ans;
}


int main(){
    //std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a,b;
    cin>>a>>b;
    int ans=a/b;
    if(a%b!=0)ans++;
    cout<<ans;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);

        long t = ((n - m) * 100) + (m * 1900);
        
        int i = 1;
        double yy = 0;
        double z = Math.Pow(2, m);

        while (true) {
            double y = t * i;
            double p = Math.Pow((z - 1) / z, i - 1) * 1 / z;

            yy += y * p;
            i++;
            if (t * p < 0.00001) break;
        }
        return (long)yy + 1;
    }

    static long Pow(long x, long n) {
        long ans = 1;
        while (n > 0) {
            if (n % 2 == 1) {
                ans = ans * x;
            }
            x = x * x;
            n /= 2;
        }
        return ans;
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int B1,B2,B3;
    cin>>B1>>B2>>B3;
    int r=B1+B2+B3;
    if(r>=22){
        cout<<"bust\n"<<endl;
    }
    else{
        cout<<"win\n"<<endl;
    }
    return 0;

}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define N 505
using namespace std;
typedef pair<int,int> P;
int h,w,r,c,a,d[N][N][4];
bool ans[N][N],used[N][N];
int dy[4]={0,1,0,-1};
int dx[4]={1,0,-1,0};

void check(int y,int x){
  if(ans[y-1][x]&&ans[y][x+1])
    if(d[y][x][0]!=d[y][x][1])ans[y][x]=1;
  if(ans[y][x+1]&&ans[y+1][x])
    if(d[y][x][1]!=d[y][x][2])ans[y][x]=1;
  if(ans[y+1][x]&&ans[y][x-1])
    if(d[y][x][2]!=d[y][x][3])ans[y][x]=1;
  if(ans[y][x-1]&&ans[y-1][x])
    if(d[y][x][3]!=d[y][x][0])ans[y][x]=1;
  if(ans[y][x-1]&&ans[y][x+1])
    if(d[y][x][1]!=d[y][x][3])ans[y][x]=1;
  if(ans[y-1][x]&&ans[y+1][x])
    if(d[y][x][0]!=d[y][x][2])ans[y][x]=1;
}

void bfs(){
  queue<P> q;
  for(int i=1;i<=w;i++){
    q.push(P(1,i));
    q.push(P(h,i));
  }
  for(int i=1;i<=h;i++){
    q.push(P(i,1));
    q.push(P(i,w));
  }
  memset(used,0,sizeof(used));
  while(!q.empty()){
    P t=q.front(); q.pop();
    int y=t.first,x=t.second;
    check(y,x);
    if(!ans[y][x])continue;
    used[y][x]=true;
    for(int i=0;i<4;i++){
      int ny=y+dy[i],nx=x+dx[i];
      if(!ny||!nx||h<ny||w<nx)continue;
      if(used[ny][nx])continue;
      q.push(P(ny,nx));
    }
  }
}

int main(){
  while(1){
    cin>>h>>w>>r>>c;
    if(!h&&!w&&!r&&!c)break;
    memset(d,0,sizeof(d));
    for(int i=1;i<=h*2+1;i++){
      if(i%2)
	for(int j=1;j<=w;j++){
	  cin>>a;
	  d[i/2][j][2]=a;
	  d[i/2+1][j][0]=a;
	}
      else
	for(int j=1;j<=w+1;j++){
	  cin>>a;
	  d[i/2][j-1][1]=a;
	  d[i/2][j][3]=a;
	}
    }
    memset(ans,0,sizeof(ans));
    for(int i=0;i<=h+1;i++)
      ans[i][0]=ans[i][w+1]=true;
    for(int i=0;i<=w+1;i++)
      ans[0][i]=ans[h+1][i]=true;
    bfs();
    if(r==1&&!d[r][c][0]&&ans[r-1][c])ans[r][c]=true;
    if(r==h&&!d[r][c][2]&&ans[r+1][c])ans[r][c]=true;
    if(c==1&&!d[r][c][3]&&ans[r][c-1])ans[r][c]=true;
    if(c==w&&!d[r][c][1]&&ans[r][c+1])ans[r][c]=true;
    if(ans[r][c])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

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

int main() {
  long long x; cin >> x;
  for(long long i = 0; i < 1000; i++){
    for(long long j = -1000; j < 1000; j++){
      if(i*i*i*i*i == x + j*j*j*j*j){
        cout << i << " " << j;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3676