akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << "\n"
#define COUTF(x) cout << setprecision(15) << (x) << "\n"
#define ENDL cout << "\n"
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll) x.size()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define MAX(x, y, z) max(x, max(y, z))
#define MIN(x, y, z) min(x, min(y, z))
#define ANS cout << ans << "\n"
#define RETURN(x)    \
  cout << x << "\n"; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << "\n"
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define LINE cerr << "[debug] line: " << __LINE__ << "\n";
#define debug(x) cerr << "[debug] " << #x << ": " << x << "\n";
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << "\n";
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  string N;
  cin >> N;
  COUT("ABC" + N);
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main()
{
    string s;
    cin>>s;
    int fo,bk,cnt=0;
    fo=10*(s[0]-'0')+(s[1]-'0');
    bk=10*(s[2]-'0')+(s[3]-'0');
    if((fo>=1 && fo<=12)&&(bk>=1 && bk<=12)) cout<<"AMBIGUOUS"<<endl;
    else if(fo>=1 && fo<=12) cout<<"MMYY"<<endl;
    else if(bk>=1 && bk<=12) cout<<"YYMM"<<endl;
    else cout<<"NA"<<endl;
    return 0;
}

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

using namespace std;


int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int ans = a + b;
  ans = max(ans, a * 2 - 1);
  ans = max(ans, b * 2 - 1);
  cout << ans << endl;
  return 0;
}

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

long long comb(long long n, long long r) {
    if (n-r < r) r = n-r;
    long long ret = 1;
    vector<bool> div(r+1, true);
    div[0] = div[1] = false;
    for (int i = n; i > n-r; i--) {
        ret *= i; assert(0 <= ret);
        for (long long d = 2; d <= r; d++) if (div[d]) {
            if (ret % d == 0) { ret /= d; div[d] = false; }
        }
    }
    return ret;
}

int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    map<long long, long long> mp;
    vector<pair<long long, long long>> data;
    for (int i = 0; i < n; i++) {
        long long e; cin >> e; mp[e]++;
    }
    for (const auto& e : mp) data.emplace_back(e);
    sort(data.begin(), data.end(), greater<pair<long long, long long>>());
    
    long long cnt = 0;
    long long sum = 0, ans = 0;
    double ave;
    for (int i = 0; i < (int)data.size(); i++) {
        long long v, c; tie(v, c) = data[i];
        if (a <= c && i == 0) {
            ave = v;
            for (long long r = a; r <= min(b, c); r++) {
                ans += comb(c, r);
            }
            break;
        }
        if (cnt + c < a) {
            cnt += c; sum += (c * v);
        } else {
            int add = a - cnt;
            sum += (v * add);
            ave = (double)sum / a;
            ans = comb(c, add);
            break;
        }
    }
    
    assert(0.00 <= ave && 0 <= ans);
    cout << fixed << setprecision(10) << ave << '\n';
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = input().split()
c = []
for i in range(a):
  c.append(int(b[i]))
g = []
for i in range(a):
  g.append(c[i] - i-1)
g.sort()
d = g[int(a/2)]
f = 0
for i in range(a):
  e = abs(c[i]-(d+i+1))
  f += e
print(f)

Measured memory_bytes: 33864
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;

int main(){
  int k,s;
  cin>>k>>s;
  int count=0;
  for(int i=0;i<=k;i++){
    for(int j=0;j<=k;j++){
      if(i+j<=s && s-i-j<=k) count++; 
    }
  }
  cout<<count<<endl;
  

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> A(H, vector<char>(W));
  
  for(int i=0; i<W+2; i++) cout << '#';
  cout << endl;
  for(int h=0; h<H; h++){
    for(int w=0; w<W; w++){
      if(w==0) cout << '#';
      cin >> A.at(h).at(w);
      cout << A.at(h).at(w);
      if(w==W-1) cout << '#';
    }
    cout << endl;
  }
  for(int i=0; i<W+2; i++) cout << '#';
}

Measured memory_bytes: 256
N = input().strip()
INFTY = 10**8
dp = [[INFTY for _ in range(2)] for _ in range(len(N)+1)]
a = int(N[-1])
for i in range(10):
    if i<a:
        dp[1][1] = min(dp[1][1],i+10-a)
    else:
        dp[1][0] = min(dp[1][0],i+i-a)
for k in range(2,len(N)+1):
    a = int(N[-k])
    for i in range(10):
        if i>=a:
            dp[k][0] = min(dp[k][0],dp[k-1][0]+i+i-a)
        if i-1>=a:
            dp[k][0] = min(dp[k][0],dp[k-1][1]+i+i-1-a)
        if i<a:
            dp[k][1] = min(dp[k][1],dp[k-1][0]+i+10-a)
        if i==0:
            dp[k][1] = min(dp[k][1],dp[k-1][1]+9-a)
        if 0<=i-1<a:
            dp[k][1] = min(dp[k][1],dp[k-1][1]+i+10-a+i-1)
print(min(dp[len(N)][0],dp[len(N)][1]+1))

Measured memory_bytes: 157860
#include <stdio.h>          // printf(), scanf()
#include <math.h>           // round()

int
main(int argc, char **argv)
{
	int p, q;

	int total = 0;
	int qsum = 0;
	int i = 0;
	while (scanf("%d,%d", &p, &q) != EOF)
	{
		i++;
		total += p * q;
		qsum += q;
	}

	printf("%d\n", total);
	printf("%.0f\n", round((double) qsum / i));
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD (int64_t)1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector

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

string S, T, U; 
int A, B; 
cin >> S >> T >> A >> B >> U;

if (S == U ) cout << A - 1 << ' ' << B << "\n";
else cout << A << ' ' << B - 1 <<  "\n";


return 0;
}
// 書いて考える．場合分け．情報整理．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
double pi= 3.14159265358979323846;
int main(){
	double R;
	cin>>R;
	printf("%.20lf\n",2*pi*R);
	return 0;
} 
//458.67252742410977361942
//458.67252742410977361942

//6.28318530717958623200
//6.28318530717958623200

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);


int main(){
    string s;cin>>s;
    vector<ll> v[26];
    unordered_map<char,ll> mp;
    rep(i,0,alp.size()-1){
        mp[alp[i]]=i;
    }
    rep(i,0,s.size()-1){
        v[mp[s[i]]].pb(i);
    }
    ll ans=inf;
    rep(i,0,25){
        if(v[i].size()==0){
            continue;
        }
        if(v[i].size()==1){
            ans=min(ans,max(v[i][0],s.size()-1-v[i][0]));
            continue;
        }
        ll maxi=-1;
        rep(j,0,v[i].size()-1){
            if(j==0){
                maxi=max(maxi,v[i][j]);
                maxi=max(maxi,v[i][j+1]-v[i][j]-1);
            }else if(j==v[i].size()-1){
                maxi=max(maxi,s.size()-1-v[i][j]);
            }else{
                maxi=max(maxi,v[i][j+1]-v[i][j]-1);
            }
        }
        ans=min(ans,maxi);
    }
    cout<<ans<<endl;
    return 0;
}






Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){

	int n;
	
		cin>>n;
		int c=0;
		while(n>3){
		if(n%3==0)n=n/3;
		else {n=n/3+1;}
		c++;
			
		}
		if(n>1)c++;
			cout<<c<<endl;


	

	return 0;
}

Measured memory_bytes: 1164
#include<stdio.h>

int main(){
  int i,j,hit,blow;
  char n1[5],n2[5];
  do{
    scanf("%s %s",n1,n2);
    if(!strcmp(n1,"0")&&!strcmp(n2,"0")) break;    
    for(hit=blow=i=0;i<4;i++){
      for(j=0;j<4;j++){
	if(n1[i]==n2[j]){
	  if(i==j) hit++;
	  else blow++;
	}
      }
    }
    printf("%d %d\n",hit,blow);
  }while(1);
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <math.h>
using namespace std;
int main(){
    long long int n,x,t;
    cin>>n>>x>>t;
    cout<<(((n-1)/x)+1)*t<<endl;
    return 0;
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  ll n,k;
  cin>>n>>k;
  ll h[n];
  for(ll i=0;i<n;i++)cin>>h[i];
  ll dp[n];
  for(ll i=0;i<n;i++)dp[i]=1e9+5;
  dp[0]=0;
  for(ll i=0;i<n;++i){
        for(ll j=i+1;j<i+k+1;++j){
            if(j<n){
                dp[j]=min(dp[i]+abs(h[j]-h[i]),dp[j]);
            }
        }
    }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define $$ long long int
#define pb push_back
#define db pop_back
#define q2(n) (n%2)==0
#define vp vector<pair <$$,$$> >
#define vctr vector<$$>
#define in(a) scanf("%lld",&a)
#define out(a) printf("%lld ",a)
#define loop(i,m,p) for ($$ i = m; i < p; i++)
#define loopn(i,m,p) for ($$ i = p-1; i >=m; --i)

using namespace std;


int main()
{
    $$ n;
    in(n);
    if (q2(n))
    {
    	/* code */ cout<<"0.50000\n";
    }
    else
    {
    	$$ q=(n/2)+1;
        float ans=(float)q/(float)n;
        cout<<ans<<endl;
    }



return 0;
}


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

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define REPR(i, n) for(ll i = n; i >= 1; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define INF 1e9+123
#define ALL(v) v.begin(), v.end()

int main(){
    ll N;
    cin>>N;
    ll sum=0;
    REP(i,N-1){
        sum+=i;
    }
    cout<<sum;
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
program main
    implicit none
    integer a, b, c, k
    integer rest, sum
    integer i 
    read(*,*) a, b, c, k

    sum = 0

    if(k >= a) then
        sum = sum + 1*a
        rest = k - a
    else
        sum = sum + 1*k
        rest = 0
    end if

    if(rest >= b) then
        rest = rest - b
    else
        rest = 0
    end if

    sum = sum + rest*(-1)

    write(*,*) sum
    
    
end program

Measured memory_bytes: 2860
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<ext/pb_ds/priority_queue.hpp>
using namespace std;

const int N = 20;
const int maxn = 2E5 + 20;

int n,v,Max,p[maxn],Min[maxn],Left[maxn][N],Right[maxn][N],f[1 << N],g[1 << N];

void Pre_Work(int k,int now)
{
	Left[1][k] = 1; Right[n][k] = n;
	for (int i = 2; i <= n; i++)
		Left[i][k] = p[i] - p[i - 1] <= now ? Left[i - 1][k] : i;
	for (int i = n - 1; i; i--)
		Right[i][k] = p[i + 1] - p[i] <= now ? Right[i + 1][k] : i;
}

int main()
{
	#ifdef DMC
		freopen("DMC.txt","r",stdin);
	#endif
	
	cin >> n >> v;
	for (int i = 1; i <= n; i++) scanf("%d",&p[i]);
	for (int x = v; ; x >>= 1)
	{
		Pre_Work(Max++,x);
		if (!x) break;
	}
	for (int i = 0; i <= n; i++) Min[i] = maxn; g[0] = n + 1;
	for (int o = 1; o < (1 << Max); o++)
	{
		g[o] = n + 1;
		for (int i = 0; i < Max; i++)
		{
			if (!(o & (1 << i))) continue;
			int op = o ^ (1 << i);
			f[o] = f[op] == n ? n : max(f[o],Right[f[op] + 1][i]);
			g[o] = g[op] == 1 ? 1 : min(g[o],Left[g[op] - 1][i]);
		}
	}
	for (int o = 0; o < (1 << Max); o++)
	{
		int A = o,B = ((1 << Max) - 1) ^ o;
		if (A & 1) A ^= 1; if (B & 1) B ^= 1;
		Min[f[A]] = min(Min[f[A]],g[B]);
	}
	for (int i = n - 1; i >= 0; i--) Min[i] = min(Min[i],Min[i + 1]);
	for (int i = 1; i <= n; i++)
		puts(Min[Left[i][0] - 1] <= Right[i][0] + 1 ? "Possible" : "Impossible");
	return 0;
}

Measured memory_bytes: 43392
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 5, mod = 1e6 + 3;
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
ll fac[2 * maxn];
int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    fac[0] = fac[1] = 1;
    for (int i = 2; i < 2 * maxn; ++i) fac[i] = fac[i - 1] * i % mod;
    int n;
    cin >> n;
    while (n--){
        ll x, d, n;
        cin >> x >> d >> n;
        if (d == 0){
            cout << quickpow(x, n) << '\n';
            continue;
        }
        if (x == 0){
            cout << 0 << '\n';
            continue;
        }
        ll inv = x * quickpow(d, mod - 2) % mod;
        if (n >= mod) cout << "0" << '\n';
        else cout << fac[inv + n - 1] * quickpow(fac[inv - 1], mod - 2) % mod * quickpow(d, n) % mod << '\n';
    }
    return 0;
}


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

int main() {
    int N;
    string S;
    cin>>N;
    cin>>S;
    int ans = 0;
    for(int i=0;i<S.size()-2;++i){
        if(S[i]=='A' & S[i+1]=='B' & S[i+2]=='C'){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 384
import static java.lang.Math.acos;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        double r=in.nextDouble();
        double pi=acos(-1.0);
        Double are=2*pi*r;
        System.out.printf("%.20f\n",are);
        
    }
}

Measured memory_bytes: 37572
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

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

  int inc = -1;
  int ans = 1;
  for (int i = 0; i < n - 1; i++) {
    if (inc == -1) {
      if (a[i] < a[i + 1]) {
        inc = 1;
      }
      if (a[i] > a[i + 1]) {
        inc = 0;
      }
    } else if (inc == 1) {
      if (a[i] > a[i + 1]) { 
        ans++;
        inc = -1;
      }
    } else if (inc == 0) {
      if (a[i] < a[i + 1]) {
        ans++;
        inc = -1;
      }
    }
  }

  cout << ans << ln;

  return 0;
}

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

int main(){
    string s;
    cin >> s;
    int cnt = 0;
    int l = 0, r = s.size()-1;

    int c = 0;
    while(l<=r){
        if(s[l]==s[r])l++,r--;
        else if(s[l]=='x')l++,c++;
        else if(s[r]=='x')r--,c++;
        else{
            cout << -1;
            return 0;
        }
    }
    cout << c;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <math.h>

int main(void){

  char str[10];
  char s[10]="Sunny";
  char c[10]="Cloudy";
  char r[10]="Rainy";

  scanf("%s", str);

  if(strcmp(str,s)==0){
    printf("%s\n", c);
  }else if(strcmp(str,c)==0){
    printf("%s\n", r);
  }else{
    printf("%s\n", s);
  }

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define maxe              *max_element
#define mine              *min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x;
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl;
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    ll n; cin>>n; ll a[n]; get(a);
    ll ans=a[0];
    for(ll i=1;i<n;i++)
    {
        ans=ans^a[i];
    }
    for(ll i=0;i<n;i++) cout<<(ans^a[i])<<" ";
}
















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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

int main(){

    ll x1, x2, x3, x4, x5; cin >> x1 >> x2 >> x3 >> x4 >> x5;

    if(!x1) cout << 1 << endl;
    if(!x2) cout << 2 << endl;
    if(!x3) cout << 3 << endl;
    if(!x4) cout << 4 << endl;
    if(!x5) cout << 5 << endl;


    return 0;
}

Measured memory_bytes: 3592
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, M = read_ints()

print(('Yes', 'No')[N != M])


Measured memory_bytes: 3188
#include<cstdio>

int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i = 0; i < n ; i++){
        scanf("%d",&a[i]);
    }
    for(int i = n - 1; i >= 0; i--){
        if(i != 0){
            printf("%d ",a[i]);
        }
        else{
            printf("%d",a[i]);
        }
    }
    printf("\n");
    return 0;
}


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

int main(){

  int N; cin >> N;
  
  vector<int> A(N);
  for(int i=0; i<N; i++)
    cin >> A.at(i);
  
  vector<int> flag;
  flag.push_back(A.at(0));
  
  for(int i=1; i<N; i++){
    
    if(flag.at(0) >= A.at(i)){
      flag.insert(flag.begin(),A.at(i));
      continue;
    }
    
    auto it = lower_bound(flag.begin(),flag.end(),A.at(i));
    *(it-1) = A.at(i);

  }
  
  cout << flag.size() << endl;
  
  
}

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s; cin >> s;
	int k; cin >> k;
	int len = s.size();
	vector<int> blocks(len + 1, 0);
	int first = 0, last = 0;
	for(int i = 0, j = 0; i < len; i = j){
		while(j < len && s[i] == s[j]) j++;
		if(j - i == len){
			long long tot = 1ll * len * k;
			cout << tot / 2 << endl;
			return 0;
		}
		if(i == 0) first = j - i;
		if(j == len) last = j - i;
		blocks[j - i] += k;
	}
	if(s[0] == s[len - 1]){
		blocks[first] -= k - 1;
		blocks[last] -= k - 1;
		blocks[first + last] += k - 1;
	}
	long long ans = 0;
	for(int i = 0; i < len; i++){
		ans += 1ll * (i / 2) * blocks[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
S = [input() for _ in range(N)]
c = {}

for s in S:
    if c.get(s):
        c[s] += 1
    else:
        c[s] = 1


s_items = sorted(c.items(), key=lambda x: x[1], reverse=True)
n_max = s_items[0][1]

print('\n'.join(sorted(map(lambda x: x[0], filter(lambda x: x[1] == n_max, s_items)))))

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll x, y, z, k;cin >> x >> y >> z >> k;
	vector<ll> a(z);REP(i, x)cin >> a[i];
	vector<ll> b(y);REP(i, y)cin >> b[i];
	vector<ll> c(z);REP(i, z)cin >> c[i];

	vector<ll> v;
	REP(i, x){
		REP(j, y){
			v.PB(a[i] + b[j]);
		}
	}

	sort(ALL(v),greater<ll>());
	vector<ll> ans;

	REP(i, min(3000, (int)v.size())){
		REP(j, z){
			ans.PB(v[i] + c[j]);
		}
	}

	sort(ALL(ans), greater<ll>());

	REP(i, k)cout << ans[i] << endl;

	return 0;
}


Measured memory_bytes: 42728
#pragma GCC optimize("Ofast")
#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()
#define ln '\n'
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true;} return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////


struct UnionFind {
    vector<int> node;

    UnionFind() = default;
    UnionFind(int x) {init(x);}

    void init(int x) {
        node.assign(x,-1);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (node[x] > node[y]) swap(x,y);
        node[x] += node[y];
        node[y] = x;
        return true; 
    }

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

    int root(int x) {
        if (node[x] < 0) return x;
        return node[x] = root(node[x]);
    }

    int size(int x) {
        return -node[root(x)];
    }
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,M,K; cin >> N >> M >> K;
    UnionFind uf1(N),uf2(N);
    vector<int> cnt1(N),cnt2(N);
    rep(i,M) {
        int A,B; cin >> A >> B;
        --A; --B;
        uf1.merge(A,B);
        cnt1[A]++;
        cnt1[B]++;
    }
    rep(i,K) {
        int C,D; cin >> C >> D;
        --C; --D;
        if (uf1.same(C,D)) {
            cnt2[C]++;
            cnt2[D]++;
        }
    }

    rep(i,N) cout << uf1.size(i) - cnt1[i] - cnt2[i] - 1 << " ";
    cout << ln;

}

Measured memory_bytes: 2432
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
pre_idx=-100
for a in A:
  idx = a-1
  #print(a, idx, pre_idx, B[idx], ans)
  ans += B[idx] + ( C[pre_idx] if idx == pre_idx+1 else 0)
  pre_idx = idx
  
  
print(ans)

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

using namespace std;

int main(){
    long long int N,ans=0;
    cin >> N;
    for(int i=pow(N,0.5);0<i;i--){
        if(N%i==0){
            ans += i;
            ans += N/i;
            break;
        }
    }

    cout << ans-2;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
 using namespace std;
 
int main()
{
	int n,c,x;
	cin>>n;
	vector<int> v;
	for(int i=0;i<n;i++){
		cin>>c;
		v.push_back(c);
	} 	
	for(int j=0;j<n-2;j++){
		if(v[j]>v[j+1]&&v[j+1]>v[j+2]){
			x++;	
		}
		else if(v[j]<v[j+1]&&v[j+1]<v[j+2]){
			x++;	
		}
	} 
	cout<<x;
}

Measured memory_bytes: 256
module A = Array
module C = Char
module I = Int64
module L = List
module Q = Queue

let pf = Printf.printf
let sf = Scanf.scanf
let ssf = Scanf.sscanf

let read_int () = sf "%d " (fun x -> x)
let read_float () = sf "%f " (fun x -> x)
let read_str () = sf "%s " (fun x -> x)
let read_array read n = A.init n (fun _ -> read ())
let err s = raise (Failure s)

let range s t = A.init (t - s) @@ (+) s
let foreach fold_f init s t map_f =
  range s t |> A.map map_f |> A.fold_left fold_f init

let inf = int_of_float 1e18
let eps = 1e-11

module S = struct
  include String
  let of_array a = String.init (A.length a) (A.get a)
  let to_array s = A.init (String.length s) (String.get s)
end;;

let () =
  let s = read_str () in
  let n = S.length s in
  let res =
    foreach (||) false 0 (n - 2) (fun i ->
              s.[i] = s.[i+1] && s.[i] = s.[i+2] ) in
  let ans = if res then "Yes" else "No" in
  pf "%s\n" ans


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define inf 1000000000000000001
#define mod 1000000007
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise fixed(cout);cout<<setprecision(16);
#define Set(N,p) N=((N)|((1LL)<<(p)))
#define Reset(N,p) N=((N)&(~((1LL)<<(p))))
#define Check(N,p) (!(((N)&((1LL)<<(p)))==(0)))
#define POPCOUNT __builtin_popcountll
#define RIGHTMOST __builtin_ctzll
#define LEFTMOST(x) (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y) (((vlong)(log10((x))/log10((y))))+1)
#define OUT(x) for(auto a:x) cout << a << " "; cout << endl;
#define OK cout << "@===================ok===================@" <<endl;
#define WTF cout <<"< "<<lo<<" | "<< hi <<" >" << endl;

using namespace std;

int main()
{
    ll x;
    cin >> x;
    ll f=x/500;
    ll ans=f*1000;
    x%=500;
    ans+= 5LL*(x/5);
    cout << ans << endl;
}


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

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;

const int MAX = 10 * 100 * 1000 + 47;
const double EPS = 1e-8;


VI G[MAX];
pair<PII, int> P[MAX];
PII Q[MAX];
int C[MAX];
int D[MAX];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    FOR(i, 0, m)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        --a, --b;
        G[a].PB(b);
        G[b].PB(a);
    }

    int q;
    scanf("%d", &q);
    FOR(i, 0, q)
    {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        --a;
        P[i] = MP(MP(a, b), c);
    }
    FILL(D, -1);
    reverse(P, P + q);
    FOR(i, 0,q)
    {
        int v = P[i].first.first;
        int d = P[i].first.second;
        int c = P[i].second;

        int ql = 0, qr = 0;
        Q[qr++] = MP(v, d);

        while(ql != qr)
        {
            int v = Q[ql].first;
            int d = Q[ql++].second;

            if (D[v] >= d)continue;
            D[v] = d;
            if (!C[v])C[v] = c;

            if (d)
            {
                FOR(i, 0, SZ(G[v]))
                {
                    int to = G[v][i];
                    Q[qr++] = MP(to, d-1);
                }
            }


        }


    }
    FOR(i, 0, n)
        printf("%d\n", C[i]);
}








































Measured memory_bytes: 42616
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            var count = 0;
            var i = 0;
            while (i < S.Length - i - 1)
            {
                if (S[i] != S[S.Length - i - 1]) count++;
                i++;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t


int main(void){
    int K,T;
    cin >> K >> T;
    int first = 0;
    int second = 0;
    int sum = 0;
    
    if( K == 1 ){
        int temp ;
        cin >> temp;
        cout << temp << endl;
        return 0;
    }
    
    for(int i = 0 ; i < T ; i++ ){
        int temp;
        cin >> temp;
        sum+=temp;
        if( temp > first ){
            second = first;
            first = temp;
        }else if( temp > second ){
            second = temp;
        }
    }
    
    int others = sum - first;
    
    if( others > first - 1 ){
        cout <<0 <<endl;
    } else{
        cout << first - others - 1 <<endl;
    }
    
    return 0;
}


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

struct Union_Find
{
	int n;
	vector<int> tree;

	Union_Find(int n) : n(n), tree(n, -1)
	{
	}

	int size(int x)
	{
		assert(0 <= x && x < n);
		return -tree[root(x)];
	}

	int root(int x)
	{
		assert(0 <= x && x < n);
		if (tree[x] < 0)
		{
			return x;
		}
		return tree[x] = root(tree[x]);
	}

	bool same(int x, int y)
	{
		assert(0 <= x && x < n && 0 <= y && y < n);
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		assert(0 <= x && x < n && 0 <= y && y < n);
		x = root(x);
		y = root(y);
		if (x == y)
		{
			return false;
		}
		if (tree[x] > tree[y])
		{
			swap(x, y);
		}
		tree[x] += tree[y];
		tree[y] = x;
		return true;
	}
};

int main()
{
	int64_t n, m, k;
	cin >> n >> m >> k;
	vector<int> as(m), bs(m);
	for (int i = 0; i < m; i++)
	{
		cin >> as[i] >> bs[i];
		as[i]--;
		bs[i]--;
	}
	vector<int> cs(k), ds(k);
	for (int i = 0; i < k; i++)
	{
		cin >> cs[i] >> ds[i];
		cs[i]--;
		ds[i]--;
	}

	Union_Find uf(n);
	for (int i = 0; i < m; i++)
	{
		uf.merge(as[i], bs[i]);
	}

	vector<vector<int>> fr(n);
	for (int i = 0; i < m; i++)
	{
		fr[as[i]].emplace_back(bs[i]);
		fr[bs[i]].emplace_back(as[i]);
	}

	vector<vector<int>> bl(n);
	for (int i = 0; i < k; i++)
	{
		bl[cs[i]].emplace_back(ds[i]);
		bl[ds[i]].emplace_back(cs[i]);
	}

	for (int i = 0; i < n; i++)
	{
		int res = uf.size(i) - 1;

		for (auto &&f : fr[i])
		{
			if (uf.same(i, f))
			{
				res--;
			}
		}

		for (auto &&b : bl[i])
		{
			if (uf.same(i, b))
			{
				res--;
			}
		}

		cout << res << ' ';
	}
	cout << endl;

	return 0;
}

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

const int MXN = 1e5 + 20, MOD = 1e9 +  7;

int n;
vector<int> edge[MXN];

void npt() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
}

pair<int,  int> dfs(int v, int p) {
	int aw = 1, ib = 0;
	for (int u: edge[v]) {
		if (u != p) {
			pair<int, int> p = dfs(u, v);
			int awc = aw;
			aw = 1ll * aw * p.second % MOD;
			ib = ((1ll * awc * p.first % MOD) 
					+ (1ll * ib * (p.first + p.second) % MOD)) % MOD;
		}
	}
	return make_pair(aw, (aw + ib) % MOD);
}

void slv() {
	pair<int, int> p = dfs(1, -1);
	cout << (p.first + p.second) % MOD << endl;
}

int main() {
	npt();
	slv();
	return 0;
}


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

static class AffineCipher
{
    static void Main()
    {
        var alpha = new[] { 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25, };
        var beta = Enumerable.Range( 0, 26 ).ToArray();

        var indata = Console.In.ReadToEnd()
            .Split( 
                new[] { '\r', '\n' },
                StringSplitOptions.RemoveEmptyEntries )
            .Skip( 1 );
        var q =
            from cipher in indata
            let keys = cipher.Split( ' ' ).Where( x => x.Length == 4 )
            let qfp =
                from a in alpha
                from b in beta
                from k in keys
                where Crypt( a, b, 't' ) == k[0]
                from w in new[] { "that", "this" }
                where w
                    .Select( x => Crypt( a, b, x ) )
                    .SequenceEqual( k )
                select new { a, b }
            let fp = qfp.First()
            select cipher
                .Select( x => x == ' ' ? x : Decrypt( fp.a, fp.b, x ) )
                .ToArray();
        foreach ( var p in q )
            Console.WriteLine( new string( p ) );
    }

    static char Decrypt(int alpha, int beta, char cipher)
    {
        var p = 0;
        var x = cipher - 'a' - beta;
        do
        {
            x += 26;
            while ( x >= alpha )
            {
                x -= alpha;
                ++p;
            }
        } while ( x > 0 );
        return (char)( 'a' + p % 26 );
    }

    static char Crypt(int alpha, int beta, char plain)
    {
        return (char)( 'a' + ( alpha * ( plain - 'a' ) + beta ) % 26 );
    }
}

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

signed main(){
    int H;
    cin >> H;
    
    int cnt = 0,tmp = 1;
    for(int i=0;H>=1;i++){
        H = H/2;
        if(i!=0) tmp *= 2;
        cnt += tmp;
    }
    
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string str = Console.ReadLine();

            string[] str2 = str.Split(' ');

            int a = int.Parse(str2[0]);
            int b = int.Parse(str2[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }

            else if (a > b)
            {
                Console.WriteLine("a > b");
            }

            else
            {
                Console.WriteLine("a == b");
            }

        }
    }
}



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

int a[1000000],b[1000000];

int main()
{
    int n,b;
    char a[103];
    scanf("%s",&a);
    n = strlen(a);
    printf("%c",a[0]);
    b = n-2;
    printf("%d",b);
    printf("%c\n",a[n-1]);
    return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    from collections import Counter

    n = int(readline())
    a = list(map(int, readline().split()))
    memo = [True] * (10 ** 6 + 1)
    ans = 0
    for k, v in sorted(Counter(a).items()):
        if v == 1 and memo[k]:
            ans += 1
        memo[k] = False
        for i in range(1, 10 ** 6 + 1):
            if 10 ** 6 + 1 <= i * k:
                break
            memo[i * k] = False
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 50884
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
    string s;
    int k;
    cin >> s >> k;
    int len = s.size();
    vector<string> sub;
    for(int i = 0; i < len; i++)
    {
        for(int j = 1; j <= len-i; j++)
        {
            string subs = s.substr(i,j);
            if (subs.size() <= k) {
                sub.push_back(subs);
            }
        }
    }
    set<string> subset(sub.begin(),sub.end());
    vector<string> sortedSub(subset.begin(), subset.end());
    cout << sortedSub[k-1] << endl;
}

Measured memory_bytes: 2428
from heapq import heapify, heappush, heappop, heappushpop

X, Y, Z, K = map(int, input().split())
As = list(map(int, input().split()))
Bs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

sum12s = []
for A in As:
    for B in Bs:
        sum12s.append(A+B)
sum12s.sort(reverse=True)

PQ = [Cs[0]+sum12 for sum12 in sum12s[:K]]
heapify(PQ)
for C in Cs[1:]:
    for sum12 in sum12s[:K]:
        heappush(PQ, C+sum12)
    for _ in range(K, len(PQ)):
        heappop(PQ)

anss = []
for _ in range(K):
    anss.append(heappop(PQ))
print('\n'.join(map(str, anss[::-1])))


Measured memory_bytes: 115152
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

vector<string> strs;
int n, l;
int i;
char tmp[110];

int main() {
    scanf("%d", &n);
    scanf("%d", &l);
    for (i = 0; i < n; i++) {
        scanf("%s", tmp);
        strs.push_back(string(tmp));
    }
    sort(strs.begin(), strs.end());
    for (i = 0; i < n; i++) {
        printf("%s", strs[i].c_str());
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long X=sc.nextLong();
     long nokori=X%500;
     long first=X/500;
     long second=nokori/5;

      System.out.println(1000*first+5*second);
        }
      }


Measured memory_bytes: 21716
#include<iostream>
using namespace std;
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define int long long int
#define inf 1000000000
int32_t main()
{
	string str;
	cin>>str;
	int n=str.size();
	int x=str[n-1]-48;
	if(x==2||x==4||x==5||x==7||x==9)
	{
		cout<<"hon"<<endl;
	}
	else if(x==3)
	{
		cout<<"bon"<<endl;
	}
	else
	  cout<<"pon"<<endl;
}


Measured memory_bytes: 3128
using System;

public class ABC092A
{
    public static void Main()
    {
        int[] costs = new int[4];
        for (int i = 0; i < 4; i++) costs[i] = int.Parse(Console.ReadLine());
        Console.WriteLine(Math.Min(costs[0], costs[1]) + Math.Min(costs[2], costs[3]));
    }
}


Measured memory_bytes: 11092
N = int(input())
A = list(map(int, input().split()))
step = 0
tmp_step = 0
for i in range(N-1):
  if A[i] + tmp_step > A[i+1]:
    tmp_step = A[i] + tmp_step - A[i+1]
    step += tmp_step
  else:
    tmp_step = 0
print(step)

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

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

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
#include <time.h>
using namespace std;
//#define int long long
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define l1 list[index]
#define l2 list[index - 1]
#define l3 list[index + 1]
#define iif(i,j) ((i<0 && j<0) || (i>0 && j>0)) ? true : false 
typedef long long ll;
typedef pair<int, int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint, int> P1;
typedef pair<int, pint> P2;
typedef pair<pint, pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD = 1000000007;
const ll INF = 1e18;
int ca[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };



signed main() {
	int n, k, cnt = 0, pp, h, l;
	string s, s1, s2;
	vector<int>list;



	for (int i = 0; i < 5; i++) {
		int num;
		cin >> num;
		list.push_back(num);
	}

	cin >> k;

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

	if (abs(list[4] - list[0]) > k) {
		cout << ":(" << endl;
	}
	else {
		cout << "Yay!" << endl;
	}








	
	getchar();
	getchar();
	return 0;
}

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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S, T; cin >> S >> T;
    int ans = INF;
    for(int i = 0; i + (int)T.length()-1 < (int)S.length(); i++)
    {
        int count = 0;
        REP(j, (int)T.length()) 
        {
            if(T[j] != S[i+j]) count++;
        }
        chmin(ans, count);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;

int main(int argc, char const *argv[])
{
    int k;
    cin >> k;

    if (k % 2 == 0)
    {
        cout << (k / 2) * (k / 2) << endl;
    }
    else
    {
        cout << (k / 2) * (k / 2 + 1) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<cctype>

using namespace std;

int ExtractInt(string &s){
	int ret = 0;
	int keta = 0;
	for(int i = s.length() - 1; i >= 0; i--){
		if( isdigit(s[i]) ){
			while( isdigit(s[i]) ){
				ret += (int)pow(10, (double)keta) * (s[i] - '0');
				keta++;
				i--;
			}
			keta = 0;
		}
	}
	return ret;
}

int main(void){
	int key = 0;
	while( true ){
		string s;

		cin >> s;
		if( cin.eof() ) break;

		key += ExtractInt( s );
	}

	cout << key << endl;
	return 0;
}

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

int main() {
	
	float v,y;
	int N;
	
	while(cin>>v){
		y = v*v/19.6;
		N = ceil(y/5) + 1;
		cout << N << endl;
	}
	return 0;
}

Measured memory_bytes: 1228
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int[][] a = new int[3][3];
    for(int i=0; i<3; i++) {
      String[] str = in.readLine().split(" ");
      for(int j=0; j<3; j++) {
        a[i][j] = Integer.parseInt(str[j]);
      }
    }
    
    int n = Integer.parseInt(in.readLine());
    int[] b = new int[n];
    for(int i=0; i<n; i++) {
      b[i] = Integer.parseInt(in.readLine());
      for(int j=0; j<3; j++) {
        for(int k=0; k<3; k++) {
          if(a[j][k]==b[i])
            a[j][k]=0;
        }
      }
    }
    
    boolean hantei = false;
    for(int i=0; i<3; i++){
      hantei |= a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0;
      hantei |= a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0;
    }
    hantei |= a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0;
    hantei |= a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0;
    
    System.out.println(hantei?"Yes":"No");
  }
}

Measured memory_bytes: 21204