akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
	int x, t;
	cin >> x >> t;
	cout << max(0, x - t) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 10000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

#define V 100000

int v, e;
vector<int> g[V];
vector<P> ans;
bool used[V], fin[V];
int memo[V];

int dfs(int v, int f) {
  int cnt = 0;
  used[v] = true;
  rep(i, g[v].size()) {
    int t = g[v][i];
    if(used[t]) {
      if(t != f && !fin[t]) {
        cnt += 1;
        memo[t] += 1;
      }
    } else {
      int res = dfs(t, v);
      if(res == 0) {
        ans.push_back(v < t ? P(v, t) : P(t, v));
      }
      cnt += res;
    }
  }
  cnt -= memo[v];
  fin[v] = true;
  return cnt;
}

int main() {
  cin >> v >> e;
  rep(i, e) {
    int s, t;
    cin >> s >> t;
    g[s].push_back(t);
    g[t].push_back(s);
  }
  dfs(0, -1);
  sort(ALL(ans));
  rep(i, ans.size()) {
    P &e = ans[i];
    cout << e.first << " " << e.second << endl;
  }
  return 0;
}

Measured memory_bytes: 5188
// beetに勝つ

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main() {
  int N, M, P[100000], Q[100000];
  cin >> N >> M;
  map< int, vector< int > > mp;
  for(int i = 0; i < M; i++) {
    cin >> P[i] >> Q[i];
    mp[P[i]].emplace_back(Q[i]);
  }
  for(auto &p : mp) {
    sort(begin(p.second), end(p.second), [&](int a, int b) {
      return a < b;
    });
  }
  for(int i = 0; i < M; i++) {
    auto it = lower_bound(begin(mp[P[i]]), end(mp[P[i]]), Q[i]) - begin(mp[P[i]]);
    printf("%06d%06d\n", P[i], (int) (it + 1));
  }
}



Measured memory_bytes: 13184
def answer(A,B,K):
	takahashi = A
	aoki = B

	takahashi = A - K
	if takahashi >= 0:
		return [takahashi,aoki]
	elif takahashi < 0:
		takahashi = 0
		aoki = aoki - abs(A - K)
		aoki = 0 if aoki < 0 else aoki
		return [takahashi, aoki]
	else:
		return [takahashi, aoki]

A,B,K = map(int, input().split())
takahashi, aoki = answer(A,B,K)
print("{} {}".format(takahashi, aoki))

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

int main(){
 int d1[6],d2[6],tmp,cnt,j,a=1;

 for(int i=0;i<6;i++){
  cin >> d1[i] ;
 }
 for(int i=0;i<6;i++){
  cin >> d2[i] ;
 }

   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)a=0;

 while(a){
 for(int i=0;i<5;i++){
  for(int k=0;k<4;k++){
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;
   tmp=d2[1];
   d2[1]=d2[3];
   d2[3]=d2[4];
   d2[4]=d2[2];
   d2[2]=tmp;
  }
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;
  tmp=d2[0];
  d2[0]=d2[1];
  d2[1]=d2[5];
  d2[5]=d2[4];
  d2[4]=tmp;
 }
 
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;

  tmp=d2[0]; 
  d2[0]=d2[3];
  d2[3]=d2[5];
  d2[5]=d2[2];
  d2[2]=tmp;

  for(int k=0;k<4;k++){
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;
   tmp=d2[1];
   d2[1]=d2[3];
   d2[3]=d2[4];
   d2[4]=d2[2];
   d2[2]=tmp;
  }
 
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;

  tmp=d2[0]; 
  d2[0]=d2[3];
  d2[3]=d2[5];
  d2[5]=d2[2];
  d2[2]=tmp;
  tmp=d2[0]; 
  d2[0]=d2[3];
  d2[3]=d2[5];
  d2[5]=d2[2];
  d2[2]=tmp;

  for(int k=0;k<4;k++){
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;
   tmp=d2[1];
   d2[1]=d2[3];
   d2[3]=d2[4];
   d2[4]=d2[2];
   d2[2]=tmp;
  }
   cnt=0;
   for(j=0;j<6;j++)if(d1[j]==d2[j])cnt++;
   if(cnt==6)break;
 a=0;
 }


 if(cnt==6)cout << "Yes" << endl ;
 else cout << "No" << endl ;

 return 0;
}

Measured memory_bytes: 3092
#define _CRT_SECURE_NO_WARNINGS
#include <cmath>
#include <cstdio>

using namespace std;

int main()
{
    int N;
    if (scanf("%d", &N) < 1) return 0;

    int n = (int)sqrt(N);

    printf("%d\n", n * n);

    return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;
  class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int A = sc.nextInt();
      int B = sc.nextInt();
      int K = sc.nextInt();
      for(int i=Math.min(A, B); i>=1; i--){
        if( A%i == 0 && B%i == 0){
          K--;
          if(K == 0){
            System.out.println(i);
            break;
          }
        }
      }
    }

  }


Measured memory_bytes: 21716
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <unordered_set>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
static const int INF = 1000010000;
static const int MOD = 1000000007;
 
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};

int main(){
	int n;
	cin >> n;
	vector<ll> x;
	REP(i, n){
		ll tmp;
		cin >> tmp;
		x.pb(tmp);
	}
	vector<ll> s = x;
	SORT(s);
	REP(i, n){
		if(x[i] > s[n / 2 - 1]) cout << s[n / 2 - 1] << " ";
		else cout << s[n / 2] << " ";
	}
}

Measured memory_bytes: 5488
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long 
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define test ll t ; cin>>t; while(t--)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
int main(){
	//mahakal(),fast;
	string str ;
	cin>>str;
	bool flag=0;
	if(str.length()&1)cout<<"No"<<endl;
	else {
		for(ll i=0;i<str.length() ;i+=2){
			if(str[i]=='h' && str[i+1]=='i');
			else flag=1;
		}
		if(flag)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n;
    int a, b, c;
    a = b = c = 0;
    scanf("%d", &n);
    if (n/100 == 1) {
        a = 9;
    } else {
        a = 1;
    }
    if ((n/10)%10 == 1) {
        b = 9;
    } else {
        b = 1;
    }
    if (n%10 == 1) {
        c = 9;
    } else {
        c = 1;
    }
    printf("%d\n", 100*a + 10*b + c);
    return 0;
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <complex>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
typedef complex<double> CD;

int main() {
	string s; cin >> s;
	int q; cin >> q;
	rep(i, q) {
		string m; cin >> m;
		int a, b; cin >> a >> b;
		if (m == "print") {
			FOR(i, a, b + 1)cout << s[i];
			puts("");
		}
		else if (m == "reverse") {
			reverse(s.begin() + a, s.begin() + b + 1);
			//dump(s);
		}
		else if (m == "replace") {
			string p; cin >> p;
			s.replace(a, b - a + 1, p);
			//dump(s);
		}
	}
}


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

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

    bool ok = true;
    for (int i = 0; i < s.size(); i++){
        if ((i+1) % 2 == 0){
            if (s[i] == 'R') {
                ok = false; 
                // cout << "error";
            }
        }
        if ((i+1) % 2 == 1){
            if (s[i] == 'L') {
                ok = false; 
                // cout << "error";
            }
        }
        if (!ok) break;
    }

    ok ? cout << "Yes" << "\n" : cout << "No" << "\n";
    
    

}

Measured memory_bytes: 256
program hrn;
 var
  a,b,s,c:longint;
  s1,s2,s3:string;
 begin
  read(a,b);
  str(a,s1);str(b,s2);
  s3:=s1+s2;
  val(s3,c);
  s:=trunc(sqrt(c));
  if s*s=c then writeln('Yes')
           else writeln('No');
 end.


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int,int>;
struct dsu {
  public:
    dsu() : _n(0) {}
    dsu(int n) : _n(n), parent_or_size(n, -1) {}

    int merge(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        int x = leader(a), y = leader(b);
        if (x == y) return x;
        if (-parent_or_size[x] < -parent_or_size[y]) std::swap(x, y);
        parent_or_size[x] += parent_or_size[y];
        parent_or_size[y] = x;
        return x;
    }

    bool same(int a, int b) {
        assert(0 <= a && a < _n);
        assert(0 <= b && b < _n);
        return leader(a) == leader(b);
    }

    int leader(int a) {
        assert(0 <= a && a < _n);
        if (parent_or_size[a] < 0) return a;
        return parent_or_size[a] = leader(parent_or_size[a]);
    }

    int size(int a) {
        assert(0 <= a && a < _n);
        return -parent_or_size[leader(a)];
    }

    vector<vector<int>> groups() {
        vector<int> leader_buf(_n), group_size(_n);
        for (int i = 0; i < _n; i++) {
            leader_buf[i] = leader(i);
            group_size[leader_buf[i]]++;
        }
        vector<vector<int>> result(_n);
        for (int i = 0; i < _n; i++) {
            result[i].reserve(group_size[i]);
        }
        for (int i = 0; i < _n; i++) {
            result[leader_buf[i]].push_back(i);
        }
        result.erase(
            remove_if(result.begin(), result.end(),
                           [&](const vector<int>& v) { return v.empty(); }),
            result.end());
        return result;
    }

  private:
    int _n;
    vector<int> parent_or_size;
};

int main(){
    int n, q;
    scanf("%d %d", &n, &q);
    dsu d(n);
    for (int i = 0; i < q; i++) {
        int t, u, v;
        scanf("%d %d %d", &t, &u, &v);
        if (t == 0) {
            d.merge(u, v);
        } else {
            if (d.same(u, v)) {
                printf("1\n");
            } else {
                printf("0\n");
            }
        }
    }
  return 0;
}

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	int s = 0;
	rep(i, n) {
		cin >> a[i];
		s += a[i];
	}
	int cnt = 0;
	rep(i, n) {
		if (a[i]*4*m >= s) cnt++;
	}
	if (cnt >= m) cout << "Yes" << endl;
	else cout << "No" << endl;

	//cout << s << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1)/ (y))

int T[5];

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

    cin >> T[0] >> T[1] >> T[2] >> T[3] >> T[4];

    int sum = 0;
    rep(i, 5)
    {
        sum += CEIL(T[i], 10) * 10;
    }
    int min = (T[0] % 10 == 0) ? sum : sum + (T[0] % 10) - 10;
    for (int i = 1; i < 5; ++i)
    {
        min = MIN(min, (T[i] % 10 == 0) ? sum : sum + (T[i] % 10) - 10);
    }

    cout << min << "\n";

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}

int main(void){
	ll x,y;
	cin>>x>>y;
	if(x<y){
		cout<<x<<endl;
	}else if(x%y != 0){
		cout<<x<<endl;
	}else{
		cout<<-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
def solve():
    S = input()
    len_s = len(S)
    A = [0] * (len_s + 2)
    for i in range(0, len_s):
        if S[i] == '<':
            A[i + 1] = A[i] + 1
    for i in range(len_s - 1, -1, -1):
        if S[i] == '>':
            A[i] = max(A[i], A[i + 1] + 1)
    print(sum(A))
solve()


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

int main(){
  string S;
  cin >> S;
  
  int min = 999;
  
  for(int i = 0; i < S.size() - 2; i++){
    int x = abs(stoi(S.substr(i, 3)) - 753);
    
    if(x < min)
      min = x;
  }
  
  cout << min << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fi first
#define sec second 
#define MOD 1000000007
#define pb push_back
#define test cout<<"debuged\n";
#define INF 10000000000
#define si 1000000
#define debug(x) cout<<x<<"\n";


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    ll n,k;
    cin>>n>>k;
    vector<ll> v(n+1);
    for(ll i=1;i<=n;i++)
      cin>>v[i];
    ll dp[n+1];
    for(auto &x:dp)
      x=INF;
    dp[1]=0;
    for(ll i=2;i<=n;i++)
    {
      for(ll j=i-1;i-j<=k;j--)
      if(j>0)
      {
        dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
      }
      else
        break;
      //cout<<i<<"-> "<<dp[i]<<endl;
    }
    cout<<dp[n];
}

Measured memory_bytes: 1792
mod = 10 ** 9 + 7
S = input()
abc = 0
bc = 0
c = 0
q = 0

for i in S[::-1]:
    if i == 'C':
        c = (pow(3, q, mod) + c) % mod
    if i == 'B':
        bc = (bc + c) % mod
    if i == 'A':
        abc = (abc + bc) % mod
    if i == '?':
        abc = (abc * 3 + bc) % mod
        bc = (bc * 3 + c) % mod
        c = (c * 3 + pow(3, q, mod)) % mod
        q += 1
        
print(abc)

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

const int MOD=998244353;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

/*
#include <atcoder/segtree>
using namespace atcoder;
*/

class UnionFind {
	vector<int>par, sz;
public:
	UnionFind() {}
	UnionFind(int n) {
		par = sz = vector<int>(n);
		for (int i = 0; i < n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (sz[x] > sz[y]) {
			par[y] = x;
			sz[x] += sz[y];
		}
		else {
			par[x] = y;
			sz[y] += sz[x];
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sz[find(x)];
	}
};

int main(){
	int n,m;cin>>n>>m;
	UnionFind uf(n);
	rep(i,m){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		uf.unite(a,b);
	}
	int cnt=0;
	rep(i,n){
		if(uf.find(i)==i)cnt++;
	}
	cout<<cnt-1<<endl;
}

Measured memory_bytes: 4004
#include <iostream>
#include <vector>

using namespace std;

const long long INF = 1e18;

int main(){
    int n, W; cin >> n >> W;
    int w[n+10], v[n+10];
    for (int i=0; i<n; i++){
        cin >> w[i] >> v[i];
    }

    auto dp = vector< vector<long long> >(110, vector<long long>(101000, 0));
    
    for (int i=0; i<n; i++){
        for (int j=0; j<=W; j++){
            if (i == 0){
                dp[i][j] = w[0] <= j ? v[0] : 0;
            }
            else {
                if (j < w[i]){
                    dp[i][j] = dp[i-1][j];
                }
                else {
                    dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
                }
            }
        }
    }

    cout << dp[n-1][W] << endl;
    
    return 0;
}

Measured memory_bytes: 88192
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int a, b;
    cin >> a >> b;
    cout << 6 - a - b << "\n";
    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,l;
    string s[101];
    cin>>n>>l;
    rep(i,n) cin>>s[i];
    sort(s,s+n);
    string ans;
    rep(i,n) ans+=s[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >21){
    cout << "bust" << endl;
  }else{
    cout << "win" << endl;
  }
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

inline int f(int n){
    return (n % 2 == 0) ? n/2 : 3*n+1;
}

int collatz(int s){
    vector<int> a(150);
    a[1] = s;
    int i = 1;
    while(true){
        i++;
        a[i] = f(a[i-1]);
        reps(j,1,i-1){
            if(a[i] == a[j]) goto BREAK;
        }
    }
    BREAK:
    return i;
}

signed main(){
    int s; cin >> s;
    cout << collatz(s) << endl;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split(" "))
B = list(map(int, input().split(" ")))
A = [list(map(int, input().split(" "))) for _ in range(N)]

n_valid = 0
for i in range(N):
    if sum([A[i][j] * B[j] for j in range(M)]) + C > 0:
        n_valid += 1
print(n_valid)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
 
//g++ -std=c++11
//g++ -std=c++1z 

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector< pair<int,int> > vp;

int main() {
 
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
 
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);

   	int n, x;

    map <int, int> mymap;
    cin >> n;
    vector <int> v;
    for (int i=0; i<n-1; i++) {
      cin >> x;
      v.push_back(x);
      mymap[x]++;
    }

    for (int i=1; i<=n; i++) {
      if(mymap[i] > 0) {
        cout << mymap[i] << endl;
      } else {
        cout << 0 << endl;
      }
    }

    return 0;
}

Measured memory_bytes: 13528
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int m = sc.nextInt();
        int s = sc.nextInt()-1;
        int t = sc.nextInt()-1;
        
        Dijkstra en = new Dijkstra(n);
        Dijkstra sn = new Dijkstra(n);
        
        for(int i=0; i<m; i++){
            int u = Integer.parseInt(sc.next())-1;
            int v = Integer.parseInt(sc.next())-1;
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            
            en.addEdge(u, v, a);
            sn.addEdge(u, v, b);
        }
        
        long[] ends = en.dijkstra(s);
        long[] snds = sn.dijkstra(t);
        
        long[] cost = new long[n];
        for(int i=0; i<n; i++){
            cost[i] = ends[i] + snds[i];
        }
        for(int i=n-1; i>0; i--){
            cost[i-1] = Math.min(cost[i-1], cost[i]);
        }
        for(int i=0; i<n; i++){
            System.out.println((long)1e15 - cost[i]);
        }
    }
}


class Dijkstra{
    
    public final long INF = (long)1e18;
    private int n;
    private List<Edge>[] edge;
    
    public Dijkstra(int n){
        this.n = n;
        edge = new List[n];
        for(int i=0; i<n; i++){
            edge[i] = new ArrayList<>();
        }
    }
    
    public void addEdge(int from, int to, int cost){
        edge[from].add(new Edge(from, to, cost));
        edge[to].add(new Edge(to, from, cost));
    }
    
    public long[] dijkstra(int from){
        long[] dist = new long[n];
        Arrays.fill(dist, INF);
        dist[from] = 0;
        
        PriorityQueue<Vertex> q = new PriorityQueue<>();
        q.add(new Vertex(from, 0));
        while(q.size() != 0){
            int u = q.poll().ver;
            
            for(Edge ne : edge[u]){
                int v = ne.to;
                long weight = ne.cost;
                if(dist[v] > dist[u]+weight){
                    dist[v] = dist[u]+weight;
                    q.add(new Vertex(v, dist[v]));
                }
            }
        }
        
        return dist;
    }
}

class Edge implements Comparable<Edge>{
    public int from = 0;
    public int to = 0;
    public int cost = 0;
    
    public Edge(int from, int to, int cost) {
        this.from = from;
        this.to = to;
        this.cost = cost;
    }
    
    @Override
    public int compareTo(Edge o) {
        return this.cost - o.cost;
    }
}

class Vertex implements Comparable<Vertex>{
    public int ver = 0;
    public long cost = 0;
    
    public Vertex(int ver, long cost) {
        this.ver = ver;
        this.cost = cost;
    }
    
    @Override
    public int compareTo(Vertex o) {
        long tmp = this.cost - o.cost;
        if(tmp == 0) return 0;
        return (int)(tmp/Math.abs(tmp));
    }
}

Measured memory_bytes: 125076
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
int main(){
    int N,i;cin>>N>>i;
    cout<<N-i+1<<endl;
}

Measured memory_bytes: 3624
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONG_INF 100000000000000
int main() {
	int k, s;
	cin >> k >> s;
	int ans = 0;
	for (int i = 0;i <= k;++i) {
		for (int q = 0;q <= k;++q) {
			if (s - i - q >= 0 && s - i - q <= k) {
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
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; }

int main()
{
    int n; cin >> n;
    int k; cin >> k;
    vint a(n), b(n), v;

    rep(i, n) cin >> a[i] >> b[i];
    rep(i, 32){
        if((k>>i)&1) v.push_back(i);
    }

    // cout << bitset<32>(k) << endl;

    ll ans = 0;
    rep(i, n){
        if((k|a[i]) == k) ans += b[i];
    }

    // cout << ans << endl;
    rep(i, v.size()){
        int x = k;
        // kのv[i]番目の1を0にする
        x ^= (1<<v[i]);
        // v[i]以下の桁を全て1にする
        x |= (1<<v[i])-1;

        // cout << bitset<32>(x) << endl;

        ll t = 0;
        rep(j, n){
            if((x|a[j]) == x)  t += b[j];
        }
        // cout << t << endl;

        chmax(ans, t);
    }

    pr(ans);
    return 0;}

Measured memory_bytes: 4024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
    int n,k;
    cin >> n >> k;
    int now = 1;
    for(int i = 1; i <= n; i++){
        if(now*2 <= now+k) now *= 2;
        else now += k;
    }

    cout << now << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	string S;
	cin >> S;

	int cnt = 0;
	rep(i, N) if (S[i] == '1') cnt++;

	int mod1 = cnt + 1;
	int mod2 = cnt - 1;

	ll kazu1 = 0;
	ll kazu2 = 0;

	rep(i, N) {
		kazu1 = (kazu1 * 2 + (S[i] - '0')) % mod1;
	}
	if (mod2 > 0) {
		rep(i, N) {
			kazu2 = (kazu2 * 2 + (S[i] - '0')) % mod2;
		}
	}
	ll are1[200000], are2[200000];
	are1[N - 1] = 1;
	are2[N - 1] = 1;
	for (int i = N - 2; i >= 0; i--) {
		are1[i] = are1[i + 1] * 2 % mod1;
		if (mod2 > 0) are2[i] = are2[i + 1] * 2 % mod2;
	}

	rep(i, N) {
		if (S[i] == '0') {
			ll tmp = kazu1 + are1[i];
			tmp %= mod1;

			int kotae = 1;
			while (tmp) {
				int k = __builtin_popcount(tmp);
				tmp = tmp % k;
				kotae++;
			}
			co(kotae);
		}
		else {
			if (mod2 == 0) {
				co(0);
			}
			else {
				ll tmp = kazu2 - are2[i] + mod2;
				tmp %= mod2;

				int kotae = 1;
				while (tmp) {
					int k = __builtin_popcount(tmp);
					tmp = tmp % k;
					kotae++;
				}
				co(kotae);
			}
		}
	}



	Would you please return 0;
}

Measured memory_bytes: 6832
{-# OPTIONS_GHC -Wall #-}

readInt :: String -> Int
readInt = read

solve :: Int -> Bool
solve n = n `elem` xs
    where
        xs = filter (<=100) [4*x + 7*y | x<-[0..25], y<-[0..14]]

main :: IO ()
main = do
    n <- fmap readInt getLine

    let ans = solve n

    putStrLn $ if ans then "Yes" else "No"


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

#define rep(i,a,n) for (int i = a;i<=n;++i)
#define per(i,a,n) for (int i = n;i>=a;--i)
#define all(x) (x).begin(), (x).end()     
#define SZ(x) ((int)x.size())

typedef vector<int> VI;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef long double ld;

mt19937 mrand(random_device{}());
ll rnd(ll a, ll b) { return a + mrand() % (b - a + 1); }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

const ll mod = 1e9 + 7;
const int N = 2e5;
ll dp[N];

void mul(ll &a, ll b) {
      a *= b;
      a %= mod;
}

void sub(ll &a, ll b) {
      a %= mod, b %= mod;
      a -= b;
      if (a < 0) a += mod;
}

void add(ll &a, ll b) {
      a += b;
      a %= mod;
}

ll powmod(ll a, ll b) {
      ll res = 1;
      while (b > 0) {
            if (b & 1)
                  mul(res, a), b--;
            else
                  mul(a, a), b /= 2;
      }
      return res;
}

ll get(ll del, ll n, ll k) {
      return powmod(k / del, n);
}

int main() {
      ios::sync_with_stdio(false); cin.tie(0);
#ifdef arrias
      freopen("a.txt", "r", stdin);
#endif
      ll n, k;
      cin >> n >> k;
      ll res = 0;
      per(gcd, 1, k) {
            dp[gcd] = get(gcd, n, k);
            for (int v = gcd * 2; v <= k; v += gcd)
                  sub(dp[gcd], dp[v]);
            ll k = dp[gcd];
            mul(k, 1ll * gcd);
            add(res, k);
      }
      cout << res << "\n";
      return 0;
}

Measured memory_bytes: 4360
import sys
from collections import deque

input = sys.stdin.buffer.readline
sys.setrecursionlimit(2*10**5)

N = int(input())
c = list(map(int,input().split()))
edge = [[] for i in range(N+1)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edge[a].append(b)
    edge[b].append(a)


#合流点の検出
deq = deque([1])
parent = [-1 for i in range(N+1)]
parent[1] = 0
topo = []
while deq:
    v = deq.popleft()
    topo.append(v)
    for nv in edge[v]:
        if parent[nv]==-1:
            parent[nv] = v
            deq.append(nv)

topo = topo[::-1]


#辺の張り直し
vertex = []
size = [1 for i in range(N+1)]
size[0] = N

def euler_tour(v,pv):
    vertex.append(v)
    for nv in edge[v]:
        if nv!=pv:
            euler_tour(nv,v)
            size[v] += size[nv]
    vertex.append(v)
euler_tour(1,0)

color_tree_edge = [{c[i]:[]} for i in range(N)]
color_tree_edge = [{c:[] for c in range(1,N+1)}] + color_tree_edge
for v in range(2,N+1):
    color_tree_edge[v][c[parent[v]-1]] = []

parent = [0 for i in range(N+1)]
visit = [None for i in range(N+1)]

for v in vertex:
    if visit[v] is None:
        visit[v] = {}
        for nc in color_tree_edge[v]:
            color_tree_edge[parent[nc]][nc].append(v)
            visit[v][nc] = parent[nc]
            parent[nc] = v
    else:
        for nc in visit[v]:
            parent[nc] = visit[v][nc]

def bfs(color):
    deq = deque([0])
    res = []
    while deq:
        v = deq.popleft()
        res.append(v)
        for nv in color_tree_edge[v][color]:
            deq.append(nv)

    return res[::-1]

ans = [0]*(N+1)

for color in range(1,N+1):
    vertex = bfs(color)
    res = N*(N+1)//2
    for v in vertex:
        if v==0 or c[v-1]!=color:
            tmp = size[v]
            for nv in color_tree_edge[v][color]:
                tmp -= size[nv]
            res -= tmp*(tmp+1)//2
    ans[color] = res

print("\n".join(map(str,ans[1:])))


Measured memory_bytes: 427228
#include <bits/stdc++.h>
#include <boost/range/adaptors.hpp>

using namespace std;
using ll = long long;
using ld = long double;

namespace NyaGadget
{
	struct NyaStruct {
		ll times = 0;
		ll v = 0;
	};

	auto NyaSort = [](const NyaStruct& l, const NyaStruct& r)
	{	// 昇順は演算子を逆にする, if順の優先でソートされる
		return l.v > r.v;
	};
}

#define all(collection) (collection).begin(), (collection).end()              // begin to end
#define divc(a, b) ceil((ld) a / (ld) b);                                     // div ceiling
#define rep(i, begin, end) for (ll i = begin; i < end; i++)                   // repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)                  // repeat reverse
#define size(collection) ((ll) (collection).size())                           // collection size
/********** for each macro **********/
#define fori(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#define each(i, e, v) fori(i, auto& e: v)
#define forir(i, ...) if(ll i = size(v)) for(__VA_ARGS__) if(i--, true)
#define eachr(i, e, v) forir(i, auto& e: boost::adaptors::reverse(v))

using namespace NyaGadget;

int main(void)
{
	ll N, M; cin >> N >> M;

	vector<ll> A(N);
	each(i, e, A)
		cin >> e;

	vector<NyaStruct> B(M);
	each(i, e, B)
		cin >> e.times >> e.v;
	
	sort(all(A));
	sort(all(B), NyaSort);

	vector<ll> change;
	each(i, e, B)
	{
		for(ll j = 0; j < e.times && size(change) != N; j++)
			change.push_back(e.v);

		if (size(change) == N) break;
	}
	
	each(i, e, change)
		if (A[i] < e) A[i] = e;

	cout << accumulate(all(A), 0LL);
	return 0;
}


Measured memory_bytes: 3704
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container;
import std.numeric, std.math;
import core.bitop;

string my_readln() { return chomp(readln()); }

long mod = pow(10, 9) + 7;
long moda(long x, long y) { return (x + y) % mod; }
long mods(long x, long y) { return ((x + mod) - (y % mod)) % mod; }
long modm(long x, long y) { return (x * y) % mod; }

void main()
{
	auto tokens = my_readln.split;
	auto N = tokens[0].to!long;
	auto a = my_readln.split.to!(long[]);

	long ans;
	foreach (e; a)
	{
		while (e % 2 == 0)
		{
			++ans;
			e /= 2;
		}
	}

	writeln(ans);
	stdout.flush();
}

Measured memory_bytes: 2556
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 1e9
long double PI =3.14159265358979323846;
 
const ll M=1e12;
const ll inf=1e18;
const ll ms=10000000;
fast;
ll ans,n;
void solve()
{
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        ll a;cin>>a;
        if(a!=i)
            ans++;
    }
    if(ans<3)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}
int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
    //int t;cin>>t;while(t--)
    {
        solve();
    }
    return 0;
}


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

using namespace std;

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

int main(){
    string c[2];
    rep(i, 2) cin >> c[i];
    rep(i, 3){
        if (c[0][i] != c[1][2-i]){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

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

int main() {
  int n,q;
  long k;
  cin >> n >> k >> q;
  vector<long> point(n,k);
  vector<int> getPoint(n,0);
  int a = 0;
  for(int i = 0;i < q;i++){
    cin >> a;
    getPoint.at(a-1)++;
  }
  if(k > q){
	  for(int j = 0; j < n;j++){
    	cout << "Yes" << endl;
      }
  }else{
      for(int h = 0; h < n;h++){
        if(k - q + getPoint.at(h) <= 0){
          cout << "No" << endl;
        }else{
          cout << "Yes" << endl;
        }
      }
  }
          

  return 0;
}


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

using namespace std;

int main(){
    long long int ans=0,sum=0,acm=0;
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin >> a[i];
        sum += a[i];
    }

    sum -= a[0];
    acm += a[0];
    ans = abs(sum-acm);

    for(int i=1;i<N-1;i++){
        sum -= a[i];
        acm += a[i];
        ans = min(abs(sum-acm),ans);
    }

    cout << ans << endl;
}

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

Measured memory_bytes: 3632
N = int(input())

alp = [chr(i) for i in range(97, 97+26)]

if N <= 26:
    print(alp[N-1])
else:
    ans = ""
    while N:
        N -= 1
        amari = N%26
        N = N//26
        ans += alp[amari]
    print(ans[::-1])

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

int main(){
    int n;
    int k;
    int a[200000];
    int aa;
    int ans=0;
    cin>>n;
    cin>>k;
    for(int i=0;i<n;i++){
        a[i]=0;
    }
    for(int i=0;i<n;i++){
        cin>>aa;
        a[aa-1]++;
    }
    sort(a, a+n);
    for(int i=0;i<n-k;i++)ans+=a[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
// #define int ll
#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define rep(i, n) FOR(i, 0, n)
#define rep1(i, n) FOR(i, 1, int(n) + 1)
#define rrep(i, n) RFOR(i, 0, n)
#define rrep1(i, n) RFOR(i, 1, int(n) + 1)
#define all(c) begin(c), end(c)
// const int MOD = 1000000007;

template <typename T>
void __print__(std::ostream &os, const char *, const char *tail, const T &fst) {
    os << fst << tail;
}
template <typename Fst, typename... Rst>
void __print__(std::ostream &os, const char *del, const char *tail, const Fst &fst,
               const Rst &... rst) {
    os << fst << del;
    __print__(os, del, tail, rst...);
}

#ifdef LOCAL
#define dump(...)                                         \
    do {                                                  \
        std::ostringstream os;                            \
        os << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; \
        __print__(os, ", ", "\n", __VA_ARGS__);           \
        std::cerr << os.str();                            \
    } while (0)
#else
#define dump(...)
#endif

template <typename Fst, typename... Rst>
void println(const Fst &fst, const Rst &... rst) {
    __print__(std::cout, "\n", "\n", fst, rst...);
}
template <typename Fst, typename... Rst>
void print(const Fst &fst, const Rst &... rst) {
    __print__(std::cout, " ", "\n", fst, rst...);
}

template <typename iter>
void println_(iter bgn, iter end) {
    while (bgn != end) println(*bgn++);
}

template <typename iter>
void print_(iter bgn, iter end) {
    while (bgn != end) {
        std::cout << *bgn++;
        std::cout << (bgn == end ? "\n" : " ");
    }
}

int _ = (std::cout.precision(10), std::cout.setf(std::ios::fixed), std::cin.tie(0),
         std::ios::sync_with_stdio(0), 0);

template <typename T>
std::vector<T> ndarray(int n, T v) {
    return std::vector<T>(n, v);
}
template <typename... Args>
auto ndarray(int n, Args... args) {
    auto val = ndarray(args...);
    return std::vector<decltype(val)>(n, move(val));
}

template <typename T>
bool umax(T &a, const T &b) {
    return a < b ? a = b, true : false;
}

template <typename T>
bool umin(T &a, const T &b) {
    return a > b ? a = b, true : false;
}

using namespace std;

string s;

// bool input() {
//     return cin >> s;
// }

int main() {
    while (cin >> s) {
        int ans = 0;
        int cur = 0;
        for (char c : s) {
            int a = c - 'A';
            int add = a - cur;
            if (add <= 0) add += 26;
            ans += add;
            cur = a;
        }
        print(ans / 26);
    }
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int ans = 0;
	int mi = INT_MAX;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if (x < mi)
			mi = x, ++ans;
	}
	cout << ans << "\n";
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int m = in(), k = in();
    int num = 1;
    rep(i, m) num *= 2;
    if (k >= num)
    {
        M1;
        return;
    }

    if (m == 0)
    {
        puts("0 0");
        return;
    }

    if (m == 1)
    {
        if (k == 0)
            puts("0 0 1 1");
        else
            M1;
        return;
    }

    vint ans;

    vint v;
    v.reserve(10000);
    rep(i, num)
    {
        if (i != k)
            v.pb(i);
    }

    ans = v;
    ans.pb(k);

    vint rv = v;
    sort(ALL(rv), greater<int>());
    for (auto x : rv)
    {
        DUMP(x);
        ans.pb(x);
    }
    ans.pb(k);

    rep(i, num * 2)
    {
        cout << ans[i] << (i == num * 2 - 1 ? "\n" : " ");
    }
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3868
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int x;
		for (int i = 1; i <= n; i ++) {
			x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
				continue;
			}
			if (x % 10 == 3) {
				System.out.print(" " + i);
				continue;
			}
			x /= 10;
			while (x != 0) {
				if (x % 10 == 3) {
					System.out.print(" " + i);
					break;
				}
				x /= 10;
			}
			continue;
		}
		System.out.print("\n");
	}
}

Measured memory_bytes: 28324
#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    int sum=0;
    if(a>=b&&a>=c) sum=a*10+b+c;
    else if(b>=a&&b>=c) sum=b*10+a+c;
    else sum=c*10+a+b;
    cout<<sum<<endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque
def main():
    N, M = map( int, input().split())
    E = [[] for _ in range(N)]
    for _ in range(M):
        u, v = map( int, input().split())
        u, v = u-1, v-1
        E[u].append(v)
    s, t = map( int, input().split())
    s, t = s-1, t-1
    d = deque([s])
    V = [10**9]*(N*3)
    V[s] = 0
    while d:
        u = d.popleft()
        r, v = u//N,u%N
        c = V[u]
        if r == 0 and v == t:
            print(c//3)
            return
        r = (r+1)%3
        for z in E[v]:
            if c+1 < V[r*N+z]:
                V[r*N+z] = c+1
                d.append(r*N+z)
    print(-1)
if __name__ == '__main__':
    main()

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

int main() {

	int N=0;
	cin >> N;
	

	int ret = 0;
	int min = 2147483647;
	for (int i = 0; i < N; i++)
	{
		int tt = 0;
		cin >> tt;


		min = min <= tt ? min : tt;

		if (tt <= min)
			ret++;

	}
	cout << ret << endl;

	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include<cmath>
#include<vector>
#include<map>
#include<sstream>
#include<deque>
#include<iomanip>
#include<algorithm>
#include<set>
#include<queue>
#include<bitset>
#include<stack>
#include<unordered_set>
using namespace std;
//	int x=atoi(s.c_str()); s_to_in;
int dx[] = { -1,0,0 };
int dy[] = { 0,1,-1 };
#define endl '\n'
long long mo = 1e9;
const long double P = 3.141592653589793238L;
void trust_yourself()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
long long gcd(long long x, long long y)
{
	if (x == 0)
		return y;
	return gcd(y%x, x);
}
long long fast_power(long long x, long long y, long long mo)
{
	long long p = 1;
	while (y)
	{
		if (y & 1)
			p = (p*x) % mo;
		y = (y >> 1); //y/=2
		x = (x*x) % mo;
	}

	return p;
}
long long convert_to_num(string x) {
	long long  num = 0;
	for (int i = 0; i < x.size(); i++) {
		num *= 2;
		num += x[i] - '0';
	}
	return num;
}

long long com(long long n, long long r) {
	long long p = 1, p1 = 1;
	for (long long i = r + 1; i <= n; i++) {
		p = p * i;
		p /= p1;
		p1++;
	}
	return p;
}


int main()
{
	trust_yourself();
	
	int x,y,z;
  cin>>x>>y>>z;
  swap(x,y);
  swap(x,z);
  cout<<x<<" "<<y<<" "<<z;
	
	return 0;

}

Measured memory_bytes: 256