akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>

using namespace std;

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

int abs_A(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

int abs_B(long long num, long long numb) {
    if (num - numb >= 0)
        return num - numb;
    else
        return -1 * (num - numb);
}

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

long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

bool permutation(vector<int>& vec,vector<int>& P) {
    bool ok = true;
    for (int i = 0; i < vec.size(); i++) {
        //cout << vec.at(i);
        if (vec.at(i) != P.at(i)) {
            ok = false;
        }
    }
    return ok;
}

const long long MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    vector<int> P(N);
    vector<int> Q(N);
    vector<int> retu(N);
    for (int i = 0; i < N; i++) {
        cin >> P.at(i);
        retu.at(i) = P.at(i);
    }
    for (int i = 0; i < N; i++) {
        cin >> Q.at(i);
    }
    bool Pok = false;
    bool Qok = false;
    sort(retu.begin(), retu.end());
    int count = 1;
    int ansP = 0;
    int ansQ = 0;
    do {
        Pok = permutation(retu, P);
        if (Pok == true) {
            ansP = count;
        }
        Qok = permutation(retu, Q);
        if (Qok == true) {
            ansQ = count;
        }
        count++;
        Pok = false;
        Qok = false;

    } while (next_permutation(retu.begin(), retu.end()));

    cout << abs_A(ansP - ansQ) << endl;
}



Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    h = list(map(int, input().split()))

    for i in range(1, n):
        if h[i] > h[i - 1]:
            h[i] -= 1
        if h[i] - h[i - 1] < 0:
            print('No')
            exit()

    print('Yes')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 58224
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b;
  string s;
  cin>>a>>b>>s;
  rep(i,a+b+1){
    if(i==a){
      if(s[i]!='-'){
        cout<<"No"<<'\n';
        return(0);
      }
    }
    else{
      if(s[i]=='-'){
        cout<<"No"<<'\n';
        return(0);
      }
    }
  }
  cout<<"Yes"<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define int long long
#define endl "\n"
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define fr(a,b,c) for(int a=b; a<c; a++)
#define frr(a,b,c) for(int a=b;a>=c;a--)
#define pb push_back
#define pii pair<int,int>
#define R(a) ll a; cin >> a;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

#define RA(a, n) ll a[(n) + 1] = {}; fr(i, 1, (n)+1) {cin >> a[i];}
#define RM(a, n, m) int a[n + 1][m + 1] = {}; fr(i, 1, n+1) {fr(j, 1, m+1) cin >> a[i][j];}
#define reset(X) memset(X, 0, sizeof(X))
using vi=vector<int>;
const int inf = 1e18;
const int mod=998244353;
unsigned int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
bool isPrime(int n)
{   if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
    for (int i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
    return true;
}
int modInverse(int n, int p)
{
    return power(n, p-2, p);
}

bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
}
signed main()
{
    fastio;
    R(a);R(b);R(c);R(d);R(e);
    if(a==0)
    {
        cout<<1<<endl;
        return 0;

    }
    if(b==0)
    {
        cout<<2<<endl;
        return 0;
    }
    if(c==0)
    {
        cout<<3<<endl;
        return 0;
    }
    if(d==0)
    {
        cout<<4<<endl;
        return 0;
    }
    if(e==0)
    {
        cout<<5<<endl;
        return 0;
    }
}


Measured memory_bytes: 3592
// #Badhi moh maya chhe!
/*
AUTHOR NAME:
	         ,--.                         ____                          ,--.
	       ,--.'|   ,---,               ,'  , `.   ,---,              ,--.'|
	   ,--,:  : |  '  .' \           ,-+-,.' _ |  '  .' \         ,--,:  : |
	,`--.'`|  ' : /  ;    '.      ,-+-. ;   , || /  ;    '.    ,`--.'`|  ' :
	|   :  :  | |:  :       \    ,--.'|'   |  ;|:  :       \   |   :  :  | |
	:   |   \ | ::  |   /\   \  |   |  ,', |  '::  |   /\   \  :   |   \ | :
	|   : '  '; ||  :  ' ;.   : |   | /  | |  |||  :  ' ;.   : |   : '  '; |
	'   ' ;.    ;|  |  ;/  \   \'   | :  | :  |,|  |  ;/  \   \'   ' ;.    ;
	|   | | \   |'  :  | \  \ ,';   . |  ; |--' '  :  | \  \ ,'|   | | \   |
	'   : |  ; .'|  |  '  '--'  |   : |  | ,    |  |  '  '--'  '   : |  ; .'
	|   | '`--'  |  :  :        |   : '  |/     |  :  :        |   | '`--'  
	'   : |      |  | ,'        ;   | |`-'      |  | ,'        '   : |      
	;   |.'      `--''          |   ;/          `--''          ;   |.'      
	'---'                       '---'                          '---'        

*/



#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define vll vector<long long>
#define all(x) x.begin(),x.end()
#define pb push_back
#define Fo(i,k,n) for(ll i=k;i<=n;i+=1)
#define deb(x) cout << #x << "=" << x << endl
#define in(a,n) Fo( i,0,n-1)cin>>a[i]
#define out(a,n) Fo( i,0,n-1)cout<<a[i]<<" ";cout<<endl
#define IOS     ios_base::sync_with_stdio(0); cin.tie(NULL);

ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void fileio()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}


int main() {
	IOS
    ll t=1;
	//cin>>t;	
	
	while(t--)
	{
	 string s;
	 cin>>s;
	 ll p1=0,p2=s.size()-1;
	 ll n=s.size();
	 while(p1<=p2&&s[p1]==s[p2]){p1++;p2--;};
	 if(p1<p2){cout<<"No";return 0;}
	 p1=0;p2=(n-1)/2-1;
	 while(p1<=p2&&s[p1]==s[p2]){p1++;p2--;};
	 if(p1<p2){cout<<"No";return 0;}
	 p2=n-1;p1=(n+3)/2-1;
	 while(p1<=p2&&s[p1]==s[p2]){p1++;p2--;};
	 if(p1<p2){cout<<"No";return 0;}
	 cout<<"Yes";
	 
	 
	}
	
    
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


int main() {
    string c1, c2, c3;
    cin >> c1 >> c2 >> c3;
    string ans = "";
    ans += c1[0];
    ans += c2[1];
    ans += c3[2];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    
    int n, i, Rt[200000], max=-1000000000;
    scanf("%d", &n);
           
    for(i=0; i<n; i++){
        scanf("%d", &Rt[i]);
    }
     
    int min =Rt[0];
     
    for(i=1; i<n; i++){
        if(max < Rt[i]-min){
            max = Rt[i]-min;
        }
        if(min > Rt[i]){
            min = Rt[i];
        }
    }
    printf("%d\n", max);
    return 0;
     
     
}

Measured memory_bytes: 1380
//Relive your past life.
//Face your demons.
//The past is never dead,it is not even past.
//The memories are not only the key to the past but...also to the future.
//coded in Rusty Lake
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define ll   long long
#define pb   push_back
#define mp   make_pair
#define orz  1000000007ll
#define X    first
#define Y    second
using namespace std;
int h,w,n;
ll jc[200005],njc[200005],dp[3005];
pair<int,int> p[3005];
ll fp(ll x,int k=1000000005){
    ll ans=1;
    while(k){
        if(k&1)ans=ans*x%orz;
        x=x*x%orz,k>>=1;
    }
    return ans;
}
ll c(int x,int y){return jc[x+y]*njc[x]%orz*njc[y]%orz;}
int main(){
    jc[0]=1;
    for(int i=1;i<=200000;++i)jc[i]=jc[i-1]*i%orz;
    njc[200000]=fp(jc[200000]);
    for(int i=200000;i;--i)njc[i-1]=njc[i]*i%orz;
    scanf("%d%d%d",&h,&w,&n);
    for(int i=1;i<=n;++i)scanf("%d%d",&p[i].X,&p[i].Y);
    sort(p+1,p+n+1);
    p[++n]=mp(h,w);
    for(int i=1;i<=n;++i){
        dp[i]=c(p[i].X-1,p[i].Y-1);
        for(int j=1;j<i;++j){
            if(p[j].X<=p[i].X&&p[j].Y<=p[i].Y){
                dp[i]-=dp[j]*c(p[i].X-p[j].X,p[i].Y-p[j].Y);
                dp[i]=(dp[i]%orz+orz)%orz;
            }
        }
    }
    printf("%lld\n",dp[n]);
	//system("pause");
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <vector>
typedef long long ll;

using namespace std;

vector<ll> sequence;

ll count_combination(ll condition) {
  ll combination_count = 0;
  ll range_sum = 0;
  int tail = 1;
  for(int head = 0; head < sequence.size(); head++) {
    while(range_sum + sequence[tail - 1] <= condition && tail <= sequence.size()) {
      range_sum += sequence[tail++ - 1];
    }
    combination_count += (tail - 1)- head;

    if(tail - head < 1) {
      tail++;
    }

    range_sum -= sequence[head];
  }

  return combination_count;
}

int main() {
  int sequence_num;
  int query_num;

  cin >> sequence_num >> query_num;
  sequence.resize(sequence_num);

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

  for(int i = 0; i < query_num; i++) {
    ll sub_sum;
    cin >> sub_sum; // x

    ll combination_num = count_combination(sub_sum);
    cout << combination_num << endl;
  }
}


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

int main()
{
    int k,n;
    cin>>k>>n;
    vector<int>v;
    int arr[n+5];
    for(int i=0;i<n;i++)cin>>arr[i];
    for(int i=0;i<n;i++)
    {
        if(i==n-1)
        {
            v.push_back((k-arr[i]+arr[0]));
        }
        else
        {
              v.push_back(arr[i+1]-arr[i]);
        }
    }
    long long sum=0;
    sort(v.begin(),v.end());
    for(int i=0;i<v.size()-1;i++)sum+=v[i];
    cout<<sum<<endl;
}


Measured memory_bytes: 2168
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	x, y := intScanner(), intScanner()
	g1 := []int{1, 3, 5, 7, 8, 10, 12}
	g2 := []int{4, 6, 9, 11}
	f := false
	for _, v := range g1 {
		for _, w := range g1 {
			if x == v && y == w {
				f = true
			}
		}
	}
	for _, v := range g2 {
		for _, w := range g2 {
			if x == v && y == w {
				f = true
			}
		}
	}
	if f {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 9999999999
#define M_PI 3.14159265358979323846

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> X,L;
vector<pii> R;

void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    REP(i,N){
        ll x,l;
        cin >> x >> l;
        X.push_back(x);
        L.push_back(l);
    }
}


void solve(){
    input();
    REP(i,N) {
        pii r;
        r = make_pair(X[i]+L[i], X[i]-L[i]);
        R.push_back(r);
    }
    VSORT(R);
    DBG(R)

    int ans=0;
    ll t=-LL_INF;
    REP(i,N){
        if(t<=R[i].second){
            ans++;
            t = R[i].first;
        }
    }
    cout << ans << endl;

}

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


Measured memory_bytes: 3436
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



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

ll a, b;

int main() {
    while (cin >> a >> b) {
        cout << gcd(a, b) << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=2e5;
const int inf=1e9;
int main(){
	int N;cin>>N;
	int cnt[N] = {}; int a;
	rep(i,0,N){
		cin>>a; cnt[a]++;
		cnt[abs(N - 2*i - 1)]--;
	}
	rep(i,0,N)if(cnt[i]){
		cout<<0<<endl;
		return 0;
	}
    long res = 1;
	rep(i,0,N/2) (res*=2)%=mod;
    cout<<res<<endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;
    N--;
    ll bina = N;

    ll k=1;
    while(N >= 0){
        N -= pow(26, k);
        if(N>=0) k++;
    }
    ll sum = 0;
    for(ll i=1; i<=k-1; i++){
        sum += pow(26, i);
        // cout << "sum:" << sum << endl;
    }
    bina = bina-sum;
    // cout << bina << endl;

    vector<ll> Binary;
    
    ll d=0;
    while(bina > 0){
        Binary.push_back(bina%26);
        bina = bina/26;
        d++;
    }
    REP(i, k-d){
        Binary.push_back(0);
    }
    reverse(Binary.begin(), Binary.end());

    
    // cout << "k:" << k << endl;
    for(ll i=0; i<k; i++){
        // cout << "v:" << Binary[i] << endl;
        // if(v == 0){
        //     cout << 'z';
        //     continue;
        // }
        // if(i == k-1){
        //     cout << char('a'+ Binary[i]);
        //     continue;
        // }
        cout << char('a'+ Binary[i]);
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 4048
S=input()
i=len(S)
while(1):
    flag=0
    if i==0:
        print('YES')
        break
    if 0<=i-5:
        if S[i-5:i]=='dream' or S[i-5:i]=='erase':
            i-=5
            flag=1
    if 0<=i-6:
        if S[i-6:i]=='eraser':
            i-=6
            flag=1
    if 0<=i-7:
        if S[i-7:i]=='dreamer':
            i-=7
            flag=1
    if flag==0:
        print('NO')
        break

Measured memory_bytes: 3188
N, X = map(int, input().split())

a, p = [1], [1]
for _ in range(N):
    a.append(a[-1] * 2 + 3)
    p.append(p[-1] * 2 + 1)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    if x <= a[n - 1] + 1:
        return f(n - 1, x - 1)
    else:
        return p[n - 1] + 1 + f(n - 1, x - a[n - 1] - 2)


print(f(N, X))

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

int main() {
  string a,b,c;
  cin >> a >> b;
  int N, M;
  cin >> N >> M;
  cin >> c;
  if(a==c){
  cout << N-1 << " " << M << endl;
  }
  else{
  cout << N << " " << M-1 << endl; 
  }
}

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

int solve(int idx, const vector<int>& p, const vector<int>& q, const vector<int>& r, const vector<int>& b)
{
  int left = 1, right = 1;
  if (r[idx] != 0)
    left = solve(r[idx], p, q, r, b);
  if (b[idx] != 0)
    right = solve(b[idx], p, q, r, b);

  int left_p = left * p[idx];
  int right_p = right * q[idx];
  int lcm = left_p / __gcd(left_p, right_p) * right_p;  
  return lcm / p[idx] + lcm / q[idx];
}

int main()
{
  int n;
  while (cin >> n) {
    if (n == 0)
      break;

    vector<int> p(n+1), q(n+1), r(n+1), b(n+1), d(n+1, 0);
    for (int i = 1; i <= n; ++i) {
      cin >> p[i] >> q[i] >> r[i] >> b[i];
      d[r[i]] = d[b[i]] = 1;
    }

    int top = 0;
    for (int i = 1; i < n+1; ++i) {
      if (!d[i])
	top = i;
    }
 
    cout << solve(top, p, q, r, b) << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>

int main(){
    int n;
    int *table;
    while(1){
        std::cin >> n;
        if(!n){
            return 0;
        }
        table = new int [(n + 1) * (n + 1)]();
        for(int i = 0; i < n * n; i++){
            std::cin >> table[i / n * (n + 1) + i % n];
        }
        for(int r = 0; r < n; r++){
            for(int c = 0; c < n; c++){
                table[r * (n + 1) + n] += table[r * (n + 1) + c];
                table[n * (n + 1) + c] += table[r * (n + 1) + c];
                table[n * (n + 1) + n] += table[r * (n + 1) + c];
            }
        }
        
        for(int i = 0; i < (n + 1) * (n + 1); i++){
            std::cout << std::setw(5) << std::right << table[i];
            if(i % (n + 1) == n){
                std::cout << std::endl;
            }
        }
        delete [] table;
    }
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define ss second
#define pp pop_back
#define in insert
#define ld long double
#define sz(v) (int)v.size()
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define sp cout << " "
#define endl '\n'
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';              
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define lmax 9223372036854775807
#define v3(type, v, x, y, z) vector<vector<vector<type>>> v(x, vector<vector<type>>(y, vector<type>(z)))
#define v2(type, v, n, m) vector<vector<type>> v(n, vector<type>(m))

const ll MOD=1e9+7;
typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vpii;
typedef vector<pll > vpll;


inline ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = (n%p) * (n%p) % p;} return r;}
inline ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
inline ll addmod(ll a, ll val, ll p = MOD) {{if ((a = (a + val)) >= p) a -= p;} return a;}
inline ll submod(ll a, ll val, ll p = MOD) {{if ((a = (a - val)) < 0) a += p;}return a;}
inline ll mult(ll a, ll b, ll p = MOD) {return (ll) a * b % p;}
vi answer;
int finder(int n, vvi dp,int i)
{

}
void find(int n, vvi dp,int i,int j)
{
	// cout<<n<<endl;
	if(j==0)
		return;
	int m=0;
	if(i==0)
	{
		if(dp[0][j]>=n)
		{
			answer.pb(0);
			find(n,dp,0,j-1);
		}
		else
		{
			n=n-dp[0][j];
			answer.pb(1);
			find(n,dp,1,j-1);
		}
	}
	else if(i==9)
	{
		if(dp[8][j]>=n)
		{
			answer.pb(8);
			find(n,dp,8,j-1);
		}
		else
		{
			n=n-dp[8][j];
			answer.pb(9);
			find(n,dp,9,j-1);
		}
	}
	else
	{
		if(dp[i-1][j]>=n)
		{
			answer.pb(i-1);
			find(n,dp,i-1,j-1);
		}
		else
		{
			n=n-dp[i-1][j];
			if(dp[i][j]>=n)
			{
				answer.pb(i);
				find(n,dp,i,j-1);
			}
			else
			{
				n=n-dp[i][j];
				answer.pb(i+1);
				find(n,dp,i+1,j-1);
			}
		}
	}	
}
int main()
{
	ll i,j,n,m,k,ans,t=1;
	// cin>>t;
	while(t--)
	{
		cin>>n;
		ans=0;
		vvi dp(10,vi(11,1));
		// vi answer;
		for(j=2;j<=10;j++)
		{
			for(i=0;i<=9;i++)
			{
				if(i==0)
					dp[i][j] = dp[i][j-1]+dp[i+1][j-1];
				else if(i==9)
					dp[i][j] = dp[i][j-1]+dp[i-1][j-1];
				else
					dp[i][j] = dp[i][j-1]+dp[i-1][j-1]+dp[i+1][j-1];
				// cout<<dp[i][j]<<" ";
			}
			// cout<<endl;
		}
		m=0;
		for(j=1;j<=10;j++)
		{
			for(i=1;i<=9;i++)
			{
				if(m+dp[i][j]>=n)
					break;
				m=m+dp[i][j];
			}
			if(i<=9)
				break;
		}
		answer.pb(i);
		find(n-m,dp,i,j-1);
		for(i=0;i<answer.size();i++)
			cout<<answer[i];
		cout<<endl;
	}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> h(n);
  for(Int i=0;i<n;i++) cin>>h[i];
  const Int INF = 1e15;
  vector<Int> dp(n,INF);
  dp[0]=0;
  for(Int i=0;i<n;i++){
    if(i+1<n) chmin(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
    if(i+2<n) chmin(dp[i+2],dp[i]+abs(h[i]-h[i+2]));
  }
  cout<<dp[n-1]<<endl;
  return 0;
}


Measured memory_bytes: 1792
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numA = nextInt();
		int numB = nextInt();
		int numC = nextInt();

		if (numA <= numC && numC <= numB) {
			out.println("Yes");
		} else if (numB <= numC && numC <= numA) {
			out.println("Yes");
		} else {
			out.println("No");
		}

		out.println("");
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 22612
int main(int argc, const char * argv[]) {
    int a,b,c,tmp;
    scanf("%d %d %d",&a,&b,&c);
    if(1<=a&&a<=10000&&1<=b&&b<=10000&&1<=c&&c<=10000){
        if(a<b){
            tmp=a;
            a=b;
            b=tmp;
        }if(a<c){
            tmp=a;
            a=c;
            c=tmp;
        }if(b<c){
            tmp=b;
            b=c;
            c=tmp;
        }
        printf("%d %d %d\n",c,b,a);
    }
        
    return 0;
}

Measured memory_bytes: 596
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
			var inputNums = IO.ReadLongArray();
			var number = inputNums[0] % inputNums[1];
			var stock = new HashSet<long> { number };
			if(number > 0)
			{
				while(true)
				{
					var checkNumber = Math.Abs(number - inputNums[1]);
					if(stock.Contains(checkNumber)) { break; }
					stock.Add(checkNumber);
				}
			}
			IO.Write(stock.Min());
		}
	}

	public static class IO
	{
		public static string   Read()							   { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')	   { return Read().Split(iSplitter); }
		public static int	   ReadInt()						   { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')  { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()						   { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ') { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()					   { return Read().ToCharArray(); }

		public static void Write(string iValue)			  { Console.WriteLine(iValue); }
		public static void Write(int iValue)			  { Console.WriteLine(iValue); }
		public static void Write(IEnumerable<int> iValue) { Console.WriteLine(string.Join(" " , iValue)); }
		public static void Write(long iValue)			  { Console.WriteLine(iValue); }
		public static void Write(decimal iValue)		  { Console.WriteLine(iValue); }
		public static void Write(bool iValue)			  { Console.WriteLine(iValue ? "Yes" : "No"); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1)	{ return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}

		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    int max = 10000 / 8;
    rep(i, max + 1)
    {
        if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)
        {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main() {
	ll a,b,q; cin>>a>>b>>q;
	vector<ll> s(a), t(b), x(q);
	for (ll i=0; i<a; i++) cin>>s[i];
	for (ll i=0; i<b; i++) cin>>t[i];
	for (ll i=0; i<q; i++) cin>>x[i];
	
	for (ll i : x) {
		vector<ll>::iterator shrine, temple;
		
		ll ans=~(1LL<<63);
		//shrine then temple
		shrine = lower_bound(s.begin(),s.end(),i);
		if (shrine!=s.end()) {
			temple = lower_bound(t.begin(),t.end(),*shrine);
			if (temple!=t.end()) {
				if (abs(i-*shrine) + abs(*shrine-*temple) < ans) {
					ans = abs(i-*shrine) + abs(*shrine-*temple);
					//cout << ' ' << ans << endl;
				}
			}
			if (temple!=t.begin()) {
				temple--;
				if (abs(i-*shrine) + abs(*shrine-*temple) < ans) {
					ans = abs(i-*shrine) + abs(*shrine-*temple);
					//cout << ' ' << ans << endl;
				}
			}
		}

		if (shrine!=s.begin()) {
			shrine--;
			temple = lower_bound(t.begin(),t.end(),*shrine);
			if (temple!=t.end()) {
				if (abs(i-*shrine) + abs(*shrine-*temple) < ans) {
					ans = abs(i-*shrine) + abs(*shrine-*temple);
					//cout << ' ' << ans << endl;
				}
			}
			if (temple!=t.begin()) {
				temple--;
				if (abs(i-*shrine) + abs(*shrine-*temple) < ans) {
					ans = abs(i-*shrine) + abs(*shrine-*temple);
					//cout << ' ' << ans << endl;
				}
			}
		}

		temple = lower_bound(t.begin(),t.end(),i);
		if (temple!=t.end()) {
			shrine = lower_bound(s.begin(),s.end(),*temple);
			if (shrine!=s.end()) {
				if (abs(i-*temple) + abs(*temple-*shrine) < ans) {
					ans = abs(i-*temple) + abs(*temple-*shrine);
					//cout << ' ' << ans << endl;
				}
			}
			if (shrine!=s.begin()) {
				shrine--;
				if (abs(i-*temple) + abs(*temple-*shrine) < ans) {
					ans = abs(i-*temple) + abs(*temple-*shrine);
					//cout << ' ' << ans << endl;
				}
			}
		}

		if (temple!=t.begin()) {
			temple--;
			shrine = lower_bound(s.begin(),s.end(),*temple);
			if (shrine!=s.end()) {
				if (abs(i-*temple) + abs(*temple-*shrine) < ans) {
					ans = abs(i-*temple) + abs(*temple-*shrine);
					//cout << ' ' << ans << endl;
				}
			}
			if (shrine!=s.begin()) {
				shrine--;
				if (abs(i-*temple) + abs(*temple-*shrine) < ans) {
					ans = abs(i-*temple) + abs(*temple-*shrine);
					//cout << ' ' << ans << endl;
				}
			}
		}

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


Measured memory_bytes: 3712
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 2e3 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll sq(ll x) {return (x * x) % MOD;}
ll modP(ll a, ll b) {return (!b ? 1 : (sq(modP(a, b / 2)) * (b % 2 ? a : 1)) % MOD);}

int a[maxN];
vector <int> vec, vec2;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	ll k; cin >> k;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		vec.push_back(a[i]);
	}
	sort(vec.begin(), vec.end());
	vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
	for (int i = 0; i < n; i++){
		a[i] = lower_bound(vec.begin(), vec.end(), a[i]) - vec.begin();
		a[i]++;
		vec2.push_back(a[i]);
	}
	sort(vec2.begin(), vec2.end());
	ll res1 = 0, res2 = 0;
	for (int i = 0; i < n; i++){
		for (int j = i + 1; j < n; j++){
			res1 += (a[i] > a[j]);
		}
	}
	for (int i = 0; i < n; i++){
		res2 += (lower_bound(vec2.begin(), vec2.end(), a[i]) - vec2.begin());
	}
	res1 *= k;
	res1 %= MOD;
	res2 *= ((k * k - k) / 2) % MOD;
	res2 %= MOD;
	cout << (res1 + res2) % MOD << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
int a[SIZE],an[SIZE];
VI e[SIZE];
template <class T>
void maa(T& x,T y){
    if(x<y)x=y;
}
template <class T>
void mii(T& x,T y){
    if(x>y)x=y;
}
void f(int x){
    VI d;
    REP(i,SZ(e[x])){
        f(e[x][i]);
        d.PB(an[e[x][i]]+1);
    }
    sort(ALL(d),greater<int>());
    REP(i,SZ(d)){
        maa(an[x],d[i]+i);
    }
}
int main(){
    DRI(N);
    REPP(i,2,N+1){
        RI(a[i]);
        e[a[i]].PB(i);
    }
    f(1);
    printf("%d\n",an[1]);
    return 0;
}


Measured memory_bytes: 36992
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(){
  int A,B;
  cin >> A;
  cin >> B;
  vector<int> ans{1,2,3};
  auto index1=find(ans.begin(),ans.end(),A);
  ans.erase(index1);
  auto index2=find(ans.begin(),ans.end(),B);
  ans.erase(index2);
  cout << ans[0] << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int,int>P;
typedef long long ll;

int main(){
	int H,W,h,w;cin>>H>>W>>h>>w;
	cout<<H*W-(H*w+W*h-h*w)<<endl;
}

Measured memory_bytes: 256
//デバッグ用オプション：-fsanitize=undefined,address

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//インクルードなど
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

// vector set 等
#include <map>
#include <set>
#include <vector>

//マクロ
// forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
// Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
// FORAは範囲for文(使いにくかったら消す)
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto& i : I)
// xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000  // 10^12:∞
#define MOD 1000000007     // 10^9+7:合同式の法
#define MAXR 100000        // 10^5:配列の最大のrange
//略記
#define PB push_back  //挿入
#define MP make_pair  // pairのコンストラクタ
#define F first       // pairの一つ目の要素
#define S second      // pairの二つ目の要素

// 負の数にも対応した % 演算
ll mod(ll x) {
  ll res = x % MOD;
  if (res < 0) x += MOD;
  return res;
}

/*
ll mpow(ll x, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}*/
ll mpow(ll x, ll y) {
  ll res = 1;
  for (ll i = 0; i < y; i++) {
    res = res * x % MOD;
  }
  return res;
}

// a^{-1} mod を計算する
ll minv(ll a) { return mpow(a, MOD - 2); }

signed main() {
  //入力の高速化用のコード
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  ll n, ans = 0;

  cin >> n;
  ans = mod(mpow(10, n) - mpow(9, n) - mpow(9, n) + mpow(8, n));

  ans = (ans + MOD) % MOD;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#define N 200000
#define SENTINEL 1000000001
long long merge(int[],int,int,int);
long long mergeSort(int[],int,int);
int main(void)
{
  int i;//counter
  int n;//the number of integers
  int arr[N];
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&arr[i]);
  printf("%ld\n",mergeSort(arr,0,n));//mergeSort function returns the total number of inversions
  return 0;
}
long long merge(int arr[],int left,int mid,int right)
{
  long long ret=0;//the number of inversions
  int i,j,k;//counter
  int n1=mid-left;//the number of elements in array l
  int n2=right-mid;//the number of elements in array r
  int *l=(int*)malloc(sizeof(int)*(n1+1));
  int *r=(int*)malloc(sizeof(int)*(n2+1));
  for(i=0;i<n1;i++) l[i]=arr[left+i];
  for(i=0;i<n2;i++) r[i]=arr[mid+i];
  l[n1]=SENTINEL;
  r[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++)
    {
      if(l[i]<=r[j])
        {
          arr[k]=l[i];
          i++;
        }
      else
        {
          arr[k]=r[j];
          j++;
          ret+=n1-i;//add the number of inversions
        }
    }
  free(l);
  free(r);
  return ret;
}
long long mergeSort(int arr[],int left,int right)
{
  int mid;//separate point of array
  long long ret=0;//the number of inversions
  if(left+1<right)
    {
      mid=(left+right)/2;
      ret+=mergeSort(arr,left,mid);
      ret+=mergeSort(arr,mid,right);
      ret+=merge(arr,left,mid,right);
    }
  return ret;
}
void printArray(int arr[],int n)
{
  int i;//counter
  for(i=0;i<n;i++)
    {
      if(i>0) printf(" ");
      printf("%d",arr[i]);
    }
  printf("\n");
}


Measured memory_bytes: 2984
a, b, c = map(int, input().split())
k = int(input())
# c > b > aならyes(k回だけどれかを2倍にできる)
# 何倍すればいいか
cnt = 0
# for i in range(k):
while not(b > a):
    b *= 2
    cnt += 1

while not(c > b):
    c *= 2
    cnt += 1

if cnt > k:
    ans = "No"
else:
    ans = "Yes"
print(ans)
# a_b = 0
# b_c = 0
# if a >= b:
#     if a % b == 0:
#         a_b = a // b 
#     else:
#         a_b = a // b + 1
# print(a_b)
# if a_b != 0:
#     b = b * a_b * 2
# if b >= c:
#     if b % c == 0:
#         b_c = b // c
#     else:
#         b_c = b // c + 1

# if a_b + b_c > k:
#     print("No")
# else:
#     print("Yes")

Measured memory_bytes: 8936
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <numeric>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll HIGHINF = (ll)1e18;
const ll LOWINF = (ll)1e15;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
    string S; cin >> S;
    ll N = S.size();
    ll ans = 0;
    V<ll> pow3(N+10,1),pow2(N+10,1);
   
    for(int i = 1; i < N + 10; ++i) pow3[i] = (pow3[i-1]*3) % MOD;
    for(int i = 1; i < N + 10; ++i) pow2[i] = (pow2[i-1]*2) % MOD;
    
    ll cnt = 0;
    for(int i = 0; i < N; ++i){
        if(S[i]=='1') {
            (ans += (pow2[cnt]*pow3[N - 1 - i]) % MOD ) %= MOD;
            cnt++;
        }
    }
    (ans += pow2[cnt]) %= MOD;
    cout << ans << endl;
    
    
 
    return 0;
}



Measured memory_bytes: 2048
#include<stdio.h>
#include<algorithm>
using namespace std;

struct ss {
	int l, r;
} ba[302020];

bool comp1(const int& x, const int& y){
	if(ba[x].l != ba[y].l) return ba[x].l < ba[y].l;
	return ba[x].r < ba[y].r;
}

bool comp2(const int& x, const int& y){
	return ba[x].r < ba[y].r;
}

int N, M, idx[302020], lmx, chk[302020], rmx;

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<N; i++){
		int s, e;
		scanf("%d%d", &s, &e);
		ba[i].l = s, ba[i].r = M+1-e;
		idx[i]=i;
	}
	sort(idx, idx+N, comp1);
	for(int i=0; i<N; i++){
		if(ba[idx[i]].l >= lmx+1) lmx++, chk[idx[i]]=1;
	}
	sort(idx, idx+N, comp2);
	for(int i=0; i<N; i++){
		if(chk[idx[i]]) continue;
		if(ba[idx[i]].r >= rmx+1) rmx++, chk[idx[i]]=1;
	}

	int dap = lmx+rmx;
	if(dap > M) dap = M;
	printf("%d", max(N-dap,0));
	return 0;
}

Measured memory_bytes: 3840
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,t,e,i,x[100005],dp[100005],ans=0,tr[2][100005],pos;
const ll inf=1e18;
ll lowbit(ll p){return p&-p;}
void modify(ll ty,ll p,ll v)
{
	while(p<=n)
	{
		tr[ty][p]=min(tr[ty][p],v);
		p+=lowbit(p);
	}
}
ll ask(ll ty,ll p)
{
	ll ans=inf;
	while(p)
	{
		ans=min(ans,tr[ty][p]);
		p-=lowbit(p);
	}
	return ans;
}
int main()
{
	scanf("%lld%lld%lld",&n,&e,&t);ans=e;
	for(i=1;i<=n;i++)scanf("%lld",&x[i]),tr[0][i]=tr[1][i]=inf;
	pos=1;
	for(i=1;i<=n;i++)
	{
		dp[i]=dp[i-1]+t;
		while(pos<=n&&2*x[pos]<=2*x[i]-t)pos++; 
		if(pos<i)dp[i]=min(dp[i],t+ask(1,n-pos+1));
		if(pos>1)dp[i]=min(dp[i],2LL*x[i]+ask(0,pos-1));
		modify(0,i,dp[i-1]-2LL*x[i]);
		modify(1,n-i+1,dp[i-1]);
		//printf("%lld")
	}
	printf("%lld\n",ans+dp[n]);
	return 0;	
} 

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007
 
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
 
int lcm(int a, int b) { return a * b / gcd(a, b); }
 
int main(){
    ll n;
    cin >> n;
    ll a[n], b[n+1];

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

    ll ans = 0;
    for (ll i = 0; i < n; i++){
        ans += min(a[i], b[i]);
        ans += min(a[i + 1], b[i] - min(a[i], b[i]));
        a[i + 1] -= (b[i] - min(a[i], b[i]));
        if(a[i+1] <= 0){
            a[i + 1] = 0;
        }
    }

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

Measured memory_bytes: 1792