akhauriyash/Code-Regression huggingface dataset:
macro p(z);:((x->parse(Int,x)).(split($z)));end
f(s) = s == "BTC" ? 380000 : 1
function main()
  sum_money=0
  for i=1:parse(Int,readline())
    a,b=split(readline())
    sum_money+=parse(Float64,a)*f(b)
  end
  print(sum_money)
end
main()

Measured memory_bytes: 166952
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, X, sum = 0, ans = 0;

  cin >> N >> X;

  for (int i=0; i<N; i++) {
    int L;
    cin >> L;
    sum += L;
    ans += sum <= X;
  }

  cout << ans + 1 << endl;

  return 0;
}


Measured memory_bytes: 256
function main(input) {
    const reverseString = (s) => {
        return s.split('').reverse().join('');
    };

    // 文字列を反転
    const WORDS = ['dream', 'dreamer', 'erase', 'eraser'].map(reverseString);

    var S = reverseString(input.split('\n')[0]);

    var index = 0;
    
    while(true) {
        var w = WORDS.find((w) => S.startsWith(w, index));
        if (!w) break;
        index += w.length;
    }

    if (S.length === index) {
        console.log('YES');
    } else {
        console.log('NO');
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       s.find(x) != s.end()

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
ll a[SZ];
//ll b[SZ];



int main() {
    FR;
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
    //    ll a, b, d;
    string s, s1, s2;

    cin1(s);

    (s[0] >= 'a' && s[0] <= 'z') ? cot1('a') : cot1('A');

    return 0;
}



Measured memory_bytes: 3644
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int a, b; cin >> a >> b;
	int ans = 0;
	if(a > b) { ans += a; a--; }
	else { ans += b; b--; }
	ans += max(a, b);
	println(ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); ++i)
 //using namespace atcoder;
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
//マクロ
// forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define _GLIBCXX_DEBUG
// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())       // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))    //最大値を求める
#define MIN(x) *min_element(ALL(x))    //最小値を求める
//定数
#define INF 1000000000000  // 10^12:極めて大きい値,∞
#define inf 2147483647     // int値の最大値
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back                             // vectorヘの挿入
#define MP make_pair                             // pairのコンストラクタ
#define F first                                  // pairの一つ目の要素
#define S second                                 // pairの二つ目の要素
#define CST(x) cout << fixed << setprecision(x)  //小数点以下の桁数指定
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int gcd(int a, int b) {
    if (b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
//各桁の和
int sumDight(int x) {
    int sum = 0;
    while (x > 0) {
        sum += (x % 10);
        x /= 10;
    }
    return sum;
}
//回文数
int divideReverse(int x) {
    int reverse = 0;
    int r;
    while (x > 0) {
        r = x % 10;
        reverse = reverse * 10 + r;
        x /= 10;
    }
    return reverse;
}

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

    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;                                               // 初期状態
    for (int i = 0; i < N; ++i) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];  // 1-index にしておく

    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i + 1] - t[i];
        int dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！
    }

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


Measured memory_bytes: 4860
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int MAX = 510000;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
	ll n, k;
	cin >> n >> k;
    COMinit();
	
	/*
		
		a個の部屋が0人で、n-a個の部屋に0人以上となる組み合わせは?
			a個以上の部屋が0人になる
		
		a個の部屋から、建物外に人を移動する組み合わせ   nCa
		a人がb個の部屋・・・(a+b-1)Ca
		建物外のa人を、(n-a)個の部屋に移動する組み合わせ・・(a+n-a-1)Ca = (n-1)Ca
		
		a個の部屋から、(n-a)個の部屋に移動する組み合わせ・・ nCa * (n-1)Ca
		
	*/
	
	if ( k >= n )
		k = n - 1;
	ll result = 0;
	for ( int i = 0; i <= k; i++ ){
		result = result + (COM(n,i)*COM(n-1,i))%MOD;
	}
	cout << result%MOD << endl;
	
	
	return 0;
}



Measured memory_bytes: 12288
#include <stdio.h>

int A[500010];
int n;

void maxheapify(int i) {
    if (i > n) {
        return;
    }
    int left = i * 2, right = i * 2 + 1, largest = i;
    if (left <= n && A[left] > A[largest]) {
        largest = left;
    }
    if (right <= n && A[right] > A[largest]) {
        largest = right;
    }
    if (largest != i) {
        int t = A[i];
        A[i] = A[largest];
        A[largest] = t;
        maxheapify(largest);
    }
}

void buildHeap() {
    for (int i = n / 2; i >= 1; i--) {
        maxheapify(i);
    }
}

void buildHeap2() {
    for (int i = 2; i <= n; i++) {
        int j = i;
        while (j > 1 && A[j / 2] < A[j]) {
            int t = A[j / 2];
            A[j / 2] = A[j];
            A[j] = t;
            j /= 2;
        }
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &A[i]);
    }
    buildHeap();
    for (int i = 1; i <= n; i++) {
        printf(" %d", A[i]);
    }
    printf("\n");
    return 0;
}



Measured memory_bytes: 4708
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

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;
typedef pair<int, int> PR;

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}
 

//cout<<""<<endl;
int main(){
 int x;cin>>x;
  if(x==1)cout<<0<<endl;
  else cout<<1<<endl;
  
}






Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <numeric>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <deque>
#include <bitset>
#include <cstring>
#include <sstream>
#include <complex>

#define f first
#define s second
#define ll long long
#define ld double
#define pb push_back
#define all(x) x.begin(),x.end()
#define mp make_pair
#define y0 eto
#define y1 mezhdy
#define y2 nami
#define left extermination
#define right dismemberment
 
using namespace std;
 
double start_moment = 0;
double get_runtime() { return 1.0*clock()/CLOCKS_PER_SEC; }
void reset_timer() { start_moment = get_runtime(); }
double timer_time() { return get_runtime() - start_moment; }
void runtime(){cout<<fixed<<setprecision(5)<<get_runtime()<<'\n';}
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
template <class T>void read(vector<T> &a,ll n){T x; a.clear();for(ll i=0;i<n;i++){cin>>x;a.pb(x);}}
template <class T>void write(vector<T> &a){for(T x : a) cout<<x<<' ';cout<<'\n';}

const int N=1003;

char a[N][N];
int n,m;
int x1,y1,x2,y2;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

vector<pii> g[N][N];
int used[N][N];
vector<int> gg[N*N];
int cc=1;
int d[N*N];

bool ok(int x,int y)
{
    return min(x,y)>=0 && x<n &&y<m;
}

void go(int x,int y)
{
    used[x][y]=cc;
    for(pii p : g[x][y])
        if(!used[p.f][p.s])
            go(p.f,p.s);
}

int main()
{
    ios_base::sync_with_stdio(0);
//    freopen("INPUT.txt","r",stdin);
//    freopen("OUTPUT.txt", "w", stdout);
    
    cin>>n>>m;
    cin>>x1>>y1>>x2>>y2;
    x1--;
    y1--;
    x2--;
    y2--;
    
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin>>a[i][j];
    
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            for(int d=0;d<4;d++)
                if(a[i][j]=='.' && ok(i+dx[d],j+dy[d]) && a[i+dx[d]][j+dy[d]]=='.')
                    g[i][j].pb(mp(i+dx[d],j+dy[d]));
    
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(a[i][j]=='.' && !used[i][j])
            {
                go(i,j);
                cc++;
            }
    
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(used[i][j])
                for(int xx=-2;xx<=2;xx++)
                    for(int yy=-2;yy<=2;yy++)
//                        if(used[i+xx][j+yy] && used[i+xx][j+yy]!=used[i][j])
                            gg[used[i][j]].pb(used[i+xx][j+yy]);
    
    for(int i=0;i<N*N;i++)
        d[i]=1000000000;
    
    queue<int> q;
    q.push(used[x1][y1]);
    d[used[x1][y1]]=0;
    
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        
        for(int to : gg[u])
            if(d[to]>d[u]+1)
            {
                d[to]=d[u]+1;
                q.push(to);
            }
    }
    if(d[used[x2][y2]]==1000000000)
        d[used[x2][y2]]=-1;
    cout<<d[used[x2][y2]]<<endl;
    
    
  

}


Measured memory_bytes: 144196
def main():
    N, C = map(int, input().split())
    XV = [tuple(map(int, input().split())) for _ in range(N)]
    return max(solve(N, C, XV), solve(N, C, [(C - x, v) for x, v in reversed(XV)]))

def solve(N, C, XV):
    lv = [0] * N
    rv = [0] * N
    x0, c, m = 0, 0, 0
    for i, (x, v) in enumerate(XV):
        c += v - (x - x0)
        m = max(m, c)
        lv[i] = m
        x0 = x
    rv = [0] * N
    x0, c, m = C, 0, 0
    for i, (x, v) in enumerate(reversed(XV)):
        c += v - 2 * (x0 - x)
        m = max(m, c)
        rv[i] = m
        x0 = x
    for i in range(N - 1):
        lv[i] += rv[N - i - 2]
    return max(lv)

print(main())


Measured memory_bytes: 36992
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <math.h>
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

int maxtime(int x)
{
    return (x+9)/10*10;
}

int remtime(int x)
{
    return maxtime(x) - x;
}

int main()
{
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int sum = maxtime(a) + maxtime(b) + maxtime(c) + maxtime(d) + maxtime(e);
    sum -= max({remtime(a), remtime(b), remtime(c), remtime(d), remtime(e)});
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    string s1,s2;
    cin>>s;
    int n=s.length();
    for(int i=0;i<n;i++){
        s1.push_back((i%2)+48);
    }
    for(int i=0;i<n;i++){
        s2.push_back(((i+1)%2)+48);
    }
    int cnt1=0,cnt2=0;
    for(int i=0;i<n;i++){
        if(s[i]!=s1[i])cnt1++;
    }
    for(int i=0;i<n;i++){
        if(s[i]!=s2[i])cnt2++;
    }
    cout<<min(cnt1,cnt2);
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

int dp[1010][1010];
string x, y;

int solve(int a, int b) {
    if (dp[a][b] >= 0) {
        return dp[a][b];
    }
    
    if (a * b == 0) {
        dp[a][b] = 0;
        return 0;
    }
    
    if (char(x[a - 1]) == char(y[b - 1])) dp[a][b] = solve(a - 1, b - 1) + 1;
    else dp[a][b] = solve(a - 1, b - 1);
    
    dp[a][b] = max(dp[a][b], max(solve(a - 1, b), solve(a, b - 1)));
    
    return dp[a][b];
}

int main(void){
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> x >> y;
        
        for (int i = 0; i <= x.size(); i++) {
            for (int j = 0; j <= y.size(); j++) dp[i][j] = -1;
        }
        dp[0][0] = 0;
        
        cout << solve(x.size(), y.size()) << endl;
    }
}



Measured memory_bytes: 7180
#include <bits/stdc++.h>
#define int long long int
#define ld long double
#define pb push_back
#define pf push_front
#define ft first
#define sc second
#define all(v) v.begin(), v.end()
using namespace std;
const int maxn = 201001, inf = 1e17;
int suf[maxn];
int dp[maxn][3];
signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<int> mas(2*n, 0);
    for (int d = 0; d < n; d++) {
        cin >> mas[d];
    }
    for (int d = n - 1; d >= 0; d--) {
        suf[d] = suf[d + 1] + mas[d];
        if (d > 0) {
            suf[d - 1] = suf[d];
            d--;
        }
    }
    if (n % 2 == 0) {
        int ans = suf[0];
        int sm = 0;
        for (int d = 0; d < n; d+=2) {
            sm += mas[d];
            ans = max(ans, sm + suf[d + 3]);
        }
        cout << ans;
        return 0;
    } else {
        for (int d = 0; d <= n + 5; d++) {
            dp[d][0] = -inf;
            dp[d][1] = -inf;
            dp[d][2] = -inf;
        }
        dp[0][0] = mas[0];
        dp[1][1] = mas[1];
        dp[2][2] = mas[2];
        for (int d = 0; d < n; d++) {
            if (d % 2 == 0) {
                dp[d + 1][0] = max(dp[d + 1][0], dp[d][0]);
                dp[d + 3][1] = max(dp[d + 3][1], dp[d][0] + mas[d + 3]);
                dp[d + 4][2] = max(dp[d + 4][2], dp[d][0] + mas[d + 4]);
            } else {
                dp[d + 1][0] = max(dp[d + 1][0], dp[d][0] + mas[d + 1]);
                dp[d + 2][1] = max(dp[d + 2][1], dp[d][0] + mas[d + 2]);
                dp[d + 3][2] = max(dp[d + 3][2], dp[d][0] + mas[d + 3]);
            }
            if (d % 2 == 1) {
                dp[d + 1][1] = max(dp[d + 1][1], dp[d][1]);
                dp[d + 3][2] = max(dp[d + 3][2], dp[d][1] + mas[d + 3]);
            } else {
                dp[d + 1][1] = max(dp[d + 1][1], dp[d][1] + mas[d + 1]);
                dp[d + 2][2] = max(dp[d + 2][2], dp[d][1] + mas[d + 2]);
            }
            if (d % 2 == 0) {
                dp[d + 1][2] = max(dp[d + 1][2], dp[d][2]);
            } else {
                dp[d + 1][2] = max(dp[d + 1][2], dp[d][2] + mas[d + 1]);
            }
        }
        int ans = dp[n - 2][0];
        ans = max(ans, dp[n - 1][1]);
        ans = max(ans, dp[n][2]);
        cout << ans;
    }
}


Measured memory_bytes: 12684
#include <bits/stdc++.h>
#include <time.h>
#include <assert.h>


using namespace std;



#define For(i,x,n)  for(long long i=x;i<n;i++)
#define rFor(i,x,n) for(long long i=x;i>=n;i--)
#define itFor(it,st)   for(auto it=st.begin() ; it!=st.end() ; it++)
#define MOD 1000000007
#define PI 3.141592653589793
#define INF 999999999999999999
#define N 1000005
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sp " "
#define cont continue
#define brk break

#define deb1(x)                cout<<#x<<": "<<x<<endl
#define deb2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define deb3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define deb4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define deb5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define deb6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

using namespace std;

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed;
    cout<<setprecision(3);
    srand(time(NULL));

    ll tt;
    // cin>>tt;
    tt=1;
    while(tt--){
        // deb1("s");
        ll x,y;
        cin>>x>>y;
        For(i,0,x+1){
            ll c1 = i*2;
            ll c2 = (x-i)*4;
            // deb2(c1,c2)
            if((c1+c2)==y){
                cout<<"Yes";
                return 0;
            }
        }
        cout<<"No";
    }    
    
    //cout<<"\nTime used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case
    return 0;
}

//s1.substr(1,3) - return 3 characters starting from position 1 as substring of string sz1. eg sz1="shreynumh" sz1.substr(2,5)="reyan"
//num = atoi(s.c_str()); //convert string s to integer num
//n.erase(i,std::string::npos); //erase i th position in string n , decreasing string size
//s.find(b)!= std::string::npos - finds string b in string a - true if found
//cout<<"Time used = "<<static_cast<double>(clock())/(CLOCKS_PER_SEC)<<"s"<<endl;  // - for checking time used for a test case                


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a<b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define pb  push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLr(obj) (obj).rbegin(), (obj).rend()
#define endl "\n"
#define F first
#define S second
#define EN cout<<endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;

ll gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
    ll n,ans=0;
    cin>>n;
    rep(i,n){
        rep(j,n){
            rep(k,n){
                ans+=gcd(gcd(i+1,j+1),k+1);
            }
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
template<typename T>
bool all_same(vector<T> v1,vector<T> v2){
    sort(ALL(v1));
    sort(ALL(v2),greater<T>());
    return v1 == v2;
}
 
// g++ -std=c++11 prac.cpp
ll Max=-1,Min=1e9+1;
 
int main(){
    ll x=0,y=0,n,m,k,l,r,w,sum1=0,sum2=0,ans=0;
    string s,t;
    bool f=true;
    map <int,int> a;
    cin >> n;
    rep(i,n){
        cin >> x;
        if (a.find(x) != a.end()){
            a.find(x)->second++;
        }
        else{
            a.insert(make_pair(x,1));
        }
    }
    for(auto i=a.begin();i!=a.end();i++){
        if(i->first > i->second){
            ans += i->second;
        }
        else{
            ans += i->second - i->first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
 
using namespace std;
 
//const int MOD=1e9+7;
 
const int MOD=998244353;

long long modpow(long long x, long long n, long long m) {
    if (n == 0) return 1%m;
    long long u = modpow(x,n/2,m);
    u = (u*u)%m;
    if (n%2 == 1) u = (u*x)%m;
    return u;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;
    
    vector<long long> w(1000001), ct(1000001), sum(1000001);
    for(int i=0; i<n; i++){
        int x;
        cin>>x;
        ct[x]++;
    }
    
    for(int i=1; i<=1000000; i++){
        w[i]+=modpow(i,MOD-2,MOD);
        w[i]%=MOD;
        for(int j=2*i; j<=1000000; j+=i){
            w[j]-=w[i];
            w[j]%=MOD;
            if(w[j]<0) w[j]+=MOD;
        }
    }
    
    for(int i=1; i<=1000000; i++){
        long long tot=0;
        for(int j=i; j<=1000000; j+=i){
            tot+=ct[j]*j;
            tot%=MOD;
        }
        
        for(long long j=i; j<=1000000; j+=i){
            long long mult=ct[j]*j;
            mult%=MOD;
            long long jsq=j*j;
            jsq%=MOD;
            long long ctc2= ct[j]*(ct[j]-1)/2;
            ctc2%=MOD;
            
            sum[i]+=jsq*ctc2;
            sum[i]%=MOD;
            tot-=mult;
            tot%=MOD;
            if(tot<0) tot+=MOD;
            sum[i]+=mult*tot;
            sum[i]%=MOD;
        }
        
    }
    long long ans=0;
    for(int i=1; i<=1000000; i++){
        ans+=w[i]*sum[i];
        ans%=MOD;
    }
    cout<<ans;
    
    return 0;
}


Measured memory_bytes: 23680
h1, m1, h2, m2, k = map(int, input().split())


if m1 > m2:
    h = h2 - h1 - 1
    m = 60 - m1 + m2
else:
    h = h2 - h1
    m = m2 - m1

if k > h*60 + m:
    print(0)
else:
    print(h*60 + m - k)


Measured memory_bytes: 9176
#include <iostream>
#include <string>
int main()//170a
{
    int inN[5];

    // インプット
    std::cin >> inN[0] >> inN[1] >> inN[2] >> inN[3] >> inN[4];
    for (int i = 0;i < 5; i++)
    {
        if (inN[i] == 0)
        {
            std::cout << (i+1);

        }
    }


}

Measured memory_bytes: 3608
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(read())

alphabets = [chr(ord('a') + x) for x in range(26)]

def dfs(S, i):
    if len(S) == N:
        yield ''.join(S)
        return
    for j in range(i):
        for w in dfs(S + [alphabets[j]], i):
            yield w
    for w in dfs(S + [alphabets[i]], i + 1):
        yield w

for w in dfs([],0):
    print(w)

Measured memory_bytes: 4340
n=gets.to_i

h=Hash.new(0)
n.times do
  h[gets.chomp]+=1
end

prev=nil
h.to_a.sort {|a, b| (a[1] <=> b[1]).nonzero? || (b[0] <=> a[0])}.reverse.each do |a,b|
  prev = b if prev == nil

  break if b != prev

  puts a
end
 

Measured memory_bytes: 38132
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
int main(void)
{
    ll N, i, A[100001], B[100001], C[100001], ans=0;

    cin >> N;

    for(i=1; i<=N; i++){
        cin >> A[i] >> B[i];
    }

    for(i=N; i>=1; i--){
        A[i] += ans;
        
        if(A[i]<B[i]){
            if(A[i]==0) C[i] = 0;
            else C[i] = B[i]-A[i];
        }
        else if(A[i]%B[i]==0){
            C[i] = 0;
        }
        else{
            C[i] = B[i]*(A[i]/B[i]+1)-A[i];
        }

        ans += C[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <cassert>
using namespace std;
using i64 = int64_t;
constexpr i64 mod = 1e9 + 7;
using vi = vector<i64>;
using vvi = vector<vi>;
using ii = pair<i64, i64>;
using vii = vector<ii>;

int a, b, c;

int main() {
    string s;
    cin >> s;
    
    for (char k: s) {
        if (k == 'a') a++;
        else if (k == 'b') b++;
        else c++;
    }
    
    if (max({a, b, c}) - min({a, b, c}) <= 1) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


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

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

int main()
{
	int a, b;
	cin >> a >> b;

	if(a+b >= 10) cout << "error" << "\n";
	else cout << a+b << "\n";

	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
S=[input().split() for i in range(M)]

a=True
c=True
for j in range(M):
    if c==True:
        for i in range(M):
            if S[i][0]==S[j][0]:
                if S[i][1]!=S[j][1]:
                    print(-1)
                    a=False
                    c=False
                    break

if N>=2:
    if a==True:
        for i in range(M):
            if S[i][0]=="2":
                a2=S[i][1]
            if S[i][0]=="3":
                a3=S[i][1]
        for i in range(M):
            if S[i][0]=="1":
                if int(S[i][1])>=1:
                    a1=S[i][1]
                else:
                    print(-1)
                    a=False
                    break

if N==1:
    if a==True:
        for i in range(M):
            if S[i][0]=="1":
                    a1=S[i][1]

if N==1 and a==True and M!=0:
    print(a1)
if N==1 and a==True and M==0:
    print(0)

if N==2 and a==True:
    b=False
    if b==False:
        try:
            print(a1,a2,sep="")
            b=True
        except:
            None
        if b==False:
            try:
                print(a1,0,sep="")
                b=True
            except:
                None
            if b==False:
                try:
                    print(1,a2,sep="")
                    b=True
                except:
                    None
                if b==False:
                    print(1,0,sep="")
            


if N==3 and a==True:
    b=False
    if b==False:
        try:
            print(a1,a2,a3,sep="")
            b=True
        except:
            None
        if b==False:
            try:
                print(a1,a2,0,sep="")
                b=True
            except:
                None
            if b==False:
                try:
                    print(a1,0,a3,sep="")
                    b=True
                except:
                    None
                if b==False:
                    try:
                        print(1,a2,a3,sep="")
                        b=True
                    except:
                        None
                    if b==False:
                        try:
                            print(a1,0,0,sep="")
                            b=True
                        except:
                            None
                        if b==False:
                            try:
                                print(1,a2,0,sep="")
                                b=True
                            except:
                                None
                            if b==False:
                                try:
                                    print(1,0,a3,sep="")
                                    b=True
                                except:
                                    None
                                if b==False:
                                    print(1,0,0,sep="")

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;

void displayGraph (vector<vector<pair<int, int> > > graph) {
    for(unsigned i=0; i<graph.size(); i++) {
        cout << i << ": ";
        for (unsigned j=0; j<graph[i].size(); j++) {
            cout << graph[i][j].second << "(" << graph[i][j].first << "), ";
        }
        cout << endl;
    }
}

typedef pair<int, int> P;

int main () {
    unsigned V, E, r;
    cin >> V >> E >> r;
    vector<vector<pair<int, int> > > graph;

    // Fill up Vertices
    for(unsigned i=0; i<V; i++) {
        graph.push_back(vector<pair<int, int> >());
    }

    // Fill up Edges
    for (unsigned i=0; i<E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        graph[s].push_back(pair<int, int>(d, t));
        cin.ignore();
    }

    // Debug
    // displayGraph(graph);

    // Djikstra
    map<int, int> distances;
    priority_queue<P, vector<P>, greater<P> > q;
    q.push(pair<int, int>(0, r));
    while(distances.size() != V && q.size() != 0) {
        // Get smallest point/distance
        pair<int, int> p = q.top();
        q.pop();
        int prevDistance = p.first;
        int prevVertice = p.second;
        if (distances.find(prevVertice) == distances.end()) {
            // Insert shorttest distance for prevVertice
            distances[prevVertice] = prevDistance;

            vector<pair<int, int> > neighbour = graph[prevVertice];
            for(unsigned i=0; i<neighbour.size(); i++) {
                int totalDistance = prevDistance + neighbour[i].first;
                q.push(pair<int, int>(totalDistance, neighbour[i].second));
            }
        }
    }

    // Print distance
    for(unsigned i=0; i<V; i++) {
        if (distances.find(i) == distances.end()) {
            cout << "INF" << endl;
        } else {
            cout << distances[i] << endl;
        }
    }
}



Measured memory_bytes: 18000
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator << (std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll P, Q, R;
  std::cin >> P >> Q >> R;

  ll ans = minimum(P+Q, Q+R, R+P);
  print(ans);

  return 0;
}


Measured memory_bytes: 384
n = int(input())
x = [0] + list(map(int, input().split()))
y = [0] + list(map(int, input().split()))
tmp = [[0 for i in range(3)] for j in range(n+1)]
max = 0
for i in range(1, n+1, 1):
    absDiff = abs(x[i]-y[i])
    absDiff2 = absDiff * absDiff
    absDiff3 = absDiff2 * absDiff
    tmp[i][0] += tmp[i-1][0] + absDiff
    tmp[i][1] += tmp[i-1][1] + absDiff2
    tmp[i][2] += tmp[i-1][2] + absDiff3
    if absDiff > max:
        max = absDiff
print(tmp[n][0])
print(tmp[n][1] ** (1/2))
print(tmp[n][2] ** (1/3))
print(max)

Measured memory_bytes: 7844
#include<iostream>

using namespace std;

int main(void)
{
  int d,t,s; cin>>d>>t>>s;
  unsigned long int dd=t*s;
  
  if(d<=dd){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  
  return 0;
}

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

using namespace std;

int main(){
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int i=0, j=s.length()-1;
	int ans;
	while(s[i] != 'A') i++;
	while(s[j] != 'Z') j--;
	ans = j-i+1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 720
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

using namespace std;

const ll NM = 202000;

ll dp[NM][3][2];

int main(){
	int n; cin >> n;
	vector<ll> da(n);
	rip(i,n,0) cin >> da[i];
	rip(i,6,0) dp[0][i%3][i/2] = LLONG_MIN/2;
	dp[0][1][0] = 0;
	rip(i,n,0){
		if((i+1)&1){
			dp[i+1][2][1] = da[i] + dp[i][1][0];
			dp[i+1][1][1] = da[i] + dp[i][0][0];
			dp[i+1][0][1] = LLONG_MIN/2;
			dp[i+1][2][0] = max(dp[i][2][0], dp[i][2][1]);
			dp[i+1][1][0] = max(dp[i][1][0], dp[i][1][1]);
			dp[i+1][0][0] = max(dp[i][0][0], dp[i][0][1]);
		}
		else{
			dp[i+1][2][1] = da[i] + dp[i][2][0];
			dp[i+1][1][1] = da[i] + dp[i][1][0];
			dp[i+1][0][1] = da[i] + dp[i][0][0];
			dp[i+1][2][0] = LLONG_MIN/2;
			dp[i+1][1][0] = max(dp[i][2][0], dp[i][2][1]);
			dp[i+1][0][0] = max(dp[i][1][0], dp[i][1][1]);
 		}
	}
	cout << max(dp[n][1][0], dp[n][1][1]) << endl;
}

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

int main() {
	int n, a[100];

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		if (i != 0)
			cout << " ";

			cout << a[n - i - 1];
	}
	cout << endl;
	return 0;

}

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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n, 1000));
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int j = 0; j < n; j++) {
            if (s[j] == '1') {
                a[i][j] = 1;
            }
        }
        a[i][i] = 0;
    }
    vector<int> c(n, -1);
    c[0] = 0;
    bool ok = true;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                if (a[j][k] == 1) {
                    if (c[j] != -1) {
                        if (c[k] == c[j]) {
                            ok = false;
                        }
                        c[k] = 1 - c[j];
                    }
                }
            }
        }
    }
    if (!ok) {
        cout << -1;
        return 0;
    }

    vector<vector<int>> d = a;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
    int mx = 0;
    for (int i = 0;i < n; i++) {
        for (int j = 0; j < n; j++) {
//            cout << i << " " << j << " " << d[i][j] << "\n";
            mx = max(mx, d[i][j]);
        }
    }
    cout << mx + 1;

    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    string s; cin >> s;
    int ans = 0;
    FOR(i,1,N){
        string X = s.substr(0,i), Y = s.substr(i);
        vector<pair<bool,bool>> used(26,MP(false,false));
        for(char c : X) used[c-'a'].first = true;
        for(char c : Y) used[c-'a'].second = true;
        int tmp = 0;
        REP(j,26) if(used[j].first && used[j].second) tmp++;
        chmax(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// यथा चतुर्भिः कनकं परीक्ष्यते निघर्षणच्छेदनतापताडनैः।
// तथा चतुर्भिः पुरुषः परीक्ष्यते त्यागेन शीलेन गुणेन कर्मणा॥
#include <bits/stdc++.h>
using namespace std;
#define lld long long int
#define M 1000000007
#define fors(i,n) for(int i=0;i<n;++i)
#define fore(i,a,b) for(int i=a;i<=b;++i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vv std::vector<int>
#define mapii std::map<int,int>
#define mpaci std::map<char,int>
#define umapii std::unordered_map<int,int>
#define umapci std::unordered_map<char,int>
#define seti std::set<int>
#define useti std::unordered_set<int>
#define qi std::queue<int>
#define qc std::queue<char>
#define sti std::stack<int>
#define stc std::stack<char>
#define endl "\n"
#define test(i) cout<<i<<endl
#define tests(i) cout<<"i: "<<i<<endl;
#define itrt int t; cin>>t; fors(i,t)
#define itr1 int t; cin>>t;
#define ff first
#define ss second
#define pb push_back
#define vmp make_pair
#define ppb pop_back
#define sorta(a,n) sort(arr,arr+n)
#define sortv(x) sort(x.begin(),x.end())
#define all(x) x.begin(),x.end() 
#define printv(v) for(auto x: v){ cout<< x << " ";}
#define pi 3.141592653589793238
void file(){
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}
bool sortdesk(const pair<int,int> &a, const pair<int,int> &b){return a.ff>b.ff;}
bool sortdesv(const pair<int,int> &a, const pair<int,int> &b){return a.ss>b.ss;}
bool sortascv(const pair<int,int> &a, const pair<int,int> &b){return a.ss<b.ss;}
bool sortasck(const pair<int,int> &a, const pair<int,int> &b){return a.ff<b.ff;}
bool is_prime(int n){if(n==1){return false;}int i=2;while(i*i<=n){if(n%i==0){return false;}i+=1;}return true;}
int gcd(int a, int b){if (b == 0){return a;} return gcd(b, a % b);}
int cntdiv(int n){int cnt=0;for(int i=1;i<=sqrt(n);++i){if(n%i==0){if(n/i==i)++cnt;else{cnt = cnt + 2;}}}return cnt;}
lld posnegmod(lld x,lld mod){return (x%mod+mod)%mod;}
// lld fact(lld n);
// lld nCr(lld n,lld r){return fact(n) / (fact(r) * fact(n - r));}
// lld fact(lld n){ lld res = 1; for(lld i = 2; i <= n; i++){res = res * i;}return res;} 
// const int maxi = 1e6+10;
// vector<int> v[maxi];
// long long a[maxi];
// void dfs(int x,int y){
//     a[x]+=a[y];
//     for(int i:v[x]){
//         if(i!=y){
//             dfs(i,x);
//         }
//     }
// }

// void dfs(int arr[][],int i,int j){
//     if(i<0 || j<0){
//         return;
//     }
//     else{
//         if()
//     }
// }
void test_case(){
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    int cnt=0;
    while(a>=b){
        ++cnt;
        b=b*2;
    }
    while(b>=c){
        ++cnt;
        c=c*2;
    }
    if(cnt<=k){
        cout<<"Yes";
        return;
    }
    cout<<"No";
}

int main(){
    fastio;
    file();
    // pre();
    int T=1;
    // int T;
    // cin>>T;
    for(int nr=1;nr<=T;++nr) {
        // cout<<"Case #"<<nr<<": ";
        test_case();
    }
}

Measured memory_bytes: 3668
#include <stdio.h>
#include<math.h>
int main()
{
    double a,b,c,d,e,f,g,h;
    scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
    e=a-c;
    f=b-d;
    g=e*e+f*f;
    h=sqrt(g);
    printf("%.8lf",h);
 
  return 0;
}


Measured memory_bytes: 2104