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

using namespace std;
using ll = long long;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount

string color= "RGBY";

int main() {
    int H, W, d;
    cin>>H>>W>>d;
    for(int i = 0; i < H; i++)
    {
        for(int j = 0; j < W; j++)
        {
            int c1 = (i+j)/d%2;
            int c2 = (i-j+W)/d%2;
            int c =c1*2+c2;
            cout<<color[c];
        }
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

#define MAX 100000

signed main() {
    int n, q;
    cin >> n;
    ll sum = 0;
    ll cnt[MAX + 1] = {};
    ll a[n];
    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
        sum += a[i];
    }
    cin >> q;
    ll b[q], c[q];
    rep(i, q) {
        cin >> b[i] >> c[i];
    }
    rep(i, q) {
        sum -= b[i] * cnt[b[i]];
        sum += c[i] * cnt[b[i]];
        cout << sum << endl;
        cnt[c[i]] += cnt[b[i]];
        cnt[b[i]] = 0;
    }
    return 0;
}

Measured memory_bytes: 6756
#include<stdio.h>

int main() {
        int n;
        scanf("%d", &n);
        long long a[n], dp[n][n];
        for( int i=0; i<n; ++i )
                scanf("%lld",a+i), dp[i][i] = 0;
        for( int d=1; d<n; ++d )
                for( int l=0; l<=n-1-d; ++l )
                {
                        dp[l][l+d] = 1000000000000000000;
                        for( int m=l; m<l+d; ++m )
                                if( dp[l][m] + dp[m+1][l+d] < dp[l][l+d] )
                                        dp[l][l+d] = dp[l][m] + dp[m+1][l+d];
                        for( int m=l; m<=l+d; ++m )
                                dp[l][l+d] += a[m];
                }
        printf("%lld\n", dp[0][n-1] );
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define fi first
#define se second
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n, a[N], dp[65][N];
ll k;
int main()
{
	scanf("%d%lld", &n, &k);
	for(int i=1; i<=n; i++) scanf("%d", a+i);
	for(int i=1; i<=n; i++) dp[0][i] = a[i];
	for(int j=1; j<=62; j++)
		for(int i=1; i<=n; i++)
			dp[j][i] = dp[j-1][dp[j-1][i]];
	int c = 1;
	for(int j=62; j>=0; j--)
		if((k>>j)&1) c = dp[j][c];
	printf("%d\n", c);
	return 0;
}

Measured memory_bytes: 53832
import sys
import math

lines = sys.stdin.readlines()
# print(lines)
n = int(lines[0].rstrip())
heights = [int(x) for x in lines[1].rstrip().split()]
# print(heights)
tot = 0
for i in range(n-1):
    if heights[i] <= heights[i+1]:
        continue
    else:
        diff = heights[i] - heights[i+1]
        heights[i+1] += diff
        tot += diff

print(tot)

Measured memory_bytes: 33516
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll INF = 1LL << 62;
const int inf = 1 << 30;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    char A, B; cin >> A >> B;
    int a = (A == 'H');
    int b = (B == 'H');

    cout << ((a^b) ? "D":"H") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

bool check(const string& s, const string& t) {
    map<char, set<char>> mp;
    rep(i, s.size()) mp[s[i]].insert(t[i]);
    for(auto&& p: mp) {
        if(p.se.size() > 1) {
            return false;
        }
    }
    return true;
}

int main(){
    string s, t;
    cin >> s >> t;
    map<char, set<char>> mp;
    rep(i, s.size()) mp[s[i]].insert(t[i]);
    if(check(s, t) && check(t, s)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 776
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
def div2(t):
    count = 0
    while t % 2 == 0:
        count += 1
        t //= 2
    return count
b = np.array([div2(i) for i in a])
odd = len(b[b == 0])
four = len(b[b >= 2])
if odd == 0:
    print('Yes')
elif odd == n:
    print('No')
elif odd <= four or ((odd == four + 1) and (odd + four) == n):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 23072
# -*- coding: utf-8 -*-
"""
Created on Sat Apr  4 20:49:45 2020

@author: naoki
"""

K = int(input())

count = K
for keta_num in range(1,100):
    op = list(map(str,[i for i in range(1,10)]))
    for keta in range(1,keta_num):
        op = [j + i for j in op for i in [str(int(j[-1])-1),str(int(j[-1])),str(int(j[-1])+1)]  \
                         if int(i) >= 0 and int(i) <=9]
    if count > len(op):
        count -= len(op)
    else:
        print(int(op[count-1]))
        break

Measured memory_bytes: 68012
// --------------
// Tejas Pandey  |
// 28 - 03 - 20  |
// Atcoder BC 160|
// --------------

#include <bits/stdc++.h>
using namespace std;

#define mod 998244353
#define vi vector<int>
typedef long long int ll;

int main (void)
{
  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  ll red[a],green[b],cr[c];
  priority_queue<ll> clr;
  for(int i = 0;i < a;i++) cin >> red[i];
  sort(red,red + a);
  reverse(red, red + a);
  for(int i = 0;i < b;i++) cin >> green[i];
  sort(green,green + b);
  reverse(green, green + b);
  for(int i = 0;i < c;i++) cin >> cr[i],clr.push(cr[i]);
  ll ans = 0;
  for(int i = 0;i < x;i++){
    if(clr.top() > red[i]) ans += clr.top(),clr.pop(),clr.push(red[i]);
    else ans += red[i];
  }
  for(int i = 0;i < y;i++){
    if(clr.top() > green[i]) ans += clr.top(),clr.pop(),clr.push(green[i]);
    else ans += green[i];
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 3704
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>

using ll = long long;

using namespace std;

using P = pair<int, int>;
#define fi first
#define se second

#define INF 10000000

struct snuke {
    int x, y, dir;
    P dist;
};

vector<P> direction{
    {1, 0},
    {0, 1},
    {-1, 0},
    {0, -1}
};

int main() {
    int h, w, k, x1, y1, x2, y2;
    cin >> h >> w >> k >> x1 >> y1 >> x2 >> y2;
    x1--; x2--; y1--; y2--;
    vector d(h, vector(w, vector<P>(4, {INF, INF})));
    vector grid(h, vector(w, false));
    for (int i=0; i<h; i++) {
        string s; cin >> s;
        for (int j=0; j<w; j++) {
            if (s[j] == '@') {
                grid[i][j] = true;
            }
        }
    }
    priority_queue<snuke, vector<snuke>, function<bool(snuke, snuke)>> pq([](snuke a, snuke b) {
        return a.dist > b.dist;
    });
    pq.push({x1, y1, 0, {0, 0}});
    d[x1][y1][0] = {0, 0};
    while (!pq.empty()) {
        snuke f = pq.top(); pq.pop();
        if (f.dist > d[f.x][f.y][f.dir]) continue;
        if (f.x == x2 && f.y == y2) {
            cout << f.dist.fi + (f.dist.se > 0) << '\n';
            return 0;
        }
        P newd = {f.dist.fi + (f.dist.se > 0), 0};
        for (int dir=0; dir<4; dir++) {
            if (newd < d[f.x][f.y][dir]) {
                d[f.x][f.y][dir] = newd;
                pq.push({f.x, f.y, dir, newd});
            }
        }
        f.x += direction[f.dir].fi;
        f.y += direction[f.dir].se;
        f.dist.se++;
        if (f.dist.se > k) {
            f.dist.fi += f.dist.se / k;
            f.dist.se %= k;
        }
        if (0 <= f.x && f.x < h && 0 <= f.y && f.y < w && f.dist < d[f.x][f.y][f.dir] && !grid[f.x][f.y]) {
            d[f.x][f.y][f.dir] = f.dist;
            pq.push(f);
        }
    }
    cout << -1 << '\n';
    return 0;
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  int count = 0;
  
  if(a % 2 == 1 && a == b && b == c){
    cout << 0 << endl;
  }
  else if(a == b && b == c){
    cout << -1 << endl;
  }
  else{ 
    while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){
      int aa = a;
      int bb = b;
      int cc = c;
      a = (bb + cc) / 2;
      b = (aa + cc) / 2;
      c = (aa + bb) / 2;
      count++;
    }
    cout << count << endl;
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
static const int INF = 2000000000;

int main(){
  int n;
  cin >> n;
  string ans = "";
  if (n == 0) ans = "0";
  while(n != 0){
    if (n % 2 != 0){
      n--;
      ans = '1' + ans;
    }
    else ans = '0' + ans;
    n /= -2;
  }
  cout << ans << endl;
}



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

int main() {
  string S;
  cin >> S;
  string ans ="No";
  if (S[0]==S[1] && S[2]==S[3] && S[0]!=S[2]) {
    ans ="Yes";
  }
  if (S[0]==S[2] && S[1]==S[3] && S[1]!=S[2]) {
    ans ="Yes";
  }
  if (S[0]==S[3] && S[1]==S[2] && S[0]!=S[1]) {
    ans ="Yes";
  }
  cout << ans << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void){
    
    //変数：入力する値を定義する
    int a, b;
    
    //変数：商d、余りr、浮動小数fを定義
    int d, r;
    double f;
    
    //変数の入力
    cin >> a >> b;
    
    //各変数の計算
    d = a / b;
    r = a % b;
    f = (double)a / b;
    
    //答えを表示する
    printf("%d %d %f\n", d, r, f);
    
}

/*****************  　キャスト演算　 *******************
 
 変数の型を一時的に変更することができる　➡︎　キャスト演算を使用
 
    書き方：変数名の前に（　型　）を書く
        例：(int)number  ➡︎　整数
            (double)number  ➡︎　少数
            (long)number  ➡︎　でかい少数、対応
            (float)number　➡︎　まぁまぁ少数、対応
            (char)number　➡︎　文字の型
 
 *******************************************************/
 

 
 /*****************  　printF()　 *******************
 
    少数点の表示個数を決めたい時に使用
    
        printf("%d %d %f\n", d, r, f);
            1つ目の%dにdの値が入る
            2つ目の%dにrの値が入る
            3つ目の%.5fにfの値が入る
        
            整数：%d
            %f：少数
            %c：文字
            %S：文字列
            
            米：％と文字の間に「 数字 」OR「 .数字 」を書くことで表示できる個数を制御
            
 
 *******************************************************/
 
 
 
 
 
 
 
 
 


Measured memory_bytes: 3232
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

int D;
ll G;
cin>>D>>G;
int p[D+1],c[D+1];
rep3(i,D)cin>>p[i]>>c[i];
int min_=1e9;
rep(i,1<<D){
    ll sum=0;
    int count=0;
    rep3(j,D){
        if((i>>(j-1))&1){
            sum+=c[j];
            sum+=j*100*p[j];
            count+=p[j];

        }
    }
    if(sum>=G){
        min_=min(min_,count);
        continue;
    }
    else{
        bool break1=false;
        repr3(j,D){
            if((i>>(j-1))&1)continue;
            rep(k,p[j]-1){
                sum+=100*j;
                count++;
                if(sum>=G){
                    min_=min(min_,count);
                    break1=true;
                    break;
                }

            }
            if(break1)break;
            

        
        }

    }

}
cout<<min_<<endl;
return 0;
}

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

using namespace std;

const int N = 200000;

int n;
int a[N + 1];
int pos[N + 1];
int f[N + 1];
int si[N + 1];

int find(int x) {
	return f[x] = (f[x] == x ? x : find(f[x]));
}

int main() {
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++) pos[a[i]] = i;
	for(int i = 1; i <= n; i++) f[i] = i;
	for(int i = 1; i <= n; i++) si[i] = 1;
	for(int i = 1; i < n; i++)
		if(pos[i] < pos[i + 1])
			 si[find(i + 1)] += si[find(i)], f[i] = f[i + 1];
	int res = n;
	for(int i = 1; i <= n; i++) res = min(res, n - si[find(i)]);
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)


int main(void){
    int a[200],key,n;

    scanf("%d",&n);

    REP(i,n){
        scanf("%d",&a[i]);
    }
    REP(i,n)
        if(i < n - 1)
            printf("%d ",a[i]);
        else
            printf("%d\n",a[i]);

    REP(i,n - 1){
        key = a[i + 1];
        int j = i;
        while(j >= 0 && a[j] > key){
            a[j + 1] = a[j];j--;
        }
        a[j + 1] = key;
        REP(k,n){
            if(k < n - 1)
                printf("%d ",a[k]);
            else
                printf("%d\n",a[k]);
        }
    }
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (auto &e : v) cin >> e;

  vector<vector<int>> dpl(n + 1, vector<int>(n + 1, -1e9)), dpr(n + 1, vector<int>(n + 1, -1e9));
  dpl[0][0] = dpr[0][0] = 0;

  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      dpl[i][j] = dpl[i - 1][j];
      if (j) dpl[i][j] = max(dpl[i][j], dpl[i - 1][j - 1] + v[i - 1]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      dpr[i][j] = dpr[i - 1][j];
      if (j) dpr[i][j] = max(dpr[i][j], dpr[i - 1][j - 1] + v[n - i]);
    }
  }

  int m = 0;
  for (int l = 0; l <= k; l++) {
    for (int lp = 0; l + lp <= k && lp <= l; lp++) {
      for (int r = 0; l + lp + r <= k && l + r <= n; r++) {
        for (int rp = 0; l + lp + r + rp <= k && rp <= r; rp++) {
          m = max(m, dpl[l][l - lp] + dpr[r][r - rp]);
        }
      }
    }
  }
  cout << m << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=998244353;

#define MAX_N 200020
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;

    inv[i]=(inv[i]+MOD)%MOD;
    fac[i]=(fac[i]+MOD)%MOD;
    ifac[i]=(ifac[i]+MOD)%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r-1);
}

ll mod_pow(ll x,ll n){
    x%=MOD;
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%MOD;
        x=x*x%MOD;
        n/=2;
    }
    return res;
}

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

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


ll N,M,K;

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

  setComb();

  ll nans=0;
  for(ll i=1;i<=min(M,K-1);i++){
      ll c=ifac[i];
      for(ll j=0;j<i;j++){
          mul(c,(M-j)%MOD);
      }

      ll res=0;
      for(ll j=1;j<=i;j++){
          ll p=mod_pow(j,N);
          mul(p,comb(i,j));
          if((i-j)%2==0) add(res,p);
          else add(res,MOD-p);
      }
      mul(res,c);
      add(nans,res);
  }

  ll ans=mod_pow(M,N);
  add(ans,MOD-nans);
  cout<<ans<<endl;

  return 0;
}



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

int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    int d[N];
    for(int i = 0; i < N; i++){
        cin >> d[i];
        cout << d[i] << (i+1 == N ? "" : " ");
    }
    
    for(int i = 1; i < N; i++){
        int now = d[i], j = i - 1;
        for(; j >= 0; j--){
            d[j+1] = d[j];
            if(d[j] < now) break;
        }
        d[j+1] = now;
        
        cout << endl;
        for(int k = 0; k < N; k++){
            cout << d[k] << (k+1 == N ? "" : " ");
        }
    }
    cout << endl;
    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    string s;
    cin >> s;
    bool ok = 0;
    FOR(i, 0 ,s.size() - 1)
        if(s[i] == '7') ok = 1;
    if(ok) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(void){
    int d,sum;
    while(cin>>d){
        sum=0;
        for(int i=1 ;d*i <= 600-d;i++){
            int f=d*i;
            sum += f*f*d;
        }
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
N = int(raw_input())
s = sorted([int(raw_input()) for i in range(N)])


_sum = sum(s)


def select_min(l):
    if len(l) == 0:
        return 0
    cand = min(l)
    if cand % 10 > 0:
        return cand
    return select_min([i for i in l if i != cand])


if _sum != 0 and _sum % 10 == 0:
    cand = filter(lambda x: x > 0 and x % 10 != 0, s)
    debt = select_min(cand)
    _sum -= debt

if _sum == 0 or _sum % 10 == 0:
    print(0)
else:
    print(_sum)


Measured memory_bytes: 2568
""" AtCoder """

ABCD = input()

l = ['+', '-']

for i in range(8):
    ans = ABCD[0] + l[(i >> 0) & 1] + ABCD[1] + l[(i >> 1) & 1] + ABCD[2] + l[(i >> 2) & 1] + ABCD[3]
    if eval(ans) == 7:
        print(ans+"=7")
        exit()



Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int minval=INT_MAX;
bool res(vector <int> &,int ,bool );
int main() {
    int n,k;
    cin>>n>>k;
    vector <int> arr(n);
    vector <bool> dp(k+1,false);
    for(int i=0;i<n;i++){
        cin>>arr[i];
        minval=min(minval,arr[i]);
    }
    dp[minval]=1;
    for(int i=0;i<k+1;i++){
        for(int j=0;j<n;j++){
            if(i>=arr[j])
                dp[i]=dp[i]||(!dp[i-arr[j]]);
            if(dp[i]==true){
                break;
            }
        }
    }
    /*
    for(int i=0;i<k+1;i++){
        for(int j=0;j<n;j++){
            dp[i+arr[j]]=dp[i+arr[j]]||(!dp[i]);
        }
    }
     */
    if(dp[k]==true)
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
    /*
    if(res(arr,k,0))
        cout<<"second"<<endl;
    else
        cout<<"first"<<endl;
     */
}
bool res(vector <int> &arr,int weight,bool q){
    if(weight<minval)
        return !q;
    if(weight==minval)
        return q;
    for(int i=0;i<arr.size();i++){
        if(res(arr,weight-arr[i],!q)==q)
            return q;
    }
    return !q;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>
#include <cstring>
using namespace std;
typedef long long ll;
ll INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	int n,black=0,white=0;
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='#') black++;
		else white++;
	}
	int b=0,w=0,ans=INT_MAX;
	for(int i=0;i<n;i++){
		if(s[i]=='#') b++;
		else w++;
		ans=min(ans,b + white-w);
	}
	ans=min(ans,white);
	ans=min(ans,black);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
#define ll long long
#define cpp boost::multiprecision::cpp_int
#define dequeue deque
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
const double PI = 3.1415926535897932384626433832795;
struct edge {
	int to;
	ll cost;
};
void reverse(string* s) {
	reverse((*s).begin(), (*s).end());
}
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
void COME_LET_THE_GAMES_BEGIN() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
}
int main() {
	COME_LET_THE_GAMES_BEGIN();
	string s;
	cin >> s;
	s[3] = '8';
	cout << s << endl;
}

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

const ll MAXN = 200000;
const long long INF = 1LL<<60;

ll N, ans=1, tmp=0, flag=0;
vector<ll> a, vemp(1,INF), PQ(100005,INF);
//vector<pair<ll,ll>> PQ;

// 最長増加部分列の長さを求める
void LIS() {
    while(!a.empty()) {
        ll num = a.back();
        a.pop_back();
        ll id = upper_bound(PQ.begin(), PQ.end(), num)-PQ.begin();
        PQ[id] = num;
    }
    for(int i=0;i<100005;i++) {
        if(PQ[i]==INF) {
            ans = i;
            break;
        }
    }
}    

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll in1;
        cin >> in1;
        a.push_back(in1);
    }
    LIS();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2168
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int m = sc.nextInt();
    int[][] arr = new int[n][2];
    int[][] dp = new int[n+1][n*1000+1];

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        for (int i=0; i<n; i++) {
            arr[i][0] = sc.nextInt();
            arr[i][1] = sc.nextInt();
        }

        for (int i=0; i<n+1; i++) {
            for (int j=0; j<n*1000+1; j++) {
                dp[i][j] = (int)1e9 + 50000;
            }
        }

        dp[0][0] = 0;

        for (int i=1; i<=n; i++) {
            for (int j=0; j<=n*1000; j++) {
                if (j < arr[i-1][1]) {
                    dp[i][j] = dp[i-1][j];
                } else {
                    dp[i][j] = Math.min(dp[i-1][j], dp[i-1][j-arr[i-1][1]]+arr[i-1][0]);
                }
            }
        }

        int ret = 0;

//        System.out.println(dp[1][5]);

        for (int i=0; i<=n*1000; i++) {
//            System.out.println(dp[n][i]);
            if (dp[n][i] <= m) {
                ret = Math.max(ret, i);

            }
        }

        System.out.println(ret);

    }
}



Measured memory_bytes: 81652
#include <iostream>
using namespace std;
int main(void){
    string h;
    cin>>h;
    if (h.size()%2==1){
        cout<<"No";
    }
    else{
        for (int i = 0;i<h.size();i+=2){
            if (h.substr(i,2)!="hi"){
                cout<<"No";
                exit(0);
            }
        }
        cout<<"Yes";
    }
    
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define all(x) x.begin(),x.end()
#define mod 1000000007

ll expo(ll a,ll b){ll r=1;a=a%mod;while(b){if(b%2)r=(r*a)%mod;a=(a*a)%mod;b=b/2;}
return r;}
struct greaterr
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};



/*vector<bool> sieve(10000007,true);

void help(){
     sieve[0] = false;
     sieve[1] = false;

     for(int i=2;i*i<=10000000;++i){
        if(sieve[i]){
            for(int j=i*i;j<=10000000;j+=i)
                sieve[j] = false;

        }
     }

}


ll exp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}
*/
int main() {
   fastIO

   int n;
   cin>>n;

   double arr[n];

   fo(i,n)
     cin>>arr[i];

     double sum = 0.0;

     fo(i,n)
       sum+= 1/arr[i];

       double ans = 1/sum;

       cout<<setprecision(6)<<fixed<<ans;


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, k;
    cin >> n >> k;

    vl p(n);
    vl rui(n+1);  // rui[i+1] : p[i]までの和
    rep(i, n) {
        cin >> p[i];
        rui[i+1] = rui[i] + p[i];
    }

    ll u = 0;
    rep(i, n-k+1) {
        chmax(u, rui[i+k] - rui[i]);
    }

    u += k;

    double ans = (double)u/2.0;
    exout(ans);
    re0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    int n,m;
    scanf("%d%d",&n,&m);
    n += m;
    if(n%2) printf("%d\n",n/2+1);
    else printf("%d\n",n/2);
    return 0;
}

Measured memory_bytes: 256
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    b = sorted([ai - (i + 1) for i, ai in enumerate(a)])
    b_center = b[n // 2]
    return sum([abs(bi - b_center) for bi in b])


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 27580
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  int N;
  scanf("%d", &N);
  if(N==1){
    cout << "Hello World" << endl;
  }
  else{
    int a,b;
    cin >> a >> b;
    cout << a+b << endl;
  }

}



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

int main(){
	ll a, b, c;
	cin >> a >> b >> c;
	ll x = c-a-b;
	if (x < 0) {
		cout << "No" << endl;
		return 0;
	}
	ll s = 4 * a * b, t = x*x;
	if (s < t) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}

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

int n, a, fp;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) {
		cin >> a;
		if(a % 2 && i % 2) ++fp;
	}
	cout << fp << endl;
	return 0;
}


Measured memory_bytes: 3604
# -*- coding: utf-8 -*-
import itertools

# 棒の本数
n = int(input())

# 棒のリスト
lods = list(map(int, input().split()))

# 3本なければ三角形は作れない
if (n < 3):
  print(0)
  exit()

# 確認
count = 0
for data in itertools.combinations(lods, 3):
  if (data[0] != data[1]
      and data[1] != data[2]
      and data[2] != data[0]
      and (data[0]+data[1]) > data[2]
      and (data[1]+data[2]) > data[0]
      and (data[2]+data[0]) > data[1]):
    count += 1

print(count)


Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
#define ll      long long int
#define MOD     1000000007
#define pb      push_back
#define mp      make_pair
#define all(v)  (v).begin(),(v).end();
#define T		int t;cin>>t;while(t--)
#define IOS     ios_base::sync_with_stdio(false);cin.tie(NULL);

int main() {


	int n;
	cin >> n;

	int a[n], b[n], c[n];

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

	int dp[n][3];


	dp[0][0]  = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

	for (int i = 1 ; i < n ; i++) {

		for (int j = 0 ; j < 3; j ++) {

			if (j == 0) {

				dp[i][j] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];

			}

			else if ( j == 1) {

				dp[i][j] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];

			}

			else {

				dp[i][j] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];

			}

		}
	}

	int ans = -1;

	for (int i = 0 ; i  < 3; i++) {
		ans = max(ans, dp[n - 1][i]);


	}

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


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

int main() {
  int N, K;
  cin >> N >> K;
  set<int> dislike;
  for (int i = 0; i < K; i++) {
    int num;
    cin >> num;
    dislike.insert(num);
  }
  int ans;
  for (int i = N; i < 1000000; i++) {
    bool can = true;
    int tmp = i;
    if (dislike.count(tmp%10)) can = false;
    while (tmp > 9) {
      tmp /= 10;
      int tmp2 = tmp % 10;
      if (dislike.count(tmp2)) can = false;
    }
    if (can) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

#define endl "\n"
typedef long long int ll;
#define f first
#define s second

inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}

//DEBUG
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;

ll INF = 1e10;
int MOD = 1e9+7;

int main(){
    #ifndef ONLINE_JUDGE
        freopen("debug.txt", "w", stderr);
    #endif
    fastio();
    int x;
    cin>>x;
    cout<<(x >= 30 ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
    #include <vector>
    #include <map>
    #include <algorithm>
     
    using namespace std;
     
    #define rep(i,n) for(int i=0; i<n; i++)
     
    typedef unsigned int ui;
     
    ui xor128(void) {
    static ui x = 123456789;
    static ui y = 362436069;
    static ui z = 521288629;
    static ui w = 88675123;
    ui t;
    t = x ^ (x << 11);
    x = y; y = z; z = w;
    return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
    }
     
    int main() {
    int n;
    cin >> n;
    vector<int> ratio(n + 1);
    vector<int> ratio2(n + 1);
    rep(i,n) {
    string hand;
    cin >> hand;
    rep(j, n) {
    if (hand[j] == 'o') {
    ratio[i] += 3;
    }
    }
    }
    int maxratio = 0;
    rep(i, n) {
    maxratio = max(maxratio, ratio[i+1]);
    }
    rep(i, n) {
    if (ratio[i] == maxratio) {
    ratio2[i] = 1;
    }
    }
    rep(i, n-1) {
    ratio[i+1] += ratio[i];
    ratio2[i+1] += ratio2[i];
    }
    int randmax = ratio[n-1];
    rep(i,500) {
    int a;
    int h = xor128() % randmax;
    rep(j,n) {
    if (ratio[j] > h) {
    cout << j+1 << endl;
    break;
    }
    }
    cin >> a;
    }
    randmax = ratio2[n-1];
    rep(i,500) {
    int a;
    int h = xor128() % randmax;
    rep(j,n) {
    if (ratio2[j] > h) {
    cout << j+1 << endl;
    break;
    }
    }
    cin >> a;
    }
    return 0;
    }

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

using namespace std;

string s;

int main() {
    ios_base::sync_with_stdio(false);
    getline(cin, s);
    for (int i = 0; i < (int)s.length(); ++i) {
        if (s[i] == ' ' && s[i-1] != s[i+1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

typedef long long int ll;

int main()
  
{
	ll n,k,cnt=0;cin>>n>>k;
  	while(n>=k)
    {
    	n/=k;
      	cnt++;
    }
  if(n==0)
    cout<<cnt;
  else
    cout<<cnt+1;
}

Measured memory_bytes: 256
def submit():
    n = int(input())
    a = list(map(int, input().split()))

    abs_min = float('inf')
    minus_cnt = 0
    for e in a:
        if e < 0:
            minus_cnt += 1
        if abs(e) < abs_min:
            abs_min = abs(e)

    s = sum([abs(e) for e in a])
    if minus_cnt % 2:
        print(s - 2 * abs_min)
    else:
        print(s)
            

submit()

Measured memory_bytes: 14412
#include<cstdio>
#include<limits>
using namespace std;
void bubbleSort(int A[],int N){
    int flag=1;
    int cnt=0;
    while(flag){
        flag=0;
        for(int j=(N-1);j>=1;j--){
            if(A[j]<A[j-1]){
                int tmp;
                tmp=A[j];
                A[j]=A[j-1];
                A[j-1]=tmp;
                flag=1;
                cnt++;
            }
        }
    }
    for(int i=0;i<N;i++){
        printf("%d%c",A[i],i==(N-1)?'\n':' ');
    }
    printf("%d\n",cnt);
}

int main(){
    int num;
    scanf("%d",&num);
    int A[num];
    for(int i=0;i<num;i++){
        scanf(" %d",&A[i]);
    }
    bubbleSort(A,num);
    return 0;
}


Measured memory_bytes: 2740
#include<iostream>

#define MOD (long(1e9) + 7)

using namespace std;

int main(){
    int N;
    cin >> N;
    
    long dp[N+1][64];
    for(int i=0; i<N+1; i++){
        for(int j=0; j<64; j++){
            dp[i][j] = 0;
        }
    }
    for(int i=0; i<4; i++){
        dp[1][i] = 1;
    }
    
    for(int i=1; i<N; i++){
        for(int j=0; j<64; j++){
            bool c = ((j%4 == 1) & (j/4%4 == 2)) | ((j%4 == 2) & (j/4/4%4 == 1)) | ((j/4%4 == 2) & (j/4/4%4 == 1)) | ((j%4 == 2) & (j/4%4 == 1));
            bool g = (j%4 == 3) & (j/4%4 == 1);
            
            for(int k=0; k<4; k++){
                if(c && k==3) continue;
                else if(g && k==2) continue;
                dp[i+1][j*4%64 + k] += dp[i][j];
                dp[i+1][j*4%64 + k] %= MOD;
            }
        }
    }
    long ans = 0;
    for(int i=0; i<64; i++){
        ans += dp[N][i];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

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

    sort(A.begin(), A.end());
    
    cout << A[N - 1] - A[0] << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
vector<long long>x; long long n;
int solve(long long p, long long pos) {
	int maxn = -999999;
	int pos1 = lower_bound(x.begin(), x.end(), p) - x.begin();
	if (pos1 != x.size() && x[pos1] == p) {
		maxn = 1;
	}
	if (x[pos] * x[pos] > p) {
		return maxn;
	}

	if (p%x[pos] == 0) {
		maxn = solve(p / x[pos], pos) + 1;
	}

	return max(maxn, solve(p, pos + 1));
}
int main() {
	for (int i = 1; i <= 18; i++) {
		for (int j = 0; j < (1 << i); j++) {
			string S = "";
			for (int k = 0; k < i; k++) {
				if ((j / (1 << k)) % 2 == 0)S += "2";
				if ((j / (1 << k)) % 2 == 1)S += "8";
			}
			x.push_back(stoll(S));
		}
	}
	sort(x.begin(), x.end());
	cin >> n;
	int r = solve(n, 0);
	if (r < 0 || n == 1)r = -1;
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 6900
X, Y, A, B, C = list(map(int, input().split()))
R = list(map(int, input().split()))
G = list(map(int, input().split()))
C = list(map(int, input().split()))

R.sort()
R.reverse()
G.sort()
G.reverse()
C.sort()
C.reverse()

R = R[:X]
G = G[:Y]

temp = 0
  
for i in range(len(C)) :
  if((X==0) and (Y==0)) :
    i = i-1
    break
  if(X==0) :
    last = G[Y-1]
    Y -= 1
    
  else :
    if(Y==0) :
      last = R[X-1]
      X -= 1
    else :
      if(R[X-1] < G[Y-1]) :
        last = R[X-1]
        X -= 1
      else :
        last = G[Y-1]
        Y -= 1

  if(C[i] < last) :
      break
  else :
    last = C[i]
    
print(sum(R[:X])+sum(G[:Y])+sum(C[:i])+last)

Measured memory_bytes: 23120
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <memory>
#include <numeric>
#include <type_traits>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
typedef long long ll;


void printVector(vector<int> v){
  rep(i,v.size()){
    cout << v[i] << " ";
  }
  cout << endl;
}


ll nFactorial(int n){
  ll res = 1;
  while(n > 0){
    res *= n;
    --n;
  }
  return res;
}


bool machingVector(vector<int> v, vector<int> p){
  bool res = true;
  rep(i,v.size()){
    if (p[i] != v[i]){
      res = false;
    }
    if (res == false) break;
  }
  return res;
}


int main(){
  int n;
  cin >> n;
  vector<int> v;
  rep(i,n){
    v.push_back(i+1);
  }

  vector<int> p(n), q(n);
  rep(i,n){
    cin >> p[i];
  }
  rep(i,n){
    cin >> q[i];
  }

  ll p_index, q_index;
  rep(i,nFactorial(n)){
    if (machingVector(v,p)){
      p_index = i;
    }
    if (machingVector(v,q)){
      q_index = i;
    }
    next_permutation(v.begin(), v.end());
  }
  cout << abs(p_index-q_index) << endl;
  

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define ve vector<ll>
#define dos pair<ll,ll>
#define vedos vector<dos>
#define rand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
int main()
{
  //flash;
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22)cout<<"bust";
  else cout<<"win";
  return 0;
}
//code the AC sol !
// BS/queue/map


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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

    if(s.size()==2){
        cout << s << endl;
    }else{
        rep(i,3){
            cout << s[2-i];
        }
        cout << endl;
    }
    return 0;
}
 
 


Measured memory_bytes: 256