akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll        = long long;
using ld        = long double;
using vl        = vector<ll>;
using vd        = vector<ld>;
using vs        = vector<string>;
using vb        = vector<bool>;
using vvl       = vector<vector<ll>>;
using vvd       = vector<vector<ld>>;
using vvs       = vector<vector<string>>;
using vvb       = vector<vector<bool>>;
using pll       = pair<ll, ll>;
constexpr ll mod= 1e9 + 7;
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for(ll(i)= 0; (i) < (n); (i)++)
#define REPS(i, n) for(ll(i)= 1; (i) <= (n); (i)++)
#define RREP(i, n) for(ll(i)= (n - 1); (i) >= 0; (i)--)
#define RREPS(i, n) for(ll(i)= (n); (i) > 0; (i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define YES(n) ((n) ? "YES" : "NO")
#define Yes(n) ((n) ? "Yes" : "No")
#define yes(n) ((n) ? "yes" : "no")

template <class T>
inline void chmin(T& a, T b) {
    if(a > b) { a= b; }
}

template <class T>
inline void chmax(T& a, T b) {
    if(a < b) { a= b; }
}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    ll X;
    cin >> X;
    cout << 1 - X << "\n";
}

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

using lint = long long;
template <typename T> using V = vector<T>;
template <typename T> using VV = vector<vector<T>>;
#define rep(i, n) for(int i = 0; i < int(n); i++)
#define repu(i, a, b, s) for(int i = int(a); i < int(b); i += int(s))
#define repd(i, a, b, s) for(int i = int(a); i > int(b); i += int(s))
#define endl "\n"
constexpr lint INF = 2e18;
constexpr lint MOD = 1e9 + 7;

lint test[129 * 1000000];
lint grid[10000][10000];
lint dp[3001][3001][4];

void solve() {
    lint R, C, K;
    cin >> R >> C >> K;

    rep(i, R) {
        rep(j, C) { grid[i][j] = -1; }
    }

    rep(i, K) {
        lint r, c, v;
        cin >> r >> c >> v;
        r--;
        c--;
        grid[r][c] = v;
    }

    rep(y, R) {
        rep(x, C) {
            rep(i, 4) { dp[y][x][i] = 0; }
        }
    }

    if(grid[0][0] != -1)
        dp[0][0][1] = grid[0][0];

    rep(y, R) {
        rep(x, C) {

            // 選ばない
            if(0 <= y - 1) {
                rep(i, 4) { dp[y][x][0] = max(dp[y][x][0], dp[y - 1][x][i]); }
            }
            if(0 <= x - 1) {
                rep(i, 4) { dp[y][x][i] = max(dp[y][x][i], dp[y][x - 1][i]); }
            }

            // 選ぶ
            if(grid[y][x] != -1) {
                if(0 <= y - 1) {
                    rep(i, 4) {
                        dp[y][x][1] =
                            max(dp[y][x][1], dp[y - 1][x][i] + grid[y][x]);
                    }
                }
            }
            if(0 <= x - 1) {
                repu(i, 1, 4, 1) {
                    dp[y][x][i] =
                        max(dp[y][x][i], dp[y][x - 1][i - 1] + grid[y][x]);
                }
            }
        }
    }

    lint ans = -INF;
    rep(i, 4) { ans = max(ans, dp[R - 1][C - 1][i]); }
    cout << ans << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
    return 0;
}


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

int main(){
    string s, t;
    cin >> s;
    cin >> t;
    int ans = 0;
    for(int i = 0; i < (int)s.length(); i++){
        if(s[i] != t[i]) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;



signed main()
{
    int n, m;
    
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
}


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

typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define ALL(obj) (obj).begin(), (obj).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

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

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

int main() {
    cout<<fixed<<setprecision(10);

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

    map<ll,ll> aa;
    for(auto e:a){
        aa[e] += aa[e] + 1;
    }

    ll ans = 0;

    // map<ll,ll> m;
    set<ll> s;

    for(auto p:aa){
        ll num, cnt;
        tie(num, cnt) = p;

        if(cnt == 1){
            auto dv = divisor(num);
            bool ok = false;
            for(auto e:dv){
                if(s.count(e)){
                    ok = true;
                    break;
                }
            }
            if(!ok){
                ans++;
            }
        }
        s.insert(num);
    }



    cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 26604
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;
ll n;
int num[21];
int temp[21];
int t = 0;
void init()
{
    scanf("%lld",&n);
    while(n)
    {
        temp[++t] = n % 10;
        n /= 10;
    }
    for(int i = t ; i >= 1 ; i --)
        num[t - i + 1] = temp[i];
}
int main()
{
    init();
    bool is_ne = 0;
    for(int i = 2 ; i <= t ; i ++)
        if(num[i] < 9)
        {
            is_ne = 1;
            break;
        }
    int ans = 0;
    if(!is_ne)
    {
        for(int i = 1 ; i <= t ; i ++)
            ans += num[i];
    }
    else
    {
        ans = num[1] - 1 + (t - 1) * 9;

    }
    printf("%d\n",ans);
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

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(); // 毒入りの美味しいクッキー
		/*
		    なるべくCをたくさん食べたい。
		    ただし、Cを食べられる枚数は、A+B+1枚まで
		*/
		int eatableC = Math.min(A+B+1, C);
		
		int count = B + eatableC;
        
        System.out.println(count);
	}
}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
const int maxn=0x7fffff;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	int n=b/a;
	if(n>=c){
		cout<<c;
	}
	else{
		cout<<n;
	}
	return 0;
}


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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;
struct result{
  lll sum;
  lll num;
};
result calpsum(lll ppos,lll n,lll k,vector<lll> x){
  result r;
  lll ii,jj;
  r.sum = 0;
  r.num = 0;

  for(ii=ppos;ii<n;ii++){
    if(ii==ppos){
      r.sum += x[ii];
    }
    else{
      r.sum += x[ii] - x[ii-1];
    }
    r.num ++;
    if(r.num >= k){
      break;
    }
  }
  
  return r;
}

result calnsum(lll npos,lll n,lll k,vector<lll> x){
  result r;
  lll ii;
  
  r.num = 0;
  r.sum = 0;
  
  for(ii=npos;ii>=0;ii--){
    if(ii==npos){
      r.sum += abs(x[ii]);
    }
    else{
      r.sum += abs(x[ii] - x[ii-1]);
    }
    r.num ++;
    if(r.num >= k){
      break;
    }
  }
  
  return r;
}
int main(){
  lll ii,jj,kk,lNum,rNum,min,sum;
  lll n,k;
  vector<lll> x;

  cin >> n >> k;

  min = LONG_LONG_MAX;
  x.resize(n);


  
  for(ii=0;ii<n;ii++){
    cin >> x[ii];
  }

  for(ii=0;ii<=n-k;ii++){
    lNum = x[ii];
    rNum = x[ii+k-1];
    if(lNum < 0 && rNum < 0){
      sum = abs(lNum);
    }
    else if(lNum < 0 && rNum >= 0){
      //小さい方に先に行く
      if(abs(lNum)<=abs(rNum)){
	sum = 2*abs(lNum) + abs(rNum);
      }
      else{
	sum = abs(lNum) + 2*abs(rNum);
      }
	  
    }
    else if(lNum >=0 && rNum >= 0){
      sum = rNum;
    }
    if(sum < min){
      min = sum;
    }
  }

  cout << min << endl;

  return 0;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int n = sc.nextInt();
    int ans = 0;

    if(d == 0){
      if(n < 100){ans = n;}
      else{ans = n + 1;}
    }else if(d == 1){
      if(n < 100){ans = 100 * n;}
      else{ans = 100 * 101;}
    }else{
      if(n < 100){ans = 10000 * n;}
      else{ans = 10000 * 101;}
    }

    System.out.println(ans);
  }
}


Measured memory_bytes: 22868
#include<iostream>
#include<vector>
#include<limits.h>
#define ll long long
using namespace std;
int main()
{
	int n,w;
	cin>>n>>w;
	int i,j,k;
	
	ll price[n];
	int weight[w+1];
	
	for(i=0;i<n;i++)
	{
		cin>>weight[i]>>price[i];
	}

	ll dp[n][w+1];
	for(i=0;i<n;i++)
	{
		dp[i][0] = 0;
	}
	for(j=0;j<=w;j++)
	{
		if(weight[0] <= j)
		dp[0][j] = price[0];
		else
		dp[0][j] = 0;
	}	
	
	
	for(i=1;i<n;i++)
	{
		for(j=1;j<=w;j++)
		{
			if(weight[i]  <= j)
			{
				dp[i][j] = max( price[i] +  dp[i-1][j - weight[i]]  , dp[i-1][j]);
			}
			else
			{
				dp[i][j] = dp[i-1][j];
			} 
		}
	}

	cout<<dp[n-1][w];
}

Measured memory_bytes: 78336
#include <iostream>
#include <cstdint>

using i64 = std::int64_t;

constexpr i64 Mod = 1e9 + 7;

int main() {
	i64 n, k;
	std::cin >> n >> k;

	i64 ans = 0;
	for (i64 i = k; i <= n + 1; ++i) {
		(ans += i * (n - i + 1) + 1) %= Mod;
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;

int main(){
    double L, l, V;
    std::cin >> L;

    l = L/3.0;
    V = pow(l, 3.0);

    std::cout << std::fixed;
    std::cout << std::setprecision(7) << V;
}

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

struct data{
    int id;
    int time;
    bool log;
    data(){}
    data(int a,int t,int b):id(a),time(t),log(b){}
    bool operator<(const data& r) const{
        return id == r.id ? time < r.time : id < r.id;
    }
};

typedef vector<data>::iterator V;

int main(){
    int N,M,n,m,r,i,j,q,b,e,c,s,t;
    while( cin>>N>>M, N||M ){
        cin >> r;
        vector< data > v(r);
        for(i=0;i<r;i++){
            cin>>t>>n>>m>>s;
            m--;
            v[i] = data(m,t,s);
        }
        sort(v.begin(), v.end());
        cin >> q;
        for(i=0;i<q;i++){
            cin>>b>>e>>m;
            b-=540; e-=540;
            m--;
            V low = lower_bound(v.begin(), v.end(), data(m,0,0));
            V up = lower_bound(v.begin(), v.end(), data(m+1,0,0));
            vector<int> in(720,0);
            for(V it = low; it != up; it++){
                if(it->log) in[it->time-540]++;
                else in[it->time-540]--;
            }
            j = 0,c = 0;
            for(t=0;t<e;t++){
                j += in[t];
                if( b <= t && t < e && j ){
                    c++;
                }
            }
            cout << c << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXSIZE=10000020;
const ll INF=0x3f3f3f3f3f3f3f3fLL;
int bufpos;
char buf[MAXSIZE];
#define NEG 1
void init(){
	#ifdef LOCAL
		freopen("C.txt","r",stdin);
	#endif
	buf[fread(buf,1,MAXSIZE,stdin)]='\0';
	bufpos=0;
}
#if NEG
int readint(){
	bool isneg=0;
	int val=0;
	for(;!isdigit(buf[bufpos]);bufpos++)
		if (buf[bufpos]=='-')
			isneg=1;
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return isneg?-val:val;
}
#else
int readint(){
	int val=0;
	for(;!isdigit(buf[bufpos]);bufpos++);
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return val;
}
#endif
char readchar(){
	for(;isspace(buf[bufpos]);bufpos++);
	return buf[bufpos++];
}
int readstr(char* s){
	int cur=0;
	for(;isspace(buf[bufpos]);bufpos++);
	for(;!isspace(buf[bufpos]);bufpos++)
		s[cur++]=buf[bufpos];
	s[cur]='\0';
	return cur;
}
int a[100002];
ll dp[100002][4];
inline void tense(ll &x,ll y){
	if (x<y)
		x=y;
}
int main(){
	init();
	int n=readint();
	for(int i=1;i<=n;i++){
		a[i]=readint();
		// printf("%d\n",a[i]);
	}
	for(int i=0;i<=n+1;i++)	
		for(int j=0;j<4;j++)
			dp[i][j]=-INF;
	dp[1][0]=0;
	for(int i=1;i<=n;i++){
		int sgn=1;
		for(int j=0;j<3;j++){
			// printf("dp[%d][%d]=%lld\n",i,j,dp[i][j]);
			//0 0
			tense(dp[i+1][j],sgn*a[i]+dp[i][j]);
			//0 1
			if (j)
				tense(dp[i+1][j-1],sgn*a[i]+dp[i][j]);
			//1 0
			if (a[i]<0)
				tense(dp[i+1][j+1],sgn*a[i]+dp[i][j]);
			sgn=-sgn;
		}
	}
	printf("%lld",dp[n+1][0]);
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n;
    cin >> n;
    int p[101][3];
    rep(i,n){
        cin >> p[i][0] >> p[i][1] >> p[i][2];
    }
    int ans,ansx,ansy,h;
    bool out;
    rep(i,101){
        rep(j,101){
            out = false;
            rep(k,n){
                if (p[k][2] == 0) continue;
                h = p[k][2]+abs(p[k][0]-i)+abs(p[k][1]-j);
                break;
            }
            rep(k,n-1){
                if (p[k][2] == 0){
                    if (h - abs(p[k][0]-i)-abs(p[k][1]-j) > 0) out = true;
                    continue;
                }
                if (p[k+1][2] == 0) continue;
                if (p[k][2]+abs(p[k][0]-i)+abs(p[k][1]-j) != p[k+1][2]+abs(p[k+1][0]-i)+abs(p[k+1][1]-j)) out = true;
            }
            if (!out){
                ans = h;
                ansx = i;
                ansy = j;
                break;
            }
        }
    }
    PRINT(ansx << " " << ansy << " " << ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
//printf("%.12lf\n",mid);
//const long long sze = 2*(2^(long long)(ceil(log(100000)/log(2))));
/*
// get part of decimal
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
const long long mod = 1000000007;
const double eps = .0000000001;
inline void prep()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
};

int main(){
    prep();
    int n;
    cin >> n;
    bitset<30> bs(n);
    
    vector<int> ones;
    int cnt = 0; 
    for (int i=0; i<=30; i++){
      if (bs[i] == 1){
        ones.push_back(cnt);
      }
      cnt++;
    }
    int verts = ones[ones.size()-1]+1;
    int lastone = ones[ones.size()-1];
    long long lastval = pow(2, lastone+1);
    vector<pair<int, pair<int, int> > > toprint;
    int currind = ones.size()-2;
    int sum = 0;
    for (int i=1; i<=verts-1; i++){
      if (lastone-ones[currind] == i && currind > -1){
        toprint.push_back({0, {i, i+1}});
        toprint.push_back({sum+1, {i, i+1}});
        sum += sum+1;
        toprint.push_back({sum+1, {1, i+1}});
        sum = sum+1;
       
        currind--;
        
      }else{
        toprint.push_back({0, {i, i+1}});
        toprint.push_back({sum+1, {i, i+1}});
        sum += sum+1;
      }
    }
    
    cout << verts << " " << 2*lastone+ones.size()-1 << endl;
    for (int i=0; i<toprint.size(); i++){
      cout << toprint[i].second.first << " " << toprint[i].second.second << " " << toprint[i].first << endl;
    }
    return 0;
}      

Measured memory_bytes: 256
str=input()
char_list = list(str)
N=len(char_list)

tmp=0
max=0
for i in range(N):
    if char_list[i] in ['A' , 'T' , 'G' , 'C']:
        tmp+=1
        if tmp>max:
            max=tmp
    else: tmp=0

print(max)

Measured memory_bytes: 3060
using System;

namespace Aizu {
    class OnlineJudge {
        static void Main() {
            var b = new TimeSpan(2, 0, 0);
            for (int[] i; (i = Array.ConvertAll(Console.ReadLine().Split(), int.Parse))[0] != -1;) {
                var s = b.Subtract(new TimeSpan(i[0], i[1], i[2]));
                Console.WriteLine("{0}\n{1}", s, new TimeSpan(s.Ticks * 3));
            }
        }
    }
}

Measured memory_bytes: 9156
#190901B
A, B = map(int, input().split())
ans=0
if B == 1:
    ans = 0
else:
    if A == 2:
        ans = B -1
    else:
        if B%(A-1)==1:
            ans = (B-1)//(A-1)
        else:
            ans = (B-1)//(A-1)+1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<utility>
#include<deque>
#include<iomanip>
#include<ctime>
#include<bitset>
using namespace std;

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

	vector<int> A(N);
	unsigned int total = 0;

	for (unsigned int i = 0; i < A.size(); i++)
	{
		cin >> A[i];
		total += A[i];
	}

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

	float base = total / (4.0F * M);
	unsigned int count = 0;

	for (unsigned int i = (unsigned int)(A.size() - 1); i >= 0; i--)
	{
		if (A[i] >= base)
		{
			count++;

			if (count >= M)
			{
				cout << "Yes" << endl;
				break;
			}
		}
		else
		{
			cout << "No" << endl;
			break;
		}
	}

	return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;


int main()
{
  ll K; scanf("%lld", &K);
  int N = 50;
  vector<ll> v(N);
  for (int i = 0; i < N; ++i) { v[i] = i; }
  ll d = K / 50;
  for (int i = 0; i < N; ++i) { v[i] += d; }
  for (int cnt = 0; cnt < (K % 50); ++cnt) {
    v[cnt] += N + 1;
    for (int i = 0; i < N; ++i) { --v[i]; }
  }

  printf("%d\n", N);
  printf("%lld", v[0]);
  for (int i = 1; i < N; ++i) {
    printf(" %lld", v[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  vector<int>L(3);
  for(int i=0;i<3;i++){
    cin>>L.at(i);
  }
  sort(L.begin(),L.end());
  cout<<L.at(0)*L.at(1)/2<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define N 100
using namespace std;

void trace(int A[], int n) {
  int i;
  rep(i,n) {
    cout << A[i];
    if (i < n-1) cout << " ";
  }
  cout << endl;
}

int main () {
  int n, A[N], count = 0;
  int i, j, tmp;
  // input
  cin >> n;
  rep(i,n)  cin >> A[i];

  // sort
  for (i = 0;i < n;i++) {
    for (j = n-1; j > i; j--) {
      if (A[j] < A[j-1]) {
	count++;
	tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
      }
    }
  }
  
  trace(A,n);
  cout << count << endl;
}

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

inline int addTax(int x, int p) {
    return x * (100 + p) / 100;
}

int main() {
    int x, y, sum;
    while (cin >> x >> y >> sum && (x || y || sum)) {
        int mx = 0;
        int t = sum * 100 / (100 + x);
        for (int a=1; a<=t; ++a) {
            for (int b=t-a; b<=t-a+2; ++b) {
                if (addTax(a, x) + addTax(b, x) == sum) {
                    mx = max(mx, addTax(a, y) + addTax(b, y));
                }
            }
        }
        cout << mx << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define pii pair<int,int>
#define eb emplace_back
#define MOD 1000000007
#define int long long
using namespace std;
#define s second
#define f first

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int ans = 1;
    for(int i=1; i<=n; i++)
    {
        ans = (ans * i)%MOD;
    }
    cout << ans;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
  int N;
  cin>>N;
  VI A(N);
  rep(i,N) cin>>A[i];
  sort(all(A));
  int ans=1;
  if(A[N-1]-A[0]>1) ans=0;
  else if(A[N-1]==A[0]){
    if(N<A[0]*2&&N-1!=A[0]) ans=0;
  }else{
    int X=A.end()-lower_bound(all(A),A[N-1]);
    ans=0;
    if(X>=2*(A[N-1]-N+X)&&N-X<A[N-1]) ans=1;
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

#define rep(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define SZ(x) ((int) (x).size())
typedef long long ll;

int main(){
	string str, ans;
	cin >> str;
	rep(i,0,SZ(str)) {
		if(str[i]!='B') ans+=str[i];
		else {
			if(SZ(ans)>0) ans.resize(SZ(ans)-1);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  int n, cnt = 0, i, j;
  scanf("%d", &n);
  typedef struct dat{
    char in[4];
    char mrk;
    int num;
    int odr;
  }T_dat;
  T_dat *dat1, *dat2;
  dat1 = (T_dat *)malloc(sizeof(T_dat) * n);
  dat2 = (T_dat *)malloc(sizeof(T_dat) * n);
  for(i = 0; i < n; i++)
    scanf("%s", dat1[i].in);
  for(i = 0; i < n; i++){
    if(dat1[i].in[0] == 'J' & dat1[i].in[0] == 'K'){
      dat1[i].mrk = 'J';
      dat1[i].num = 0;
    }
    else if(dat1[i].in[0] == 'S' | dat1[i].in[0] == 'H' | dat1[i].in[0] == 'D' | dat1[i].in[0] == 'C')
      dat1[i].mrk = dat1[i].in[0];
    else
      dat1[i].mrk = '-';
    if(strlen(dat1[i].in) < 3){
      if(dat1[i].in[1] >= '1' & dat1[i].in[1] <= '9')
	dat1[i].num = dat1[i].in[1] - '0';
      else if(dat1[i].in[1] == 'J' | dat1[i].in[1] == 'j')
	dat1[i].num = 11;
      else if(dat1[i].in[1] == 'Q' | dat1[i].in[1] == 'q')
	dat1[i].num = 12;
      else if(dat1[i].in[1] == 'K' | dat1[i].in[1] == 'k')
	dat1[i].num = 13;
      else if(dat1[i].in[1] == 'A' | dat1[i].in[1] == 'a')
	dat1[i].num = 1;
      else
	dat1[i].num = 0;
    }
    else if(dat1[i].in[1] == '1' & dat1[i].in[2] >= 0 & dat1[i].in[2] <= 3)
      dat1[i].num = 10 + dat1[i].in[2] - '0';
    else
      dat1[i].num = 0;
    dat1[i].odr = i;
    dat2[i] = dat1[i];
  }
  for(i = 0; i < n - 1; i++)
    for(j = n - 1; j > i; j--)
      if(dat1[j - 1].num > dat1[j].num){
	T_dat tmp = dat1[j - 1];
	dat1[j - 1] = dat1[j];
	dat1[j] = tmp;
	//	cnt++;
      }
  for(i = 0; i < n - 1; i++){
    int jmin = i;
    for(j = i + 1; j < n; j++){
      if(dat2[j].num < dat2[jmin].num)
	jmin = j;
    }
    if(jmin != i){
      T_dat tmp = dat2[i];
      dat2[i] = dat2[jmin];
      dat2[jmin] = tmp;
      //      cnt++;
    }
  }
  int P = 0;
  int P_apr[13];
  for(i = 0; i < 13; i++)
    P_apr[i] = 0;
  printf("%c%d", dat1[0].mrk, dat1[0].num);
  P_apr[dat1[0].num - 1] = 1;
  for(i = 1; i < n; i++){
    printf(" %c%d", dat1[i].mrk, dat1[i].num);
    if(P_apr[dat1[i].num - 1]){
      for(j = 0; j < i; j++)
	if(dat1[i].num == dat1[j].num & dat1[j].odr > dat1[i].odr)
	  P = 1;
    }
    else
      P_apr[dat1[i].num - 1] = 1;
  }
  printf("\n");
  if(!P)
    printf("Stable\n");
  else
    printf("Not stable\n");
  P = 0;
  for(i = 0; i < 13; i++)
    P_apr[i] = 0;
  printf("%c%d", dat2[0].mrk, dat2[0].num);
  P_apr[dat2[0].num - 1] = 1;
  for(i = 1; i < n; i++){
    printf(" %c%d", dat2[i].mrk, dat2[i].num);
    if(P_apr[dat2[i].num - 1]){
      for(j = 0; j < i; j++)
	if(dat1[i].num == dat1[j].num & dat2[j].odr > dat2[i].odr)
	  P = 1;
    }
    else
      P_apr[dat2[i].num - 1] = 1;
  }
  printf("\n");
  if(!P)
    printf("Stable\n");
  else
    printf("Not stable\n");
  //  printf("%d\n", cnt);
  return 0;
}

Measured memory_bytes: 612
#include<time.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}

int main(void){
    int n;
    cin>>n;
    if (n%2==1)n*=2;
    
    cout<<n;

}




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

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

fn main() {
  let s = read::<String>();
  let has_2 = s.chars().collect::<HashSet<_>>();

  if has_2.len() != 2 {
    println!("No");
    return;
  }

  for w in has_2 {
    if s.match_indices(w).count() != 2 {
      println!("No");
      return;
    }
  }
  println!("Yes");
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cstdlib>
#include<iomanip>
#include<queue>
#include<set>



//expr(at the last, operate + or -)
//term(then, judge the symble * and / next to digit first)
//fact(first, judge the symble if () or digit)

using namespace std;

string str;
string::iterator it;

int term();
int fact();

int expr()
{
    int p = term();
    
    while( *it == '+' || *it == '-' )
    {
        if( *it == '+' )
        {
            it++;
            
            int q = term();
            
            p += q;
        }
        else
        {
            it++;
            int q = term();
            p -= q;
        }
    }
    
    return p;
}

int term()
{
    int p = fact();
    
    while( *it == '*' || *it == '/' )
    {
        if( *it == '*' )
        {
            it++;
            
            int q = fact();
            
            p *= q;
        }
        else
        {
            it++;
            
            int q = fact();
            
            p /= q;
        }
    }
    
    return p;
}

int fact()
{
    if( *it == '(' )
    {
        it++;         //turn to the number next to "("
        
        int p = expr();
        
        it++;
        
        return p;
    }
    else
    {
        int p = 0;
        
        while(isdigit(*it))
        {
            p *= 10;
            p += *it - '0';
            it++;
        }
        
        return p;
    }
}

int main()
{
    int n;
    
    cin>>n;
    
    while(n--)
    {
        cin>>str;
        
        str[str.size() - 1] = '\0';
        
        it = str.begin();
        
        cout<<expr()<<endl;
    }
    
    return 0;
}

/**
 * expr ::= term { ( '+' | '-' ) term }
 * term ::= fact { ( '*' | '/' ) fact }
 * fact ::= '(' expr ')' | digit
 **/

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fastio        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll            long long
#define fl            long double
#define pll           pair<ll,ll>
#define onebits(x)    __builtin_popcountll(x)
#define fbo(x)        find_by_order(x)
#define ook(x)        order_of_key(x)
#define pb            push_back
#define mk            make_pair
#define endl          "\n"
#define ff            first
#define ss            second
#define mt            make_tuple
#define np            next_permutation
#define pi            3.141592653589793238
#define deb(x)        cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define vll           vector<ll>
#define vp            vector<pair<ll,ll>>
#define all(x)        x.begin(),x.end()
#define rall(x)       x.rbegin(),x.rend()
#define revpq         priority_queue <int, vector<int>, greater<int>>
#define pq            priority_queue<ll>
#define ps(x,y)       fixed<<setprecision(y)<<x
const ll mod = 1e9 + 7;
const ll INF = 1e18;
const ll MAXN = 200005;
ll power(ll a, ll b) {ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) {if (b & 1)res = res * a % mod % mod; a = a * a % mod;} return res;}

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


int main()
{
    fastio;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ll i, j, t, k, l, r, tp, n, m;

    cin >> n >> m >> t;
    ll cn = n / m;
    if (n % m != 0)
    {
        cn++;
    }
    cout << cn*t << endl;
    return 0;
}

Measured memory_bytes: 3628
// AOJ 1067 Cutting a Chocolate
// 2018.3.17 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//#define getchar_unlocked()  getchar()
int in()        // get a non-negative integer from stdin
{
	int n = 0, c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	return n;
}

double dbl()    // get a non-negative real number from stdin  
{
	double x, y;
	int n = 0, c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	x = n;
	if (c == '.') {
		y = 1, c = getchar_unlocked();
		do y *= 0.1, x += y * (c & 0xf), c = getchar_unlocked(); while (c >= '0');
	}
	return x;
}

#define EQ(a,b)   (fabs(a-b)<1e-7)

typedef struct { double x, y; } P;
P p[30002];

int hl[30002], hr[30002], s[30002], a[30002];

int binary_search(int *tbl, int hi, int k, int key)
{
	int lo = 0, mi, r;

    while (lo < hi) {
        mi = (lo + hi) >> 1;
		r = tbl[mi]*k - key;
		if (!r) return mi;
        if (r < 0) lo = mi + 1; else hi = mi;
    }
	return lo-1;
}

int cmp(P *a, P *b)
{
	if (!EQ(a->y, b->y)) { if (a->y <= b->y) return -1;	return 1; }
	if (EQ(a->x, b->x)) return 0; if (a->x <= b->x) return -1; return 1;
}

int main()
{
	int n, m, w, h, S, ans;
	int i, j;
	double x, y, y1, y2;

	while (n = in()) {
		m = in(), w = in(), h = in(), S = (w*h-in()) << 1;
		for (i = 0; i < m; i++) {
			hl[i] = in(), hr[i] = in(), a[i] = 0;
			s[i] = hl[i] + hr[i];
		}
		for (i = 0; i < n; i++) p[i].x = dbl(), p[i].y = dbl();
		qsort(p, n, sizeof(P), cmp);

		j = 0; for (i = 0; i < n; i++) {
			if (j < 0) j = 0;
			x = p[i].x, y = p[i].y;
			while (1) {
				if (j == 0) y1 = 0;
				else y1 = (hr[j-1] - hl[j-1]) * x / w + hl[j-1];
				y2 = (hr[j] - hl[j]) * x / w + hl[j];
				if (y1 < y && y < y2) break;
				while (y < y1) {
					j--;
					if (j == 0) y1 = 0;
					else y1 = (hr[j-1] - hl[j-1]) * x / w + hl[j-1];
					y2 = (hr[j] - hl[j]) * x / w + hl[j];
					if (y1 < y && y < y2) goto done;
				}
				j++;
			}
done:		a[j]++;
		}
		for (i = 1; i < m; i++) a[i] += a[i-1];

		if (S == 0) { printf("%d\n", n); continue; }
		else if (S == 2*w*h) { puts("0"); continue; }

		j = binary_search(s, m, w, S); ans = a[j++];
		i = 0; while (j < m) {
			while ((s[j] - s[i])*w > S) i++;
			if (a[j] - a[i] > ans) ans = a[j] - a[i];
			j++;
		}
		printf("%d\n", n - ans);
	}
	return 0;
}



Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int INF = 1 << 30;
ll A[1000];
ll B[1000];
ll C[1000];
int idx[1000];
int main() {
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	for (int i = 0; i < X; i++) cin >> A[i];
	for (int i = 0; i < Y; i++) cin >> B[i];
	for (int i = 0; i < Z; i++) cin >> C[i];
	vector<ll> vec;
	for (int i = 0; i < Y; i++) {
		for (int j = 0; j < Z; j++) {
			vec.push_back(B[i] + C[j]);
		}
	}
	sort(A, A + X, greater<ll>());
	sort(vec.begin(), vec.end(), greater<ll>());
	for (int i = 0; i < K; i++) {
		int x = -1;
		for (int j = 0; j < X; j++) {
			if (idx[j] < Y*Z) {
				if (x == -1 || A[x] + vec[idx[x]] < A[j] + vec[idx[j]]) {
					x = j;
				}
			}
		}
		cout << A[x] + vec[idx[x]] << endl;
		idx[x]++;
	}
}


Measured memory_bytes: 10476
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+9, INF = 0x3f3f3f3f;
int dt[105], ans = 0;

void bubbleSort( int n ) {
    bool ok = true;
    while( ok ) {
        ok = false;
        for( int i = n - 1; i >= 1; --i ) {
            if( dt[i] < dt[i - 1] ) swap( dt[i], dt[i - 1] ), ok = true, ++ans;
        }
    }
}

int main( void ) {
    ios::sync_with_stdio( false );
    int n;
    cin >> n;
    for( int i = 0; i < n; ++i ) cin >> dt[i];
    bubbleSort( n );
    for( int i = 0; i < n; ++i ) cout << dt[i] << ( i == n - 1 ? '\n' : ' ' );
    cout << ans << '\n';
    return 0;
}



Measured memory_bytes: 3228
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(X);
    cout<<10-(X/200)<<endl;

//-----------------------------------------------------------------------------------------------------------//


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 3772
n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1, n+1):
    for j in range(i, n+1):
        r = min(
            abs(i-j),
            abs(x-i) + 1 + abs(y-j),
            abs(y-i) + 1 + abs(x-j)
        )
        ans[r] += 1

print("\n".join(map(str, ans[1:])))



Measured memory_bytes: 45916
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
ll n;
int st[20],tp=0;
int main() {
    cin>>n;
    while(n) st[++tp]=n%10,n/=10;
    int fl=1;
    for(int i=1;i<tp;i++) if(st[i]<9) fl=0;
    int ans=(tp-1)*9+st[tp]-1;
    if(fl) ++ans;
    printf("%d\n",ans);
    return 0;
}


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


int main(){
    string S;
    cin >> S;
  
    if((S[0]==S[1]&&S[2]==S[3]&&S[0]!=S[3])||(S[0]==S[2]&&S[1]==S[3]&&S[0]!=S[1])||(S[0]==S[3]&&S[1]==S[2]&&S[0]!=S[1])){
        cout<<"Yes"<<"\n";
    }else{
        cout<<"No"<<"\n";
    }
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (int i = 0; i < n; i++)
#define IREP(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(a, b) for (int i = a; i < b + 1; i++)
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define int long long
using namespace std;
typedef long long ll;

signed main() {
	int n;
	cin >> n;
	map<int,int> m;
	REP(i,n){
		int b;
		cin >> b;
		m[b]+=1;
	}
	int max=0;
	for(auto itr:m){
		int tmp=itr.second;
		auto a=m.find(itr.first-1);
		auto b=m.find(itr.first+1);
		if(a!=m.end()){
			tmp+=a->second;
		}
		if (b != m.end())
		{
			tmp += b->second;
		}
		if(max<tmp){
			max=tmp;
		}
	}
	cout << max << endl;
}

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

int main() {
	
	ll x; cin >> x;
	ll ans = 0;
	ll m = 100;
	double r = 0.01;
	while (true) {
		if (x <= m) {
			break;
		}
		m *= (1 + r);
		ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main(void){

  int N,K;
  
  char S[51];

  scanf("%d %d\n",&N,&K);
  
  scanf("%s\n",S);
  
  for(int i=0;i<N;i++){
  	if(i!=K-1){
    	printf("%c",S[i]);
    }else{
    	printf("%c",S[i]+32);
    }
  }


  return 0;
}

Measured memory_bytes: 128
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << "[" << pa.first << ", " << pa.second << "]";
}

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

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;


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

  std::string s;

  ll x,y;

  std::cin>>s>>x>>y;

  //0 x
  std::vector<std::vector<ll>> len(2);

  ll now=0,cnt=0;
  rep(i,0,s.size()){
    if(s[i]=='T'){
      len[now].push_back(cnt);
      cnt=0;
      now=(now^1);
    }else{
      cnt++;
    }
  }

  len[now].push_back(cnt);

  std::vector<std::vector<bool>> used(len[0].size(),std::vector<bool>(16010,false));

  ll mid=8005;

  used[0][mid+len[0][0]]=true;

  rep(i,1,len[0].size()){
    rep(j,0,16010){
      used[i][j]=(j>=len[0][i]&&used[i-1][j-len[0][i]])|(j<16010-len[0][i]&&used[i-1][j+len[0][i]]);
    }
  }

  if(!used[len[0].size()-1][mid+x]){
    std::cout<<"No\n";
    return 0;
  }

  if(len[1].empty()){
    std::cout<<"Yes\n";
    return 0;
  }

  used[0][mid+len[0][0]]=false;
  used[0][mid+len[1][0]]=true;
  used[0][mid-len[1][0]]=true;

  rep(i,1,len[1].size()){
    rep(j,0,16010){
        used[i][j]=(j>=len[1][i]&&used[i-1][j-len[1][i]])|(j<16010-len[1][i]&&used[i-1][j+len[1][i]]);
    }
  }

  if(used[len[1].size()-1][mid+y]){
    std::cout<<"Yes\n";
  }else{
    std::cout<<"No\n";
  }

  return 0;
}






Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
#define all(x) begin(x),end(x)
int main(){
    int N,K,X,Y=3;
    vector<int>ame(Y);
    cin>>ame.at(0)>>ame.at(1)>>ame.at(2);
    sort(all(ame));
    if(ame.at(2)==ame.at(1)+ame.at(0))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
                                                                                                
  
int main(void){
                                                                                                
   
    int a, b, c;
   
      
    scanf("%d %d %d", &a, &b, &c );

    if( a <= c && c <= b ){

        printf("Yes\n");

        return 0;

        }
   

    else printf("No\n");


    return 0;
                                                          
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest._700problems
{
    class ARC_058
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            long[] nxyz = ReadLongs();
            long n = nxyz[0];
            long[] xyz = new long[3] { nxyz[1], nxyz[2], nxyz[3] };
            long x = nxyz[1];
            long y = nxyz[2];
            long z = nxyz[3];
            long mask = 1000000000 + 7;
            long[] twoPows = new long[21];
            twoPows[0] = 1;
            for(long i = 1; i <=20; i++)
            {
                twoPows[i] = twoPows[i - 1]*2;
                twoPows[i] %= mask;
            }
            long pats = twoPows[x + y + z];
            long[,] dp = new long[n + 1, pats];
            dp[0, 0] = 1;
            for(long i = 0; i < n; i++)
            {
                for(long j = 0; j < pats; j++)
                {
                    for(long k = 1; k <= 10; k++)
                    {
                        long next = j * twoPows[k];
                        next += twoPows[k - 1];
                        next %= pats;
                        if ((next & twoPows[z-1]) > 0
                            && (next & twoPows[y+z - 1]) > 0
                            && (next & twoPows[x + y + z - 1]) > 0)
                        {
                            continue;
                        }

                        dp[i + 1, next] += dp[i, j];
                        dp[i + 1, next] %= mask;
                    }
                }
            }
            long res = 0;
            for (long i = 0; i <pats; i++)
            {
                res += dp[n,i];
                res %= mask;
            }
            long tens = 1;
            for (long i = 0; i < n; i++)
            {
                tens *= 10;
                tens %= mask;
            }
            res = (tens - res+mask)%mask;
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 52064
#include<bits/stdc++.h>
using namespace std;
int MAX = 1e6 + 10;
int main(){
  int N;
  cin >> N;
  vector<bool> is(MAX,false);
  vector<bool> two(MAX,false);
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
    if(is[vec[i]]){
      two[vec[i]] = true;
    }
    is[vec[i]] = true;
  }
  
  int cnt = N;
  for(int i=0; i<N; i++){
    for(int n=1; n*n<=vec[i]; n++){
      if(vec[i] %n == 0){
        if(n != 1 && is[vec[i]/n]){
          cnt--;
          break;
        }
        if(is[n] && vec[i] != 1){
          cnt--;
          break;
        }
        if(n == 1 && two[vec[i]]){
          cnt--;
          break;
        }
        if(vec[i] == 1 && two[1]){
          cnt--;
          break;
        }
      }
    }
  }
  cout << cnt << endl;
}    

Measured memory_bytes: 4224
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
using ll = long long;
using namespace std;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
//sort(a, a + N, greater<ll>())   // descend
//sort(a, a+N)                    //  ascend

/* 
void comb(vector<vector <ll> > &v) {
	ll mod=1000000007;
	rep (i,0,v.size()) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	rep (k,1,v.size()) {
		rep (j,1,k) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%mod;
		}
	}
}
/*main内でnCn~nC0 生成 **
vector<vector<ll> > v(n + 1, vector<ll>(n + 1, 0));
comb(v);
*/

int main() {
	bool p =true;
	ll n;
	cin>>n;
	ll a[110000];
	rep(i,0,n)cin>>a[i];
	sort(a,a+n);
	if(n%3==0){
		if(a[0]!=a[n/3-1] || a[n/3]!=a[2*n/3-1] || a[2*n/3]!=a[n-1])p=false;
		ll fuck=a[2*n/3]^a[0];
		if(a[n/3]!=fuck) p=false;
	}
	else if(a[n-1]==0 && n%3!=0) p=true;
	else p=false;

	if(p)cout<<"Yes";
	else cout<<"No";


}
















/* 
int main() {
	ll n,c,k;
	cin>>n>>c>>k;
	ll t[110000];
	rep(i,0,n)cin>>t[i];
	sort(t,t+n);
	ll time = t[0];
	ll cnt =0;
	rep(i,0,n){
		if(t[i]>time)  {cnt=i-1; break;}
	}*/



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int N,M;
vector<int> Graph[220000];
int dist[220000];

void DFS() {
  dist[0] = 0;
  queue<P> que;
  que.push(make_pair(0,0));
  while (!que.empty()) {
    P p = que.front();
    que.pop();
    if (p.S > dist[p.F]) {
      continue;
    }
    for (int i = 0; i < (int)Graph[p.F].size(); i++) {
      if (dist[Graph[p.F][i]] > p.S + 1) {
        dist[Graph[p.F][i]] = p.S + 1;
        que.push(make_pair(Graph[p.F][i],p.S+1));
      }
    }
  }
}

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

  for (int i = 0; i < N; i++) {
    dist[i] = 10000000;
  }

  DFS();

  if (dist[N-1] <= 2) {
    cout << "POSSIBLE" << endl;
  } else {
    cout << "IMPOSSIBLE" << endl;
  }
  return 0;
}

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

int main(){
    int N;  cin >> N;
    int S = 0;
    vector<int> A(N, 0);
    for(int i=0; i<N; i++){
        cin >> A[i];
        S += A[i];
    }

    vector<int> X(N, 0);
    X[0] = S;
    for(int i=1; i<N; i+=2){
        X[0] -= 2*A[i];
    }
    for(int i=1; i<N; i++){
        X[i] = 2*A[i-1] - X[i-1];
    }
    for(int x: X){
        cout << x << " ";
    }cout << endl;
}


Measured memory_bytes: 2048
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for(int i = 1; i <= n; i++) {
            if(i % 3 == 0) {
                System.out.print(" " + i);
            }else {
                for(int j = i; j > 0; j /=10) {
                    if(j % 10 == 3) {
                        System.out.print(" " + i);
                        break;
                    }
                }
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 28776