akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define ld long double
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7; ;
const ll inf=1e10;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define put(x) cout<<#x<<" = "<<x<<endl;

ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

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

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

bool isVowel(char c){
	if(c=='a' or c=='e' or c=='i' or c=='o' or c=='u')
		return true;
	return false;
}


int main()
{
    fast;
    ll t;
    
    //~ cin>>t;
    t=1;
    while(t--){
			ll n;
			cin>>n;
			string a,b;
			cin>>a>>b;
			string ans="";
			for(int i=0;i<n;i++){
				cout<<a[i]<<b[i];
			}
			
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;

public class Main {
public static void main(String[] args){
	
	String[] input = new java.util.Scanner ( System.in ). nextLine().split(" ");
	int a = Integer.parseInt(input[0]);
	int b = Integer.parseInt(input[1]);
	int c = Integer.parseInt(input[2]);
	int[] an = new int[]{a, b, c};
	Arrays.sort(an);
	for (int i = 0; i < an.length; i++)
	{
		System.out.print(an[i]);
		if (i != 2)
			System.out.print(" ");
		if (i == 2)
			System.out.println();
	}
	
	
	
	
}
}

Measured memory_bytes: 17128
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
// dp[i] = TRUE if  first player wins if i stones remaining
 
int main(){
	int n,k;
	cin >> n >> k;
	
	vector<int> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
 
	vector<bool>dp(k+1);
	for(int stones = 0;stones <= k; stones++){
		for(int j=0;j<n;j++){
			if(stones >= v[j] && !dp[stones-v[j]]){
				dp[stones] = true;
			}
		}
	}
	
	puts(dp[k] ? "First" : "Second");
	return 0;
}

Measured memory_bytes: 3624
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;



int main() {
	string S;
	cin >> S;
	if ((S[2] == S[3]) && (S[4] == S[5])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(M);
    vector<int> B(M);
    rep(i,M){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    dsu d(N);
    rep(i,M){
        d.merge(A[i], B[i]);
    }
    map<int,int> mp;
    rep(i,N){
        mp[d.leader(i)]++;
    }
    int ans = 0;
    for (map<int,int>::iterator itr = mp.begin(); itr != mp.end(); itr++){
        ans++;
    }
    cout << ans - 1 << endl;
}

Measured memory_bytes: 7432
#include <cstdio>
#include <algorithm>
using namespace std;
int N,M;
int C[16][16];
int dp[1<<15][16];
int F[1<<15][16];
int wut(int a,int b)
{
    int rez=0;
    for(int i=1;i<=N;i++)if((b>>(i-1))&1)rez+=F[a][i];
    return rez;
}
int main()
{
    scanf("%d %d",&N,&M);
    for(int i=1;i<=M;i++){int x,y,z;scanf("%d %d %d",&x,&y,&z);C[x][y]=C[y][x]=z;}
    for(int conf=0;conf<(1<<N);conf++)
    {
        for(int j=1;j<=N;j++)
        {
            dp[conf][j]=1<<30;
            for(int k=1;k<=N;k++)
                if((conf>>(k-1))&1)F[conf][j]+=C[k][j];
        }
    }
    dp[1][1]=0;
    for(int conf=1;conf<(1<<N);conf++)
    {
        for(int i=1;i<=N;i++)
        {
            if((conf>>(i-1))&1)
            {
                for(int j=1;j<=N;j++)
                    if(C[i][j]&&((conf>>(j-1))&1)==0)
                        dp[conf|(1<<(j-1))][j]=min(dp[conf|(1<<(j-1))][j],dp[conf][i]+F[conf^(1<<(i-1))][j]);
                int u=(1<<N)-1-conf;
                for(int p=u;p;p=(p-1)&u)
                    dp[conf|p][i]=min(dp[conf|p][i],dp[conf][i]+wut(conf^(1<<(i-1)),p));
            }
        }
    }
    printf("%d",dp[(1<<N)-1][N]);
    return 0;
}


Measured memory_bytes: 4224
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int[] arr = new int[3];
		arr[0] = sc.nextInt();
		arr[1] = sc.nextInt();
		arr[2] = sc.nextInt();	

		Arrays.sort(arr);
		System.out.println(arr[0] + arr[1]);
	}
}

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

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("1 2 3");
            //YES
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("5");
            WillReturn.Add("1 2 3 4 5");
            //NO
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        int OddCnt = wkArr.Count(X => X % 2 == 1);
        //int EvenCnt = wkArr.Count(X => X % 2 == 0);

        //偶数しかなかったらOK
        //if (OddCnt == 0 && EvenCnt > 0) {
        //    Console.WriteLine("YES");
        //    return;
        //}

        ////奇数の数が2の倍数ならOK
        //if (OddCnt % 2 == 0) {
        //    Console.WriteLine("YES");
        //    return;
        //}

        Console.WriteLine(OddCnt % 2 == 0 ? "YES" : "NO");
    }
}


Measured memory_bytes: 19680
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;

int main() {
    string s;
    cin >> s;
    bool flag = 1;
    for (int i = 0; i < 3; i++) {
        if (s[i] != 'a' && s[i] != 'b' && s[i] != 'c') flag = 1;
    }
    if (flag && s[0] != s[1] && s[1] != s[2] && s[2] != s[0]) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <algorithm>
#include <sstream>
#include <math.h>

using namespace std;

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vec2bool vector<vector<bool>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s >= 0;s--)

#define Pi 3.1415926535897932384626


int main()
{
	ll a,b,h,m;
	double ans;
	string s;
	bool flag = false;

	cin >> a >> b >> h >> m;

	pair<double,double> hPoints, mPoints;

	double hAngle = (double)(h * 30 + (double)m / 2) / 180;
	double mAngle = (double)m * 6 / 180;

	hPoints = {a* sin(hAngle*Pi),
		a * cos(hAngle * Pi) };
	mPoints = { b * sin(mAngle * Pi),
		b * cos(mAngle * Pi) };

	ans = (abs(hPoints.first - mPoints.first) * abs(hPoints.first - mPoints.first)) + (abs(hPoints.second - mPoints.second) * abs(hPoints.second - mPoints.second));
	
	cout << fixed << setprecision(15) << pow(ans,0.5);

}


Measured memory_bytes: 4320
#include <stdio.h>
#include <math.h>

int main(void)          
{
	double xone, yone, xtwo, ytwo;

	scanf("%lf %lf %lf %lf", &xone, &yone, &xtwo, &ytwo);
	
	printf("%f", sqrt((xtwo - xone)*(xtwo - xone) + (yone - ytwo)*(yone - ytwo)));
	return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N, x;
    cin >> N >> x;
    vector<int> A(N);
    for(int i=0; i<N; ++i) cin >> A[i];
    long long ans = 0;
    for(int i=1; i<N; ++i){
        long long sum = A[i] + A[i-1];
        if(sum <= x) continue;
        else{
            ans += sum - x;
            if(sum-x > A[i]){
                A[i] = 0;
                //A[i-1] =  x;
            }
            else{
                A[i] -= sum -x;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#!/usr/bin/ruby
M=10**24+7 # selected with miller_rabin
n,a,b,*v=`dd`.split.map &:to_i
I=[1,1];*F=I;*R=I
2.upto(n){|i|I<<z=(M-M/i)*I[M%i]%M;F<<i*F[-1]%M;R<<z*R[-1]%M}
v.sort_by! &:-@
(a-1).downto(x=y=0){|i|
	break if v[i]!=v[a-1]
	x+=1
	y+=1
}
a.upto(n-1){|i|
	break if v[i]!=v[a-1]
	x+=1
}

p v[0,a].reduce(:+)*1.0/a
p (y==a ? a..[x,b].min : y..y).reduce(0){|s,i|s+F[x]*R[i]*R[x-i]%M}

Measured memory_bytes: 2044
// AtCoder :: Beginner Contest 179 :: A - Plural Form
// https://atcoder.jp/contests/abc179/tasks/abc179_a

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string S;
    getline(cin, S);
    if (S.back() == 's') {
        cout << S << "es" << endl;
    } else {
        cout << S << "s" << endl;
    }
    return EXIT_SUCCESS;
}


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

int main() {
  int a;
  int b;
  int c;
  	cin >> a >> b >> c;
  int x;
  	x = a * b;
      if(x > c){
        cout << c << endl;
      }
  		else{
          cout << x << endl;
      }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=55;
int n,x,d,fa[N],c[N*N*N];
struct node
{
	int v,id;
	long long w;
	bool operator<(const node k)const
	{
		return v*k.w>w*k.v;
	}
}a[N];
long long dp[N*N*N],ans;
int main()
{
	ios::sync_with_stdio();
	cin>>n>>x>>d;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].w;
		if(i>1)
			cin>>fa[i];
		a[i].id=i;
		a[i].v=1;
	}
	for(int i=n;i>=1;i--)
	{
		a[fa[i]].w+=a[i].w;
		a[fa[i]].v+=a[i].v;
	}
	sort(a+1,a+n+1);
	int m=min(n,d);
	for(int j=1;j<=n*n*n;j++)
		dp[j]=1e18;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=n*n*n;j++)
			c[j]=0;
		for(int j=0;j<=n*n*n;j++)
		{
			if(c[j]==m)
				continue;
			if(dp[j+a[i].v]>dp[j]+a[i].w)
			{
				dp[j+a[i].v]=dp[j]+a[i].w;
				c[j+a[i].v]=c[j]+1;
			}
			else if(dp[j+a[i].v]==dp[j]+a[i].w&&c[j+a[i].v]>c[j]+1)
				c[j+a[i].v]=c[j]+1;
		}
	}
	for(int i=0;i<=n*n*n;i++)
	{
		if(dp[i]>x)
			continue;
		long long w=dp[i],v=i;
		for(int j=1;j<=n;j++)
		{
			if(a[j].id==1)
			{
				long long zh=(x-w)/a[j].w;
				w+=zh*a[j].w,v+=zh*a[j].v;
				continue;
			}
			long long zh=min((long long)d-m,(x-w)/a[j].w);
			w+=zh*a[j].w,v+=zh*a[j].v;
		}
		ans=max(ans,v);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 5088
#include<iostream>
using namespace std;
int main()
{
    int i, a, b, ca=0, cb=0;
    cin>>a>>b;
    for(i=1; i<10;i++)
    {

        if(a==i)
            ca++;
        if(b==i)
            cb++;
    }
    if(ca!= 0&& cb!=0)
        cout<<a*b<<endl;
    else
        cout<<"-1"<<endl;

    return 0;
}




Measured memory_bytes: 256
using System;

namespace ABC_064_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            var word = Console.ReadLine().Split(' ');
            string r = (word[0]);
            string g = (word[1]);
            string b = (word[2]);
            string c = (r + g + b);
            int i = int.Parse(c);
            if (i % 4 == 0)
            {
                Console.WriteLine("YES");
            }
            else if (i % 4 != 0)
            {
                Console.WriteLine("NO");
            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}
namespace {
    const int mo = 1e9 + 7;
    inline int add(int x, int y) { x += y; return x >= mo ? x - mo : x; }
    inline int sub(int x, int y) { x -= y; return x < 0 ? x + mo : x; }
    inline int mul(int x, int y) { return (lo) x * y % mo; }
    inline int power(int a, int k = mo - 2) {
		int ans = 1;
		for (; k; k >>= 1, a = mul(a, a))
			if (k & 1) ans = mul(ans, a);
		return ans;
    }
	inline void U(int &x, int y) { x = add(x, y); } 
}
const int N = 666;
int n, q, m;
int b[N], L[N], R[N], g[N], sum[N][N], dp[N][N];

int main(void) {
	read(n); read(q); m = 2 * n;
	rep (i, q) {
		int x, y; read(x); read(y);
		b[x] = b[y] = true; if (x > y) swap(x, y);
		R[x] = y; L[y] = x;
	}
	rep (l, m) for (int r = l; r <= m; r++)
		sum[l][r] = sum[l][r - 1] + (b[r] == 0);
	g[0] = 1;
	rep (k, m) if (~k & 1) {
		g[k] = 1;
		for (int p = k - 1; p >= 1; p -= 2) g[k] = mul(g[k], p);
	}
	rep (len, m) {
		rep (l, m) {
			int r = l + len - 1; if (r > m) break;
			if (sum[l][r] & 1) continue;
			bool ok = true;
			for (int k = l; k <= r; k++)
				if ((R[k] && R[k] > r) || (L[k] && L[k] < l)) ok = false;
			if (!ok) continue;
			dp[l][r] = g[sum[l][r]];
			for (int k = l; k <= r - 1; k++)
				dp[l][r] = sub(dp[l][r], mul(dp[l][k], g[sum[k + 1][r]]));
		}
	}
	int ans = 0;
	rep (l, m) rep (r, m) U(ans, mul(dp[l][r],  g[sum[1][m] - sum[l][r]]));
	cout << ans << "\n";
}


Measured memory_bytes: 3328
def actual(N):
    """
    発想: 4 と 7 の和の組み合わせで表現できる数を列挙する(最大は100)
    """
    num_4x_list = [4 * i for i in range(1, (100 // 4) + 1)]

    set_all = set()

    for i, num_4x in enumerate(num_4x_list, start=1):
        for j in range(i + 1):
            element = num_4x + 3 * j

            if element <= 100:
                set_all |= {element}

    if N in set_all:
        return 'Yes'

    return 'No'
  
  
N = int(input())

print(actual(N))

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

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> p;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        p.push_back(tmp);
    }
    sort(p.begin(), p.end());
    p[N - 1] /= 2;

    int ans = 0;
    for (int i : p) {
        ans += i;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <cstring>
#include <vector>
using namespace std;

#define x real()
#define y imag()
#define pb push_back 
typedef double D;
typedef complex<D> P;
typedef struct circle{
	P p;
	D r;
} C;

int rel[24];
C c[24];
vector<int> color[4];
char use[1<<24];
int cmax;

bool IC(C a,C b){
	D d=norm(a.p-b.p);
	D r=(a.r+b.r)*(a.r+b.r);
	return d<r;
}

int main(void){
	int n;
	while(cin >> n, n){
		cmax=0;
		for(int i=0;i<4;i++){
			while(!color[i].empty())
				color[i].pop_back();
		}
		for(int i=0;i<24;i++)
			rel[i]=0;
		
		for(int i=0;i<n;i++){
			int tmp;
			cin >> c[i].p.x >> c[i].p.y >> c[i].r;
			cin >> tmp;
			color[tmp-1].pb(i);
		}

		for(int i=0;i<n;i++){
			for(int j=0;j<i;j++){
				if(IC(c[i],c[j]))
					rel[i]|=1<<j;
			}
		}		
		memset(use,-1,sizeof(use));
		use[0]=0;
		for(int u=0;u<(1<<n);u++){
			if(use[u]==-1)
				continue;
			cmax=max(cmax,(int)use[u]);
			for(int i=0;i<4;i++){
				for(int j=0;j<color[i].size();j++){
					if(u >>color[i][j]&1)
						continue;
					if(rel[color[i][j]]&~u)
						continue;
					for(int k=j+1;k<color[i].size();k++){
						if(u >>color[i][k]&1)
							continue;
						if(rel[color[i][k]]&~u)
							continue;
						use[u|(1<<color[i][j])|(1<<color[i][k])]=use[u]+2;
					}
				}
			}
		}
		cout << cmax << endl;
	}
	return 0;
}

Measured memory_bytes: 17656
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();

		int max;
		int noMax;

		max = Math.max(Math.max(a, b), c);
		if (a == max) {
			noMax = b + c;
		} else if (b == max) {
			noMax = a + c;
		} else {
			noMax = a + b;
		}
		int ans = max*10 + noMax;

		// 出力
		System.out.println(ans);
	}
}

Measured memory_bytes: 22356
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define DEBUG(x) cout << (#x) << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

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

    int sum = L * N + (N - 1) * N / 2;
    if (L <= -N)
    {
        sum -= (L + N - 1);
    }
    else if (L >= 0)
    {
        sum -= L;
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 1000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}

signed main() {
	int n, l, sum = 0, ans = 30000, out = 0;
	cin >> n >> l;
	int a[500];
	rep(i, n) {
		a[i] = l + i;
		sum += a[i];
	}
	rep(i, n) {
		if (ans > abs(sum - (sum - a[i]))) {
			ans = abs(sum - (sum- a[i]));
			out = sum - a[i];
		}
	}
	cout << out << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;


int main(){
  string s;
  cin>>s;
  string ans;
  for(int i=0;i<s.size();i++){
    if(s[i]=='B'){
      if(!ans.empty()){
        ans.erase(ans.end()-1);
      }
    }else{
      ans.push_back(s[i]);
    }
    //cout<<ans<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3560
/*
 * b.cc: 
 */
 
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;
 
/* constant */
 
const int MAX_N = 100000;
 
/* typedef */
 
/* global variables */
 
int as[MAX_N];
 
/* subroutines */
 
int partition(int A[], int p, int r) {
  int x = A[r];
  int i = p-1;
  for (int j = p; j < r; j++)
    if (A[j] <= x) {
      i++;
      swap(A[i], A[j]);
    }
  i++;
  swap(A[i], A[r]);
  return i;
}
 
/* main */
 
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> as[i];
 
  int k = partition(as, 0, n - 1);
 
  for (int i = 0; i < n; i++) {
    if (i) putchar(' ');
    if (i == k) printf("[%d]", as[i]);
    else printf("%d", as[i]);
  }
  putchar('\n');
 
  return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        var saying = new []
        {
            "pon",
            "pon",
            "hon",
            "bon",
            "hon",
            "hon",
            "pon",
            "hon",
            "pon",
            "hon",
        };

        Console.WriteLine(saying[n % 10]);
    }
}


Measured memory_bytes: 27540
N = int(input())
A = list(map(int, input().split()))

def bubblesort(A, N):
    flag = True
    i = 0
    cnt = 0
    while flag:
        flag = False
        for j in range(N-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                flag = True
                cnt += 1
        i += 1     
    print(*A)
    print(cnt)

bubblesort(A,N)

Measured memory_bytes: 7688
#include<stdio.h>
#include<stdlib.h>

#define N 8
#define FREE -1
#define NOFREE 1

int row[N];
int col[N];
int dpos[2*N-1];
int dneg[2*N-1];

char X[N][N];

void initialize(){
    int i;
    
    for(i=0;i<N;i++){
        row[i]=FREE;
        col[i]=FREE;
    }
    
    for(i=0;i<2*N-1;i++){
        dpos[i]=FREE;
        dneg[i]=FREE;
    }
}

void printBoard(){
    int i,j;
    
    for(i=0;i<N;i++){
        for(j=0;j<N;j++){
            if(X[i][j]){
                if(row[i]!=j) return;
            }
        }
    }
    for(i=0;i<N;i++){
        for(j=0;j<N;j++){
            printf("%s",(row[i]==j)?"Q":".");
        }
        printf("\n");
    }
}

void recursive(int i){
    int j;
    
    if(i==N){
        printBoard();
        return;
    }
    
    for(j=0;j<N;j++){
        if(NOFREE==col[j]||NOFREE==dpos[i+j]||
            NOFREE==dneg[i-j+N-1])
            continue;
            
            row[i]=j;
            col[j]=dpos[i+j]=dneg[i-j+N-1]=NOFREE;
            
            recursive(i+1);
            
            row[i]=col[j]=dpos[i+j]=dneg[i-j+N-1]=FREE;
    }
}

int main(){
    initialize();
    
    int i,j;
    
    for(i=0;i<N;i++)
        for(j=0;j<N;j++)
            X[i][j]=0;
    
    int k;
    
    scanf("%d",&k);
    
    for(i=0;i<k;i++){
        int r,c;
        scanf("%d%d",&r,&c);
        X[r][c]=1;
    }
    recursive(0);
    
    return 0;
}




Measured memory_bytes: 2112
#include <stdio.h>
#include <stdlib.h>

#define WIN 3
#define DRAW 1

int ascending_order_index(const void *a, const void *b);
int descending_order_num(const void *a, const void *b);

typedef struct {
	int index;
	int num;
    int rank;
} TEAM;

int main(void){
	int N, A, B, C, D;
    TEAM team[100]; 
    int match, same_rank = 0;
    int i;
	
	scanf("%d", &N);
    for(i = 0; i < N; i++){
        team[i].index = i + 1;
        team[i].num = 0;
    }

    match = (N * (N - 1)) / 2; 
	for(i = 0; i < match; i++){
		scanf("%d %d %d %d", &A, &B, &C, &D);
        
        if(C > D){
            team[A - 1].num += WIN;
        }else if(C < D){
            team[B - 1].num += WIN;
        }else if(C == D){
            team[A - 1].num += DRAW;
            team[B - 1].num += DRAW;
        }
	}

    qsort(team, N, sizeof(TEAM), descending_order_num);
    team[0].rank = 1;
    for(i = 2; i <= N; i++){
        if(team[i - 2].num == team[i - 1].num){
            same_rank++;
        }else{
            same_rank = 0;
        }
        team[i - 1].rank = i - same_rank;
    }

    qsort(team, N, sizeof(TEAM), ascending_order_index);
    for(i = 0; i < N; i++){
        printf("%d\n", team[i].rank);
    }

	return 0;
}

int ascending_order_index(const void *a, const void *b){
    return ((TEAM*)a)->index - ((TEAM*)b)->index;
}

int descending_order_num(const void *a, const void *b){
    return ((TEAM*)b)->num - ((TEAM*)a)->num;
}


Measured memory_bytes: 2048
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define vint vector<int>


int main(){
	int n,q;
	cin >> n;
	vint a(n);
	REP(i,n) cin >> a[i];
	cin >> q;
	vector<vector<int>> b(q,vector<int>(2));
	REP(i,q){
		cin >> b[i][0] >> b[i][1];
	}
	
	sort(a.begin(),a.end());
	vector<long long> h((int)(1e5),0);
	
	long long s=0;
	REP(i,n){
		h[a[i]-1]++;
		s += a[i];
	}
	
	
	REP(i,q){
		s += (b[i][1]-b[i][0]) * h[b[i][0]-1];
		h[b[i][1]-1] += h[b[i][0]-1];
		h[b[i][0]-1] = 0;
		cout << s << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 9792
import java.util.Scanner;


public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	
    	int A=sc.nextInt();
    	int B=sc.nextInt();
    	
    	int  add=A+B;
    	int minus=A-B;
    	int mult=A*B;
    	
    	int result=Math.max(add,Math.max(minus,mult));
    	
    	System.out.println(result);

    }
}



Measured memory_bytes: 23764
#include<stdio.h>
int main()
{
	int a,b[100]={},c=0;
	scanf("%d",&a);
	while(a!=-1){
		if(a==0){
			printf("0");
			goto A;
		}
	while(a>0){
		b[c]=a%4;
		a=a/4;
		c++;
	}
	for(int j=c-1;j>=0;j--){
		printf("%d",b[j]);
	}
	A:
	printf("\n");
	int b[100]={};
	c=0;
	scanf("%d",&a);
	}
	return 0;
}

Measured memory_bytes: 1032
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        int readPos = 0;
        char[] ans = new char[s.Length];
        for (int i = 0; i < s.Length; i++) ans[i] = 'x';
        for(int i = 0; i < s.Length; i++)
        {
            if(s[i] == 'B')
            {
                if (readPos != 0) {
                    ans[readPos - 1] = 'x';
                    readPos--;
                }
            }
            else
            {
                ans[readPos] = s[i];
                readPos++;
            }
        }
        foreach (char c in ans)
            if (c != 'x') Console.Write(c);
        Console.WriteLine();
    }
}


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

using namespace std;


#define PI 3.14159265
#define int long long

bool is(int &x){
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) return false;
	}
	return true;
}



main(){


	int x; cin >> x;


	while(!is(x)){
		x++;
	}


	cout << x << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int N;
 cin >> N;
 string a;
int check = 0;
 for(int i = 0; i < N; i++){
  cin >> a;
  if(a == "Y"){
    check = 1;
     break;
  }
 }
 if ( check == 1){
  cout << "Four" << endl;
 }
  else{
    cout << "Three" << endl;
  }
}

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

int main() {
	ll n;
	cin>>n;
	pair<ll,ll> a[n];
	for(ll i=0;i<n;i++)
	{
	    cin>>a[i].second>>a[i].first;
	}
	sort(a,a+n);
	for(ll i=1;i<n;i++)
	{
	    a[i].second+=a[i-1].second;
	}
	for(ll i=0;i<n;i++)
	{
	    if(a[i].second>a[i].first)
	    {
	        cout<<"No\n";
	        return 0;
	    }
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3328
import java.util.Scanner;

/**
 * https://abc057.contest.atcoder.jp/tasks/abc057_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		sc.close();
 
		System.out.println((A+B)%24);
		

	}

}


Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
    int n,x,l[101]={};
    cin >> n >> x;
    for(int i=0;i<n;i++){
        cin >> l[i];
    }
    long long int d[101]={};
    for(int i=1;i<n+1;i++){
        d[i]=d[i-1]+l[i-1];
    }
    int ct=1;
    for(int i=1;i<n+1;i++){
        if(d[i]<=x){
            ct++;
        }else{
            break;
        }
    }
    cout <<ct << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int a[100005];

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    int x=0,y=a[n-1],k=INF,m=a[n-1]/2;
    for(int i=0;i<n-1;i++){
        if(abs(a[i]-m)<=k){ k=abs(a[i]-m); x=a[i]; }
    }
    printf("%d %d\n",y,x);
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ul X;
  cin >> X;
  bool is_ans = false;
  for (int a = -200; a < 200; ++a) {
    for (int b = -200; b < 200; ++b) {
      if (pow(a, 5) - pow(b, 5) == X) {
        is_ans = true;
        cout << a << " " << b << endl;
        break;
      }
    }
    if (is_ans) {
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 4032
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <tuple>
#include <math.h>
#include <deque>
#include <stack>

using namespace std;

typedef long long ll;


int solve() {
  ll n, m;
  const ll INF = 1145141919810;
  cin >> n >> m;
  vector<ll> a(m),b(m),c(m);
  for(ll i = 0;i < m;i++){
    cin >> a[i] >> b[i] >> c[i];
    c[i] = -c[i];
  }
  vector<ll> dist(n,INF);
  dist[0] = 0;
  // Bellman–Ford
  for(ll i = 0;i < n - 1; i++){
    for(ll j = 0;j < m;j++){
      // 最短経路値の計算
      if(dist[a[j] - 1] == INF){
        continue;
      }
      if(dist[b[j] - 1] > dist[a[j] - 1] + c[j]){
        dist[b[j] - 1] = dist[a[j] - 1] + c[j];
      }
    }
  }
  ll ans = dist[n - 1];
  vector<bool> negative(n, false);
  // 閉路の検索
  for(ll i = 0;i < n; i++) {
    for(ll j = 0;j < m; j++){
      if(dist[a[j] - 1] == INF){
        continue;
      }

      if(dist[b[j] - 1] > dist[a[j] - 1] + c[j]){
        negative[b[j] - 1] = true;
      }

      if(negative[a[j] - 1] == true){
        negative[b[j] - 1] = true;
      }
    }
  }
  if(negative[n - 1]){
    cout << "inf" << endl;
  }else{
    cout << -ans << endl;
  }
  return 0;
}

int main(void){
  solve();
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;

#define MOD 1000000007

int main(void) {
    ll A, B, C, X;
    ll count = 0;
    cin >> A >> B >> C >> X;
    for(ll a = 0;a <= A;a++) {
        for(ll b = 0;b <= B;b++) {
            for(ll c = 0;c <= C;c++) {
                if(a * 500 + b * 100 + c * 50 == X) count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
open Batteries
module EnumL = Enum.Labels
module ListL = List.Labels
module ArrayL = Array.Labels

let dbg0 x = Printf.eprintf "[debug]%s\n" @@ dump x
let dbg1 x = dbg0 x; x

let id = identity

let (++) n m = List.range n `To m
let (++-) n m = if n >= m then List.range n `Downto m else []
let (++^) n m = if n < m then List.range n `To (pred m) else []

let scan fmt = Scanf.sscanf (read_line ()) fmt

let scan_lines n fmt f =
  if n = 0 then []
  else List.map (fun _ -> scan fmt f) (1 ++ n)

let scan_list ?sep cnv =
  let line = read_line () in
  (match sep with
   | None -> List.map String.of_char @@ String.to_list line
   | Some sep -> String.split_on_char sep line)
  |> List.map cnv

let scan_array ?sep cnv = Array.of_list @@ scan_list ?sep cnv

let scan_matrix n m e ?sep conv =
  let arr = Array.make_matrix n m e in
  ListL.iter (0 ++^ n)
    ~f:(fun i -> arr.(i) <- Array.of_list @@ scan_list ?sep conv);
  arr

let atoi c = Char.code c - Char.code '0'

let rec powerset = function
  | [] -> [[]]
  | hd::tl ->
    let pws =  powerset tl in
    pws @ ListL.map pws ~f:(fun pw -> hd::pw)

let permutations l =
  let rec interleave x = function
    | [] -> [[x]]
    | (hd::tl) as l ->
      (x::l) :: (interleave x tl |> ListL.map ~f:(fun l -> hd::l)) in
  let rec aux = function
    | [] -> [[]]
    | a::rest ->
      aux rest |> ListL.map ~f:(interleave a) |> List.concat in
  aux l

let intersection l =
  EnumL.filter ~f:(fun x -> EnumL.exists ~f:((=) x) @@ Enum.clone l)

let zip l m =
  let n = min (List.length l) (List.length m) in
  List.combine (List.take n l) (List.take n m)

let lower_bound n f =
  let rec aux l u =
    if u - l > 1 then
      let m = (l + u) / 2 in
      if f m then aux l m
      else aux m u
    else u in aux (-1) n

let between n x m = n <= x && x < m

module ModOp = struct
  let prime = 1_000_000_007
  let (-) a b = (a + prime - b) mod prime
  let (+) a b = (a + b) mod prime
  let ( * ) a b = (a * b) mod prime

  let rec pow x n =
    if n = 0 then 1
    else if n mod 2 = 0 then pow (x*x) (n/2)
    else x * pow (x*x) (n/2)
end

let n = scan "%d" id
let ls = scan_lines n "%d %d" Tuple2.make

let rec gcd a b =
  if b = 0 then a
  else gcd b (a mod b)

let () =
  let open ModOp in
  let (ks, ms) = ListL.partition ls ~f:(fun (a,b) -> a = 0 && b = 0) in
  let ms = ListL.map ms ~f:(fun (a, b) ->
      if a = 0 then (0,1)
      else if b = 0 then (1,0)
      else
        let m = gcd (abs a) (abs b) in
        if a < 0 then (-a/m, -b/m)
        else (a/m, b/m)) in
  let h0 = Hashtbl.create n in
  let h1 = Hashtbl.create n in
  ListL.iter ms ~f:(fun (a,b) ->
      if b <= 0 then Hashtbl.modify_def 0 (a,b) succ h0
      else (Hashtbl.modify_def 0 (b,-a) succ h1;
            Hashtbl.modify_def 0 (b,-a) id h0));
  Hashtbl.map (fun v n ->
      let x = Hashtbl.find_default h1 v 0 in
      pow 2 n + pow 2 x - 1) h0
  |> Hashtbl.to_list |> List.map Tuple2.second
  |> ListL.fold_left ~init:1 ~f:( * )
  |> ((+) (List.length ks - 1))
  |> Printf.printf "%d\n"


Measured memory_bytes: 74292
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=a;i>b;i--)
#define mkp(a,b) make_pair(a,b)
#define all(v) v.begin(),v.end()
using namespace std;
bool compare(pair<int,int>& p1,pair<int,int>& p2)
{
    return p1.second<p2.second;
}
int main()
{
    fastio
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a<<"\n";
}

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
//#include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ...

#define pi 3.14159265358979323846
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using ld = long double;
using Byte = unsigned char;
using namespace std;

bool isZero = true;

//string ans = "Yes";
ll ans = 0;
ll N;
vector<ll> A;

int main() {
	cin >> N;

	vector<ll> prime;
	vector<ll> primeF;
	ll nowP = 1;
	ll tmpN = N;

	
	if (tmpN % 2 == 0) {
		ll F = 0;
		while (tmpN % 2 == 0) {
			F++;
			tmpN /= 2;
		}
		prime.push_back(2);
		primeF.push_back(F);
	}


	while (tmpN > 1) {
		nowP += 2;
		if (nowP > sqrt(N)) {
			prime.push_back(tmpN);
			primeF.push_back(1);
			break;
		}

		if (tmpN % nowP != 0) continue;
		
		int F = 0;
		while (tmpN % nowP == 0) {
			F++;
			tmpN /= nowP;
		}
		prime.push_back(nowP);
		primeF.push_back(F);


	}



	//線形探索...
	for (int p : primeF) {
		ll x = 0;
		while ((x + 1) * (x + 2) / 2 <= p) {
			x++;
		}
		ans += x;
	}


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


Measured memory_bytes: 3712
#include <iostream>

bool check(int t, int x, int y, int tt, int xx, int yy) {
    int time = tt - t;
    int min_dist = abs(xx - x) + abs(yy -y);
    if (time % 2 != min_dist % 2 || time < min_dist) {
        return false;
    }
    return true;
}

int main() {
    int N;
    std::cin >> N;
    int t, x, y;
    t = 0;
    x = 0;
    y = 0;
    for (int i = 0; i < N; ++i) {
        int tt, xx, yy;
        std::cin >> tt >> xx >> yy;
        if (!check(t, x, y, tt, xx, yy)) {
            std::cout << "No";
            return 0;
        }
        t = tt;
        x = xx;
        y = yy;
    }
    std::cout << "Yes";
    return 0;
}

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

using namespace std;

int main() {
  int N, div4 = 0, div2 = 0;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    if (a % 4 == 0)
      div4++;
    else if (a % 2 == 0)
      div2++;
  }
  cout << (div4 * 2 + max(1, div2) >= N ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define Rep(i,k,n) for(long long i=k;i<=(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
typedef long long ll;
typedef pair<ll,ll> P;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;

int k;
ll ab;
ll abc;
int main(){
    cin>>k;
    ll ans=0;
    Rep(i,1,k){
        Rep(j,1,k){
            Rep(h,1,k){
                ab=__gcd(i,j);
                ans+=__gcd(h,ab);
                
            }
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
p = [int(i) for i in input().split()]
ans = 0

for i in range(1, n - 1):
    if p[i-1] < p[i] and p[i] < p[i + 1] or p[i] < p[i -1] and p[i + 1] < p[i]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#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++)
typedef long long ll;

int main() {
    int N; cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }
    for (int i = N-1; i >= 0; i -= 2){
        cout << A[i] << " ";
    }
    if (N%2){
        for (int i = 1; i < N; i += 2){
            cout << A[i] << " ";
        }
    }
    else {
        for (int i = 0; i < N; i += 2){
            cout << A[i] << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
map<int,int> m;
void cal1(vector<string> v,int i,int h,int w)
{
	if(i==w)
	{
		// cal1(v,0,h,w);
		int t = 0;
		for (int k = 0; k < h; ++k)
		{
			for(int j = 0; j<w; j++)
			{
				if(v[k][j]=='#')
					t++;
			}
		}
		m[t]++;
		return;
	}
	cal1(v,i+1,h,w);
	for(int j = 0 ; j<h; j++)
		v[j][i] = 'R';
	cal1(v,i+1,h,w);
}

void cal(vector<string> v, int i,int h,int w)
{
	if(i==h)
	{
		cal1(v,0,h,w);
		return;
	}
	cal(v,i+1,h,w);
	for(int j = 0 ; j<w; j++)
		v[i][j] = 'R';
	cal(v,i+1,h,w);
}


void solve()
{
	int h,w,k;
	cin>>h>>w>>k;
	vector<string> v(h);
	for (int i = 0; i < h; ++i)
	{
		cin>>v[i];
	}
	cal(v,0,h,w);
	cout<<m[k]<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define MOD 998244353
using namespace std;
int32_t main()
{
    int n,k=2;
    cin>>n>>k;
    vector<int> v;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        v.push_back(x);
    }
    vector<int> dp(n,0);
    for(int i=1;i<n;i++)
    {
        dp[i]=1e9;
        for(int j=i-1;j>=0 && i-j<=k;j--)
            dp[i]=min(dp[i],dp[j]+abs(v[i]-v[j]));
    }
    cout<<dp[n-1]<<endl;
}
    


Measured memory_bytes: 4976
def main():
    bm = 0xffffffff
    a,b = map(int, input().split())
    
    an = (a & b) & bm
    o  = (a | b) & bm
    xo = (a ^ b) & bm

    print(format(an, "032b"))
    print(format(o,  "032b"))
    print(format(xo, "032b"))

main()


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 1e9+7;
int binary(int bina){
	int ans = 0;
	for (int i = 0; bina>0 ; i++)
	{
		ans = ans+(bina%2)*pow(10,i);
		bina = bina/2;
	}
	return ans;
}
int main(){
	int n, m;
	cin >> n >> m;
	vector<vector<int> > dp(m+5, vector<int>((1<<n)+5, MAX));
	for(int i=0;i<=m;i++)
		dp[i][0] = 0;

	for(int i=1;i<=m;i++) {
		int a,b;
		cin >> a >> b;
		int bit = 0;
		for(int j=0;j<b;j++) {
			int c;
			cin >> c;
			c--;
			bit |= (1<<c);
		}
		for(int j=0;j<(1<<n);j++) {
			dp[i][j] = dp[i-1][j];
		}
		for(int j=0;j<(1<<n);j++) {
			dp[i][bit|j] = min(dp[i-1][j] + a, dp[i][bit|j]);
		}
	}

	if(dp[m][(1<<n)-1]==MAX) cout << -1 << endl;
	else cout << dp[m][(1<<n)-1] << endl;
}

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

const int mx=100009;
ll w[200], v[200], dp[mx][200], n, W;

ll find_max(ll val, ll index)
{
    if(index==n) return val==0 ? 0 : INT_MAX;

    if(~dp[val][index]) return dp[val][index];

    ll ans = find_max(val, index+1);

    if(v[index]<=val)
    {
        ans = min(ans, find_max(val-v[index], index+1) + w[index]);
    }
    return dp[val][index] = ans;
}
ll calc(ll mxx)
{
    for(ll i=mxx;i>=1;i--)
    {
        if(find_max(i, 0)<=W)
        {
            return i;
        }
    }
    return 0;
}

void solve()
{
    ll mxx=0;
    cin>>n>>W;

    memset(dp, -1, sizeof dp);

    for(int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
        mxx+=v[i];
    }
    cout<<calc(mxx)<<endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int t=1;
   // cin>>t;

    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 159888
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define debug(x) cerr << (x) << '\n';
#define bits(x,i) ((x >> i) & 1)
using namespace std;
const int N = 55;
int n,m,q;
#define pr pair<int,int>
int a[N], b[N], c[N], d[N];
int val[N];
long long ans = 0;
void dfs(int pos,int l){
	if (pos == n+1){
		long long res = 0;
		for(int i=1;i<=q;++i){
			if (val[b[i]] - val[a[i]] == c[i]) res += d[i];
		}
		ans = max(ans, res);
	}
	else {
		for(int i = l;i<=m;++i){
			val[pos] = i;
			dfs(pos+1,i);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m >> q;
	for(int i=1;i<=q;++i){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	dfs(1,1);
	cout << ans;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define dbug(x) cout<<#x<<"="<<x<<endl
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
int n,k,q,Q;
int cnt[100010];
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(k); read(q); Q=q;
	int x;
	while (q--) {
		read(x);
		cnt[x]++;
	}
	for (int i=1;i<=n;i++) {
		if (k+cnt[i]-Q<=0) printf("No\n");
		else printf("Yes\n");
	}
	return 0;
}

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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> s(N);
    int t = 0;
    for(auto& it : s) {
        cin >> it;
        t += it;
    }
    
    if(t % 10){
        cout << t << endl;
        return 0;
    }

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

    for(auto i : s){
        if(i % 10){
            cout << t-i << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 256
n,k=list(map(int,input().split()))
v=list(map(int,input().split()))
#左から取れる個数はL=0~min(n,k)
#右から取れる個数はR=0~(min(n,k)-L)
#戻す個数はk-L-R個まで少ない方から負の価値の石を返す
ans=0
for L in range(min(n,k)+1):
    for R in range(min(n,k)-L+1):
        v_get=v[0:L]+v[n-R:n]
        v_get.sort()
        D=0
        for i in v_get:
            if D==k-L-R:
                break
            if i>=0:
                break
            D+=1
        if D==0:
            total=sum(v_get)
        else:
            total=sum(v_get[D:])
        if total>ans:
            ans=total
print(ans)

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

using namespace std;
using namespace atcoder;
typedef long long ll;

/*
#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
*/
 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-12;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
//#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////

int main(){fastio
    ll q;cin>>q;
    while(q--){
        ll n,m,a,b;cin>>n>>m>>a>>b;
        cout<<floor_sum(n,m,a,b)<<endl;
    }
    
    return 0;
}


Measured memory_bytes: 3564
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>


int main(int argc, char **argv) {
    std::string input;
    std::cin >> input;
    if (input == "A") {
        std::cout << "T" << std::endl;
    } else if (input == "C") {
        std::cout << "G" << std::endl;
    } else if (input == "G") {
        std::cout << "C" << std::endl;
    } else if (input == "T") {
        std::cout << "A" << std::endl;
    } else {
        assert(false);
    }
    return 0;
}

Measured memory_bytes: 256
def BubbleSort(a,n)
    cnt=0
    (0..n-1).each do |i|
        if i+1 > n-1 then next end
        (i+1..n-1).reverse_each do |j|
            if a[j] < a[j-1] then
               a[j],a[j-1]=a[j-1],a[j]
               cnt+=1
            end
        end
    end
    return cnt
end
n=gets.to_i
indata=gets.split(' ').map(&:to_i)
n=BubbleSort(indata,n)
printf("%s\n",indata.join(' ').to_s)
p n

Measured memory_bytes: 8724