akhauriyash/Code-Regression huggingface dataset:
//Bismillah Hir Rehmanir Rahim
//Allah knows best
using namespace std;
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#define endl "\n"
#define mini -10000000000000000
#define start ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i, a, n) for( i=a; i<n;i++)
#define ll long long
#define pi 3.141592653589793
#define vi              vector<int>
#define si              set<int>
#define pb              push_back
#define mp              make_pair
#define mod             1000000007
#define rr              return 0
#define ff              first
#define in              insert
#define ss              second
#define setbits(x)      __builtin_popcountll(x)
#define zrbits(x)       __builtin_ctzll(x)
#define deb(x)          cout << #x << " = " << x << endl
int main()
{
    //freopen("in.txt","r",stdin);
    start;
    ll i,j,k,n,m;
    string s;
    cin>>s;
    n=s.size();
    if(s[n-1]=='s') cout<<s<<"es"<<endl;
    else cout<<s<<"s"<<endl;
    rr;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

/*
 * base -2, 1,-2,4,-8,16,-32, ..
 * For any given value x, if x is positive, all positive parts come from
 * even terms; on the other hand, if x is negative, all negative come
 * from the odd terms.
 */

const int inf = 1e9;
const int maxn = 50;
int N, A[maxn]; LL pw[maxn];

void dfs(const LL x)
{
    if (x == 0)
        return;
    int i,j; LL y = 0;
    if (x > 0) {
        i = j = 0;
        while (y < x) {
            j = i; y += pw[i]; i += 2;
        }
    }
    else {
        i = j = 1;
        while (y > x) {
            j = i; y += pw[i]; i += 2;
        }
    }
    /*
     * The j-th term (the last term) must be selected. The smaller terms
     * may not be selected. Also the j-th cannot be reused, because the
     * next time that we encounter a same sign value of x would be a
     * smaller number that cannot reach j.
     */
    A[j] = 1;
    dfs(x-pw[j]);
}

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    pw[0] = 1;
    FOR(i,1,32) {
        pw[i] = pw[i-1] * (-2);
    }
    while (cin >> N) {
        if (N == 0) {
            cout << 0 << endl;
            continue;
        }
        memset(A,0,sizeof(A));
        dfs(N);
        reverse(A,A+maxn);
        int i = 0;
        while (A[i] == 0)
            i++;
        FOR(j,i,maxn)
            cout << A[j];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main() {
  bool result = true;
  int n;
  cin >> n;
  string words[n];
  for(int i = 0; i < n; i++){
  	cin >> words[i];
  }
  for(int i = 0; i < n-1; i++){
  	for(int j = i+1; j < n;j++){
      if(words[i] == words[j]){
      	result = false;
      }
    }
  }
  for(int i = 0; i < n-1; i++){
  	if(words[i][words[i].size() - 1] != words[i + 1][0]){
    	result = false;
    }
  }
	if(result){
    	cout << "Yes"<<endl;
    }else{
    	cout << "No" << endl;
    }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;
const ll INF=1LL<<60;
int main()
{
  ll n,w;
  cin>>n>>w;
  vector<pair<ll,ll>> product(n);
  for(auto&& e: product) 
  {
    cin>>e.first>>e.second;
  }
  vector<vector<ll>> dp(n+1,
    vector<ll>(1e5+1,INF));
  dp[0][0]=0;
  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < 1e5+1; ++j)
    {
      if(j-product[i].second<0) 
      {
        dp[i+1][j]=dp[i][j];
        continue;
      }
      dp[i+1][j]=min(dp[i][j],
        dp[i][j-product[i].second]
        +product[i].first);
    }
  }
  ll ans=0;
  for (ll i = 0; i < dp[n].size(); ++i)
  {
    if(dp[n][i]>w) continue;
    ans=max(ans,i);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 83156
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		if(sc.nextInt()  > sc.nextInt()) pw.print("No");
		else pw.print("Yes");
		pw.close();
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

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

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

Measured memory_bytes: 22996
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
 
//#include <x86intrin.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <stack>
#include <map>
#include <set>
//#include <ordered_set>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
 
//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
     
#define F first
#define S second           
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair                                     
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const ll inf = (ll)1e18 + 1;
 
const double pi = acos (-1.0);
const double eps = 1e-9;                  
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, a[N], l[N], r[N];
stack <int> st;
ll ans;

inline void boost () {
   ios_base :: sync_with_stdio (0);
   cin.tie (0), cout.tie (0);
}
 
inline void Solve () {
   cin >> n;
   for (int i = 1; i <= n; i ++) cin >> a[i];
   for (int i = 1; i <= n; i ++) {
      while (sz (st) && a[st.top ()] >= a[i]) st.pop ();
      if (sz (st)) l[i] = st.top () + 1;
      else l[i] = 1;
      st.push (i);
   }
   st = stack <int> ();
   for (int i = n; i >= 1; i --) {
      while (sz (st) && a[st.top ()] >= a[i]) st.pop ();
      if (sz (st)) r[i] = st.top () - 1;
      else r[i] = n;
      st.push (i);
   }
   for (int i = 1; i <= n; i ++) {
      ans += 1ll * (i - l[i] + 1) * (r[i] - i + 1) * a[i]; 
   }
   cout << ans;

}               
 
signed main () {                                       
   //#ifdef QWERTY
   //   freopen("input", "r", stdin);
   //#endif
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
   //cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}                   

Measured memory_bytes: 3456
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n,mx=0,ans=0;cin>>n;
    for(ll i=0;i<n;i++){
        ll a,b;cin>>a>>b;
        if(a>mx){
            mx=a;
            ans=a+b;
        }
    }
    cout<<ans;
}





Measured memory_bytes: 256
use std::io;

fn main() {
    loop {
        let numbers = input_number();
        let hs = numbers[0] as usize;
        let ws = numbers[1] as usize;
        if hs == 0 && ws == 0 { break }
        for h in 0..hs {
            for w in 0..ws {
                let c = if (h + w)%2 == 0 { "#" } else { "." };
                print!("{}", c);
            }
            println!("");
        }
        println!("");
    }
}

#[allow(dead_code)]
fn input_number() -> Vec<i64> {
    let mut input = String::new();

    io::stdin().read_line(&mut input)
        .expect("Failed to read line");

    let vec: Vec<i64> = input
        .split_whitespace()
        .map(|x| x.parse().unwrap_or(0))
        .collect();
    vec
}



Measured memory_bytes: 5020
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int R, G;
		R = Integer.parseInt(in.readLine());
		G = Integer.parseInt(in.readLine());
		int result = G * 2 - R;
		System.out.println(result);
	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 22996
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n,f=0;
    string str,ns="";
    cin>>n>>str;
    for(auto c:str){
        if(c=='('){
            f++;
        }else{
            if(f!=0){
                f--;
            }else{
                ns+=')';
            }
        }
    }
    for(int i=0;i<ns.length();i++){cout<<'(';}
    cout<<str;
    for(;f--;){cout<<')';}
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll x, y;std::cin >> x >> y;
  ll ans = 0;
  while(x<=y){
    x*=2;
    ans++;
  }
  std::cout << ans << '\n';
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 文字列の入力
            string s = Console.ReadLine();

            string str_Nickname = s.Substring(0, 3);

            Console.WriteLine(str_Nickname);

            Console.Out.Flush();
        }
    }
}


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

using namespace std;

vector<int> num;

int main(){
    int n,sum=0;
    cin >> n;
    for(int i=0; i<n; i++){
        int x;
        cin >> x;
        num.push_back(x);
        sum += x;
    }

    sort(num.begin(), num.end());

    int minn,max;
    minn = num[0];
    max = num[num.size()-1];



    if(max == minn){
        cout << 0;
        return 0;
    }

    int result = 0;
    int mid = ceil((double)(sum)/n);

    for(int i=0; i<num.size(); i++){
        result += ((mid-num[i])*(mid-num[i]));
    }

    int result2 = 0;
    mid = floor((double)(sum)/n);
    for(int i=0; i<num.size(); i++){
        result2 += ((mid-num[i])*(mid-num[i]));
    }


    cout << (min(result,result2));

}






Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; cin >> N;
    VI A(N);
    int sum = 0;
    REP(i,N) {
        cin >> A[i];
        sum ^= A[i];
    }
    REP(i,N){
        cout << (A[i] ^ sum) << " ";
    }
    cout << endl;

}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937 rnd;
#define F first
#define S second
#define pb push_back
#define pii pair<int,int>

void lcs( char *X, char *Y, int m, int n )  {
   int L[m+1][n+1];

   /* Following steps build L[m+1][n+1] in bottom up fashion. Note
      that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
   for (int i=0; i<=m; i++)
   {
     for (int j=0; j<=n; j++)
     {
       if (i == 0 || j == 0)
         L[i][j] = 0;
       else if (X[i-1] == Y[j-1])
         L[i][j] = L[i-1][j-1] + 1;
       else
         L[i][j] = max(L[i-1][j], L[i][j-1]);
     }
   }

   // Following code is used to print LCS
   int index = L[m][n];

   // Create a character array to store the lcs string
   char lcs[index+1]={};// Set the terminating character

   // Start from the right-most-bottom-most corner and
   // one by one store characters in lcs[]
   int i = m, j = n;
   while (i > 0 && j > 0)
   {
      // If current character in X[] and Y are same, then
      // current character is part of LCS
      if (X[i-1] == Y[j-1])
      {
          lcs[index-1] = X[i-1]; // Put current character in result
          i--; j--; index--;     // reduce values of i, j and index
      }

      // If not same, then find the larger of two and
      // go in the direction of larger value
      else if (L[i-1][j] > L[i][j-1])
         i--;
      else
         j--;
   }

   // Print the lcs
   cout << lcs;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif // LOCAL
    string s,t;
    cin >> s;
    cin >> t;
    int n = s.size(), m = t.size();
    char a[n], b[m];
    for (int i=0; i<n; i++) a[i] = s[i];
    for (int i=0; i<m; i++) b[i] = t[i];
    lcs(a,b,n,m);
    return 0;
}


Measured memory_bytes: 35456
import java.util.Scanner;

public class Main {
	private static Scanner scan;
	public static void main(String[] args) {
		scan = new Scanner(System.in);
		String str = scan.next();
		int l = str.length();
		String rts ="";
		for(int i = l -1;i >= 0 ;i--){
			rts = rts + str.charAt(i);
		}
		System.out.println(rts);
		System.exit(0);
	}
}

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

int main() {
  long long N, M, a;
  cin >> N;
  M = N;
  while(N != 0) {
    a += N%10; 
    N = N/10;
  }
  if(M%a == 0) {
    cout<< "Yes" <<endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>    
#include <unordered_map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cerr<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define endl "\n"
#define fo(i,n) for(int i=0;i<n;i++)
#define foo(i,x,n) for(int i=x;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define w(x) int x;cin>>x;while(x--)
#define display(a,n) {fo(i,n) {cout<<a[i]<<" ";}cout<<endl;}
#define fil(a,n,val) {fo(i,n) a[i]=val; }
const ll MOD   = 1000*1000*1000+7;
const ll MOD2  = 998244353;
const ll N = 1000*1000+5;
const double PI  = 3.14159265;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
ll search(vl arr, ll l, ll r, ll x){if (r >= l) {ll mid = l + (r - l) / 2;if (arr[mid] == x)return mid;if (arr[mid] > x)return search(arr, l, mid - 1, x);return search(arr, mid + 1, r, x);} return -1;}
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll lcm(ll a , ll b){return (a*b)/ gcd(a,b);}
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){ if (y & 1) res = (res*x) % p; y = y>>1;x = (x*x) % p; } return res; }
ll modInverse(ll n, ll p){return power(n, p-2, p);}
const int maxn=3e5+5;

int main(){
	fastio();
	int n,m;
	cin>>n>>m;
	ll dp[n][m];
	char c;
	fo(i,n){
		fo(j,m){
			cin>>c;
			if(c=='#')
				dp[i][j]=-1;
			else
				dp[i][j]=0;
		}
	}

	fo(i,n){
		if(dp[i][0]==-1)
			break;
		dp[i][0]=1;
	}

	fo(j,m){
		if(dp[0][j]==-1)
			break;
		dp[0][j]=1;
	}

	foo(i,1,n){
		foo(j,1,m){
			if(dp[i][j]==-1)
				continue;
			if(dp[i-1][j]!=-1)
				dp[i][j]=(dp[i][j]+dp[i-1][j])%MOD;
			if(dp[i][j-1]!=-1)
				dp[i][j]=(dp[i][j]+dp[i][j-1])%MOD;
		}
	}
	cout<<dp[n-1][m-1]<<endl;
}

Measured memory_bytes: 11432
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

#define ll long long
const long long llINF = 1LL << 60;
const int iINF = 0x20000000;
template<class T> inline bool chmin(T& a, T b) { if (b < a) { 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; }

void execute();
int main() 
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);// cin と scanfの併用禁止
    cout << fixed << setprecision(15);
    execute();
    return 0;
}


void execute()
{
    ll N;
    cin >> N;


    ll ref = 26;
    ll order = 1;
    ll n = N-1;
    while(ref <= n){
        n -= ref;
        ref *= 26;
        order++;
    }

    char val[11];
    for(int i = 0; i < order; i++){
        val[order - i - 1] = (char)('a'+(n % 26));
        n /= 26;
    }
    
    for(int i = 0; i < order; i++){
        cout << val[i];
    }
    cout << endl; 
}


Measured memory_bytes: 3636
#include<stdio.h>
int main(){

  int k;
  int r;
  int ans;
  scanf("%d",&k);

  if(k%2==0){
    ans=(k/2)*(k/2);
  }else{
    r=(k/2)+1;
    ans=(k/2)*r;
  }
  printf("%d",ans);

  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, int num=0){
  if(num == 0) num = (int)v.size();
  if(is_reverse) for(int i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<" ";}
  else for(int i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<" ";}
  cout << endl;
}

template <typename T>
void print_pairvec(const vector<T> &v, int num=0){
  if(num == 0) num = (int)v.size();
  cout << endl;
  for(int i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
}


template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

struct Eratosthenes{
	vector<ll> sieve;// sieve[i]: 数字iがエラトスとネスで篩落とされた時の素数

	Eratosthenes(ll n): sieve(n+1){
		for(int i=0; i<=n; i++) sieve[i] = i;
		for(ll i=2; i*i<=n; i++){
			if(sieve[i] < i) continue;//すでに篩落とされているならcontinue
			for(int j=i*i; j<=n; j+=i) sieve[j] = min(sieve[j], i);
		}
	}

	vector<ll> prime_divisors(ll x, bool tmp=false){
		vector<ll> res(1, 1); //back()のところで ひっかかるので1を入れておく
		while(x > 1){
			if(res.back() != sieve[x]) res.push_back(sieve[x]);
			x /= sieve[x];
		}
		return res;
	}

	map<ll, int> prime_divisors(ll x, int tmp=0){
		map<ll, int> mp;
		while(x > 1){
			mp[sieve[x]]++;
			x /= sieve[x];
		}
		return mp;
	}
};

ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
int main(){
	int N;
	cin >> N;
	vector<ll> A(N);
	for(int i=0; i<N; i++) cin >> A[i];
	
	ll g = A[0];
	for(int i=1; i<N; i++) g = gcd(g, A[i]);
	if(g != 1){
		cout << "not coprime" << endl;
		return 0;
	}

	const int INF = 1e6;
	Eratosthenes era(INF);
	map<ll, int> mp;
	for(int i=0; i<N; i++){
		vector<ll> vec = era.prime_divisors(A[i], false);
		for(ll prime : vec){
			if(prime == 1) continue;
			if(mp[prime] != 0){
				cout << "setwise coprime" << endl;
				return 0;
			}
			mp[prime]++;
		}
	}
	cout << "pairwise coprime" << endl;
	return 0;
}



Measured memory_bytes: 18836
// https://atcoder.jp/contests/abc149/tasks/abc149_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  ll A, B, K;
  cin >> A >> B >> K;

  ll a_eat = min(A, K);
  ll a_res = A - a_eat;

  ll b_eat = min(B, K - a_eat);
  ll b_res = B - b_eat;

  cout << a_res << " " << b_res << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } 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; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    int A,B,M;
    cin>>A>>B>>M;
    vector<int>a(A),b(B);
    int s=INF,t=INF;
    REP(i,A) {
        cin>>a[i];
        chmin(s,a[i]);
    }
    REP(i,B) {
        cin>>b[i];
        chmin(t,b[i]);
    }
    int cnt=s+t;
    for (int i = 0; i < M; i++)
    {
    int x,y,c;
    cin>>x>>y>>c;
    x--,y--;
    chmin(cnt,a[x]+b[y]-c);
    }
    cout<<cnt<<endl;
    
    return 0;
}

Measured memory_bytes: 1920
import fractions
A, B, C, D = map(int, input().split())

def divisor(x, c, d):
    cd = c * d // fractions.gcd(c, d) 
    ans = x - (x // c + x // d - x // cd)
    return ans

B_divisor = divisor(B, C, D)
A_divisor = divisor(A-1, C, D)
print(B_divisor-A_divisor)


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

int solve(int e){
    // int x,y,z;
    int m = INT_MAX;
    for(int y = 0; y<= 1000; y++){
        for(int z = 0; z <= 1000; z++){
            if((z*z*z + y*y) <= e) {
                int x = e - z*z*z -y*y;
                m=min(m, z+y+x);
            }
        }
    }
    return m;
}

int main(void){
    int e;
    vector<int>ans;
    while(1){
        cin>>e;
        if(e==0)break;
        ans.push_back(solve(e));
    }
    for(int m: ans)cout<< m <<endl;
}




Measured memory_bytes: 3112
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
using ll = long long;

ll lcm (ll a, ll b) {
	ll x = a*b;
	if (a < b) {
		swap(a,b);
	}
	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return x/b; 
}

int main() {
	ll N;
	cin >> N;
	vector<ll> a(N);
	for (ll i=0;i<N;++i) cin >> a[i];
	/*
	// 最小公倍数-1が存在するならば, sum(a[i]-1) が解
	// 存在する.
	ll res = a[0];
	for (ll i=1;i<N;++i) {
		res = lcm (res, a[i]);
	}
	cout << res - 1 << endl;
	*/
	ll sum = 0;
	for (ll i=0;i<N;++i) {
		sum += a[i]-1;
	}
	cout << sum << endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define brep(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define orep(i, n) for (int i =  1; i <= (int)n; i++)
#define vec vector
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define ll long long

vec<int> dp;
vec<vec<int>> road;

void bfs(int p)
{
	dp[p] = 1;
	rep(i, road[p].size()) {
		if (dp[road[p][i]]) continue;
		bfs(road[p][i]);
	}
}

int main(void)
{
	int n, m;
	cin >> n >> m;
	vec<vec<int>> lang(m);
	vec<vec<int>> input(n);
	rep(i, n) {
		int k;
		cin >> k;
		input[i].resize(k);
		rep(j, k) {
			int get;
			cin >> get;
			get--;
			lang[get].pb(i);
			input[i][j] = get;
		}
	}
	dp.resize(n);
	rep(i, n) dp[i] = 0;
	road.resize(n);
	rep(i, m) {
		if (lang[i].empty()) continue;
		int keep = lang[i][0];
		orep(j, lang[i].size() - 1) {
			road[keep].pb(lang[i][j]);
			road[lang[i][j]].pb(keep);
		}
	}
	rep(i, n) {
		rep(j, input[i].size()) {
			road[i].pb(lang[input[i][j]][0]);
			road[lang[input[i][j]][0]].pb(i);
		}
	}

	bfs(0);
	int flag = 1;
	rep(i, n) if (!dp[i]) flag = 0;
	if (flag) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}


Measured memory_bytes: 15352
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int q = Integer.parseInt(st.nextToken());
        int h = Integer.parseInt(st.nextToken());
        int s = Integer.parseInt(st.nextToken());
        int d = Integer.parseInt(st.nextToken());
        int n = Integer.parseInt(br.readLine());
        int min = Math.min(Math.min(8*q, 4*h), Math.min(2*s, d));
        if((n & 1) == 0){
            System.out.println((n / 2) *1L* min);
            return;
    }
        long ans = (n / 2) *1L* min;
        ans += Math.min(4*q, Math.min(2*h, s));
        System.out.println(ans);
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
const long long MOD = 1000000007, INF = 1e18;
/*
#define endl '\n'
#define IOS()                     \
	ios_base::sync_with_stdio(0); \
	cin.tie(0)
*/
string get_str(string s)
{
	s += ',';
	string ret = "";
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == ',')
			ret += "=%ld, ";
		else
			ret += s[i];
	}
	return ret;
}
#define dump(...)                                       \
	printf(get_str(#__VA_ARGS__).c_str(), __VA_ARGS__); \
	cout << endl
//******************************************************************************

int N;

signed main()
{
	cin >> N;
	vector<int> v(N), c(N);
	for (int i = 0; i < N; i++)
	{
		cin >> v[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> c[i];
	}
	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		if (v[i] > c[i])
			ans += v[i] - c[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,m;cin>>n>>m;
    double a[n];
    rep(i,0,n)cin>>a[i];
    priority_queue<double> q;
    rep(i,0,n)q.push(a[i]);
    rep(i,0,m){
        double now=q.top();q.pop();
        now/=2.0;
        q.push(now);
    }
    ll ans=0;
    rep(i,0,n){
        double y=q.top();q.pop();
        ll t=y;
        ans+=t;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2168
n = int(input())
s = list(input())
lst_26 = [(chr(ord("a") + i)).upper() for i in range(26)]

for i in range(len(s)):
    if lst_26.index(s[i])+n >= 26:
        s[i] = lst_26[lst_26.index(s[i])+n-26]
    else:
        s[i] = lst_26[lst_26.index(s[i])+n]
print("".join(s))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;
	string s;
	cin>>a>>b;
	cin>>s;
	for(int i=0;i<a+b+1;i++){
		if(i==a){
			if(s[i]!='-'){
				cout<<"No";
				return 0;
			}
		}	
		else{
			if(48<=s[i] and s[i]<=57){
				continue;
		   	}
			else{
				cout<<"No";
				return 0;
			}
		}
	} 
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define endl '\n'
#define y1 holyshit
#define all(x) x.begin(),x.end()
const int inf=0x3f3f3f3f;

int H,W,Ch,Cw,Dh,Dw,dist[1010][1010];
string grid[1010];
deque<pii> dq;
int dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin>>H>>W>>Ch>>Cw>>Dh>>Dw;
	for(int i=1;i<=H;i++) cin>>grid[i], grid[i].insert(0,"#");
	memset(dist,inf,sizeof(dist));
	dist[Ch][Cw]=0; dq.push_back({Ch,Cw});
	while(!dq.empty()){
		int x=dq.front().fi,y=dq.front().se; dq.pop_front();
		for(int i=0;i<4;i++){
			int nx=x+dx[i],ny=y+dy[i];
			if(nx<1||nx>H||ny<1||ny>W) continue;
			if(grid[nx][ny]=='#') continue;
			if(dist[nx][ny]<=dist[x][y]) continue;
			dist[nx][ny]=dist[x][y];
			dq.push_front({nx,ny});
		}
		for(int i=max(1,x-2);i<=min(H,x+2);i++) for(int j=max(1,y-2);j<=min(W,y+2);j++){
			if(grid[i][j]=='#') continue;
			if(dist[i][j]<=dist[x][y]+1) continue;
			dist[i][j]=dist[x][y]+1;
			dq.push_back({i,j});
		}
	}
	if(dist[Dh][Dw]>=inf) cout<<-1;
	else cout<<dist[Dh][Dw];
	return 0;
}

Measured memory_bytes: 9676
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]

ans = 2000

for i in range(2 ** D):
    tmp = 0
    max_ = -1
    count = 0
    for j in range(D):
        if (i >> j) & 1 == 1:
            tmp += pc[j][0] * 100 * (j + 1) + pc[j][1]
            count += pc[j][0]
        else:
            max_ = j
    if tmp < G:
        if max_ >= 0:
            for j in range(pc[max_][0]):
                tmp += 100 * (max_ + 1)
                count += 1
                if tmp >= G:
                    break
    if tmp >= G:
        ans = min(ans, count)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  string s;
  cin >> s;

  int N = s.size();

  int ans = INF;
  REP(i, N-2){
    int ret = stoi(s.substr(i, 3));
    chmin(ans, abs(753-ret));
  }

  cout << ans << "\n";

  return 0;
}

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

using namespace std;

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

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vector<ll> a(n); cin >> a;
    vector<ll> a0 = a;
    sort(all(a));
    map<ll, ll> ans;
    rep(i, n/2) {
        ans[a[i]] = a[n/2];
    }
    rep(i, n/2, n) {
        ans[a[i]] = a[n/2-1];
    }
    rep(i, n) {
        cout << ans[a0[i]] << endl;
    }
}


Measured memory_bytes: 17536
def island_war():
    N, M = [int(i) for i in input().split()]
    data_ls = list()
    for i in range(M):
        data_ls.append([int(i) for i in input().split()])
    data_ls = sorted(data_ls, key=lambda x: x[1])
    drop_ls = list()
    cnt = 0
    while True:
        bridge = data_ls[0][1] - 1
        drop_ls.append(bridge)
        cnt += 1
        for ind, i in enumerate(data_ls):
            if i[0] <= bridge < i[1]:
                pass
            else:
                break
            if ind == len(data_ls) - 1:
                return cnt
        data_ls = data_ls[ind:]


print(island_war())

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;


const ll INF = (ll)1e18;

ll mabs(ll a) {
    return a > 0 ? a : -a;
}

ll go(ll x, ll y) {
    if (x <= y)
        return y - x;
    return INF;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    ll x, y;
    cin >> x >> y;
    if (y == 0) {
        if (x < 0) {
            cout << mabs(x) << endl;
            return 0;
        }
        else {
            cout << mabs(x) + 1 << endl;
            return 0;
        }
    }
    ll res = INF;
    for (int s1 = 0; s1 < 2; s1++)
        for (int s2 = 0; s2 < 2; s2++) {
            ll curx = x;
            ll cury = y;
            ll cur = 0;
            if (s1) {
                curx = -curx;
                cur++;
            }      
            if (s2) {
                cury = -cury;
                cur++;
            }
            cur += go(curx, cury);
            res = min(res, cur);              
        }
    cout << res << endl;
}       

Measured memory_bytes: 764
#include<bits/stdc++.h>
#define xiu return
#define fr(i,a,b) for(ll i=a;i<=b;++i)
#define pr(i,a,b) for(ll i=a;i>=b;--i)
#define fh(i,a,b) for(ll i=head[a],b=e[i].to;i;i=e[i].last,b=e[i].to)
#define fn(i,a,b) for(ll i=h[a],b=q[i].to;i;i=q[i].last,b=q[i].to)
#define mem(a,b) memset(a,b,sizeof(a))
#define mp(a,b) make_pair(a,b)
using namespace std;
typedef long long ll;typedef double lf;
void read(ll &w){
	w=0;ll f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)){(w*=10)+=ch-'0';ch=getchar();}
	w*=f;
}
const ll N = 45,M = 1<<18,mod = 1e9+7;
ll n,x,y,z,end,sum,dp[N][M],ans=1;
int main(){
	read(n);read(x);read(y);read(z);
	mem(dp,0);end=1<<(x+y+z-1);end|=1<<(y+z-1);
	end|=1<<(z-1);sum=(1<<(x+y+z))-1;dp[0][0]=1;
	fr(i,1,n){
		ans*=10;ans%=mod;
		fr(j,0,sum){
			if(dp[i-1][j]==0) continue;
			fr(k,1,10){
				int now=(j<<k)|(1<<(k-1));
				now&=sum;
				if((now&end)!=end) dp[i][now]=(dp[i][now]+dp[i-1][j])%mod;
			}
		}
	}
	fr(i,0,sum) ans=(ans-dp[n][i]+mod)%mod;
	printf("%lld\n",ans);
	xiu 0;
}

Measured memory_bytes: 92544
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

int main() {

	int M;
	cin >> M;

	unsigned long long int ans = 0, sum = 0;

	for (int i = 0; i < M; i++) {
		long long c, d;
		cin >> d >> c;
		ans += c;
		sum += d * c;
	}
	ans--;

	ans += (sum - 1) / 9;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0))
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0))
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a))
#define Reverse(a) reverse(All(a))
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define Lower(a,t) lower_bound(All(a),t)
using namespace std;
int max_int = 1000000007;
void Debug(auto a);
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


signed main(){
    int n;
    cin >> n;
    int tall = 0;
    int ans = 1;
    REP(i,n){
        int t;
        cin >> t;
        if(i==0){
            tall = t;
        }
        else{
            if(tall <= t){
                ans++;
                tall = t;
            }
        }
    }
    cout << ans << endl;

    return 0;
}



void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}


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

struct Kukan{
    int n;
    int l, r;
    bool operator<(const Kukan& right) const {
        return r < right.r;
    }
};

int main(void){
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> nums(n), anss(q);
    vector<Kukan> kukans(m), queries(q);
    for(int i = 0; i < m; i ++){
        cin >> kukans[i].l >> kukans[i].r;
    }
    for(int i = 0; i < q; i ++){
        queries[i].n = i;
        cin >> queries[i].l >> queries[i].r;
    }
    sort(kukans.begin(), kukans.end());
    sort(queries.begin(), queries.end());
    
    int ik = 0, iq = 0;
    for(int k = 0; k < n; k ++){
        // train
        for(ik; kukans[ik].r-1 == k; ik ++){
            nums[kukans[ik].l-1] ++;
        }
        // query
        for(iq; queries[iq].r-1 == k; iq ++){
            for(int j = queries[iq].l-1; j < queries[iq].r; j ++){
                anss[queries[iq].n] += nums[j];
            }
        }
    }
    
    for(int i = 0; i < q; i ++){
        cout << anss[i] << "\n";
    }
}


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

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

  for (int i4 = 0; i4 <= n; ) {
    for (int j7 = 0; j7 <= n; ) {
      if (i4+j7 == n|| i4 == n || j7 == n) {
        printf("Yes");
        return 0;
      }
      j7 = j7+7;
    }
    i4 = i4 + 4;
  }
  printf("No");

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var inputs = Console.ReadLine().Split(' ').ToList();
            if(inputs.Any(s => s == "Y"))
            {
                Console.WriteLine("Four");
            }
            else
            {
                Console.WriteLine("Three");
            }
        }
    }
}

Measured memory_bytes: 13268