akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <fstream>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[4] = {
	{ -1 ,0 },{ 0 , 1 },{ 1 ,0 },{ 0 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL
#define chmax(a,b) a = max(a,b)
#define chmin(a,b) a = min(a,b)

struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}

};
typedef vector<vector<Edge>> Graph;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int dp[3001][3001][2] = {};

signed main() {
	int n, t;

	cin >> n >> t;

	vector<int> a(n), b(n);
	REP(i, n) {
		cin >> a[i];

		cin >> b[i];
	}


	REP(i, n) {
		REP(j, t) {
			if (j) {
				chmax(dp[i + 1][j][0], dp[i + 1][j - 1][0]);
				chmax(dp[i + 1][j][1], dp[i + 1][j - 1][1]);
			}
			chmax(dp[i + 1][j][0], dp[i][j][0]);
			chmax(dp[i + 1][j][1], dp[i][j][1]);

			if (a[i] <= j) {
				chmax(dp[i + 1][j][0] ,dp[i][j - a[i]][0] + b[i]);
				chmax(dp[i + 1][j][1], dp[i][j - a[i]][1] + b[i]);
			}

			chmax(dp[i + 1][j][1], dp[i][j][0] + b[i]);
		}
	}

	cout << max(dp[n][t - 1][1], dp[n][t - 1][0]) << endl;


	return 0;
}

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

using namespace std;

typedef unsigned long long ull;
const ull MOD = 1000000007;
const int MAX_N = 100000;
ull fact[MAX_N + 1];

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

	vector<ull> ans;

	fact[0] = 0;
	fact[1] = 1;
	for (int i = 2; i < MAX_N + 1; i++){
		fact[i] = (fact[i - 1] * i) % MOD;
	}

	while (1){
		int N, R;
		ull num = 0;

		cin >> N;
		if (N == 0) break;

		ans.push_back(0);
		vector<int> word(N);
		for (int i = 0; i < N; i++) word[i] = i;
		word.push_back(0);

		cin >> R;

		vector<int> s(2*R+1, 0);

		for (int i = 0; i < R; i++){
			cin >> s[i] >> s[i+R];
			s[i]--; s[i+R]--;

			word[s[i]] ^= word[s[i+R]];
			word[s[i+R]] ^= word[s[i]];
			word[s[i]] ^= word[s[i+R]];
		}


		sort(s.begin(), s.end());
		s.erase(unique(s.begin(), s.end()), s.end());
		s.push_back(N);

		for (int i = 0, R = s.size() - 1; i < R; i++){
			// 先頭の計算
			ull tmp = fact[N - s[i] - 1], tmp2 = 0;
			tmp *= word[s[i]];
			tmp = tmp % MOD;

			// 値を詰める
			for (int j = i; j < R; j++){
				// 先頭
				word[s[j]] -= (word[s[j]] > word[s[i]] ? 1 : 0);
				// 後続
				if (s[j] + 1 != s[j + 1]){
					word[s[j] + 1] -= (word[s[j] + 1] > word[s[i]] ? 1 : 0);
				}
			}

			// 後続の計算
			for (int j = s[i] + 1; j < s[i + 1]; j++){
				tmp2 += fact[N - j - 1];
//				cout << j << "("<< tmp2 << "),";
				tmp2 = tmp2 % MOD;
			}
			// 値を詰める
			for (int j = i + 1; j < R; j++){
				// 先頭
				word[s[j]] -= (word[s[j]] > word[s[i] + 1] ? s[i+1] - s[i] - 1 : 0);
				// 後続
				if (s[j] + 1 != s[j + 1]){
					word[s[j] + 1] -= (word[s[j] + 1] > word[s[i] + 1] ? s[i+1] - s[i] - 1 : 0);
				}
			}


			tmp2 *= word[s[i] + 1];
//			cout << tmp << "," << tmp2 << ",";
			tmp += tmp2;
			tmp += *(ans.end() - 1);	// end()は最後の要素の次の要素のiteratorを返す
			*(ans.end() - 1) = tmp % MOD;
//			cout << *(ans.end() - 1) << endl;
			
		}
	}

	for (int i = 0, l = ans.size(); i < l; i++){
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 2792
A,B,C,X,Y = list(map(int,input().split()))
max_pizza=max(X,Y)#AピザとBピザのうち、必要な枚数の多い方のピザの枚数
ans=10E+10  

for i in range(0,max_pizza*2+2,2):#ABピザをi枚買う(iは偶数)
    #max_pizza*2+2の「+2」に注意。例えばrange(0,10,2)
    #のとき0,2,4,6,8までしか出てこない。(0,10+2,2)なら10まで出る

    if (X-i/2)<=0 and (Y-i/2)>0:
        ans_kouho = B*(Y-i/2)+C*(i)
    elif (X-i/2)>0 and(Y-i/2)<=0:
        ans_kouho = A*(X-i/2)+C*(i)
    elif (X-i/2)<=0 and(Y-i/2)<=0:
         ans_kouho = C*(i)
    else:
        ans_kouho = A*(X-i/2)+B*(Y-i/2)+C*(i)

    
    if(ans_kouho<ans):
        ans = ans_kouho

print(int(ans))



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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N;
    cin >> N;

    for (int i=1; i<=N; ++i) {
        for (int j=i+1; j<=N; ++j) {
            int low = 0;
            while ((i & (1<<low)) == (j & (1<<low))) ++low;
            cout << low + 1;
            if (j == N) cout << '\n';
            else cout << ' ';
        }
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

using ll = long long;
using ull = unsigned long long;
using veci = vector<int>;
using vecll = vector<ll>;
using vecull = vector<ull>;

int main(void) {
    int N;
    cin >> N;
    vector<veci> G(N);
    vector<pair<int, int>> vp;

    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a, b);
    }

    int cols_min = 0;
    map<pair<int, int>, int> ans;
    veci cs(N, 0);

    veci used(N, 0);
    queue<int> que;
    used[0] = 1;
    que.emplace(0);
    while(!que.empty()) {
        int v = que.front(); que.pop();

        cols_min = max(cols_min, (int)G[v].size());

        int cur = 1;

        for (int u : G[v]) {
            // 親がヒットしたらスキップ
            if (used[u]) continue;

            // 親と同じ色ならスキップ
            if (cur == cs[v]) cur++;

            // 次の色を塗る
            cs[u] = ans[make_pair(u, v)] = ans[make_pair(v, u)] = cur++;

            used[u] = 1;

            que.emplace(u);

        }
    }

    cout << cols_min << endl;
    for(auto p : vp) cout << ans[p] << endl;


    return 0;
}


Measured memory_bytes: 20084
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y, ll z){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2,z);
        if(y%2==0)
         return (p*p)%z;
        else
        return (x*((p*p)%z))%z;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
ll po(ll x)
{
    ll c=0;
    while(x>0)
    {
        x=x&(x-1);
        c++;
    }
    return c;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
    ll n,x;
    cin>>n>>x;
    ll c=0;
    while(n>0)
    {
        c++;
        n=n/x;
    }
    cout<<c;}

Measured memory_bytes: 3656
#include <iostream>
#include <vector>
using namespace std;
#define int int64_t

int getNumber(int n) {
    int counter = 0;
    for (int i = 0; i<n; i++) {
        for (int j = i+1; j<n; j++) {
            counter++;
        }
    }
    return counter;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    
    cout << getNumber(n) + getNumber(m);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;cin>>n;
    vector<int> arr(n);for(int i=0; i<n; i++)cin>>arr[i];

    vector<int> dp(n);
    dp[1] = abs(arr[1]-arr[0]);
    for(int i=2; i<n; i++)
      dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i-2]-arr[i]));
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){
	
	long long int i,n,x,y=0;
	
	scanf("%lld",&n);
	
	for(i=0;i<n;i++){
		scanf("%lld",&x);
		y+=x;
	}
	
	printf("%lld\n",y/n);
	
return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] t = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        int m = int.Parse(Console.ReadLine());
        int tSum = t.Sum();
        int[] px;
        for (int i = 0; i < m; i++)
        {
            px = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            Console.WriteLine(tSum - (t[px[0] - 1] - px[1]));
        }
    }
}

Measured memory_bytes: 13268
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

struct edge {
    int to;
    int64_t cost;
    edge(int x=0, int64_t y=0):to(x), cost(y) {}
};

vector<vector<edge> > G; // resizeの必要あり

struct dijkstra {
    vector<int64_t> d;
    dijkstra(int s, int n):d(n, INT64_MAX/3) { // sはスタート,nは頂点数
        d[s] = 0LL;
        priority_queue<pair<int64_t, int>, vector<pair<int64_t, int> >, greater<pair<int64_t, int> > > que;
        que.push(make_pair(0LL, s));
        while(!que.empty()) {
            pair<int64_t, int> now = que.top();
            que.pop();
            if(now.first != d[now.second]) continue;
            for(edge next:G[now.second]) {
                if(d[next.to] > d[now.second] + next.cost) {
                    d[next.to] = d[now.second] + next.cost;
                    que.push(make_pair(d[next.to], next.to));
                }
            }
        }
    }
};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int v, e, r;
    cin >> v >> e >> r;
    G.resize(v);
    rep(i, e) {
        int s, t, d;
        cin >> s >> t >> d;
        G[s].emplace_back(t, d);
    }

    vector<ll> vec = dijkstra(r, v).d;
    rep(i, vec.size()) {
        cout << (vec[i] == INT64_MAX/3?"INF":to_string(vec[i])) << '\n';
    }
}


Measured memory_bytes: 19348
#include <cstdio>
#include <algorithm>
using namespace std;
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, n)
#define M 1000001
bool p[M];
int dish[31];
int dp[M];
int n, x;
int main()
{
	rep(i, M) p[i] = true;
	p[0] = p[1] = false;
	for (int i = 2; i * i < M; ++i)
		if (p[i]) for (int j = 2 * i; j < M; j += i)
			if (p[j]) p[j] = false;

	while (true) {
		scanf("%d%d", &n, &x);
		if ((n | x) == 0) break;
		rep(i, n) scanf("%d", dish + i);
		
		rep(j, x+1) dp[j] = -1;
		dp[0] = (1<<20);

		int k = 1;
		rep(i, n) REP(j, 1, x+1) {
			if (dp[j] >= 0)
				dp[j] = (1<<20);
			else if (j < dish[i] || dp[j-dish[i]] <= 0)
				dp[j] = -1;
			else
				dp[j] = dp[j-dish[i]] - 1;
		}
		int res = 0;
		rep(j, x+1) if (p[j] && dp[j] >= 0) res = j;
		if (res > 0)
			printf("%d\n", res);
		else
			puts("NA");
	}
	return 0;
}

Measured memory_bytes: 5640
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	string line;
	int64 hh, ww;
	cin >> hh >> ww;
	for(int64 ii = 0;ii < hh;ii++)
	{
		cin >> line;
		cout << line << endl << line << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
/*
sonu_verma1
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
ll gcd(ll a,ll b)
{
	if(a==0)
		return b;
	else
		return gcd(b%a,a);
}
int main()
{
	ll n,i,sm=0;
	cin>>n;
	ll j,k;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			for(k=1;k<=n;k++)
			{
				sm+=gcd(gcd(i,j),k);
			}
		}
	}
	cout<<sm;


	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp> //required

using namespace __gnu_pbds; 
using namespace std;

template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
typedef long long  ll;
typedef vector<ll> VL;
typedef vector<int> VI;
typedef pair<ll,ll> PLL;
typedef pair<int,int> PII;
#define pb push_back

#define F first
#define S second
#define SZ(a) int((a).size())
#define ALL(a) a.begin(),a.end()
#define fr(i,x,y) for(ll i=x;i<y;i++)
#define frr(i,x,y) for(ll i=x-1;i>=y;i--)
#define inf 1e18+1
const ll mod=1000000007;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll power(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;}a=a*a;b>>=1;}return ans;}
ll powerm(ll a,ll b){ll ans=1;while(b!=0){if(b&1){ans*=a;ans%=mod;}a=a*a;a%=mod;b>>=1;}return ans%mod;}
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

void solve()
{
    ll k;
    cin>>k;
    string str;
    cin>>str;
    if(SZ(str)>k)
    {
        //cout<<str.substr(0,k)<<"...\n";
        fr(i,0,k)
            cout<<str[i];
        cout<<"...\n";
    }
    else
        cout<<str<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
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();
        if(a>b){
            System.out.println("a > b");
        }
        if(a<b){
            System.out.println("a < b");
        }
        if(a==b){
            System.out.println("a == b");
        }
        sc.close();
    }
}


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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i, n)         for(int i=0; i<n; i++)
#define fo(i, k, n)     for(int i=k; i<n; i++)
#define forr(i, a, b)   for(int i=a; i<=b; i++)
#define rf(i,n)         for(int i=n;i>=0;i--)
typedef unsigned long long ull;
typedef pair<int,int> pr;
#define MAX 100005
#define INF 1000000009
#define   sq(n)         (n*n)
#define p(n) cout<<n<<endl
#define pb push_back
#define py cout<<"YES"<<endl;
#define pn cout<<"NO"<<endl;
#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
ll lcm ( ll a, ll b )
{
    return ( a / __gcd ( a, b ) ) * b;
}
int main()
{
    __FastIO;

   ll n;
   cin>>n;
   string s;
   while(n>0)
   {
       n--;
       ll p=n%26;
       s+='a'+p;
       n/=26;
   }
   reverse(s.begin(),s.end());
   cout<<s<<endl;
    return 0;
}


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

int main () {
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
   cin >> a[i];
  }
  for(int i=k;i<n;i++){
    if(a[i]>a[i-k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  return 0;
}

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

using namespace std;


int main(){
    
    int a[5];
    int k;
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> k;
    bool y = true;
    
    for (int i = 1; i <= 4; i++) {
        if (a[i] - a[0] > k) {
            y = false;
            break;
        }
    }
    
    if (y) {
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }
    
    
}



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

using namespace std;

int main()
{
	int N;

	cin >> N;

	N %= 1000;

	if (N == 0)
	{
		cout << N;
	}
	else
	{
		cout << 1000 - N;
	}

	return 0;
}

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int power(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

bool vowel(char c)
{
    return(c=='a' or c=='e' or c=='i' or c=='o' or c=='u' or c=='A' or c=='E' or c=='I' or c=='U' or c=='O');
}

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","w",stdout);
    //FILE *fptr2=freopen("out.txt","w",stdout);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cr=0,cw=0;
    loop(i,0,n)
    {
        if(s[i]=='R') cr++;
        else cw++;
    }
    if(cr==n or cw==n)
    {
        cout<< "0";
        return 0;
    }
    bool f=0,fl=0;
    loop(i,0,n)
    {
        if(s[i]=='W')
        {
            f=1;
        }
        else
        {
            if(f==1)
            {
                fl=1;
                break;
            }
        }
    }
    if(!fl)
    {
        cout<< "0";
        return 0;
    }
    vector <int> r(n),w(n);
    int ans=pinf;
    //bool f=0;
    loop(i,0,n)
    {
        if(i==0)
        {
            r[i]=(s[i]=='W');
        }
        else
        {
            r[i]=r[i-1]+(s[i]=='W');
        }
    }

    for(int i=n-1;i>=0;i--)
    {
        if(i==n-1)
        {
            w[i]=(s[i]=='R');
        }
        else
        {
            w[i]=w[i+1]+(s[i]=='R');
        }
    }

    loop(i,0,n-1)
    {
        int c=0;
        int x=r[i];// Ws
        int y=w[i+1];// Rs
        int z=min(x,y);
        c=z;
        x-=z;
        y-=z;
        c+=(x+y);
        ans=min(ans,c);
    }




    cout<<ans;

    return 0;
}


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

using namespace std;

const int N = 188;

int dpr[2][N][N][N];
int dpc[2][N][N][N];

int pref[N][N];

bool all(int x1, int y1, int x2, int y2) {
  int here = pref[x2 + 1][y2 + 1] - pref[x1][y2 + 1] - pref[x2 + 1][y1] + pref[x1][y1];
  return here == 0 || here == (x2 - x1 + 1) * (y2 - y1 + 1);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string foo;
    cin >> foo;
    for (int j = 0; j < m; j++) {
      pref[i + 1][j + 1] = foo[j] == '#';
    }
  }
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      pref[i + 1][j] += pref[i][j];
      pref[i][j + 1] += pref[i][j];
      pref[i + 1][j + 1] -= pref[i][j];
    }
  }
  for (int r1 = 0; r1 < n; r1++) {
    for (int c1 = 0; c1 < m; c1++) {
      for (int r2 = r1; r2 < n; r2++) {
        int lo = c1, hi = m + 1;
        while (hi - lo > 1) {
          int mid = (lo + hi) / 2;
          (all(r1, c1, r2, mid - 1) ? lo : hi) = mid;
        }
        dpr[0][r1][r2][c1] = lo;
      }
      for (int c2 = c1; c2 < m; c2++) {
        int lo = r1, hi = n + 1;
        while (hi - lo > 1) {
          int mid = (lo + hi) / 2;
          (all(r1, c1, mid - 1, c2) ? lo : hi) = mid;
        }
        dpc[0][c1][c2][r1] = lo;
      }
    }
  }
  for (int t = 0; t <= 16; t++) {
    int c = t & 1;
    if (dpr[c][0][n - 1][0] == m) {
      cout << t << '\n';
      return 0;
    }
    assert(dpc[c][0][m - 1][0] != n);
    for (int r1 = 0; r1 < n; r1++) {
      for (int c1 = 0; c1 < m; c1++) {
        for (int r2 = 0; r2 < n; r2++) {
          int c2 = dpr[c][r1][r2][c1];
          if (c2 < m) {
            c2 = dpr[c][r1][r2][c2];
          }
          dpr[c ^ 1][r1][r2][c1] = c2;
        }
        for (int c2 = 0; c2 < m; c2++) {
          int r2 = dpc[c][c1][c2][r1];
          if (r2 < n) {
            r2 = dpc[c][c1][c2][r2];
          }
          dpc[c ^ 1][c1][c2][r1] = r2;
        }
      }
    }
    for (int r1 = 0; r1 < n; r1++) {
      for (int r2 = r1; r2 < n; r2++) {
        for (int c1 = 0; c1 < m; c1++) {
          int c2 = dpr[c ^ 1][r1][r2][c1];
          while (c2 < m && dpc[c ^ 1][c1][c2][r1] > r2) {
            ++c2;
          }
          dpr[c ^ 1][r1][r2][c1] = c2;
        }
      }
    }
    for (int c1 = 0; c1 < m; c1++) {
      for (int c2 = 0; c2 < m; c2++) {
        for (int r1 = 0; r1 < n; r1++) {
          int r2 = dpc[c ^ 1][c1][c2][r1];
          while (r2 < n && dpr[c ^ 1][r1][r2][c1] > c2) {
            ++r2;
          }
          dpc[c ^ 1][c1][c2][r1] = r2;
        }
      }
    }
  }
  throw;
}


Measured memory_bytes: 105952
# -*- coding: utf-8 -*-

def main():
     a, b = map(int, input().split())
     if a <= b:
          word = ''.join([str(a) for i in range(b)])
     else:
          word = ''.join([str(b) for i in range(a)])

     print(word)

if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

a, b, c, d = MAP()

ans = max(a*c, a*d, b*c, b*d)
print(ans)


Measured memory_bytes: 9520
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>
#include<numeric>
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007
using namespace std;
using ll = long long;
int main(){
    string S;   cin>>S;
    ll K;  cin>>K;
    for(int i=0;i < min((long long)S.size(), K);++i){
        if(S[i]!='1') {
            cout<<S[i]<<endl;
            return 0;
        }
    }
    cout<<1<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	double v;
	for (; cin >> v;)
	{
		double y = 4.9 * pow(v / 9.8, 2);

		cout << (int)(y / 5 + 2) << endl;
	}
}


Measured memory_bytes: 3132
#include <cstdio>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

const double EPS=(1e-10);
typedef long long ll;
typedef pair<int,int> pii;
bool EQ(double a,double b){
  return abs((a)-(b))<EPS;
}
void fast_stream(){
	std::ios_base::sync_with_stdio(0);
}

int C,D,W,X;
int E[101][101];
int F[101][101];

int dp[31][6][51];
int calc(){
    int ret=0;
    for(int day=D;day>=0;day--){
        for(int more=0;more<=X;more++){
            for(int w=0;w<=W;w++){
                int res=0;
                if(day==D)res=0;
                else{
                    // ツ開ツ始ツ都ツ市ツ暗環置ツづーツ個按津ィ
                    for(int pos=0;pos<C;pos++){
                        if(E[pos][day]!=0){
                            // ツ債カツつゥツ右ツつゥ
                            for(int i=-1;i<=1;i++){
                                if(i==0)continue;
                                int curPos=pos;
                                int sumw=w;
                                int sumv=0;
                                while(curPos>=0&&curPos<C){
                                    sumw-=F[curPos][day];
                                    sumv+=E[curPos][day];
                                    if(E[curPos][day]==0)break;
                                    int nmore=more;
                                    if(curPos!=pos)nmore--;
                                    if(sumw>=0&&nmore>=0)res=max(res,dp[day+1][nmore][sumw]+sumv);
                                    curPos+=i;
                                }
                            }
                        }
                    }
                    // ツつオツづ按つ「
                    res=max(res,dp[day+1][more][w]);
                }
                dp[day][more][w]=res;
            }
        }
    }
    return dp[0][X][W];
}

void solve(){
    while(cin>>C>>D>>W>>X&&(C|D|W|X)){
        for(int i=0;i<C;i++)for(int j=0;j<D;j++)cin>>E[i][j];
        for(int i=0;i<C;i++)for(int j=0;j<D;j++)cin>>F[i][j];
        int res=calc();
        cout<<res<<endl;
    }
}
int main(){

    solve();

    return 0;
}

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

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, A, B;
    cin >> N >>  A>> B;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        int t;
        cin >> t;
        if (A <= t && t < B) continue;
        cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        string a = Console.ReadLine();
        Console.WriteLine(a.Substring(0,a.Length-8));
    }

    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b)
    {
        return a / gcd(a, b) * b;
    }
    public static bool IsPrime(long n)
    {
        if (n < 2) return false;
        if (n == 2) return true;

        for (long i = 2; i < n; i++)
        {
            if (n % i == 0) return false;
        }
        return true;
    }

}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long()
    {
        return long.Parse(Console.ReadLine());
    }
    public static long[] longs()
    {
        return Console.ReadLine().Split().Select(long.Parse).ToArray();
    }
    public static int Int()
    {
        return int.Parse(Console.ReadLine());
    }
    public static int[] ints()
    {
        return Console.ReadLine().Split().Select(int.Parse).ToArray();
    }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

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

int main(){
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n) {
        n /= k;
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons, std.numeric;

void main() {
    const N = readln.chomp.to!long;
    const as = readln.split.to!(long[]);
    as.map!(a => a-1).sum.writeln;
}



Measured memory_bytes: 2428
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define LL long long
#define pb push_back
#define pob pop_back
#define mp make_pair
#define FILL(a,v) memset((void*)a,v,sizeof(a))
#define FILL0(a) FILL(a,0)
#define FILL1(a) FILL(a,-1)
#define ALL(a) (a).begin(),(a).end()
#define Inf 1e9
#define Mod 1000000007
#define foreach(it,x) for(typeof(x.begin()) it=x.begin();it!=x.end();it++)
#define FOR(i,x) for(int i=0;i<x;i++)
#define RFOR(i,x) for(int i=x-1;i>=0;i--)
#define FFOR(i,a,b) for(int i=a;i<b;i++)
#define FRFOR(i,a,b) for(int i=a-1;i>=b;i--)
#define SZ(a) ((int)(a).size())
#define FI first
#define SE second
#define OVER(a) return puts(a),0
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,int> pii;
typedef unsigned long long UINT;
typedef unsigned int Uint;
typedef long long INT;
typedef pair<INT,INT> PII;

int a[3];
const int n=3;

int main()
{
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	sort(a,a+n);
	printf("%d\n",a[0]+a[1]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  cout << accumulate(a.begin(), a.end(), 0)  - n << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll A, B;
    string S, T, u;
    cin >> S >> T;
    cin >> A >> B;
    cin >> u;

    bool is_s_ = true;
    bool is_t_ = true;
    rep(i, 10){
        if(i>=u.size()){
            if(u.size() == T.size()){
                is_s_ = false;
            }else{
                is_t_ = false;
            }
        }
        if(i>=T.size()){ is_t_ = false;break;}
        if(u[i] != T[i]) {is_t_ = false; break;}
        if(i>=S.size()){ is_s_ = false; break;}
        if(u[i] != S[i]) {is_s_ = false; break;}
    }

    if(is_s_){
        cout << A - 1 <<" " << B << endl;
    }else{
        cout << A <<" " << B -1<< endl;

    }

}

int main(){
    Main();
}

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

int main()
{
  std::string s, t;
  std::cin >> s >> t;
  int count = 0;
  for (int i = 0; i < s.size(); ++i)
  {
    if (s[i] != t[i])
    {
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 3912
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>
#include <tuple>
#include <unordered_map>
#include <limits>
#include <functional>
#include <cassert>

#define FOR(x,n) for(int x = 0; x < n; x++)
#define PUT(x) cout << x << endl
#define DPUT(x) printf("%.15lf\n",x)
#define GET(x,y) std::get<x>(y)
#define CHMAX(x,y) x = std::max(x,y)
#define CHMIN(x,y) x = std::min(x,y)

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using vvpii = std::vector<vpii>;
using vch = std::vector<char>;
using vvch = std::vector<vch>;
using tiii = std::tuple<int, int, int>;

const ll mod197 = 1000000007LL;
const ll INF = 10000000000LL;

const double PI11 = 3.14159265359;

const int dis[5] = { 0,1,0,-1,0 };

const int disD[4] = { 0,1,1,0 };

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

	if (s.rfind('F') != string::npos && s.find('C') < s.rfind('F')) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;

int dp[(1<<22)];
int mat[21][21];
 
signed main()
{
    tezz

    int n;
    cin>>n;
    for(int i=0;i<n;i++) for(int j=0;j<n;j++) cin>>mat[i][j];
    // for(int i=0;i<n;i++){
    //     for(int j=0;j<n;j++) cout<<mat[i][j]<<' ';
    //         cout<<endl;
    // }
    dp[0] = 1;

   // for(int i=0;i<n;i++){
        for(int mask=0;mask<(1<<n);mask++){
            int i = __builtin_popcount(mask);
            for(int j=0;j<n;j++){ // iterating over bandiya
                if(mat[i][j] && !(mask & (1<<j))){
                    // cout<<i<<' '<<j<<endl;
                    int curr = mask ^ (1<<j);
                    dp[curr] = (dp[curr] + dp[mask]) % M;
                }
            }
        }
    //}

    cout<<dp[(1<<n)-1];
} 

Measured memory_bytes: 18688
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]

S=input()
T=input()
s=[0 for i in range(len(S))]
for i in range(len(s)):
 if S[i]=="B":
    s[i]=2
 else:
    s[i]=1

t=[0 for i in range(len(T))]
for i in range(len(t)):
 if T[i]=="B":
    t[i]=2
 else:
    t[i]=1
for i in range(len(s)-1):
   s[i+1]+=s[i]
for i in range(len(t)-1):
   t[i+1]+=t[i]
q=i1()
s=[0]+s
t=[0]+t
for i in range(q):
 [a,b,c,d]=i2()
 if (s[b]-s[a-1])%3==(t[d]-t[c-1])%3:
    print("YES")
 else:
    print("NO")

Measured memory_bytes: 57740
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
#define int long long int
const int INF = 1001001001001001LL;
const int MOD = 1000000007;

int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

signed main(){
  
  int n; cin >> n;
  vector<int> h(n);
  for(int i = 0; i < n; i++) cin >> h[i];
  int val = INF;
  
  for(int i = n - 1; i >= 0; i--){
    val = min(val, h[i]);
    if(h[i] - val >= 2){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = 1e9 + 7;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> c(n);
    REP(i, n) cin >> c[i];

    map<int, int> mp;
    vector<LL> dp(n+1, 0);
    dp[0] = 1;
    REP(i, n)
    {
        if (mp[c[i]] == i)
        {
            dp[i + 1] = dp[i];
        }
        else
        {
            dp[i+1] = (dp[i] + (mp[c[i]] != 0 ? dp[mp[c[i]]] : 0)) % MOD;
        }

        mp[c[i]] = i+1;
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 12032
a,n=map(int,input().split())
b=input()
c=[]
for i in range(n):
  c.append(int(b[2*i]))
flag="F"
while flag=="F":
  k=a
  fflag="T"
  while k>=1:
    l=int(k%10)
    for i in range(n):
      if c[i]==l:
        fflag="F"
        break
    k=int(k/10)
    if fflag=="F":
      break
  if fflag=="T":
    flag="T"
  else:
    a+=1
print(a)

Measured memory_bytes: 3064
def solve(string):
    n, *a = map(int, string.split())
    m1, m2 = sorted(a)[-2:]
    return "\n".join(map(str, [m1 if _a == m2 else m2 for _a in a]))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	is >> p.first >> p.second;
	return (is);
}

int main() {
	string S;
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		cout << "x";
	}
	cout << endl;
	return (0);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

class s_Atcoder{
  public static void Main(){

    string s = Console.ReadLine();
    char[] c = s.ToCharArray();
    for(int i=0; i<s.Length; i++){
        if(i % 2 == 0){
            Console.Write(c[i]);
        }
    }
    Console.WriteLine("");
  }
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=202020;
int const MOD=1000000007;
ll n,m,a,b,ans,d[N],f[N];
ll kasumi (ll a,ll b,ll n) 
{
    ll res=1;
    while(b)
    {
        if(b&1)
            res=res*a%n;
        a=a*a%n;
        b>>=1	;
    }
    return res;
}
ll exgcd(int a,int b,int p)
{
    if(a==b||b==0)
    {
        return 1;
    }
    return ((d[a]*f[b])%p*f[a-b]%p);
}
ll input(int x1,int y1,int x2,int y2)
{
    return exgcd(x2-x1+y2-y1,x2-x1,MOD);
}
void prepare ()
{
	d[1]=1;
	for(int i=2;i<=200000;i++)
		d[i]=(d[i-1]*i)%MOD;
	f[200000]=kasumi(d[200000],MOD-2,MOD);
	for(int i=199999;i>0;i--)
		f[i]=(f[i+1]*(i+1))%MOD;
}
int main ()
{
	prepare();
	scanf("%lld%lld%lld%lld",&n,&m,&a,&b);
	for(int i=1;i<=n-a;i++)
	{
		ans+=(input(1,1,i,b)*input(i,b+1,n,m))%MOD;
		ans%=MOD;
	}
	printf("%d",ans);
	return 0;
}

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


int main() {
	int n; cin >> n;
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<int>x(n), y(n);
	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
	}
	int res = n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (i == j)continue;
			ll dx = x[j] - x[i], dy = y[j] - y[i];
			int sub = 0;
			for (int i2 = 0; i2 < n; ++i2) {
				for (int j2 = 0; j2 < n; ++j2) {
					if (j2 == i2)continue;
					if (dx == x[j2] - x[i2] && dy == y[j2] - y[i2]) {
						++sub;
					}
				}
				res = min(res, n - sub);
			}
		}
	}
	cout << res << endl;
	return 0;
}

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

using namespace std;

int main(void){
  int a;
  int b;
  double ave;
  
  cin >> a;
  cin >> b;
  
  ave = ceil(double((a+b))/2);
  
  
  cout<< ave<< endl;
  
  return 0;
  
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define Size(x) ((int)((x).size()))
#define rep(i, l, r) for(int (i) = (l); (i) <= (r); ++(i))
#define per(i, r, l) for(int (i) = (r); (i) >= (l); --(i))
#define chkmax(x, y) (x) = max((x), (y))
#define chkmin(x, y) (x) = min((x), (y))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vii;
inline char gc() {
	static char now[1<<16], *S, *T;
	if(S == T) {T = (S = now) + fread(now, 1, 1<<16, stdin); if(S == T) return EOF;}
	return *S++;
}
#define gc getchar
inline int read() {
	int x = 0, f = 1; char c = gc();
	while(c < '0' || c > '9') {(c ^ '-') ? 0 : (f = 0); c = gc();}
	while(c >= '0' && c <= '9') {x = (x << 3) + (x << 1) + (c ^ 48); c = gc();}
	return f ? x : ((~x) + 1);
}
#define N 100010
int n;
vector<pii> con[N];

int siz[N], rt = 0, mx[N];
void getrt(int x, int fa) {
	siz[x] = 1; mx[x] = 0;
	for (pii now : con[x]) {
		int y = now.fi;
		if (y == fa) continue ;
		getrt(y, x);
		mx[x] = max(mx[x], siz[y]);
		siz[x] += siz[y];
	}
	mx[x] = max(mx[x], n - siz[x]);
	if (!rt || mx[rt] > mx[x]) rt = x;
}
ll ans = 0;
void dfs(int x, int fa, ll d) {
	siz[x] = 1;
	for (pii now : con[x]) {
		if (now.fi == fa) continue ;
		dfs(now.fi, x, d + now.se);
		siz[x] += siz[now.fi];
	}
	ans += d;
}
int main() {
	n = read();
	for (int i = 1; i < n; ++ i) {
		int u = read(), v = read(), w = read();
		con[u].pb(mk(v, w));
		con[v].pb(mk(u, w));
	}
	getrt(1, 0);
	dfs(rt, 0, 0);
	int tmp = 0x3f3f3f3f;
	for (pii now : con[rt]) {
		int y = now.fi;
		if (siz[y] == (n + 1) / 2) {
			tmp = now.se;
			break ;
		}
		tmp = min(tmp, now.se);
	}
	printf("%lld\n", 2ll * ans - tmp);
	return 0;
}

Measured memory_bytes: 11904
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

ll N,K;
ll table[SIZE];

ll mod_pow(ll x,ll count, ll mod){

	if(count == 0)return 1;
	ll ret = mod_pow((x*x)%mod,count/2,mod);
	if(count%2 == 1){

		ret = (ret*x)%mod;
	}
	return ret;
}


int main(){

	scanf("%lld %lld",&N,&K);


	ll ans = 0;

	for(ll num = K; num >= 1; num--){

		ll tmp= mod_pow(K/num,N,MOD); //N個全てがnumの倍数

		for(ll i = 2; num*i <= K; i++){ //自分の倍数が最小公倍数である場合を除く

			tmp -= table[num*i];
			if(tmp < 0){
				tmp += MOD;
			}
		}

		ans += num*tmp;
		ans %= MOD;
		table[num] = tmp;
	}

	printf("%lld\n",ans);

	return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  int ret = 0;
  for(int i = 1; i <= N; i++) {
    if(to_string(i).size() & 1)++ret;
  }
  cout << ret << endl;
}




Measured memory_bytes: 256