akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	ll n, k;
	string s;
	cin>>n>>k>>s;
	deque<char> q;
	rep(i, s.size()) q.push_back(s[i]-'A');
	int t = 0;
	if(k>n*4) k = (k-n*4)%4+n*4;
	for(int i = 0, m = k; i < m; i++,k--){
		char c = q.front(); q.pop_front();
		if(t) c = !c;
		if(c==0) q.push_front(!t);
		else {
			t = !t;
			q.push_back(t);
		}
	}
	string res;
	while(!q.empty()){
		char a = q.front();
		a ^= t;
		res += a+'A'; q.pop_front();
	}
	cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 1164
#include<iostream>
#include<cstring>
#include<vector>

using namespace std;

int main(){
    int H, W;
    vector<string> S;
    cin >> H;
    cin >> W;

    S.resize(H);
    for(int i=H; i != 0; i--) cin >> S[H-i];


    for(int i=0; i != H; i++){ 
        char *s = (char*) S[i].c_str();
    
        for(int j=0; j != W; j++) {
            int n = 0;
            if(s[j] == '#') continue;
    
            if(0 <= i-1 && 0 <= j-1 ) 
                if('#' ==  (S[i-1].c_str())[j-1]) n++;
            if(0 <= i-1 && 0 <= j ) 
                if('#' ==  (S[i-1].c_str())[j]) n++;
            if(0 <= i-1 && W > j+1 ) 
                if('#' ==  (S[i-1].c_str())[j+1]) n++;
    
            if(0 <= i  && 0 <= j-1 ) 
                if('#' ==  (S[i].c_str())[j-1]) n++;
            //if(0 <= i  && 0 <= j ) 
            //    if('#' ==  (S[i].c_str())[j]) n++;
            if(0 <= i  && W > j+1 ) 
                if('#' ==  (S[i].c_str())[j+1]) n++;

            if(H > i+1 && 0 <= j-1 ) 
                if('#' ==  (S[i+1].c_str())[j-1]) n++;
            if(H > i+1  && 0 <= j ) 
                if('#' ==  (S[i+1].c_str())[j]) n++;
            if(H > i+1  && W > j+1 ) 
                if('#' ==  (S[i+1].c_str())[j+1]) n++;
            //cout << "i, j : " << i << "," << j << endl;
            s[j] = (char) n + '0';
        }

        for(int j=0; j != W; j++) cout << s[j];
        cout << endl;
    
    }   
    
    //cout << endl;
    //for(int i=H; i != 0; i--) cout << S[H-i] << endl;
    
    

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(){
  int l, r, d, cnt=0;
  scanf("%d %d %d", &l, &r, &d);
  for(int i=l; i<=r; i++){
    if( i%d==0 ){ cnt++; }
  }
  printf("%d", cnt);
  return 0;
}

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

using namespace std;

const int N = 1e6;

int readInt ()
{
    bool minus = false;
    int result = 0;
    char ch;
    ch = getchar();
    while (true)
    {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus = true;
    else result = ch-'0';
    while (true)
    {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }
    if (minus)
        return -result;
    else
        return result;
}
char readChar()
{
    char result = getchar();
    while (isspace(result)) {
        result = getchar();
    }
    return result;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int getRand(int l, int r)
{
    return uniform_int_distribution<int>(l, r)(rng);
}

main() {
    int a = readInt(), b = readInt();
    int g = __gcd(a, b);
    int cnt = 0;
    vector<int> d;
    int ans = 1;
    for (int i = 2; i * i <= g; i++) {
        if (g % i == 0) {
            ++ans;
//            d.push_back(i);
            while (g % i == 0) {
                g /= i;
            }
        }
    }
    if (g > 1) {
        ++ans;
    }
//    for (int it : d) {
//        cout << it << " ";
//    }
//    puts("");
//    int n = d.size();
//    cout << n << "\n";
//    assert(n <= 28);

    cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#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...); }

string ac[]={"AC","WA","TLE","RE"};

int main(){
  int n; cin >>n;
  vector<int> cnt(4,0);
  
  rep(i,n){
    string s; cin >>s;
    rep(j,4){
      if(s==ac[j]) cnt[j]++;
    }
  }
  
  rep(j,4){
    print(ac[j],"x",cnt[j]);
  }
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
const int mx = 1e6;
int n, k;
vector<int>v;
bool chk(int mid) {
    int temp = k;
    if (mid == 0)
        return false;
    for (int i(0); i < n; ++i) {
        if (v[i] <= mid)continue;
        int cnt = v[i] / mid;
        temp -= cnt;
    }
    return temp >= 0;
}
int main() {
    cin >> n >> k;
    v.resize(n);
    for (auto& x : v)
        cin >> x;
    int l = -1, r = 1e9 + 5;
    while (r - l > 1) {
        int mid = l + (r - l) / 2;
        if (chk(mid))
            r = mid;
        else
            l = mid;
    }
    cout << r << endl;
}

Measured memory_bytes: 3844
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))
list = []
maximum = 0

for i in range(n):
    num = a[i]*(-1)
    heapq.heappush(list,num)

for i in range(m):
    maximum = heapq.heappop(list)
    if maximum%2 == 0:
        maximum = maximum//2
    else:
        maximum = (maximum//2)+1
    heapq.heappush(list,maximum)
#    print(list)

ans = 0
minimum = 0

for i in range(n):
    minimum = heapq.heappop(list)
    minimum = minimum*(-1)
    ans = ans + minimum

print(ans)


Measured memory_bytes: 14184
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let s: String = input();
    let s: Vec<&str> = s.split("/").collect();
    let year: i32 = s[0].parse().unwrap();
    let month: i32 = s[1].parse().unwrap();
    let day: i32 = s[2].parse().unwrap();
    let mut heisei = true;
    if year > 2019 {
        heisei = false;
    } else if year == 2019 {
        if month > 4 {
            heisei = false;
        } else if month == 4 {
            if day > 30 {
                heisei = false;
            }
        }
    }
    if heisei {
        println!("Heisei");
    } else {
        println!("TBD");
    }

}


Measured memory_bytes: 2160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}
const ll MOD = 1e9 + 7;

const int MAX = 2 * 1e5; // 適宜
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 逆元 a^{-1} mod m
// aがmの倍数でないことが前提。O(log m)
ll modinv(ll a, ll m=MOD) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

struct DP{
	ll val;
	ll sz;
	
	DP(ll val=1, ll sz=0):val(val),sz(sz) {}
	DP addRoot() const {
		DP res = *this;
		res.sz++;
		return res;
	}
	DP operator + (const DP o) const {
		DP res = *this;
		(res.val *= o.val) %= MOD;
		(res.val *= COM(res.sz + o.sz, res.sz)) %= MOD;
		res.sz += o.sz;
		return res;
	}
	DP operator - (const DP o) const {
		DP res = *this;
		(res.val *= modinv(o.val)) %= MOD;
		(res.val *= modinv(COM(res.sz, o.sz))) %= MOD;
		res.sz -= o.sz;
		return res;
	}

};

int mainsolve(){

	// 前処理
    COMinit();

	ll n;
	cin >> n;
	vector<vector<ll>> to(n);
	rep(i,n-1){
		ll a,b;
		cin >> a >> b;
		--a; --b;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	vector<vector<DP>> dp(n); // 要素数 2(n-1)
	rep(i,n) dp[i] = vector<DP>(to[i].size()); // vの子から始まる部分木（vの子自身を含む）
	vector<DP> dpSum(n); // vの子から始まる部分木の和（vを含まない）

	// まず普通にdfsして子方向へのdpを埋める
	function<DP(ll,ll)> dfs = [&](ll v, ll p){
		rep(i,to[v].size()){
			ll u = to[v][i];
			if(u != p){
				dp[v][i] = dfs(u,v).addRoot(); // uがrootである部分木
				dpSum[v] = dpSum[v] + dp[v][i];
			}
		}
		return dpSum[v];
	};
	dfs(0,-1);

	// 各dpSum[v]について、親方向へのノード1個分だけ足せていないので、それを足す
	function<void(ll,ll,DP)> dfs2 = [&](ll v, ll p, DP dpP){
		dpSum[v] = dpSum[v] + dpP;

		rep(i,to[v].size()){
			ll u = to[v][i];
			DP nextDpP = (dpSum[v] - dp[v][i]).addRoot(); // 親vの部分木から子uの部分木の分だけ引く
			if(u != p) dfs2(u, v, nextDpP);
		}

	};
	dfs2(0,-1,DP());

	rep(i,n) cout << dpSum[i].addRoot().val << endl;
	return 0;

	
}

int main(){
  
	mainsolve(); 
	return 0;
}

Measured memory_bytes: 36592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		Main app = new Main();
		String str, s[];
		
		int n, ll = 0, lr = 0, res;
		while(!(str = reader.readLine()).equals("0")){
			n = Integer.valueOf(str);
			
			s = reader.readLine().split(" ");
			res = 0;
			for(int i = 1; i < n; i += 2){
				res += app.check(s[i], s[i - 1]);
			}
			System.out.println(res);
		}
		reader.close();
	}
	public int check(String x, String y){
		char l[] = x.toCharArray();
		char r[] = y.toCharArray();
		
		if(l[0] == r[0]){
			return 0;
		}else return 1;
	}
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cerr << (*begin) << " ";
    *begin++;
  }
  cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cerr << " " << Array[i][j];
    }
    cerr << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

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

using pii = pair<int, int>;
set<int> used;

int N;
vec<pii> G[111111];
vec<int> ans;

void rec(int from, int dist) {
  used.insert(from);
  if (dist&1) {
    ans[from] = 1;
  }

  for (pii p : G[from]) {
    int to = p.first;
    int sDist = p.second;
    // dbg2(from, to)
    // if (to == from) continue;
    if (used.count(to)) continue;
    rec(to, dist + sDist);
  }
}

signed main() {
  cin >> N;
  ans.resize(N);
  rep (i, N-1) {
    int u, v, w;
    cin >> u >> v >> w;
    u--, v--;
    G[u].push_back({v, w});
    G[v].push_back({u, w});
  }

  // from, dist
  rec(0, 0);

  rep (i, N) {
    cout << ans[i] << endl;
  }

  return 0;
}

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

int main()
{
  int A, B, C, X;
  int x = 0;
  cin >> A >> B >> C >> X;
  for (int i = 0; i <= A; i++) {
    for (int j = 0; j <= B; j++) {
      for (int k = 0; k <= C; k++) {
        int a = 500 * i;
        int b = 100 * j;
        int c = 50 * k;
        if ((a + b + c) == X) {
          x++;
        }
      }
    }
  }

  cout << x << endl;
}


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

typedef long long ll;
typedef vector<ll> vll;

vector<ll> n_layers(51), n_buns(51);

ll sub(int N, ll X) {
  //N==0のときXを返す
    if (N == 0) { return X; }
    //X<=1なら0
    if (X <= 1) return 0;
    else if (X <= n_layers[N-1]+1) return sub(N-1, X-1);
    else if (X == n_layers[N-1]+2) return n_buns[N-1] + 1;
    else if (X <= n_layers[N]-1) return n_buns[N-1] + 1 + sub(N-1, X-n_layers[N-1]-2);
    else {return n_buns[N];}
}


int main() {
  
    n_layers[0] = n_buns[0] = 1;
    for (int i=1; i<=50; i++) {
        n_layers[i] = n_layers[i-1]*2 + 3;
        n_buns[i] = n_buns[i-1]*2 + 1;
    }


    int N; ll X;
    cin >> N >> X;
    cout << sub(N,X) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int[] a = sc.nextIntArray(3);
        Arrays.sort(a);
        if (a[0]==a[1]&&a[0]!=a[2]) out.println("Yes");
        else if (a[2]==a[1]&&a[1]!=a[0]) out.println("Yes");
        else out.println("No");
        out.flush();
        out.close();
    }


    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream system) {
            br = new BufferedReader(new InputStreamReader(system));
        }

        boolean ready() throws IOException {
            return br.ready();
        }


        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

        public Long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) throws IOException {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) throws IOException {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }


        public Integer[] nextIntegerArray(int n) throws IOException {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}

Measured memory_bytes: 22996
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++)
  {
    cin >> p[i];
  }
  sort(p, p + N);
  int ans = 0;
  for (int i = 0; i < N - 1; i++)
  {
    ans += p[i];
  }
  ans += p[N - 1] / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
lm=max(l)
rm=min(r)
if rm-lm<0:
  print(0)
else:
  print(rm-lm+1)


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  ll N, A, B;
  cin >> N >> A >> B;
  vector<ll> X(N);
  REP(i,N) cin >> X[i];

  ll res = 0LL;
  REP(i,N - 1) {
    res += min((X[i + 1] - X[i]) * A, B);
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
int n,m,k;
int main() {
	//freopen("1.txt","r",stdin);
	read(n); read(m); read(k);
	n=max(n,m);
	if (k%n==0) printf("%d\n",k/n);
	else printf("%d\n",k/n+1);
	return 0;
}
/*
  REMEMBER:
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Array size? Integer overflow? Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	int n, s;
	int ans;
	int[][] table = new int[10000][21];
	boolean[] use = new boolean[20];
	int[] p = new int[20];

	void makeParm(int sum, int n, int[] p, boolean[] use) {
		table[sum][n]++;
		if (n == 10) {
			return;
		}
		for (int i = 0; i < 10; i++) {
			if (use[i]) {
				continue;
			}
			p[n] = i;
			use[i] = true;
			makeParm(sum + ((n + 1) * p[n]), n + 1, p, use);
			use[i] = false;
		}
	}

	void run() {
		makeParm(0, 0, p, use);
		while (sc.hasNext()) {
			n = sc.nextInt();
			s = sc.nextInt();
			System.out.println(n > 10 || s > 330 ? 0 : table[s][n]);
		}
	}

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

Measured memory_bytes: 23072
#include<iostream>
#include<algorithm>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int H, W, K; std::cin >> H >> W >> K;
  char c[6][6];
  for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) std::cin >> c[i][j];
  int ans = 0;
  for(int sh = 0; sh < (1<<H); ++sh) for(int sw = 0; sw < (1<<W); ++sw) {
    int cn = 0;
    for(int i = 0; i < H; ++i) for(int j = 0; j < W; ++j) {
      if(((1<<i)&sh) || ((1<<j)&sw)) continue;
      if(c[i][j] == '#') ++cn;
    }
    if(cn == K) ++ans;
  }
  fin(ans);
  return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int flag=0;
  while(n>0)
  {
    int r=n%10;
    if(r==7)
    {
      flag=1;
      n=0;
      
    }

      n=n/10;
  }
  if(flag==1)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define DEBUG
// #define TIME
/*
Learn : -
Problem Type : -
Source : -
*/
#pragma GCC optimize ("Ofast")
#define sint(a) int a; qread(a);
#define sint2(a,b) int a,b; qread(a),qread(b);
#define sint3(a,b,c) int a,b,c; qread(a),qread(b),qread(c);
#define int1(a) qread(a);
#define int2(a,b) qread(a),qread(b);
#define int3(a,b,c) qread(a),qread(b),qread(c);
#define mkp make_pair
#define mkt make_tuple
#define pb emplace_back
#define inf INT_MAX
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define sdouble(a) double a; scanf("%lf",&a);
#define slong(a) long long a; scanf("%lld",&a);
#define cstring(a,x) char a[x]; scanf("%s",a);
#define sstring(a) string a;cin>>a;
#define rev(s) reverse(all(s));
#define FOR(a,b,c) for(int a=b;a<c;a++)
#define ROF(a,b,c) for(int a=b;a>c;a--)
#define pause system("pause")
#define endl printf("\n")
#define fastio {ios::sync_with_stdio(false);cin.tie(NULL);}
#define null NULL
#ifdef DEBUG
#define debug(x) cout<< #x << " = " << x;endl;
#else
#define debug(x)
#endif
#define OPEN freopen("input.txt","r",stdin)
#define SEND freopen("output.txt","w",stdout)
#ifdef COM
#define IN(x)
#define OUT(x)
#else
#define IN(x) freopen(x,"r",stdin);
#define OUT(x) freopen(x,"w",stdout);
#endif
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
void qread(int &x){
	int neg=1;x=0;
	register char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')neg=-1;c=getchar();}
	while(c>='0'&&c<='9')x=10*x+c-'0',c=getchar();
	x*=neg;
}
void Wl(int x)
{
    printf("%d\n",x);
}
void Wl(double x)
{
    printf("%lf\n",x);
}
void Wl(string x)
{
    printf("%s\n",x.c_str());
}
void Wl(ll x)
{
    printf("%lld\n",x);
}
void W(int x)
{
    printf("%d ",x);
}
void W(double x)
{
    printf("%lf ",x);
}
void W(string x)
{
    printf("%s ",x.c_str());
}
void W(ll x)
{
    printf("%lld ",x);
}
set<int> inc,decr;
int main()
{
    sint(n);
	vii v;
    for(int i=0;i<n;i++)
	{
		sint(x);
		v.pb(x,i);
	}
	sort(all(v));
	ll ans=0;
	for(int i=0;i<v.size();i++)
	{
		int currPos = v[i].S;
		auto itright = inc.upper_bound(currPos);
		int right = (itright == inc.end())? n-currPos: *(itright) - currPos;
		auto itleft = decr.upper_bound(n-currPos);
		int left = (itleft == decr.end())? currPos+1 : *(itleft) - n + currPos;
		ans+= (ll)v[i].F * (ll)right * (ll)left;
		inc.insert(currPos);
		decr.insert(n-currPos);
		// debug(ans);
	}
	Wl(ans);
}
/*

*/


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

int main() {
    int n, cnt = 0; cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];

    for (int i = 0; i < n - 2; i++) {
        for (int j = i + 1; j < n - 1; j++) {
            for (int k = j + 1; k < n; k++) {
                if (l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) {
                    if (l[i] != l[j] && l[j] != l[k] && l[i] != l[k]) {
                        cnt++;
                    }
                }
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

int main() {

	vector<int> v;
	int n;
	int a;
	int cnt=0;
	int b[3];
	int wk;

	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a;
		v.push_back(a);
	}

	for (int i = 0; i+2 < n; i++) {
		b[0] = v.at(i);
		b[1] = v.at(i+1);
		b[2] = v.at(i + 2);
		wk = b[1];

		sort(b,b + 3);

		if (wk == b[1]) {
			cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}

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

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

    int N;
    cin >> N;
    vector<string> s(N);
    int A = 0, B = 0, BA = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> s[i];
        int n = s[i].size();
        if (s[i][n - 1] == 'A')
        {
            A++;
        }
        if (s[i][0] == 'B')
        {
            B++;
        }
        if (s[i][0] == 'B' && s[i][n - 1] == 'A')
        {
            BA++;
        }
    }

    long long ans = 0LL;
    for (int i = 0; i < N; i++)
    {
        for (int j = 1; j < s[i].size(); j++)
        {
            if (s[i][j - 1] == 'A' && s[i][j] == 'B')
            {
                ans++;
            }
        }
    }

    if (N == 1)
    {
        cout << ans << endl;
    }

    if (A == B && B == BA && A != 0)
    {
        ans += BA - 1;
    }
    else
    {
        ans += min(A, B);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <string>

using namespace std;

char c1[32] = {' ','\'',',','-','.','?','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
string s1[32] = {"101", "000000","000011","10010001","010001","000001","100101","10011010",
				 "0101","0001","110","01001","10011011","010000","0111","10011000",
				 "0110","00100","10011001","10011110","00101","111","10011111","1000",
				 "00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};

string s2[32] = {"00000", "00001", "00010", "00011", "00100", "00101", "00110", "00111", 
				 "01000", "01001", "01010", "01011", "01100", "01101", "01110", "01111", 
				 "10000", "10001", "10010", "10011", "10100", "10101", "10110", "10111", 
				 "11000", "11001", "11010", "11011", "11100", "11101", "11110", "11111"};
char c2[32] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', ' ', '.',',','-','\'','?'};

void solve()
{
	string s;
	while(getline(cin, s))
	{
		string binary;
		for(int i = 0; i < s.size(); ++i)
		{
			for(int j = 0; j < 32; ++j)
			{
				if(s[i] == c1[j])
				{
					binary += s1[j];
				}
			}
		}
		while(binary.size() % 5)
		{
			binary += '0';
		}
		
		string ans;
		for(int i = 0; i < binary.size(); i += 5)
		{
			string temp;
			for(int j = 0; j < 5; ++j)
			{
				temp += binary[i + j];
			}
			for(int j = 0; j < 32; ++j)
			{
				if(temp == s2[j])
				{
					ans += c2[j];
				}
			}
		}
		cout << ans << endl;
	}
}

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

Measured memory_bytes: 1196
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:https://onlinejudge.u-aizu.ac.jp/challenges/search/volumes/0299>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = LINF;
    ll N,M,p; cin >> N >> M >> p;
    vector<ll> d(M); for(auto& in:d) cin >> in;
    sort(d.begin(),d.end());
    
    ll m = upper_bound(d.begin(),d.end(),p) -d.begin();
    
    ll li = m - 1;
    if(li == -1) li = M-1;
    ll ri = m;
    if(ri == M) ri = 0;

    res = min(res,(N+d[li])-p);
    res = min(res,(N+p)-d[ri]);
    for(int i = 0; i < M;i++){
        ll T = 0;
        
        ll next = (i+1)%M;
        ll pre = (i-1+M)%M;

        if(d[i] > p){
            if(i == M-1){
                T = (d[i]-p) + (d[i] - d[next]);
            }else{
                T = (d[i]-p) + (d[i] - (d[next]-N));
            }
            res = min(res,T);
            
            //ll td = d[i] - N;
            //T = (p - td) + (d[pre] - td);
            res = min(res,T);
        }else{
            if(i == 0){
                T = (p-d[i]) + (d[pre] - d[i]);
            }else{
                T = (p-d[i]) + ((N+d[pre]) - d[i]);
            }
            res = min(res,T);
            
           // ll td = d[i] + N;
           // T = (td-p) + (td - d[next]);
            res = min(res,T);
        }
    }
    return res*100;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 

int power(int x, unsigned int y, unsigned int m) 
    { 
        if (y == 0) 
            return 1; 
        int p = power(x, y/2, m) % m; 
        p = (p * p) % m; 
      
        return (y%2 == 0)? p : (x * p) % m; 
    } 
    bool intersect(pii a,pii b){
    	if(max(a.ff,b.ff)>min(a.ss,b.ss)) return 0;
    	return 1;
    }
int solve(){

	
	int n,k;cin>>n>>k;
 	int ans=0;
 	int sum=0;
 	int ls=0;
 	for(int i=0;i<k-1;i++){
 		sum+=n-i;
 		ls+=i;
 	}
 	// trace(sum);
 	for(int i=k;i<=n;i++){
 		sum+=n-(i-1);
 		ls+=(i-1);
 		ans+=(sum-ls+1);
 		ans%=M;
 		// trace(ls,sum);
 	}
 	cout<<(ans+1)%M;


    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d\n", &n)

	x := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &x[i])
	}

	best := int(1e9)
	for i := 1; i <= 100; i++ {
		score := 0
		for _, e := range x {
			score += (e - i) * (e - i)
		}
		if best > score {
			best = score
		}
	}

	fmt.Printf("%d\n", best)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define fab(i,a,b)     for(int i=a;i<b;i++)
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void k_t_p()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
	k_t_p();
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int n1 = a * c;
	int n2 = a * d;
	int n3 = b * c;
	int n4 = b * d;
	//int n2 = b * d;
	cout << max(n1, max(n2, max(n3, n4))) << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define ll          long long
#define PI 		    acos(-1)
#define pb          push_back
#define ins         insert
#define INF        	1000000000000000007 //1e18+7
#define mk          make_pair
#define lb(v,x)     lower_bound(all(v),x)
#define ub(v,x)     upper_bound(all(v),x)
#define ff          first
#define ss          second
#define rev         reverse
#define endl        "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a)       (ll)a.size()
#define ld     		long double
#define minpq       priority_queue <ll,vector<ll>,greater<ll> > 
#define fill(x,y)   memset(x,y,sizeof(x))
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define MOD         1000000007		//1e9+7
#define bp(n)       __builtin_popcountll(n)
#define mxt(a)      *(max_element(a.begin(),a.end()))
#define mnt(a)      *(min_element(a.begin(),a.end())
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i, a, mp) for(ll i = (a); i<=(mp); ++i)
#define trav(a, x) 	  for(auto &a : x)
#define re(i,n)       for(ll i = 0; i < n; ++i) 
const int N = 5e5 + 7;
const ld eps=1e-7;
typedef pair<ll,ll>   pii;
typedef vector<pii>   vpii;
typedef vector<ll>    vll;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
template <typename T> T gcd(T a,T mp){ if(a==0) return mp; return gcd(mp%a,a); }
template <typename T> T powm(T a,T mp, ll m){T cnt=1; while(mp>0){ if(mp%2==1) cnt=(cnt*a)%m; mp/=2; a=(a*a)%m; }return cnt%m;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
ll sqr(ll x) { return x * x;} 
void prec(){

}
void run(){
	int n,m;cin>>n>>m;
	char grid[n][m];
	re(i,n){
		re(j,m) cin>>grid[i][j];
	}	
	int dp[n+1][m+1];
	fill(dp,0);
	dp[0][0]=1;
	for(int i=0; i<n; ++i){
		for(int j=0; j<m; ++j){
			if(grid[i][j]=='#') continue;
			if(j) dp[i][j]=dp[i][j]+dp[i][j-1],dp[i][j]%=MOD;
			if(i) dp[i][j]=dp[i][j]+dp[i-1][j],dp[i][j]%=MOD;
		}
	}
	cout<<dp[n-1][m-1];
}
int main()
{
    cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
    	run();
    return 0; 
}

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

string st;
int k;

void solve() {
    for (int i = 0; i < st.size(); i++)
        if ('z' - st[i] + 1 <= k && st[i] != 'a') {
            k -= ('z' - st[i] + 1) ;
            st[i] = 'a';
        }

    st[st.size() - 1] = (st[st.size() - 1] + k - 'a') % 26 + 'a';
    return;
}

int main() {
    cin >> st >> k;
    solve() ;
    cout << st << endl;
    return 0;
}


Measured memory_bytes: 512
import math

A , B = map(int,input().split())

bA = bin(A)
bB = bin(B)


if (A - 1) % 2 == 0 :
    fA = A - 1
    fA += ((A - 1) / 2) % 2
else :
    fA = (A / 2) % 2

if B % 2 == 0 :
    fB = B
    fB += (B / 2) % 2
else :
    fB = ((B + 1) / 2) % 2

bfA = bin(int(fA))
bfB = bin(int(fB))

bAB = [0] * (max(len(bfA) , len(bfB)) - 2)
ans = 0

for i in range(1,len(bAB) + 1) :
    if i > len(bfA) - 2 :
        bAB[-i] = int(bfB[-i])
    elif i > len(bfB) - 2 :
        bAB[-i] = int(bfA[-i])
    else :
        bAB[-i] = 1 if (int(bfA[-i]) + int(bfB[-i])) % 2 == 1 else 0

for b in bAB : # デコード
    ans = ans * 2 + b

print(ans)


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

int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++){
		for(int j=i;j<s.size();j++){
			if(s.substr(0,i)+s.substr(j+1)=="keyence"){
				cout<<"YES"<<endl;
				return 0;
			}
		}
	}
	if(s=="keyence"){
		cout<<"YES"<<endl;
		return 0;
	}
	cout<<"NO"<<endl;
	return 0;
}

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<int> wcnt(n+1, 0);
    int sum = 0, acs = 0;
    for (int i = 0; i < m; i++) {
        int p; string s; cin >> p >> s;
        if (s == "AC") {
            if (wcnt[p] >= 0) acs++, sum += wcnt[p];
            wcnt[p] = -1;
        } else {
            if (wcnt[p] >= 0) wcnt[p]++;
        }
    }
    cout << acs << " " << sum << "\n";
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  string s;
  bool isFour = false;

  for (int i = 0; i < N; i++) {
    cin >> s;
    if (s == "Y") {
      isFour = true;
      break;
    }
  }
  if (isFour) {
    cout << "Four" << endl;
  } else {
    cout << "Three" << endl;
  }
}


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

using namespace std;

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

    int n; cin >> n;
    string ans = "No";
    for (int i = 1; i <= 9; ++i) {
        for (int j = 1; j <= i; ++j) {
            if (i * j == n) {
                ans = "Yes";
                break;
            }
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct Node {
  Node *left;
  Node *right;
  Node() : left(NULL), right(NULL) {;}
};
Node _pool[1000000];
Node *pool;
int pos = 0;

Node *Parse(char *str) {
  Node *ret = pool++;
  assert(str[pos] == '(');
  pos++;
  if (str[pos] == '(') { ret->left = Parse(str); }
  assert(str[pos] == ',');
  pos++;
  if (str[pos] == '(') { ret->right = Parse(str); }
  assert(str[pos] == ')');
  pos++;
  return ret;
}

void Output(char op, Node *l, Node *r) {
  Node temp;
  if (l == NULL && r == NULL) { return; }
  if (l == NULL) { swap(l, r); }
  if (op == 'i') {
    if (r == NULL) { return; }
    putchar('(');
    Output(op, l->left, r->left);
    putchar(',');
    Output(op, l->right, r->right);
    putchar(')');
  } else {
    if (r == NULL) { r = &temp; }
    putchar('(');
    Output(op, l->left, r->left);
    putchar(',');
    Output(op, l->right, r->right);
    putchar(')');
  }
}

char str1[10000];
char str2[10000];
int main() {
  char op;
  while (scanf(" %c %s %s", &op, str1, str2) > 0) {
    MEMSET(_pool, 0);
    pool = _pool;
    pos = 0;
    Node *l = Parse(str1);
    pos = 0;
    Node *r = Parse(str2);
    Output(op, l, r);
    puts("");
  }
}

Measured memory_bytes: 16760
S = input()
n = len(S)
cnt = [0] * n
i = 0
while True:
    rc = 0
    lc = 0

    while i < n and S[i] == 'R':
        rc += 1
        i += 1
    while i < n and S[i] == 'L':
        lc += 1
        i += 1
    cnt[i - lc - 1] = (rc + 1) // 2 + lc // 2
    cnt[i - lc] = rc // 2 + (lc + 1) // 2

    if i == n:
        break

print(*cnt)


Measured memory_bytes: 48764
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
inline int rd(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=0;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?x:-x;
}
int n,m,T,f[1<<15],g[16][1<<15],cnt[16][1<<15],mi[1<<15];
bool vis[16][1<<15],ok[1<<15];
int main(){
	n=rd(),m=rd();T=1<<n;mi[0]=1;
	for(int i=1;i<=n;i++) mi[i]=mi[i-1]*2;
	int x,y;
	for(int i=0;i<m;i++){
		x=rd(),y=rd();
		vis[x][1<<(y-1)]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<T;j++){
			int k=j&-j;
			cnt[i][j]=cnt[i][j^k]+vis[i][k];
			g[i][j]=mi[cnt[i][j]]-1;
		}
	}
	for(int i=0;i<T;i++) ok[i]=(((1&i)>0)==((2&i)>0));
	f[0]=1;
	for(int i=1;i<T;i++){
		if(ok[i]){
			f[i]=1;
			for(int j=(i-1)&i;j;j=(j-1)&i){
				if(ok[j]){
					int k=i^j,s=f[k];
					for(int x=0;x<n;x++){
						if(((1<<x)&k)>0){
							s=(ll)s*g[x+1][j]%mod;
						}
						else if(((1<<x)&j)>0){
							s=(ll)s*mi[cnt[x+1][k]]%mod;
						}
					}
					f[i]=(f[i]+s)%mod;
				}
			}
		}
	}
	ll ans=1;
	for(int i=1;i<=m;i++) ans=ans*2%mod;
	printf("%lld\n",(ans-f[T-1]+mod)%mod); 
	return 0;
} 
/*
5 10
2 4
3 4
2 5
2 3
1 2
3 5
1 3
1 5
4 5
1 4
*/

Measured memory_bytes: 4608
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
const ll E=1e18+7;
const ll MOD=1000000007;
#define IOS cin.tie(0); ios::sync_with_stdio(0);
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
template<class... A> void prints()      { cout << endl; }
template<class... A> void prints_rest() { cout << endl; }
template<class T, class... A> void prints_rest(const T& first, const A&... rest) { cout << " " << first; prints_rest(rest...); }
template<class T, class... A> void prints(const T& first, const A&... rest)      { cout << first; prints_rest(rest...); }

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
int main() {
    int x, a;
    cin >> x >> a;

    if (x<a) prints(0);
    else prints(10);
    return 0;
}


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

using namespace std;

vector<int> in(100002);
int n;

int tb[100002];

int dp(int i){
	if(i >= n) return 999999999;
	if(i == n-1) return 0;
	
	if(tb[i] != -1) return tb[i];
	
	return tb[i] = min( dp(i+1)+abs(in[i] - in[i+1]), 
					dp(i+2)+abs(in[i] - in[i+2]));
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	memset(tb,-1,sizeof(tb));
	cin >> n;
	for(int i =0; i < n; ++i)
		cin >> in[i];
	
	cout << dp(0) << endl;
	
	return 0;
}

Measured memory_bytes: 3328
import math


def main():
    n = int(input())
    sum = (n-1)*2-1
    for i in range(2, n):
        sho = n // i
        amari = n % i
        if i**2 >= n:
            break
        if amari == 0:
            sho -= 1
        sum += (sho - i+1) * 2 - 1
    print(sum)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
#define fori(s,n) for(ll i=s;i<=n;i++)
#define ford(s,n) for(int i=n;i>=s;i--)
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define TEST(t) for(int T=1;T<=t;T++)
int gcd(int a, int b) 
{  if (b == 0) 
       return a; 
   return gcd(b, a % b); 
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,j,k;
    ll f=0;
    cin>>n;
    for(i=1;i<=n;i++){
      for(j=1;j<=n;j++)
         for(k=1;k<=n;k++)
            f+=gcd(i,gcd(j,k));
    }
 	 cout<<f;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using ll = long long;
const ll MOD=1e9+7;
const long long INF = 1LL<<60;

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

    set<char> st;

    rep(i,3){
        st.insert(s.at(i));
    }

    if (int(st.size())==2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

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

using namespace std;

#define fastio cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(0)
typedef long long ll;
//#define int ll
#define swap(x, y)((x)^=(y)^=(x)^=(y))
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> matrix;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(c) c.begin(),c.end()
#define mp make_pair
#define pb push_back
#define f first
#define tcase int _; cin>> _; for( ; _; --_)
#define s second
#define endl '\n'
const int MAX = 1e6+1;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1);
const double DEG = 180/PI;
const int MOD = 1e9+7;
int mod(int x, int m){ if(x >= 0) return x % m; if(-x < m) return m-(-x); return mod(x%m, m);}
int gcd (int a, int b) {while(b){a = mod(a, b); swap(a, b);} return a;}
int lcm (int a, int b) {return a / gcd(a, b) * b;}
int fexp(int base, int exp, int m){
	int total = 1;
	while(exp > 0){
		if(exp % 2 == 1){
			total = mod(((mod(total, m)) * (mod(base, m))), m);
			exp--;
		}
		base= mod((mod(base, m) * mod(base, m)), m);
		exp /= 2;
	}
	return mod(total, m);
}

int n;

void solve(){
    cin >> n;

    cout<< (n % 1000 ?1000 - n%1000: 0)<< endl;
}

int32_t main(){
	fastio;
	solve();
	return 0;
}



Measured memory_bytes: 3556
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int main(){
    char s[4];
    cin >> s[0] >> s[1] >> s[2] >> s[3];
    sort(s,s+4);
    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[2]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
typedef long long ll;
using namespace std;

const int MAXN = 1e5+5;
const int MOD = 1e9+7;

int main()
{
    int n, m;
    cin >> n >> m;
    if (m == n)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  cout << (n >= 30 ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 3644