akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

using namespace std;

int main(){
  int a,b,c,d,e,k;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> d;
  cin >> e;
  
  cin >> k;
  
  int flag = 0;
  if((e-a) > k){
    flag =1;
  }
  else if((e-b) > k){
    flag=1;
  }
  else if((e-c) > k){
    flag=1;
  }
  else if((e-d) > k){
    flag=1; 
  }
  if(flag==0){
    cout << "Yay!" << endl;
  }
  else{
    cout << ":(" << endl;
  }
}
    
  

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;



//Combination MOD
const ll MOD = INF + 7;

int main(){
    ll d, n;
    cin >> d >> n;

    vector<ll> list;
    REP(i, 1, n + 1){
        if(i % 100 == 0)continue;
        ll a = pow(100, d) * i;
        list.push_back(a);
    }
    cout << list[n - 1] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[110000], b[110000], c[110000], d[110000], n;

void funca(ll x, ll y){
    if (x == n) {
        return;
    } else if (b[x] < c[y] || y == n) {
        d[x] = n - y;
        funca(x + 1, y);
    } else {
        funca(x, y + 1);
    }
}
ll funcb(ll x, ll y){
    if (x == n) {
        return 0;
    } else if (a[y] >= b[x] || y == n) {
        return d[x] * y + funcb(x + 1, y);
    } else {
        return funcb(x, y + 1);
    }
}

int main(void){
    // Your code here!
    cin >> n;
    for (ll i = 0; i < n; i++) cin >> a[i];
    for (ll i = 0; i < n; i++) cin >> b[i];
    for (ll i = 0; i < n; i++) cin >> c[i];
    sort(a, a + n);
    sort(b, b + n);
    sort(c, c + n);
    funca(0, 0);
    cout << funcb(0, 0) << endl;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int H, W;
string a[102];
int main() {
    cin >> H >> W;
    rep(i, H) cin >> a[i];
    rep(i, W + 2) cout << "#";
    cout << endl;
    rep(i, H) {
        cout << "#";
        cout << a[i];
        cout << "#" << endl;;
    }
    rep(i, W + 2) cout << "#";
    cout << endl;


    return 0;
}


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

using namespace std;

int main()
{
    int h , w;
    cin >> h >> w;
    while(h--){
        string x;
        cin >> x;
        int n = 2;
        while(n--){
            cout << x << "\n";;
        }
    }

    return 0;
}


Measured memory_bytes: 256
import copy

def calc(T):
    res = 0
    L = [0]*26
    for i in range(D):
        res += S[i][T[i]-1]
        L[T[i]-1] = i+1
        for j in range(26):
            res -= C[j]*(i+1-L[j])
    return res
    
D = int(input())
C = [int(c) for c in input().split()]
S = [[int(s) for s in input().split()] for _ in range(D)]

T = [0]*D
L = [0]*26
for i in range(D):
    p = -10**12
    for j in range(26):
        d = S[i][j]
        for k in range(26):
            if k == j:
                continue
            d -= C[k]*(i+1-L[k])
        if p < d:
            p = d
            idx = j+1
    T[i] = idx
        

p = calc(T)
            
for i in range(D):
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp
for i in range(D-1, -1, -1):
    for j in range(26):
        temp = copy.deepcopy(T)
        temp[i] = j+1
        newp = calc(temp)
        if p < newp:
            T[i] = j+1
            p = newp

for t in T:
    print(t)

Measured memory_bytes: 75104
#include <bits/stdc++.h>
#define mp make_pair
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 30) - 1LL;
const ll LINF = (1LL << 60) - 1LL;
const double eps = 1e-9;
const ll MOD = 10007LL;
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);
};
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int main() {
    vector<int> a(5);
    for(int i = 0; i < 5; i++) {
        cin >> a[i];
    }
    vector<int> b{0, 1, 2, 3, 4};
    int ans = INF;
    do {
        int t = 0;
        for(int i = 0; i < 5; i++) {
            int id = b[i];
            if(t % 10)
                t = t + (10 - t % 10);
            t += a[id];
        }
        chmin(ans, t);
    } while(next_permutation(all(b)));
    cout << ans << endl;
}


Measured memory_bytes: 256
while True:
    try:
        n = float(input())
        ans = 1
        v = 0
        while v < n:
            ans += 1
            y = ans * 5 - 5
            t = (y / 4.9) ** 0.5
            v = 9.8 * t
        print(ans)
    except:
        break

Measured memory_bytes: 6800
#!/usr/bin/env python3

def countb(h, w, mskh, mskw, s):
    ret=0
    for i in range(w):
        for j in range(h):
            if (2**i)&mskw == 0 and (2**j)&mskh == 0:
                ret += 1 if s[j][i] == "#" else 0
    return ret

def main(h,w,k,s):
    ans=0
    for i in range(2**w):
        for j in range(2**h):
            ans += 1 if countb(h, w, j, i, s)==k else 0

    print(ans)
    return

if __name__ == '__main__':
    h,w,k=map(int, input().split())
    s=[]
    for i in range(h):
          s.append(input())
    main(h,w,k,s)


Measured memory_bytes: 9212
#include<stdio.h>
int min(int a,int b){if(a<b) return a;return b;}
int main(){
    int A,B,m,i,j;
    scanf("%d%d%d",&A,&B,&m);
    int a[A],b[B],x[m],y[m],c[m];
    for(i=0;i<A;i++) scanf("%d",&a[i]);
    for(i=0;i<B;i++) scanf("%d",&b[i]);
    for(i=0;i<m;i++) scanf("%d%d%d",&x[i],&y[i],&c[i]);
    int mina=a[0],minb=b[0];
    for(i=0;i<A;i++) if(mina>a[i]) mina=a[i];
    for(i=0;i<B;i++) if(minb>b[i]) minb=b[i];
    int ans=mina+minb;
    for(i=0;i<m;i++)
        ans=min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
    printf("%d\n",ans);
    return 0;
}

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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define repp(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const lint MOD   = 1e9 + 7;
const double EPS = 1e-10;

int main() {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<vector<int>> sum_of_train_ij(N, vector<int>(N, 0));
    rep(i, M) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        sum_of_train_ij[l][r] += 1;
    }

    // 累積和の計算
    vector<vector<int>> L(N, vector<int>(N + 1, 0));
    for (int left = 0; left < N; left++) {
        for (int i = 0; i < N; i++) {
            L[left][i + 1] = L[left][i] + sum_of_train_ij[left][i];
        }
    }

    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        l--, r--;
        int ans = 0;
        for (int left = l; left <= r; left++) {
            ans += L[left][r + 1] - L[l][l];
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2944
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(int i = a; i < n; ++i)
#define pb push_back
#define mp make_pair
#define f first
#define s second

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <set>
#include <ostream>
#include <queue>
#include <functional>
#include <sstream>
#include <map>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<pair<ll, ll>, ll> pll;
#pragma comment(linker, "/STACK:228228000")


ll res = 228228, n;

ll fun(ll a)
{
	ll sum = 0;
	while (a > 0)
	{
		sum += a % 10;
		a /= 10;
	}
	return sum;
}

int main()
{
	/*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/ 
	cin >> n;
	forn(i, 1, n)
	{
		res = min(res, fun(n - i) + fun(i));
	}
	cout << res;
	//cin >> n;
	return 0;
}

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

bool isPrime(int x) {
	for(int i=2 ; i * i <= x ; i++ ) {
		if( x % i == 0 ) return false;
	}
	return true;
}

bool isGaussianPrime(int a, int b) {
	if (a < 0) a = -a;
	if (b < 0) b = -b;
	if (a == 0) return b % 4 == 3 && isPrime(b);
	if (b == 0) return a % 4 == 3 && isPrime(a);
	return isPrime(a*a + b*b);
}

int main(){
	int n;
	cin >> n;
	for(int t=0 ; t < n ; t++ ){
		int a, b;
		cin >> a >> b;
		cout << (isGaussianPrime(a, b)? "P" : "C") << endl;
	}
}

Measured memory_bytes: 1152
#include<stdio.h>
#define MAX 1000001

int main(void)
{
  int a, d, n, sum,  count, k=0, p=0;
  int ans[500];
  int i, j, x[MAX];

  for(i=2; i<MAX; i++){
    x[i]=1;
  }
  for(i=2; i<1001; i++){
    if(x[i]==1){
      for(j=i*i; j<MAX; j+=i){ //?´???°??§??????????????°??????
//	if(j%i==0){
	  x[j]=0;
//	}
      }
    }
  }
  x[2]=1;
  while(1){
    scanf(" %d %d %d", &a, &d, &n);
    if(a==0&&d==0&&n==0){
      for(k=0; k<p; k++){
	printf("%d\n", ans[k]);
      }
      return 0;
    }
    else{
      sum=a;
      count=0;

      while(1){
	if(x[sum]==1){
	  count++;
	  if(count==n){
	    ans[p]=sum;
	    p++;
	    break;
	  }
	}
	sum+=d;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 4504
#include<bits/stdc++.h>
#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() {
    int h,w,k;
    cin >> h >> w >> k;
    vector<string> c(h);
    int ans = 0;
    rep(i,h) cin >> c[i];
    rep(i0,1<<h) {
        rep(j0,1<<w) {
            int count=0;
            rep(i1,h) {
                rep(j1,w) {
                    if (i0 & 1<<i1) continue;
                    if (j0 & 1<<j1) continue;
                    if (c[i1][j1] == '#') count++;
                }
            }
            if (count == k) ans++;
        }
    } 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
N = int(input())
H = [int(i) for i in input().split()]

ans = 0

count = N - 1
for i in reversed(H):
    flag = 0
    for j in reversed(H[0:count]):
        if i < j:
            flag = 1
            break
    if flag == 0:
        ans += 1
    count -= 1
print(ans)

Measured memory_bytes: 3188
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    ans = 0
    while all([aa%2 == 0 for aa in a]):
        ans += 1
        a = [aa//2 for aa in a]
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const long long Mod=1000000007ll,Mul2[3][3]={{1,2,1},{0,1,1},{0,0,1}};
long long MMul[39][3][3]={{{1,2,1},{0,1,1},{1,2,2}}};
long long n,m,a[100090],mat[3]={1,0,0};

int main()
{
	for(int i=0;i<30;i++)
		for(int j=0;j<3;j++)
		for(int k=0;k<3;k++)
		for(int l=0;l<3;l++)
			MMul[i+1][j][k]=(MMul[i+1][j][k]+MMul[i][j][l]*MMul[i][l][k])%Mod;
	cin>>n>>m; a[m+1]=-1;
	do{
		if(m) cin>>a[m];
		else a[m]=n;
		long long k=a[m]-a[m+1]-1,_mat[3]={0,0,0};
		for(int i=0;i<30;i++) if(k&(1<<i))
		{
			for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)
				_mat[j]=(_mat[j]+mat[k]*MMul[i][k][j])%Mod;
			for(int j=0;j<3;j++) mat[j]=_mat[j],_mat[j]=0;
		}
		if(m)
		{
			for(int j=0;j<3;j++)
			for(int k=0;k<3;k++)
				_mat[j]=(_mat[j]+mat[k]*Mul2[k][j])%Mod;
			for(int j=0;j<3;j++) mat[j]=_mat[j];
		}
//		printf("[%d %d %d]\n",mat[0],mat[1],mat[2]);
	}while(m--);
	cout<<mat[2];
}

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

int main()
{
int N;scanf("%d",&N);double ans=0.000000;
vector<int> v(N);
for(int i=0;i<N;i++)scanf("%d ",&v[i]);
sort(v.begin(),v.end());ans=v[0];
for(int i=1;i<N;i++)ans=(ans+v[i])/2.00000;
printf("%f\n",ans);
}

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

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

bool isprime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

int main() {
	int n;
	while (cin >> n && n) {
		int sum = 0;
		rep(i, n) {
			int x = n + i + 1;
			sum += isprime(x);
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3052
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 100010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll dp[110][N];

int main()
{
    FIO;
    ll n,w,wt,val,i,j,mx;
    cin>>n>>w>>wt>>val;
    dp[1][wt]=val;
    for(i=2;i<=n;i++)
    {
        cin>>wt>>val;
        fr(j,w) dp[i][j]=dp[i-1][j];
        for(j=wt;j<=w;j++)
            dp[i][j]=max(dp[i][j], dp[i-1][j-wt]+val);
    }
    mx=0;
    fr(i,w) mx=max(mx, dp[n][i]);
    cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 78592
using System;

namespace B_002_59
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            new Logic_A().Start();
            Console.ReadLine();
        }

        public class Logic_A
        {
            public void Start()
            {
                var str = Console.ReadLine().Split(' ');
                var a = str[0];
                var b = str[1];
                var c = str[2];

                Console.WriteLine(a.ToUpper()[0].ToString() + b.ToUpper()[0] + c.ToUpper()[0]);
            }
        }
    }
}

Measured memory_bytes: 13140
from collections import Counter
 
N, M, K = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
CD = [list(map(int, input().split())) for _ in range(K)]
 
friend_g = [set() for i in range(N)]
for a, b in AB:
    a, b = a-1, b-1
    friend_g[a].add(b)
    friend_g[b].add(a)
friend_count = [len(s) for s in friend_g]
 
g_nums = [-1]*N
current_g_num = 0
for i in range(N):
    if g_nums[i] == -1:
        g_nums[i] = current_g_num
        q = [i]
        while q:
            t = q.pop()
            for friend in friend_g[t]:
                if g_nums[friend] == -1:
                    g_nums[friend] = current_g_num
                    q.append(friend)
                # print(i, t, g_nums)
        current_g_num += 1
 
block_count = [0]*N
for c, d in CD:
    c, d = c-1, d-1
    if g_nums[c] == g_nums[d]:
        block_count[c] += 1
        block_count[d] += 1
 
g_nums_counter = Counter(g_nums)
print(*(g_nums_counter[g_nums[i]] - friend_count[i] - block_count[i] - 1 for i in range(N)))

Measured memory_bytes: 103640
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    ll n;
    cin >> n;
    ll a[n]={};
    rep(i,n)cin >> a[i];
    sort(a,a+n);
    ll x,y=0;
    x = a[n-1];
    rep(i,n-1){
        if(y<min(a[i],a[n-1]-a[i]))y=a[i];
        DEBUG{cout << a[i] << endl;cout << y << endl;}

    }
    cout << x << " " << y << endl;
    return 0;
}


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

int main() {
    string s;
    int count;

    cin >> s;

    for (int i = 0; i <= 3; i++) {
        if (s[i] == '+') {
            count++;
        } else if (s[i] == '-') {
            count--;
        }

    }

    cout << count;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x = (from); x < (to); ++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string s;
	while(cin >> s) {
		char r = 'd';
		rep(i,3) {
			char c = s[i * 3];
			if(c == 's') continue;
			bool f = 1;
			rep2(j,1,3) {
				if(s[i * 3 + j] != c) f = 0;
			}
			if(f) {
				r = c;
				break;
			}
		}
		rep(i,3) {
			char c = s[i];
			if(c == 's') continue;
			bool f = 1;
			rep2(j,1,3) {
				if(s[j * 3 + i] != c) f = 0;
			}
			if(f) {
				r = c;
				break;
			}
		}		
		char c = s[4];
		if(c != 's' && s[0] == c && c == s[8]) r = c;
		else if(c != 's' && s[2] == c && c == s[6]) r = c;
		
		cout << r << endl;
	}
	return 0;
}

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

int main() {
  int r;
  cin >> r;
  cout << 3*r*r << endl;
  return 0;
}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    set<string> s;
    for (int i = 0; i < n; ++i) {
        string line;
        cin >> line;
        s.insert(line);
    }
    cout << s.size() << "\n";
    return 0;
}

Measured memory_bytes: 19256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Main
 */
public class Main {

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

        int N = sc.nextInt();
        String[] S = new String[N];
        Map<String, Integer> Keihin = new HashMap<String, Integer>();

        for(int i = 0; i < N; i++){
            S[i] = sc.next();
            Keihin.put(S[i],i);
        }
        System.out.println(Keihin.size());

    }
}

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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair

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

int main(){
	int n;
	cin >> n;
	int a[n];
	FOR(i,n) cin >> a[i];
	int sol[n];
	sol[n-1]=0;
	sol[n-2]=abs(a[n-2]-a[n-1]);
	for (int i = n-3; i > -1; --i)
	{
		sol[i]=min(sol[i+1]+abs(a[i+1]-a[i]), sol[i+2] + abs(a[i+2]-a[i]));
	}
	cout << sol[0];

	return 0;
}

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

#define ll long long
const int mod = 1e9 + 7;
string s;
string t;
const int N = 3001;
int dp[N][N];
int LCS(int l1, int l2){
	if(l1==0 || l2==0){
		return dp[l1][l2] = 0;
	}
	if(dp[l1][l2] != -1){
		return dp[l1][l2];
	}

	if(s[l1-1]==t[l2-1]){
		return dp[l1][l2] = 1 + LCS(l1-1,l2-1);
	}
	else{
		return dp[l1][l2] = max(LCS(l1-1,l2), LCS(l1,l2-1));
	}

}
int main(){

	fastio;
	cin>>s>>t;
	memset(dp,-1,sizeof(dp));
	int l1 = s.length();
	int l2 = t.length();

	LCS(l1,l2);

	// for(int i=0;i<=l1;i++){
	// 	for(int j=0;j<=l2;j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }

	int a = l1, b = l2;
	string ans;
	while(a>0 and b>0){

		if(s[a-1]==t[b-1]){
			ans+=s[a-1];
			a--;
			b--;
		}	
		else{
			if(dp[a-1][b] > dp[a][b-1]){
				a--;
			}
			else{
				b--;
			}
		}

	}

	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;










	return 0;
}

Measured memory_bytes: 35968
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  int n,d[100];
  int top=0,ans=0;
  cin>>n;
  rep(i,n){
    cin>>d[i];
  }
  sort(d,d+n);
  rep(i,n){
    if(top<d[i]){
      top=d[i];
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}




Measured memory_bytes: 256
//            ____             ____
//           /@@@@\           |@@@@|      ____
//          /@@@@@@\          |@@@@|     |@@@@|
//         /@@@@@@@@\         |@@@@|   __|@@@@|___    ____       ____      ___  _________     ____        ____    ____________      ___  _________     ____         ____
//        /@@@@/\@@@@\        |@@@@|   @@@@@@@@@@@   |@@@@|     |@@@@|    |@@@\/@@@@@@@@@\   (@@@@\      /@@@@)  /@@@@@@@@@@@@|    |@@@\/@@@@@@@@@\   (@@@@\       /@@@@)
//       /@@@@/  \@@@@\       |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|    \@@@@@|   \@@@@\    /@@@@/  |@@/     |@@@@|    |@@@@|    \@@@@@|   \@@@@\     /@@@@/
//      /@@@@(____)@@@@\      |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|    \@@@@\  /@@@@/            |@@@@|    |@@@@|     |@@@@|    \@@@@\   /@@@@/
//     /@@@@@@@@@@@@@@@@\     |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|     \@@@@\/@@@@/    /@@@@@@@@@@@@@|    |@@@@|     |@@@@|     \@@@@\ /@@@@/
//    /@@@@@@@@@@@@@@@@@@\    |@@@@|     |@@@@|___   |@@@@|____/@@@@@|    |@@@@|     |@@@@|      \@@@@@@@@/    (@@@@(   )@@@@@|    |@@@@|     |@@@@|      \@@@@|@@@@/
//   /@@@@/          \@@@@\   |@@@@|     |@@@@@@@@    \@@@@@@@@@@@@@@|    |@@@@|     |@@@@|       \@@@@@@/      \@@@@\_/@@@@@@|    |@@@@|     |@@@@|       \@@@@@@@/
//  /@@@@/            \@@@@\  |@@@@|      \@@@@@@/      \@@@@@/  \@@@|    |@@@@|     |@@@@|        )@@@@/        \@@@@@@@/\@@@|    |@@@@|     |@@@@|        \@@@@@/
//                                                                                                (@@@@/

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

using namespace std;
// using namespace __gnu_pbds;

//-----------------------------------------------
#define all(x)  x.begin(), x.end()
#define sz(x)   (int)x.size()
#define sq(x)   (x) * (x)
#define fr      first
#define sc      second
//-----------------------------------------------
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pli = pair<ll, int>;

const int N = 300 * 1000 + 5;
const ll mod = 1000000007;
const ll INF = 1000000 * 1ll * 10000000 * 1ll * 1000;
const ld pi = acosl(-1.0);

int n;

void input() {
    cin >> n;
}

void solve(int testId) {
    cout << (n >= 30 ? "Yes" : "No") << endl;
}

int main() {
    // freopen("test", "r", stdin);
    int testcases = 1;
    // scanf("%d", &testcases);
    for(int testId = 1; testId <= testcases; testId++) {
        input();
        solve(testId);
    }
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[][][] pl=new int[n][3][2];
		for(int i=0;i<n;i++){
			for(int j=0;j<3;j++){
				pl[i][j][0]=sc.nextInt();
				pl[i][j][1]=0;
			}
		}
		for(int h=0;h<3;h++){
			for(int i=0;i<n-1;i++){
				for(int j=i+1;j<n;j++){
					if(pl[i][h][0]==pl[j][h][0]){
						if(pl[i][h][1]==-1&&pl[j][h][1]==-1){
							break;
						}
						pl[i][h][1]=-1;
						pl[j][h][1]=-1;
					}
				}
			}
		}
		for(int i=0;i<n;i++){
			int tmp=0;
			for(int j=0;j<3;j++){
				if(pl[i][j][1]!=-1){
					tmp+=pl[i][j][0];
				}
			}
			System.out.println(tmp);
		}
	}
}

Measured memory_bytes: 21720
function main(input) {
  var args = input.split(/\s|\n/);
  for (var i = 0;i < 5;i++) {
   if (args[i] == '0') {
     console.log(i + 1);
     break;
   }
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;cin >> n;
    vector<bool> a(n+1);
    rep(i,n){
        int t;cin >> t;
        if(t) a[i+1] = true;
        else a[i+1] = false;
    }
    vector<bool> ans(n+1,false);
    for(int i=n;i>=1;i--){
        bool yes = false;
        for(int j=i;j<=n;j += i){
            if(ans[j]) yes = !yes;
        }
        if(a[i] + yes == 1){
            ans[i] = true;
        }
    }
    int m=0;
    rep(i,n+1){
        m += ans[i];
    }
    cout << m << endl;
    bool ok=false;
    rep(i,n+1){
        if(ans[i]){
            cout << i << " ";
            ok = true;
        }
    }
    cout << endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>

using namespace std;

int main(){
	int N;
	while(cin >> N){
		vector<double> vd, r(N);
		for(double& d : r) cin >> d;
		double res = 0.0;
		for(int i=0;i<N;i++){
			double d = r[i];
			for(int j=0;j<i;j++){
				double sum = r[i] + r[j];
				double dif = abs(r[i] - r[j]);
				d = max(d, vd[j] + sqrt(sum*sum - dif*dif));
			}
			vd.push_back(d);
			res = max(res, d + r[i]);
		}
		printf("%.10lf\n", res);
	}
}

Measured memory_bytes: 3360
# your code goes here
S = input()
T = input()

alphabet_S = [0]*27
alphabet_T = [0]*27
for i in range(len(S)):
	alphabet_S[ord(S[i])-ord('a')] += 1
	alphabet_T[ord(T[i])-ord('a')] += 1

alphabet_S.sort()
alphabet_T.sort()

if alphabet_S == alphabet_T:
	print('Yes')
else:
	print('No')

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

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

  int l = s.length();

  if (l > k) {
    cout << s.erase(k) << "...";
  } else {
    cout << s;
  }
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define ff first
#define ss second

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
   	int n;
  	cin >> n;
  	vector<pair<int, int>> a(n);
  	for (int i = 0; i < n; i++)
      	cin >> a[i].ff >> a[i].ss;
  	bool ans = false;
  	for (int i = 2; i < n; i++) {
    	if (a[i].ff != a[i].ss)
        	continue;
      	if (a[i - 1].ff != a[i - 1].ss)
          	continue;
      	if (a[i - 2].ff != a[i - 2].ss)
          	continue;
      	ans = true;
      	break;
    }
  	cout << (ans ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int n, m;
	cin >> n >> m;
	vector<vector<pair<int, long long>>> G(n);
	for (int i = 0; i < m; i++) {
		int l, r, d;
		cin >> l >> r >> d;
		G[l-1].push_back(make_pair(r-1, d));
		G[r-1].push_back(make_pair(l-1, -d));
	}

	long long number[n];
	bool visited[n];
	fill(visited, visited+n, false);
	set<int> todo;
	for (int i = 0; i < n; i++)
		todo.insert(i);
	queue<int> q;
	while (!todo.empty()) {
		q.push(*todo.begin());
		number[*todo.begin()] = 0;
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			if (visited[v])
				continue;
			todo.erase(v);
			visited[v] = true;
			for (auto& e : G[v]) {
				if (!visited[e.first]) {
					number[e.first] = number[v] + e.second;
					q.push(e.first);
				}
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (auto& e : G[i]) {
			if (number[i] + e.second != number[e.first]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 21228
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <bitset>
using namespace std;
typedef long long int lli;
int main(void)
{
    int N;
    cin >> N;
    int price = 0;
    if (N % 4 == 0 || N % 7 == 0)
    {
        cout << "Yes" << endl;
        return 0;
    }
    else
    {
        for (int i = 0; i <= 25; i++)
        {
            for (int j = 0; j <= 14; j++)
            {
                if (N == 4 * i + 7 * j)
                {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n;
  cin >> n;
  vector<int> x(n);
  rep (i, n) cin >> x[i];
  lint mini = LLONG_MAX;
  rep (p, 101) {
    lint sum = 0;
    rep (i, n) {
      sum += (x[i] - p) * (x[i] - p);
    }
    mini = min(mini, sum);
  }
  cout << mini << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[100005];int l,i;
int main(){
	scanf("%s",a);
	l=strlen(a);
	for(;i<l;i++)
		if(i%2==0)
			printf("%c",a[i]);
	printf("\n");
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int h,w; cin>>h>>w;
	vector<string>s(h); for(auto&&i:s)cin>>i;
	vector<vector<int>>u(h+2,vector<int>(w+2,0)),d(h+2,vector<int>(w+2,0)),
	l(h+2,vector<int>(w+2,0)),r(h+2,vector<int>(w+2,0));
	for(int i=0;i<h;++i){
		for(int j=0;j<w;++j){
			if(s.at(i).at(j)=='.'){
				u.at(i+1).at(j+1)=u.at(i).at(j+1);
				l.at(i+1).at(j+1)=l.at(i+1).at(j);
				++u.at(i+1).at(j+1);
				++l.at(i+1).at(j+1);
			}
			int y=abs(h-i),x=abs(w-j);
			if(s.at(y-1).at(x-1)=='.'){
				d.at(y).at(x)=d.at(y+1).at(x);
				r.at(y).at(x)=r.at(y).at(x+1);
				++d.at(y).at(x);
				++r.at(y).at(x);
			}
		}
	}
	int ans=0;
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			ans=max(ans,u.at(i).at(j)+l.at(i).at(j)+d.at(i).at(j)+r.at(i).at(j)-3);
		}
	}
	cout<<ans<<"\n"s;
}


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

int main() {
  ll N;
  cin >> N;
  ll ans = 1;
  vector<ll> v(N);
  ll LIM = 1000000000000000000;
  for (ll i = 0; i < N; i++) {
    cin >> v[i];
    if (v[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (ll i = 0; i < N; i++) {
    if (v[i] > LIM / ans) {
      cout << -1 << endl;
      return 0;
    }
    ans *= v[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4000
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_set = set(A)

A_dict = {x:0 for x in A_set}
for i in A:
    A_dict[i] += 1
A_dict = sorted(A_dict.items(), key=lambda x:x[1])

ans = 0
if len(A_set) > K:
    for i in range(len(A_set) - K):
        ans += A_dict[i][1]
        
print(ans)


Measured memory_bytes: 50228
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll> >
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 + 7;

int main()
{
	fast;
	ll n;
	cin>>n;
	map<ll,ll> p;
	for(ll i=0;i<n;i++)
	{
		ll x;
		cin>>x;
		if(p[x]==1)
		{
			cout<<"NO";
			return 0;
		}
		p[x]++;
	}
	cout<<"YES";
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

#ifdef DEBUG
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
#else
template <class T, class... Args>
void debug(const T &x, const Args &... args) {}
template <class T> void debugVector(const vector<T> &v) {}
#endif

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

struct Trie {
    const char base;
    struct Node {
        int child[26]; // 子の頂点番号 存在しなければ-1
        ll cnt[26];
        Node() {
            for(int i = 0; i < 26; i++) {
                child[i] = -1;
                cnt[i] = 0LL;
            }
        }
    };
    vector<Node> nodes;
    Trie(char base) : base(base) { nodes.emplace_back(Node()); }
    void insert(const string &s) {
        int now = 0;
        int n = (int)s.size();
        for(int i = 0; i < n - 1; i++) {
            int nxt = nodes[now].child[s[i] - base];
            if(nxt == -1) {
                nodes[now].child[s[i] - base] = (int)nodes.size();
                nxt = (int)nodes.size();
                nodes.emplace_back(Node());
            }
            now = nxt;
        }
        nodes[now].cnt[s.back() - base]++;
    }
    ll get(const string &s, vector<int> &exist) {
        ll res = 0;
        int now = 0;
        int n = (int)s.size();
        for(int i = 0; i < n; i++) {
            for(int k = 0; k < 26; k++) {
                if(exist[i] & (1 << k)) {
                    res += nodes[now].cnt[k];
                }
            }
            int nxt = nodes[now].child[s[i] - base];
            if(nxt == -1) {
                return res;
            }
            now = nxt;
        }
        return res;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> s(N);
    for(int i = 0; i < N; i++) {
        cin >> s[i];
        reverse(ALL(s[i]));
    }
    sort(ALL(s), [](const string &a, const string &b) {
        return (a.size() < b.size());
    });

    Trie trie('a');
    ll ans = 0;
    for(int i = 0; i < N; i++) {
        int n = (int)s[i].size();
        vector<int> exist(n + 1, 0);
        for(int j = n - 1; j >= 0; j--) {
            exist[j] = exist[j + 1] | (1 << (s[i][j] - 'a'));
        }
        ans += trie.get(s[i], exist);
        trie.insert(s[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 328868
package main
import . "fmt"
import . "os"
func main() {
  var n int
  var l []int
  l = []int{1,2,4,8,16,32,64,128}
  Scan(&n)
  for i:=0;i<7;i++ {
    if l[i] <= n && n < l[i+1] {
      Println(l[i])
      Exit(0)
    }
  }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#undef int
#define mk make_pair
#define pb push_back
typedef pair<int, int> pii;
const int mod = 1000000007;
const int INF = 1000000009;

int N;

signed main()
{
    cin >> N;
    int ans = 0;
    int n = N;
    while(n){
        if(n % 10 == 2){
            ans++;
        }
        n /= 10;
    }
    cout << ans << endl;

    return 0;
}

/*



*/


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

int main() {
  string s;
  cin >> s;
  if(s == "ARC"){
    cout << "ABC";
  }
  else{
    cout << "ARC";
  }
  
}


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

int main() {
  string s;
  cin >> s;
  bool ok = true;
  rep(i,s.size()) {
    if(s[i] == 'U' || s[i] == 'D') continue;
    if(i % 2 == 0) {
      if(s[i] != 'R') ok = false;
    }else{
      if(s[i] != 'L') ok = false;
    }
  }
  cout << (ok? "Yes":"No") << endl; 
  return 0;
}

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

namespace IO
{
	const int S=(1<<20)+5;
	char buf[S],*H,*T;
	inline char Get()
	{
		if(H==T) T=(H=buf)+fread(buf,1,S,stdin);
		if(H==T) return -1;return *H++;
	}
	inline int read()
	{
		int x=0;char c=Get();
		while(!isdigit(c)) c=Get();
		while(isdigit(c)) x=x*10+c-'0',c=Get();
		return x;
	}
	inline void reads(char *s)
	{
		char c=Get();int tot=0;
		while(c<'a'||c>'z') c=Get();
		while(c>='a'&&c<='z') s[++tot]=c,c=Get();
		s[++tot]='\0';
	}
}

inline void Falun_Dafa_is_good(const int &x){printf("%d\n",x);exit(0);}

const int N=1000010;
char S0[N],T[N];
int c[N];
vector<int> v[27];
deque<int> q;

int main()
{
	int n=IO::read(),tag=0,ans=0;
	IO::reads(S0);IO::reads(T);
	c[n+1]=n+1;
	if(strcmp(S0+1,T+1)==0) Falun_Dafa_is_good(0);
	if(n==1) Falun_Dafa_is_good(-1);
	for(int i=1;i<=n;i++) v[S0[i]-'a'].push_back(i);
    for(int i=n;i;i--)
    {
        if(T[i]==T[i+1]&&i>=c[i+1]){c[i]=c[i+1];continue;}
        else
        {
        	int x=T[i]-'a';
            while(!v[x].empty()&&v[x].back()>=c[i+1])
            {
                v[x].pop_back();
                if(v[x].empty()) Falun_Dafa_is_good(-1);
            }
            c[i]=v[x].back();
            if(i>=c[i+1])
            {
                tag++;
				q.push_front(c[i+1]-1+tag);
                while(q.back()-tag>=i) q.pop_back();
                q.push_back(i+tag);
            }
            else
			{
				while(!q.empty()) q.pop_back();
				if(c[i]<i) q.push_back(i+tag);
			}
            ans=max(ans,(int)q.size());
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 15624
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
long long gcd(long long a,long long b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int main() {
	int n;
	cin>>n;
	if(n>500)cout<<1;
	else cout<<9;
	if(n%100>50)cout<<1;
	else cout<<9;
	if(n%10>5)cout<<1;
	else cout<<9;
	return 0;
}


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

int main()
{
//    freopen("C.txt","r",stdin);

    int n,t;
    long long ans=0;

    scanf("%d%d",&n,&t);

    vector<int> a(n);

    for(int i = 0;i < n;i++)
    {
        scanf("%d",&a[i]);
        if(i==0) continue;
        if(a[i]-a[i-1]>=t) ans+=t;
        else ans+=a[i]-a[i-1];
    }
    printf("%lld",ans+t);
}



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

int main(){
	int N;
	cin >> N;
	int b[N], B[N], f = 0, c[N];
	for(int i=0; i<N; i++){
		cin >> b[i];
		if(i+1 < b[i]) f = 1;
		c[i] = i+1 - b[i];
		B[i] = b[i];
	}
	int ans[N];
	if(f) cout << -1 << endl;
	else{
		for(int j=0; j<N; j++){
			for(int i=N-1; i>=0; i--){
				if(c[i] == 0){
					ans[N-j-1] = B[i];
					for(int k=i; k<N; k++){
						c[k]--;
					}
					break;
				}
			}
		}
		for(int i=0; i<N; i++){
			cout << ans[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;
typedef long long ll;

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

int main() {

    int L;
    cin >> L;
    double l = L/3.0;
    double out = l*l*l;
    cout << fixed << setprecision(6) << out << endl;
    return 0;
}


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

long long a[500][500] , dp[500][500] , slm[500];
int main()
{
    int n;
    cin >> n;
    for(int i=0 ; i<n ; i++)
        cin >> slm[i];

    for(int i=0 ; i<n ; i++)
        for(int j=i ; j<n ; j++)
            for(int k=i ; k<=j ; k++)
                a[i][j] += slm[k];

    for(int i=0 ; i<n ; i++)
    {
        dp[i][i] = 0;
        for(int j=i+1 ; j<n ; j++)
            dp[i][j] = LLONG_MAX;
    }
    for(int i=n-1 ; i>=0 ; i--)
        for(int j=i+1 ; j<n ; j++)
            for(int k=i ; k<j ; k++)
                dp[i][j] = min(dp[i][j] , dp[i][k] + dp[k+1][j] + a[i][j]);
    cout<<dp[0][n-1];
}

Measured memory_bytes: 3328
MP={'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
a,b = input().split()
if(MP[a]>MP[b]):
  print('>')
elif(MP[a]<MP[b]):
  print('<')
else:
  print('=')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    string s;
    cin >> s;
    cout << s.substr(0, 3) << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
pii ldp[200001], rdp[200001];
char txt[200001];
int main(){
	int N,K,C;scanf("%d %d %d",&N,&K,&C);
	scanf("%s",txt);
	if(txt[0]=='o') ldp[0] = {1,0};
	if(txt[N-1]=='o') rdp[N-1] = {1,N-1};
	for(int i=1;i<N;i++){
		if(txt[i]=='o'){
			pii x = ldp[i-1];
			pii y = {(i-C-1>=0?ldp[i-C-1].first:0) + 1,i};
			if(x.first<y.first) ldp[i] = y;
			else ldp[i] = x;
		}
		else ldp[i] = ldp[i-1];
	}
	for(int i=N-2;i>=0;i--){
		if(txt[i]=='o'){
			pii x = rdp[i+1];
			pii y = {(i+C+1<N?rdp[i+C+1].first:0) + 1,i};
			if(x.first<y.first) rdp[i] = y;
			else rdp[i] = x;
		}
		else rdp[i] = rdp[i+1];
	}
	for(int i=0;i<N;i++){
		if(txt[i]!='o') continue;
		int sum = 0;
		if(i>0){
			sum+=ldp[i-1].first;
			if(max(i+1,ldp[i-1].second+C+1)<N) sum+=rdp[max(i+1,ldp[i-1].second+C+1)].first;
		}
		sum = max(i+1<N?rdp[i+1].first:0,sum);
		//printf("%d %d\n",i,sum);
		if(sum<K) printf("%d\n",i+1);
	}
}

Measured memory_bytes: 4736
from collections import defaultdict
import sys
N=int(input())
alist=list(map(int,input().split()))

adic=defaultdict(int)
for a in alist:
  adic[a]+=1

noset=set()
aset=set()
max_a=0
for a,v in adic.items():
  aset.add(a)
  max_a=max(max_a,a)
  if v>=2:
    noset.add(a)
  
if not aset:
  print(0)
  sys.exit(0)
  
tlist=[False]*(max_a+1)
for a in aset:
  tlist[a]=True
#print(tlist)

for i in range(1,len(tlist)):
  if not tlist[i]:
    continue
  else:
    for j in range(2*i,len(tlist),i):
      tlist[j]=False
      
#print(tlist)
answer=0
for i in range(len(tlist)):
  if tlist[i] and not i in noset:
    answer+=1
    
print(answer)

Measured memory_bytes: 155452
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

public static class Program
{
    static char[] cArray;
    static int _firstWite;
    static int _lastRed;

    public static void Main()
    {
        int n = int.Parse(ReadLine());
        cArray = ReadLine().ToCharArray();
        int min = Math.Min(cArray.Count(x => x == 'R'), cArray.Count(x => x == 'W'));
        if(min == 0)
        {
            WriteLine(0);
            return;
        }
        {
            bool w = false;
            bool cmpl = true;
            for(int i = cArray.Length - 1; i >= 0; --i)
            {
                if (cArray[i] == 'W') w = true;
                else if (w)
                {
                    cmpl = false;
                    break;
                }
            }
            if (cmpl)
            {
                WriteLine(min);
                return;
            }
        }
        _firstWite = 0;
        _lastRed = cArray.Length - 1;
        int count = 0;
        while (!Check())
        {
            cArray[FirstWhite()] = 'R';
            cArray[LastRed()] = 'W';
            ++count;
            if(count >= min)
            {
                WriteLine(min);
                return;
            }
        }
        WriteLine(count);
    }

    static bool Check()
    {
        bool w = false;
        for(int i = _firstWite; i <= _lastRed; ++i)
        {
            if (cArray[i] == 'W') w = true;
            else if (w) return false;
        }
        return true;
    }

    static int FirstWhite()
    {
        for (int i = _firstWite; i < cArray.Length; ++i)
        {
            if (cArray[i] == 'W')
            {
                _firstWite = i;
                return i;
            }
        }
        _firstWite = -1;
        return -1;
    }

    static int LastRed()
    {
        for (int i = _lastRed; i >= 0; --i)
        {
            if (cArray[i] == 'R')
            {
                _lastRed = i;
                return i;
            }
        }
        _lastRed = -1;
        return -1;
    }
}

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



int main(){
    int n; cin >> n;
    vector<long long> dp(n+1);
    dp[0] = 1; dp[1] = 1;
    for(int i=2; i<n+1; ++i){
        dp[i] = dp[i-2] + dp[i-1];
    }
    cout << dp[n] << endl;
}


Measured memory_bytes: 3092
import java.util.*;
import java.util.stream.Collectors;

public class Main{
  public static void main(String[] args){
    
    Scanner scan = new Scanner(System.in);
    int val  = scan.nextInt();
    int val2 = scan.nextInt();
    int val3 = scan.nextInt();
    
    //int[] prelist ={val,val2,val3};
    List<Integer> prelist = new ArrayList<Integer>();
    prelist.add(val);
    prelist.add(val2);
    prelist.add(val3);
    
    
    
    List<Integer> list = prelist.stream().distinct().collect(Collectors.toList());
    System.out.println(list.size());
    
    
    
    
    
  }
}

Measured memory_bytes: 35984