akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1);

int main(){
  int n;
  while(cin >> n && n != 0){
    int a, b, asum = 0, bsum = 0;
    for(int i = 0; i < n; i++){
      cin >> a >> b;
      if(a > b){
        asum += (a + b);
      }else if(a < b){
        bsum += (a + b);
      }else{
        asum += a;
        bsum += b;
      }
    }
    cout << asum << " " << bsum << endl;
  }
}

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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0; 
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];
    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

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


    ll N = S.size();

    string RS = S;
    reverse(ALL(RS));
    ll cc=1;

    for(ll i=0;i<N;i++){
        if(RS[i]!=S[i]){
            cc=0;
            break;
        }
    }

    
    for(ll i=0;i<=((N-1)/2)-1;i++){
        if(S[i]!=S[((N-1)/2)-1-i]){
           cc=0;
        }
    }

     for(ll i=((N+3)/2)-1;i<=N-1;i++){
        if(S[i]!=S[N-1-i]){
           cc=0;
        }
    }

    if(cc==0){
        cout<<"No"<<endl;
    }
    else{
        cout<<"Yes"<<endl;
    }








}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
vector<int> G[5005];
P siz[5005];
int parent[5005];
ll fact[5005];

P dfs(int v,int p){
	P val=P(1,0);
	parent[v]=p;
	for(int i=0;i<G[v].size();i++){
		int nv=G[v][i];
		if(nv==p)continue;
		P tmp=dfs(G[v][i],v);
		val.first+=tmp.first;
		val.second=max(val.second,tmp.first);
	}
	val.second=max(val.second,n-val.first);
	return siz[v]=val;
}

ll extgcd(ll a,ll b,ll& x,ll& y){
	ll d=a;
	if(b!=0LL){
		d=extgcd(b,a%b,y,x);
		y-=(a/b)*x;
	}else{
		x=1;
		y=0;
	}
	return d;
}

ll mod_inverse(ll a,ll m){
	ll x,y;
	extgcd(a,m,x,y);
	return (m+x%m)%m;
}
ll mod_fact(ll n,ll p,ll& e){
	e=0;
	if(n==0)return 1;
	ll res=mod_fact(n/p,p,e);
	e+=n/p;
	if(n/p%2!=0){
		return res*(p-fact[n%p])%p;
	}
	return res*fact[n%p]%p;
}

ll mod_comb(ll n,ll k,ll p){
	if(n<0 || k<0 || n<k)return 0;
	ll e1,e2,e3;
	ll a1=mod_fact(n,p,e1),a2=mod_fact(k,p,e2),a3=mod_fact(n-k,p,e3);
	if(e1>e2+e3)return 0;
	return a1*mod_inverse(a2*a3%p,p)%p;
}

ll dp[5005][5005];
ll comb[5005][5005];

int main(void){
	fact[0]=1;
	comb[0][0]=1;
	for(int i=1;i<=5000;i++){
		for(int j=1;j<i;j++){
			comb[i][j]=(comb[i-1][j]+comb[i-1][j-1])%MOD;
		}
		comb[i][0]=1;
		comb[i][i]=1;
	}
	for(int i=1;i<=5000;i++){
		fact[i]=(ll)fact[i-1]*i%MOD;
	}
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(0,-1);
	int bs=0,cnt=1;
	for(int i=1;i<n;i++){
		if(siz[bs].second>siz[i].second){
			cnt=0;
			bs=i;
		}
		if(siz[bs].second==siz[i].second){
			cnt++;
		}
	}
	if(cnt==2){
		printf("%lld\n",fact[n/2]*fact[n/2]%MOD);
		return 0;
	}

	vector<int> vec;
	for(int i=0;i<G[bs].size();i++){
		int nv=G[bs][i];
		if(nv==parent[bs])continue;
		vec.push_back(siz[nv].first);
	}
	if(parent[bs]!=-1){
		vec.push_back(n-siz[bs].first);
	}
	dp[0][0]=1;
	int sum=0;
	for(int i=0;i<vec.size();i++){
		//printf("%d\n",vec[i]);
		int v=vec[i];
		for(int j=0;j<=sum;j++){
			for(int k=0;k<=v;k++){
				ll val=comb[v][k]*comb[v][k]%MOD*fact[k]%MOD;
				dp[i+1][j+k]+=dp[i][j]*val%MOD;
				dp[i+1][j+k]%=MOD;
			}
		}
		sum+=v;
	}
	ll ans=0;
	for(int i=0;i<=n;i++){
		ll val=dp[vec.size()][i];
		val=val*fact[n-i]%MOD;
		if(i%2==1)val=-val;
		ans+=val;
		if(ans<0)ans+=MOD;
		ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 385152
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	ll n;
	cin >> n;
	auto l = vector<ll>(n,0);
	for(int i =0;i<n;i++){
		cin >>l[i];
	}
	sort(l.begin(),l.end());
	ll ans = 0;
	for(int i =l.size()-1;i>=0;i--){
		for(int j=i-1;j>=0;j--){
			auto k = upper_bound(l.begin(),l.begin()+j,abs(l[i]-l[j]));
          	ans+=j-(k-l.begin());
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

char w[5][5];
char b[128], *p;
char i,j;

void F(int v){
  scanf("%s",b);
  for(p=b; *p; p++){
    w[p-b+1-v][j+v]|=((w[p-b][j]|=(*p==49)<<3-v)&8>>v)>>2;
  }
  j+=v;
}
  
main(){
  
  for (;F(0),j-4;F(1));
  
  
  for(i=j=(*b=3)^3;i+="BABC"[*b]-66,j+="ABCB"[*b]-66,putchar("ULDR"[*b]),i+j;)
    for((*b+=1)&=~4;!(w[i][j]&(1<<*b)); (*b+=3)&=~4);
  return !puts("");
  
}


Measured memory_bytes: 2572
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, m int
	var k int64
	fmt.Fscan(r, &n, &m, &k)
	a := make([]int64, n+1)
	b := make([]int64, m+1)
	for i := 0; i < n; i++ {
		var tmp int64
		fmt.Fscan(r, &tmp)
		a[i+1] = a[i] + tmp
	}
	for i := 0; i < m; i++ {
		var tmp int64
		fmt.Fscan(r, &tmp)
		b[i+1] = b[i] + tmp
	}
	var ans int
	j := m
	for i := 0; i <= n; i++ {
		if a[i] > k {
			break
		}
		for a[i]+b[j] > k {
			j--
		}
		if i+j > ans {
			ans = i + j
		}
	}
	fmt.Println(ans)
}

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

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a.at(i));
    }
    reverse(a.begin(), a.end());
    for (int i = 0; i < n; i++) {
        if (i != n-1) {
            printf("%d ", a.at(i));
        } else {
            printf("%d\n", a.at(i));
        }
    }
}


Measured memory_bytes: 3212
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<long,long>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}
int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n);
    bool zf=false;
    for(ll i=0;i<n;i++){
        cin >> a[i];
        if(a[i]!=0){
            zf=true;
        }
    }

    for(ll j=0;j<k;j++){
        vector<ll> sim(n,0);
        for(ll i=0;i<n;i++){
            if(i-a[i]<0){
                sim[0]++;
            }else{
                sim[i-a[i]]++;
            }
            if(i+a[i]>n-2){
            }else{
                sim[i+a[i]+1]--;
            }

            
        }
        bool flg=true;
        a[0]=sim[0];
        if(a[0]!=n) flg=false;
        for(ll i=1;i<n;i++){
                a[i]=a[i-1]+sim[i];
                if(a[i]!=n) flg=false;
        }
        if(flg){
            for( ll i=0;i<n;i++){
                cout << n << " ";
            }
            cout << endl;
            return 0;
        }
    }
    for(ll i=0;i<n;i++){
        cout << a[i] << " ";
    }
    cout << endl;

}

Measured memory_bytes: 6428
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import combinations_with_replacement
def main():
    n, m, q = map(int, input().split())
    abcd = []
    for _ in range(q):
        q = tuple(map(int, input().split()))
        abcd.append(q)
    c1 = tuple(combinations_with_replacement(range(1,m+1), n))
    r = 0
    for ce in c1:
        t = 0
        for qe in abcd:
            a, b, c, d = qe
            a -= 1
            b -= 1
            if ce[b] - ce[a] == c:
                t += d
        r = max(r, t)
    print(r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 21780
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s;	cin>>s;
	int sum=0;
	for(int i=0;i<s.size()/2;i++)
		if(s[i]!=s[s.size()-i-1])
			sum++;
	cout<<sum<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long N;
    cin>>N;
    long long A[100010];
    long long counter=0;
    long long b=1000000010;
    long long sum=0;
    for(long long i=0; i<N; i++){
        long long a;
        cin>>a;
        if(a<0) counter++;
        b=min(b,abs(a));
        sum+=abs(a);
        A[i]=a;
    }
    if(counter%2==0) cout<<sum<<endl;
    else cout<<sum-2*b<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
#define rep(i,s,n) for(ll i = (ll)(s); i < (ll)(n); i++)
#define all(a) (a).begin(),a.end()
using namespace std;
using graph =vector<vector<ll>>;
/*階乗*/
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

/* ユークリッドの互除法 最大公約数*/
ll gcd(ll a, ll b) {
	ll r;
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}



/*最小公倍数*/

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


/*二点間の距離*/
double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}
/*
ll solve(ll i,ll m,vector<ll>t,ll n){
    if(m==0){
        return 1;
    }
    if(i>=n){
        return 0;
    }
    
    
    cout<<i+1<<" "<<m<<endl;
    cout<<i+1<<" "<<m-t[i]<<endl;
    ll res=solve(i+1,m,t,n)||solve(i+1,m-t[i],t,n);
    return res;
}
*/

//小数点12桁
struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    string s;
    ll q,count=0;
    cin>>s>>q;
    vector<ll>t(q,0);
    deque<char>dq;
    rep(i,0,s.size()){
        dq.push_back(s[i]);
    }
    rep(i,0,q){
        cin>>t[i];
        if(t[i]==2){
            char c;
            ll a;
            cin>>a>>c;
            if(a==1){
                if(count%2==0){
                    dq.push_front(c);
                }
                else{
                    dq.push_back(c);
                }
            }
            else{
                if(count%2==0){
                    dq.push_back(c);
                }
                else{
                    dq.push_front(c);
                }
            }
        }
        else{
            count++;

        }
        
    }
    if(count%2==1){
        reverse(all(dq));
    }
    rep(i,0,dq.size()){
        cout<<dq[i];
    }
    
    
    cout<<endl;
    
        
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
ll modpow(ll b, ll e ,ll mod) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}


int32_t main(){
	int k;
	string s;
	cin >> k >> s;	
	if(sz(s) <= k) cout << s << endl;
	else{
		string p;
		for(int i = 0 ; i < k ; i ++) p.push_back(s[i]);
		p.push_back('.');p.push_back('.');p.push_back('.');
	cout << p << endl;
	}
}
	  // clever stuff:
  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M? io?  
  // overflow? ll x int



Measured memory_bytes: 3632
<?php
class Dice{
  public $label=[1,2,3,4,5,6];#index+1????????¢?????????
  public $pos=[0,1,2];#?????¢,?????¢,??\??¢???index ???????????¢???5-index
  function __construct($sLabel){
    $this->label=explode(' ',$sLabel,6);
  }
  function move($s){
    $x=$this->pos[0];
    if($s=='E'){
      $this->pos[0]=5-$this->pos[2];
      $this->pos[2]=$x;
    }
    elseif($s=='W'){
      $this->pos[0]=$this->pos[2];
      $this->pos[2]=5-$x;
    }
    elseif($s=='N'){
      $this->pos[0]=$this->pos[1];
      $this->pos[1]=5-$x;
    }
    elseif($s=='S'){
      $this->pos[0]=5-$this->pos[1];
      $this->pos[1]=$x;
    }
  }
  function top(){
    return $this->label[$this->pos[0]];
  }
}

$dice=new Dice(trim(fgets(STDIN)));
foreach(str_split(trim(fgets(STDIN))) as $m) $dice->move($m);
echo $dice->top();
?>

Measured memory_bytes: 15524
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;


void run_case() {
    string s;
    int q;
    cin >> s >> q;
    vector<char> store[2];
    int sta = 0;
    while(q--) {
        int type;
        cin >> type;
        if(type == 1) sta = !sta;
        else {
            static int pos;
            static char ch;
            cin >> pos >> ch;
            pos--;
            store[pos^sta].push_back(ch);
        }
    }
    string ans;
    for(auto i = store[0].rbegin(); i != store[0].rend(); i++) ans += *i;
    ans += s;
    for(auto ch: store[1]) ans += ch;
    if(sta) reverse(ans.begin(), ans.end());
    cout << ans;
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

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

using namespace std;

vector<int>adj[100000];
bool vis[100000];

void dfs(int u){
    if(!vis[u]){
        vis[u] = true;
        for(int& v: adj[u]){
            dfs(v);
        }
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 0;i < m;i++){
        int u,v;
        cin >> u >> v;
        u--;
        v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int c = -1;
    for(int i = 0;i < n;i++){
        if(!vis[i]){
            c++;
            dfs(i);
        }
    }
    cout << c << endl;
}


Measured memory_bytes: 9672
<?php
fscanf(STDIN, "%d", $n);
$line = fgets(STDIN);
$arr = explode(" ", $line);
$flag = 0;
foreach($arr as $v){
    if (($v % 2) == 1 && $flag == 0) {
        $flag = 1;
    } else if (($v % 2) == 1 && $flag == 1) {
        $flag = 0;
    }
}

if ($flag) {
    echo "NO";
} else {
    echo "YES";
}

Measured memory_bytes: 22264
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b,c;
  string S;
  cin >> S;
  if( S.at(0)!=S.at(1) && S.at(1)!=S.at(2) && S.at(2)!=S.at(0) ){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}

Measured memory_bytes: 256
def diff(i, j):
    return abs(a[i] - a[j])
    
n = int(input())
a = list(map(int, input().split()))

dp = [-1] * n
dp[0], dp[1] = 0, abs(a[1]-a[0])

for i in range(2, n):
    dp[i] = min(dp[i-1] + diff(i, i-1), dp[i-2] + diff(i, i-2))
    
print(dp[-1])


Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int INF = 1e9+10;
int main()
{
    int n, x;
    cin >> n >> x;
    n = 2 * n - 1;
    if(x == 1 || x == n)
    {
        cout << "No" << endl;
        return 0;
    }
    else cout << "Yes" << endl;
    if(n == 3)
    {
        cout << 1 << endl;
        cout << 2 << endl;
        cout << 3 << endl;
        return 0;
    }
    set<int> s;
    for(int i = 1; i <= n; i++) s.insert(i);
    if(x == n-1)
    {
        s.erase(x);
        s.erase(x+1);
        s.erase(x-1);
        s.erase(x-2);
        for(int i = 0; i < n/2-2; i++)
        {
            cout << *s.begin() << endl;
            s.erase(s.begin());
        }
        cout << x-2 << endl;
        cout << x+1 << endl;
        cout << x << endl;
        cout << x-1 << endl;
        while(!s.empty())
        {
            cout << *s.begin() << endl;
            s.erase(s.begin());
        }
    }
    else
    {
        s.erase(x);
        s.erase(x-1);
        s.erase(x+1);
        s.erase(x+2);
        for(int i = 0; i < n/2-2; i++)
        {
            cout << *s.begin() << endl;
            s.erase(s.begin());
        }
        cout << x+2 << endl;
        cout << x-1 << endl;
        cout << x << endl;
        cout << x+1 << endl;
        while(!s.empty())
        {
            cout << *s.begin() << endl;
            s.erase(s.begin());
        }
    }
}


Measured memory_bytes: 12920
K = int(input())
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[K-1])


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

    long long H;
    short m;
    cin >> H;

    for(short i=0; i<50; i++){
        if(pow(2, i)<=H && H<pow(2, i+1)){
            m = i;
            break;
        }
    }
    
    long long ans = pow(2, m+1) - 1;

    cout << ans << endl; 

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
     
    int main(){
      int N;
      cin>>N;
      vector<vector<int>> G(N);
      vector<pair<int,int>> vp;
      for(int i=1;i<N;i++){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a,b);
      }
     
      int K=0;
      map<pair<int,int>,int> I;
      vector<int> cs(N,0); // color of edge between its parent
     
      vector<int> used(N,0);
      queue<int> que;
      used[0]=1;
      que.emplace(0);
      while(!que.empty()){
        int v=que.front();que.pop();
        if(K<(int)G[v].size()) K=G[v].size();
        int cur=1;
        for(int u:G[v]){
          if(used[u]) continue;
          if(cur==cs[v]) cur++;
          cs[u]=I[make_pair(u,v)]=I[make_pair(v,u)]=cur++;
          used[u]=1;
          que.emplace(u);
        }
      }
     
      cout<<K<<endl;
      for(auto p:vp) cout<<I[p]<<endl;
      return 0;
    }

Measured memory_bytes: 22864
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

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

  for(auto& c: s){
    if(c == '1') c = '9';
    else c = '1';
  }

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = input().split(" ")
for i in range(n):
    a[i] = int(a[i])
a.sort()
ans_bef = max(a)
ans_aft = a[0]
med = ans_bef/2
for i in range(1, n-1):
    if abs(med-a[i]) < abs(med-ans_aft):
        ans_aft = a[i]
print(ans_bef, ans_aft)

Measured memory_bytes: 11232
#include <iostream>

using namespace std ;
int main() {
	int n, c;
	string s ;
	cin >> n >> s ;
	c = 0 ;
	
	for ( int i = 0 ; i < n ; i++ )
	{
		
		if ( i <= n - 3 && s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C' ) c++ ;
		
	}
	
	cout << c ;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iostream>
#define ios   ios_base::sync_with_stdio(false);  cin.tie(0);    cout.tie(0);
typedef long long int ll;
typedef long double  ld;
using namespace std;
const int M=1e9+7;
int main()
{
   string s;cin>>s;
   if(s[2]==s[3] && s[4]==s[5])
   cout<<"Yes";
   else
   cout<<"No";
}


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

 int N,M;
 int num_visited = 0;
 bool is_bridge = false;
vector<vector<int>> G,G_;
vector<int>  visited(50,0);
int ans=0;

void dfs ( int now ){
 visited [ now ] = 1;

 for ( int i =0; i < G [ now ]. size (); i ++){
 int next = G [ now ][ i ];
 if (! visited [ next ]) dfs ( next );
 }
 }

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

G = vector<vector<int>>(50);
vector<vector<int>> g(50 ,vector<int>(2));

for(int i=0;i<M;i++){
int a,b;
cin >> a >> b;
a--;b--;
G[a].push_back(b);
G[b].push_back(a);

g[i][0]=a;
g[i][1]=b;
}
G_=G;

for(int i=0;i<M;i++){
    auto  line_iter = find(G[g[i][0]].begin(),G[g[i][0]].end(),g[i][1]); 
    G[g[i][0]].erase(line_iter); 

    line_iter = find(G[g[i][1]].begin(),G[g[i][1]].end(),g[i][0]);
    G[g[i][1]].erase(line_iter); 
    
    for(int j=0;j<N;j++)visited[j]=false;
    is_bridge = false;
    dfs(1);
    for(int j=0;j<N;j++)if(visited[j]==false)is_bridge = true;
    if(is_bridge)ans ++;
    
    G=G_;
}


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


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub 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")
}

use std::cmp::max;
use std::cmp::Ordering;

fn main() {
    let n: usize = read();
    let mut k: usize = read();
    let mut vec: Vec<(i64, i64)> = vec![];
    for _ in 0..n {
        let a: i64 = read();
        let b: i64 = read();
        vec.push((a, b))
    }
    vec.sort_by(|a, b| {
        if a.0 > b.0 {
            return Ordering::Greater;
        } else {
            if a.0 == b.0 {
                return Ordering::Equal;
            }
            return Ordering::Less;
        }
    });

    for i in 0..n {
        let vi = vec[i];
        if k <= vi.1 as usize {
            println!("{}", vi.0);
            return;
        }
        k -= vi.1 as usize;
    }
}

Measured memory_bytes: 6396
#include <iostream>

using namespace std;

int main(){
    int N;
    int idx[200000];
    cin >> N;
    for(int i = 0; i < N; i++){
        int P;
        cin >> P;
        idx[P-1] = i;
    }
    
    int tmp_idx = idx[0];
    int max_cnt = 1;
    int cnt = 1;
    for(int i = 1; i < N; i++){
        if(tmp_idx > idx[i]){
            max_cnt = max(max_cnt, cnt);
            cnt = 1;
            tmp_idx = idx[i];
        }else{
            cnt++;
            tmp_idx = idx[i];
        }
    }
    max_cnt = max(max_cnt, cnt);
    cout << N - max_cnt << endl;
}

Measured memory_bytes: 1024
use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        s: Chars
    };

    let mut s: Vec<char> = s;

    s[k - 1] = s[k - 1].to_lowercase().next().unwrap();

    for i in s.iter() {
        print!("{}", i);
    }
}


Measured memory_bytes: 2196
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

const ll MOD = 1000000007;
const ll INF = 1 << 30;
const ll INF2 = 9000000000000000000LL;
const double INF3 = 900000000000000;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define sc second


int main() {
	int ans = 0;
	string s;
	cin >> s;
	while (true) {
		if (s[0] == s[s.size() - 1]) {
			if (s.size() > 2) {
				s = s.substr(1, s.size() - 2);
			}
			else {
				break;
			}
		}
		else {
			if (s[0] == 'x'&&s[s.size() - 1] != 'x') {
				ans++;
				s += 'x';
			}
			else if (s[0] != 'x'&&s[s.size() - 1] == 'x') {
				ans++;
				s = 'x' + s;
			}
			else {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
a=int(input())
b=list(map(int,input().split()))
b=[0]+b+[0]
s=0
for i in range(1,a+2):
    s=s+abs(b[i]-b[i-1])
for j in range(1,a+1):
    print(s+abs(b[j+1]-b[j-1])-abs(b[j]-b[j-1])-abs(b[j+1]-b[j]))

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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;}

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int k; cin >> k;
    char x = s[k-1];
    REP(i, 0, n){
        if(s[i] != x){
            s[i] = '*';
        }else{
            continue;
        }
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let n = get();
    let c: i64 = get();
    let k: i64 = get();
    let mut t: Vec<i64> = (0 .. n).map(|_| get()).collect();
    t.sort();
    let mut que = Vec::new();
    let mut cnt = 0;
    for &v in t.iter() {
        let first = if que.len() == 0 { 1 << 50 } else { que[0] };
        if que.len() as i64 >= c || first + k < v {
            que.clear();
            cnt += 1;
        }
        que.push(v);
    }
    if !que.is_empty() {
        cnt += 1;
    }
    println!("{}", cnt);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;string S;
    cin >> N >> S;
    ll mi = 0,le = 0;
    ll cnt = 0;
    rep(i,N){
        if(S[i] == ')')cnt++;
        else cnt--;
        chmax(mi,cnt);
    }
    cnt = 0;
    for(ll i = N - 1;i >= 0;i--){
        if(S[i] == '(')cnt++;
        else cnt--;
        chmax(le,cnt);
    }
    rep(i,mi){
        S = '(' + S;
    }
    rep(I,le){
        S += ')';
    }
    cout << S << "\n";
}

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

using namespace std;
typedef long long ll;

int main() {
  ll x;
  cin >> x;
  ll cur = 100;
  int ans = 0;
  while (cur < x) {
    cur += (cur * 0.01);
    ans++;
  }

  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 3644
def resolve():
    N, M = list(map(int, input().split()))
    swi = []
    for i in range(M):
        k, *ss = list(map(int, input().split()))
        t = 0
        for s in ss:
            t += 1 << (s-1)
        swi.append(t)

    ps = list(map(int, input().split()))
    ans = 0
    for i in range(1 << N):
        for s, p in zip(swi, ps):
            t = i & s
            c = bin(t).count('1') % 2
            if c != p:
                break
        else:
            ans += 1
    print(ans)
    return

resolve()

Measured memory_bytes: 9212
d,g = gets.chomp.split(" ").map(&:to_i)
g /= 100
p = d.times.map{gets.chomp.split(" ").map(&:to_i)}
ans = 10**8
state = Array.new(d,true)

for i in 0..2**d-1
  score = 0
  ac = 0
  d.times do |j|
    if i&(2**j) != 0
      score += p[j][0]*(j+1)+p[j][1]/100
      ac += p[j][0]
      state[j] = true
    else
      state[j] = false
    end
  end
  if score < g
    k = state.rindex(false)
    if k && g-score <= p[k][0]*(k+1)
      ans = ans < ac+(g-score+k)/(k+1) ? ans : ac+(g-score+k)/(k+1)
    end
  else
    ans = ans < ac ? ans : ac
  end
end
p ans

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll a,b,c,d,kk,pk;
     cin>>a>>b>>c>>d;
     kk=ceil(c/(b*1.0));
     pk=ceil(a/(d*1.0));
     //cout<<kk<<" "<<pk<<endl;
     if(kk<=pk)
        cout<<"Yes"<<endl;
     else
        cout<<"No"<<endl;
}



Measured memory_bytes: 3744
import java.util.Scanner;

class Main {

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

        int n = sc.nextInt();
        int[] a = new int[n];
        int[] color = {0, 0, 0, 0, 0, 0, 0, 0, 0};
        int min = 0;
        int max = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            if (1 <= a[i] && a[i] <= 399) {
                color[0]++;
            } else if (400 <= a[i] && a[i] <= 799) {
                color[1]++;
            } else if (800 <= a[i] && a[i] <= 1199) {
                color[2]++;
            } else if (1200 <= a[i] && a[i] <= 1599) {
                color[3]++;
            } else if (1600 <= a[i] && a[i] <= 1999) {
                color[4]++;
            } else if (2000 <= a[i] && a[i] <= 2399) {
                color[5]++;
            } else if (2400 <= a[i] && a[i] <= 2799) {
                color[6]++;
            } else if (2800 <= a[i] && a[i] <= 3199) {
                color[7]++;
            } else if (3200 <= a[i]) {
                color[8]++;
            }
        }
        for (int i = 0; i < 8; i++) {
            if (color[i] != 0) {
                min++;
            }
        }

        if (min == 0) {
            min = 1;
            max = color[8];
        } else {
            max = min + color[8];
        }
        System.out.print(min);
        System.out.print(" ");
        System.out.println(max);
    }
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;

inline int read()
{
	int sum=0,ff=1; char ch=getchar();
	while(!isdigit(ch))
	{
		if(ch=='-') ff=-1;
		ch=getchar();
	}
	while(isdigit(ch))
		sum=sum*10+(ch^48),ch=getchar();
	return sum*ff;
}

const int N=2005;

int n,m,f[N][N],ans;

struct Node
{
	int x,id;
	inline bool friend operator < (const Node&a,const Node&b)
	{
		return a.x>b.x;
	}
};
Node a[N];

inline int dp(int x,int l,int r)
{
	if(r<l) return a[x].x;
	if(~f[l][r]) return f[l][r];
	int L=dp(x+1,l+1,r)+a[x].x*abs(a[x].id-l);
	int R=dp(x+1,l,r-1)+a[x].x*abs(a[x].id-r);
//	cout<<x<<" "<<l<<" "<<r<<" "<<L<<" "<<R<<endl;
	f[l][r]=max(f[l][r],max(L,R));
	return f[l][r];
}

signed main()
{
	n=read();
	for ( int i=1;i<=n;i++ ) 
		a[i]=(Node){read(),i};
	sort(a+1,a+n+1);
	memset(f,-1,sizeof(f));
	ans=dp(1,1,n);
	printf("%lld\n",ans);
	return 0;
}
			


Measured memory_bytes: 35360
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

string S, T;
int T_len;

void input(void){
	cin >> S >> T;
	T_len = T.length();
}

int change(int idx){
	int res = 0;
	for (int i = 0; i < T_len; ++i)
		if (S[idx + i] != T[i])
			++res;
	return res;
}

int main(void){
	input();
	int ans = 2000;
	for (int i = 0; i < S.length() - T_len + 1; ++i)
		ans = min(ans, change(i));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, i = 0, j = 1, cnt = 1;

	cin >> n;
	vector<string> s(n);

	for (int i = 0; i < n; i++) {
		cin >> s.at(i);
	}
	sort(s.begin(), s.end());

	while (i < n - 1 && j < n) {
		if (s.at(j) == s.at(i)) {
			j++;
		} else {
			i = j;
            j = i + 1;
			cnt++;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 9532
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n,k = readInts()
    res = 0
    # 1 ~ n まで、表がでる確率としてn_回必要であると考える
    # 成功率から(1/2)^nとなる
    # それを v = 1,2...nまで合計すれば大丈夫
    for n_ in range(1,n+1):
        tmp = 1.0
        n2 = n_
        while n2 < k:
            n2 *= 2
            tmp /= 2.0
        res += tmp
    print("%.010f"%(res/n))
if __name__ == '__main__':
  main()


Measured memory_bytes: 3060
inp  = [int(i) for i in input().split()]
k = inp[0]
a = inp[1]
b = inp[2]
k_ = (k - a + 1)//2
if b - a < 2:
    print(1 + k)
else:
    if (k - a + 1) % 2 == 0:
        print(a + (b - a) * k_)
    else:
        print(a + (b - a) * k_ + 1)

Measured memory_bytes: 3060
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n;
    int arr[n];

    unordered_map<int , int> m;
    for(int i=0;i<n;i++){
      cin>>arr[i];
      sum += arr[i];
      m[arr[i]]++;
    }

    int q ; cin>>q;

    while(q--){

        cin>>b>>c;

        int b_occ = m[b];

        // db(b_occ);

        sum += (c - b)*b_occ;
        m[b] = 0;
        m[c] += b_occ;

        cout<<sum<<endl;

    } 
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


Measured memory_bytes: 7740
#include <bits/stdc++.h>
using namespace std;
#define ft first
#define sd second
using ll = long long;
const int INF = 1e9+7;
const int EPS = -1e6;
const int maxn = 100000+5;
inline void fastio() {ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);}

inline bool isAGCT(char ch){
    return ch == 'A' || ch == 'G' || ch == 'C' || ch == 'T';
}

int main(){
    //freopen("input.txt", "r", stdin);
    fastio();

    string s;
    cin>>s;
    int ans = 0, t = 0;
    for(int i = 0; i < (int)s.size(); ++i){
        if(isAGCT(s[i])){
            t++;
        }else{
            ans = max(ans, t);
            t =0 ;
        }
    }
    ans = max(ans, t);

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
local mmi, mma = math.min, math.max
local n, ma, mb = io.read("*n", "*n", "*n")
local a, b, c = {}, {}, {}
for i = 1, n do
  a[i], b[i], c[i] = io.read("*n", "*n", "*n")
end
local inf = 1000000007
local t = {}
for i = 1, 400 do
  t[i] = {}
  for j = 1, 400 do
    t[i][j] = inf
  end
end
for k = 1, n do
  for i = 400 - a[k], 1, -1 do
    for j = 400 - b[k], 1, -1 do
      t[i + a[k]][j + b[k]] = mmi(t[i + a[k]][j + b[k]], t[i][j] + c[k])
    end
  end
  t[a[k]][b[k]] = mmi(t[a[k]][b[k]], c[k])
end
local ret = -1
for i = 1, 400 do
  for j = 1, 400 do
    if i * mb == j * ma and t[i][j] < inf then
      if ret < 0 or t[i][j] < ret then
        ret = t[i][j]
      end
    end
  end
end
print(ret)


Measured memory_bytes: 1920
#include <stdio.h>
int main(void){
    int n,m,a,i;
    scanf("%d%d",&n,&m);
    a=0;
    for(i=0;i<m;i++){
        a+=1900;
    }
    for(i=0;i<n-m;i++){
        a+=100;
    }
    for(i=0;i<m;i++){
        a=a*2;
    }
    printf("%d",a);
    return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  
  else if(A + B == C + D){
    cout << "Balanced" << endl;
  }
  
  else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <numeric>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,m; cin >> n >> m;
		if(n==0&&m==0)break;
		vector<pair<int,int>> v;
		for(int i=0;i<n;i++){
			int x,y; cin >> x >> y;
			v.push_back({y,x}); 
		}
		sort(v.rbegin(),v.rend());
		int ans=0;
		for(int i=0;i<n;i++){
			if(m>=v[i].second){
				m-=v[i].second;
			}
			else{
				v[i].second-=m;
				m=0;
				ans+=v[i].first*v[i].second;
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3240
n=gets.chomp.to_i
a=gets.chomp.split.map { |e| e.to_i  }

max=0
min=10**9

n.times do |i|
  if a[i]>max
    max=a[i]
  end

  if a[i]<min
    min = a[i]
  end
end

puts max-min

Measured memory_bytes: 1788
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> p;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;
string convert(string s) {
  rep(i, s.length()) if(s[i] == '?') s[i] = 'a';
  return s;
}

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.length(), m = t.length();

  for (int i = n - 1; i >= 0; --i) {
    string ans = s;
    if (i + m > n) continue;
    string subs = s.substr(i, m);
    bool ok = true;
    rep(j, m) {
      if (s[i + j] == '?') {
        ans[i + j] = t[j];
      } else if(s[i + j] != t[j]) ok = false;
    }
    if (ok) {
      ans = convert(ans);
      cout << ans << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE"<< endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <utility>
#include <algorithm>
#include <bitset>
using namespace std;
typedef pair<int,int> pi;
#define F first
#define S second
#define MP make_pair
const int N=1e3+10;
bitset<N> went;
int bot,tot,a[N],t;
pi b[N];
void dfs(int n){
    if(went[n])return ;
    went[n]=true;
    t++;
    tot+=b[a[n]].F;
    bot=min(bot,b[a[n]].F);
    dfs(a[n]);
    return ;
}
int main(){
    int n,low=1e5+10;;
    long long int ans=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&b[i].F);
        low=min(low,b[i].F);
        b[i].S=i;
    }
    sort(b,b+n);
    for(int i=0;i<n;i++)a[b[i].S]=i;
    went.reset();
    for(int i=0;i<n;i++)if(!went[i]&&a[i]!=i){
        tot=0;
        bot=1e5+10;
        t=0;
        dfs(i);
        ans+=min(tot+(t+1)*low+bot,tot+(t-2)*bot);
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 2764
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;

const ll INF = 1001001001001001001LL;

int main(void) {

	cin.tie(0);
  ios::sync_with_stdio(false);

	ll n;
	cin >> n;
  	ll a[n];
	rep (i, n) cin >> a[i];

	rep (i, n - 1) a[i + 1] += a[i];
	ll sum = a[n - 1];
	ll ans = INF;
	rep (i, n - 1) {
		ll left = a[i];
		ll right = sum - left;
		ans = min(ans, abs(left - right));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
#include <stack>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
using namespace std;
const int MAXN=1e6+50;
const int inf=0x3f3f3f3f;
const int M=5000*4;
char ch[MAXN];
int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=20050;i++){
        double aa=i*0.08;
        double bb=i*0.1;
        if((int)aa==a&&(int)bb==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<-1<<endl;
    return 0;
}
/*

*/


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		if(a==b&&a!=c)
			System.out.println("Yes");
		else if(a==c&&a!=b)
			System.out.println("Yes");
		else if(a!=b&&b==c)
			System.out.println("Yes");
		else
			System.out.println("No");

	}

}


Measured memory_bytes: 22868
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  // 入力
  ll x, y;
  cin >> x >> y;

  int ans = 0;
  while (x <= y) {
    x *= 2;
    ans++;
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

using namespace std;

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




int main(void) {

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;

    string r;

    for (int i=0; i < 2*n; i++){
        if (i%2 == 0){
            r+= s[i/2];
        }
        else {
            r+= t[i/2];
        }
    }

    cout << r << endl;

}



//              g++ -std=c++1z  

Measured memory_bytes: 888
n=int(input())
s=input()
keep=-1
for i in range(0,n-1):
  left=s[:i+1]
  migi=s[i+1:]
  lis=[]
  count=0
  for j in range(0,len(left)):
    t=left[j]
    if not t in lis:
      if t in migi:
        count+=1
    lis.append(t)
  if count>keep:
    keep=count
print(keep)

Measured memory_bytes: 3064
from collections import deque
b=deque([])
n=int(input())
a=list(map(str,input().split()))
b.append(a[0])
for i in range(1,n):
  if i%2==0:
    b.append(a[i])
  else:
    b.appendleft(a[i])
if n%2==0:
  print(*b)
else:
  print(*reversed(b))

Measured memory_bytes: 24516
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/segtree>
using namespace atcoder;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int op(int a,int b){
	return max(a,b);
}

int e(){
	return -Inf;
}

int main(){

	int N,K;
	cin>>N>>K;
	
	vector<int> A(N);
	rep(i,N){
		cin>>A[i];
	}
	int M = 300005;
	segtree<int,op,e> seg(M);
	
	rep(i,N){
		int l = max(0,A[i]-K);
		int r = min(A[i]+K+1,M);
		int temp = max(seg.prod(l,r)+1,1);
		seg.set(A[i],max(temp,seg.get(A[i])));
	}
	
	cout<<seg.all_prod()<<endl;

	return 0;
}


Measured memory_bytes: 9544
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        final int N = sc.nextInt();
        int[] l = new int[N+2];
        long ans = 0;
        for(int i = 1;i <= N;i++){
            l[i] = sc.nextInt();
            ans += Math.abs(l[i]-l[i-1]);
        }
        ans += Math.abs(l[N+1]-l[N]);
        long div = ans;
        for(int i = 1;i <= N;i++){
            ans -= Math.abs(l[i]-l[i-1])+Math.abs(l[i+1]-l[i]);
            ans += Math.abs(l[i+1]-l[i-1]);
            System.out.println(ans);
            ans = div;
        }
    }
}

Measured memory_bytes: 68396
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
using namespace std;
int main() {
	int ans = 1,n,k;
	cin >> n >> k;
	for (int i = 0; i < n;i++) {
		if (ans < k) {
			ans *= 2;
		}
		else {
			ans += k;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main() {

  string S;
  cin >> S;

  if(S == "Sunny") cout << "Cloudy" << endl;
  else if(S == "Cloudy") cout << "Rainy" << endl;
  else if(S == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256