akhauriyash/Code-Regression huggingface dataset:
/* Alohomora */
#include<bits/stdc++.h>
#define ll         long long
#define fl(i,n)    for(i=0;i<n;i++)
#define fld(i,a,b) for(i=a;i>b;i--)
#define fli(i,a,n) for(i=a;i<n;i++)
#define inp(i,a,n) for(i=0;i<n;i++) {cin>>a[i];}
#define op(i,a,n)  for(i=0;i<n;i++) {cout<<a[i]<<" ";}
#define pb         push_back
#define mp         make_pair
#define mod        1000000007 
#define speedup    ios_base::sync_with_stdio(false),cin.tie(0)
using namespace std;
ll fact(ll n){ if(n==0){return 1;}return (n*fact(n-1))%mod;}
ll power(ll x, ll y){ll out = 1;while (y > 0){if (y & 1) out=(out*x)%mod;y = y>>1;x = (x*x)%mod;}return out%mod;}
ll inverse(ll a){return power(a,mod-2);}
ll gcd(ll a,ll b){if(b==0){return a;}gcd(b,a%b);}
ll a[2000000];
void sieve(){ll i,j;fli(i,2,1000001){if(a[i]==0){for(j=i*i;j<1000001;j+=i){a[j]=1;}}}}
map<ll,vector<pair<ll,ll> > >m1;
vector<ll>v1;
bool compar(const pair<ll,ll> &a, const pair<ll,ll> &b) 
{ 
    return (a.second < b.second);
} 
ll ans=0;
vector<ll>root;
/*void calldfs(ll v,int visit[])
{
 visit[v]=1;
 for(int i=0;i<m1[v].size();i++)
 {
  if(visit[m1[v][i]]==0)
  {
   calldfs(m1[v][i],visit);
  }
 }
}
void dfs(ll n)
{
 ll i;
 int visit[1000000]={0};
 fli(i,1,n+1)
 {
  visit[i]=0;
 }
 fli(i,1,n+1)
 {
  if(visit[i]==0)
  {
   calldfs(i,visit);
   ans++;
  } 
 }
}*/
ll color[1000000];
void bfs(ll root)
{
 ll i;
 fli(i,1,1000000)
 color[i]=-1;
 queue<ll>q1;
 q1.push(root);
 color[root]=0;
 
 ll temp;
 while(!q1.empty())
 {
  temp=q1.front();
  for(int i=0;i<m1[temp].size();i++)
  {
   if(color[m1[temp][i].first]==-1)
   {
   if(m1[temp][i].second%2)
   {
    color[m1[temp][i].first]=color[temp]^1;
   }
   else
   {
    color[m1[temp][i].first]=color[temp];
   }
   q1.push(m1[temp][i].first);
   }
  }
  q1.pop();
 }
}
void comp()
{
 ll a,b,k,i;
 cin>>a>>b>>k;
 ll temp=gcd(a,b);
 //cout<<temp;
 vector<ll>v1;
 fli(i,1,sqrt(temp)+1)
 {
  if(temp%i==0 && i!=temp/i)
  {
   v1.pb(i);
   v1.pb(temp/i);
  }
  else if(temp%i==0)
  {
   v1.pb(i);
  }
 }
 sort(v1.rbegin(),v1.rend());
 cout<<v1[k-1]<<"\n";
} 
int main()
{
	speedup;
	ll i=0,t;
	ll n;
	//cin>>t;
	t=1;
	while(t--)
	{
	 comp();
	}
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

const int maxn = 2e5 + 10;

ll fact[maxn], fact_inv[maxn];

int power(ll a, ll b) {
	ll result = 1;
	while(b) {
		if(b % 2) result = (result * a) % P;
		a = (a * a) % P;
		b /= 2;
	}
	
	return result;
}

int divide(ll a, ll b) {
	return (a * power(b, P - 2)) % P;
}

int C(int n, int k) {
	ll result = ((fact[n] * fact_inv[n - k]) % P * fact_inv[k]) % P;
	return result;
}

void init() {
	fact[0] = 1;
	for(int i = 1; i < maxn; i++) fact[i] = (fact[i - 1] * i) % P;
	
	fact_inv[maxn - 1] = divide(1, fact[maxn - 1]); 
	for(int i = maxn - 2; i >= 0; i--) fact_inv[i] = (fact_inv[i + 1] * (i + 1)) % P;
}

void solve() {
	int n, k;
	cin >> n >> k;
	
	int ans = 0;
	for(int i = 1; i <= min(n - 1, k); i++) {
		ll add = (C(n, i) * 1ll * C(n - 1, i)) % P;
		ans = (ans + add) % P;
	}
	
	ans++;
	ans %= P;
	
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	init();
	solve();
    return 0;
}

Measured memory_bytes: 6792
#include <iostream>
using namespace std ; 
int main() 
{
	int A,B ; 
	cin>>A>>B ; 
	if (A>=0&&A<=5)
	cout<<"0"<<endl ; 
	else if (A>=6&&A<=12)
	cout<<B/2<<endl ; 
	else
	cout<<B<<endl;
}

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

int main() {

string A,B,C;
  cin>>A>>B>>C;
  if(A.at(A.length()-1)==B.at(0)&&B.at(B.length()-1)==C.at(0)){cout<<"YES"<<endl;}
  else{cout<<"NO"<<endl;}
}


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

int main(){
	long int n, m;
	cin >> n >> m;
	int l, r;
	int i;
	int a = 0, b = 1000000;
	for(i=0;i<m;i++){
		cin >> l >> r;
		if(a < l){
			a = l;
		}
		if(r < b){
			b = r;
		}
	}
	if(a <= b){
		cout << b - a + 1 << endl;
	}else{
		cout << 0 << endl;
	}
	return 0;
}

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

string s;

signed main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> s;
    int n = s.size();
    if (s[0]!='1' or s[n-2]!='1' or s[n-1]!='0') {
        cout << -1 << endl;
        exit(0);
    }
    rep(i, n/2) if (s[i]!=s[n-2-i]) {
        cout << -1 << endl;
        exit(0);
    }
    cout << 1 << " " << 2 << endl;
    int top = 2;
    for (int i=1; i<n/2; i++) {
        cout << top << " " << i+2 << endl;
        if (s[i]=='1') top = i+2;
    }
    for (int i=n/2+2; i<=n; i++) {
        cout << top << " " << i << endl;
    }
}

Measured memory_bytes: 1616
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n;
  cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  vb tt(n,false);
  ll i=0;
  tt[i]=true;
  ll ans=1;
  while(a[i]!=2){
    i=a[i]-1;
    if(tt[i]) {
      COUT(-1);
      return 0;
    }
    else{
      tt[i]=true;
      ans++;
    }
  }
  COUT(ans);
}
    

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    int s, w;
    cin>>s>>w;
    if (s > w) {
        cout<<"safe"<<endl;
        return 0;
    }
    cout<<"unsafe"<<endl;
}

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

const int N=3e3+2;
int n,ans,mo,f[N],g[N][N],C[N][N];

inline int mul(int x,int y) {return x*y%mo;}
int ksm(int x,int y,int mod) {
	int ans=1;
	for(;y;y>>=1,x=x*x%mod) if(y&1) ans=ans*x%mod;
	return ans;
}
signed main() {
    scanf("%lld%lld",&n,&mo);
    for(int i=0;i<=n;++i) {
        C[i][0]=g[i][0]=1;
        for(int j=1;j<=i;++j) 
            C[i][j]=(C[i-1][j]+C[i-1][j-1])%mo,
            g[i][j]=(g[i-1][j-1]+mul(j+1,g[i-1][j]))%mo;
    }
    for(int i=0;i<=n;++i) {
        int tmp=ksm(2,ksm(2,n-i,mo-1),mo);
        int num=ksm(2,n-i,mo),qaq=1,res=0;
        for(int j=0;j<=i;++j) res=(res+mul(g[i][j],qaq))%mo,qaq=mul(qaq,num);
        ans=(ans+mul(mul((i&1)?mo-C[n][i]:C[n][i],tmp),res))%mo;
    }
    printf("%lld\n",ans);
    return 0;
}

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

vector<int> adj[200001];
int dist[200001];
int N, M, a, b;

void dfs(int x, int d) {
    if (d < dist[x] || dist[x] == -1) dist[x] = d;
    for (auto i : adj[x]) {
        dfs(i, dist[x]+1);
    }
}

int main() {
    memset(dist, -1, sizeof dist);
    cin >> N >> M;
    for (int i=0;i<M;i++) {
        cin >> a >> b;
        adj[a].push_back(b);
    }
    dist[1]=0;
    dfs(1, 0);
    if (dist[N]==2) cout << "POSSIBLE\n";
    else cout << "IMPOSSIBLE\n";
}

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

int main(){
    int N,K;cin>>N>>K;
    vector<int> A;
    for(int i = 0;i < N;i++){
        int _a;cin>>_a;
        A.push_back(_a);
    }
    vector<bool> dp(K+1,false);
    for(int i = 0;i < K+1;i++){
        if(dp[i])continue;
        for(int j = 0;j < N;j++){
            if(i+A[j] > K)break;
            dp[i+A[j]] = true;
        }
    }
    cout<<(dp[K] ? "First" : "Second")<<endl;
}

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

typedef long long ll;
#define mod 1000000007

int main() 
{
    int a[3][3];
    vector<vector<ll>> vis(3,vector<ll>(3,0));
    for(ll i=0;i<3;i++)
    {
        for(ll j=0;j<3;j++)
        {
            cin>>a[i][j];
        }
    }
    ll n;
    cin>>n;
    vector<ll> q(n);
    for(ll i=0;i<n;i++)
    {
        cin>>q[i];
        for(ll j=0;j<3;j++)
        {
            for(ll k=0;k<3;k++)
            {
                if(a[j][k]==q[i])
                {
                    vis[j][k]=1;
                }
            }
        }
    }
    for(ll i=0;i<3;i++)
    {
        int t=1;
        for(ll j=0;j<3;j++)
        {
            if(vis[i][j]==0)
            {
                t=0;
                break;
            }
        }
        if(t)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
     for(ll i=0;i<3;i++)
    {
        int t=1;
        for(ll j=0;j<3;j++)
        {
            if(vis[j][i]==0)
            {
                t=0;
                break;
            }
        }
        if(t)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    int t=1;
     for(ll i=0;i<3;i++)
    {
        if(vis[i][i]==0)
        {
            t=0;
            break;
        }
    }
    if(t)
    {
        cout<<"Yes"<<endl;
            return 0;
    }
    t=1;
    for(ll i=0;i<3;i++)
    {
        if(vis[i][2-i]==0)
        {
            t=0;
            break;
        }
    }
    if(t)
    {
        cout<<"Yes"<<endl;
            return 0;
    }
    cout<<"No"<<endl;
    return 0;
}

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

const string NO = "IMPOSSIBLE";

void solve(long long A, long long B){
    if(A%2 != B%2) cout << NO << endl;
    else cout << (A+B)/2 << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int a[1000], used[1000], b[300][300], used2[1000];
vector<int> G[300];
void dfs(int u){
	if(used[u])return;
	used[u] = 1;
	rep(i,G[u].size()){
		dfs(G[u][i]);
	}
}

void dfs2(int u, int R, int t){
	if(used2[u])return;
	used2[u] = 1;
	int i = u;
	rrep(j,R){
		if(i+j >= t){b[i][t] = 1;dfs2(t, R, t);continue;}
		if(i+j+a[i+j] < 0){b[i][0] = 1;dfs2(0, R, t);continue;}
		if(i+j+a[i+j] >= t){b[i][t] = 1;dfs2(t, R, t);continue;}
		b[i][i+j+a[i+j]] = 1;dfs2(i+j+a[i+j], R, t);
	}
}

void init(){
	rep(i,300)rep(j,300)b[i][j] = 0;
	fill(used2, used2+1000, 0);
	fill(used, used+1000, 0);
	rep(i,300)G[i].clear();
}

signed main(){
	while(1){
		int R, n;
		scanf("%lld", &R);
		if(R == 0)break;
		scanf("%lld", &n);
		rrep(i,n)scanf("%lld", &a[i]);
		int s = 0, t = n+1;
		init();
		dfs2(0, R, t);
		rep(i,t+1)rep(j,t+1){if(b[j][i])G[i].pb(j);}
		dfs(t);
		
		int ans = 1;
		rep(i,t+1)if(used[i] != used2[i])ans = 0;
		/*rep(i,t+1)printf("%lld ", used2[i]);printf("\n");
		rep(i,t+1)printf("%lld ", used[i]);printf("\n");
		rep(i,t+1)printf("%lld ", (int)(G[i].size()));printf("\n");*/
		/*rep(i,t+1){
			rep(j,t+1)printf("%lld ", b[i][j]);
			printf("\n");
		}*/
		printf("%s\n", ans ? "OK" : "NG");
	}
	return 0;
}





Measured memory_bytes: 3980
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int a,b;cin >> a >> b;
  bool x = false;

  if(a%3 == 0)
  {
    x = true;
  }
  else
  {
    if(b%3 == 0)
    {
      x = true;
    }
    else
    {
      if((a + b) % 3 == 0)
      {
        x = true;
      }
    }
  }

  if(x) cout << "Possible" ;
  else cout << "Impossible" ;
  


  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <cassert>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'
#define FIR first
#define SEC second
#define PB push_back
#define SZ(x) ((int)x.size())

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

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

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

void solveSingleCase(int caseNo)
{
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int T = 1;
    // cin >> T;
    FOR(tcase, 1, T + 1) {
        solveSingleCase(tcase);
    }
    return 0;
};


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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

bool comp(int a, int b){
    return (a<b);
}

int main(){
    int n; cin >> n;
    if(n<=999) cout << "ABC";
    else cout << "ABD";
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

char s[1010];
int a[1010];
int main(){
	int n,d;
	scanf("%d %s %d",&n,s,&d);
	for(int i=0;i<n;i++)if(d>0&&s[i]=='0')a[i]=1,d--;
	for(int i=n-1;i>=0;i--)if(d>0&&s[i]=='1')a[i]=1,d--;
	for(int i=0;i<n;i++)putchar(s[i]^a[i]);
	puts("");
}


Measured memory_bytes: 2148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;

void solve(long long N, std::vector<long long> P){
    ll cnt = 1;
    vector<ll> M(N, P[0]);
    for(ll i = 1; i < N; ++i){
        M[i] = min(P[i], M[i-1]);
        if(P[i] == M[i]) cnt++;
    }
    cout << cnt << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> P(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&P[i]);
    }
    solve(N, std::move(P));
    return 0;
}


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

using namespace std;

int main(){
    string S;
    cin >> S;
    map<char, int> cnt;
    for(int i = 0; i < S.length(); ++i){
        cnt[S[i]] = 1;
    }
    for(char c = 'a'; c <= 'z'; ++c){
        if(cnt.find(c) == cnt.end()){
            S += c;
            cout << S << endl;
            return 0;
        }
    }
    
    int index = -1;
    char now = S[S.length() - 1];
    cnt[now]--;
    for(int i = S.length() - 2; i >= 0; --i){
        if(S[i] > now){
            now = S[i];
            cnt[S[i]]--;
            continue;
        }
        
        index = i;
        now = S[i];
        break;
    }
    
    if(index == -1){
        cout << -1 << endl;
        return 0;
    }
    
    S.erase(S.begin() + index, S.end());
    for(char c = now; c <= 'z'; ++c){
        if(cnt[c] == 0){
            S += c;
            cout << S << endl;
            return 0;
        }
    }
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, t;

int main() {
    cin >> n >> t;
    int mi = 1e9;
    int mx = 0;
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
        cin >> m;
        if (m > mi) {
            int e = m - mi;
            if (e > mx) {
                mx = e;
                cnt = 1;
            } else if (e == mx) {
                ++cnt;
            }
        }
        mi = min(mi, m);
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<tuple>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define tii tuple<int,int>
#define tiii tuple<int,int,int>
#define mt make_tuple
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
#define DIV 1000007
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

vector<string> vs;
vi vec1 ={0,1,-1};
vi vec2 ={0,1,-1};
int main(){
  int h,w; cin >> h >> w;
  vs.pb("                                                                     ");
  rep(i,h){
    string s;cin >> s;
    s = " " + s + " ";
    vs.pb(s);
  }
  vs.pb("                                                                      ");
  for(int i = 1; i <= h; i++)
    for(int j = 1; j <= w; j++){
      if(vs[i][j] == '.') vs[i][j] = '0';
      rep(ii,3)rep(jj,3)if(vs[i+vec1[ii]][j+vec2[jj]] == '#' && vs[i][j] != '#') vs[i][j]++;
    }
  for(int i = 1; i <= h; i++){
    for(int j = 1; j <= w; j++){
      cout << vs[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for i in range(n)]

ans=float('inf')
for i in range(2**n):
    lst=[0]*m
    tmp=0
    for j in range(n):
        if i>>j&1:
            tmp+=ca[j][0]
            for k in range(m):
                lst[k]+=ca[j][k+1]

    # print(lst)
    # print(i,tmp)

    for j in range(m):
        if lst[j]>=x:
            pass
        else:
            break
    else:
        ans=min(ans,tmp)

if ans==float('inf'):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 85868
N, T = map(int, input().split(' '))
t = list(map(int, input().split(' ')))
t_interval = [t[i+1]-t[i] for i in range(N-1)]
ans = 0
for i in range(N-1):
    if t_interval[i] <= T:
        ans += t_interval[i]
    elif t_interval[i] > T:
        ans += T
ans += T
print(ans)


Measured memory_bytes: 25196
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		for(int i=n-1;i>=0;i--){
			if(i!=0){
				System.out.print(a[i]+" ");
			}
			else{
				System.out.println(a[i]);
			}
		}
	}
}


Measured memory_bytes: 26264
if __name__ == '__main__':
	n = int(input())
	A = list(map(int,input().split()))
	ma = max(A) + 1
	ans = 1000000
	for x in range(1,ma):
		tmp = 0
		for y in A:
			tmp2 = (y-x)*(y-x)
			tmp += tmp2
		ans = min(ans,tmp)
	
	print(ans)

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

int main()
{
    int n, m, l;
    cin >> n >> m >> l;

    long int a[110][110], b[110][110];

    long int c[110][110];

    for(int i=0; i<n; i++)
    {
        for (int j=0; j<l; j++)
        {
            c[i][j] = 0;
        }
    } 

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin >> a[i][j];
        }
    }

     for(int i=0; i<m; i++)
    {
        for(int j=0; j<l; j++)
        {
            cin >> b[i][j];
        }
    }

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<l; j++)
        {
            for(int k=0; k<m; k++)
            {
                c[i][j] += a[i][k] * b[k][j];
            }
        }
    }

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<l-1; j++)
        {
            cout << c[i][j] << ' ';
        }
        cout << c[i][l-1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3324
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class Main {
	

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		List <Integer> M = new ArrayList<Integer>();
		List <Integer> F = new ArrayList<Integer>();
		List <Integer> R = new ArrayList<Integer>();
		int m;
		int f;
		int r;
		do {
			m = stdIn.nextInt();
			f = stdIn.nextInt();
			r = stdIn.nextInt();
			M.add(m);
			F.add(f);
			R.add(r);
		} while (m != -1 || f != -1 || r != -1);
		
		
		for(int i = 0; i < M.size()-1; i++) {
			if(M.get(i) == -1 || F.get(i) == -1) {
				System.out.println("F");
			}
			else {
				int tmp = M.get(i) + F.get(i);
				if(tmp >= 80) {
					System.out.println("A");
				}
				else if (tmp >= 65) {
					System.out.println("B");
				}
				else if (tmp >= 50) {
					System.out.println("C");
				}
				else if(tmp >= 30) {
					if(R.get(i) >= 50) {
						System.out.println("C");
					}
					else {
						System.out.println("D");
					}
				}
				else {
					System.out.println("F");
				}
			}
		}
	}
}

Measured memory_bytes: 19656
import os

N = int(input())

def prime_fact(value):
    """
    素因数分解を行う関数
    Args:
        value: 素因数分解を行う値
    Returns:
        素因数分解を行った数値リスト
    """
    import math
    prime_list = {}
    prime = 2
    loop_num = 0
    while 1:
        if int(math.sqrt(value))+100<loop_num:
            prime_list[int(value)] = 1
            break
        if value%prime==0:
            value/=prime
            if prime in prime_list.keys():
                prime_list[prime]+=1
            else:
                prime_list[prime]=1
        else:
            prime+=1
        if value == 1:
            break
        loop_num+=1
    return prime_list

def sieve(max_num):
    """
    ある値までの素数を発見する関数
    Args:
        max_num: 素数の最大値
    Returns:
        ある値までの素数のリスト
    """
    droped = []
    uniqued = []
    prime_list = list(range(2, max_num+1))
    for i, current_num in enumerate(prime_list):
        if current_num in droped:
            continue
        else:
            uniqued.append(current_num)
        if i+1>=len(prime_list):
            break
        for num in prime_list[i+1:]:
            if num in droped:
                continue
            if num%current_num==0:
                droped.append(num)
    return uniqued

tmp = prime_fact(N)
result = 0
for prime, num in tmp.items():
    diff = 1
    while num>0:
        num-=diff
        if num<0:
            break
        diff+=1
        result+=1
print(result)


Measured memory_bytes: 9292
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    cout << min(n, k) * x + max(0, n - k) * y << endl;
}

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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007
#define tc             ll tc;scanf("%lld",&tc);while(tc--)

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

int main()
{

    string ac="AC", wa="WA", tle="TLE", re="RE";
    ll n;
    map<string, ll> m;
    cin >> n;
    while(n--)
    {

        string ss;
        cin >> ss;
        m[ss]++;
    }
    cout << "AC x " << m[ac] << endl;
    cout << "WA x " << m[wa] << endl;
    cout << "TLE x " << m[tle] << endl;
    cout << "RE x " << m[re] << endl;
}


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


int main() {
  for(int n; cin >> n && n; ) {
    vector<string> v(n);
    for(int i = 0; i < n; ++i) cin >> v[i];
    try {
      vector<int> s, t;
      for(int i = 0; i+1 < n; ++i) {
        const string &a = v[i], &b = v[i+1];
        int l = min(a.size(), b.size());
        if(a.substr(0, l) == b.substr(0, l) &&
           a.size() > b.size()) {
          throw "no";
        }
        for(int j = 0; j < l; ++j) {
          if(a[j] != b[j]) {
            s.push_back(a[j]-'a');
            t.push_back(b[j]-'a');
            break;
          }
        }
      }
      vector<int> w(26, 0);
      for(int k = 0; k < 26; ++k) {
        bool update = false;
        for(int i = 0; i < s.size(); ++i) {
          if(w[t[i]] > w[s[i]] - 1) {
            w[t[i]] = w[s[i]] - 1;
            update = true;
          }
        }
        if(!update) throw "yes";
        if(k+1 == 26) throw "no";
      } 
    } catch(const char *s) {
      cout << s << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1328
import math
a,b,x=list(map(int,input().split()))

max_=a**2*b
if x<=max_/2:
  num=x*2/a/b
  num2=math.sqrt(b**2+num**2)
  print(90-math.degrees(math.asin(num/num2)))
else:
  num=x*2/a/a-b
  num2=math.sqrt((b-num)**2+a**2)
  print(90-math.degrees(math.asin(a/num2)))




Measured memory_bytes: 3060
N=int(input())
X=[]
for i in range(N):
    X.append(list(map(int,input().split())))

total_d=0
for i in range(N):
    for j in range(i):
        total_d+=((X[i][0]-X[j][0])**2+(X[i][1]-X[j][1])**2)**0.5
ans=total_d*2/N
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>
int main()
{
	int i,j,m,n;
	scanf("%d %d",&n,&m);
	int A[110][110],B[110],C[110];
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
			scanf("%d",&A[i][j]);
	}
	for(i=0;i<m;i++)
		scanf("%d",&B[i]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(j==0)C[i]=0;
			C[i]+=A[i][j]*B[j];
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n",C[i]);
	}
	return 0;
}


Measured memory_bytes: 2100
#include<stdio.h>

int main(void){
   char s[3];
   int i;
   for(i=0;i<3;i++){
      scanf("%c",&s[i]);
   }
   if(s[0]!=s[1]||s[1]!=s[2]){
      printf("Yes");
   } else {
      printf("No");
   }
   return 0;
}


Measured memory_bytes: 1672
#include <bits/stdc++.h>
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 all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 1000000000000
#define MOD 10000007
#define PI 3.14159265359
#define dij priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>
typedef long long ll;
//

int main(){
    int h,w,m;cin>>h>>w>>m;
    vector<pair<int,int>> v(m);
    vector<bool> check(min(h,w),false);
    rep(i,m){
        int a,b;cin>>a>>b;
        v[i]=make_pair(a,b);
        if(a==b)check[a]=true;
    }
    vector<int> che1,che2;
    map<int,int> mp1,mp2;
    int ma1=0,ma2=0;
    for(auto e:v){
        mp1[e.F]++;
        mp2[e.S]++;
        ma1=max(ma1,mp1[e.F]);
        ma2=max(ma2,mp2[e.S]);
    }
    int ans=0;
    for(auto e:v){
        if(mp1[e.F]==ma1)che1.push_back(e.F);
        if(mp2[e.S]==ma2)che2.push_back(e.S);
    }
    sort(all(che1));sort(all(che2));
    che1.erase(unique(all(che1)),che1.end());
    che2.erase(unique(all(che2)),che2.end());
    //for(auto e:che1)cout<<e<<endl;for(auto e:che2)cout<<e<<endl;
    ans=mp1[che1[0]]+mp2[che2[0]];
    //vector<bool> flag;
    bool flag=true;
    sort(all(v));
    
    for(auto e:che1){
        for(auto f:che2){
            auto itr1=lower_bound(all(v),make_pair(e,f));
            if(v[itr1-v.begin()]!=make_pair(e,f)){
                flag=false;
                break;
            }
            //else flag.push_back(false);
        }
        if(!flag)break;
    }
    //for(auto e:flag)cout<<e<<endl;
    if(flag)ans--;
    cout<<ans<<endl;

}


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

using namespace std;

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

int main(){
  double a,b,c,d; cin >> a >> b >> c >> d;

  int x=ceil(a/d);
  int y=ceil(c/b);

  //cout << x << " " << y << endl;

  if(x>=y){
    puts("Yes");
  }else{
    puts("No");
  }

}

Measured memory_bytes: 3708
#include<iostream>
#include <string>
#include <iomanip>
#include <vector>
#include <queue>
#include <algorithm>
#include <functional>
#include <math.h>
#include <stack>
#include <cctype>
using namespace std;
#define int long long
#define pi 2*acos(0.0)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)

signed main()
{
	int r;
	cin >> r;
	if (r < 1200) cout << "ABC" << endl;
	else cout << "ARC" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N,A; cin>>N>>A;
    if(A>=N%500)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 256
s=list(map(lambda x:int(x), input().split()))
if s[1]-s[0] <= s[2]:
    for k in range(s[0],s[1]+1):
        print(k)
else:
    dst=[s[0]+i for i in range(s[2])]
    dst.extend([s[1]-i for i in range(s[2])])
    dst = sorted(list(set(dst)))
    for k in dst:
        print(k)


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

ll a[100000], sum[100001], m[100000];
int main() {
	int n, k; scanf("%d%d", &n, &k);
	rep(i, n)scanf("%lld", &a[i]);
	for (int i = 1; i <= n; i++) {
		sum[i] = sum[i - 1] + a[i - 1];
		m[i] = max(m[i - 1], m[i - 1] + a[i - 1]);
	}
	ll Max = 0;
	rep(i, n - k + 1) {
		ll p = sum[i + k] - sum[i];
		ll l = m[i], r = m[n] - m[i + k];
		Max = max(Max, (p < 0 ? 0 : p) + l + r);
	}
	printf("%lld\n", Max);
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<pii, lint> ppl;
typedef complex<double> xy_t;
typedef pair<xy_t, int> pci;
typedef vector<lint> poly;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod*mod;
constexpr int MAX = 100010;

int main(){
    string s, t;
    cin>>s>>t;
    cout<<t<<s;
}

Measured memory_bytes: 256
import itertools

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
l = [i for i in range(N)]
pl = itertools.permutations(l)
d = 0
cnt = 0

for one_case in pl:
  cnt += 1
  for i in range(N - 1):
    a = one_case[i]
    b = one_case[i + 1]
    dx = (xy[a][0] - xy[b][0])**2
    dy = (xy[a][1] - xy[b][1])**2
    d += (dx + dy)**0.5
    
print(d / cnt)

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

int main(){
	int64_t n,m,ans;
	cin>>n>>m;
	if(n>m/2)ans=m/2;
	else{
		ans=n;
		m-=n*2;
		ans+=m/4;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
using System;

namespace ABC051_B_Sum_of_Three_Integers
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string[] input = Console.ReadLine().Split(' ');
			int k = int.Parse(input[0]);
			int s = int.Parse(input[1]);

			int count = 0;
			
			for (int x = 0; x <= k; x++) {
				for (int y = 0; y <= k; y++)
				{
					int z = s - x - y;
					if (x + y + z == s && z <= k && z >= 0)
					{
						//Console.WriteLine("x：" + x + " y：" + y + " z：" + z); 
						count++;
					}
				
				}
			}
			
			Console.WriteLine(count);
		}
	}
}


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

#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define FORW(a, b, c) for(int a = b; a >= c; --a)
#define int long long

int n, len, powe[20];
string ans;

bool check(int x)   {
    cout << "? " << x << '\n'; cout.flush();
    string tmp; cin >> tmp;
    return (tmp == "Y");
}

int solve_1()   {

    int l = 0, r = 9;
    while(l < r)    {
        int mid = (l + r) / 2;
        if(check(3 * powe[mid])) r = mid;
        else l = mid + 1;
    }
    return l;
}

int solve_2()   {

    int l = 0, r = 9;
    while(r > l)    {
        int mid = (l + r + 1) / 2;
        if(check(powe[mid])) l = mid;
        else r = mid - 1;
    }
    return l;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    powe[0] = 1;
    FOR(i, 1, 9) powe[i] = powe[i - 1] * 10;

    bool flag = check(1000000000);
    if(flag) len = solve_1();
    else len = solve_2();

    int l = powe[len], r = powe[len + 1] - 1;
    while(r > l)    {
        int mid = (l + r) / 2;
        if(check(mid * 10)) r = mid;
        else l = mid + 1;
    }
    cout << "! " << l << '\n'; cout.flush();
}


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

int main() {
	int A,P;
	cin >> A >> P;
  cout << (A*3 + P) / 2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int i,k,num[3],work;
    for(i = 0; i < 3; i ++ )scanf("%d",&num[i]);
    for(i = 0; i < 3; i ++ ){
        for(k = i + 1; k < 3; k ++){
            if(num[i] > num[k]){
                work = num[i];
                num[i] = num[k];
                num[k] = work;
            }
        }
    }
    for(i = 0; i < 3; i ++ ){
        printf("%d",num[i]);
        if(i != 2)printf(" ");
    }
    printf("\n");
    return 0;
}

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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<string> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n;
mat s;
lli ans = 0;

bool check(){
  for(lli i = 0;i < n;i++){
    for(lli j = i+1;j < n;j++){
      if(s[i][j] != s[j][i]) return false;
    }
  }
  return true;
}

int main(){
  cin >> n;
  s = mat(n);
  for(lli i = 0;i < n;i++) cin >> s[i];
  for(lli a = 0;a < n;a++){
    for(lli i = 0;i < n;i++) rotate(s[i].begin(),s[i].begin()+1,s[i].end());
    if(check()){
      ans += n;
    }
  }
  cout << ans << endl;
}


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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#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()

signed main(){
    int n; cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    int ans = 0;
    rep(i,n){
        if((i+1) % 2 == 1 && a[i] % 2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3572
#define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
using namespace std;

int main(){
	priority_queue<int> q;
	for (int i = 0; i < 5; ++i) {
		int a;
		cin >> a;
		q.push(a);
	}
	for (int i = 0; i < 5; ++i) {
		cout << q.top();
		if (i != 4) cout << ' ';
		q.pop();
	}
	cout << endl;
	return 0;
}

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

using namespace std;

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

    int ans = 0;

    for(int i=0; i<N; i++){
        if(i%2==0 && a[i]%2==1) ans++;
    }

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

Measured memory_bytes: 3628
#include <cstdio>
#include<iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstring>
#include <string.h>
#include<vector>
#include <set>
#include <vector>
#include <iterator>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b)
{
    return b == 0 ? a : gcd(b, a % b);
}
 ll LCM(ll a, ll aa, ll b)
 {
    return a % b == 0 ? a : LCM(a + aa, aa,b);
 }

 int main()
 {
     ll a, b;
     while(~scanf("%lld %lld", &a, &b))
     {
         printf("%lld %lld\n", gcd(a, b), LCM(a, a, b));
     }
     return 0;
 }


Measured memory_bytes: 3116
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int count=0;
        String str = sc.next();
        for(int i=0; i<str.length();i++){
            if(str.charAt(i) == '1'){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    int n = s.size();
    int k = n;
    FOR(i,0,n-1){
        if(s[i] == s[i+1]){
            --k;
            i += 2;
        }
    }
    cout << k;
}



Measured memory_bytes: 720
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

constexpr double EPS = 1e-7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
#define PI (acos(-1))

constexpr int MOD = 1e9 + 7;

int N, K;
vector<ll> V;

int main(int argc, char const *argv[]) {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	cin >> N >> K;
	V.resize(N);
	for (int i = 0; i < N; ++i)
		cin >> V[i];

	long long res = 0;
	for (int p = 0; p <= min(K, N); ++p) {
		for (int q = 0; p + q <= min(K, N); ++q) {
			vector<long long> v;
			long long cur = 0;
			for (int i = 0; i < p; ++i)
				v.push_back(V[i]), cur += V[i];
			for (int i = 0; i < q; ++i)
				v.push_back(V[N - 1 - i]), cur += V[N - 1 - i];

			sort(v.begin(), v.end());
			for (int i = 0; i < min(K - p - q, (int)v.size()); ++i) {
				if (v[i] < 0)
					cur -= v[i];
			}
			res = max(res, cur);
		}
	}
	cout << res << endl;
	return 0;
}


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

int n, a, b, c, d;
string s;

bool check(int start, int end){
    for(int i = start; i + 1 <= end; i++){
        if(s[i] == '#' && s[i+1] == '#'){
            return false;
        }
    }
    return true;
}

int main(){
    cin >> n >> a >> b >> c >> d >> s;
    a--, b--, c--, d--;
    
    if(!check(a, c) || !check(b, d)){
        cout << "No\n";
        return 0;
    }

    if(c > d){
        bool flat3 = false;
        for(int i = b; i <= d; i++){
            if(s[i-1] == '.' && s[i] == '.' && s[i+1] == '.'){
                flat3 = true;
            }
        }
        if(!flat3){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3684