akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int ans;
    ans = c - (a-b);
    if(ans < 0)
    ans = 0;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
S = list(input())
T = list(input())
S.sort()
T.sort()
S.reverse()
T.reverse()
for i, s in enumerate(S):
    for j, t in enumerate(T):
        if s < t:
            print('Yes')
            exit()
        if s > t:
            for k, t2 in enumerate(T):
                if s < t2:
                    print('Yes')
                    exit()

if all([x == S[0] for x in S]) \
        and all([x == S[0] for x in T]) \
        and len(S) < len(T):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
/*
   وَعَلَى اللَّهِ فَلْيَتَوَكَّلِ الْمُؤْمِنُونَ
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
   //  freopen("in.txt", "r", stdin) ;
   ios :: sync_with_stdio(0) ;
   cin.tie(0) ;
   cout.tie(0) ;

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

   int mx = 1e9 ;
   for(int i = 1 ; i <= 300 ; i++){
        int tot = 0 ;
        for(auto j: a){
            int dif = (j - i) ;
            tot += dif * dif ;
        }
        mx = min(mx, tot) ;
   }

   cout << mx ;


}




Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define Fr(i,a,b) for(int i=a;i<=b;i++)
#define RF(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<ll,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pii>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
 
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        int x,y,z;
        vvi a;
        a.resize(3);
        Fr(i,0,n-1){
            cin>>x>>y>>z;
            a[0].pb(x);
            a[1].pb(y);
            a[2].pb(z);
        }
        vvi b(3,vi(n,0));
        b[0][0]=a[0][0];b[1][0]=a[1][0];b[2][0]=a[2][0];
        Fr(i,1,n-1){
            b[0][i]=max(b[1][i-1],b[2][i-1])+a[0][i];
            b[1][i]=max(b[0][i-1],b[2][i-1])+a[1][i];
            b[2][i]=max(b[1][i-1],b[0][i-1])+a[2][i];
        }
        cout<<max(b[0][n-1],max(b[1][n-1],b[2][n-1]))<<endl;
    }
    return 0;
} 

Measured memory_bytes: 3308
H, W, M = map(int, input().split())

visited = set()

h_sum = [0] * H
w_sum = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    visited.add((h, w))
    h_sum[h] += 1
    w_sum[w] += 1

max_h = max_w = 0
can_h = []
can_w = []
for i in range(H):
    max_h = max(max_h, h_sum[i])
    
for i in range(W):
    max_w = max(max_w, w_sum[i])

for i in range(H):
    if h_sum[i] == max_h:
        can_h.append(i)
for i in range(W):
    if w_sum[i] == max_w:
        can_w.append(i)
        
ans = max_h + max_w

for i in can_h:
    for j in can_w:
        if (i, j) not in visited:
            print(ans)
            exit()

print(ans-1)

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

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

    vector<vector<int>> a(2, vector<int>(n));
    for(int i = 0; i<a.size(); ++i) {
        for(int j = 0; j<a.at(0).size(); ++j) {
            cin >> a.at(i).at(j);
        }
    }

    vector<vector<int>> candy(2, vector<int>(n));
    candy.at(0).at(0) = a.at(0).at(0);
    for(unsigned int i = 0; i< 2; ++i) {
        for(unsigned int j = 0; j< n; ++j) {
            if ( j+1 != n) {
                candy.at(i).at(j+1) = max(candy.at(i).at(j) + a.at(i).at(j+1), candy.at(i).at(j+1));
            }
            if ( i+1 != 2) {
                candy.at(i+1).at(j) = max(candy.at(i).at(j) + a.at(i+1).at(j), candy.at(i+1).at(j));
            }

        }
    }
    cout << candy.at(1).at(n-1) << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

signed main(void){
    int N,M;
    int H[114514];
    int A[114514],B[114514];
    
    cin >> N >> M;
    REP(i,N){cin >> H[i];}
    REP(i,M){
        cin >> A[i] >> B[i];
        A[i]--;B[i]--;
    }
    
    int good[114514];
    REP(i,N){
        good[i]=1;
    }
    
    REP(i,M){
        if(H[A[i]]>H[B[i]]){
            good[B[i]]=0;
        }else if(H[A[i]]<H[B[i]]){
            good[A[i]]=0;
        }else{
            good[A[i]]=0;
            good[B[i]]=0;
        }
    }
    
    int Ans=0;
    REP(i,N){
        Ans+=good[i];
    }
    cout << Ans << endl;
    
    return 0;
}




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

int main() 
{
  int N, A, B;
  cin >> N >> A >> B;

  int x = A * N;
  int y = B;

  if (x == y) cout << x << endl;
  else if (x > y) cout << y << endl;
  else cout << x << endl;
}


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

void pr(int a, int b){
    for(int i=0; i<a; i++){
        cout << b;
    }
    cout << endl;
}
int main(){
    int a, b;
    cin >> a >> b;
    if(a>=b){
        pr(a, b);
    }
    else pr(b, a);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,q;cin >> n >> q;
	vector<vector<int>> G(n,vector<int>());
	vector<ll> ans(n);
	rep(i,n-1){
		int a,b;cin >> a >> b;
		G.at(a-1).pb(b-1);
		G.at(b-1).pb(a-1);
	}
	rep(i,q){
		int p,x;cin >> p >> x;
		ans.at(p-1) += x;
	}
	vector<bool> used(n,true);
	queue<pair<int,ll>> que;
	que.push(mp(0,0));
	used.at(0) = false;
	while(!que.empty()){
		pair<int,ll> cur = que.front();que.pop();
		int num = cur.first;
		ll sum = cur.second;
		ll nextsum = sum + ans.at(num);
		ans.at(num) = sum + ans.at(num);
		rep(i,G.at(num).size()){
			if(used.at(G.at(num).at(i))){
				used.at(G.at(num).at(i)) = false;
				que.push(mp(G.at(num).at(i),nextsum));
			}
		}
	}
	rep(i,n){
		if(i == n-1) cout << ans.at(i) << endl;
		else cout << ans.at(i) << " ";
	}
}


Measured memory_bytes: 18804
using System;
public class Hello{
    public static void Main(){
        int N = int.Parse(Console.ReadLine());
        int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
        int M = int.Parse(Console.ReadLine());
        
        for(var i = 0;i < M;i++){
            int ans = 0;
            
            string[] input = Console.ReadLine().Split(' ');
            int dn = int.Parse(input[0]);
            int time = int.Parse(input[1]);
            for(var j = 0;j < N;j++){
                if(j == dn - 1){
                    ans += time;
                }else{
                    ans += nums[j];
                }
            }
            Console.WriteLine(ans);
        }
        
    }
}


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

int main(){
    char X, Y;
    cin >> X >> Y;

    if(X > Y){
        cout << '>' << endl;
    }
    else if(X < Y){
        cout << '<' << endl;
    }
    else{
        cout << '=' << endl;
    }
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::HashSet;
use std::cmp;
use std::f64::consts;

fn main() {
    let s: String =read();
    let vec: Vec<char> = s.chars().collect();
    let k: i64 = read();

    let mut ans_vec: HashSet<String> = HashSet::new();


    for str_len in 1..k as usize +1 {
        for start_index in 0..s.len() {
            let mut str = "".to_string();
            let end_index = start_index + str_len;
            if end_index > s.len() {
                break;
            }
            for k in start_index..end_index {
                str = format!("{}{}", str, vec[k]);
            }
            ans_vec.insert(str);
        }
    }

    let mut ans: Vec<String> = ans_vec.iter().cloned().collect();
    ans.sort();
    println!("{}", ans[(k-1) as usize]);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// 最大公約数
fn gcd(a: i32, b: i32) -> i32 {
    match b {
        0 => a,
        _ => gcd(b, a % b)
    }
}

// 最小公倍数
fn lcm(a: i32, b: i32) -> i32 {
    a * b / gcd(a, b)
}

// 階乗
fn kaijou(n: i32)->i32 {
    if n == 1 {
        return n;
    }
    return n * kaijou(n-1);
}

Measured memory_bytes: 6396
def main():
    a, b = input().split()
    alphabet = {'A': 10, 'B': 11, 'C': 12, 'D': 13, 'E': 14, 'F': 15}
    if alphabet.get(a) < alphabet.get(b):
        print('<')
    elif alphabet.get(a) > alphabet.get(b):
        print('>')
    else:
        print('=') 
main()

Measured memory_bytes: 8992
s = input()
nbits = 2**(len(s)-1)
ans = 0
for bit in range(nbits):
  tmp = []
  for i in range(len(s)-1):
    if bit & (1 << i):
      tmp.append(i)
  curr = 0
  for x in tmp:
    ans += int(s[curr:x+1])
    curr = x + 1
  ans += int(s[curr:])

print(ans)

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

int main(int argc, char const *argv[])
{
    int n, x, sum;
    vector<int> vn, vx;

    while (true)
    {
        cin >> n >> x;
        if (n == 0 && x == 0)
        {
            break;
        }
        else
        {
            vn.emplace_back(n);
            vx.emplace_back(x);
        }
    }

    for (int i = 0; i < vn.size(); i++)
    {
        sum = 0;
        for (int j = 1; j <= vn[i]; j++)
        {
            for (int k = j + 1; k <= vn[i]; k++)
            {
                for (int l = k + 1; l <= vn[i]; l++)
                {
                    if (j + k + l == vx[i])
                    {
                        sum += 1;
                    }
                }
            }
        }
        cout << sum << endl;
    }

    return 0;
}



Measured memory_bytes: 3144
#include <stdio.h>
int fibo[45];
int main(){
  int n;
  int i;
  scanf("%d",&n);
  fibo[0]=1;
  fibo[1]=1;
  for(i=2;i<=n;i++)fibo[i]=fibo[i-1]+fibo[i-2];

  printf("%d\n",fibo[n]);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 1000000000000;
const long long MOD = 1000000007;

//書くくらいの輪を返す
long long f(long long N){
  string s = to_string(N);
  long long slen = s.length();
  long long ret=0;
  for (int i = 0; i < slen; i++)
    ret += (s[i] - '0');
  return ret;
}

int main()
{
  string s,t;
  cin >> s>>t;
  for (int i = 0; i < s.length();i++){
    char last = s[s.length() - 1];
    s = last + s;
    s.pop_back();
    //cout << s << endl;
    if(s==t){
      cout<< "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


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

int main()
{
    int n;
    cin >> n;
    bool flag=false;
    for(int i=1;i<=9;++i){
        if((double)n/i==(int)n/i && 1<=n/i && n/i<=9) flag=true;
    }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

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

  int d1 = abs(a - b);
  int d2 = abs(b - c);
  int d3 = abs(c - a);
  cout << d1 + d2 + d3 - max(d1, max(d2, d3)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define vll vector<ll>
#define vvll vector<vll>
#define mll map<ll,ll>
#define f(i,m,n) for(i=m;i<n;i++)
#define ee endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define take(v,n) for(i=0;i<n;i++) cin>>v[i];
#define NO() cout<<"No"<<endl
#define YES() cout<<"Yes"<<endl
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sot(v) sort(v.begin(),v.end());
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

ll powe(ll x, ll y){
    ll res = 1;
    while (y > 0){
        if (y & 1) res = res*x;
        y = y>>1;
        x = x*x;
    }
    return res;
}

void solve()
{
    ll i,j,k=0,n,l;
    cin>>n>>k>>j;
    l=n/k+(n%k?1:0);
    cout<<j*l<<ee;
    
}

int main() {
    fast;
    ll i,j,l,k,t,n;
    t=1;
    while(t--)
    solve();
}

Measured memory_bytes: 3636
while True:
    s = input().split(" ")
    n = int(s[0])
    x = int(s[1])
    if n == 0 and x == 0:
        break
    cnt = 0
    for i in range(1, n-1):
        for j in range(i+1, n):
            for k in range(j+1, n+1):
                if i + j + k == x:
                    cnt += 1
    print(cnt)
    

Measured memory_bytes: 7664
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
const int mod = 1000000007;
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
vector<int> f = {1},fi = {1};
int fact(int x){
	while((int)f.size() <=x)f.push_back((f.back()*f.size())%mod);
	return f[x];
}
int ifact(int x){
	return modpow(fact(x),mod-2,mod);
}
int C(int x,int y){
	if(x < y)return 0;
	return fact(x)*ifact(y)%mod*ifact(x-y)%mod;
}

signed main(){
	int n,k;cin >> n >> k;
	vector<int> a(n);
	rep(i,n)cin >> a[i];
	sort(a.begin(),a.end());
	int ret = 0;
	rep(i,n){
		int tmp = (a[i]*C(i,k-1))%mod;
		ret = (ret + tmp)%mod;
	}
	reverse(a.begin(),a.end());
	rep(i,n){
		int tmp = (a[i]*C(i,k-1))%mod;
		ret = (ret - tmp)%mod;

	}
	cout << (ret%mod + mod)%mod << endl;
	return 0;
}

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

int main(){
  int A, B, Ans;
  
  cin >> A >> B;
  
  if(A+B == 3) Ans = 3;
  else if(A+B == 5) Ans = 1;
  else if(A+B == 4) Ans = 2;
  
  cout << Ans << endl;
  
  return 0;
}


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

using namespace std;
int cnt[10];
int main() {
	int N; cin >>N;
	char c[20];
	while(N--) {
		scanf("%s",c);
		if(c[0] =='M')cnt[0]++;
		if(c[0]=='A')cnt[1]++;
		if(c[0]=='R')cnt[2]++;
		if(c[0]=='C')cnt[3]++;
		if(c[0]=='H')cnt[4]++;
	} 
	long long ans = 0;
	//for(int i = 0; i < 5; ++i)cout<<cnt[i]<<endl;
	for(int i = 0; i < (1 <<5);++i){
		int tot = 0; long long tmp = 1; bool ok = 1;
		for(int j = 0; j < 5; ++j) {
			if(i & (1 << j)) tot++, tmp *= cnt[j];
		}
		if(tot!=3)continue;
		ans+= tmp;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
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; }

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

int main(){
    int n;
    int m;
    cin >> n >> m;
    vector<int> g[100005];
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    queue<int> q;
    vector<int> to(n, -1);
    q.push(0);
    to[0] = 0;
    while(!q.empty()){
        int p = q.front(); q.pop();
        for(int v : g[p]){
            if (p != v && to[v] == -1){
                q.push(v);
                to[v] = p+1;
            }
        }
    }
    rep(i,n){
        if (to[i] == -1){
            cout << "No" << endl;
        }
    }
    cout << "Yes" << endl;
    for(int i = 1; i < n; i++){
        cout << to[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 10180
<?php

fscanf(STDIN, '%s', $str);
fscanf(STDIN, '%d', $q);

for ($i = 0; $i < $q; $i++) {
    $line = trim(fgets(STDIN));
    if (strpos($line, 'print') !== false) {
        sscanf($line, '%s %d %d', $s, $from, $to);
        echo substr($str, $from, $to - $from + 1), PHP_EOL;
        continue;
    }

    if (strpos($line, 'replace') !== false) {
        sscanf($line, '%s %d %d %s', $s, $from, $to, $replace);
    } else {
        sscanf($line, '%s %d %d', $s, $from, $to);
        $s = substr($str, $from, $to - $from + 1);
        $replace = implode('', array_reverse(str_split($s)));
    }

    for ($j = 0; $from <= $to; $from++, $j++) {
        $str[$from] = $replace[$j];
    }
}

Measured memory_bytes: 6860
n=int(input())
s=list(input())
ans=[]
for i in range(1,n):
    x=s[:i]
    y=s[i:]
    cnt=0
    x=list(set(x))
    y=list(set(y))
    for j in range(len(x)):
        if x[j] in y:
            cnt+=1
    ans.append(cnt)
print(max(ans))
        

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

int main() {
    int x, y, z, k;
    cin >> x >> y >> z >> k;

    long a[x], b[y], c[z];

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

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

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

    long ab[x * y];

    for (int i = 0; i < x; i++) {
        for (int j = 0; j < y; j++) {
            ab[i * y + j] = a[i] + b[j];
        }
    }

    sort(ab, ab + (x * y), greater<long>());

    int max_ab_idx = min(3000, x * y);

    long abc[max_ab_idx * z];

    for (int i = 0; i < max_ab_idx; i++) {
        for (int j = 0; j < z; j++) {
            abc[i * z + j] = ab[i] + c[j];
        }
    }

    sort(abc, abc + (max_ab_idx * z), greater<long>());

    for (int i = 0; i < k; i++) {
        cout << abc[i] << endl;
    }

    return 0;
}


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

int main()
{
    std::vector<int> alpha(26, 0);
    std::string s;

    std::cin >> s;

    for (auto a : s) {
        int c = a - 97;
        alpha.at(c) += 1;
    }

    // 文字がかぶってたら-1出力して終わり
    for (auto a : alpha) {
        if (a > 1) {
            std::cout << -1 << std::endl;
            return 0;
        }
    }

    // 末尾に1文字追加して出力
    for (int i = 0; i < alpha.size(); ++i) {
        if (alpha.at(i) == 0) {
            char new_char = static_cast<char>(i + 97);
            std::cout << s + new_char << std::endl;
            return 0;
        }
    }

    // 全部埋まってたら
    std::string s_rev = s;
    std::reverse(s_rev.begin(), s_rev.end());
    for (int i = 0; i < s_rev.size(); ++i) {
        int c_int = static_cast<int>(s_rev.at(i) - 97);
        for (; c_int < alpha.size(); ++c_int) {
            if (alpha.at(c_int) == 0) {
                char new_char = static_cast<char>(c_int + 97);
                std::string new_s = s.substr(0, s.size()-i-1);
                std::cout << new_s + new_char << std::endl;
                return 0;
            }
        }
        alpha.at(static_cast<int>(s_rev.at(i) - 97)) = 0;
    }
    std::cout << -1 << std::endl;

    return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int mod = 1000000007;

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i, n)
  {
    cin >> a[i];
  }
  ll ans = 0;
  for(int i = 0; i < 60; ++i)
  {
    ll x = 0;
    for(int j = 0; j < n; ++j)
    {
      if(a[j] >> i & 1) ++x;
    }
    ll now = x * (n - x) % mod;
    for(int j = 0; j < i; ++j)
    {
      now = now * 2 % mod;
    }
    ans += now;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2560
#include <cstdio>  
#include <iostream>
using namespace std;
char c[110][110];
int row[110],col[110];
int main()
{
	int n,m;
	cin>>n>>m;
	int i,j;
	bool judge;
	for(i=1;i<=n;i++)
	{
		judge=false;
		for(j=1;j<=m;j++)
		{
			cin>>c[i][j];
			if(c[i][j]=='#')
				judge=true;
		}
		if(judge)	row[i]=1;
	}
	for(i=1;i<=m;i++)
	{
		judge=false;
		for(j=1;j<=n;j++)
		{
			if(c[j][i]=='#')
				judge=true;
		}
		if(judge)	col[i]=1;
	}
	for(i=1;i<=n;i++)
	{
		if(row[i])
		{
			for(j=1;j<=m;j++)
				if(col[j])
					cout<<c[i][j];
			cout<<endl; 
		}
	}
	return 0;
		
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll power(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)

//your code here!

int main(void){
    char s[100100];
    scanf("%s", s);
    ll N=strlen(s);
    while(N) {
        if     (N>=7 && strncmp(s+N-7, "dreamer", 7)==0) N -= 7;
        else if(N>=6 && strncmp(s+N-6, "eraser" , 6)==0) N -= 6;
        else if(N>=5 && (strncmp(s+N-5, "dream" , 5)==0 || strncmp(s+N-5, "erase", 5)==0)) N -= 5;
        else {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int N, A[100001], B[2]; long long ans;
int main() {
  scanf("%d", &N);
  for(int i = 0; i < N+1; i++) scanf("%d", &A[i]);
  for(int i = 0; i < N+1; i++) {
    scanf("%d", &B[1]);
    if(i == N) B[1] = 0;
    if(B[0] > A[i]) {ans += A[i]; A[i] = 0;}
    else B[1] += B[0];
    if(B[1] > A[i]) {ans += A[i]; B[0] = B[1]-A[i];}
    else {ans += B[1]; B[0] = 0;}
  }
  printf("%ld", ans);
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<queue>
#include<cstring>
#define dian(i,j) (i+(j)*(Maxn+1))
#define Maxn 50*50//Ò»²ãµÄµãÊý 
#define int long long
using namespace std;
int N,M,s;
int first[Maxn*Maxn*2]={0},newp=0,vis[Maxn*Maxn*2]={0},c[Maxn+5],d[Maxn+5];
int dist[Maxn*Maxn*2];
struct wc
{
	int to,ne,va;
}v[Maxn*Maxn+5];
void add(int a,int b,int t)
{
	v[++newp]=(wc){b,first[a],t};
	first[a]=newp;
}
void dij(int root)
{
	dist[root]=0;
	priority_queue<pair<int,int> > q;
	q.push(make_pair(-dist[root],root));
	while(!q.empty()){
		int t=q.top().second;q.pop();
		if(vis[t])continue;
		vis[t]=1;
		for(int i=first[t];i;i=v[i].ne){
			int j=v[i].to;
			if(dist[j]>v[i].va+dist[t]){
				dist[j]=dist[t]+v[i].va;
				q.push(make_pair(-dist[j],j));
			}
		}
	}
}
signed main()
{
	int num=Maxn;
	scanf("%lld%lld%lld",&N,&M,&s);
	s=min(s,num);
	for(int i=1,a,b,x,t;i<=M;i++){
		scanf("%lld%lld%lld%lld",&a,&b,&x,&t);
		for(int j=0;j<=Maxn;j++){
			if(j>=x){
				add(dian(a,j),dian(b,j-x),t);
				add(dian(b,j),dian(a,j-x),t);
			}
		}
	}
	for(int i=1,x,t;i<=N;i++){
		scanf("%lld%lld",&x,&t);
		for(int j=0;j<=Maxn;j++){
			int cur=min(j+x,num);
			add(dian(i,j),dian(i,cur),t);
		}
	}
	memset(dist,0x3f,sizeof(dist));
	dij(dian(1,s));
	/*for(int i=1;i<=N;i++){
		for(int j=0;j<=5;j++){
			printf("%lld ",dist[dian(i,j)]);
		}
		printf("\n");
	}*/
	for(int i=2;i<=N;i++){
		int ans=0x3f3f3f3f3f3f3f3f;
		for(int j=0;j<=Maxn;j++){
			ans=min(ans,dist[dian(i,j)]);
			if(ans==0)printf(" %d ",j);
		}
		
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 139160
#include <bits/stdc++.h>
#define IOS  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define mp    make_pair
#define pb    push_back
#define F     first
#define pi 	  3.14159265358979323846
#define S     second
#define ll    long long
#define ld    long double
#define sz(s) (ll)s.size() 
#define vl    vector < ll >
#define pll   pair < ll, ll >
#define ml    map < ll, ll >
#define mod   1000000007
#define MAXN  50005 
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define inv(i,a,b)  for(ll i=a;i>=b;i--)
#define all(a)  (a).begin(),(a).end()
using namespace std;
int main(){
	IOS;
	ll n,i,k,m,ans,ans1;
	cin>>k>>n;
	bool a[105]={false};
	rep(i,0,n)cin>>m,a[m]=true;
	rep(i,k,102)if(a[i]==false){ans=i;break;}
	inv(i,k-1,0)if(a[i]==false){ans1=i;break;}
	if(abs(ans1-k)<=abs(ans-k))cout<<ans1;
	else cout<<ans;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <array>

using namespace std;
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using C = array<int, 10>;
constexpr C e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

struct Node {
    using NP = Node*;
    NP l, r;
    int sz;
    Node(int sz) : sz(sz) {
        fill(begin(cnt), end(cnt), 0);
        cnt[0] = 1;
        lz = e;
        if (sz == 1) return;
        l = new Node(sz/2);
        r = new Node(sz-sz/2);
        update();
    }
    C cnt;
    C lz;
    void push() {
        if (lz != e) {
            l->lzdata(lz);
            r->lzdata(lz);
            lz = e;
        }
    }
    void lzdata(C nx) {
        C ncnt = {};
        C nlz = {};
        for (int i = 0; i < 10; i++) {
            nlz[i] = nx[lz[i]];
        }
        for (int i = 0; i < 10; i++) {
            ncnt[nx[i]] += cnt[i];
        }
        lz = nlz;
        cnt = ncnt;
    }
    void update() {
        for (int i = 0; i < 10; i++) {
            cnt[i] = l->cnt[i] + r->cnt[i];
        }
    }
    int get(int a, int b, int c, int d) {
        if (b <= 0 || sz <= a) return 0;
        if (a <= 0 && sz <= b) {
            int u = 0;
            for (int i = c; i <= d; i++) {
                u += cnt[i];
            }
            return u;
        }
        push();
        return l->get(a, b, c, d) + r->get(a - sz/2, b - sz/2, c, d);
    }
    void cng(int a, int b, int c, int d) {
        // c -> d
        if (b <= 0 || sz <= a) return;
        if (a <= 0 && sz <= b) {
            C x = e;
            x[c] = d;
            lzdata(x);
            return;
        }
        push();
        l->cng(a, b, c, d);
        r->cng(a-sz/2, b-sz/2, c, d);
        update();
    }
};

int n, q;
VV<int> g;
V<int> lid, rid;
int nc = 0;
void precalc(int p, int b) {
    lid[p] = nc; nc++;
    for (int d: g[p]) {
        if (d == b) continue;
        precalc(d, p);
    }
    rid[p] = nc;
}

V<int> res;



int main() {
    ios::sync_with_stdio(false);
    cin >> n >> q;
    g = VV<int>(n);
    lid = V<int>(n); rid = V<int>(n);
    for (int i = 0; i < n-1; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    precalc(0, -1);

/*    for (int i = 0; i < n; i++) {
        cout << lid[i] << ":" << rid[i] << endl;
    }*/

    Node* tr = new Node(n);
    res = V<int>(q);
    for (int i = 0; i < q; i++) {
        int t, p, x, y;
        cin >> t >> p >> x >> y;
        int l = lid[p], r = rid[p];
        if (t == 1) {
            //count
            cout << tr->get(l, r, x, y) << endl;
        } else {
            //change
            tr->cng(l, r, x, y);
        }
    }
    return 0;
}

Measured memory_bytes: 36012
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

T RD(T = long)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n)
	{
		par = new long[](n);
		foreach (i; 0..n) par[i] = i;
		cnt = new long[](n);
		fill(cnt, 1);
	}
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	long unite(long i, long j)
	{ 
		i = root(i); j = root(j);
		if (i == j) return 0;
		par[j] = i;
		auto cnt_i = ((cnt[i] ^^ 2) - cnt[i]) / 2;
		auto cnt_j = ((cnt[j] ^^ 2) - cnt[j]) / 2;
		cnt[i] += cnt[j];
		auto diff = ((cnt[i] ^^ 2) - cnt[i]) / 2 - (cnt_i + cnt_j);
		//stderr.writeln(i, ":", j, " ", cnt_i, " ", cnt_j, " ", diff);
		return diff;
	}

	long[] par;
	long[] cnt;
}

void main()
{
	auto N = RD;
	auto a = RDR.ARR;
	auto avg = cast(double)a.sum / a.length;
	auto pos = MIN_POS!((a, b) => abs(a - avg) < abs(b - avg))(a);
	
	writeln(pos);
	stdout.flush();
}

Measured memory_bytes: 380
import sys

N=int(input())
ab=[list(map(int,input().split())) for i in range(N-1)]
c=list(map(int,input().split()))
c.sort(reverse=True)
data=[[] for i in range(N+1)]
for a,b in ab:
    data[a].append(b)
    data[b].append(a)
    
flag=[0]*(N+1)
ans=[0]*(N+1)
flag[1]=1
k=0
que=[1]
while que:
    for u in que:
        ans[u]=c[k]
        k+=1
    if k>N:
        break
    h=[]
    for u in que:
        for v in data[u]:
            if flag[v]==0:
                flag[v]=1
                h.append(v)
    que=h
print(sum(ans[2:]))
print(*ans[1:])

Measured memory_bytes: 52056
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long
#define MAX 10

bool edge[MAX][MAX];
bool visited[MAX];
int n, m, cnt;

void dfs(int current, int number) {
  if (n == number) {
    cnt++;
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i] && edge[i][current]) {
      visited[i] = true;
      dfs(i, number + 1);
      visited[i] = false;
    }
  }
}


signed main() {
  cin >> n >> m;
  for (int i = 0; i < MAX; i++) {
    for (int j = 0; j < MAX; j++) {
      edge[i][j] = false;
    }
  }
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    edge[a][b] = true;
    edge[b][a] = true;
  }
  fill(visited, visited + MAX, false);
  visited[1] = true;
  dfs(1, 1);
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
    a,b = map(int,input().split())
    c.append(a)
    t.append(b)
flg = 0
ans = []
for i in range(N):
    if t[i] <= T:
        ans.append(c[i])
        flg = 1
if flg==0: print("TLE")
else:
    ans.sort()
    print(ans[0])


Measured memory_bytes: 3064
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF=2e18;

string S;
ll N,K;

int main(){
    cin>>N>>K>>S;
    ll cnt=0;
    for(ll i=0;i<S.length()-1;i++){
        if(S[i]!=S[i+1]){
            cnt++;
        }
    }
    cout<<(N-1)-max(0LL,cnt-2*K);


    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{

    public static void main(String[] args) {
        
        Scanner scan = new Scanner(System.in);
        
        String[] l = scan.nextLine().split(" ");
        int a = Integer.parseInt(l[0]);
        int b = Integer.parseInt(l[1]);
        String s = scan.nextLine();

        if(s.length() != (a+b+1)){
            System.out.println("No");
            scan.close();
            return;
        }

        String res = "Yes";
        for(int i=0; i<s.length(); i++){
            String str = s.substring(i, i+1);
            if(i==a && !str.equals("-")){
                res = "No";
                break;
            }else if(i!=a && !isNum(str)){
                res = "No";
                break;
            }
        }
        
        System.out.println(res);
        scan.close();
        
    }
    private static boolean isNum(String str){
        try{
            Integer.parseInt(str);
            return true;
        }catch(Exception e){
            return false;
        }
    }
}

Measured memory_bytes: 22612
#include <iostream>

using namespace std;

int main()
{

    int n,m,a;
    
    while(cin >> n >> m,n!=0&&m!=0){
        a = m-n;
        cout << a%500/100 << " " << a%1000/500 << " " << a/1000 << endl; 
    }
    
    return 0;
}



Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(int argc, char const* argv[])
{
    int tg;
    int count =0;
while(cin >> tg) {
   count =0;
    for(int a=0;a<=9;a++)
     for(int b=0;b<=9;b++)
       for(int c=0;c<=9;c++)
         for(int d=0;d<=9;d++)
             if(a+b+c+d==tg)count++;
    cout << count << endl;
}
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <utility>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

const double EPS = 1e-8;

bool equals(double x, double y) {
	return fabs(x-y) < EPS;
}

#define x first
#define y second
typedef pair<double, double> pt;


pt operator-(pt u, pt v) { return pt(u.x - v.x, u.y - v.y); }
pt operator+(pt u, pt v) { return pt(u.x + v.x, u.y + v.y); }
pt operator*(pt u, double d) { return pt(u.x * d, u.y * d); }

// dot product
double operator*(pt u, pt v) { return u.x * v.x + u.y * v.y; }
// norm
double operator!(pt p) { return sqrt(p * p); }
// "cross product"
double operator^(pt u, pt v) { return u.x * v.y - u.y * v.x; }

double operator==(pt a, pt b) { return equals(a.x, b.x) && equals(a.y, b.y);}

// angle with positive x axis
double operator~(pt v)
{
	return atan2(v.y, v.x);
}

int pointsInCircle(pt p, vector<pt>& points)
{
	vector<pair<double, bool>> angles;
	
	for(auto point : points)
	{
		pt x = point - p;
		double dSquared = x * x;
		if(p == point || dSquared > 4) continue;
		double a = acos(sqrt(dSquared) / 2.0); 
		double b = ~x;
		angles.emplace_back(b - a, true);
		angles.emplace_back(a + b, false);
	}
	
	int count = 1;
	int result = 1;
	sort(angles.begin(), angles.end());
	for(auto a : angles)
	{
		if(a.second) 
		{
			count++;
			result = max(result, count);
		}
		else count--;
	}
	return result;
}

int solve(vector<pt>& points)
{
	int sln = 0;
	for(auto p : points)
		sln = max(sln, pointsInCircle(p, points));
	return sln;
}

int main(void) {
	
	ios::sync_with_stdio(false);
	int N;
	cin >> N;

	while(N)
	{
		vector<pt> points;
		for(int i  = 0; i < N; ++i)
		{
			double x, y;
			cin >> x >> y;
			points.emplace_back(x, y);
		}
		cout << solve(points) << '\n';
		cin >> N;
	}
	return 0;
}


Measured memory_bytes: 3680
#include <vector>
#include <list>
#include <map>
#include <set>
#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 <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

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

#define INF 100000000
#define EPS 1e-9

#define MAX_N 16

int N;
int t[MAX_N][MAX_N + 1];
int dp[1 << MAX_N];
int score[1 << MAX_N];
vector<int> ans_list;

//すでにクリアしたゲーム集合S
int rec(int S){

	if (dp[S] >= 0){
		return dp[S];
	}

	if (S == (1 << N) - 1){
		return dp[S] = 0;
	}

	int ans = INF;

	//次のゲームの選択:uが次のゲーム
	for (int u = 0; u < N; u++){
		if (!(S >> u & 1)){
			int tmp = t[u][0];
			for (int i = 0; i < N; i++){
				if ((S >> i & 1)){
					tmp = min(tmp, t[u][i + 1]);
				}
			}
			ans = min(ans, tmp + rec(S | 1 << u));
		}
	}

	return dp[S] = ans;

}

int main(){

	while (true){
	
		cin >> N;
		if (N == 0)
			break;

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

		memset(dp, -1, sizeof(dp));
		ans_list.push_back(rec(0));
	
	}

	for (int i = 0; i < ans_list.size(); i++){
		cout << ans_list[i] << endl;
	}


	return 0;

}

Measured memory_bytes: 1484
from sys import stdin


def bubble_sort(A, N):
    for i in range(N-1):
        for j in range(N-1,0,-1):
            if int(A[j-1][1]) > int(A[j][1]):
                A[j], A[j-1] = A[j-1], A[j]
    return 'Stable'
                
def selection_sort(A, N, B):
    for i in range(N):
        minj = i
        for j in range(i,N):
            if int(A[j][1]) < int(A[minj][1]):
                minj = j
        A[i], A[minj] = A[minj], A[i]


    if A == B:
        return 'Stable'
    else:
        return 'Not stable'

    
def main():
    read = stdin.readline
    N = int(read())
    data_for_bubble = list(map(str, read().split('\n')[0].split(' ')))
    data_for_selection = data_for_bubble.copy()
    bubble_result = bubble_sort(data_for_bubble, N)
    for i in range(N-1):
        print(data_for_bubble[i], end = ' ')
    print(data_for_bubble[N-1])
    print(bubble_result)
    selection_result = selection_sort(data_for_selection, N, data_for_bubble)
    for i in range(N-1):
        print(data_for_selection[i], end = ' ')
    print(data_for_selection[N-1])
    print(selection_result)
    
    
if __name__ == '__main__':
    main()


Measured memory_bytes: 5616
/**
 *    author        : Sudipta Banik Trisha 
 *    created       : September 07, 2020 9:19 PM
 *    Problem Name  : A - Next Alphabet
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/abc151/tasks/abc151_a
 *    @genarated by : ai-virtual-assistant
**/

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

int main(){
    ios_base::sync_with_stdio(false);

    char c;
    cin >> c;

    int n = int(c) + 1;
    cout << char(n) << endl;

    return 0 ;
}


Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll A, B;
    cin >> A >> B;

    cout << max((ll)0, A - B * 2) << endl;

    return 0;
}

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

using namespace std;


#ifdef zxc

#include <sys/resource.h>
#include "debug.h"
#include "profile.h"

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define profile(X) LOG_DURATION(X)
#else
#define debug(...) 42
#define profile(...) 42
#endif

using ll = int64_t;
using ld = double;
const ld EPS = 1e-9;
//const ll MOD = 924844033;
const ld PI = 3.141592653589793;
const int maxn = 600001;
const int MOD = 1e9 + 7;
using cd = complex<double>;

void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
}

signed main() {
#ifdef zxc
    struct rlimit rl;
    const rlim_t kStackSize = 512L * 1024L * 1024L;
    assert(!getrlimit(RLIMIT_STACK, &rl));
    rl.rlim_cur = kStackSize;
    assert(!setrlimit(RLIMIT_STACK, &rl));
    freopen("../input.txt", "r", stdin);
//    freopen("../kolya_output.txt", "w", stdout);
#else
    //    mt19937 mt(std::chrono::high_resolution_clock::now().time_since_epoch().count());
    //            freopen("", "r", stdin);
    //        freopen("hack.out", "w", stdout);
#endif
    profile("all");

    auto solve = [](int _) {

        int n;
        cin >> n;
        vector<int> a(n + 1);
        for (int i = 1; i <= n; ++i) { cin >> a[i]; }
        if (n == 2) {
            if (a[1] == a[2]) {
                cout << "YES";
            } else {

                cout << "NO";
            }
            return;
        }
        vector<vector<int>> g(n + 1);
        for (int i = 1; i < n; ++i) {
            int a, b;
            cin >> a >> b;
            g[a].push_back(b);
            g[b].push_back(a);
        }
        bool ok = true;
        vector<ll> res(n + 1);
        function<void(int, int)> dfs = [&](int v, int p) {
            ll mx = 0;
            ll sum = 0;
            int cnt = 0;
            for (int to:g[v]) {
                if (to == p) {
                    continue;
                }
                ++cnt;
                dfs(to, v);
                mx = max(mx, res[to]);
                sum += res[to];
            }
            if (!cnt) {
                res[v] = a[v];
                return;
            }
            ll mn_avail = (2 * mx > sum ? mx : sum - sum / 2);
            if (a[v] < mn_avail || a[v] > sum) {
                ok = false;
            }
            res[v] = sum - 2 * (sum - a[v]);
            if (res[v] < 0) {
                ok = false;
            }
        };
        int root = 1;
        for (int i = 1; i <= n; ++i) {
            if (g[i].size() == 2) {
                root = i;
            }
        }
        dfs(root, root);
        if (ok && !res[root]) {
            cout << "YES";
        } else {
            cout << "NO";
        }
    };


    fast_io();
    cout.precision(9);
    cout << fixed;

    solve(1);


}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

const int LIMIT = 100100;

class UnionFind {
    vector<int> parent;

    public:
        UnionFind(int size) {
            parent = vector<int>(size, -1);
        }

        int find(int x) {
            if (parent[x] < 0) {
                // parent itself
                return x;
            } else {
                return parent[x] = find(parent[x]);
            }
        }

        bool unite(int x, int y) {
            int rX, rY;
            if ((rX = find(x)) == (rY = find(y))) {
                // already united
                return false;
            }
            if (size(rX) < size(rY)) {
                int tmp = rX;
                rX = rY;
                rY = tmp;
            }
            parent[rX] += parent[rY];
            parent[rY] = rX;
            return true;
        }

        int size(int x) {
            return -parent[find(x)];
        }

        bool is_same(int x, int y) {
            return find(x) == find(y);
        }

        int component_count() {
            int c = 0;
            for (const int x : parent) {
                if (x < 0) {
                    c++;
                }
            }
            return c;
        }
};
int main() {
    int n;
    cin >> n;
    UnionFind uf = UnionFind(LIMIT * 2);
    ll x, y;
    REP(i, n) {
        cin >> x >> y;
        uf.unite(x, y + LIMIT);
    }
    map<int, ll> mx;
    map<int, ll> my;
    REP(i, LIMIT) {
        mx[uf.find(i)]++;
    }
    FOR(i, LIMIT, LIMIT * 2) {
        my[uf.find(i)]++;
    }
    ll t = -n;
    REP(i, LIMIT * 2) {
        t += mx[i] * my[i];
    }
    cout << t << endl;
}


Measured memory_bytes: 26112
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<sstream>
#include<map>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll MOD =  1000000007;
const ll INF =  1LL << 60;
ll n, m, x, y,z,w, sum= 0, ans = 0;
vector<ll> a, b;
int main() {
    string st,s; cin >> n;
    cout << 0 << endl;
    int l = 0,r = n - 1;
    cin >> st;
    if (st == "Vacant") return 0;
    rep(i, 20) {
        int next = (l + r + 1) / 2;
        cout << next << endl;
        cin >> s;
        if (s == "Vacant") return 0;
        bool ok = 1;
        if (s == st && next % 2) ok = 0;
        if (s != st && next % 2 == 0)ok = 0;
        if (ok) l = next;
        else r = next;
    }
}

Measured memory_bytes: 852