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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  ll X;
  cin >> X;
  ll K;
  cin >> K;
  vi r(K);
  for (ll i = 0; i < K; i++) {
    cin >> r[i];
  }

  struct S {
    ll t, a, b, c;
    bool up;
    S(ll t, ll a, ll b, ll c, bool up) : t(t), a(a), b(b), c(c), up(up) {}
  };

  vector<S> v;
  v.emplace_back(0, 0, X, 0, false);
  for (ll i = 0; i < K; i++) {
    if (i % 2 == 0) {
      if (r[i] - v.back().t <= v.back().c) {
        v.emplace_back(r[i], v.back().a, v.back().b,
                       v.back().c - (r[i] - v.back().t), true);
      } else if (r[i] - v.back().t <= v.back().c + v.back().b - v.back().a) {
        v.emplace_back(r[i], v.back().a + (r[i] - v.back().t - v.back().c),
                       v.back().b, 0, true);
      } else {
        v.emplace_back(r[i], 0, 0, 0, true);
      }
    } else {
      if (r[i] - v.back().t <= X - (v.back().c + v.back().b - v.back().a)) {
        v.emplace_back(r[i], v.back().a, v.back().b,
                       v.back().c + (r[i] - v.back().t), false);
      } else if (r[i] - v.back().t <= X - v.back().c) {
        v.emplace_back(r[i], v.back().a,
                       v.back().b - (r[i] - v.back().t - X + v.back().c +
                                     v.back().b - v.back().a),
                       v.back().c + (r[i] - v.back().t), false);
      } else {
        v.emplace_back(r[i], 0, 0, X, false);
      }
    }
  }

  ll Q;
  cin >> Q;

  for (ll i = 0; i < Q; i++) {
    ll t, x;
    cin >> t >> x;
    ll j =
        distance(v.begin(), upper_bound(v.begin(), v.end(), S(t, 0, 0, 0, true),
                                        [](S x, S y) { return x.t < y.t; })) -
        1;

    ll y;
    if (x <= v[j].a) {
      y = v[j].c;
    } else if (x <= v[j].b) {
      y = v[j].c + (x - v[j].a);
    } else {
      y = v[j].c + v[j].b - v[j].a;
    }

    if (v[j].up) {
      y = min(X, y + (t - v[j].t));
    } else {
      y = max(0ll, y - (t - v[j].t));
    }

    cout << y << endl;
  }
}

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

int main(){
	int n;
	string ans = "No";
	cin >> n;
	for(int i=1; i<=9; i++){
		for(int j=1; j<=9; j++){
			if(n == i*j){
				ans = "Yes";
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// Author : amnptl
//    Godbless

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 998244353     // Check Question

ll power(ll base, ll exponent, ll modx = mod) 
{
    ll ret = 1 % modx;
    base %= modx;
    while(exponent) 
    {
        if(exponent & 1) 
        {
            ret = (ret * base) % modx;
        }
        base = (base * base) % modx;
        exponent >>= 1;
    }
    return ret;
}
 
//nCr mod 
ll inv(ll val, ll modx = mod) 
{
    return power(val, modx - 2, modx);
}
 
vector <ll> fac, ifac;
void preFac(ll sz) 
{
    fac.resize(sz + 1),
    ifac.resize(sz + 1);
    fac[0] = 1;
    for(int i = 1; i <= sz; i++) 
    {
        fac[i] = (i * fac[i - 1]) % mod;
    }
    ifac[sz] = inv(fac[sz]);
    for(int i = sz - 1; i >= 0; i--) 
    {
        ifac[i] = ((i + 1) * ifac[i + 1]) % mod;
    }
}
ll nCr(ll N, ll R)
{
    if(R <= N && R >= 0) {
        return ((fac[N] * ifac[R]) % mod * ifac[N - R]) % mod;
    }
    return 0;
}
// nCr mod
 
int main()
{
    ios_base::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    preFac(201000);	// preComputation
    // Code begins here: 
    ll n,m,k; cin>>n>>m>>k;

    ll color[n+1] = {0}; color[0] = m;		
    for(int i=1; i<=n; i++) color[i] = ((color[i-1]*(m-1))%mod);
    
    ll partition[n+1] = {0}; 
	for(int i=0; i<=n; i++) partition[i] = (nCr(n-1,i))%mod;

	ll pairways[n+1] = {0};
	for(int i=0; i<n; i++) pairways[i] = ((color[n-i-1]*partition[n-1-i])%mod);

	ll ans = 0;
	for(int i=0; i<=k; i++) ans = (ans + pairways[i])%mod;

	cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 11112
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
const ll MAX = 200010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
class SegTree{
    private:
        ll n;
        vector<ll> node;
    public:
        SegTree(vector<ll> v){
            ll sz = v.size();
            n = 1;
            while(n < sz) n *= 2;
            node.resize(2*n+1,INF);
            rep(i,sz) node[i+n-1] = v[i];
            for(int i = n-2;i >= 0;i--) node[i] = min(node[2*i+1],node[2*i+2]);
        }
        void update(ll x,ll val){
            x += (n-1);
            node[x] = val;
            while(x > 0){
                x = (x-1)/2;
                node[x] = min(node[2*x+1],node[2*x+2]);
            }
        }
        ll query(ll a,ll b,ll k = 0,ll l = 0,ll r = -1){
            if (r < 0) r = n;
            if (r <= a || b <= l) return INF;
            if (a <= l && r <= b) return node[k];
            ll vl = query(a,b,2*k+1,l,(l+r)/2);
            ll vr = query(a,b,2*k+2,(l+r)/2,r);
            return min(vl,vr);
        }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,x;
    cin >> n >> x;
    vector<ll> a(n);
    cins(all(a));
    SegTree m(a);
    ll ans = INF,c = 0;
    rep(i,n){
        c = x*i;
        rep(j,n){
            if (j-i >= 0){
                c += m.query(j-i,j+1);
            }
            else{
                c += min(m.query(0,j+1),m.query(n-(i-j),n));
            }
        }
        chmin(ans,c);
    }
    PRINT(ans);
}


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

using namespace std ;

string s , t ;
int dp[ 3002 ][ 3002 ] ;
stack< char > st ;
void print()
{
    /*for( int i = 0 ; i < t.size() ; i++ )
    {
        for( int j = 0 ; j < s.size() ; j++ )
            cout << dp[ i ][ j ] << " " ;
        cout << endl ;
    }*/
    int i = t.size() - 1 ;
    int j = s.size() - 1 ;

    while( i > 0 && j > 0 )
    {
        if( dp[ i - 1 ][ j ] < dp[ i ][ j ] && dp[ i ][ j -1 ] < dp[ i ][ j ] )
        {
            st.push( t[ i ] ) ;
            i-- , j-- ;
        }
        else if( dp[ i - 1 ][ j ] < dp[ i ][ j - 1 ] )
                    j-- ;
                else
                    i-- ;
    }

    while( !st.empty() )
    {
        cout << st.top() ;
        st.pop() ;
    }
}
void solve()
{
    int l1 = s.size() ;
    int l2 = t.size() ;

    for( int i = 0 ; i < l1 ; i++ )
        dp[ 0 ][ i ] = 0 ;
    for( int i = 0 ; i < l2 ; i++ )
        dp[ i ][ 0 ] = 0 ;

    for( int i = 1 ; i < l2 ; i++ )
    {
        for( int j = 1 ; j < l1 ; j++ )
        {
            int ans = 0 ;
            if( t[ i ] == s[ j ] )
                ans = dp[ i - 1 ][ j - 1 ] + 1 ;
            dp[ i ][ j ] = max( ans , max( dp[ i - 1 ][ j ] , dp[ i ][ j - 1 ] ) ) ;
        }
    }

    ///cout << dp[ l2 - 1 ][ l1 - 1 ] << endl ;
    print() ;
}

int main()
{
    s = " " , t = " " ;
    string x , y ;
    cin >> x >> y ;
    s += x , t += y ;
   /// cout << s.size() << endl ;
    ///cout << t << endl ;
    solve() ;
}


Measured memory_bytes: 38820
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
s = input()
ln = len(s)
if ln%2 == 0:
    ml = ln//2 - 1
    mr = ln//2
    ans = 0
    for i in range(ml+1):
        #print(s[i],s[-i-1])
        if s[i] == s[-i-1]:
            pass
        else:
            ans += 1
else:
    m = ln//2
    ans = 0
    for i in range(m):
        if s[i] == s[-i-1]:
            pass
        else:
            ans += 1
print(ans)


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

using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<pair<int, int>> v;
    int a, b;
    for (int i = 0; i<N; i++) {
        cin>>a>>b;
        v.push_back(make_pair(a,b));
    }
    sort(v.begin(), v.end(), [&](auto x, auto y) {
        return ((x.first + x.second) < (y.first + y.second));
    });
    int res = abs(v[0].first - v[N-1].first) + abs(v[0].second - v[N-1].second);
    sort(v.begin(), v.end(), [&](auto x, auto y) {
        return ((x.first - x.second) < (y.first - y.second));
    });
    res = max(res, abs(v[0].first - v[N-1].first) + abs(v[0].second - v[N-1].second));
    cout << res << '\n';
    return 0;
}

Measured memory_bytes: 5340
#include <iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0; // ?????¢?´¢
static const int GRAY = 1;  // ?¬??????¢?´¢????±?
static const int BLACK = 2; // ??¢?´¢??????

int n, M[MAX][MAX];  // ??°??????????????????????????¨????????£??\??????

int prim() {
    int u, minv; // u??????
    int d[MAX], p[MAX], color[MAX]; // d:??¢?´¢??????????±?, p:MST??????????????????v??????

    for(int i = 0;i < n; i++){
	 // ?????????
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }

    d[0] = 0; // MST?????¢?´¢????§?????????????????????°???

    while (1){
	    minv = INFTY;
	    u = -1;
	    for(int i = 0; i < n; i++){
		    // ??¢?´¢????±?????????§??????????°??????????????????§??????????????¢?´¢???????????????????????????	
		    if(minv > d[i] && color[i] != BLACK){
			    u = i; // MST?????????????????????????±???????
			    minv = d[i];
		    }
	    }
	    if(u == -1) break; //??¨??????????±??????¢?´¢????????¨???????????¢?´¢??????????????? 
	    color[u] = BLACK; // ??¢?´¢???????????????
	    for(int v = 0; v < n; v++){
		   //?????¢?´¢????????§?????????u??¨?????????????????£???????????????
		   //  ?¬??????¢?´¢????±???¨????????????????????????????????????
		   if(color[v] != BLACK && M[u][v] != INFTY){
			    if(d[v] > M[u][v]){
				    d[v] = M[u][v]; //????????´??°
				    p[v] = u;  // ????????´??°
				    color[v] = GRAY;
			    }
		    }
	    }
    }
    int sum = 0;
    for(int i = 0; i < n; i++){
	    if (p[i] != -1) sum += M[i][p[i]]; // MST???????????????????????¨???
    }

    return sum;
}

int main(){
	cin >> n;

	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			int e; cin >> e;
			M[i][j] = (e == -1) ? INFTY : e; // ???????????¨??????????????????
		}
	}
	cout << prim() << endl;
	
	return 0;
}

Measured memory_bytes: 1200
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<queue>
#include<vector>
#define MAX 100030
using namespace std;
typedef long long lld;
typedef pair<int,int> pii;
//priority_queue<pii> bean,bbean;
vector<int> graph[MAX];
//vector<pii> weight[MAX];
int n,m,b[MAX],cnt,chk[MAX],chk2[MAX];
pii a[MAX];
lld val;
void dfs(int x,int c){
    if(b[x]!=-1) return;
    b[x]=c;
    for(int i=0;i<graph[x].size();i++) dfs(graph[x][i],c);
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=0,t;i<n;i++) {scanf("%d",&t),a[i]=make_pair(t,i),b[i]=-1;}
    for(int i=0;i<m;i++){
        int t1,t2;
        scanf("%d%d",&t1,&t2);
        graph[t1].push_back(t2);
        graph[t2].push_back(t1);
    }
    for(int i=0;i<n;i++) if(b[i]==-1) dfs(i,cnt++);
    sort(a,a+n);
    if(cnt==1){
        printf("0\n");
        return 0;
    }
    if(2*(cnt-1)>n){
        printf("Impossible\n");
        return 0;
    }
    for(int i=0;i<n;i++) {
        if(chk[b[a[i].second]]==0) chk2[i]=1,chk[b[a[i].second]]=1,val+=(lld)a[i].first;
    }
    int t=0;
    for(int i=0;i<n;i++){
        if(t==cnt-2) break;
        if(chk2[i]==0) chk2[i]=1,t+=1,val+=(lld)a[i].first;
    }
    printf("%lld\n",val);
    /*
    for(int i=0;i<n;i++){
        weight[b[i]].push_back(make_pair(a[i],i));
    }
    chk[0]=1;
    for(int i=0;i<weight[0].size();i++) bean.push(weight[0][i]);
    for(int i=1;i<cnt;i++) for(int j=0;j<weight[i].size();j++) bbean.push(weight[i][j]);
    for(int i=1;i<cnt;i++){
        if(bean.empty()||bbean.empty()){
            printf("Impossible\n");
            return 0;
        }
        pii t1=bean.top(),t2;
        bean.pop();
        while(1){
            t2=bbean.top(),bbean.pop();
            if(!chk[b[t2.second]]) {
                chk[b[t2.second]]=1;
                break;
            }
            else if(bbean.empty()){
                printf("Impossible\n");
                return 0;
            }
        }
        val+=(lld)t1.first+t2.first;
        for(int j=0;j<weight[b[t2.second]].size();j++) if(t2.second!=weight[b[t2.second]][j].second) bean.push(weight[b[t2.second]][j]);
    }
    */
}


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

ll N;
ll ans = 0;

void count(ll x, int b3, int b5, int b7);

int main(){
	cin >> N;
	count(0, 0, 0, 0);
	cout << ans << endl;
	return 0;
}

void count(ll x, int b3, int b5, int b7){
	if(x > N){
		return;
	}
	if(b3+b5+b7 == 3){
		ans += 1;
	}
	count(10*x+3, 1, b5, b7);
	count(10*x+5, b3, 1, b7);
	count(10*x+7, b3, b5, 1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,a,b; cin >> n >> a >> b;
    ll min_ , max_;
    ll ans = 0;
    if(n == 1 && a == b)ans = 1;
    else if(n > 1){
        min_ = a*(n-1) + b;
        max_ = a + b*(n-1);
        ans = max(0LL , max_ - min_ + 1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "2 60", "10 10", "100 100" ].parse.expand.solve == 110 );
	assert( [ "3 60", "10 10", "10 20", "10 30" ].parse.expand.solve == 60 );
	assert( [ "3 60", "30 10", "30 20", "30 30" ].parse.expand.solve == 50 );
	assert( [ "10 100", "15 23", "20 18", "13 17", "24 12", "18 29", "19 27", "23 21", "18 20", "27 15", "22 25" ].parse.expand.solve == 145 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nt = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ nt[ 0 ] ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
	}
	return tuple( nt[ 1 ], abs );
}

auto solve( long t, long[ 2 ][] abs )
{
	auto mt = 0L;
	auto md = 0L;
	foreach( ab; abs )
	{
		mt += ab[ 0 ];
		md += ab[ 1 ];
	}
	if( mt <= t ) return md;
	
	auto dp = new long[][]( 1 + abs.length, 1 + t );
	foreach( ref dpp; dp ) dpp[] = -1;
	dp[ 0 ][ 0 ] = 0;
	abs.sort();
	foreach( long i, ab; abs )
	{
		foreach( long j; 0L .. dp[ i ].length )
		{
			if( dp[ i ][ j ] < 0 ) continue;
			
			// 食べない場合
			dp[ i + 1 ][ j ] = max( dp[ i + 1 ][ j ], dp[ i ][ j ] );
			
			// 食べる場合
			if( j + 1 < dp[ i ].length )
			{
				auto k = min( dp[ i ].length.signed - 1, j + ab[ 0 ] );		// ラストオーダーに間に合えば食べる時間がオーバーしても良い
				dp[ i + 1 ][ k ] = max( dp[ i + 1 ][ k ], dp[ i ][ j ] + ab[ 1 ] );
			}
		}
	}
	return dp[ $ - 1 ][ $ - 1 ];
}


Measured memory_bytes: 75132
# Bubble sort
def bubble_sort(A,N):
    count = 0
    flag = 1 # ????????£??\????´?????????¨??????
    while flag:
        flag = 0
        for j in range(N-1,0,-1):
            if A[j] < A[j-1]:
                tmp = A[j]
                A[j] = A[j-1]
                A[j-1] = tmp
                flag = 1
                count += 1
    return count
N = int(input())
A = [int(i) for i in input().split(' ')]
c = bubble_sort(A,N)
print(' '.join(list(map(str, A))))
print(c)


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

typedef pair<int, int> P;

int main() {

    ll x,y;
    cin >> x >>y;
    int ans = 0;
    while(x<=y){
        ans++;
        x *= 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//author rhythmicankur
                                                                  //god_is_almighty
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")
#include<bits/stdc++.h>
#define f 		first
#define s 		second
#define ll 		int
#define int 		long long
#define ld 		long double
#define pb 		push_back
#define eb 		emplace_back
#define mk 		make_pair
#define vi 		vector<int>
#define pii 		pair<int,int>
#define vpi 		vector<pii>
#define REP(i,n) for (int i = 1; i <= n; i++)
#define trav(a, x)      for(auto& a : x)
#define all(x)          x.begin(), x.end()
#define fill(a,val)	memset(a,val,sizeof(a))
#define 	PI acos(-1)
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define M1 	998244353
#define M2 	1000000007
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); } 
#define test4(x,y,z,a) 		    cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"  |  "<<#a<<": "<<a<<endl;
#define test1(x)                cerr<<#x<<": "<<x<<endl
#define test2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define test3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
ll power(ll a,ll b,ll m=M2){ll answer=1;while(b){if(b&1)answer=(answer*a)%m;b/=2;a=(a*a)%m;}return answer;}
using namespace std;
void ctrl(){cout<<"Control"<<endl;}
int make_num(string p){stringstream geek(p); int x = 0; geek >> x;return x;}
string make_str(int x){ostringstream str1; str1 << x; string geek = str1.str(); return geek;}
const int N=1e5+10;
int dp[N],n,k,ht[N];
int recur(int x)
{
    if(x==n-1)
    return 0;
    if(dp[x]!=-1)
    return dp[x];
    int ans=M2;
    for(int i=1;i<=k;i++)
    {
        if(i+x<n)
        {
            ans=min(ans,abs(ht[x]-ht[i+x])+recur(i+x));
        }
    }

    return dp[x]=ans;
}
signed main()
{	ios::sync_with_stdio(0);
	cin.tie(0); 
	cin.exceptions(cin.failbit);
	
    cin>>n>>k;

    for(int i=0;i<n;i++)cin>>ht[i];
    memset(dp,-1,sizeof(dp));
    int x = recur(0);
    cout<<x;

return 0;
}

Measured memory_bytes: 6144
// I can't tell you what it really is,
// I can only tell you what it feels like.
#include "bits/stdc++.h"
using namespace std;
 
#define int long long
#define F first
#define S second
#define sz(x) ((int)x.size())
#define rep(i,a,n) for (int i = a; i <= n; ++i)
#define all(v)  v.begin(), v.end()
#define pb push_back
#define P pair < int, int >
#define E cout << '\n'

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

int a[N];
 
inline void solve() {
    int n, ans = 0, cnt(0);
    cin >> n;
    rep(i,1,n)
        cin >> a[i];
    for (int i = 2; i <= n; ++i) {
        if (a[i-1] >= a[i]) {
            ++cnt;//cout << i << ' ';
        }
        else
            cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  //cin >> t; while(t--)
  solve();
  return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int dfs(int a){
	if(a < 6){
		return a;
	}else if(a < 9){
		return a-5;
	}else{
		int six = 6;
		while(six <= a){
			six *= 6;
		}
		six /= 6;
		int nine = 9;
		while(nine <= a){
			nine *= 9;
		}
		nine /= 9;
		return std::min(dfs(a-six), dfs(a-nine)) + 1;
	}
}

int main(){
	int n;
	scanf("%d", &n);
	printf("%d\n", dfs(n));
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int n, x, l, d = 0, cont = 0;
	scanf("%d %d", &n, &x);
	for(int i = 0; i < n; i++){
		scanf("%d", &l);
		if(d <= x)
			cont++;
		d = d + l;
	}
	if(d <= x)
		cont++;
	printf("%d\n", cont);

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int n;
    int a[105];
    
    cin >> n;
    for(int i=0; i<n; i++) {
        cin >> a[i];
    }
    cout << a[0];
    for(int i=1; i<n; i++) {
        cout << " " << a[i]; 
    }
    cout << endl;
    
    int v;
    
    for(int i=1; i<n; i++) {
        v = a[i];
        int j = i - 1;
        while(j>=0 && a[j]>v) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        
        cout << a[0];
        for(int i=1; i<n; i++) {
            cout << " " << a[i]; 
        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 3068
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a;
    cin >> a;
    cout << a / 2 + a % 2 << endl;
}

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

typedef long long int llint;

int main()
{
  int n[3];
  cin>> n[0] >> n[1] >> n[2];

  sort(n, n + 3);

  int cnt = n[2] - n[1];
  n[0] += cnt;
  cnt += (n[2] - n[0] + 1) / 2;
  if((n[2] - n[0]) % 2 == 1) cnt++;

  cout<< cnt <<endl;

  return 0;
}


Measured memory_bytes: 256
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
r, s, p = [int(i) for i in sys.stdin.readline().split()]
t = input()
score_dic = {"r":p, "s":r,"p":s}
f = [1 for i in range(n)]
score = 0
for i, (_t, flg) in enumerate(zip(t, f)):
    if i >= k and t[i-k] == _t and flg:
        if i < n - k:
            f[i+k] = 0
    else:
        score += score_dic[_t]
print(score)

Measured memory_bytes: 4212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
	int X =3, Y = 3;
	vector<vector<int>> index;
	
	index.resize(X);
	for (auto& itr : index)
	{
		int t1, t2, t3;
		cin >> t1 >> t2 >> t3;
		itr.push_back(t1);
		itr.push_back(t2);
		itr.push_back(t3);
	}

	int max = 100;
	vector<int> numInt;
	numInt.resize(6);
	int a1, a2, a3, b1, b2, b3;
	int c11 = index[0][0], c12 = index[0][1], c13 = index[0][2];
	int c21 = index[1][0], c22 = index[1][1], c23 = index[1][2];
	int c31 = index[2][0], c32 = index[2][1], c33 = index[2][2];

	for (a1 = 0; a1 <= max; a1++)
	{
		numInt[0] = a1;
		// a1が決まればb1,b2,b3が確定
		numInt[3] = b1 = std::max(c11 - a1, 0);
		numInt[4] = b2 = std::max(c12 - a1, 0);
		numInt[5] = b3 = std::max(c13 - a1, 0);
		// b1,b2,b3が決まればa2,a3も確定する
		numInt[1] = a2 = std::max(c21 - b1, 0);
		numInt[2] = a3 = std::max(c31 - b1, 0);

		// あとは比較？
		if (c11 == a1 + b1 &&
			c12 == a1 + b2 && 
			c13 == a1 + b3 && 
			c21 == a2 + b1 && 
			c22 == a2 + b2 && 
			c23 == a2 + b3 &&
			c31 == a3 + b1 &&
			c32 == a3 + b2 &&
			c33 == a3 + b3 )
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

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

int N,M,ans;
int L_mx,R_mi,L,R;

int main(){
    cin>>N>>M>>L_mx>>R_mi;
    for(int i=0;i<M-1;i++){
        cin>>L>>R;
        if(L>L_mx){L_mx=L;}
        if(R<R_mi){R_mi=R;}
    }
    if(L_mx<=R_mi){ans=R_mi-L_mx+1;
    }else {ans=0;}

    cout<<ans<<endl;
}

Measured memory_bytes: 256
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline

def main():
    n = int(input())
    stations = []
    for _ in range(5):
        stations.append(int(input()))
    min_x = min(stations)
    print(5 + math.ceil(n / min_x) - 1)


def divide_list(l, args):
    result = []
    pre = 0
    for i, a in enumerate(args):
        if i != 0:
            pre = args[i-1]
        result.append(l[pre:a])
        if i == len(args) - 1:
            result.append(l[a:])
    return result

def divide_two(n):
    c = 0
    while True:
        if c >= 2:
            break
        if n % 2 != 0:
            break
        n //= 2
        c += 1
    return c

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


if __name__ == "__main__":
    main()


Measured memory_bytes: 67180
def main():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    t = input().rstrip()

    n = len(s)
    m = len(t)

    dp = []
    for _ in range(n + 1):
        dp.append([0] * (m + 1))

    for i in range(1, n + 1):
        s_ = s[i - 1]
        for j in range(1, m + 1):
            t_ = t[j - 1]
            if s_ != t_:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
            else:
                dp[i][j] = dp[i - 1][j - 1] + 1
    ans = []
    while n > 0 and m > 0:
        if s[n - 1] == t[m - 1]:
            ans.append(s[n - 1])
            n -= 1
            m -= 1
        elif dp[n][m] == dp[n - 1][m]:
            n -= 1
        else:
            m -= 1
    print("".join(ans[::-1]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 112604
a = input()
if a[-1] == '3':
    print("bon")
if a[-1] == '0':
    print("pon")
if a[-1] == '1':
    print("pon")
if a[-1] == '6':
    print("pon")
if a[-1] == '8':
    print("pon")
if a[-1] == '2':
    print("hon")
if a[-1] == '4':
    print("hon")
if a[-1] == '5':
    print("hon")
if a[-1] == '7':
    print("hon")
if a[-1] == '9':
    print("hon")



Measured memory_bytes: 9072
#include <atcoder/scc>
#include <cstdio>

using namespace std;
using namespace atcoder;

int main() {
    int n, m;
    scanf("%d %d", &n, &m);

    scc_graph g(n);

    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        g.add_edge(u, v);
    }

    auto scc = g.scc();

    printf("%d\n", int(scc.size()));
    for (auto v : scc) {
        printf("%d", int(v.size()));
        for (int x : v) {
            printf(" %d", x);
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 40096
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(b-a==c-b)
        printf("YES");
    else printf("NO");
    return 0;
}


Measured memory_bytes: 256
/*
______________________________
                              |
Shubham Singhal               |
                              |
CodeChef          torque      |
HackerEarth       torque      |
SPOJ              torque      |
HackerRank        torquecode  |
CodeForces        torquecode  |
AtCoder           torque            |
______________________________| */


// If Tyrion dies, I am gonna riot :P


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

# define MOD         1000000007
# define gc          getchar
# define LL          long long
# define L           long
# define pb          push_back
# define mp          make_pair
# define vi          vector<int>
# define MAXN        100005
# define INF         1e9
LL f[300006];

LL power(LL a,LL b)
{
    if(b==0)
        return 1;
    if(b==1)
        return a;
    LL temp=power(a,b/2);
    temp=(temp*temp)%MOD;
    if(b&1)
        temp=(temp*a)%MOD;
    return temp;

}
LL fact(LL n,LL r)
{
    LL temp=f[n];
    LL temp1=(f[r]*f[n-r])%MOD;
    temp1=power(temp1,MOD-2);
    temp=(temp*temp1)%MOD;
    return temp;
}
int main()
{
    f[0]=1;
    for(int i=1;i<=300005;i++)
        f[i]=(f[i-1]*i)%MOD;
    LL h,w,a,b;
    cin>>h>>w>>a>>b;
    LL ans=0;
    LL tt=h+w-2;
    ans=fact(tt,h-1)%MOD;

    for(int i=1;i<=a;i++)
    {
        tt=b+h-a+i-2;
        LL temp=fact(tt,b-1)%MOD;
        tt=a-i+w-b-1;
        temp=temp*fact(tt,w-b-1);
        temp=temp%MOD;
        ans=ans-temp;
        ans+=MOD;
        ans%=MOD;

    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;


int main()
{ios_base::sync_with_stdio(false);
ll n,a,b;
cin>>n>>a>>b;
ll ans=a+(b-a-1)/2;
if(b%2==a%2)ans=min(ans,abs(b-a)/2);
a=n-a+1;b=n-b+1;
swap(a,b);
ans=min(ans,a+(b-a-1)/2);

ol(ans);
return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long int
int main()
{
	ll w,h,n;
	cin>>w>>h>>n;
	bool x[w+10],y[h+10];
	for(int i=0;i<=w;i++)
	{
		x[i]=0;
	}
	for(int i=0;i<=h;i++)
	{
		y[i]=0;
	}
	for(int j=0;j<n;j++)
	{
		ll qq,ww,c;
		cin>>qq>>ww>>c;
		if(c==1)
		{
			for(int i=0;i<qq;i++)
			{
				x[i]=1;
			}
		}
		else if(c==2)
		{
			for(int i=w;i>qq;i--)
			{
				x[i]=1;
			}
		}
		else if(c==3)
		{
			for(int i=0;i<ww;i++)
			{
				y[i]=1;
			}
		}
		else
		{
			for(int i=h;i>ww;i--)
			{
				y[i]=1;
			}
		}
	}
	/*
	ll z=0,s=0;
	for(int i=0;i<=w;i++)
	{
		if(x[i]==0)
		{
			//cout<<i<<endl;
			z++;
		}
	}
	//z--;
	for(int i=0;i<=h;i++)
	{
		if(y[i]==0) s++;
	}
	//s--;
	//ll ss=max(z*s,0);
	//cout<<z<<" "<<s<<endl;
	if((z*s)>=0)
	{
		cout<<z*s<<endl;
	}
	else
	{
		cout<<"0"<<endl;
	}*/
	ll z1=0,z2=0,z3=0,z4=0;
	for(int i=0;i<=w;i++)
	{
		if(x[i]==0)
		{
			z1=i;
			//cout<<i<<endl;
			break;
		}
	}
	for(int i=w;i>=0;i--)
	{
		if(x[i]==0)
		{
			z2=i;
			//cout<<i<<endl;
			break;
		}
	}
	for(int i=0;i<=h;i++)
	{
		if(y[i]==0)
		{
			z3=i;
			//cout<<i<<endl;
			break;
		}
	}
	for(int i=h;i>=0;i--)
	{
		if(y[i]==0)
		{
			z4=i;
			break;
		}
	}
	//cout<<z1<<" "<<z2<<" "<<z3<<" "<<z4<<endl;
	cout<<(z2-z1)*(z4-z3)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

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


int main(){
    int x = 0, y = 0;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        char c;
        cin >> c;
        if(c == 'R'){
            x++;
        }
        else{
            y++;
        }
    }

    if(x > y){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//Fast io
#define io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
//Class shorthands
#define ll long long
#define db long double
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
//Function Shorthands
#define fi first
#define se second
#define mem1(a) memset(a,-1,sizeof(a))
#define mem0(a) memset(a,0,sizeof(a))
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define po pop_back
#define eb emplace_back
//Code Shorthands
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repe(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)
#define all(a) (a).begin(),(a).end()
#define sz(x) (int)x.size()
//Constants
#define hell 1000000007
#define PI acos(-1.0)
using namespace std;

void solve(){
	int n;
	cin>>n;
	int dp[n+1];
	int p[n+1];
	p[1] = 1;
	memset(p, 0, sizeof(p));
	for(int i=0;i<n+1;i++) dp[i] = 1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			for(int j = i;j<n+1;j+=i){
				int cur = j;
				int c = 0;
				p[j] = 1;
				while(cur%i==0){
					cur/=i;
					c++;
				}
				dp[j]*=(c+1);
			}
		}
	}
	for(int i=2;i<n+1;i++) dp[i] +=dp[i-1];
	cout<<dp[n-1]<<endl;
}

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

Measured memory_bytes: 11384
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    N := nextInt()
    A := nextInt()
    B := nextInt()
    P := nextInts(N)
    
    ans := make([]int, 3)
    for _, pi := range P {
        if pi <= A {
            ans[0]++
        } else if pi > A && pi <= B {
            ans[1]++
        } else {
            ans[2]++
        }
    }
    fmt.Println(Min(ans))

    
}

// nとiからdigitSumを計算し、sと一致するかチェックする
func chk(n, i, s int64) bool{
    digitSum := int64(0)
    x := n
	for x > 0 {
		digitSum += x%i
		x /= i
	}
	return digitSum == s
}
 
/* templates */


func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


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

int main() {
  char s[3];
  int cnt = 0;
  
  cin >> s[0] >> s[1] >> s[2];
  for (int i = 0; i < 3; i++) {
    if (s[i] == '1') {
      cnt++;
    }
  }
  cout << cnt << endl;
}

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

int main()
{
    int d,n;
    cin>>d>>n;
    
    if(n==100)
    {
        if(d==0)
            cout<<101<<endl;
        else if(d==1)
            cout<<10100<<endl;
        else 
            cout<<1010000<<endl;
        return 0;
    }
    
    if(d==0)
        cout<<n<<endl;
    else if(d==1)
        cout<<100*n<<endl;
    else
        cout<<10000*n<<endl;
        
    return 0;
}


Measured memory_bytes: 256
while True:
    try:
        a, b, c, d, e, f = map(float, input().split())
        x = (c*e - b*f)/(a*e - b*d)
        y = (f*a - c*d)/(a*e - d*b)
        print( "{0:.3f} {1:.3f}".format(x+0, y+0))
    except:
        break

Measured memory_bytes: 5584
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] H = new int[N];
    for (int i = 0; i < N; i++)
      H[i] = sc.nextInt();
    int[] A = new int[M];
    int[] B = new int[M];
    for (int i = 0; i < M; i++) {
      A[i] = sc.nextInt();
      B[i] = sc.nextInt();
    }
    sc.close();

    boolean[] h = new boolean[N];
    for (int i = 0; i < M; i++) {
      if (H[A[i] - 1] <= H[B[i] - 1])
        h[A[i] - 1] = true;
      if (H[A[i] - 1] >= H[B[i] - 1])
        h[B[i] - 1] = true;
    }

    int ans = N;
    for (int i = 0; i < N; i++)
      if (h[i]) ans--;
    System.out.println(ans);
  }
}


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

int main( void )
{
    char s[ 3 ];
    cin >> s[ 0 ] >> s[ 1 ] >> s[ 2 ];
    if ( ( s[ 0 ] + s[ 1 ] + s[ 2 ] ) == ( 97 + 98 + 99 ) )
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/



bool comp(pair<string,int> i, pair<string,int> j) {
    if (i.first==j.first) {
        return i.second > j.second;
    }
    return i.first < j.first;
}


int n, p; string s; vector <pair<string,int>> v; map<pair<string,int>, int> m;

void solve()
{
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> s >> p;
        v.pb({s,p});
        m[{s,p}] = i+1;
    }
    sort(v.begin(), v.end(), comp);
    for (int i=0; i<n; i++) {
        nout(m[v[i]]);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int A,B;
int main () {
cin >> A >> B;
if(A==B){
	cout << "Draw" << endl;
} else if (A==1) {
	cout << "Alice" << endl;
} else if (B==1) {
	cout << "Bob" << endl;
} else if (A>B) {
	cout << "Alice" << endl;
} else {
	cout << "Bob" << endl;
}
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
using namespace std;
typedef long long int ll;

const int N=45;

int a[N];

ll bit[N];
int dp1[1<<20];
int dp2[1<<20];

int n;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    map<string,int> mp;
    while(cin >> n,n){
        mp.clear();
        vector<string> rinsetu[n];
        for(int i=0;i<n;i++){
            string s; cin >> s;
            mp[s]=i;
            cin >> a[i];
            int m; cin >> m;
            while(m--){
                cin >> s;
                rinsetu[i].push_back(s);
            }
        }
        for(int i=0;i<n;i++){
            bit[i]=0;
            for(string s:rinsetu[i]){
                bit[i]|=(1LL<<mp[s]);
            }
        }
        int r=n/2;
        int l=n-r;
        for(ll i=0;i<(1<<r);i++){
            int sum=0;
            dp1[i]=-1;
            bool ok=1;
            for(int j=0;j<r;j++){
                if(i&(1LL<<j)){
                    sum+=a[j];
                    if(i&bit[j]){
                        ok=0;
                    }
                }
                if(!ok)break;
            }
            if(ok){
                dp1[i]=sum;
            }
        }
        for(ll i=0;i<(1<<l);i++){
            dp2[i]=0;
            int sum=0;
            bool ok=1;
            for(int j=0;j<l;j++){
                if(i&(1<<j)){
                    sum+=a[j+r];
                    ll ii=(ll)(i<<r);
                    if(ii&bit[j+r]){
                        ok=0;
                    }
                }
                if(!ok)break;
            }
            if(ok){
                dp2[i]=sum;
            }
        }
        for(int j=0;j<(1<<l);j++){
            for(int i=0;i<l;i++){
                if(j&(1<<i)){
                    dp2[j]=max(dp2[j],dp2[j^(1<<i)]);
                }
            }
        }
        int res=0;
        ll q=(1<<l)-1;
        for(int i=0;i<(1<<r);i++){
            if(i%2==0)continue;
            if(dp1[i]==-1)continue;
            ll p=0;
            for(int j=0;j<r;j++){
                if(i&(1<<j)){
                    p|=bit[j];
                }
            }
            p>>=r;
            p^=q;
            res=max(res,dp1[i]+dp2[p]);
        }
        printf("%lld\n",res);
    }
}



Measured memory_bytes: 11708
#include <iostream>

using namespace std;

int main(void){
  int N;
  string S;
  cin >> N >> S;

  for(int i=0; i<S.length(); i++)
    S[i] = (S[i]-'A'+N)%26 + 'A';

  cout << S << endl;

  return 0;
}


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

struct Node{
	long key;
	Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(long k){
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = new Node;
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while (x != NIL){
		y = x;
		if (z->key < x->key){
			x = x->left;
		}
		else {
			x = x->right;
		}
	}

	z->parent = y;
	if (y == NIL){
		root = z;
	}
	else {
		if (z->key < y->key){
			y->left = z;
		}
		else {
			y->right = z;
		}
	}
}

void inorder(Node *u){
	if (u == NIL) return;
	inorder(u->left);
	cout << " " << u->key;
	inorder(u->right);
}

void preorder(Node *u){
	if (u == NIL) return;
	cout << " " << u->key;
	preorder(u->left);
	preorder(u->right);
}

int main(){
	long n, x;
	string com;
	cin >> n;
	for (long i = 0; i < n; i++){
		cin >> com;
		if (com == "insert"){
			cin >> x;
			insert(x);
		}
		else if (com == "print"){
			inorder(root);
			cout << endl;
			preorder(root);
			cout << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 24648
import sys
from operator import itemgetter

fin = sys.stdin.readline
N = int(fin())
conditions = [[elem for elem in fin().split()] + [idx+1] for idx in range(N)]
conditions = [[x[0], int(x[1]), x[2]] for x in conditions]

conditions = sorted(conditions, key=itemgetter(1), reverse=True)
conditions = sorted(conditions, key=itemgetter(0))

[print(x[2]) for x in conditions]


Measured memory_bytes: 3188
#include<stdio.h>

int main(void)
{
	int c, d, e;
	scanf("%d %d %d", &c, &d, &e);

	if (c <=d&&d <= e)
	{
		printf("%d %d %d\n", c, d, e);
	}
	else if (c <= e&&e <= d)
	{
		printf("%d %d %d\n", c, e, d);
	}
	else if (d <= c&&c <= e)
	{
		printf("%d %d %d\n", d, c, e);
	}
	else if (d <= e&&e <= c)
	{
		printf("%d %d %d\n", d, e, c);
	}
	else if (e <= c&&c <= d)
	{
		printf("%d %d %d\n", e, c, d);
	}
	else if (e <= d&&d <= c)
	{
		printf("%d %d %d\n", e, d, c);
	}
	return 0;
}

Measured memory_bytes: 596
_ = gets.chomp.to_i

nums = gets.split.map(&:to_i)

min_div = 32  # Aの範囲が 10^9 までなので最大でも32回？しか2で割れない
nums.each do |num|
  cur_div = 0
  # []演算子で指定bit位置の値が取れる ※[0]が最下位（1の位）
  while (num[cur_div] & 1) == 0
    cur_div += 1
  end
  # puts "cur_div: #{cur_div}"

  if cur_div < min_div
    min_div = cur_div
  end
end

puts min_div


Measured memory_bytes: 1788
// Remeber Choose Compiler: GCC9
#include <bits/stdc++.h>

using namespace std;

// Debug Output Utility
#ifdef LOCAL
#define dbg(args...)             \
    do {                         \
        cout << #args << " -> "; \
        err(args);               \
    } while (0)
void err() { std::cout << std::endl; }
template <typename T, typename... Args>
void err(T a, Args... args) {
    std::cout << a << ' ';
    err(args...);
}
template <template <typename...> class T, typename t, typename... A>
void err(const T<t> &arg, const A &... args) {
    for (auto &v : arg)
        std::cout << v << ' ';
    err(args...);
}
#else
#define dbg(...)
#endif

// Macro Definitions:
#define mp make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

// Type Alias:
using int64 = long long;
using PII   = pair<int, int>;

// Global Const Variable
const int64 INF     = 0x3f3f3f3f;
const int MOD       = 1000000007;
const int MAXN      = ((1 << 18) + 5);
const int M         = 100005;
const int dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};

int64 v[MAXN], w[MAXN];
int64 dp[1030][M];

int64 f(int u, int l) {
    if (l < 0)
        return -INF;
    if (u > 1024) {
        return max(f(u >> 1, l), f(u >> 1, l - w[u]) + v[u]);
    } else {
        return dp[u][l];
    }
}

void run() {
    int64 n;
    cin >> n;
    int64 ans = (n + 1) * n / 2;
    for (int64 i = 2; i <= n; i++) {
        ans += (i + ((n / i) * i)) * (n / i) / 2;
    }
    cout << ans << endl;
}

// Debug Input Redirection
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
#endif
    run();
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
using namespace std;
int n,m;
const int maxn = 100010;
int a[maxn];
vector<int> g[maxn];
bool vis[maxn];
int group[maxn],group_cnt;
void dfs(int u)
{
	vis[u] = 1; 
	group[u] = group_cnt;
	for(int i = 0;i < g[u].size(); ++i)
	{
		int v = g[u][i];
		if(!vis[v]) 
		{
			dfs(v);
		}
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for(int i = 1;i <= n; ++ i) 
	{
		cin>>a[i];
	}
	for(int i = 1;i <= m; ++i)
	{
		int x,y; 
		cin>>x>>y;
		g[x].push_back(y); 
		g[y].push_back(x);
	}
	for(int i = 1;i <= n; ++i)
	{
		if(!vis[i]) 
		{
			group_cnt++;
			dfs(i);
		}
	}
	int ans = 0;
	for(int i = 1;i <= n; ++i) 
	{
		if(group[i] == group[a[i]]) 
		{
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0 ;
}

Measured memory_bytes: 8576