akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {

		A = root(A);
		B = root(B);
		if (A == B) {

			return false;
		}
		if (size(A) < size(B)) swap(A, B);

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}
};

const int maxn = 100000;

int main() {

	int n, m;
	int p[maxn];
	int ans = 0;
	
	cin >> n >> m;

	rep(i, n) {
		int c; cin >> c;
		c--;
		p[c] = i;
	}

	UnionFind uni(n);

	rep(i, m) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		uni.connect(x, y);
	}
	
	rep(i, n) {     
		if (uni.root(i) == uni.root(p[i]))ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let r = read_as_vec::<f64>()[0];

    println!("{}", 2.0*r*std::f64::consts::PI);
}


Measured memory_bytes: 2224
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>=(cnt*(1/(4*m))):
        b.append(a[i])

if len(b)>= m:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const array<pair<int,int>,4> fd{make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int main(){
  int a[3][3];rep(i,3)rep(j,3)cin>>a[j][i];
  bool p = true;
  rep(i,3){
    p = p && a[0][i] - a[0][(i+1)%3] == a[1][i] - a[1][(i+1)%3] && a[0][i] - a[0][(i+1)%3] == a[2][i] - a[2][(i+1)%3] && a[i][0] - a[(i+1)%3][0] == a[i][1] - a[(i+1)%3][1] && a[i][0] - a[(i+1)%3][0] == a[i][2] - a[(i+1)%3][2];
}
  cout << (p ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
let rs, cs, xys = Scanf.(scanf "%d %d" @@ fun n m -> Array.(make n 0, make n 1, Array.init m @@ fun _ -> scanf " %d %d" @@ fun a b -> a - 1, b - 1))
let _ = rs.(0) <- 1; Array.(iter (fun (x, y) -> if rs.(x) = 1 then rs.(y) <- 1; cs.(y) <- cs.(y) + 1; cs.(x) <- cs.(x) - 1; if cs.(x) = 0 then rs.(x) <- 0) xys; fold_left (+) 0 rs) |> Printf.printf "%d\n"

Measured memory_bytes: 8320
use itertools::Itertools;
use proconio::input;

fn main() {
    input! {
        n: usize,
        l: [i64; n],
    }

    let ans = l
        .into_iter()
        .combinations(3)
        .filter(|xs| {
            let l_i = xs[0];
            let l_j = xs[1];
            let l_k = xs[2];
            !(l_i == l_j || l_j == l_k || l_k == l_i)
                && (l_i + l_j > l_k && l_j + l_k > l_i && l_k + l_i > l_j)
        })
        .count();

    println!("{}", ans);
}


Measured memory_bytes: 2192
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String[] input = sc.nextLine().split("");
        int n = input.length;
        int[] array = new int[n];
        
        for (int i=0; i<array.length; i++) {
            array[i] = Integer.parseInt(input[i]);
        }

        int[] test1 = new int[n];
        int[] test2 = new int[n];

        test1[0] = 0;
        test2[0] = 1;

        int amari = 0;
        for (int i=1; i<n; i++) {
            amari = i % 2;
            if (amari == 1) {
                test1[i] = 1;
                test2[i] = 0;
            } else {
                test1[i] = 0;
                test2[i] = 1;
            }
            
        }

        int total_test1 = 0;
        int total_test2 = 0;
        for (int i=0; i<n; i++) {
            // test1
            if (array[i] != test1[i]) {
                total_test1++;
            }
            // test2
            if (array[i] != test2[i]) {
                total_test2++;
            }
        }

        if (total_test1 <= total_test2) {
            System.out.println(total_test1);
        } else {
            System.out.println(total_test2);
        }
    }
}

Measured memory_bytes: 32452
using System;
using System.Linq;

namespace ITP1_3_D_How_Many_Divisors
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split( ' ' ).Select( int.Parse ).ToArray();
            Console.WriteLine( Enumerable.Range( input[ 0 ], input[ 1 ] - input[ 0 ] + 1 ).Count( n => input[ 2 ] % n == 0 ) );
        }
    }
}

Measured memory_bytes: 20256
//g++ .cpp && ./a.out
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

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

const int mod = 1000000007;
const int inf = 1000000007;

int main()
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (a + b >= k && a <= k)
    {
        cout << a << endl;
        return 0;
    }
    if (a + b >= k && a > k)
    {
        cout << k << endl;
        return 0;
    }
    if (a + b < k)
    {
        cout << a - (k - b - a) << endl;
        return 0;
    }
}


Measured memory_bytes: 3604
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <math.h>
using namespace std;

int main()
{
	int x;
	cin >> x;
	cout << x * x * x << endl;

    return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define ll long long

int main() {
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    for(int i = 0; i < t; i++) cin >> a[i];

    int ans = 0;
    for(int i = 0; i < t; i++) {
        ans = max(ans, a[i]-1-(k-a[i]));
        //cout << a[i]-1-(k-a[i]) << endl;
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

using ll= long long;

#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int N=13;
int c[14][14];


void solve(){
	int n,m,x;
	cin>>n>>m>>x;
	for(int i=0;i<n;i++){
		for(int j=0;j<m+1;j++){
			cin>>c[i][j];
		}
	}
	int ans=1e9+1;
	for(int st= 0;st<(1<<n);st++){
		vector<int> subset(m+1,0);
		int cost =0;
		for(int i=0;i<n;i++){
			if((st&(1<<i))){
				cost+= c[i][0];
				for(int j=0;j<m+1;j++){
					subset[j] += c[i][j];
				}
			}
		}
		bool ok= true;
		for(int j=1;j<m+1;j++){
			if(subset[j]<x){
				ok= false;
			}
		}
		if(ok){
			ans = min(ans,cost);
		}
	}
	if(ans== (1e9+1)){
		cout<<"-1\n";
	}else{
		cout<<ans<<"\n";
	}
}

int32_t main(){
	IOS

	int t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}

/*
   check for overflows int long long
   correct size of array
*/

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>x(n),y(n);
  for(i=0;i<n;i++)cin>>x[i]>>y[i];
  map<pair<ll,ll>,ll>t;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      buf1=x[i]-x[j];
      buf2=y[i]-y[j];
      if(t.find({buf1,buf2})==t.end()){
        t.insert({{buf1,buf2},1});
      }
      else t[{buf1,buf2}]++;
      
      if(t.find({-buf1,-buf2})==t.end()){
        t.insert({{-buf1,-buf2},1});
      }
      else t[{-buf1,-buf2}]++;
    }
  }

  for(auto itr=t.begin();itr!=t.end();itr++){
    chmax(res,itr->second);
  }
  cout<<n-res<<endl;

  

  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll n;
  cin >> n;
  vector<ll> a(3*n);
  for(ll i = 0; i < n*3; i++) cin >> a[i];
  sort(all(a), greater<ll>());

  ll ans = 0;
  for(ll i = 0; i < n; i++){
    //cout << ans << endl;
    ans += a[i*2+1];
  }
  cout << ans << endl;
  return 0;
}

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

char s[7];
P f[12][6];
int dx[]{ 1,-1,0,0 }, dy[]{ 0,0,1,-1 };
bool used[12][6];

int dfs(int x, int y) {
	used[x][y] = true;
	int res = 1;
	rep(i, 4) {
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 6 && !used[nx][ny] && f[nx][ny].first == f[x][y].first)
			res += dfs(nx, ny);
	}
	return res;
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		rep(i, 12) {
			scanf("%s", s);
			rep(j, 6)f[i][j] = P(s[j], 0);
		}
		int cnt = 0; bool update = true;
		while (update) {
			update = false;
			rep(i, 12)rep(j, 6)f[i][j].second = 0;
			rep(i, 12)rep(j, 6) {
				memset(used, 0, sizeof(used));
				if (f[i][j].first != '.'&&f[i][j].first != 'O'&&dfs(i, j) >= 4)
					f[i][j].second = 1;
			}
			rep(i, 12)rep(j, 6) {
				if (f[i][j].first != 'O')continue;
				bool ok = false;
				rep(k, 4) {
					int nx = i + dx[k], ny = j + dy[k];
					if (0 <= nx&&nx < 12 && 0 <= ny&&ny < 6 && f[nx][ny].first != 'O'&&f[nx][ny].second)ok = true;
				}
				if (ok) {
					f[i][j].second = 1;
				}
			}
			rep(i, 12)rep(j, 6) {
				if (f[i][j].second) {
					f[i][j].first = '.'; update = true;
				}
			}
			for (int i = 10; i >= 0; i--)rep(j, 6) {
				int k = i;
				while (k <= 10 && f[k + 1][j].first == '.')swap(f[k][j], f[k + 1][j]), k++;
			}
			if (update)cnt++;
		}
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 3208
#include <iostream>
#include <cstdio>

using namespace std;

int main(void)
{
	double line[10];
	double v1,v2;

	while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",&line[0],&line[1],&line[2],&line[3],&line[4],&line[5],&line[6],&line[7],&line[8],&line[9],&v1,&v2) != EOF ){

		double sum = 0;

		for( int i = 0;i < 10;i++ ){
			sum += line[i];
		}

		double time = sum / ( v1 + v2 );

		double dist = time * v1;


		for( int i = 0;i < 10;i++ ){
			dist -= line[i];

			if( dist <= 0 ){
				cout << i + 1 << endl;
				break;
			}
		}
	}

	return 0;
}

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

int main()
{
	int a = 0, b = 0, x = 0, y = 0, r = 0;
	cin >> a >> b >> x >> y >> r;
	if (a - (x + r) >= 0 && b - (y + r) >= 0 && x - r >= 0 && y - r >= 0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}


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

using namespace std;

int main() {
    int i,tmp;
    double gosei;
    cin >> i;
    vector<int> vc(i);
    for (int n = 0; n < i; ++n)
        cin >> vc.at(n);
    sort(vc.begin(),vc.end());
    gosei = vc.at(0);

    for(int n=1; n < i; ++n) {
        tmp = vc.at(n);
        gosei = (gosei+tmp)/2;
    }

    cout << gosei;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 123;
const ll LINF = (ll) 1e18 + 123;
const ld EPS = (ld) 1e-12;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (auto i = f; i < t; i++)
#define per(i, f, t) for (auto i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

void add(ll &x, ll y, ll mod = MOD) {
    x += y;
    if (x >= mod) x -= mod;
    if (x < 0) x += mod;
}

ll sum(ll x, ll y, ll mod = MOD) {
    add(x, y, mod);
    return x;
}

ll mult(ll x, ll y, ll mod = MOD) {
    return (x * y) % mod;
}

ll div(ll x, ll y, ll mod) {
    return x * power(y, mod - 2, mod);
}

template<typename A, typename B> bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

template<typename T> void read(T first, T last) {
    while (first != last) {
        cin >> *(first++);
    }
}

template<typename T> void print(T first, T last) {
    while (first != last) {
        cout << *(first++) << " ";
    }
    cout << "\n";
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

ll nok(ll x, ll y) {
    return x / __gcd(x, y) * y;
}

void run() {
    int n;
    cin >> n;
    ll ans;
    cin >> ans;
    rep(i, 0, n - 1) {
        ll t;
        cin >> t;
        ans = nok(ans, t);
    }
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

const int mod = 1000000007; // 998244353;
struct mint {
  long long x;
  mint(long long 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(long long 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;
}

// GCD, LCM
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

using P = pair<ll, ll>;
map<P,int>mp;
int acnt=0,bcnt=0;

int main(){
  int n;
  cin>>n;
  mint k=0;
  rep(i,n){
    ll a,b;
    cin>>a>>b;
    if(a==0&&b==0){
      k+=1;
    }
    else if(a==0){
      acnt++;
    }
    else if(b==0){
      bcnt++;
    }
    else{
      ll x=gcd(llabs(a),llabs(b));
      a/=x;
      b/=x;
      if(a<0&&b<0){
        a*=-1,b*=-1;
      }
      else if(a>0&&b<0){
        a*=-1,b*=-1;
      }
      mp[P(a,b)]++;
    }
  }
  mint ans=1;
  for(auto x:mp){
    P p=x.fi;
    ll a=p.fi,b=p.se;
    int s=x.se;
    int t=mp[P(b,-a)];
    ans*=(mint(2).pow(s)+mint(2).pow(t)-1);
    mp[P(a,b)]=0;
    mp[P(b,-a)]=0;
  }
  ans*=(mint(2).pow(acnt)+mint(2).pow(bcnt)-1);
  ans+=k;
  cout<<ans-1<<endl;
  return(0);
}


Measured memory_bytes: 41000
#include<stdio.h>
 int main(void){
     int i,n,r;
       for (i=1;i<=9;i++){
         for(n=1;n<=9;n++){
                r=i*n;
            printf("%dx%d=%d\n",i,n,r);
         }
       }



 return 0;
 }

Measured memory_bytes: 524
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdn = new Scanner(System.in);

		int a = stdn.nextInt();
		int b = stdn.nextInt();
		int c = stdn.nextInt();

		for(int i=0; i<3; i++) { 
			if (a > b){
				int t = a;
				a = b;
				b = t;
			}else if (a > c) {
				int t = a;
				a = c; 
				c = t;
			}else if (b > c) {
				int x = b;
				b = c; 
				c = x;
			}
		}

		System.out.println(a + " " + b + " " + c);
	}
}

Measured memory_bytes: 26144
from sys import stdin

def main():
    N = int(input())
    H = list(map(int, input().split()))

    ans, n = 0, 0
    for i in range(1, N):
        if H[i-1] >= H[i]:
            n += 1
        else:
            n = 0
        ans = max(ans, n)
    print(ans)

input = lambda: stdin.readline()[:-1]
main()


Measured memory_bytes: 14224
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int R;cin >> R;

    if (R < 1200){
        cout << "ABC" << endl;
        return 0;
    } else if (R < 2800) {
        cout << "ARC" << endl;
        return 0;
    } else {
        cout << "AGC" << endl;
        return 0;
    }
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
k = ni()
x = ni()
y = ni()

print(x*min(n, k) + y*max(0, n-k))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main() 
{
int n,m,x;
cin>>n>>m>>x;
int arr[n][m+1];

for(int i=0;i<n;i++)
{
          for(int j=0;j<=m;j++)
          {
                    cin>>arr[i][j];
          }
}
int cost=INT_MAX;
for(int it=0;it<(1<<n);it++)
{     vector<int>dp(m+1,0);
      int temp=0;
          for(int i=0;i<n;i++)
          {
                    if((it&(1<<i))==0) continue;
                     
                     for(int j=1;j<=m;j++)
                     {
                         dp[j]+=arr[i][j];      
                     }
                     temp+=arr[i][0];
                     
          }
          bool ch=1;
          for(int j=1;j<=m;j++)
          {
                    if(dp[j]<x) ch=0;
          }
          if(ch==1)
          {
                    cost=min(cost,temp);
          }
}
if(cost==INT_MAX)
{
          cout<<-1<<"\n";
}
else
{
          cout<<cost<<"\n";
}
}


Measured memory_bytes: 3680
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		
		if(s.length()%2 != 0)
		{
			System.out.println("No");
			return;
		}
			
		for(int i = 0; i < s.length(); i++)
		{
			if(i%2 == 0)
			{
				if(s.charAt(i) != 'h')
				{
					System.out.println("No");
					return;
				}
			}
			else
			{
				if(s.charAt(i) != 'i')
				{
					System.out.println("No");
					return;
				}
			}
		}
		System.out.println("Yes");

	}

}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace  std ;
#define       sf scanf
#define      pf printf
#define   pb push_back
#define   mp make_pair
typedef long long  ll;
const int MOD = 1e9+7;
const int   N = 1e6+7;
const ll  INF =  1e18;

#define nr()    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll ar[5000005],br[500005];

int main()
{
    nr();
    ll T, n, nb=0, r, a, b ,c;
    cin >> a >> b >> c;
    r=a+b+c;
    if(a==b && c!=a && c!=b) cout<<"Yes"<<endl;
    else if(b==c && a!=b && a!=c) cout<<"Yes"<<endl;
    else if (c==a && b!=c && b!=a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
   // main();
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	int r,c;
	while (cin >> r >> c) {
		if (r == 0 && c == 0) {
			break;
		}

		if (r % 2 == 1 && c % 2 == 1) {
			cout << "no" << endl;
		}
		else {
			cout << "yes" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int main(){
        int n; cin >> n;
        long long int a[n];
        int zero = 0;
        for (int x = 0; x < n; ++x){
            cin >> a[x];
            if (a[x] == 0){
                zero++;
            }
        }
        if (zero > 0){
            cout << 0 << endl;
            return 0;
        }
        long long int prod = 1;
        for (int x = 0; x < n; ++x){
            if (a[x] <= 1000000000000000000/prod){
                prod *= a[x];
            }
            else{
                cout << -1 << endl;
                return 0;
            }
        }
        cout << prod << endl;
    return 0;
}



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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int ns = 0;
  int nt = 0;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'S') {
      ++ns;
    } else {
      if (ns) {
        --ns;
      } else {
        ++nt;
      }
    }
  }
  cout << nt * 2 << endl;
  return 0;
}



Measured memory_bytes: 720
#include<stdio.h>
int main()
{
    long long int s,c;
    while(scanf("%lld %lld",&s,&c)!=EOF)
    {
        long long int max;
        if(c<=2*s)
            max=c/2;
        else
            max=(2*s+c)/4;
        printf("%lld\n",max);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   ios_base::sync_with_stdio(0);
    cin.tie(0);
    char ch;
    cin >> ch;
    if(ch-'A'<=27)
    {
        cout << "A" <<endl;
    }
    else
    {
        cout << "a" <<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int A[] = new int[N];
		long step = 0;
		int max = 0;
		for(int i=0; i<N; i++) {
			A[i] = scan.nextInt();
		}

		max = A[0];
		for(int i=0; i<N; i++) {
			if(max <= A[i]) {
				max = A[i];
			}
			step += max - A[i];
		}
		System.out.println(step);
	}
}


Measured memory_bytes: 60500
//
//  main.c
//  abc060_b
//
//  Created by Ding Chao on 4/29/17.
//  Copyright © 2017 Ding Chao. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);
    int result = 0;
    for (int i = 0; i < B; i++) {
        int product = A * i; 
        int m = product % B;
        if (C == m) {
            result = 1;
            break;
        }
    }
    
    if (result) 
        printf("YES\n");
    else 
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(){

int a,b;
scanf("%d%d",&a,&b);

if(a>0 && b>0){ puts("Positive"); }
else if (a<=0 && 0<=b){ puts("Zero"); }
else if (a<0 && b<0)
{ 
  ((-a) - (-b) +1)%2==0 ? puts("Positive") : puts("Negative"); 
}

return 0;

}

Measured memory_bytes: 1608
a,b,c,d = map(int,input().split())
counter_1=0
counter_2=0
while c>0:
  c=c-b
  counter_1=counter_1+1 #counter_1は高橋の攻撃回数
while a>0:
  a=a-d
  counter_2=counter_2+1 #counter_2は青木の攻撃回数
if counter_2>=counter_1:
  print("Yes")
else:
  print("No")

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

#define FOR(i,a,b) for(i=a;i<=b;i++)
#define FOD(i,b,a) for(i=a;i>=b;i--)
#define pa pair<int,int>
#define fi first
#define se second
#define task "x"

typedef long long ll;
const ll M=1e6+1;
const ll N=1e4+1;
using namespace std;

ll i, j, n, ans = 0, x, y, z;
string s;

void input()
{
    cin >> x >> y >> z ;

}

void solve()
{
    if(x + y + z>=22) cout<<"bust";
    else cout<<"win";
}

int main()
{
  	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	if(fopen(task".inp","r"))
        {
 	  freopen(task".inp","r",stdin);
 	  freopen(task".out","w",stdout);
	}
	input();
	solve();

   return 0;
}



Measured memory_bytes: 3636
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(long long int i=a; i<n; i++)
#define rloop(i,a,n) for(long long int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcount(a)
#define mod 1000000007
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define stkll stack<ll>
#define qll queue<ll>
#define pqll priority_queue<ll>
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1;
    while(power>0)
    {
        if(power%2==1)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1)
    {
        return false;
    }
    if(n<=3)
    {
        return true;
    }
    if(n%2==0 || n%3==0)
    {
        return false;
    }
    for(ll i=5; (i*i)<=n; i+=6)
    {
        if(n%i==0 || n%(i+2)==0)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    return (a.second<b.second);
}
int main()
{
    FAST
    FO
    FI
    string s;
    IN s;
    ull n= s.length();
    int ans=0;
    loop(i,0,n/2)
    {
        if(s[i]!=s[n-1-i])
        {
            ans++;
        }
    }
    OUT ans;
    return 0;
}


Measured memory_bytes: 256
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))






def main():
    m = ii()
    count = 0
    csum = 0
    for i in range(m):
        d,c = mi()
        count+= d*c
        csum +=c
    
    ans = 0
    ans+= csum-1

    while count > 9:
        ans+=count//10
        tmp = count//10
        count %= 10
        count += tmp


    print(ans)

    
main()


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<deque>
using namespace std;
int main()
{
	int n;
	cin >> n;
	deque<int> a;
	int x;
	string mission;
	for (int i = 0; i < n; i++)
	{
		cin >> mission;
		if (mission[0]=='i')
		{
			cin >> x;
			a.push_front(x);
		}
		else if (mission[6] == 'F')
		{
			a.pop_front();
		}
		else if (mission[6] =='L' )
		{
			a.pop_back();
		}
		else
		{
			cin >> x;
			for (int s = 0; s < a.size(); s++)
			{
				if (a[s] == x)
				{
					a.erase(a.begin() + s); break;
				}
			}
		}

	}
	for (int i = 0; i < a.size(); i++)
	{
		cout << a[i];
		if (i != a.size() - 1)cout << " ";
	}cout << endl;

}

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

void test(vector<int> &a, int k){
	bool dp[k+1];
	memset(dp, 0, sizeof(dp));
	for(int i = 1; i < k + 1; i++){
		bool temp = 0;
		for(int j = 0; j < a.size(); j++){
			if(a[j]<=i){
				temp = temp||(!(dp[i-a[j]]));
			}
		}
		dp[i] = temp;
	}
	if(dp[k]){
		cout << "First";
	}
	else{
		cout << "Second";
	}
}

int main(){
	#ifndef ONLINE_JUDGE
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/input.txt", "r", stdin);
	freopen("/home/afzalrao/Desktop/Academics/2nd Year/3rd Sem/ESO207/CP/Text Files/output.txt", "w", stdout);
	#endif
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for(int i =0 ; i < n; i++){
		cin >> a[i];
	}
	test(a, k);
	return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;


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

    ll N,K,S;
    cin >> N >> K >> S;
    ll ans[N];

    for(ll i = 0; i < N;i++){
        if(i < K){
            ans[i] = S;
        }else if (S != 1){
            ans[i] = S-1;
        }else{
            ans[i] = S+1;
        }
    }

    for(ll i = 0; i < N;i++){
        cout << ans[i] <<  " ";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define SIZE 12
typedef long long int ll;
typedef pair<int,int> P;
char str[SIZE];
int main(){
    scanf("%s",&str);
    int n=strlen(str);
    ll ret=0;
    for(int S=0;S<1<<(n-1);S++){
        ll now=0;
        ll sum=0;
        for(int i=0;i<n;i++){
            now*=10LL;
            now+=str[i]-'0';
            if(i<n-1&&(S>>i&1)){
                sum+=now;
                now=0;
            }
        }
        sum+=now;
        ret+=sum;
    }
    printf("%lld\n",ret);
    return 0;
}

Measured memory_bytes: 3824
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 

const ll inf=1e18+1e17;
const ll mod =1e9+7;
using cd= complex < double > ;
//const ll mod = 998244353;
ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=	(a*a)%mod;b>>=1;}return (res%mod);}
const ll N = 1e6 +5;


void solve(){
string s;
cin>>s;
int val=0;
for ( int i=0;i<s.len();i++){
	val+=s[i]-'0';

}
if ( val%9==0)
cout<<"Yes\n";
else
cout<<"No\n";
}






int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){

    	solve();
    }
}


Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
// http://drken1215.hatenablog.com/entry/2019/01/14/033200
int main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(N);
    vector<int> B(M);
    REP(i, N) { cin >> A[i]; }
    REP(i, M) { cin >> B[i]; }
    A.push_back(0);
    B.push_back(0);
    // N行M列
    //重複がない
    sort(A.begin(), A.end(), greater<int>());
    sort(B.begin(), B.end(), greater<int>());
    ll res = 1;
    // A, B でXより大きいのが何個有るのか
    int biggerX_a = 0;
    int biggerX_b = 0;
    // 各マスに何が入りうるのかを考える
    // 各数字がどこのマスに入りうるのかを考える
    if(A[0] > N * M) {
        cout << 0 << endl;
        return 0;
    }
    if(B[0] > N * M) {
        cout << 0 << endl;
        return 0;
    }
    for(int x = N * M; x >= 1; x--) {
        ll tmp = 1;
        if(A[biggerX_a] == x and B[biggerX_b] == x) {
            //一意にきまる
            tmp = 1;
            biggerX_a++;
            biggerX_b++;
        } else if(A[biggerX_a] == x) {
            tmp = biggerX_b;
            biggerX_a++;
        } else if(B[biggerX_b] == x) {
            tmp = biggerX_a;
            biggerX_b++;
        } else {
            tmp = biggerX_a * biggerX_b - (N * M - x);
            if(tmp < 0) {
                cout << 0 << endl;
                return 0;
            }
        }
        res = (res * tmp) % MOD;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n,k;
  cin >> n >> k;
  vector<int> p(n), c(n);
  rep(i,n) {cin >> p[i]; p[i]--;}
  rep(i,n) {cin >> c[i];}

  ll ans = -1e18;
  rep(si,n) {
    int x = si;
    vector<int> score;
    ll tot = 0;
    while (true)
    {
      x = p[x];
      tot += c[x];
      score.push_back(c[x]);
      if (x == si) break;
    }
    int l = score.size();
    ll t = 0;
    rep(i,l) {
      t += score[i];
      if (i+1 > k) break; 
      ll now = t;
      if (tot > 0) {
        ll e = (k-(i+1)) / l;
        now += tot*e;
      }
      ans = max(ans,now);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3680
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;


// 約数の列挙
vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            res.push_back(i);
            if (i != n / i) {
                res.push_back(n / i);
            }
        }
    }
    return res;
}

ll ketasuu(ll n){
  ll k = 1;
  while(n >= 10){
    n /= 10;
    k++;
  }
  return k;
}


int main(){
  ll ans = INF;
  ll N; cin>>N;
  ll a,b;
  for(ll i = 1; i * i <= N; i++){
    if(N % i == 0) {
      a = i;
      b = N/i;
      ans = min(max( ketasuu(a), ketasuu(b) ), ans );
    }
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pi 3.1416
///#define f(i,l,r) for(int i=l;i<=r;i++)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main()
{
    ll int i,j,k,sum=0,x,p,r,a,b,c=0;
   long double n=0.01;
    p=100;

cin>>a;

///for(i=100;i<=a;  i+=i/100){

    for(i=0;; i++)
    {
        if(p>=a)
            break;
        else
        {



            p=p+(p*n);
            ///cout<<n<<endl;

  c++;

        }


    }

    cout<<c<<endl;


    return 0;

}


Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdlib.h>
#include <string>
using namespace std;

int main() {
  string S;
  int N,counter;

  cin >> N >> S;
  for (int i = 0; i <= N-3; i++) {
    if (S[i] == 'A') {
      if (S[i + 1] == 'B') {
        if (S[i + 2] == 'C') {
          counter++;
        }
      }
    }
  }
  cout << counter << endl;
  return 0;
}


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

int main(){
  string str;
  cin >> str;
  int a[25] = {0};
  for(int i = 0;i< str.size(); i++){
  	a[str[i]-97]++;
  }
  for(int i = 0;i<25;i++){
    if(a[i] % 2 == 1){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes"<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
int main(void)
{
    int n;
    scanf("%d", &n);

    if(n == 7 || n == 5 || n == 3)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cstdlib>
using namespace std;
int r,D;
  int x[11];
int main(){
  cin>>r>>D;
  cin>>x[0];
  for(int i=0;i<10;i++){
    x[i+1]=r*x[i]-D;
  }
  for(int i=1;i<=10;i++){
    cout<<x[i]<<endl;
  }
}

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

#define REP(i, n) for(int i = 0; i != n; ++i)
#define REPR(i, n) for(int i = n - 1; i != -1; --i)
#define FOR(i, a, b) for(int i = a; i != b; ++i)
#define RBF(i, n) for(auto &i : n)
#define ABS(n) (n < 0 ? -n : n)
#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define IN(n) (cin >> n)
#define OUT(n) (cout << n << "\n")
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main() {
    int A, B;
    IN(A);
    IN(B);
    int a = A + B, b = A - B, c = A * B;
    if(a >= b && a >= c) OUT(a);
    else if(b >= a && b >= c) OUT(b);
    else if(c >= a && c >= b) OUT(c);
}

Measured memory_bytes: 256
s = input()
t = ""
for i in range(len(s)):
    if s[i] == "0":
        t += "0"
    elif s[i] == "1":
        t += "1"
    elif s[i] == "B":
        if len(t) != 0:
            k = list(t)
            del k[-1]

            t = ''.join(k)
            #t.pop(-1)
print(t)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{



 long long ans[4][4];

 for(long long i=0;i<3;i++)
 {
     for(long long j=0;j<3;j++)
     {
         long long k;
         cin>>ans[i][j];

     }
 }
 long long n;
 cin>>n;
vector<long long>sura;
for(long long j=0;j<n;j++)
{
    long long k;
    cin>>k;
    sura.push_back(k);
}
 bool hbe=false;
  for(long long i=0;i<3;i++)
 {
     long long an=0;
     for(long long j=0;j<3;j++)
     {
        for(long long k=0;k<n;k++)
        {
            if(ans[i][j]==sura[k])
                an++;
        }

     }
     if(an==3)
        hbe=true;
 }
  for(long long i=0;i<3;i++)
 { long long an=0;
     for(long long j=0;j<3;j++)
     {
      for(long long k=0;k<n;k++)
        {
            if(ans[j][i]==sura[k])
                an++;
        }

     }
     if(an==3)
        hbe=true;
 }
 long long y;
  for(long long i=0;i<3;i++)
 {
     for(long long j=0;j<3;j++)
     {
         if(i+j==2)
         {
              for(long long k=0;k<n;k++)
        {
            if(ans[i][j]==sura[k])
                y++;
        }
         }
     }

 }
 if(y==3)
    hbe=true;
    y=0;
 for(long long i=0;i<3;i++)
 {
           for(long long k=0;k<n;k++)
        {
            if(ans[i][i]==sura[k])
                y++;
        }
 }
 if(y==3)
    hbe=true;
 if(hbe)
    cout<<"Yes"<<endl;
 else
    cout<<"No"<<endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define nikal ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
    nikal;
    long long x,y=100,k=0;
    cin>>x;
    while(y<x)
    {
        y+=(y/100);
        k++;
    }
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    int sum = a + b + c;
    int max = a;
    if (max < b)
        max = b;
    if (max < c)
        max = c;
    sum -= max;
    printf("%d\n", 10 * max + sum);
    return 0;
}

Measured memory_bytes: 128
import sys
from math import sqrt
input = sys.stdin.readline
N = int(input())
e = []
for _ in range(N):
  x, y = map(int, input().split())
  e.append((x, y))
res = 0
for i in range(N):
  for j in range(N):
    u = e[i][0] + e[j][0]
    v = e[i][1] + e[j][1]
    px = 0
    py = 0
    for k in range(N):
      x, y = e[k]
      if u * x + v * y > 0:
        px += x
        py += y
    res = max(res, sqrt(px ** 2 + py ** 2))
print(res)

Measured memory_bytes: 42092
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String s = sc.next();
    String t = sc.next();
    int ans = 2*N;
    for (int i = 0; i < N; i++) {
      String ss = s.substring(i, N);
      String tt = t.substring(0, N-i);
      if (ss.equals(tt)) {
        ans -= N-i;
        break;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
    #define sz(a) (int)(a).size()
     
    using namespace std;
     
    template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
    template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
    const int INF = 2e5+2;
    const long long hell = 998244353ll;
    
    void solve(){
          int n;
          cin>>n;
          vector<int>arr(n);
          for(int i=0;i<n;i++){
           	cin>>arr[i];
          }
          bool bani = true;
          int cur_max=arr[0];
          for(int i=0;i<n;i++){
          	if(cur_max-arr[i]>=2) bani = false;
          	uax(cur_max,arr[i]);
          }
          if(bani){
          	cout<<"Yes"<<endl;
          }else{
                cout<<"No"<<endl;
          }
    }

    int main(){
    	
    	ios_base::sync_with_stdio(0);cin.tie(0);
    	
    	int q=1;
    #ifdef LOCAL
      	cin>>q;
#endif
	while(q--){
	 solve();
	}

    #ifdef LOCAL
        cout << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    #endif	
    	return 0;
    }

Measured memory_bytes: 640
program main
    implicit none
    integer n,m
    integer, allocatable, dimension(:) :: h, a, b, ex
    integer i,j,k,sum

    read(*,*) n, m
    allocate(h(n))
    allocate(a(m))
    allocate(b(m))
    allocate(ex(n))

    do i = 1,n
        ex(i) = 0
    end do

    read(*,*) h
    do i = 1,m
        read(*,*) a(i), b(i)
        if(h(a(i)) > h(b(i))) then
            ex(b(i)) = 1
        else if (h(a(i)) < h(b(i))) then
            ex(a(i)) = 1
        else if (h(a(i)) == h(b(i))) then
            ex(a(i)) = 1
            ex(b(i)) = 1
        end if
    end do

    sum = 0
    do i = 1,n
        sum = sum + ex(i)
    end do

    write(*,*) n-sum


end program

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

#define ll long long
#define endl "\n"
#define M 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    int count = 0;
    for(int i = 0; i < s.length(); i++)
    {
        if(s[i] != t[i])
            count++;
    }
    cout<<count;
}

Measured memory_bytes: 3696
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, -1, 0, 1};
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAX = 150;
const char board[2] = {'.', '#'};

int main() {
    int N;
    cin >> N;
    int dir = 0;
    string ans1, ans2;
    while (1) {
        string up = ans1, bottom = ans2;
        up += board[dir/2];
        bottom += board[dir%2];
        cout << up << endl;
        cout << bottom << endl;
        string input;
        cin >> input;
        if (input == "end") {
            return 0;
        } else if (input == "T") {
            ans1 = up;
            ans2 = bottom;
            dir = 0;
            continue;
        } else {
            dir++;
            if (dir == 4) {
                dir = 0;
                break;
            }
        }
    }
    while (1) {
        string up = board[dir/2]+ans1, bottom = board[dir%2] + ans2;
        cout << up << endl;
        cout << bottom << endl;
        string input;
        cin >> input;
        if (input == "end") return 0;
        else if (input == "T") {
            ans1 = up;
            ans2 = bottom;
            dir = 0;
            continue;
        } else {
            dir++;
            assert(dir < 4);
        }
    }
    return 0;
}

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

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

int main() {
    vector<int> v;
    REP(i, 28) {
        int j;
        cin >> j;
        v.push_back(j);
    }
    sort(v.begin(), v.end());
    For(i, 1, 31) {
        if (!binary_search(v.begin(), v.end(), i)) {
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1220
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}



int main() {

  long n;

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

  vector<long> count(ALPHABET, 1000);

  vector<vector<long>> stringCount(n, vector<long>(ALPHABET, 0));


  for (int i = 0; i < n; ++i) {
    for (auto v : s[i]) {
      stringCount[i][v - 'a']++;
    }
  }



  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < ALPHABET; j++) {
      count[j] = min(count[j], stringCount[i][j]);
    }
  }



  for (int i = 0; i < ALPHABET; ++i) {
    for(int j=0;j<count[i];j++){
      cout <<  (char)('a' + i)  ;
    }
  }



}




















Measured memory_bytes: 256