akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
int main()
{
    vector<char> a(3);
    char b;
    bool c = false;
    for (int i = 0; i < 3; i++)
    {
        scanf("%c", &a[i]);
    }
    scanf("\n");
    
    for (int i = 2; i >= 0; i--)
    {
        scanf("%c", &b);
        
        if (b != a[i])
        {
            c = true;
            break;
        }
    }
    if (c)
    {
        printf("NO\n");
    }
    else
    {
        printf("YES\n");
    }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<math.h>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<time.h>
#include<ctime>
#include<functional>
#define int long long
#define itn int
#define f(n) for(int i=0;i<(n);i++)
using namespace std;
typedef pair<int, int> P;
signed main() {
	int a;
	cin >> a;
	map<string, bool> m;
	string s[100];
	f(a) {
		cin >> s[i];
		if (m[s[i]] || (i&&s[i][0] != s[i - 1][s[i - 1].size() - 1])) {
			cout << "No" << endl;
			return 0;
		}
		m[s[i]] = true;
	}
	cout << "Yes" << endl;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int n, k;
	cin >> n >> k;

	vi h(n);
	rep(i, n) cin >> h[i];

	vl dp(n + 1, INF);
	dp[0] = 0;

	for (int i = 1; i < n; ++i) {
		for (int j = 1; j <= k; ++j) {
			if (i - j < 0) continue;

			chmin(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
		}
	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1408
#include <iostream>



int main() {
    int N;
    std::cin >> N;
    int cards[N];
    for (int i = 0; i < N; i++){
        std::cin >> cards[i];
    }
//sort

    for (int i = 0; i < N; i++){
        int max = 0;
        int maxidx = i;
       for(int j = i; j < N; j++){
           if (cards[j] > max) {
               max = cards[j];
               maxidx = j;
           }
       }
       if (maxidx != i){
           int tmp = cards[i];
           cards[i] = max;
           cards[maxidx] = tmp;
       }



    }
    int score = 0;
    for (int i = 0; i < N; i++){
        if (i % 2 == 0){
            score += cards[i];
        }else{
            score -= cards[i];
        }
    }
    std::cout << score;




    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)



int main() {
	ll N,D;
  	cin>>N>>D;
  	ll x[N];
    ll y[N];
  	long double d[N];
  	ll count=0;
  
  	rep(i,N) {
      cin>>x[i]>>y[i];
      d[i]= sqrt(x[i]*x[i]+y[i]*y[i]);
      if(d[i]<=D) count++;
    }
  
  	 cout<<count<<endl;
}

Measured memory_bytes: 9868
//  Submission Code
//  Created by samuraisam01
//  Copyright © 2020 samuraisam01. All rights reserved.

#include <iostream>
#include<string>
#include<algorithm>
#include<unordered_set>
#include<cmath>
#include <cstdlib>
#include<vector>
using namespace std;

#define foru(i, a , b)             for(ll i = a ; i < b ; i++)
#define ford(i, a , b)             for(ll i = a ; i >= b ; i--)
#define forinc(i,a,b,inc)           for(ll i = a; i < b; i += inc)
#define ain(a , n)                 for(ll i = 0 ; i < n ; i++) cin >> a[i];
#define aout(a , n)                for(ll i = 0 ; i < n ; i++) cout << a[i] << " "
#define matrixin(a,m,n)			   for(ll i = 0 ; i < m ; i++) { for(ll j = 0 ; j < n ; j++) { cin>>a[i][j]; } }
#define matrixout(a,m,n)		   for(ll i = 0 ; i < m ; i++) { for(ll j = 0 ; j < n ; j++) { cout<<a[i][j]<<" "; } cout<<endl; }
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

typedef long long ll;
typedef unsigned long long ull;

bool isPrime(ll n) {

    if (n <= 1) return false;
    if (n <= 3) return true;


    if (n % 2 == 0 || n % 3 == 0) return false;

    for (ll i = 5; i * i <= n; i = i + 6) {
        if (n % i == 0 || n % (i + 2) == 0) {
            return false;
        }

    }
    return true;
}

bool ispower(ll x){
    while(x > 1){
        if(x % 2 != 0){
            return false;
        }
        x /= 2;
    }
    return true;
}
ll logfinder(ll x){
    ll z = 0;
    while(x > 1){
        x /= 2;
        z++;
    }
    return z;
}
int main() {

    fastio();
#ifndef ONLINE_JUDGE
    freopen("testcase.txt", "r", stdin);
    freopen("error.txt", "w", stderr);
    freopen("output.txt", "w", stdout);
#endif



        ll a,b;     cin>>a>>b;
        cout<<a*b<<endl;


    return 0;
}

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

typedef long long ll;

int m, n;
ll sum[1 << 16];
ll s[16];
ll d[101];

ll memo[101][1 << 16];

const ll inf = 1LL << 50;

ll dfs(int i, int state) {
	if(i == m) {
		return 0;
	}
	
	if(memo[i][state] != inf) {
		return memo[i][state];
	}
	
	
	
	ll ret = inf;
	
	ret = dfs(i + 1, state) + abs(sum[state] - d[i]);
	
	rep(j, n) {
		if(!((state >> j) & 1)) {
			ret = min(ret, dfs(i, state | (1 << j)));
		}
	}
	
	return memo[i][state] = ret;
}

int main(){
	while(true) {
		cin >> n >> m;
		
		if(n == 0 && m == 0) {
			break;
		}
		
		rep(i, n) {
			cin >> s[i];
		}
		
		rep(i, m) {
			cin >> d[i];
		}
		
		sort(d, d + m);
		
		rep(i, 1 << n) {
			sum[i] = 0;
			rep(j, n) {
				if((i >> j) & 1) {
					sum[i] += s[j];
				}
			}
		}
		
		fill((ll*)memo, (ll*)(memo + m), inf);
		
		cout << dfs(0, 0) << endl;
	}
	return 0;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define deg_to_rad(deg) (((deg) / 360) * 2 * M_PI)
#define rad_to_deg(rad) (((rad) / 2 / M_PI) * 360)

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

typedef long long ll;


void solve(long long N){
    cout<<N*N*N<<endl;
}

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


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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define dbg(x) cout<<#x" = "<<(x)<<ln

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > mat;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, a[114514], l = inf, h, x, y;

int main() {
	cin >> n;
	rep(i,n) {
		cin >> a[i];
		chmax(h,a[i]), chmin(l,a[i]);
	}
	if (h-l==0 && (h==n-1 || 2*h<=n)) cout << "Yes" << ln;
	else if (h-l==1) {
		rep(i,n) if (a[i]==l) x++;
		y = n - x;
		if (x<h && 2*(h-x)<=y) cout << "Yes" << ln;
		else cout << "No" << ln;
	} else cout << "No" << ln;
}

Measured memory_bytes: 640
a,b = map(int,input().split())
dic = ['Alice','Bob','Draw']
ans = 0

if a==b:
	ans = 2
elif a>b:
	ans = 0
else:
	ans = 1
      
if (a==1 or b==1) and ans!=2:
	ans ^= 1

print(dic[ans])
  


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

namespace competitive_programming
{
    class Program
    {
        static void Main(string[] args)
        {
            var main = new Program();
            main.solve();
        }

        void solve()
        {
            long N = long.Parse(Console.ReadLine());
            Dictionary<long, bool> dic = new Dictionary<long, bool>();
            for(int i = 0;i < N; i++)
            {
                var input = long.Parse(Console.ReadLine());
                if (dic.ContainsKey(input)) dic[input] = !dic[input];
                else
                {
                    dic.Add(input, true);
                }
            }
            long count = dic.Count(val => val.Value);
            Console.WriteLine(count);
        }
    }
    struct Vector2
    {
        public Vector2(long x, long y)
        {
            this.x = x;
            this.y = y;
        }
        public long x;
        public long y;
    }

    struct Vector3
    {
        public int x;
        public int y;
        public int z;
    }
}


Measured memory_bytes: 23264
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000000
#define ll long long
using namespace std;
int main()
{
    int a, b;
    int ans = 0;
    cin >> a;
    ans = a * a;
    cout << ans;
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, q; readV(n, q);
  string s; readV(s);

  auto a = new int[](n);
  foreach (i; 1..n) a[i] = s[i-1..i+1] == "AC";
  auto ac = a.cumulativeSum;

  foreach (_; 0..q) {
    int l, r; readV(l, r);
    writeln(ac[l..r]);
  }
}

class CumulativeSum(T)
{
  size_t n;
  T[] s;

  this(T[] a)
  {
    n = a.length;
    s = new T[](n+1);
    static if (T.init != 0) s[0] = T(0);
    foreach (i; 0..n) s[i+1] = s[i] + a[i];
  }

  pure auto opSlice(size_t l, size_t r) { return s[r]-s[l]; }
  pure auto opDollar() { return n; }
}
auto cumulativeSum(T)(T[] a) { return new CumulativeSum!T(a); }


Measured memory_bytes: 4732
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cinii(N, M);
    vector<vector<string> > v(N);
    int totalAC = 0,totalPenalty=0;
    rep(i, M) {
        int a;
        string b;
        cin >> a >> b;
        a--;
        if(v[a].size()>0 && v[a][v[a].size()-1]=="AC"){
            continue;
        }
        if(b=="AC"){
            totalAC++;
            totalPenalty += v[a].size();
        }
        v[a].push_back(b);
    }
    cout << totalAC << " " << totalPenalty << nn;
    return 0;
}

Measured memory_bytes: 10368
#include <stdio.h>

int main(void) {
	// your code goes here
	int a, b, c;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a<b&&b<c){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;
}



Measured memory_bytes: 2140
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

ll gcd(ll a, ll b);
ll lcm(ll a, ll b);

int main(){
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long e = lcm(c, d);
    long long cntc, cntd, cnte;
    
    if(a % c == 0) cntc = b / c - a / c +1;
    else cntc = b / c  - a / c;

    if(a % d == 0) cntd = b /d - a / d +1;
    else cntd = b / d - a/ d;

    if(a % e == 0) cnte = b /e - a / e +1;
    else cnte = b / e - a/ e;
    
    long long ans = b - a + 1 - (cntc + cntd - cnte);
    cout << ans << endl;

}

ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

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


Measured memory_bytes: 256
#include <bits/stdc++.h> // imports every library in c++
using namespace std; // ; is essential | says that you are USING the libraries

//  COMMAND TO USE WHEN RUNNING CODE: g++ day5.cpp -o day5 -std=c++11 -O2  | to run: ./(name of file)  //

int N;
tuple<string, int, int> R[100];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++ ) { 
        string name;
        cin >> name;
        int rating;
        cin >> rating;
        R[i] = make_tuple(name, -rating, i+1);
    }
    sort(R, R+N);

    for ( int i = 0; i < N; i++ ) {
        cout << get<2>(R[i]) << "\n";
    }

    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    // cout << setprecision(8) << setiosflags(ios::fixed);

    int H, W;
    cin >> H >> W;

    vector<string> a(H);
    for (int i = 0; i < H; ++i) cin >> a[i];

    using P = pair<int, int>;
    vector<vector<int>> d(H, vector<int>(W, -1));
    queue<P> que;
    for (int i = 0; i < H; ++i)
        for (int j = 0; j < W; ++j)
            if (a[i][j] == '#') {
                d[i][j] = 0;
                que.emplace(i, j);
            }

    const array<int, 4> dr = {-1, 0, 1, 0};
    const array<int, 4> dc = {0, -1, 0, 1};
    while (!que.empty()) {
        const P cur = que.front(); que.pop();

        for (int dir = 0; dir < 4; ++dir) {
            const int nr = cur.first + dr[dir];
            const int nc = cur.second + dc[dir];

            if (nr < 0 || H <= nr || nc < 0 || W <= nc) continue;

            if (d[nr][nc] == -1 || d[cur.first][cur.second] + 1 < d[nr][nc]) {
                d[nr][nc] = d[cur.first][cur.second] + 1;
                que.emplace(nr, nc);
            }
        }
    }

    int max_d = 0;
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
            max_d = max(max_d, d[i][j]);
        }
    }

    cout << max_d << endl;

    return 0;
}


Measured memory_bytes: 13456
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int R, G, B, N;
  cin>>R>>G>>B>>N;

  int ans = 0;
  for(int i=0;i<=N;i+=R)
    for(int j=0;j<=N;j+=G){
      int k = N - (i + j);
      if(i + j <= N && k % B == 0) ans++;
    }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
//#pragma comment (linker,"/STACK:256000000")
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define next(a) ( ((a)+1)%SIZE )
#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000
#define SIZE 100000

#define INF 1000000000
#define LLINF 10000000000000000

typedef long long ll;

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

int cnt = 0;

/*
void insertion_sort(int *a, int n,int g)
{
	int i, j;
	int k;

	for (i = g; i < n; i++)
	{
		k = i;

		while (a[k] < a[k - g] && k-g>=0)
		{
			swap(&a[k], &a[k - g]);
			k-=g;
			cnt++;
		}
	}
}*/

void insertion_sort(int *A, int n, int g) {
	int i, j, v;
	for (i = g; i < n; i++) {
		v = A[i];
		j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j = j - g;
			cnt++;
		}
		A[j + g] = v;
	}
}


void shell_sort(int *a, int n)
{
	long long int h=1;
	int m = 1;
	int G[100];
	int i, j;

	while ((h*3+1) < n)
	{
		h = h * 3 + 1;
		m++;
	}

	for (i = 0; i < m; i++)
	{
		G[i] = h;
		h /= 3;
	}

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

	for (i = 0; i < m; i++)
	{
		if (i == m - 1)
			printf("%d\n", G[i]);
		else
			printf("%d ", G[i]);
	}

	for (i = 0; i < m; i++)
		insertion_sort(a, n, G[i]);

	printf("%d\n", cnt);
}
/*

int GCD(int x, int y)
{
	if (x < y)
		swap(&x, &y);

	int z;

	while (y > 0)
	{
		z = x;
		x = y;
		y = z % y;
	}
	return x;
}

int prime(int x)
{
	int i, j;

	for (i = 2; i <= sqrt(x); i++)
	{
		if (x % i == 0)
			return -1;
	}

	return 1;
}

void bubble_sort(int* p, int n)
{
	int i, j;

	for (i = 0; i < n; i++)
	{
		for (j=n-1; j > i ; j--)
		{
			if (p[j] < p[j - 1])
			{
				swap(&p[j], &p[j - 1]);
				cnt++;
			}
		}
	}
}
*/

/*
void selection_sort(int* p, int n)
{
	int i, j, min;

	for (i = 0; i < n; i++)
	{
		min = i;
		for (j = i+1; j < n; j++)
		{
			if (p[j] < p[min])
				min = j;
		}
		if (min != i)
		{
			swap(&p[min], &p[i]);
			cnt++;
		}
	}
}*/

int main()
{
	int n;
	int a[1000000];

	scanf("%d", &n);

	int i, j;
	
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);

	shell_sort(a, n);

	for (i = 0; i < n; i++)
		printf("%d\n", a[i]);

	return 0;
}


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

int gcd(int a, int b);
int gcd(const std::vector<int>& arr);

int main() {

        int n, l;
        std::cin >> n >> l;
        std::vector<int> t(n);
        for (std::size_t i = 0; i < n; ++i) {
                t[i] = l + i;
        }
        int total = 0;
        int ans_v = std::numeric_limits<int>::max();
        for (const auto& v : t) {
                if (std::abs(ans_v) > std::abs(v)) {
                        ans_v = v;
                }
                total += v;
        }

        std::cout << total - ans_v << std::endl;

        return 0;
}

int gcd(int a, int b) {
        if (a > b) {
                std::swap(a, b);
        }

        for (int r = b % a; r != 0; b = a, a = r, r = b % a)
                ;

        return a;
}

int gcd(const std::vector<int>& arr) {
        const int size = arr.size();
        if (size == 0) {
                return 0;
        }
        else if (size == 1) {
                return arr[0];
        }

        int ret = gcd(arr[0], arr[1]);

        for (std::size_t i = 2; i < size && ret != 1; ++i) {
                ret = gcd(arr[i], ret);
        }

        return ret;
}


Measured memory_bytes: 256
# import sys
# input = sys.stdin.readline
# import re
import math
import itertools

def main():
    n, d = input_list()
    ans = 0
    for _ in range(n):
        x, y = input_list()
        a = math.sqrt((x * x) + (y * y))
        if a <= d:
            ans += 1
    print(ans)

# 累積和
def get_camulative(l):
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def count(mazes, hc, wc):
    hc = list(hc)
    wc = list(wc)
    r = 0
    for hi, row in enumerate(mazes):
        if hi in hc:
            continue
        for wi, m in enumerate(row):
            if wi in wc:
                continue
            if m == '#':
                r += 1
    return r

def input_list():
    return list(map(int, input().split()))

def input_list_str():
    return list(map(str, input().split()))

if __name__ == '__main__':
    main()



Measured memory_bytes: 70232
#include <stdio.h>
#include <math.h>
int main (void){
  int a[256];
  char block[256][50];
  int result[256][50];
  char moziretu[256];
  int i=0;
  int m=0;
  int j=0;
  int bomb;
  int yoko=0;
  int tate=0;
  int mozi=0; //文字数                                                          
  char str[256];
  gets(str);
  while(1){
    if(str[i]==' '||str[i]=='\n'||str[i]=='\0'){
      a[mozi]=0;
      while(j!=0){
        a[mozi]+=(str[i-j]-'0')*pow(10,j-1);
        j--;
      }
      mozi++;
      if(m==-1){
        a[mozi-1]=a[mozi-1]*-1;
        m=0;
      }
      j=-1;
      if(str[i]=='\n'||str[i]=='\0')break;
    }
    if(str[i]=='-'){
     m=-1;
     j--;
   }
    i++;
    j++;
  }
  for(tate=0;tate<a[0];tate++){
    gets(moziretu);
    for(yoko=0;yoko<a[1];yoko++){
      block[tate][yoko]=moziretu[yoko];
    }
  }
  for(tate=0;tate<a[0];tate++){
    for(yoko=0;yoko<a[1];yoko++){
      bomb=0;
      if(tate!=0){
      if(block[tate-1][yoko-1]=='#'&&yoko!=0)bomb++;
      if(block[tate-1][yoko]=='#')bomb++;
      if(block[tate-1][yoko+1]=='#'&&yoko!=a[1]-1)bomb++;
      }
      if(block[tate][yoko-1]=='#'&&yoko!=0)bomb++;
      if(block[tate][yoko+1]=='#'&&yoko!=a[1]-1)bomb++;
      if(tate!=a[0]){
      if(block[tate+1][yoko-1]=='#'&&yoko!=0)bomb++;
      if(block[tate+1][yoko]=='#')bomb++;
      if(block[tate+1][yoko+1]=='#'&&yoko!=a[1]-1)bomb++;
      }
      result[tate][yoko]=bomb;
    }
  }
  for(tate=0;tate<a[0];tate++){
    for(yoko=0;yoko<a[1];yoko++){
      if(block[tate][yoko]!='#'){
      printf("%d",result[tate][yoko]);
      }else{
      printf("#");
      }
    }
     printf("\n");
  }
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

#define mod 1000000007

int n;
string s[2];

ll dp[55][3][3];

int main(){
	cin.sync_with_stdio(false);
  cin>>n;
  cin>>s[0]>>s[1];
  if(s[0][0]==s[1][0]){
    rep(i,3)dp[0][i][i]=1;
  }else{
    rep(i,3)rep(j,3)if(i!=j)dp[0][i][j]=1;
  }
  ll res=0;
  rep(i,n-1)rep(j,3)rep(k,3)rep(nj,3)rep(nk,3){
    if((s[0][i]==s[0][i+1])==(nj==j)&&((s[1][i]==s[1][i+1])==(nk==k))){
      if(s[0][i+1]==s[1][i+1]&&nj!=nk)continue;
      if(s[0][i+1]!=s[1][i+1]&&nj==nk)continue;
      dp[i+1][nj][nk]=(dp[i+1][nj][nk]+dp[i][j][k])%mod;
    }
  }
  rep(i,3)rep(j,3)res=(res+dp[n-1][i][j])%mod;
  cout<<res<<endl;
	return 0;
}


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

const static ll MOD = (1e+9)+7;

int main(){
    int k,t;cin>>k>>t;
    vector<int> lst(t);
    rep(i,t)cin>>lst[i];
    int ans = -1;
    while(lst[0] != 0){
        sort(lst.begin(),lst.end(),greater<int>());
        lst[0]--;
        if(t > 1 && lst[1] != 0){
            lst[1]--;
        }else{
            ans++;
        }
    }
    cout<<max(ans,0)<<endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class A
{
	public static void Main()
	{
		int A = GetInt();
		int B = GetInt();
		int C = GetInt();

		if((A == B) && (B == C))
		{
			Console.WriteLine((A % 2 == 0) ? -1 : 0);
			return;
		}

		int ans = 0;
		while((A % 2 == 0) && (B % 2 == 0) && (C % 2 == 0))
		{
			int newA = (B + C) / 2;
			int newB = (C + A) / 2;
			int newC = (A + B) / 2;
			A = newA;
			B = newB;
			C = newC;
			ans++;
		}

		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 11092
#include <iostream>

using namespace std;

const int m = 1000000000 + 7;

int main() {
  int n;
  cin >> n;
  long ans = 1;
  for (int i = 1; i <= n; i++) {
    ans *= i;
    ans %= m;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3156
a , b , c = map(int , raw_input().split())
ans = 0
while not ((a & 1) | (b & 1) | (c & 1)):
	a , b , c = (b + c) >> 1 , (a + c) >> 1 , (a + b) >> 1
	ans += 1
	if ans > 1 << 15:
		ans = -1
		break
print ans

Measured memory_bytes: 2692
n = gets.chomp.to_i
as = gets.chomp.split(' ').map(&:to_i)

counts = {}
as.each do |a|
    counts[a] = (counts[a] || 0) + 1
end

base = 0
counts.each do |k, v|
    if v > 1
        base = base + v * (v - 1) / 2
    end
end

as.each do |a|
    c = counts[a]
    if c == 1
        puts base
    elsif c == 2
        puts base - 1
    else
        puts base - c + 1
    end
end


Measured memory_bytes: 29956
#include <bits/stdc++.h>
typedef long long ll;
#define vstroku() to_string()
#define vchislo() to_ulong()
#define gcd(x,y) __builtin_gcd(x,y)
#define numberof1(x) __builtin_popcount(x)
#define povsemelementam(i,mnozh) for(auto i: mnozh)
#define podotrezok(i,j) substr(i-1,j) // like prefix sum, (i,j)=s[j]-s[i-1]
#define pb push_back
#define pf push_front
#define popf pop_front
#define popb pop_back 
#define pii pair <int, int>
#define F first
#define S second
#define mipletsplay ios_base::sync_with_stdio(0); cin.tie(0); 


using namespace std;
const ll INFLL = 1e18;
const int MAXN = 3e5;
const ll INF = 1e9;
const ll kek=998244353;

int main() {
mipletsplay;

int n,d;
cin>>n>>d;
vector <vector <ll> > x(n);
for (int i=0;i<n;i++){
for (int j=0;j<d;j++)
{
    ll y;
    cin>>y;
    x[i].pb(y);
}
}
int k=0;
for (int i=0;i<n;i++)
{
for (int j=i+1;j<n;j++)
{
ll sum=0;
for (int h=0;h<d;h++)
sum+=(x[i][h]-x[j][h])*(x[i][h]-x[j][h]);
double t=sqrt(sum);
if (t==floor(t))
k++;
}
}
cout<<k;}

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

using namespace std;

#define INF (1<<29)

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    
    vector<int> D(M), dm(N, -1);
    for (int i = 0; i < M; i++) {
        cin >> D[i]; D[i]--;
        dm[D[i]] = 1<<i;
    }
    
    vector<vector<int>> v(N, vector<int>(K));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < K; j++) {
            cin >> v[i][j];
            v[i][j]--;
        }
    }
    
    int dp[1<<16];
    fill(dp, dp + (1<<16), INF);
    dp[(1<<M)-1] = 0;

    queue<int> Q;
    Q.push((1<<M)-1);

    while (!Q.empty()) {
        int S = Q.front(); Q.pop();
        if (dp[S] == INF) continue;
        for (int i = 0; i < K; i++) {
            int nS = 0;
            for (int j = 0; j < M; j++) {
                if (!(S >> j & 1)) continue;
                int nj = v[D[j]][i];
                if (dm[nj] >= 0) {
                    nS |= dm[nj];
                }                
            }
            if (dp[S] + 1 < dp[nS]) {
                dp[nS] = dp[S] + 1;
                Q.push(nS);
            }           
        }
    }
    cout << dp[0] << endl;
    return 0;
}

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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            long N = long.Parse(line);
            string ans = "";
            while(N > 0)
            {
                if (N % 26 == 0)
                {
                    ans = (char)('z') + ans;
                    N = N - 26;
                }
                else
                {
                    ans = (char)('a' - 1 + (N % 26)) + ans;
                }
                N = N / 26;
            }
            

            Console.WriteLine(ans);
        }
    }
}


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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

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

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

using i64 = int_fast64_t;

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    i64 x,y;
    if(a%2==0||b%2==0||c%2==0){
        cout << 0 << endl;
    }else{
        if(a>b&&a>c){
            x=(a/2)*b*c;
            y=((a/2)+1)*b*c;
        }else if(b>c){
            x=(b/2)*a*c;
            y=((b/2)+1)*a*c;
        }else{
            x=(c/2)*b*a;
            y=((c/2)+1)*b*a;
        }
        //x=(p[2]/2)*p[0]*p[1];
        //y=((p[2]/2)+1)*p[0]*p[1];
        cout << y-x << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
using ll = long long;
ll dp[61][2];
vector<int> ag[61][2];
bool better(vector<int> a,vector<int> b){
	if(a.size()!=b.size()) return a.size()<b.size();
	return a<b;
}
int main(){
	int N;
	cin>>N;
	dp[0][0] = dp[0][1] = 1;
	rep(i,N){
		int a;
		cin>>a;
		rep(j,2) dp[i+1][j] = dp[i][j], ag[i+1][j] = ag[i][j];
		rep(j,2){
			rep(t,2){
				ll nxt = dp[i][j]*a;
				ll now = dp[i+1][t];
				vector<int> nag = ag[i][j];
				nag.pb(i);
				if(t==0){
					if(nxt<now || (nxt==now && better(nag,ag[i+1][t]))){
						dp[i+1][t] = nxt;
						ag[i+1][t] = nag;
					}
				}else{
					if(nxt>now || (nxt==now && better(nag,ag[i+1][t]))){
						dp[i+1][t] = nxt;
						ag[i+1][t] = nag;
					}
				}
			}
		}
	}
	vector<int> ans = ag[N][1];
	cout<<ans.size()<<endl;
	for(int v:ans) cout<<v+1<<endl;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, M; cin >> N >> M;
    vector<ll> X(M, 0);
    rep (i, 0, M) cin >> X[i];

    if (N >= M) {
        cout << 0 <<endl;
        return 0;
    }

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

    vector<ll> diffs;
    rep (i, 0, X.size()) {
        diffs.push_back(X[i] - X[i-1]);
    }
    sort(diffs.begin(), diffs.end(), greater<ll>());

    ll res = X.back() - X[0];
    rep (i, 0, min((int)diffs.size(), N-1)) {
        res -= diffs[i];
    }

    cout << res << endl;
}

Measured memory_bytes: 2168
//k_k_dubey_
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define inf 999999999999
#define mx 200005
#define gcd __gcd
#define pb push_back
#define mk make_pair
#define bs binary_search
#define ub upper_bound
#define lb lower_bound
#define endl "\n"
#define vl vector<ll>
#define vs vector<string>
#define non __builtin_popcount
#define ml map<ll, ll> 
#define ms map<string , ll> 
using namespace std;

bool isp[mx];

void sv(){

	ll i,j;
	memset(isp, true, sizeof(isp));
	
	isp[1]= false;
	for(i=2;i*i<mx;i++){
		if(isp[i]){
			for(j=i*i;j<mx;j+=i)
			isp[j]= false;
		}
	}
}

ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	//sv();
	
	double w, h, x, y, i, j;
	cin>>w>>h>>x>>y;
	double ans= w*h*1.0/2;
	cout<<ans<<" ";
	if(x==w*1.0/2 && y==h*1.0/2)
	cout<<"1";
	else
	cout<<"0";
    return 0;
}























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

int main(void){
    int n, m, x;
    cin >> n >> m >> x;
    
    int l=0, r=0;
    for(int i=0; i<m; i++) {
        int a;
        cin >> a; 
        if(a<x) l++;
        else r++;
    }
    cout << (l<r ? l : r) << endl;
    return 0;
}


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

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    ll sum = 0;
    int maxans = 0;
    repr(i,1,N+1){
        sum += i;
        if(sum >= N){
            maxans = i;
            break;
        }
    }
    sum = 0;
    for(int i = maxans; i >= 1; i--){
        if(sum + i > N) continue;
        sum += i;
        cout << i << endl;
        if(sum == N) break;
    }
}


Measured memory_bytes: 256
import sys
import numpy as np

input = sys.stdin.readline

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = np.zeros(n, dtype=int)
h = np.array(h)

for i in range(1,n):
    start = max(0, i-k)
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))

print(dp[n-1])


Measured memory_bytes: 22684
#include <iostream>
#include <string>

using namespace std;

int main(){
    int ans = 0;
    int tmp = 0;
    string str;
    while(cin >> str){
	tmp = 0;
	for(int i=0;i<str.size();i++){
	    if('0'<=str[i] && str[i] <='9'){
		tmp += str[i] -'0';
	    }
	    if(i+1 == str.size() || '0' > str[i+1] || str[i+1] > '9'){
		ans += tmp;
		tmp = 0;
	    }
	    else{
		tmp *= 10;
	    }
	}
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s="ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
    int k;
    cin >> k ;
    string p ;
    cin >> p ;
    int len=p.length() ;
    for (int i=0;i<len;i++){
        int y=p[i]-'A' ;
        y+=k;
        y=y%26;
        cout << s[y] ;
    }
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
#define N 100000
#define Q 50000

int search(int);
int S[N];
int n;

int main(){
  int q,T[Q],i,j,x,count=0;

  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i = 0; i < q; i++){
    scanf("%d",&T[i]);
  }
  for(i = 0; i < q; i++){
   x = search(T[i]);
    if(x == 1 ){
      count++;
          }
  }
  printf("%d\n",count);
  return 0;
}

int search(int key){
  int left = 0,right,mid;
  right = n;
  while(1){
    mid =(left + right) / 2;
    if(key == S[mid]){
      return 1;
    }
    if(key < S[mid]) right = mid;
    else if(key > S[mid]) left = mid + 1;
    if(left == right){
        break;
        }
      }
        return 0;
}



Measured memory_bytes: 2280
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

a = S()

if a.isupper():
    print("A")
else:
    print("a")

Measured memory_bytes: 9092
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const ll mod9 = 998244353;
const ll INF = 1001001001;
const ll LINF = 1001001001001001001;

void prvec(vector<ll> vec){
    ll n = vec.size();
    rep(i,n) cout << i << " " << vec.at(i) << "\n";
}

void pr2d(vector<vector<ll>> vvec){
    ll h = vvec.size();
    ll w = vvec.at(0).size();
    rep(i,h){
        rep(j,w){
            cout << vvec.at(i).at(j) << " ";
        }
        cout << "\n";
    }
}

int main(){
    ll n, x, m  ; cin >> n >> x >> m;
    ll a = x;
    vector<ll> lc(m,0);
    ll cur = 1;
    lc.at(a) = cur;
    bool no_loop = false;

    while(true){
        a = (a*a)%m;
        cur++;
        if(lc.at(a)==0) lc.at(a) = cur; else break;
        if(cur==n) break;
    }
    ll loop_start = lc.at(a);
    ll loop_length = cur - loop_start;

    ll nol=INF,stop=INF;
    if(loop_length){
        nol = (n-(loop_start-1))/loop_length; //number of laps(切り捨て)
        stop = (n-(loop_start-1))%loop_length; //最終周でいくつ進むか
    }else{
      	loop_start++;
    }

    ll ans = 0;
    rep(i,m){
        if(lc.at(i) == 0){
            continue;
        }else if(lc.at(i)<loop_start){
            ans += i;
        }else{
            if(lc.at(i)-loop_start<stop){
                ans += (nol+1)*i;
            }else{
                ans += nol*i;
            }
        }
        //cout << i << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4052
def main():
    D,G = [int(x) for x in input().split()]
    min_cnt = 0
    bonus = []
    for i in range(D):
        p,c = [int(x) for x in input().split()]
        bonus.append((p,c))
        min_cnt += p
    # print(bonus)
    # print(min_cnt)

    for bit in range(1<<D):
        score = 0
        cnt = 0
        for i,(p,c) in enumerate(bonus):
            if (1<<i) & bit:
                score += 100*(i+1)*p+c
                cnt += p
        # print(bin(bit),i,score,cnt,min_cnt)
        if score >= G:
            min_cnt = min(min_cnt, cnt)
        else:
            for i in reversed(range(0,D)):
                if (1<<i) & bit:
                    continue
                pi,ci = bonus[i]
                for j in range(pi-1):
                    score += 100*(i+1)
                    cnt += 1
                    # print(bin(bit),i,j,p,c,score,cnt,min_cnt)
                    if score >= G:
                        # print('break')
                        min_cnt = min(min_cnt, cnt)
                        break
    print(min_cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int K = sc.nextInt();
        int X = sc.nextInt();
        int end = Math.min(1000000, X + K - 1);
        for (int i = Math.max(-1000000, X - K + 1); i <= end; i++) {
            out.print(i);
            if (i != end) {
                out.print(" ");
            }
        }
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

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

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

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

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

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

  rep(i, k) {
    if (a >= b) {
      b *= 2;
      continue;
    }
    if (b >= c) {
      c *= 2;
      continue;
    }
  }
  if (a < b && b < c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		if (n % 2 == 0) {
			System.out.println(n);
		} else {
			System.out.println(n * 2);
		}
	}

}


Measured memory_bytes: 21844
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;

int change(vec v){
    int ret=0,bi=1;
    rep(i,26){
        ret+=v[i]*bi;
        bi*=2;
    }
    return ret;
}
int dp[1<<26+2];
main(){

    string ss;cin>>ss;
    int n=ss.size();
    //rep(i,1<<26+2)dp[i]=INF;
    vec s;
    rep(i,n){
        s.pb((int)(ss[i]-'a'));
    }
    vec counter(26);
    rep2(i,1,n){
        counter[s[i-1]]^=1;
    }
    int flag=1;
    rep(i,26)flag-=counter[i];
    if(flag>=0){
        cout<<1<<endl;return 0;
    }
    counter=vec(26);
    dp[0]=0;
    rep(i,n+1){
        int now=change(counter);
        if(dp[now]==0&&now)dp[now]=INF;
        rep(j,26){
            vec temp=counter;
            temp[j]^=1;
            int place=change(temp);
            if(dp[place]==0&&place)dp[place]=INF;
            dp[now]=min(dp[now],dp[place]+1);
        }
        if(i<n)
        counter[s[i]]^=1;
        else
          cout<<dp[now]<<endl;
    }
    return 0;
}



Measured memory_bytes: 265464