akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            switch (sc.next()) {
                case "SUN":
                    return 7;
                case "MON":
                    return 6;
                case "TUE":
                    return 5;
                case "WED":
                    return 4;
                case "THU":
                    return 3;
                case "FRI":
                    return 2;
                case "SAT":
                    return 1;
                default:
                 return null;
            }
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
}


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

/*alias*/
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using ll=long long;

using namespace std;

/*input*/
int a,p;

/*funcs*/


/*main*/
int main(){
cin>>a>>p;
int tot=a*3+p;
cout<<tot/2;    
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int a[7] = {1, 3, 5, 7, 8, 10, 12};
	int b[4] = {4, 6, 9, 11};
	int c[1] = {2};
	
	int x, y, groupx, groupy;
	scanf("%d%d", &x, &y);
	
	for(int i=0; i<=6; i++){
		if(x == a[i])groupx = 0;
		if(y == a[i])groupy = 0;
	}
	for(int i=0; i<=3; i++){
		if(x == b[i])groupx = 1;
		if(y == b[i])groupy = 1;
	}
	if(x == c[0])groupx = 2;
	if(y == c[0])groupy = 2;
	
	if(groupx == groupy){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;

			int min = 1 << 20;
			for (int z = 0; z <= n; z++) {
				if (n < z * z * z) break;
				for (int y = 0; y <= n; y++) {
					if (n < y * y + z * z * z) break;
					int x = n - y*y - z*z*z;
					if (x < 0) break;
					min = Math.min(min, x + y + z);
				}
			}

			System.out.println(min);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

string s;
bool check[100001];
bool ans[100001];

string a("dream");
string b("dreamer");
string c("erase");
string d("eraser");

bool f(int now)
{
	if(now == s.size()) return true;
	if(check[now]) return ans[now];
	check[now]=true;

	bool aa=false;
	if(now+5 <= s.size() && s.substr(now,5) == a) aa |= f(now+5);
	if(now+7 <= s.size() && s.substr(now,7) == b) aa |= f(now+7);
	if(now+5 <= s.size() && s.substr(now,5) == c) aa |= f(now+5);
	if(now+6 <= s.size() && s.substr(now,6) == d) aa |= f(now+6);
	return ans[now]=aa;
}

int main()
{
	cin>>s;
	bool res = f(0);
	if(res) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}


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

using namespace std;

int main() {
  int N, D, A;
  cin >> N >> D >> A;
  vector<pair<int, int>> M(N);
  for (auto &m : M) {
    cin >> m.first >> m.second;
  }
  sort(M.begin(), M.end());
  vector<int> right_m(N);
  for (int i = 0; i < N - 1; i++) {
    auto r = make_pair(M[i].first + 2 * D + 1, 0);
    right_m[i] = upper_bound(M.begin(), M.end(), r) - M.begin() - i;
  }
  vector<long long> damage(N);
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    if (i > 0) {
      damage[i] += damage[i - 1];
    }
    M[i].second -= damage[i];
    if (M[i].second <= 0) {
      continue;
    }
    long long count = (M[i].second + A - 1) / A;
    ans += count;
    damage[i] += count * A;
    if (i + right_m[i] < N) {
      damage[i + right_m[i]] -= count * A;
    }
  }
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    long long Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;
    
    long long q = Q * 8;
    long long h = H * 4;
    long long s = S * 2;
    long long d = D;
    long long a = min({q, h, s, d});
    long long ans = N / 2 * a;
    if (N & 1) {
        long long b = min({q, h, s}) / 2;
        ans += b;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
   //ios_base::sync_with_stdio(0);
   //cin.tie(0);
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	if(a[0] == 5 && a[1] == a[0] && a[2] == 7) cout << "YES" << endl;
	else cout << "NO" << endl;

   return 0;
}

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

int main()
{
	int64_t a, b, c, d, x, y, maximum, max1, max2;
	cin >> a >> b >> c >> d;

	max1 = max(a * c, a * d);
	max2 = max(b * c, b * d);
	maximum = max(max1, max2);
	cout << maximum;
}

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

using namespace std;
const long long MOD=1e9+7;
long long fanc[2000009], inv_fanc[2000009];

long long modpow(long long a, long long n, long long mod){
  long long ret = 1;
  while(n>0){
    if(n&1)ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}

long long modinv(long long a, long long mod){
  return modpow(a, mod-2, mod);
}

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

  fanc[0]=1;
  inv_fanc[0]=1;
  for(int i=1;i<=2000009;i++){
    fanc[i] = (fanc[i-1]*i)%MOD;
    inv_fanc[i] = modinv(fanc[i], MOD);
  }
  long long ans=0;
  long long n=s.length();
  for(int i=n-1;i<k+n;i++){
    long long add=modpow(25, i-(n-1), MOD);
    add = (add * fanc[i]) %MOD;
    add = (add * inv_fanc[i-(n-1)])%MOD;
    add = (add * inv_fanc[(n-1)])%MOD;
    add = (add * modpow(26, k+n-(i+1), MOD))%MOD;
    ans = (ans + add) %MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 35648
#include<stdio.h>

int work[200000][30];

int main(){
	int N,C,ans=0;
	scanf("%d%d",&N,&C);
	int s[N],t[N],c[N];
	
	for(int i=0;i<N;i++){
		scanf("%d%d%d",&s[i],&t[i],&c[i]);
		s[i]=s[i]*2-1;
		t[i]=t[i]*2;
		c[i]--;
		for(int j=s[i];j<t[i];j++)work[j][c[i]]=1;
	}
	
	for(int i=0;i<200000;i++){
		int c=0;
		for(int j=0;j<30;j++)if(work[i][j]==1)c++;
		if(c>ans)ans=c;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 24832
#include <iostream>
#include <set>
using ll = long long;

int main() {
  int n{0};
  std::set<char> S;
  char c;
  while (std::cin >> c, !std::cin.eof()) {
    S.insert(c);
    ++n;
  }
  std::cout << ((n == S.size()) ? "yes" : "no") << std::endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int POW[21];
	for(int i = 0; i <= 20; i++)POW[i] = pow(2,i);

	int N,M;
	scanf("%d %d",&N,&M);

	int* table = new int[N];
	int num[M];
	for(int i = 0; i < M; i++)num[i] = 0;

	int** ruisekiwa = new int*[M];
	for(int i = 0; i < M; i++){
		ruisekiwa[i] = new int[N];
		for(int k = 0; k < N; k++){
			ruisekiwa[i][k] = 0;
		}
	}

	for(int i = 0; i < N; i++){
		scanf("%d",&table[i]);
		table[i]--;
		num[table[i]]++;
		ruisekiwa[table[i]][i]++;
	}

	for(int i = 0; i < M; i++){
		for(int k = 1; k < N; k++){
			ruisekiwa[i][k] += ruisekiwa[i][k-1];
		}
	}

	int* dp = new int[POW[M]];

	for(int i = 0; i < POW[M]; i++)dp[i] = BIG_NUM;

	dp[0] = 0;

	int next_start_pos,next_state;
	stack<int> S;

	for(int i = 0; i < M; i++){
		next_state = POW[i];

		int tmp = num[i];
		tmp -= ruisekiwa[i][num[i]-1];
		dp[next_state] = tmp;
	}

	for(int state = 1; state < POW[M]; state++){

		next_start_pos = 0;
		for(int loop = 0; loop < M; loop++){
			if(state & (1 << loop)){
				next_start_pos += num[loop];
			}else{
				S.push(loop);
			}
		}

		while(!S.empty()){
			next_state = state+POW[S.top()];

			int tmp = num[S.top()];

			tmp -= (ruisekiwa[S.top()][next_start_pos+num[S.top()]-1]-ruisekiwa[S.top()][next_start_pos-1]);

			dp[next_state] = min(dp[next_state],dp[state]+tmp);

			S.pop();
		}
	}

	printf("%d\n",dp[POW[M]-1]);

	return 0;
}

Measured memory_bytes: 15672
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

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


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}


int main(){
    string s,t;
    int ans = 10000;
    cin >> s >> t;
    int lens = s.length();
    int lent = t.length();
    int now = 0;
    while(true){
        if(now+lent > lens) break;
        string u = s.substr(now,lent);
        int cnt = 0;
        for(int i = 0; i < lent; i++){
            if(u[i] != t[i]) cnt++;
        }
        ans = min(ans,cnt);
        now++; 
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
c1=0
c2=0
c3=0
c4=0
n=int(input())
for i in range(n):
  s=str(input())
  if s=="AC":
    c1+=1
  elif s=="WA":
    c2+=1
  elif s=="TLE":
    c3+=1
  elif s=="RE":
    c4+=1
print("AC x " +str(c1))
print("WA x " +str(c2))
print("TLE x " +str(c3))
print("RE x " +str(c4))


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

int main(){

    size_t n;
    std::cin >> n;
    
    std::vector<long long> b(n);
    size_t cnt_minus = 0;

    for(auto&& e : b){
        std::cin >> e;
        if(e < 0) cnt_minus++;
    }

    size_t sum = 0;
    size_t min_abs = std::numeric_limits<size_t>::max();
    for(const auto& e : b){
        if(e < 0){
            sum += -e;
        }else{
            sum += e;
        }

        min_abs = std::min<size_t>(min_abs, std::abs(e));
    }

    if(cnt_minus % 2 == 0){
        std::cout << sum << std::endl;
    }else{
        std::cout << sum - (min_abs * 2) << std::endl;
    }

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
template<class T> 
inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> 
inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll n;
    ll a[200010];
    cin>>n;
    rep(i,n){
        cin>>a[i];
        a[i]--;
    }
    ll cnt[200010]={};
    rep(i,n){
        cnt[a[i]]++;
    }
    ll all=0;
    rep(i,n){
        all+=cnt[i]*(cnt[i]-1)/2;
    }
    rep(i,n){
        ll ans=all;
        ans-=cnt[a[i]]*(cnt[a[i]]-1)/2;
        ans+=(cnt[a[i]]-1)*(cnt[a[i]]-2)/2;
        cout<<ans<<endl;
    }
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    solve();


    return 0;
}

Measured memory_bytes: 6764
#include<iostream>
#include<numeric>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define chmax(a,b) (a<(b)?a=(b),1:0)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define MOD 1000000000
#define rep(i,n) for(int i=0;i<(n);i++)

#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  // ここでストリームに obj を書き込みます。
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}


int main(){
  int n; cin >>n;
  vector<vector<int>> hon(n),evi(n);
  rep(v,n){
    int m;cin>>m;
    rep(j,m){
      int x,y; cin >>x >>y; x--;
      if(y) hon[v].push_back(x);
      else evi[v].push_back(x);
    }
  }
  if(df){
    rep(i,n)print(i,":",hon[i]);
    rep(i,n)print(i,":",evi[i]);
  }
  li lim=1<<n,ans=0;
  rep(bs,lim){
    int flag=0;
    if(df)print(bs);
    rep(v,n){
      if((((li)1<<v)&bs)==0)continue;
      
      for(int u: hon[v]){
        if(df)print(u,(((li)1<<u)&bs));
        if((((li)1<<u)&bs)==0){
          flag=1;
          break;
        }
      }
      if(flag)break;
      for(int u: evi[v]){
        if(df)print(u,(((li)1<<u)&bs));
        if(((li)1<<u)&bs){
          flag=1;
          break;
        }
      }
      if(flag)break;
    }
    if(!flag){
      chmax(ans,__builtin_popcount(bs));
    }
  }
  print(ans);
}



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

using namespace std;

bool comp(int a, int b){
    return b < a;
}

int main(){
    
    int n, x;
    int a[100000], point[100000];
    int i, sum, j;
    long long count = 0;
    
    cin >> n >> x;
    for (i=0; i<n; i++){
        cin >> a[i];
    }
    
    for (i=0; i<n-1; i++){
        sum = a[i] + a[i+1];
        if (sum > x){
            if (a[i+1] >= sum-x){
                a[i+1] -= sum-x;
            } else {
                a[i] -= sum-x-a[i+1];
                a[i+1] = 0;
            }
            count += sum-x;
            
        }
//        for (j=0; j<n; j++){
//            cout << a[j] << ' ';
//        }
//        cout << '\n';
    }
    
    cout << count << '\n';
    
    return 0;
}


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

const int mod = 1e9 + 7;
template<typename T>
T add(T x) {
  return x;
}
template<typename T, typename... Ts>
T add(T x, Ts... y) {
  T res = x + add(y...);
  if (res >= mod)
    res -= mod;
  return res;
}
template<typename T, typename... Ts>
T sub(T x, Ts... y) {
  return add(x, mod - add(y...));
}
template<typename T, typename... Ts>
void udd(T& x, Ts... y) {
  x = add(x, y...);
}
template<typename T, typename... Ts>
void uub(T& x, Ts... y) {
  x = sub(x, y...);
}
template<typename T>
T mul(T x) {
  return x;
}
template<typename T, typename... Ts>
T mul(T x, Ts... y) {
  return (x * 1ll * mul(y...)) % mod;
}
template<typename T, typename... Ts>
void uul(T& x, Ts... y) {
  x = mul(x, y...);
}
int bin(int a, ll deg) {
  int r = 1;
  while (deg) {
    if (deg & 1)
      uul(r, a);
    deg >>= 1;
    uul(a, a);
  }
  return r;
}
int inv(int x) {
  assert(x);
  return bin(x, mod - 2);
}

const int maxn = 105;
int h[maxn];
int d[maxn][maxn];
vector<int> hs;

signed main() {
#ifdef LOCAL
  assert(freopen("d.in", "r", stdin));
#endif
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
    hs.push_back(h[i]);
  }
  hs.push_back(0);
  hs.push_back(1e9 + 7);
  sort(hs.begin(), hs.end());
  hs.erase(unique(hs.begin(), hs.end()), hs.end());
  int last = hs.size() - 2;
  d[0][last] = 1;
  for (int i = 0; i < n; ++i) {
    //for (int j = 0; j <= last; ++j) {
      //cerr << d[i][j] << ' ';
    //}
    //cerr << '\n';
    for (int j = 0; j <= last; ++j) {
      if (i && h[i] <= h[i - 1]) {
        int nj = hs[j] < h[i] ? j : last;
        udd(d[i + 1][nj], d[i][j]); //inv
        if (nj == last) {
          udd(d[i + 1][nj], d[i][j]); //copy
        }
      } else {
        int ph = i ? h[i - 1] : 0;
        if (j != last) {
          udd(d[i + 1][j], mul(d[i][j], bin(2, h[i] - ph)));
        } else {
          udd(d[i + 1][last], mul(2, d[i][j]));
          int from = lower_bound(hs.begin(), hs.end(), ph) - hs.begin();
          for (int nj = from; hs[nj] < h[i]; ++nj) {
            int ways = bin(2, h[i] - hs[nj]);
            int bad = bin(2, h[i] - hs[nj + 1] + 1);
            if (i || nj > 0) {
              uul(ways, 2);
            }
            //if (d[i][j]) {
              //cerr << "wb " << ways << ' ' << bad << '\n';
            //}
            uub(ways, bad);
            udd(d[i + 1][nj], mul(d[i][j], ways));
          }
        }
      }
    }
  }
    //for (int j = 0; j <= last; ++j) {
      //cerr << d[n][j] << ' ';
    //}
    //cerr << '\n';
  int res = 0;
  for (int j = 0; j <= last; ++j) {
    udd(res, d[n][j]);
  }
  cout << res << '\n';
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    string st;
    cin >> st;
    
    int n = st.size();
    int cnt = 0;
    int mae = 0, ushi = n-1;
    while (mae < ushi && mae < n && ushi >= 0) {
        if (st[mae] == st[ushi]) {
            mae++; ushi--;
        } else if (st[mae] == 'x') {
            cnt++;
            mae++;
        } else if (st[ushi] == 'x') {
            cnt++;
            ushi--;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << cnt << endl;



    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

#define NDEBUG

int main() {
	int n, k, x; scanf("%d%d%d", &n, &k, &x);
	std::string s; cin >> s;

	std::vector<int> dp(n + 1);
	for(int i = 0; i < n; i++) {
		if(s[i] == 'o') dp[std::min(n, i + x + 1)] = std::max(dp[std::min(n, i + x + 1)], dp[i] + 1);
		dp[i + 1] = std::max(dp[i + 1], dp[i]);
	}

	std::vector<int> ok(n + 1, k);
	for(int i = n - 1; i >= 0; i--) {
		if(s[i] == 'o') ok[i] = std::max(0, ok[std::min(n, i + x + 1)] - 1);
		ok[i] = std::min(ok[i], ok[i + 1]);
	}

	#ifndef NDEBUG
	cout << "dp: ";
	for(auto v: dp) cout << v << " "; cout << endl;
	
	cout << "ok: ";
	for(auto v: ok) cout << v << " "; cout << endl;
	#endif

	int back = 0;
	std::vector<int> ans;
	for(int i = 0; i < n; i++) {
		if(s[i] == 'x') continue;
		if(!(dp[i] >= ok[i + 1] or i < back)) {
			printf("%d\n", i + 1);
		}
		
		if(dp[i] >= ok[i]) back = i + x + 1;
	}
	return 0;
}


Measured memory_bytes: 3332
import java.awt.Point;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();

		char[][] block = new char[h][w];
		Point[] point = new Point[n + 1];

		for (int y = 0; y < h; y++) {
			String s = sc.next();
			for (int x = 0; x < w; x++) {
				char c = s.charAt(x);
				if (c == 'S') {
					point[0] = new Point(x, y);
				} else if ('1' <= c && c <= '9') {
					point[c - '0'] = new Point(x, y);
				}
				block[y][x] = c;
			}
		}

		sc.close();

		int total = 0;
		int[][] time = new int[h][w];
		Queue<Point> q = new LinkedList<>();

		for (int i = 0; i < n; i++) {
			for (int y = 0; y < h; y++) {
				for (int x = 0; x < w; x++) {
					time[y][x] = 0;
				}
			}
			q.clear();
			q.offer(point[i]);
			while (!q.isEmpty()) {
				Point p = q.poll();
				if (p.equals(point[i + 1])) {
					total += time[p.y][p.x];
					break;
				}
				for (int j = 0; j < 4; j++) {
					int _x = p.x + dx[j];
					int _y = p.y + dy[j];
					if (((0 <= _y && _y < h) && (0 <= _x && _x < w)) && time[_y][_x] == 0 && block[_y][_x] != 'X') {
						time[_y][_x] = time[p.y][p.x] + 1;
						q.offer(new Point(_x, _y));
					}
				}
			}
		}

		System.out.println(total);
	}
}

Measured memory_bytes: 104912
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  rep(i,n) cin >> vec[i];
  sort(vec.begin(),vec.end());
  vector<int> ok(1000000);
  int ans=0;
  rep(i,n){
    int x=vec[i];
    int y=x;
    if(ok[x]==0){
      if(x!=vec[i+1])ans++;
      while(x<=1000000){
        ok[x]++;
        x+=y;
      }
    }
  }
  cout << ans << endl;
        
}

Measured memory_bytes: 7932
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#define rep(i,n) for (int i = 0; i < (n);i++)
typedef long long ll;
using namespace std;
/*#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;*/



void Main()
{
	int n,m; cin>>n>>m;
	priority_queue<ll> que;
	vector<ll> price(n);
	rep(i,n) {
		ll a; cin >>a;
		que.push(a);
	}
	rep(i,m){
		int a = que.top();
		a/= 2ll;
		que.pop();
		que.push(a);
	}
	ll ans =0;
	rep(i,n){
		ans+= que.top();
		que.pop();
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 2168
qSort :: (Ord a) => [a] -> [a]
qSort xs = case xs of [] -> []
                      (h:ts) -> (qSort smallerOrEqual) ++ [h] ++ (qSort larger)
                        where smallerOrEqual = [ a | a <- ts, a <= h ]
                              larger = [ a | a <- ts, a > h]

stringToInt :: String -> [Int]
stringToInt xs = map read $ words xs

printf :: (Show a) => [a] -> IO ()
printf xs = putStrLn $ unwords $ map show xs

main = do
  hoge <- getLine
  printf $ qSort $ stringToInt hoge



Measured memory_bytes: 3648
M=10**9+7;F=lambda X:pow(X,M-2,M);H,W,A,B=map(int,input().split());Z=C=1
for I in range(H-1):Z=C=C*(W+H-B-2-I)*F(I+1)%M
for I in range(1,H-A):C=C*(B-1+I)*(H-I)*F(I*(W+H-B-1-I))%M;Z+=C
print(Z%M)

Measured memory_bytes: 3064
N, K = map(int, input().split())
P = [0] + list(map(int, input().split()))
C = [0] + list(map(int, input().split()))

ans = -10 ** 9
for i in range(1, N + 1):
    start = i
    next_ = start
    loop_score = 0
    loop_count = 0
    while True:
        loop_count += 1
        loop_score += C[next_]
        next_ = P[next_]
        if next_ == start:
            break
    in_score = 0
    in_count = 0

    for k in range(K):
        in_count += 1
        in_score += C[next_]

        loop_num = (K - in_count) // loop_count
        score = in_score + max(0, loop_score) * loop_num
        ans = max(ans, score)

        next_ = P[next_]
        if next_ == start:
            break

print(ans)


Measured memory_bytes: 74148
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, k;
    cin >> n >> k;
    REP(i,n) {
        int x; cin >> x;
    }

    int ans = 0;
    int one = 1;
    while(one < n) {
        one += k-1;
        ans++;
    }

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

using namespace std;

#define FOR(a,b) for(int a=0;a<b;a++)
#define F0R(a,b,c) for(int a = b; a<=c; a++)
#define f first
#define s second
#define m0(x) memset(x,0,sizeof(x))

typedef pair<int,int> pi;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pi> vpi;

bool comp(const int a, const int b){
    return(abs(a) > abs(b));
}

const ll mod = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,k; cin >> n >> k;
    vector<ll> nums(n); FOR(i,n) cin >> nums[i];
    sort(nums.begin(),nums.end(),comp);nums.push_back(1);
    int lneg = n, lpos = n;
    int negcnt = 0;
    bool zpos = 0;
    FOR(i,k){
        if(nums[i] > 0) lpos = i;
        else if(nums[i] < 0){
            lneg = i;
            negcnt++;
        }else zpos = 1;
    }
    int nneg = n, nepos = n;
    if(negcnt&1){
//        cerr << "hi\n";
        F0R(i,k,n-1){
            if(nums[i] > 0 && nepos == n) nepos = i;
            else if(nums[i] < 0 && nneg == n) nneg = i;
            else zpos = 1;
        }
        ll ans = 1;
        if(lpos == n && nepos == n){
            for(int i = n-1; i >= n-k; i--){
                ll a = nums[i];
                a = (mod - (-nums[i])%mod)%mod;
                ans *= a; ans %= mod;
            }
            cout << ans << "\n"; return 0;
        }
        if(nneg == n && nepos == n){
            if(zpos) cout << 0 << "\n";
            else{
//                cerr << "hi\n";
                FOR(i,k){
                    if(nums[i] < 0){
                        nums[i] = -nums[i];
                        nums[i] %= mod;
                        nums[i] = (mod-nums[i])%mod;
                    }
                    ans *= nums[i];
                    ans %= mod;
                }
                cout << ans << "\n";
            }
            return 0;
        }
        int skip = n; ll add = 1;
        if(nums[lpos]*nums[nepos] < nums[nneg]*nums[lneg] && lpos != n){
            skip = lpos; add = (mod-(-nums[nneg])%mod)%mod;
        }else{
            skip = lneg; add = nums[nepos]%mod;
        }
        FOR(i,k){
            if(i == skip) continue;
            if(nums[i] < 0){
                nums[i] = -nums[i];
                nums[i] %= mod;
                nums[i] = (mod-nums[i])%mod;
            }
            ans *= nums[i];
            ans %= mod;
        }
        ans *= add; ans %= mod;
        cout << ans << "\n";
        return 0;
    }
    ll ans = 1;
    FOR(i,k){
        if(nums[i] < 0){
            nums[i] = -nums[i];
            nums[i] %= mod;
            nums[i] = (mod-nums[i])%mod;
        }
        ans *= nums[i];
        ans %= mod;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6308
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int sum = 0;
		int[] p = new int[N];
		for (int i = 0; i < N; i++) {
			p[i] = sc.nextInt();
		}
		Arrays.sort(p);

		for (int i = 0; i < K; i++) {
			sum += p[i];
		}
		System.out.println(sum);
	}
}


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

int main() {
  int H, W;
  cin >> H >> W;
  while (H != 0 || W != 0) {
    if (H == 0 || W == 0) {
      cout << endl;
      cin >> H >> W;
      continue;
    }

    for (int x = 0; x < H; x++) {
      for (int y = 0; y < W; y++) {
        cout << "#";
      }
      cout << endl;
    }
    cout << endl;
    cin >> H >> W;
  }
}



Measured memory_bytes: 3088
#include <iostream>

using namespace std;

int main() {
	long long int n, k;
	cin >> n >> k;
	long long int a;

	long long int b = 0;

	for (long long int i = 0; i < n; i++) {
		cin >> a;
		if (a == 1) {
			b = i + 1;
		}
	}

	long long int x = (b - 1) / (k - 1);

	long long int c = (k - 1)*x + 1;

	long long d = n - c;
	d++;

	//cout << x << ' ' << c << ' ' << d << endl;

	if (d > 0) {
		long long int e = (d - 1) / (k - 1);
		if ((d - 1) % (k - 1) != 0) {
			e++;
		}
		x += e;
	}

	cout << x << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)cin >> a[i];

    sort(ALL(a));

    vector<ll> c;
    vector<ll> sum(1, 0);
    c.push_back(a[0]);

    ll no = 0;

    while(a[no] == c[0]){
        //cout << a[no];
        no++;
        sum[0]++;
    }
    ll i = no;
    while(i < n){
        ll cnt = 0;
        c.push_back(a[i]);
        //cout << "a" << c[c.size()-1] << "=" << a[i];
        while(a[i] == c[c.size()-1]){
            //cout << a[i];
            i++;
            cnt++;
        }
        sum.push_back(cnt);
        if(c.size()>3){
            cout << "No";
            return 0;
        }
    }

    if(c.size() == 1){
        if(c[0] == 0)cout << "Yes";
        else cout << "No";
        return 0;
    }

    if(n %3 != 0){
        cout << "No";
        return 0;
    }

    else if(c.size() == 2){
        if(sum[0] == n/3 && c[0] == 0)cout << "Yes";
        else if(sum[1] == n/3 && c[1] == 0)cout << "Yes";
        else cout << "No";
    }
    else {
        if(sum[0] == n/3 && sum[1] == n/3){
           if(c[0] != 0 && c[1] != 0 && c[2] != 0 && ((c[0]^c[1])^c[2])==0) cout << "Yes";
           else cout << "No";
        }
        else cout << "No";
        //cout << sum[0] << sum[1] << sum[2];
    }
    
    
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)

template <class T> struct CumulativeSum2D {
    vector<vector<T>> data;

    CumulativeSum2D(int W, int H) : data(W + 1, vector<int>(H + 1, 0)) {}

    void add(int x, int y, T z) {
        ++x, ++y;
        if (x >= data.size() || y >= data[0].size())
            return;
        data[x][y] += z;
    }

    void build() {
        for (int i = 1; i < data.size(); i++) {
            for (int j = 1; j < data[i].size(); j++) {
                data[i][j] +=
                    data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
            }
        }
    }

    T query(int sx, int sy, int gx, int gy) {
        return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
    }

    void print() {
        for (auto &x : data) {
            for (auto &y : x) {
                cout << y << " ";
            }
            cout << endl;
        }
    }
};

const int KMAX = 1000;
int main(void) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    char c;
    int n, k, x, y;
    cin >> n >> k;
    CumulativeSum2D<int> s(k * 2, k * 2);
    REP(i, n) {
        cin >> x >> y >> c;
        if (c == 'W') {
            y += k;
        }
        y %= 2 * k;
        if (y >= k) {
            y -= k;
            x += k;
        }
        x %= 2 * k;
        s.add(x, y, 1);
        s.add((x + k) % (2 * k), y + k, 1);
    }
    // 二次元累積和
    s.build();
    // s.print();
    int maxv = 0;
    REP(x, k) {
        REP(y, k) {
            int t = s.query(x, y, x + k, y + k);
            maxv = max({maxv, t, n - t});
        }
    }
    cout << maxv << endl;
    return 0;
}


Measured memory_bytes: 16000
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n)
		cin >> a[i];
	int count = 0;
int	flag = 1;
while (flag == 1)
{
	flag = 0;
	for (int j = n - 1; j >= 1; j--) {
		if (a[j] < a[j - 1]) {
			int x = a[j];
			a[j] = a[j - 1];
			a[j - 1] = x;
			flag = 1;
			count++;
		}
}
}
rep(i, n) {
	if (i != n - 1)
		cout << a[i] << " ";
	else
		cout << a[n - 1] << endl;
}
cout << count << endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <iomanip>
 

using namespace std;

 

int main()
{
    int a, b, d, r;
    double f;
    cin >> a >> b;
    f = (double)a / b;
    d = a/b;
    r = a%b;
    cout << d << " " << r << " " << fixed << setprecision(5) <<  f << endl; 
}


Measured memory_bytes: 3260
n=int(input())
h=list(map(int,input().split()))
ans=0
temp=[0]*n
temp[0]=0
temp[1]=abs(h[1]-h[0])
for i in range(2,n):
  temp[i]=min(temp[i-1]+abs(h[i]-h[i-1]),temp[i-2]+abs(h[i]-h[i-2]))
print(temp[n-1])

Measured memory_bytes: 13980
#include "bits/stdc++.h"
using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	scanf("%d", &n);
	vector <int> a (n);
	for(int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	long long ans = 0;
	int l = 0;
	int sum = 0, val = 0;
	for(int i = 0; i < n; i++) {
		sum += a[i];
		val ^= a[i];
		while(l < i && sum > val) {
			sum -= a[l];
			val ^= a[l++];
		}
		ans += i - l + 1;
	}
	printf("%lld\n", ans);
	return 0;
}

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

#[fastout]
fn main() {
    input! {
        n: usize,
        a: [u64; n],
    }
    let mut dp = vec![vec![0 as u64; n + 1]; n + 1];
    let mut v = vec![0; n];
    for i in 0..n {
        v[i] = i;
    }
    let v = v.as_mut_slice();
    v.sort_by(|&i, &j| {
        if a[i] != a[j] {
            return a[i].cmp(&a[j]).reverse();
        } else {
            return i.max(n - 1 - i).cmp(&j.max(n - 1 - j));
        }
    });

    for i in 0..n {
        let j = v[i];
        for l in 0..i + 1 {
            let r = i - l;
            let r = n - 1 - r;
            {
                let d = j.max(l) - j.min(l);
                let tmp = (d as u64) * a[j];
                dp[i + 1][l + 1] = dp[i + 1][l + 1].max(tmp + dp[i][l]);
            }
            {
                let d = j.max(r) - j.min(r);
                let tmp = (d as u64) * a[j];
                dp[i + 1][l] = dp[i + 1][l].max(tmp + dp[i][l]);
            }
        }
    }

    let ans = dp[n].iter().fold(0 as u64, |res, &x| res.max(x));
    println!("{}", ans);
}


Measured memory_bytes: 33568
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let S = rl().chars().collect::<Vec<_>>();
    let mut b = 0;
    let mut s = 0_i64;
    for &c in &S {
        if c == 'B' {
            b += 1
        } else {
            s += b;
        }
    }

    println!("{}", s)
}


Measured memory_bytes: 4352
n=int(input())
a=[list(map(int,input().split()))for _ in range(n)]
def f():
 for i in range(n-1):
  d=a[i][:];d[3],d[4]=d[4],d[3]
  for j in range(i+1,n):
   e=a[j][:];e[3],e[4]=e[4],e[3]
   for p in('012345','152043','215304','302541','410352','514320'):
    f=[d[int(k)]for k in p]
    if f[0]==e[0]:
     if f[5]==e[5]:
      f=f[1:5]*2
      for k in range(4):
       if f[k:k+4]==e[1:5]:return 'No'
 return 'Yes'
print(f())


Measured memory_bytes: 5608
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
using namespace std;
 
#define sz(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
////////////////////////
 
void solve(){
	ll a, b, n;
	cin >> n >> a >> b;
	if(a > b){
		cout << 0 << endl;
		return;
	}
	if(n == 1 && a != b){
		cout << 0 << endl;
		return;
	}
	ll ans = 1;
	ans += (b - a ) * (n - 2);
	cout << ans << endl;
}
 
int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
 
	solve();
 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (ll)((v).size())
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 


#define M 100010




int main(){
    IOS;
    tihs;
    
   	string s;cin>>s;
   	if(s[1]=='B')s[1]='R';
   	else s[1]='B';
   	cout<<s;


    return 0;
}

Measured memory_bytes: 3664
from bisect import bisect_left,bisect_right
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
c.sort()
ans=0
for i in range(len(b)):
  ans+=bisect_left(a,b[i])*(len(c)-bisect_right(c,b[i]))
print(ans)

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

int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;
    if(N%2!=0){
        cout<<"No"<<endl;
    }
    else {
        bool ans = true;
        for(int i=0;i<N/2;++i){
            if(S[i]!=S[i+N/2])ans = false;
        }
        if(ans)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define loop(i, a, b) for(int i = a; i < b; i++) 
#define rep(i, a) loop(i, 0, a)
using namespace std;
const int MOD = 1000000007;
const int inf = 1e8;
using vi = vector <int>;
using vvi = vector <vi>;
using vc = vector <char>;
using vvc = vector <vc>;
using vs = vector <string>;
using vvs = vector <vs>;
//g++ -std==c++14
//setprecision(10)
string s;

int main(){
    cin >> s;
    for(int i = s.size() - 1; i >= 0; i--){
        if(s[i - 4] == 'd'&& s[i - 3] == 'r' && s[i - 2] == 'e' && s[i - 1] == 'a' && s[i] == 'm')
            i -= 4;
        else if(s[i - 4] == 'e'&& s[i - 3] == 'r' && s[i - 2] == 'a' && s[i - 1] == 's' && s[i] == 'e')
            i -= 4;
        else if(s[i - 5] == 'e' && s[i - 4] == 'r'&& s[i - 3] == 'a' && s[i - 2] == 's' && s[i - 1] == 'e' && s[i] == 'r')
            i -= 5;
        else if( s[i - 6] == 'd' && s[i - 5] == 'r' && s[i - 4] == 'e'&& s[i - 3] == 'a' && s[i - 2] == 'm' && s[i - 1] == 'e' && s[i] == 'r')
            i -= 6;
        else{
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

const int maxn = 1e5+5;
int h[maxn], n, A, B;

int check(long long ans){
	long long sum = 0;
	for(int i = 1; i <= n; i++){
		if((long long)(h[i]-(long long)ans*B) > 0){
			sum += (long long)(h[i]-(long long)(ans*B))/(A-B);
			if((long long)(h[i]-(long long)(ans*B))%(A-B)){
				sum ++;
			}
		}
	}
	if(sum <= ans) return 1;
	return 0;
}

int main(){
	scanf("%d%d%d",&n, &A, &B);
	for(int i = 1; i <= n; i++)
		scanf("%d",h+i);
	long long l = 0, r = 1e10, mid;
	while(l < r){
		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid;
		}
		else{
			l = mid+1;
		}
	}
	printf("%lld\n",r);

	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)


const int MAX_Q = int(1e5);
int H, W, D, Q, L[MAX_Q], R[MAX_Q];
unordered_map<int, pair<int, int> > mp;

int main() {
    cin >> H >> W >> D;
    int temp;
    REP(i, H) {
        REP(j, W) {
            cin >> temp;
            mp[temp] = make_pair(i, j);
        }
    }
    ll dp[H * W + 1];
    FOR(i, D + 1, H * W + 1) {
        ll pre_x = mp[i - D].first, pre_y = mp[i - D].second;
        ll x = mp[i].first, y = mp[i].second;
        dp[i] = dp[i - D] + abs(x - pre_x) + abs(y - pre_y);
    }
    cin >> Q;
    REP(i, Q) {
        cin >> L[i] >> R[i];
        printf("%lli\n", dp[R[i]] - dp[L[i]]);
    }
    return 0;
}

Measured memory_bytes: 6436
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = N;
    int sum = 0;

    while(M!=0){
      sum+=M%10;
      M/=10;
    }
    if(N%sum==0){
      System.out.println("Yes");
    }
    else{
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 21716
max_fact = 5 * 10**5
mod = 10**9 + 7

f = [1] * (max_fact + 1)
for idx in range(2, max_fact + 1):
    f[idx] = f[idx - 1] * idx
    f[idx] %= mod
fi = [pow(f[-1], mod - 2, mod)]
for idx in range(max_fact, 0, -1):
    fi += [fi[-1] * idx % mod]
fi = fi[::-1]

def factorial(n):
    return f[n]

def factorial_inverse(n):
    return fi[n]

def combination(n, r):
    return f[n] * fi[r] * fi[n - r] % mod

def permutation(n, r):
    return f[n] * fi[n - r] % mod

def homogeneous_product(n, r):
    return f[n + r - 1] * fi[r] * fi[n - 1] % mod


comb = combination
perm = permutation

N, M = [int(_) for _ in input().split()]
ans = 0
for p in range(N + 1):
    ans += (-1)**p * comb(N, p) * perm(M - p, N - p)
    ans %= mod
ans *= perm(M, N)
ans %= mod
print(ans)


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

int main(){
  int n,m,p;

  while((cin>>n>>m>>p)&&(n|m|p!=0)){
    vector<int> x(n);
    int sum=0;
    for(int i=0;i<n;i++){
      cin >> x[i];
      sum += x[i];
    }

    if(x[m-1]==0) cout << 0 << endl;
    else{
      int haitou=(sum*(100-p))/x[m-1];
      cout << haitou << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1196
#include<cstdio>
#include<algorithm>
#include<vector>
#define ll long long
#define N 1005
#define inf 1000000000
using namespace std;
ll n;
int sta[105], top=0;
int main(){
    scanf("%lld", &n);
    ll t=26;
    --n;
    for(int i=1; ; ++i, t*=26){
    	if(n>=t) n-=t;
    	else{
    		while(n){
    			sta[++top]=n%26;
    			n/=26;	
			}
			for(int j=i; j>=1; --j) printf("%c", sta[j]+'a');
			break;
		}
	}
	return 0;
} 

Measured memory_bytes: 1624
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] a = new int[N];
        int ans = 0;
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            if (i != 0 && a[i - 1] == a[i]) {
                a[i] = N + 1;
                ans++;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21972
let cnt = ref 0
let (g : int list ref) = ref []

let print_list l =
  List.iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) l;
  print_newline ()

let print_array = Array.iter (fun n -> Printf.printf "%d\n" n)

let insertion_sort (a : int array) n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j + g) <- v
    else (a.(j + g) <- a.(j); incr cnt; insert (j - g) v)
  in
  let rec doit i =
    if i < n then (insert (i - g) a.(i); doit (i + 1))
  in
  doit g

let generate_g n =
  let rec doit i g lst =
    if g > n then lst
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: lst)
  in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  g := generate_g n;
  let rec doit = function
    | [] -> ()
    | hd :: tl -> (insertion_sort a n hd; doit tl)
  in
  doit !g

let () =
  let n = read_int () in
  let a = Array.make n 0 in
  let rec doit i =
    if i < n then (a.(i) <- read_int (); doit (i + 1))
  in
  doit 0;
  shell_sort a n;
  Printf.printf "%d\n" (List.length !g);
  print_list !g;
  Printf.printf "%d\n" !cnt;
  print_array a

Measured memory_bytes: 12608
#include<cstdio>

int main(){
  char s[13];
  scanf("%s",s);
  for(int i=0;i<4;i++) printf("%c",s[i]);
  printf(" ");
  for(int i=4;i<12;i++) printf("%c",s[i]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 128