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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, M, C;
	cin >> N >> M >> C;
	vector<int64> B(M);
	REP(i, M) cin >> B[i];
	int64 res = 0;
	REP(i, N) {
		int64 sum = 0;
		REP(j, M) {
			int64 a;
			cin >> a;
			sum += a*B[j];
		}
		sum += C;
		res += sum > 0;
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll fac[200005];
ll rfac[200005];

ll f(ll a, ll x) {
  ll res = 1;
  while(x > 0) {
    if(x & 1) res = res * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return res;
}

ll nCr(ll n, ll r) {
  ll R = r;
  ll NR = n-r;
  if(R < NR) swap(R,NR);
  ll res = 1;
  for(ll i = n; i > R; i--) {
    res = res * i % mod;
  }
  return res * rfac[NR] % mod;
}
  


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

  fac[0] = rfac[0] = 1;
  for(ll i = 1; i < 200005; i++) {
    fac[i] = fac[i-1] * i % mod;
    rfac[i] = f(fac[i],mod-2);
  }

  cout << (f(2,n) - 1 + mod - nCr(n,a) + mod - nCr(n,b) + mod) % mod << endl;

}




  


Measured memory_bytes: 3328
n = int(input())
a = list(map(int,input().split())) # len: n+1
b = list(map(int,input().split())) # len: n
mons = 0
for i in range(n):
    if b[i] >= a[i]+a[i+1]:
        mons += a[i]+a[i+1]
        a[i+1] = 0
    elif b[i] >= a[i]:
        mons += b[i]
        a[i+1] -= b[i]-a[i]
    else:
        mons += b[i]
print(mons)
    
    

Measured memory_bytes: 18624
#include<stdio.h>
int a[9];
int main()
{

    int i,j,t;
    for(i=1;i<=3;i++)
    {
        scanf("%d",&a[i]);
    }
    for(i=1;i<=3;i++)
    {
        for(j=i+1;j<=3;j++)
        {
            if(a[i]>a[j])
               {
                   t=a[i];
                   a[i]=a[j];
                   a[j]=t;
               }

        }
    }
    printf("%d\n",a[1]+a[2]);
}


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

int main() {
  string s;
  cin >> s;
  string ans;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      ans += '0';
    }
    else if (s[i] == '1') {
      ans += '1';
    }
    else if (s[i] == 'B') {
      if (ans.size() != 0) {
        ans.erase(ans.size()-1);
      }
    }
  }
  cout << ans << endl;
}

             

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

#define say(obj) (cout << obj << endl)
#define endline (cout << endl)
#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template <typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const vector<vector<T>>& mat) {
	for (const vector<T>& m : mat) os << m << endl;
	return os;
}

template <typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template <typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	int N;
	cin >> N;
	vpii AB(N);
	cin >> AB;

	sortall(AB);

	say(AB[N - 1].first + AB[N - 1].second);

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>

using namespace std;

#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);

#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)

#define MODE 0
#define DEB(X) if(MODE)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(MODE)cout<<X<<" ";
#define ARDEB(i,X) if(MODE)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) if(MODE){(f)? cout<<"true ":cout<<"false ";}
#define FORDEB(n,X) if(MODE)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(MODE)cout<<endl;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
struct P2{int x,y;};
//struct edge{int from,cost,to;};
#define Endl endl
#define MAX_V 1010

const int MOD7=1000000007;
const int INF=100000000;

void BFS(){
	
}

int main(){
	ull a,b,x;
	cin>>a>>b>>x;
	if(a!=0){
		cout<<b/x-((a-1)/x)<<endl;
	}
	else{
		cout<<b/x+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define MAX 100

int main(){
    int n;
    int t_point=0, h_point=0;
    char tarou[MAX], hanako[MAX];

    scanf("%d", &n);
    for(;n>0;n--){
        scanf(" %s %s", tarou, hanako);
        if(strcmp(tarou, hanako)>0){
            t_point+=3;
        }else if(strcmp(tarou, hanako)==0){
            t_point+=1;
            h_point+=1;
        }else if(strcmp(tarou, hanako)<0){
            h_point+=3;
        }
    }
    printf("%d %d\n", t_point, h_point);

    return 0;
}

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

int main()
{
    ll N,K;cin >> N >>K;
    vector<ll> P(N);
    vector<ll> C(N);
    for (int i=0;i<N;i++)
    {
        cin >> P[i];
    }
    for (int i=0;i<N;i++)
    {
        cin >> C[i];
    }
    vector<vector<ll>> score(N+1,vector<ll>(N+1,-INF));
    vector<pair<ll,ll>> loop(N+1,make_pair(0,0));
    for (int start=1;start<N+1;start++)
    {
    score[start][0]=0;
    ll now=start;
    for (int i=1;i<N+1;i++)
    {
        score[start][i]=score[start][i-1]+C[P[now-1]-1];
        now=P[now-1];
        if (start==now)
        {
            loop[start].first=score[start][i];
            //cout << score[start][i] << endl;
            loop[start].second=i;
            break;
        }
    }
    }
    ll ans=-INF;
    for (int i=1;i<N+1;i++)
    {
    if (loop[i].first>0)
    {
        ll time=K/loop[i].second;
        ll now=loop[i].first*time;
        ll last=K%loop[i].second;
        ll max_score=-INF;
        ll max_score1=-INF;
        if (time==0)
        {
            for (int j=1;j<=last;j++)
            {
                max_score=max(max_score,score[i][j]);
            }
            now=now+max_score;
        }
        else
        {
            ll now1=loop[i].first*(time-1);
            for (int j=1;j<=loop[i].second;j++)
            {
                max_score=max(max_score,score[i][j]);
            }
            now1=now1+max_score;
            for (int j=0;j<=last;j++)
            {
                max_score1=max(max_score1,score[i][j]);
            }
            now=now+max_score1;
            now=max(now1,now);
        }
        if (now>ans){
            ans=now;
        }
    }
    else{
        ll now=-INF;
        for (int j=1;j<=min(loop[i].second,K);j++)
        {
            now=max(now,score[i][j]);
        }
        if (now>ans){
            ans=now;
        }
    }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 199144
#include<bits/stdc++.h>
#define REP(i,n) for(int i=1;i<n;i++)
using namespace std;
int main() {
   cin.tie(0);
   ios::sync_with_stdio(false);
   int n; cin >> n;
   int ans = 0;
   for(int i = 1;i <= n;i++) {
       if(i%2==0) {
    
       } else {
           int count = 0;
           for(int j = 1;j <= n;j++) {
               if(i%j==0) count++;
           }
           if(count==8) {
               ans++;
           }
       }
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF_LL 10000000000000000
#define INF 200000000
#define MOD 1000000007
#define ll long long
#define all(x) x.begin(), x.end()
#define REP(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
// typedef float double;
// typedef priority_queue prique;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<ll> vl;
typedef vector<vi> matrix;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int sign[2] = {1, -1};
template <class T> bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll b, ll m) {
    if(b == 0)
        return 1;
    ll t = modpow(a, b / 2, m);
    if(b & 1) {
        return (t * t % m) * a % m;
    } else {
        return t * t % m;
    }
}
struct edge {
    int to;
    ll cost;
    edge(int t, ll c) { to = t, cost = c; }
};

int main() {
    int n, q;
    string s;
    cin >> n >> s >> q;
    vl d(n + 1), m(n + 1), c(n + 1);
    rep(i, n) {
        d[i + 1] += d[i];
        m[i + 1] += m[i];
        c[i + 1] += c[i];
        if(s[i] == 'D') {
            d[i + 1]++;
        } else if(s[i] == 'M') {
            m[i + 1]++;
        } else if(s[i] == 'C') {
            c[i + 1]++;
        }
    }
    rep(_, q) {
        ll res = 0;
        int k;
        cin >> k;
        rep(i, n) {
            if(s[i] == 'D') {
                res -= (c[min(n, i + k)] - c[i]) * m[i];
            } else if(s[i] == 'C') {
                res += (d[i] - d[max(0, i - k + 1)]) * m[i];
            }
        }
        cout << res << endl;
    }
}


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

void print(string str, int a, int b)
{
    cout << str.substr(a, b - a + 1) << endl;
}

string reverse(string str, int a, int b)
{
    string left = str.substr(0, a);
    string middle = str.substr(a, b - a + 1);
    string right = str.substr(b + 1);

    reverse(middle.begin(), middle.end());

    return left + middle + right;
}

string replace(string str, int a, int b, string p)
{
    string left = str.substr(0, a);
    string middle = str.substr(a, b - a + 1);
    string right = str.substr(b + 1);

    return left + p + right;
}

int main()
{
    string str, func;
    int n;

    cin >> str >> n;

    for (int i = 0; i < n; i++) {
        cin >> func;

        if (!func.compare("reverse")) {
            int a, b;

            cin >> a >> b;

            str = reverse(str, a, b);
        } else if (!func.compare("replace")) {
            int a, b;
            string s;

            cin >> a >> b >> s;

            str = replace(str, a, b, s);
        } else if (!func.compare("print")) {
            int a, b;

            cin >> a >> b;

            print(str, a, b);
        }
    }

    return 0;
}

Measured memory_bytes: 1228
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int k = sc.nextInt();
        char[][] map = new char[h][w];
        int total = 0;
        for(int i = 0; i < h; i++){
            map[i] = sc.next().toCharArray();
        }
        int ans = 0;
        for(int i = 0; i < (1 << h); i++){
            for(int j = 0; j < (1 << w); j++){
                int tmp = 0;
                for(int i2 = 0; i2 < h; i2++){
                    if((i >> i2) % 2 == 1){
                        for(int j2 = 0; j2 < w; j2++){
                            if((i >> i2) % 2 == 1){
                                if((j >> j2) % 2 == 1 && map[i2][j2] == '#'){
                                    tmp++;
                                }
                            }
                        }
                    }
                }
                if(tmp == k){
                    ans++;
                }
            }
        }
        System.out.println(ans);
    }
    
}

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 String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    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: 26024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] == 'L') {
			cout << "No" << endl;
			return 0;
		}
	}
	for (int i = 1; i < s.size(); i += 2) {
		if (s[i] == 'R') {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  unordered_map<char, int> mp;
  cin >> n;
  REP(i,n){
    char c;
    cin >> c;
    mp[c]++;
  }
  cout << ((int)mp.size()==3 ? "Three" : "Four") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    const long long INF=1000000000000000ll;
     
    int main()
    {
      int n,K;
      scanf("%d%d",&n,&K);
      vector<int> C(n);
      vector<long long> V(n);
      for(int i=0;i<n;i++){
        scanf("%d%lld",&C[i],&V[i]);
        C[i]--;
      }
      vector<vector<long long> > CV(K);
      for(int i=0;i<n;i++){
        CV[C[i]].push_back(V[i]);
      }
      ////////////////////////////////////////
      vector<pair<long long,int> > V2(K+1);
      multiset<long long> V3;
      for(int j=0;j<K;j++){
        sort(CV[j].begin(),CV[j].end(),greater<long long>());
        V2[j]=make_pair(CV[j][0]+CV[j][1],j);
        if(CV[j].size()>=3){
          V3.insert(CV[j][0]+CV[j][1]+CV[j][2]);
        }
      }
      ////////////////////////////
      V2[K]=make_pair(-INF,-1);
      V3.insert(-INF);
      sort(V2.begin(),V2.end(),greater<pair<long long,int> >());
      multiset<long long> S;
      S.insert(-INF);
      long long S1=INF,S2=INF;
      vector<long long> ans(n+1);
      ans[0]=0;
      ///////////
      for(int i=0,j=0;i<n;){
        int k=V2[j].second;
        long long s1=*S.rbegin(),s2=V2[j].first;
        if(2*s1>=s2){
          ans[i+1]=ans[i]+s1;
          S1=s1;
          S.erase(S.find(s1));
          i++;
        }
        else{
          ans[i+1]=max(-1ll,max(ans[i]+s1,max(ans[i]-S1+s2,ans[i]-S2+*V3.rbegin())));
          ans[i+2]=ans[i]+s2;
          S2=s2;
          for(int t=2;t<CV[k].size();t++){
    	S.insert(CV[k][t]);
          }
          if(CV[k].size()>=3){
    	V3.erase(V3.find(CV[k][0]+CV[k][1]+CV[k][2]));
          }
          i+=2;
          j++;
        }
      }
      ////////////////////////////////////////////
      for(int i=1;i<=n;i++){
        printf("%lld\n",ans[i]);
      }
      return 0;
    }

Measured memory_bytes: 18688
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let mut V = Vec::<i64>::new();
    let mut A = 0;
    let mut B = 0;

    for index in 0..N {
        let c: i64 = read();
        V.push(c);
    }

    V.sort_by(|x, y| y.cmp(x));

    for (i, &v) in V.iter().enumerate() {
        if i % 2 == 0 {
            A += v;
        } else {
            B += v;
        }
    }

    println!("{}", A - B);
}


Measured memory_bytes: 4352
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

double f(double y, double r) {
  return 1 + y * r / 100;
}

double g(double y, double r) {
  return pow((1 + r / 100), y);
}

void solve() {
  int n;
  while (cin >> n, n) {
    double y;
    cin >> y;
    double maxInterest = -INF;
    int bestBank;
    while (n--) {
      int b, t;
      double r;
      cin >> b >> r >> t;
      t--;
      double interest = t ? g(y, r) : f(y, r);
      if (cmax(maxInterest, interest)) bestBank = b;
    }
    cout << bestBank << endl;
  }
}

Measured memory_bytes: 3312
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

        var sum = 0d;
        for (int i = 0; i < n; i++)
        {
            sum += 1.0 / a[i];
        }

        Console.WriteLine(1 / sum);
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18

int main() {
    string s ;
    cin >> s ;
    int cnt = 0;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R'){
        cout << 3 << endl ;
        return 0 ;
    }
    if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')){
        cout << 2 << endl ;
        return 0 ;
    }
    if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R' ){
        cout << 1 << endl ;
        return 0 ;
    }
    cout << 0 << endl ;
}

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

int main(void)
{
  int N, H[100000];
  bool flag = true;
  cin >> N;
  
  for(int i = 0; i < N; i++)
    cin >> H[i];
  
  for(int i = 0; i < N - 1; i++)
  {
	if(H[i] - H[i+1] > 1)
    {
      cout << "No" << endl;
      flag = false;
      break;
    }
    else if(H[i] - H[i+1] == 1)
      H[i+1]++;
  }
  
  if(flag)
    cout << "Yes" << endl;
  
  return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int A[N]; rep(i, N) cin >> A[i];
    int left[N+1], right[N+1];
    left[0] = right[N] = 0;
    for(int i = 1; i <= N; i++) left[i] = __gcd(left[i-1], A[i-1]);
    for(int i = N-1; i >= 0; i--) right[i] = __gcd(right[i+1], A[i]);
    int ans = 1;
    //left[i]: A[0]-A[i]までのgcd right[i]: A[i]-A[N-1]までのgcd
    for(int i = 0; i <= N-1; i++){
        ans = max(ans, __gcd(left[i], right[i+1]));
    }
    //rep(i, N+1) cout << left[i] << " "; cout << endl;
    //rep(i, N+1) cout << right[i] << " "; cout << endl;
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second
#define all(c) ((c).begin()), ((c).end())
#define sz(x) ((int)(x).size())
#define ld long double

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<", "<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	for(int i = 0;i < (int)v.size(); i++){
		if(i)os<<", ";
		os<<v[i];
	}
	os<<"}";
	return os;
}

#ifdef LOCAL
#define cerr cout
#else
#endif

#define TRACE

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

int main(){
	map<int, int> freq;
	int n; sd(n);
	for(int i = 0; i < n; i++){
		int x; sd(x);
		freq[x]++;
	}
	auto mn = freq.begin()->F;
	int s = sz(freq);
	if((sz(freq) == 1 && mn) || sz(freq) > 3){
		printf("No\n");
		return 0;
	}
	if(s == 1){
		printf("Yes\n");
		return 0;
	}
	if(s == 2){
		if(mn != 0){
			printf("No\n");
			return 0;
		}
		auto it = freq.begin();
		int a = it->S;
		it++;
		int b = it->S;
		if(b != 2 * a){
			printf("No\n");
			return 0;
		}
		printf("Yes\n");
		return 0;
	}
	auto it = freq.begin();
	int a = it->S, x = it->F;
	it++;
	int b = it->S, y = it->F;
	it++;
	int c = it->S, z = it->F;
	printf((a == b && b == c && c == a && (x ^ y) == z) ? "Yes\n" : "No\n");
}

Measured memory_bytes: 7336
#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}
int main()
{
  int N,l,r,res=0;
  cin >> N;
  REP(i,N){
    cin >> l >> r;
    res += r-l+1;
  }
  cout << res << endl;
  return 0;
}

int par[MAX_N];
int ranks[MAX_N];

//n要素で初期化
void init(int n){
  REP(i,n){
    par[i] = i;
    ranks[i] = 0;
  }

}

//木の根を求める
int find(int x){
  if(par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x,int y){
  x = find(x);
  y = find(y);
  if(x == y) return ;
  if(ranks[x] < ranks[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(ranks[x] == ranks[y]) ranks[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){	

	int N, h[100000], dp[100001], ans = 0;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> h[i];
	}
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);
	dp[2] = abs(h[0] - h[2]);
	for(int i = 1; i < N; i++){
		dp[i + 2] = min(dp[i] + abs(h[i + 2] - h[i]), dp[i + 1] + abs(h[i + 2] - h[i + 1]));
	}
	cout << dp[N - 1] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;

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

    sort(a.begin(), a.end(), greater<int>());
    if (N & 1) {
        a.push_back(0);
        N++;
    }

    int alice = 0, bob = 0;
    for (int i = 0; i < N; i += 2) {
        alice += a[i];
        bob += a[i + 1];
    }

    cout << (alice - bob) << endl;

    return 0;
}


Measured memory_bytes: 256
a = input()
b = input()
y = 0
if len(a) != len(b):
    print("No")
else:
    for i in range(len(a)):
        if a == b:
            print("Yes")
            y = 1
            break
        c = a[0]
        a = a[1:] + c
if y == 0:
    print("No")

Measured memory_bytes: 3060
//2018年09月13日 星期四 22时16分19秒 
#include<bits/stdc++.h>
#define ll long long
#define db double
#define lowbit(p) (p&(-p))
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define A first
#define B second
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}
/*
## 题意:
给出A,B
求有多少个数对(x,y)满足x*y<A*B
并且x各不相等 y各不相等
*/
ll chk(ll x){
	ll l=0,r=1e9,mid,res;
	for (;l<=r;){
		mid=(l+r)>>1;	
		if (mid*mid<=x){
			res=mid;
			l=mid+1;
		}
		else{
			r=mid-1;
		}
	}
	return res;
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	freopen("1.in","r",stdin);
	int q;
	ll a,b,res,k;
	read(q);
	for (;q--;){
		read(a); read(b);
        k=chk(a*b-1);
        res=2*k-1;
        if(k*(k+1)>a*b-1)res--;
        if(a==b)res++;
    	printf("%lld\n",res);
    }
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back

using namespace std;

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


Measured memory_bytes: 256
n,g =map(int,input().split())
list=[list(map(int,input().split())) for i in range(g)]

lown=[list[0][0]]
hin=[list[0][1]]
#print(lown,hin)

for i in range(1,g):
    if list[i][0]>lown[-1]:
        lown.append(list[i][0])
        
for i in range(1,g):
    if list[i][1]<hin[-1]:
        hin.append(list[i][1])
        
ans=[k for k in range(lown[-1],hin[-1]+1)]
print(len(ans))

Measured memory_bytes: 28816
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    if(k <= a)
        cout << k << '\n';
    else if(k <= a + b)
        cout << a << '\n';
    else
        cout << 2*a + b - k << '\n';
}

Measured memory_bytes: 3612
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())
	return n
}

func getFloat() float64 {
	sc.Scan()
	n, _ := strconv.ParseFloat(sc.Text(), 64)
	return n
}

func sum(n []int) int {
	a := 0
	for _, v := range n {
		a += v
	}
	return a
}

func partseFloat(s string) (n float64) {
	n, _ = strconv.ParseFloat(s, 64)
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n := sc.Text()

	Rune := []rune(n)
	str := make([]string, 3)

	for i, v := range Rune {
		if string(v) == "1" {
			str[i] = "9"
		} else {
			str[i] = "1"
		}
	}
	fmt.Println(strings.Join(str, ""))
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);

    int m, d;
    cin >> m >> d;

    int ans = 0;

    for(int i = 1; i <= d; i++) {
    	int x = i;
    	int d1 = x%10;
    	int d10 = (x/10)%10;
    	if(d1 >= 2 and d10 >= 2 and d1*d10 <= m) ans++;
    }

    cout << ans;

    return 0;
}


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

int main(){
	char a;
	cin >> a;
	if(a == 'A')cout << "T" << endl;
	if(a == 'G')cout << "C" << endl;
	if(a == 'C')cout << "G" << endl;
	if(a == 'T')cout << "A" << endl;
	
	return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define umap unordered_map

const int MOD = 1e9 + 7;

int madd(int a, int b){
	a += b;
	if (a >= MOD) a -= MOD;
	return a;
}

int msub(int a, int b){
	a -= b;
	if (a < 0) a += MOD;
	return a;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n, k; cin >> n >> k;
	vi A = vi();
	rep(i, n){
		int x; cin >> x;
		A.pb(x);
	}
	vvll dp = vvll(n, vll(k + 1, 0));
	vvll psums = vvll(n, vll(k + 1, 0));
	for(int c = 0; c <= A[0]; c++){
		dp[0][c] = 1;
	}
	for(int c = 0; c <= k; c++){
		psums[0][c] = madd(dp[0][c], (c > 0 ? psums[0][c-1] : 0));
	}

	for(int r = 1; r < n; r++){
		for(int c = 0; c <= k; c++){
			int cutoff = c - A[r] - 1;
			dp[r][c] = msub(psums[r-1][c], (cutoff >= 0 ? psums[r-1][cutoff] : 0));
		}
		for(int c = 0; c <= k; c++){
			psums[r][c] = madd(dp[r][c], (c > 0 ? psums[r][c-1] : 0));
		}
	}
	cout << dp[n-1][k] % MOD;
}

Measured memory_bytes: 160248
use std::io::*;
use std::cmp::*;
use std::fmt::Write;
use std::collections::BTreeSet;


#[derive(Debug)]
enum Event {
    Begin,
    End,
}


fn solve(buf: String) -> String {
    let it: Vec<&str> = buf.split_whitespace().collect();
    let (n, _): (usize, usize) = (it[0].parse().unwrap(), it[1].parse().unwrap());

    let mut stx: Vec<(i32, i32, i32)> = vec![];
    let it: Vec<i32> = it[2..].iter().map(|x| x.parse().unwrap()).collect();
    for i in 0..n {
        let j = 3*i;
        stx.push((it[j], it[j+1], it[j+2]));
    }

    let delay: Vec<i32> = it[3*n..].to_vec();

    let mut events: Vec<(i32, Event, i32)> = vec![];
    for s in & stx {
        events.push((max(0, s.0 - s.2), Event::Begin, s.2));
        events.push((max(0, s.1 - s.2), Event::End  , s.2));
    }

    events.sort_by(|a,b| a.0.cmp(&b.0));

    let mut set = BTreeSet::new();

    let mut c = 0;
    let mut buf = String::from("");
    for d in delay {
        while c < events.len() && events[c].0 <= d {
            match events[c].1 {
                Event::Begin => {
                    set.insert(events[c].2);
                },
                Event::End => {
                    set.remove(&events[c].2);
                }
            }
            c += 1;
        }

        let ans = *set.iter().next().unwrap_or(&-1);
        writeln!(&mut buf, "{}", ans);
    }

    buf
}


fn main() {
    let mut buf = String::new();
    stdin().read_to_string(&mut buf).unwrap();
    println!("{}", solve(buf));
}

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

int main(){
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;
    for(int i=0; i<=a; i++){
        for(int j=0; j<=b; j++){
            for(int k=0; k<=c; k++){
                if(500*i + 100*j + 50*k == x) ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  string a ;
  cin >> a ;
  int n , m ;
  for(int i = 0 ; i < a.size() ; i++ ){
    if(a[i]=='A'){
      n=i ;
      break ;
    }
  }
  for(int i = a.size()-1 ; i >=0; i-- ){
    if(a[i]=='Z'){
      m=i ;
      break ;
    }
  }
  cout << m - n + 1<< endl ;
}

Measured memory_bytes: 640
import sys
import math

g = 9.8

while True:
    try:
        s = raw_input()
        vd = float(s)
        #N = int(math.ceil((vd * vd / (10.0 * g)) + 1.0))
        N = int(math.ceil((vd * vd / (9.8 * 2) + 5) / 5))
        print(N)
    except EOFError:
        break

Measured memory_bytes: 4372
def iseven():
    global a
    for i in range(len(a)):
        if a[i] % 2:
            return 0
        else:
            a[i] = a[i] // 2
    else:
        return 1

count = 0
n = int(input())
a = list(map(int, input().split()))

while True:
    if iseven():
        count += 1
    else:
        break

print(count)


Measured memory_bytes: 3060
fn main() {
    read::<i32>();
    let mut vec = read_vec::<i32>();
    let mut a = 0;
    let mut b = 0;

    vec.sort();

    loop {
        match vec.pop() {
            Some(i) => a += i,
            None => break,
        }
        match vec.pop() {
            Some(i) => b += i,
            None => break,
        }
    }

    println!("{}", a - b);
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Objects;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int N = in.nextInt();
            int activities[][] = new int[N][3];
            Map<Key, Integer> memo = new HashMap<>();
            for (int i = 0; i < N; i++)
            {
                activities[i] = CPUtils.readIntArray(3, in);
            }
            out.println(solve(N, 0, '0', activities, memo));
        }

        private int solve(int n, int day, char prev, int[][] activities, Map<Key, Integer> memo)
        {
            if (day == n) return 0;

            int score = -1;
            char activity = '0';
            char choices[] = {'A', 'B', 'C'};
            for (int i = 0; i < 3; i++)
            {
                if (prev != choices[i])
                {
                    int choiceScore;
                    Key key = new Key(day, choices[i]);
                    choiceScore = memo.containsKey(key) ? memo.get(key) :
                                  solve(n, day + 1, choices[i], activities, memo) + activities[day][i];
                    if (choiceScore > score)
                    {
                        score = choiceScore;
                        activity = choices[i];
                    }
                }
            }
            memo.put(new Key(day, activity), score);
            return score;
        }

    }

    static class Key
    {
        int day;
        char activity;

        Key(int day, char activity)
        {
            this.day = day;
            this.activity = activity;
        }

        public boolean equals(Object o)
        {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Key key = (Key) o;
            return day == key.day && activity == key.activity;
        }

        public int hashCode()
        {
            return Objects.hash(day, activity);
        }

    }

    static class CPUtils
    {
        public static int[] readIntArray(int size, Scanner in)
        {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
            {
                array[i] = in.nextInt();
            }
            return array;
        }

    }
}



Measured memory_bytes: 206320
// #Sazaの1日1AC
#include<bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
const long long INF=9e15;
const double PI=3.14159265358979323846;

//マクロ
//型エイリアス
using ll = long long;
using P=pair<long long,long long>;
using vl=vector<long long>;
using vvl=vector<vector<long long>>;
using vP=vector<pair<long long, long long>>;
//ショートカット
#define rep(i,n) for(long long i = 0; i < n; i++)
#define rep2(i,k,n) for(long long i = k; i < n; i++) //半開区間
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define mkp make_pair
//入力
#define vin(v,N) for(long long id=0;id<N;id++) cin>>v.at(id)
#define lin(n) long long n;cin>>n
#define chin(x) char x;cin>>x;
#define sin(s) string s;cin>>s;
#define vlin(v,N) vector<long long>v(N);for(long long i=0;i<N;i++)cin>>v.at(i)

#define max(a,b) max((ll)a,(ll)b)
#define min(a,b) min((ll)a,(ll)b)

//関数
//最大公約数
long long gcd(long long m, long long n){
  long long a=max(m,n);
  long long b=min(m,n);
  long long r=a%b;
  while(r!=0){
    a=b; b=r; r=a%b;
  }
  return b;
}
// 最小公倍数
long long lcd(long long m, long long n){
  return m*n/gcd(m,n);
}
//xのn乗
long long power(long long x, long long N){
  long long ret=1;
  for(long long i=0;i<N;i++)   
    ret*=x;
  return ret;
}
//繰り返し二乗法
long long repeat_squaring(long long x, long long n){
  if(n==0) return 1;
  else if(n%2==0){
    long long t=repeat_squaring(x,n/2);
    return t*t%mod;
  }
  else
    return x*repeat_squaring(x,n-1);
}
//素因数分解(mapで返す)
map<long long,long long> factor(long long p){
  ll p1=p;
  map<long long,long long>ret;
  for(long long i=2;i*i<=p1;i++){
     while(p%i==0){
      ret[i]++;
      p/=i;
    }
  }
  if(p!=1)
  ret[p]++;
  return ret;
}
//素数判定
bool is_prime(long long N){
  for(long long i=2;i*i<=N;i++){
    if(N%i==0)
      return false;
  }
  return true;
}
//最大値更新
void chmax(long long &a,long long b){
  a=max(a,b);
}
//最小値更新
void chmin(long long &a,long long b){
  a=min(a,b);
}

//構造体

/////////////////⊂('ω'⊂ )))Σ≡GO!/////////////////



//メイン関数
int main(){
  //doubleの桁数
  cout<<fixed<<setprecision(2);
  
  lin(N);
  int n;

  for(int i = 0; true; i++){
    if(26 * (power(26LL, i) - 1) < 25 * N && 25 * N <= 26 * (power(26LL, i+1) - 1)){
      n = i; break;
    }
  }

  N -= 26 * (power(26LL, n) - 1) / 25;

  string res = "a";

  rep(i, n){
    res += 'a';
  }

  N--;

  int i = n;
  while(N != 0){
    res[i] += N % 26;
    N /= 26;
    i--;
  }

  cout << res << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ul;
typedef signed long long ll;
ul over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  string s;
  int x, y;
  cin >> s >> x >> y;
  s += "T";
  vector< vector< bool > > dpx(8001, vector< bool >(16001, false));
  vector< vector< bool > > dpy(8001, vector< bool >(16001, false));
  dpx[0][8000] = true;
  dpy[0][8000] = true;
  int n_turn = 0;
  int c_cnt = 0;
  int x_max = 0, y_max = 0;
  for (size_t i=0; i<s.size(); ++i) {
    if (s[i]=='T') {
      for (int j=0; j<=16000; ++j) {
        if (n_turn == 0) {
          if (dpx[n_turn/2][j]) {
            dpx[1][j+c_cnt] = true;
            x_max = 1;
          }
        } else if (n_turn%2 == 0) {
          if (dpx[n_turn/2][j]) {
            if (j-c_cnt >= 0) {
              dpx[n_turn/2+1][j-c_cnt] = true;
            }
            dpx[n_turn/2+1][j+c_cnt] = true;
            x_max = n_turn/2+1;
          }
        } else {
          if (dpy[n_turn/2][j]) {
            if (j-c_cnt >= 0) {
              dpy[n_turn/2+1][j-c_cnt] = true;
            }
            dpy[n_turn/2+1][j+c_cnt] = true;
            y_max = n_turn/2+1;
          }
        }
      }
      n_turn++;
      c_cnt = 0;
    } else {
      c_cnt++;
    }
  }
  cout << (dpx[x_max][x+8000] && dpy[y_max][y+8000] ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 32384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  vector<int> num(3);
  for (int i=0; i<3; i++) {
    cin >> num[i];
  }
  cout << num[2] <<" " << num[0] << " " << num[1] << endl;
}
   

Measured memory_bytes: 256
h, w = map(int,input().split())
a = []
for i in range(h):
    a.append(input())

row = [False]*h
col = [False]*w

for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True

for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j],end = '')
        print()

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

    S = list(input().rsplit()[0])
    T = list(input().rsplit()[0])

    for i in range(len(S)):
        if S[i] != T[i]:
            print("No")
            exit()
    print('Yes')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9040