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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;

#define rep(a,n) for(ll a = 0;a < n;a++)

static const ll INF = 1e15;
static const ll mod = 1e9+7;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

int main() {
    ll n, x, t;
    cin >> n >> x >> t;
    if (n % x == 0) {
        cout << n / x * t << endl;
    }
    else {
        cout << (n / x + 1) * t << endl;

    }
    return 0;
}


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

using ll = long long;

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

    int N;
    cin >> N;

    const int MAX_NUM = (int) 1e9 + 1;
    
    ll dp[N + 1][2];
    dp[0][0] = 0;
    dp[0][1] = - MAX_NUM;

    for (int i = 0; i < N; ++i) {
        int a;
        cin >> a;
        dp[i + 1][0] = max(dp[i][0] + a, dp[i][1] - a);
        dp[i + 1][1] = max(dp[i][0] - a, dp[i][1] + a);
    }

    
    
    cout << dp[N][0] << '\n';

    return 0;
}


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

bool check(long long a, long long b) {
	long long c = a + b;

	while (1) {
		if (c == 1) {
			return true;
		}
		else if (c % 2 == 1) {
			return false;
		}
		c /= 2;
	}
}

int main() {
	long long n;
	static long long a[200000];
	static bool b[200000];
	long long count = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = true;
	}

	sort(a, a + n);

	for (long long i = n - 1; i >= 1; i--) {
		if (b[i]) {
			long long k = 2;
			for (int j = 1; j <= 30; j++) {
				if (k > a[i]) {
					break;
				}
				else {
					k *= 2;
				}
			}

			k = k - a[i];

			long long end = i - 1;
			long long start = 0;
			long long mid = (start + end) / 2;

			if (a[end] == k && b[end]) {
				//cout << a[i] << " " << a[end] << endl;
				count++;
				b[end] = false;
				b[i] = false;
			}
			else if (a[start] == k && b[start]) {
				//cout << a[i] << " " << a[start] << endl;
				count++;
				b[start] = false;
				b[i] = false;
			}
			else {
				while (1) {
					if (a[mid] > k) {
						end = mid;
					}
					else if (a[mid] < k) {
						start = mid;
					}
					else if (a[mid] == k) {
						if (b[mid]) {
							//cout << a[i] << " " << a[mid] << endl;
							count++;
							b[mid] = false;
							b[i] = false;
							break;
						}
						else {
							end--;
							if (a[end] == k && b[end]) {
								//cout << a[i] << " " << a[end] << endl;
								count++;
								b[end] = false;
								b[i] = false;
								break;
							}
						}
					}
					mid = (start + end) / 2;
					if (end - start <= 1) { break; }
				}
			}
		}
	}

	cout << count << endl;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<'\n'

ll prime(ll n){
  int n_root = sqrt(n);
  if(n==1)return 1;
  else if (n%2==0)return 2;
  for(int i=3;i<n_root+1;i+=2){
    if(n%i==0)return i;
  }
  return n;
}



int main(){
    ll n,p;
    cin >> n >> p;
    map<ll,int> mp;
    
    while(p>1){
        ll num = prime(p);
        mp[num]++;
        p /= num;
    }
    
    ll ans = 1;
    for(const auto& x:mp){
        ll num1 = x.first;
        int num2 = x.second;
        if(num2>=n) ans*= pow(num1,(num2/n));
    }
    COUT(ans);
    return 0;
}

Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] H = new int[N + 1];
        for (int i = 0; i < N; i++)
            H[i] = sc.nextInt();
        sc.close();
        H[N] = 999999999;

        int count = 0;
        int maxMv = 0;

        for (int i = 0; i < N - 1; i++) {
            if (H[i] >= H[i + 1]) {
                count++;
                if (i == N - 2) {
                    if (maxMv < count) {
                        maxMv = count;
                    }
                }
            } else {
                if (maxMv < count) {
                    maxMv = count;
                }
                count = 0;
            }
        }

        System.out.println(maxMv);


    }
}

Measured memory_bytes: 50744
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const double pi = acos(-1);

int main() {
    vl x(5);
    rep(i, 5) {
        cin >> x[i];
    }

    rep(i, 5) {
        if(x[i] == 0) {
            out(i+1);
            re0;
        }
    }

    re0;
}

Measured memory_bytes: 3572
from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


def check(min_, max_, x):
  if max_ <= x:
    # return 10**max(0, len(str(min_))-2)
    return int((max_ - min_)/10) + 1
  elif min_ <= x:
    # ret = max(1, int(str(x)[1:-1]) if len(str(x)) > 2 else 1)
    # if int(str(min_)[-1]) <= int(str(x)[-1]):
    #   ret += 1
    # return ret
    return int((x - min_)/10) + 1
  else:
    return 0


def main():
  N = int(input())

  if len(str(N)) == 1:
    print(N)
    return
  sum_ = 0
  for l in range(1, 10):
    for r in range(l, 10):
      temp = sum_
      min_ = int(str(l) + '0'*(len(str(N))-2) + str(r))
      max_ = int(str(l) + '9'*(len(str(N))-2) + str(r))
      A = check(min_, max_, N)
      # max_ = int(str(l) + '9'*(len(str(N))-3) + str(r))
      for gap in range(len(str(N))-2):
        A += (10**gap)

      min_ = int(str(r) + '0'*(len(str(N))-2) + str(l))
      max_ = int(str(r) + '9'*(len(str(N))-2) + str(l))
      B = check(min_, max_, N)
      for gap in range(len(str(N))-2):
        B += (10**gap)

      if l == r:
        A += 1
        B += 1
        sum_ += A*B
      else:
        sum_ += 2*A*B
      # print(l, r, sum_ - temp)

  print(sum_)


if(__name__ == '__main__'):
  main()


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

using namespace std;
using ll = long long;

ll powll(ll base,ll exp) { ll res = 1; while(exp>0){ if(exp & 1)res = res * base; base = base * base; exp >>= 1; } return res;}
ll mod_pow(ll base,ll exp, ll mod) { ll res = 1; while(exp>0){ if(exp & 1)res = res * base % mod; base = base * base % mod; exp >>= 1; } return res % mod;}

int main()
{
    ll n, p; string s;
    cin >> n >> p >> s;

    if(p == 2 || p == 5) {
        ll cnt = 0;
        for(ll i = n - 1; i >= 0; i--) {
            if((s[i] - '0') % p == 0) {
                cnt += i + 1;
            }
        }
        cout << cnt << endl;
    } else {
        map<ll,ll> mp;
        ll cur = 0;
        mp[cur]++;
        for(ll i = n - 1; i >= 0; i--) {
            cur += (s[i] - '0') * mod_pow(10,n - 1 - i, p);
            cur %= p;
            mp[cur]++;
        }
        ll cnt = 0;
        for(auto i : mp) {
            cnt += (ll)i.second * (i.second - 1) / 2;
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 4188
n, k = map(int, input().split())
array = sorted([int(x) for x in input().split()])
tmp = array[0]
tmp_array = []
for i in range(len(array)):
    tmp_array.append(array[i]-tmp)
    tmp = array[i]

tmp_array = sorted(tmp_array)
print(sum(tmp_array[:-n+1]) if n != 1 else sum(tmp_array))


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main(){
    ll a, b, k;
    cin >> a >> b >> k;
    ll t=min(a, k);
    a-=t; k-=t;
    t=min(b, k);
    b-=t;
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

      ans += n / 500 * 1000;
      n %= 500;

      ans += n / 5 * 5;
      System.out.println(ans);
    } finally {
      sc.close();
    }
  }
}


Measured memory_bytes: 35816
#include <cstdio>
#include <vector>

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::vector<int>> F(N, std::vector<int>(10));
  for (size_t i = 0; i < N; ++i)
    for (size_t j = 0; j < 10; ++j)
      scanf("%d", &F[i][j]);

  std::vector<std::vector<int>> P(N, std::vector<int>(11));
  for (size_t i = 0; i < N; ++i)
    for (size_t j = 0; j <= 10; ++j)
      scanf("%d", &P[i][j]);

  int res = -1e9;
  for (int i = 1; i < (1 << 10); ++i) {
    int cur = 0;
    for (size_t j = 0; j < N; ++j) {
      int p = 0;
      for (size_t k = 0; k < 10; ++k)
        if (i >> k & 1 && F[j][k]) ++p;
      cur += P[j][p];
    }
    res = std::max(res, cur);
  }
  printf("%d\n", res);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <utility> 

#define rep(i,m,n) for(int i = m;i < n;++i)
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const int MOD = 1e9 + 7;

bool is_prime(ll n) {
	if (n < 2)return 0;
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0) {
			return 0;
		}
	}
	return 1;
}


int main(){
	ll n;
	cin >> n;

	vector<ll> pr;
	rep(i, 2, n + 1) {
		if (is_prime(i))pr.push_back(i);
	}

	ll ans=1;
	for (int i = 0; i < pr.size();i++) {
		ll temp=pr[i];
		ll anstemp=0;
		while(n/pr[i] > 0){
			anstemp += n / pr[i];
			pr[i] *= temp;
		}
		ans = ((anstemp + 1)*ans) % MOD;
	}


	cout << ans << endl;
}


Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin>>s;
    for(int i=0;i<4;i++){
        cout<<s[i];
    }
    cout<<" ";
    for(int i=0;i<8;i++){
        cout<<s[i+4];
    }
    cout<<endl;
    return 0;
}



Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BPapersPlease solver = new BPapersPlease();
        solver.solve(1, in, out);
        out.close();
    }

    static class BPapersPlease {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            boolean f = true;
            int n = in.nextInt();
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                if (x % 2 == 0) {
                    if (x % 3 != 0 && x % 5 != 0) {
                        f = false;
                        break;
                    } else {
                        continue;
                    }
                }
            }
            if (f) out.println("APPROVED\n");
            else out.println("DENIED\n");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll a[100009];
ll power(ll x,ll y)
{
    ll res=1;
  
    while(y>0)
    {
        if(y&1)
            res=res*x;
        res%=mod;
        y=y>>1;
        x=x*x;
        x%=mod;
    } 
    return res; 
}
ll inv(ll x)
{
	return (power(x,mod-2));
}
int main()
{
	FAST
	#ifdef ayk_16
	freopen("input.txt","rt",stdin);
	freopen("output.txt","wt",stdout);
	#endif
	ll n,k;
	cin>>n>>k;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	ll mul=1;
	ll ba=0,ca=0;
	for(ll i=1;i<=(n-k+1);i++)
	{
		ll p=(n-k-i+1);
		ca+=(a[p]*mul);
		ca%=mod;
		p=k+i-2;
		ba+=(a[p]*mul);
		ba%=mod;
		mul*=(k+i-1);
		mul%=mod;
		mul*=inv(i);
		mul%=mod;
	}
	ll ans=ba-ca;
	ans%=mod;
	ans+=mod;
	ans%=mod;
	cout<<ans;
}

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

typedef long long int ll;
void solved(){
	char s[10];scanf("%s",s+1);
	if(s[1] == '7' || s[2] == '7' || s[3] == '7')cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}
int main(){
	solved();
	return 0;
} 

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x=0) : x((x%mod+mod)%mod) {}
	mint operator-() const { 
	return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if (t&1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod-2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res/=a;
	}
	friend ostream& operator<<(ostream& os, const mint& m){
		os << m.x;
		return os;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n):fact(n+1),ifact(n+1) {
		assert(n < mod);
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
	int s;cin >> s;
	if(s < 3) {
		cout << 0 <<endl;
		return 0;
	}
	mint ans = 0;
	combination c(4000);
	for(int i = 1;i <= s/3;i++){
		ans += c(s-3*i+i-1,i-1);
		//cout <<  c(s-3*i+1,i-1) << endl;;
		
	}
	cout << ans << endl;

} 
 

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

using namespace std;
typedef long long ll;

int main() {
  vector<int> a(3);
  for (int i = 0; i < 3; i++) cin>>a[i];
  sort(a.begin(),a.end());
  int ans = a[2] - a[0];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
    VECCIN(head);
    VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
    seco[head]=IN();
    VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
    CIN(n);
    SANKOU(n<1000,ABC,ABD);
 
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
double Pi = 3.1415926535897932384626;
 
vector<ll> G[550010];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 1000000007;
/*
2000000011 is prime
2000000033 is prime
*/

ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}

/*
ll fact[800005],rfact[800005];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[800000] = rui(fact[800000],mod - 2);
    for(ll i=800000; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,ans;
ll x[500005],y[500005],z[500005];
ll res;
char s[500005];

int main(){
    cin >> n >> k;
    cin >> s;
    for(int i=0;i<n-1;i++){
        if(s[i] == s[i+1]){
            res++;
        }else{
            ans += res;
            res = 0;
        }
    }
    ans += res;
    res = 0;
    ans += 2 * k;
    ans = min(ans, n - 1);
    p(ans);
    return 0;
}






Measured memory_bytes: 15232
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int V,E,r;
const int Inf = 10000*100000+100;
ll C[100010];
int main(){
	while(cin >> V >> E >> r && V >0){
		vector< vector< P > > v(V+10);
		for(int i=0;i<E;i++){
			ll s,t,d;
			cin >> s >> t >> d;
			v[s].push_back(make_pair(d,t));
		}
		priority_queue<P> Q;
		Q.push(P(0,r));
		for(int i=0;i<V;i++){
			C[i] = Inf;
		}
		C[r] = 0;
		while(!Q.empty()){
			P t = Q.top();
			ll s = t.second;
			Q.pop();
			if(C[s] < t.first) continue;
			for(int i=0;i<v[s].size();i++){
				P e = v[s][i];
				if(C[e.second] > C[s] + e.first){
					C[e.second] = C[s] + e.first;
					Q.push(make_pair(-C[e.second],e.second));
				}
			}
		}
		for(int i=0;i<V;i++){
			if(C[i] < Inf) cout << C[i] << endl;
			else cout << "INF" << endl;
		}
	}
}
#if 0
所要時間45分程度。ほとんどの部分はテキストを見ながら自力で書いたがうまくいかず，
蟻本(プログラミングコンテストチャレンジブック)(最近友人から譲ってもらった)を見て28行目を追加しAC
「確定しているので無視」ということの意味があまりわかっていなかったらしい。
#endif



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

int main() {
  int n, k; cin >> n >> k;
  vector<int> l(n);
  for (int i = 0; i < n; i++) cin >> l[i];
  sort(l.begin(), l.end(), greater<int>());
  int ans = 0;
  for (int i = 0; i < k; i++) ans += l[i];
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()
#define foreach(it,c) for(typeof(c.begin()) it=c.begin();it!=c.end();++it)

int main()
{
    vector<int> h; int t;

    REP(10) { cin >> t; h.push_back(t);}
    sort(all(h), greater<int >());

    cout << h[0] << endl;
    cout << h[1] << endl;
    cout << h[2] << endl;
    return 0;
}

Measured memory_bytes: 1216
a,b = map(int,input().split())
l = [2,3,4,5,6,7,8,9,10,11,12,13,1]
A = l.index(a)
B = l.index(b)
if A > B:
    print('Alice')
elif A == B:
    print('Draw')
else:
    print('Bob')

Measured memory_bytes: 3064
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

using ll = long long int;
using namespace std;

int main(){

  ll N;
  vector<string> S;
  string str;

  cin >> N;
  for(ll i = 0; i < N; i++){
    cin >> str;
    S.push_back(str);
  }

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

  ll ans = 1;
  for(ll i = 1; i < N; i++){
    if(S[i] != S[i-1]){
      ans++;
    }
  }

  cerr << "Answer:" << endl;
  cout << ans << endl;

  return 0;
  
}


Measured memory_bytes: 11660
#include <iostream>
#include <bits/stdc++.h>
#include <iomanip>

using namespace std;

double find_angle(int a, int b, int x) 
{ 
  
    // Now we have the volume 
    // of rectangular prism a*a*b 
    int volume = a * a * b; 
  
    double ans = 0; 
  
    // Now we have 2 cases! 
    if (x < volume / 2) { 
  
        float d = (a * b * b) / (2.0 * x); 
  
        // Taking the tangent inverse of value d 
        // As we want to take out the required angle 
        ans = atan(d); 
    } 
    else { 
  
        x = volume - x;
        double d = (2 * x) / (double)(a * a * a); 
  
        // Taking the tangent inverse of value d 
        // As we want to take out the required angle 
        ans = atan(d); 
    } 
  
    // As of now the angle is in radian. 
    // So we have to convert it in degree. 
    ans = (ans * 180) / 3.14159265; 
  
    return ans; 
} 

int main()
{
    int a,b,x;
    cin >> a >> b >> x;
    cout << fixed << setprecision(6);
    cout << find_angle(a,b,x) << endl;

    return 0;
}

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

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

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int s, w;
    cin >> s >> w;
    if(w >= s) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }

    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


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

using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const ld eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i, a, b) for (ll i=(a); i<(b);i++)
#define FORD(i, a, b) for (ll i=ll(b)-1; i>=(a); i--)
#define TR(X) ({ if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })


ll heights[100205] = {0};
ll minCosts[100205] = {0};

int main() {
	cin.sync_with_stdio(0);


	ll n, k;
	cin >> n >> k;
	FOR(i, 0, n) {
		ll tmp;
		cin >> tmp;
		heights[i] = tmp;
	}
	minCosts[n - 1] = 0;
	minCosts[n - 2] = abs(heights[n - 1] - heights[n - 2]);
	FORD(i, 0, n - 2) {
		ll mini = oo;
		FOR(j, 1, k + 1) {
			if (i + j < n) {
				ll tmp = abs(heights[i] - heights[i + j]) + minCosts[i + j];
				if (tmp < mini)
					mini = tmp;
			}
		}
		minCosts[i] = mini;
	}
	cout << minCosts[0];
}

Measured memory_bytes: 1792
# coding: utf-8

n, a, b = map(int, input().split())

total = 0
for i in range(n):
    i_str = str(i+1)
    num = 0
    for j in range(len(i_str)):
        num += int(i_str[j])
    if a <= num <= b:
        total += i+1

print(total)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int vis[110];
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    if(n%2) cout<<"No"<<endl;
    else
    {
        for(int i=0;i<s.size();i++)
        {
            vis[i]=s[i]-'0';
        }
        bool flag=true;
        for(int i=n/2;i<n;i++)
        {
            if(vis[i]!=vis[i-n/2])
            {
                flag=false;
                break;
            }
        }
        if(flag) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String[] sArray = new String[4];
        int count = 0;
        
        for (int i = 0; i < 4; i++) {
            sArray[i] = s.substring(i, i + 1);
        }
        
        Arrays.sort(sArray);
        if (sArray[0].equals(sArray[1])) {
            count++;
        }
        
        if (sArray[2].equals(sArray[3])) {
            count++;
        }
        
        if (!sArray[0].equals(sArray[3]) ) {
            count++;
        }
        
        if (count == 3) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} 

Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;
const double PI = 3.14159265358979323846264338327950288;

int cnt[100010];
int main()
{
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		cnt[a]++;
		cnt[b]++;
	}
	for (int i = 0; i < N; i++) {
		if (cnt[i] % 2 == 1) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}


Measured memory_bytes: 768
#import sys

#input = sys.stdin.readline
import math
#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True


def main():
#    h,w,a,b = map(int, input().split())
    n = int(input())
    xy=[]
    for i in range(n):
        xy.append(list(map(int,input().split())))
    d = []
    for i in range(0,n-1):
        for j in range(i+1,n):
            d.append(math.sqrt((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2))
#    print(d)
    ave=n*(n-1)//2
    aveve=math.factorial(n)*(n-1)
    aveve2=aveve//ave
    ave2=sum(d)*aveve2/(math.factorial(n))
    print(ave2)

if __name__ == "__main__":
    main()

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

using namespace std;

int main() {
    string s, t;    cin >> s >> t;
    int dp[1001][1001] = {0};
    int ls = s.size(), lt = t.size();

    for (int i = 0; i <= ls; i++)
        dp[i][0] = i;
    for (int j = 0; j <= lt; j++)
        dp[0][j] = j;
    
    for (int i = 0; i < ls; i++) {
        for (int j = 0; j < lt; j++) {
            if (s[i] == t[j])
                dp[i+1][j+1] = min(dp[i][j], min(dp[i][j+1]+1, dp[i+1][j]+1));
            else 
                dp[i+1][j+1] = min(dp[i][j], min(dp[i][j+1], dp[i+1][j])) + 1;
        }
    }

    cout << dp[ls][lt] << endl;

    return 0;
}


Measured memory_bytes: 7116
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] x = new int[N];
    int[] y = new int[N];
    for (int i = 0; i < N; i++) {
	  x[i] = sc.nextInt();
	  y[i] = sc.nextInt();
    }
    sc.close();
    
    double sum = 0;
    int[] idx = new int[N];
    long cnt = 0;
    while (next_permutation(idx)) {
      for (int i = 0; i < N - 1; i++) {
        int j = idx[i] - 1;
        int k = idx[i + 1] - 1;
        sum += Math.sqrt(
          (x[j] - x[k]) * (x[j] - x[k]) +
          (y[j] - y[k]) * (y[j] - y[k])
        );
      }
      cnt++;
    }
    
    System.out.println(sum / cnt);
  }
  
  private static boolean next_permutation(int[] ints) {
    if (ints[0] == 0) {
      for (int i = 0; i < ints.length; i++) ints[i] = i + 1;
      return true;
    }

    int l = -1;
    for (int i = ints.length - 2; l == -1 && l < i; i--)
      if (ints[i] < ints[i + 1]) l = i;
    if (l == -1) return false;

    int r = l;
    for (int i = ints.length - 1; r == l && l < i; i--)
      if (ints[l] < ints[i]) r = i;

    int t = ints[r];
    ints[r] = ints[l];
    ints[l] = t;
    l++;
    r = ints.length - 1;
    while (l < r) {
      t = ints[r];
      ints[r] = ints[l];
      ints[l] = t;
      l++;
      r--;
    }
    return true;
  }  
}

Measured memory_bytes: 22208
import java.util.*

fun main(args: Array<String>) {
    val (N, C) = readLine()!!.split(" ").map{it.toLong()}

    val cal = TreeMap<Long, Long>()
    val rcal = TreeMap<Long, Long>()

    for (i in 1..N) {
        val (x, v) = readLine()!!.split(" ").map{it.toLong()}
        val e = cal.lowerEntry(x)
        cal[x] = v + (e?.value ?: 0L) - (x - (e?.key ?: 0L))
        rcal[C - x] = v
    }

    for (k in rcal.keys) {
        val e = rcal.lowerEntry(k)
        rcal[k] = rcal[k]!! + (e?.value ?: 0L) - (k - (e?.key ?: 0L))
    }

    fun func(cal: TreeMap<Long, Long>) {
        for (k in cal.keys) {
            cal[k] = Math.max(cal[k]!!, cal.lowerEntry(k)?.value ?: 0L)
        }
    }

    func(cal)
    func(rcal)

    fun calc(mp: TreeMap<Long, Long>, rmp: TreeMap<Long, Long>): Long {
        var r = 0L

        for (e in mp.entries) {
            r = Math.max(r, e.value)

            val t = rmp.lowerEntry(C - e.key)?.value ?: 0L
            r = Math.max(r, e.value + t - e.key)
        }

        return r
    }

    println(Math.max(calc(cal, rcal), calc(rcal, cal)))
}


Measured memory_bytes: 105804
import bisect
N = int(input())
ABC = [list(map(int,input().split())) for i in range(3)]
ABC[0].sort()
ABC[2].sort()

ans = 0
for i in range(N):
    B_hi = bisect.bisect_left(ABC[0],ABC[1][i])
    B_lo =N - bisect.bisect_right(ABC[2],ABC[1][i])
    ans += B_hi * B_lo

print(ans)

Measured memory_bytes: 22720
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
  int N, neg=0;// neg; 負のAiの個数
  cin >> N;
  vector<int> A(N);
  rep(i, N) {
      cin >> A[i];
      if(A[i]<0) neg++;
  }
  sort(A.begin(), A.end());
  
  //rep(i, N) {
  //  cout << A[i] <<endl;
  //}

  vector<int> x(N-1), y(N-1);
  int start = 0;
  int tmp = 0;
  // 負の数字を１つ残して抹消する．

  if(neg==N) { // 全て負の時
    x[0] = A[N-1]; 
    y[0] = A[N-2];
    tmp = x[0] - y[0];
    for(int i=1; i<N-1; i++) {
        x[i] = tmp;
        y[i] = A[N-i-2];
        tmp = x[i] - y[i];
    }
  }
  else if(neg>1) { // 負が2個以上．0以上が1個以上
    rep(i, neg-1) { // まず負を削る
        x[i] = A[N-1]; // max
        y[i] = A[i]; // 負
        A[N-1] = A[N-1] - A[i];
    }
    start = neg-1; //最大N-2
    //cout << start << endl;

    if(start<N-2) {
        x[start] = A[start];
        y[start] = A[start+1];
        tmp = x[start] - y[start];
        for(int i=start+1; i<N-2; i++){ // small - big
            x[i] = tmp;
            y[i] = A[i+1];
            tmp = x[i] - y[i];
        }
        // 最後の一回は 大 - 小
        x[N-2] = A[N-1];
        y[N-2] = tmp;
        tmp = x[N-2] - y[N-2];
    } else { // start == N-2
        // 最後の一回は 大 - 小
        x[N-2] = A[N-1];
        y[N-2] = A[N-2];
        tmp = x[N-2] - y[N-2];
    }

  }
  else { // 負が1個以下
    x[0] = A[0];
    y[0] = A[1];
    tmp = x[0] - y[0];
  
    for(int i=1; i<N-2; i++){ // small - big
      x[i] = tmp;
      y[i] = A[i+1];
      tmp = x[i] - y[i];
    }
    // 最後の一回は 大 - 小
    x[N-2] = A[N-1];
    y[N-2] = tmp;
    tmp = x[N-2] - y[N-2];
  }

  cout << tmp << endl;
  rep(i, N-1) {
      cout << x[i] << ' ' << y[i] << endl;
  }

  return 0;
}


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

bool is_connected(int n, int m, int a[], int b[], int remove) {
    vector<int> adj[n];
    for (int i = 0; i < m; i++) {
        if (i == remove)
            continue;
        adj[a[i]].push_back(b[i]);
        adj[b[i]].push_back(a[i]);
    }

    queue<int> que;
    que.push(0);

    bool visited[n];
    fill(visited, visited + n, false);

    while (!que.empty()) {
        int p = que.front(); que.pop();
        if (visited[p])
            continue;
        visited[p] = true;
        for (int x : adj[p]) {
            que.push(x);
        }
    }

    for (bool p : visited) {
        if (!p) return false;
    }
    return true;
}


int main() {
    int n, m;
    cin >> n >> m;

    int a[m], b[m];
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    int count = 0;
    for (int i = 0; i < m; i++) {
        if (!is_connected(n, m, a, b, i)) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    for (case in 1..50) {
        val W = sc.nextInt()
        if (W == 0) break
        val N = sc.nextInt()
        val a = Array(N, { sc.next().split(",").map { Integer.parseInt(it) } })
        val dp = Array(W+1, { 0 })
        dp[0] = 0
        for ((item_v, item_w) in a) {
            for (to_w in W downTo item_w) {
                dp[to_w] = Math.max(dp[to_w], dp[to_w-item_w]+item_v)
            }
        }
        val ans = dp.max()!!
        val index = dp.indexOf(ans)
        println("Case $case:")
        println(ans)
        println(index)
    }
}


Measured memory_bytes: 57120
import java.util.Scanner;
 

//result = Math.pow(num1, num3)
//StringBuffer str = new StringBuffer(hoge1);
//String hoge2 = str.reverse().toString();
public class Main {
	private static Scanner sc = new Scanner(System.in);
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p(long ans) {System.out.println(ans);};
	//static String eikomoji[]={"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"};
	
	
	public static void main(String[] args) {
	long N =sc.nextInt();
	long R =sc.nextInt();
	long g=0;
	boolean a=true;
		for(int d=0;a;d++) {
			g+=(long)Math.pow(R, d)*(R-1);
			if(g>=N) {
					p(d+1);
					a=false;
				}
			
		}
		
		
	}
}

Measured memory_bytes: 20948
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i,n) for(int (i) = 0; (i) < (int)(n); (i)++)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) (x.begin(), x.end())

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if((abs(b-a)<=d && abs(c-b)<=d) || abs(a-c) <= d) Yes();
    else No(); 
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/

//Optional FAST

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

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

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

//Required typedefs

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

//Required Constants

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

//Required Functions

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

//Work

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

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

    char c;
    cin>>c;
    c++;
    cout<<c<<endl;

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


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        
        if(T.substring(0, S.length()).equals(S)){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35452
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int main(void) {
    int a, b;
    cin >> a >> b;
    if (a >= 0 && b <= 0 || a < 0 && b > 0) cout << abs(abs(a)-abs(b)) + 1 << endl;
    else if (a <= b) cout << b - a << endl;
    else cout << a - b + 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

ll gcd (ll a, ll b){
    ll k = a % b;
    while (k > 0){
        a = b;
        b = k;
        k = a % b;
    }
    return b;
}

int main() {
    int d; cin >> d;
    vector<int> ar(26);
    rep(i,26) cin >> ar[i];
    vector<int> ans(d);
    rep(i,d){
        vector<P> ima(26);
        rep(j,26){
            cin >> ima[j].first;
            ima[j].second = j+1;
        }
        sort(ima.rbegin(),ima.rend());
        ans[i] = ima[1].second;
    }
    rep(i,d) cout << ans[i] << endl;
}

Measured memory_bytes: 3636
Scanf.scanf "%s %s" @@ fun s' t->
let reg = Str.global_replace (Str.regexp ".") "[\\0\\?]" t in
print_endline @@ try
  let i = Str.search_backward (Str.regexp reg) s' (String.length s') in
  Str.string_before s' i ^ t ^ Str.string_after s' (i+String.length t)
  |> String.map (function | '?' -> 'a' | c -> c)
with _ -> "UNRESTORABLE"

Measured memory_bytes: 384
#与えられる変数
N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
ans=0

#Aの各要素の2進数表記した時のi番目の数について見ていく（Aの要素は最大でも2の60乗だから0≦i≦60）
#XORは2進数表記した時の2つの数が違うとき,その桁の数を1とする
#2進数表記したi番目の数が異なる場合の数がその桁での和として表現できる
#その場合の数は(0の個数)×(1の個数)で表現できる
for i in range(61):
    yes=sum([1 for a in A if (a>>i)&1])
    no=N-yes
    ans+=(1<<i)*yes*no

ans%=mod
print(ans)



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

using namespace std;

int main()
{
	//freopen("input14.txt","r",stdin);freopen("output14.txt","w",stdout);
	string a,b;
	int i;
	cin>>a;
	for (i=0;i<a.length();i++){
		if (a[i]!='B'){
			b.push_back(a[i]);
		}
		else {
			if (b.length()>0){
				b.pop_back();
			}
		}
	}
	cout<<b;
	return 0;
}

Measured memory_bytes: 256