akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "bitset"

using namespace std;

//const long long int MOD = 998244353;
const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

long long int gcd(long long int a, long long int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

	cin >> N >> M;
	string s, t;
	cin >> s >> t;
	K = gcd(N, M);
	for (int i = 0,j=0; i < N; i += N / K,j+=M/K) {
		if (s[i] != t[j]) {
			cout << -1 << endl;
			return 0;
		}
	}
	cout << N * M / K << endl;
	return 0;
}


Measured memory_bytes: 768
#include <stdlib.h>
int comp_int_r(const void *a, const void *b){return *(int*)b-*(int*)a;}
int main(){
  int n, k, i;
  scanf("%d%d", &n, &k);
  if(k>=n){
    puts("0");
    return 0;
  }
  int *a = calloc(n, sizeof(int));
  for(i=0; i<n; i++){
    scanf("%d", a+i);
  }
  qsort(a, n, sizeof(int), comp_int_r);
  long sum=0;
  for(i=k; i<n; i++){
    sum+=a[i];
  }
  printf("%ld\n", sum);
}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long
int main()
{
    SPEED
    int n, m, x;
    cin >> n >> m >> x;

    vector<int> cost;

    vector<vector<int>> skill_val(n, vector<int>(m));

    for (int i = 0; i < n; ++i)
    {
        int c;
        cin >> c;
        cost.push_back(c);

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

    int s = 1;
    s = s << n;

    //cout << "total possibilities : " << s << '\n';

    int ans = INT_MAX;

    for (int i = 1; i < s; ++i)
    {
        //cout << "possibility number : " << i << '\n' << '\n';
        int sum = 0;

        int shifter = 0;
        int comparator = 1;

        int skill_levels[m] = {0};

        while(i >= comparator)
        {
            if (comparator&i)
            {
                //cout << "comparator : " << comparator << " shifter : " << shifter << '\n';
                sum += cost[shifter];
                for (int j = 0; j < m; ++j)
                {
                    skill_levels[j] += skill_val[shifter][j];
                }
            }

            shifter++;
            comparator = comparator << 1;
            //cout << "comparator after shifting : " << comparator << '\n';
        }

        bool satisfies = true;
        for (int i = 0; i < m; ++i)
        {
            if (skill_levels[i] < x)
            {
                satisfies = false;
                break;
            }
        }

        if (satisfies)
        {
            ans = min(ans, sum);
        }
        //cout << '\n';
    }



    if (ans==INT_MAX)
    {
        cout << -1;
    }
    else
    {
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3660
function main(){
  var
  i, j, k, n,
  seq, max, sum;
  for(i = 0; n = parseInt(input[i++],10); ){
    seq = [];
    for(j = 0; j < n; j++){
      seq[j] = parseInt(input[i + j],10);
    }
    i += n;
    max = -Infinity;
    for(j = 0; j < n; j++) {
      sum = 0;
      for(k = j; k < n; k++) {
        sum += seq[k];
        if(sum > max) max = sum;
      }
    }
    console.log(max);
  }
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

Measured memory_bytes: 9916
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

class combination{
    public:
    lint _n;
    combination(lint n){
        C.resize(n+1);
        _n = n+1;
    }
    void init(){
        REP(i, _n){
            C[i].resize(i+1);
            REP(j, i+1){
                if(j==0 or j==i) C[i][j]=1;
                else{
                    C[i][j] = C[i-1][j-1] + C[i-1][j];
                }
            }                
        }
    }
    void debug(){
        REP(i, _n){
            for(auto ncr: C[i]) cout << ncr << " ";
            cout << endl;
        }
    }
    vector<vector<lint> > C;
};

signed main(){
    lint N, A, B;
    cin >>N>>A>>B;
    vector<lint> V(N);
    REP(i, N) cin >> V[i];
    sort(ALL(V), greater<lint>());
    vector<lint> CS(N+1, 0);
    REP(i, N) CS[i+1] = CS[i] + V[i];
    double resave = CS[A] / (1.0 * A);
    cout << fixed << setprecision(10) <<  resave << endl;

    lint cnt = 0;
    if(V[0]==V[A-1]){
        lint ca = A;
        lint cb = 0;
        FOR(i, A, N){
            if(V[i]==V[0]) cb++; 
        }
        combination cmb = combination(ca+cb);
        cmb.init();
        FOR(i, A, min(A+cb+1, B+1)) cnt += cmb.C[ca+cb][i];
    }
    else{
        lint ca = 0;
        lint cb = 0;
        REP(i, A) if(V[i]==V[A-1]) ca++;
        FOR(i, A, N) if(V[i]==V[A-1]) cb++;
        combination cmb = combination(ca+cb);
        cmb.init();
        cnt +=  cmb.C[ca+cb][ca]; 
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
// #include <bits/stdc++.h>
using namespace std;
#define MAX 2000112
#define mod 1000000007


long long f[MAX];
long long qpow(int a,int b){
	if(b == 0)return 1;
	long long temp = qpow(a,b/2);
	temp*= temp;
	temp %= mod;
	if(b&1) temp *= a;
	return temp%mod;
}
long long so(int a,int b){
	long long ans = (f[a+b] * qpow(f[a],mod-2))%mod;
	ans *= (qpow(f[b],mod - 2));
	return (ans + mod)%mod;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
	int h,w,a,b;
	cin>>h>>w>>a>>b;
	f[0] = 1;for(int i = 1; i < MAX; i++)f[i] = (f[i-1] * i)%mod;
	long long ans = 0,sum = 0;
	for(int i = 1; i <= h - a; i++){
		ans = so(h-i,w-b-1);
		ans *= so(b-1,i-1);
		ans %= mod;
		sum += ans;
		sum %= mod;
	}
	cout<<(sum + mod)%mod;
	return 0;	
}


Measured memory_bytes: 16256
/* ex6_2
   seira3 */

#include <stdio.h>
#include <string.h>
#define SIZE 101

int main(void){
    int length; //配列の長さを格納するint型の変数を宣言
    char str[SIZE]; //入力を入れる配列を宣言
    for(int i = 0; i < SIZE; i++){ //strを初期化
        str[i] = '0';
    }
    scanf("%s",str); //strに入力
    length = strlen(str); //文字列の長さを取得し代入
    printf("%c%d%c\n",str[0],length-2,str[length-1]); //問題文の指定に沿って出力
    return 0;
}

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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

int main(){
    ll n,a,b;
    cin>>n>>a>>b;

    if(a%2==b%2)cout<<(b-a)/2<<endl;

    else cout<<min(a-1,n-b)+1+(b-a-1)/2<<endl;
}


Measured memory_bytes: 256
#整数をint型に変換する
def is_int(x):
    try:
        x = int(x)
    except ValueError as e:
        pass
    finally:
        return x

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

#レストランの番号を追加
for i in range(n):
    list[i].append(i+1)

#辞書順,点数で降順にソート
list.sort(key=lambda x:(x[0],-x[1]))

#レストランの番号を出力
for i in range(n):
    print(list[i][2])

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            long[] A = new long[N + 2];
            for (int i = 0; i < N; i++) {
                A[i + 1] = in.nextInt();
            }
            long sum = 0;
            for (int i = 1; i < N + 2; i++) {
                sum += Math.abs(A[i] - A[i - 1]);
            }
            for (int i = 1; i <= N; i++) {
                long before = Math.abs(A[i + 1] - A[i]) + Math.abs(A[i] - A[i - 1]);
                long after = Math.abs(A[i + 1] - A[i - 1]);
                System.out.println(sum - before + after);
            }

        }
    }
}


Measured memory_bytes: 63536
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> kiri(100010,0);
    ll sum=0;
    for(ll i=0; i<N; i++){
        cin >> A.at(i);
        kiri.at(A.at(i))++;
        sum += A.at(i);
    }
    ll Q;
    cin >> Q;
    vector<ll> B(Q),C(Q);
    for(ll i=0; i<Q; i++){
        cin >> B.at(i) >> C.at(i);
        ll a = kiri.at(B.at(i));
        kiri.at(C.at(i))+=a;
        sum = sum - B.at(i)*a + C.at(i)*a;
        kiri.at(B.at(i))=0;
        cout << sum << endl;
    }
}

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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

ll N;
std::vector<ll> a;
vector<ll> acc;
vector<vector<ll>> dp;

ll f(ll l, ll r) {
  if (dp.at(l).at(r) != -1) return dp.at(l).at(r);
  if (l == r) return dp.at(l).at(r) = 0;

  ll ret = LINF;
  FOR(m, l, r) ret = min(ret, f(l, m) + f(m + 1, r));
  ll c = acc.at(r + 1) - acc.at(l);
  return dp.at(l).at(r) = ret + c;
}

void solve() {
  acc.resize(N + 1, 0);
  dp.resize(N + 1, vector<ll>(N + 1, -1));

  rep(i, N) { acc.at(i + 1) += acc.at(i) + a.at(i); }

  cout << f(0, N - 1) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  scanf("%lld", &N);
  a.resize(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  solve();
  return 0;
}


Measured memory_bytes: 4588
n = gets.to_i
atoz = ("a".."z")
ans = atoz.each_with_object(Hash.new) { |c, h| h[c.to_sym] = 50 }
 #p ans
n.times do
  s = gets.chomp
  ans.each do |k, v|
    count = s.count(k.to_s)
    ans[k] = count if count <= v
  end
end
 
puts ans.select { |_, v| v > 0 }.map { |k, v| [k.to_s * v] }.join

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

const int N=2e5+20;

int n,a[N],vis[N],cycle,dp[N];
long long k;

void go(int node,int steps=1)
{
	vis[node]=steps;
	dp[steps]=node;
	int child=a[node];
	if(vis[child]==0) go(child,steps+1);
	else cycle=child;
}

int main()
{
	scanf("%d%lld",&n,&k);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);

	k++;
	go(1);
	if(k<N and dp[k]) printf("%d",dp[k]);
	else
	{
		k-=vis[cycle];
		vector <int> v={cycle};
		for(int node=a[cycle];node!=cycle;node=a[node]) v.push_back(node);
		cout<<v[k%v.size()];
	}
}

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

#define ll long long

int main(){

    ll S;
    cin >> S;

    int h, m, s;

    h = S / 3600;
    m = (S % 3600) / 60;
    s = (S % 3600) % 60;
    
    cout << h << ":" << m << ":" << s << endl;

    return 0;
}

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


int main() {

long A,V,B,W,T;
cin>>A>>V>>B>>W>>T;

long X,Y;

if(A<B){
  X=A+V*T;
  Y=B+W*T;
}
else{
  X=A-V*T;
  Y=B-W*T;
}

if(A<B){
  if(X>=Y){
    cout<<"YES"<<endl;
    return 0;
  }
  else{
    cout<<"NO"<<endl;
    return 0;
  }
}

else{
  if(X<=Y){
    cout<<"YES"<<endl;
    return 0;
  }
  else{
    cout<<"NO"<<endl;
    return 0;
  }
}


}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n,las,ras,t=0,h=0;
	string l, r;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> l >> r;
		
		
		for (int j = 0; j < 100; j++){
			if (l == r){
				t++;
				h++; break;
			}
			las = l[j] - 'a';
			ras = r[j] - 'a';
			
			 if (las > ras){
				 t += 3; break;
			}
			 else if (las < ras){
				 h += 3; break;
			 }
		}
	}
	cout << t << " " << h << endl;
	return 0;
}

Measured memory_bytes: 3164
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman001 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef long double ld;
using namespace std;
int main()
{
    abdelrahman001
    ll n;
    ld x,ans = 0;
    cin >> n;
    while(n--)
    {
        cin >> x;
        ans+=(1/x);
    }
    cout << fixed << setprecision(9) << 1.0/ans;
    return 0;
}


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

int main() {
  int n, compare;
  int count = 0, y;
  cin >> n >> compare;
  for (int i = 1; i < n; i++) {
    cin >> y;
    if (compare == y) {
      count++;
      compare = -3;
    }
    else compare = y;
  }
  cout << count << endl;
}



Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N,x = MI()
if x == 1 or x == 2*N-1:
    print('No')
    exit()

print('Yes')
A = [i for i in range(1,2*N)]
A = A + A + A
print(*A[x+N-1:x+3*N-2],sep='\n')


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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0;i<N;i++) cin >> A[i];
    map<int,int> mp;
    mp[0] = 3;
    mint ans = 1;
    for (int i=0;i<N;i++){
        ans *= mp[A[i]];
        mp[A[i]]--;
        mp[A[i]+1]++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 8148
import java.util.*;
import java.awt.geom.*;

public class Main{
	String JOI = "JOI";
	String IOI = "IOI";
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String s = sc.next();
			int a = 0, b = 0;
			for(int i = 0; i <= s.length() - 3; i++){
				String sub = s.substring(i, i + 3);
				if(sub.equals(JOI)){
					a++;
				}
				if(sub.equals(IOI)){
					b++;
				}
			}
			System.out.println(a);
			System.out.println(b);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

Measured memory_bytes: 23684
#include <bits/stdc++.h>
#define speed                   \
  ios_base::sync_with_stdio(0); \
  cin.tie(0);                   \
  cout.tie(0);
#define oprecision    \
  cout.precision(30); \
  cerr.precision(7);
#define ll long long
#define ld long double
#define ss string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define forn(n) for (int i = 1; i <= n; i++)
#define forlr(l, r) \
  for (int i = l; (l > r ? i >= r : i <= r); (l > r ? i-- : i++))
#define pb push_back
#define pc __builtin_popcount
#define pcll __builtin_popcountll
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
using namespace std;
const ld pi = acos(-1.0);
ld a, b, h, m, y;
ld soc(ld param) { return cos(param * pi / 180.0); }
int main() {
  speed;
  oprecision;
  // code
  cin >> a >> b >> h >> m;
  y = fmod(abs((h * 30.0 + m * 0.5) - m * 6.0), 360.0);
  cout << fixed << setprecision(10)
       << sqrt(((a * a) + (b * b)) - (2.0 * a * b * soc(y)));
  // endl
#ifndef ONLINE_JUDGE
  cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}

Measured memory_bytes: 4128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
   long long n;
   cin >> n;
   
   string t = "";
   while(n > 0){
         n--;
         t += 'a' + n % 26;
         n /= 26;
   }
   
   for(int i = t.size() - 1;i >= 0;i--){
         cout << t[i];
   }
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b >= c) cout << b+c << endl;
	else cout << b*2 + a+1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll             long long int
#define lb             lower_bound
#define fi             first
#define ub             upper_bound
#define se              second
#define mp             make_pair
#define vll            vector<ll>
#define mod            1000003
#define endl            "\n"
#define fast           ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb             push_back
#define sz               size()
#define all(v)         v.begin(),v.end()
#define allr(v)        v.rbegin(),v.rend()
#define inp(V,n)       for(int i=0;i<n;i++){cin >> V[i];}
#define oup(V,n)       {for(int i=0;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
      return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
{
   return (a*b)/gcd(a, b);
}
bool sortByVal(const pair<double,double> &a,
               const pair<double,double> &b)
{
    if(a.fi==b.fi)
    {
    return (a.second >b.second);
    }
    else
        return (a.fi<b.fi);
}
int main()
{
   ll i,j,k,l,m,n;
     string str;
     cin>>str;
     n=str.size();
     if(str[n-1]=='s')
     {
         str+='e';
         str+='s';
     }
     else {
        str+='s';
     }

       cout<<str;


return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
////////////////////////////////////////
struct UnionFind {
	vector<int>par;

	UnionFind(int N) :par(N) {
		for (int i = 0; i < N; ++i) {
			par[i] = i;
		}
	}

	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}

	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
int main(){
	int N, M;
	cin >> N >> M;
	vector<int>P(N);
	for (int i = 0; i < N; ++i) {
		cin >> P[i];
	}
	UnionFind tree(N);
	for (int i = 0; i < M; ++i) {
		int x, y;
		cin >> x >> y;
		tree.unite(x - 1, y - 1);
	}
	int cnt = 0;
	for (int i = 0; i < N; ++i) {
		if (tree.same(i, P[i] - 1)) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
import math
from bisect import bisect_right

n, d, a = map(int, input().split())
x_list = []
max_x = 0
for _ in range(n):
    x, h = map(int, input().split())
    x -= 1
    x_list.append([x, h])
    max_x = max(max_x, x)
x_list.sort()
xx = [x[0] for x in x_list]
hh = [x[1] for x in x_list]
ans = 0
accum = [0 for _ in range(n)]
for index, [x, h] in enumerate(x_list):
    if index != 0:
        accum[index] += accum[index - 1]
    cnt = max(math.ceil((hh[index] - accum[index]) / a),  0)
    ans += cnt
    index_right = bisect_right(xx, xx[index] + (2 * d))
    accum[index] += cnt * a
    if index_right < n:
        accum[index_right] -= cnt * a
print(ans)

Measured memory_bytes: 48096
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int a[101];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    int cnt = 0;
    int tmp;
    int i = 0;
    int flag = 1;
    while(flag){
        flag = 0;
        for(int j = N - 1; j >= i + 1; j--){
            if(a[j] < a[j - 1]){
                tmp = a[j];
                a[j] = a[j - 1];
                a[j - 1] = tmp;
                flag = 1;
                cnt++;
            }
        }
        i++;
    }
    for(int i = 0; i < N; i++){
        cout << a[i];
        if(i < N - 1)   cout << " ";
        else    cout << endl;
    }
    cout << cnt << endl;
    
}



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



int main() 
{
  ll N,M;
  cin >> N >> M;
  vector<ll> num(N);
  rep (i,M)
  {
    ll a,b;
    cin >> a >> b;
    num.at(a - 1) += 1;
    num.at(b - 1) += 1;
  }
  rep (i,N)
  {
    cout << num.at(i) << endl;
  }  
}

Measured memory_bytes: 256
import sys
import queue
import collections

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=100000000777777

#+++++

def main():
	#a = int(input())
	n, k = tin()
	#s = input()
	al=[lin() for _ in range(n)]
	al.sort(key = lambda x : -x[1])
	use_t = set()
	t_max=collections.defaultdict(lambda :0)
	mm=[]
	ret_ug=0
	for t,v in al[:k]:
		ret_ug += v
		if t in use_t and t_max[t] >= v:
			mm.append(v)
		elif t in use_t:
			mm.append(t_max[t])
			t_max[t]=v
		else:
			t_max[t]=v
			use_t.add(t)
	
	nt=len(use_t)
	ret_ug += nt*nt
	
	nokori = collections.defaultdict(lambda :0)
	for t, v in al[k:]:
		if t in use_t:
			continue
		nokori[t]=max(nokori[t], v)
	upp=[]
	for k in nokori:
		upp.append(nokori[k])
	upp.sort(reverse = True)
	mm.sort()
	ret=ret_ug
	for up_v, mm_v in zip(upp, mm):
		ret_ug += up_v
		ret_ug -= mm_v
		ret_ug += 2*nt + 1
		nt += 1
		ret = max(ret, ret_ug)
		
	print(ret)
		
		
	
		
		
		
		
		
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

int main()
{
    int n, m;
    cin >> n >> m;
    string a[50], b[50];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < m; i++){
        cin >> b[i];
    }
    int d = n - m + 1;
    for(int i = 0; i < d; i++){
        for(int j = 0; j < d; j++){
            bool f = true;
            for(int k = 0; k < m; k++){
                for(int l = 0; l < m; l++){
                    if(b[k][l] != a[i + k][j + l]){
                        f = false;
                    }
                }
            }
            if(f){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int A, B;
int d[100][100];
bool ok[100][100];
typedef tuple<int, int, int> path;
vector<path> V;

void answer() {
  cout << 204 << " " << V.size() << endl;
  for (auto x : V) {
    cout << get<0>(x) << " " << get<1>(x) << " ";
    if (get<2>(x) == -1) {
      cout << "X" << endl;
    } else if (get<2>(x) == -2) {
      cout << "Y" << endl;
    } else {
      cout << get<2>(x) << endl;
    }
  }
  cout << 1 << " " << 204 << endl;
}

void add(int i, int j, int a) {
  V.push_back(make_tuple(i+1, 204-j, a));
}

int main () {
  cin >> A >> B;
  for (auto i = 1; i <= A; ++i) {
    for (auto j = 1; j <= B; ++j) {
      cin >> d[i][j];
      ok[i][j] = false;
    }
  }
  for (auto i = 1; i <= 101; ++i) {
    V.push_back(make_tuple(i, i+1, -1));
  }
  for (auto i = 103; i <= 203; ++i) {
    V.push_back(make_tuple(i, i+1, -2));
  }
  for (auto i = 0; i <= 101; ++i) {
    for (auto j = 0; j <= 101; ++j) {
      int a = 0;
      for (auto X = 1; X <= A; ++X) {
        for (auto Y = 1; Y <= B; ++Y) {
          a = max(a, d[X][Y] - i * X - j * Y);
        }
      }
      add(i, j, a);
      for (auto X = 1; X <= A; ++X) {
        for (auto Y = 1; Y <= B; ++Y) {
          if (d[X][Y] == a + i * X + j * Y) {
            ok[X][Y] = true;
          }
        }
      }
    }
  }
  for (auto X = 1; X <= A; ++X) {
    for (auto Y = 1; Y <= B; ++Y) {
      if (!ok[X][Y]) {
        cout << "Impossible" << endl;
        return 0;
      }
    }
  }
  cout << "Possible" << endl;
  answer();
}


Measured memory_bytes: 576
#include<bits/stdc++.h>
using namespace std;
int n,i,a[100005],s,v1,v2,dp[100005],start,k,mini,j;
int main()
{
  cin>>n>>k;
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(n==1)
  {
  	cout<<0;
  	return 0;
  }
  dp[0]=0;
  dp[1] = fabs(a[0]-a[1]);
  for(i=2;i<n;i++)
  {
  	mini = 1e9;
  	start = max(i-k, 0);
  	for(j=start;j<i;j++)
  	{
  		v1 = dp[j] + fabs(a[i]-a[j]);
  		//cout<<j<<"--"<<v1<<" ";
  		mini = min(mini,v1);
  	}
  	//cout<<"\n";
  	dp[i] = mini;
  }
  cout<<dp[n-1];
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  double ans = 0.00;
  vector<int>value(N);
  for(int i=0; i<N; i++) cin >> value.at(i);
  
  sort(value.begin(), value.end());
  ans = value.at(0);
  for(int i=0; i<N; i++){
    ans = (ans + value.at(i))/2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3684
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
using namespace std;

typedef long long ll;

int main() {
    ll K;
    cin >> K;
    ll roop=K/50;
    ll mergin=K%50;
    ll ans[50];

    for(int i=0; i<50; i++){
        ans[i]=i;
        ans[i]-=mergin;
        if(ans[i]<0) ans[i]+=51;
        ans[i]+=roop;
    }
    cout << 50 << endl;
    for(int i=0; i<50; i++){
        cout << ans[i] << ' ';
    }

    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
using namespace std;
int main(){
	string s;
	int ans=0;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='+')ans++;else ans--;
	}
	cout<<ans<<endl;
}

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

ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}

int main()
{
	int n;
	double x,sum=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++) {
		scanf("%lf",&x);
		sum+=1.0/x;
	}	
	printf("%lf",1.0/sum);
	return 0;	
} 

Measured memory_bytes: 384
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    AIN(ll, L, N);
    ll ans = 0;
    SORT(L);
    REP(i, N)
    {
        for (ll j = i + 1; j < N; ++j)
        {
            for (ll k = j + 1; k < N; ++k)
            {
                ans += L[i] < L[j] and L[j] < L[k] and L[k] < L[i] + L[j];
            }
        }
    }
    OUT(ans);
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    double t,a,m=1000000000;
    cin>>t>>a;
    for(int i=0;i<n;i++)
    {
        float x;
        cin>>x;
        if(abs(a-(t-(x*.006)))<m)
        {
            ans = i+1;
            m = abs(a-(t-(x*.006)));
        }
    }
    cout<<ans;

}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    int h, w; 
    cin >> h >> w;
    vector<string> vs;
    REP(i, h){
        string s;
        cin >> s;
        vs.pb(s);
    }
    REP(i, h){
        bool flag = true;
        REP(j, w){
            if(vs[i][j] == '#') flag = false;
        }
        if(flag){
            REP(j, w) vs[i][j] = 'x';
        }
    }
    REP(i, w){
        bool flag = true;
        REP(j, h){
            if(vs[j][i] == '#') flag = false;
        }
        if(flag){
            REP(j, h) vs[j][i] = 'x';
        }
    }

    REP(i, h){
        string res;
        REP(j, w){
           
            if(vs[i][j] == 'x'){
                continue;
            }
            else{
                res += vs[i][j];
            } 
        }
        if(!res.empty()) cout << res << endl;
        else continue;
    }
}

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

Measured memory_bytes: 256
n = int(input())
num_list = list(map(int, input().split()))
ans = 1
cnt_list = [0] * n
a = int()

for i in range(1,n):
    if num_list[i-1] > num_list[i]:
        cnt_list[i] = -1
    if num_list[i-1] < num_list[i]:
        cnt_list[i] = 1

while 1 in cnt_list and -1 in cnt_list:
    del cnt_list[:max(cnt_list.index(1),cnt_list.index(-1))]
    cnt_list[0] = 0
    ans += 1

print(ans)

Measured memory_bytes: 20124
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, p = LI()
    print((a*3+p)//2)
    return

#B
def B():
    n = II()
    sp = []
    for i in range(n):
        sp.append(input().split())
    another = [(s[0], -1 * int(s[1]),num) for num,s in enumerate(sp)]
    another.sort()
    for s,p,q in another:
        print(q+1)

    return

#C
def C():
    n, m = LI()
    ks = LIR_(m)
    p = LI()
    patern = itertools.product(range(2), repeat=n)
    ans = 0
    for on in patern:
        ki = [0 for i in range(m)]
        for num, oni in enumerate(on):
            if oni:
                for i,ksi in enumerate(ks):
                    ksi = ksi[1::]
                    if num in ksi:
                        ki[i] ^= 1
        for num, pi in enumerate(p):
            if pi != ki[num]:
                break
        else:
            ans += 1
    print(ans)

            
    return

#D
def D():
    N, K = LI()#random.randint(1,50),random.randint(1,100)
    v = LI()#[random.randint(-10 ** 2, 10 ** 2) for i in range(N)]
    ans = 0
    for a in range(min(N, K) + 1):
        for b in range(min(N, K) + 1):
            if a + b > min(K,N):
                break
            if a == b == 0:
                continue
            deletes = K - a - b
            left = v[:a]
            right = v[:-b-1:-1]
            x = left + right
            x.sort()
            tmp = sum(x)
            zero_index = bisect_left(x, 0)
            tmp -= sum(x[:min(zero_index,deletes)])
            ans = max(ans, tmp)
    
    print(ans)
                

    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 42864
/*input

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

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

int fast_ex(int a,int n,int m){
  if(n == 0)return 1;
  if(n == 1)return a;
  int x = 1;
    x *= fast_ex(a,n/2,m);
    x %= m;
    x *= x;
    x %= m;
    if(n%2)x*= a;
    x %= m;
    return x;
}


void solve(){
    int n,a,b;cin >> n >> a >> b;
    cout << min(a,b) << " ";
    if(a+b > n)cout << (a+b)-n;
    else cout << 0;
}

signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //freopen(".in","r",stdin);freopen(".out","w",stdout);
  int t = 1;//cin >> t;
  WL(t)solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n; string a[40], b[40];
int main() {
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i], b[i] = a[i];
	for(int i = 0; i < n; i++) {
		for(int j = n - 1; j > i; j--) {
			if(b[j - 1][1] > b[j][1]) swap(b[j - 1], b[j]);
		}
	}
	for(int i = 0; i < n; i++) cout << (i ? " " : "") << b[i]; cout << endl;
	cout << "Stable" << endl;
	for(int i = 0; i < n; i++) {
		int r = i;
		for(int j = i + 1; j < n; j++) {
			if(a[j][1] < a[r][1]) r = j;
		}
		swap(a[i], a[r]);
	}
	for(int i = 0; i < n; i++) cout << (i ? " " : "") << a[i]; cout << endl;
	cout << (equal(a, a + n, b) ? "Stable" : "Not stable") << endl;
}



Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, a, b) for(ll i = a;i<b; i++)
int main()
{
	ll n;
	cin>>n;
	string temp;
	map <string, ll> mp;
	f(i, 0, n)
	{
	    cin>>temp;
	    mp[temp]++;
	}
	cout<<mp.size()<<endl;

    return 0;
}


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define intMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod = 1e9+7;

int main(){
	int a1,a2,a3;
	cin >> a1 >> a2 >> a3;
	if(a1+a2+a3 >= 22){
		cout << "bust" <<endl;
	}else cout << "win" <<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.io.IOException;
import java.util.*;

@SuppressWarnings({"rawtypes", "unchecked"})
class Main {
    final static int INF = 1 << 28;
    final static long LNF = 1L << 60;
    final static double EPS = 1e-9;
    final static double GOLDEN_RATIO = (1.0 + Math.sqrt(5)) / 2.0;

    static final long MOD = 1_000_000_007;

    public static void main(String[] args) throws Exception {
        final MyScanner sc = new MyScanner();
        String S;
        S = sc.next();
        String T;
        T = sc.next();
        solve(S, T);
    }

    static void solve(String S, String T){
        String[] hoge = S.split(" ");
        System.out.println(hoge[1]+hoge[0]);
    }


    static class MyScanner {
 
        BufferedReader br;
        StringTokenizer st;
 
        MyScanner(FileReader fileReader) {
            br = new BufferedReader(fileReader);
        }
 
        MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String nn() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        String next() {
            String ans = "";
            try {
                ans = br.readLine();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            return ans;
        }
 
        char nextChar() {
            return nn().charAt(0);
        }
 
        int nextInt() {
            return Integer.parseInt(nn());
        }
 
        long nextLong() {
            return Long.parseLong(nn());
        }
 
        double nextDouble() {
            return Double.parseDouble(nn());
        }
 
        Integer[] niArr0(int n) {
            Integer[] ar = new Integer[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Integer[] niArr1(int n) {
            Integer[] ar = new Integer[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }
 
        Long[] nlArr0(int n) {
            Long[] ar = new Long[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
 
        Long[] nlArr1(int n) {
            Long[] ar = new Long[n + 1];
            for (int i = 1; i <= n; i++) {
                ar[i] = nextLong();
            }
            return ar;
        }
    }

}


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

using namespace std;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  while (1) {
    int N, K, M; cin >> N >> K >> M;
    if (N == 0 and K == 0 and M == 0) break;
    M--;
    vector<int> stones(N); REP(i, N) stones[i] = i;
    while (stones.size() > 1) {
      stones.erase(stones.begin() + M);
      M = (M + K - 1 + stones.size()) % stones.size();
    }
    cout << stones[0] + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    map<string,int> count;
    int best=0;
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(count.find(s)==count.end()){
            count[s]=1;
        }else{
            count[s]++;
        }
        best=max(best,count[s]);
    }
    vector<string> ans;
    for(auto itr=count.begin();itr!=count.end();itr++){
        if(itr->second==best)ans.push_back(itr->first);
    }
    sort(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 26868
#include <iostream>
using namespace std;
int main(){
    int W,H,x,y,r;
    cin >> W >> H >> x >> y >> r ;
    if (x + r > W){
        cout << "No" << endl;
    }
    else if(x - r < 0){
        cout << "No" << endl;
    }
    else if(y + r > H){
        cout << "No" << endl;
    }
    else if(y - r < 0){
        cout << "No" <<endl;
    }
    else{
        cout << "Yes" <<endl;
    }
}


Measured memory_bytes: 3116
#include <iostream>

using namespace std;


int main()
{
	int A, B, C;
	int max = 0;
	int min[2] = { 0 };
	int ret = 0;

	cin >> A >> B >> C;

	max = A;

	if (A < B) {
		max = B;
		min[0] = A;
	}
	else {
		max = A;
		min[0] = B;
	}

	if (max < C) {
		min[1] = max;
		max = C;
	}
	else {
		min[1] = C;
	}

	ret = max * 10 + min[0] + min[1];
	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
// D - Gathering Children

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

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

	int result[100005] = {};

	// 最初にRにいる人
	int odd_R = 0;
	int even_R = 0;
	bool odd = true;
	for (int i=0; i<S.size(); i++) {
		if (S[i] == 'R') {
			if (odd) {
				odd_R++;
				odd = false;
			} else {
				even_R++;
				odd = true;
			}
		} else {
			// 'L'に来た
			if (odd) {
				result[i-1] += even_R;
				result[i] += odd_R;
			} else {
				result[i-1] += odd_R;
				result[i] += even_R;
			}

			// リセット
			odd_R = 0;
			even_R = 0;
			odd = true;
		}
	}

	// 最初にLにいる人
	int odd_L = 0;
	int even_L = 0;
	odd = true;
	for (int i=S.size()-1; i>=0; i--) {
		if (S[i] == 'L') {
			if (odd) {
				odd_L++;
				odd = false;
			} else {
				even_L++;
				odd = true;
			}
		} else {
			// 'R'に来た
			if (odd) {
				result[i+1] += even_L;
				result[i] += odd_L;
			} else {
				result[i+1] += odd_L;
				result[i] += even_L;
			}

			// リセット
			odd_L = 0;
			even_L = 0;
			odd = true;
		}
	}

	for (int i=0; i<S.size(); i++) {
		if (i > 0) cout << " ";
		cout << result[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstdlib>
#include <cmath>
#include<algorithm>
#include<vector>
#include<unordered_map>
#include <bits/stdc++.h>
using namespace std;

int main()
{   
    long double A, B, H, M;
    cin >> A >> B >> H >> M;
    
    long double theta;
    
    theta = abs((H+M/60.0)/6.0 - M/30.0)*M_PI;
    theta = theta < 2*M_PI - theta ? theta : 2*M_PI - theta;
    
    long double c = sqrt(A*A + B*B - 2*A*B*cos(theta));
    cout << std::setprecision(20) << c << endl;
}


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

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int count=0;
    string tmp;
    for(int i=0; i<N-2; i++){
        tmp = S.substr(i,3);
        if(tmp=="ABC"){
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256