akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;
 
const int N=200005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar();
	while(ch>'9'||ch<'0') ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
}
 
struct node{int x,y;}a[N],q[N];
int n,m,yy[N],mx=0,mn=inf;
int p[N<<2],flag[N<<2];
 
inline bool cmp(const node &a,const node &b){return a.x<b.x;}
inline void add(int k,int b){
	p[k]=(ll)p[k]*b%mod,flag[k]=(ll)flag[k]*b%mod;
}
inline void push(int k){
	if(flag[k]==1) return;
	add(ls,flag[k]);add(rs,flag[k]);
	flag[k]=1;
}
inline void ch(int l,int r,int x,int k,int b){
	if(l==r){ch(p[k],b);return;}
	int mid=l+r>>1;
	push(k);
	if(x<=mid) ch(l,mid,x,ls,b); else ch(mid+1,r,x,rs,b);
	p[k]=(p[ls]+p[rs])%mod;
}
inline void mul(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y){add(k,2);return;}
	push(k);int mid=l+r>>1;
	if(x<=mid) mul(l,mid,x,y,ls);
	if(y>mid) mul(mid+1,r,x,y,rs);
	p[k]=(p[ls]+p[rs])%mod;
}
inline int get(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y) return p[k];
	push(k);int ans=0,mid=l+r>>1;
	if(x<=mid) ch(ans,get(l,mid,x,y,ls));
	if(y>mid) ch(ans,get(mid+1,r,x,y,rs));
	return ans;
}
 
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i].x,&a[i].y),yy[i]=a[i].y;
	sort(yy+1,yy+n+1);
	m=unique(yy+1,yy+n+1)-yy-1;
	for(int i=1;i<=n;i++) a[i].y=lower_bound(yy+1,yy+m+1,a[i].y)-yy;
//	for(int i=1;i<=n;i++) printf("%d %d\n",a[i].x,a[i].y);
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		int l=i,r=i;
		while(r<=n&&a[r].x==a[l].x) r++;
		for(int j=l;j<r;j++)
			q[j].y=max(mx,a[j].y);
		for(int j=l;j<r;j++)
			gmax(mx,a[j].y);
		i=r-1;
	}
	reverse(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		int l=i,r=i;
		while(r<=n&&a[r].x==a[l].x) r++;
		for(int j=l;j<r;j++)
			q[n-j+1].x=min(mn,a[j].y);
		for(int j=l;j<r;j++)
			gmin(mn,a[j].y);
		i=r-1;
	}
	sort(q+1,q+n+1,cmp);
	for(int i=1;i<=800000;i++) flag[i]=1;
//	for(int i=1;i<=n;i++) printf("%d %d\n",q[i].x,q[i].y);
//	return 0;
	ch(0,m,0,1,1);
	for(int i=1;i<=n;i++){
		int k=get(0,m,q[i].x-1,q[i].y,1);
		ch(0,m,q[i].y,1,k);
		if(q[i].y<m) mul(0,m,q[i].y+1,m,1);
	}
	printf("%d\n",get(0,m,m,m,1));
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  for (int i=1; i<=9; i++) {
    if (111 * i >= N) {
      cout << 111 * i << endl;
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 256
x=range(int(input())-1,-1,-1)
P=[]
for _ in x:P+=[[int(i) for i in input().split()]]
P+=[P[0]]
for j in x:_+=P[j][0]*P[j+1][1]-P[j][1]*P[j+1][0]
print(_*0.5)

Measured memory_bytes: 7720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		double ans = a[0];
		for(int i = 1; i < n; i++) {
			ans =(ans + a[i])/2;
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

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

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

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

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

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


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

const double PI = acos(-1);
using ll = long long;
using ull = unsigned long long;
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define REP(i,n) for (int i = 0; i < (n); i++)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second

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

  int a,b,c;
  cin >> a >> b>> c;
  cout << min(c,b/a) << endl;


  return 0;
}


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


int main () {
  vector<int> cost(3);
  for (int i = 0; i < 3; ++i) {
    cin >> cost.at(i);
  }
  sort(cost.begin(), cost.end());
  int ans = 0;
  ans += cost.at(1) - cost.at(0);
  ans += cost.at(2) - cost.at(1);
  cout << ans << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

template <typename T>
void quit(T a)
{
    cout << a << endl;
    exit(0);
}

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 10010020030040056ll;
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    ll x, k, d;
    cin >> x >> k >> d;
    ll MOD = x % d;
    if (abs(x - MOD) / d > k)
    {
        if (x >= 0)
        {
            cout << abs(x - k * d) << endl;
            return 0;
        }
        else
        {
            cout << abs(x + k * d) << endl;
            return 0;
        }
    }
    if ((k - (x - MOD) / d) % 2 == 0)
    {
        cout << abs(MOD) << endl;
    }
    else
    {
        cout << min(abs(MOD + d), abs(MOD - d)) << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LLINF = 9223372036854775807;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main() {
	int n; cin >> n;
	VI a(n); REP(i, n)cin >> a[i];
	REP(i, n) a[i] -= i;
	sort(ALL(a));
	ll k = a[n / 2], ans = 0;
	REP(i, n) ans += abs(a[i] - k);
	cout << ans;
}

Measured memory_bytes: 1792
use proconio::*;

fn calc(mut a: Vec<(u32, i32)>, item: (u32, i32)) -> Vec<(u32, i32)> {
    let mut b = a.iter().map(|a| (a.0 + item.0, a.1 + item.1)).collect::<Vec<_>>();
    let mut c = Vec::with_capacity(a.len() * 2);
    while !(a.is_empty() || b.is_empty()) {
        if a.last().unwrap().1 >= b.last().unwrap().1 {
            c.push(a.pop().unwrap());
        } else {
            c.push(b.pop().unwrap());
        }
    }
    for p in a.into_iter().chain(b.into_iter()).rev() {
        c.push(p);
    }
    c.reverse();
    for i in 1..c.len() {
        c[i].0 = std::cmp::max(c[i].0, c[i - 1].0);
    }
    c
}

#[fastout]
fn run() {
    input! {
        n: usize,
        mut item: [(u32, i32); n],
        q: usize,
        ask: [(usize, i32); q],
    }
    item.insert(0, (0, 0));
    let mut memo = vec![vec![]; n + 1];
    memo[1] = vec![(0, 0), item[1]];
    let batch = 12;
    for i in 2..=std::cmp::min(n, 1 << batch) {
        memo[i] = calc(memo[i / 2].clone(), item[i]);
    }
    for (start, width) in ask {
        let ans = if start < (1 << batch) {
            memo[start].iter().filter(|p| p.1 <= width).max().unwrap().0
        } else {
            let mut dp = vec![(0, 0)];
            let mut pos = start;
            while pos >= (1 << batch) {
                dp = calc(dp, item[pos]);
                pos /= 2;
            }
            let memo = &memo[pos];
            let mut i = 0;
            let mut j = memo.len();
            let mut ans = 0;
            while i < dp.len() && j > 0 {
                if dp[i].1 + memo[j - 1].1 <= width {
                    ans = std::cmp::max(ans, dp[i].0 + memo[j - 1].0);
                    i += 1;
                } else {
                    j -= 1;
                }
            }
            ans
        };
        println!("{}", ans);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 103604
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        long k = sc.nextLong();

        long[] sumA = new long[n+1];
        long[] sumB = new long[m+1];

        for (int i=1; i<=n; i++) {
            long a = sc.nextLong();
            sumA[i] = sumA[i-1] + a;
        }

        for (int i=1; i<=m; i++) {
           long b = sc.nextLong();
            sumB[i] = sumB[i-1] + b;
        }

        int ans = 0;
        int flag = m;
        for(int i=0; i<=n; i++) {
            if(sumA[i]>k) break;
            while (sumB[flag]>k-sumA[i]&&flag>0) {
                flag--;
            }
            ans = Math.max(ans, i+flag);
        }
        System.out.print(ans);
    }
}

Measured memory_bytes: 63068
//
//AtCoder Beginner Contest 126
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

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

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

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

    ld ans = 0;

    FOR(i, 1, n){
        ld tmp = 1.0/n;
        ll scr = i;
        while(k>scr){
            scr*=2;
            tmp/=2;
        }
        ans+=tmp;
    }
    cout << fixed;
    cout << setprecision(12) << ans << endl ;

    return 0;
}


Measured memory_bytes: 3760
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

    ll a,b,c;
    cin>>a>>b>>c;
     if(a&1LL || b&1LL || c&1LL)
    {
        cout<<"0"<<endl;
        return 0;
    }
    if(a==b and b==c)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    ll step=0;
    while(a%2==0 and b%2==0 and c%2==0)
    {
       ll aa=a/2;
       ll bb=b/2;
       ll cc=c/2;
        ll sum1=aa+bb;
        ll sum2=aa+cc;
        ll sum3=bb+cc;
        c=sum1;
        b=sum2;
        a=sum3;






        step++;

    }
    cout<<step<<endl;

}



Measured memory_bytes: 3548
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n ,k;
    cin>> n>> k;
    if(k<=20){
        string s ="";
        while(n!=0){
            int temp = n%k;
                n = n/k;
                s+=(char)temp+'0';
        }
        cout<<s.size();
    }


}


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

long long n,k;


bool solve(long time,vector<long long>a,vector<long long>f,vector<long long>t){
    long long cost=0LL;

    for(long long i=0LL;i<n;i++){
        if(t[i]>time){
            cost+=a[i]-time/f[i];
        }
    }
    return (cost<=k);
}

int main(){
    
    cin>>n>>k;
    vector<long long>a(n),f(n),t(n);
    for(long long i=0LL;i<n;i++)cin>>a[i];
    for(long long i=0LL;i<n;i++)cin>>f[i];


    sort(a.begin(),a.end());
    sort(f.rbegin(),f.rend());

    //for(long long i=0;i<n;i++)cout<<a[i]<<f[i]<<endl;

    //cout<<"time"<<endl;
    for(long long i=0LL;i<n;i++){
        t[i]=a[i]*f[i];
        //cout<<t[i]<<endl;
    }
    //cout<<"ans"<<ma<<endl;


    long long ng=-1LL,ok=1000000000000LL,mid;
    while(abs(ng-ok)>1LL){
        mid=(ok+ng)/2LL;
        //cout<<ok<<" "<<mid<<" "<<ng<<" "<<endl;
        if(solve(mid,a,f,t))ok=mid;
        else ng=mid;
    }
    //cout<<(solve(mid,a,f,t)?"ok":"ng")<<endl;
    cout<<mid+!(solve(mid,a,f,t))<<endl;
    return 0;
}

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



int main()
{
    //freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
    	cin>>a[i];
    }
    ll m,p,x,s,temp;
    cin>>m;
    for(ll i=1;i<=m;i++)
    {   
    	s=0;
    	cin>>p>>x;
    	temp=a[p-1];
    	a[p-1]=x;
    	for(ll i=0;i<n;i++)
    	{
    		s=s+a[i];
    	}
    	cout<<s<<endl;
    	a[p-1]=temp;
    }
   
    return 0;
}

Measured memory_bytes: 3616
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int n,k;
struct per{
  vector<int> x;
  void pob(){
    x.resize(n);
    R(i,n){
      cin >> x[i];
      x[i]--;
    }
  }
  void wys(){
    R(i,n){
      cout << x[i] + 1 << " ";
    }
    cout << "\n";
  }
  void odw(per a){
    x.resize(n);
    R(i,n){
      x[a.x[i]] = i;
    }
  }
  per(){};
  per(per a,per b):x(n){
    R(i,n){
      x[i] = a.x[b.x[i]];
    }
  };
  void id(){
    x.resize(n);
    R(i,n)x[i] = i;
  }
}a,b,a2,b2,res;

vector<vector<int>> xxx = 
{
  {1,-2},
  {2,1,-2},
  {2},
  {2,-1},
  {2,-1,-2},
  {-2}
};

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n >> k;
  a.pob();
  if(k == 1){
    a.wys();
    return 0;
  }
  b.pob();
  a2.odw(a);
  b2.odw(b);
  per spec(per(b,a2),per(b2,a));
  res.id();
  int w = (k + 1) / 6;
  while(w){
    if(w & 1){
      res = per(res,spec);
    }
    w/=2;
    spec = per(spec,spec);
  }
  for(int el:xxx[k%6]){
    if(el == 2){
      res = per(res,b);
    }else if(el == 1){
      res = per(res,a);
    }else if(el == -1){
      res = per(res,a2);
    }else {
      res = per(res,b2);
    }
  }
  
  spec = per(per(a2,b),per(a,b2));
  w = (k - 2) / 6;
  while(w){
    if(w & 1){
      res = per(res,spec);
    }
    w/=2;
    spec = per(spec,spec);
  }
  res.wys();
  
//   vector<vector<int>> f;
//   f.PB({1});
//   f.PB({2});
//   for(int i = 0; i < 20; i++){
//     vector<int> pom = f[i + 1];
//     reverse(ALL(f[i]));
//     for(int el:f[i]){
//       if(el == pom.back()){
//         pom.pop_back();
//       }else
//         pom.PB(-el);
//     }
//     reverse(ALL(f[i]));
//     f.PB(pom);
//     debug(pom);
//   }
}


Measured memory_bytes: 10392
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
typedef vector<string> vstring;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  if(s[1]=='B'){
    cout<<"ARC"<<'\n';
  }
  else{
    cout<<"ABC"<<'\n';
  }
  
  return(0);
}


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    string s;
    cin >> s;

    i32 chars = 0;
    for(auto ch : s) {
        chars |= (1<<(i32)(ch-'a'));
    }

    bool all_1 = 1;
    char ch = 'a';
    for(i32 i = 0; i < 26; ++i) {
        if(!((chars>>i) & 1)) {
            ch = (char)(ch + i);
            all_1 = 0;
            break;
        }
    }
    if(all_1) {
        i32 chs = 0;
        while (s.size()) {
            char tmp = *--s.end();
            for(i32 i = (tmp-'a')+1; i < 26; ++i) {
                if((chs>>i) & 1) {
                    *--s.end() = 'a' + i;
                    cout << s << '\n';
                    return 0;
                }
            }
            chs |= (1<<(i32)(tmp-'a'));
            // debug
//            rrep(i, 26) cout << (chs>>i & 1 ? 1 : 0);
//            cout << '\n';
//            debug(*--s.end());
            s.pop_back();
        }
        cout << -1 << '\n';
    }
    else {
        s.push_back(ch);
        cout << s << '\n';
    }


    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = N;
  vector<int> E(N), W(N), total(N);
  int ecount =0;
  int wcount=0;
  for(int i=0;i<N;i++){
      E[i]=ecount;
      W[N-1-i]=wcount;
      if(S[i]=='W') wcount++;
      if(S[N-1-i]=='E') ecount++;
  }
  for(int i=0;i<N;i++){
      total[i]=E[i]+W[i];
      ans = min(ans,total[i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 4228
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = M / N; i >= 1; i--) {
	  if (M % i == 0) {
		  cout << i << endl;
		  return 0;
		}
	}
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
    long long fin=0;
    long long n;
    cin>>n;
    string s;
    cin>>s;
    long long r=0, g=0, b=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='R'){
            r++;
        }
        else if(s[i]=='G'){
            g++;
        }
        else{
            b++;
        }
    }
    fin=r*g*b;
    for(int i=0;i<s.size();i++){
        for(int j=i+1;j<s.size();j++){
            if(2*j-i<s.size() && s[2*j-i]!=s[i] && s[2*j-i]!=s[j] && s[i]!=s[j]){
                fin--;
            }
        }
    }
    cout<<fin;
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll Q=1000000007;

int func(string X,int c){// 0 <= c <= 25
  char Z = 'a' + c;
  string Y = "";
  Y = Y + Z;
  Y = Y + X;
  Y = Y + "#";
  //cout << Y << endl;
  int i=0,j=1,ans=0;
  while(true){
    if(Y[i+j]=='#'){
      ans = max(ans,j-1);
      return ans;
    }else if(Y[i+j]==Z){
      ans = max(ans,j-1);
      i=i+j;
      j=0;
    }
    j++;
  }
}
  
int main(){
  string S;
  cin >> S;
  int ans=100000;
  for(int i=0;i<26;i++){
    ans = min(ans,func(S,i));
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define int long long

using ll = long long;
const ll mod = LLONG_MAX;

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


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

int main(){
	int N,K;
	cin>>N>>K;
	vector<int> count;
	count.push_back(0);
	char bc='0';
	for(int i=0;i<N;++i){
		char ic;
		cin>>ic;
		if(bc == ic){
			++count.back();
		}else{
			count.push_back(1);	
			bc = ic;
		}
	}
	int ans=0;
	int nc = 0;
	int lp=0;
	int zc=0;
	for(int i=0;i<count.size();++i){
		nc += count[i];
		if(i%2 == 0){
			++zc;
			if(zc > K){
				nc -= count[lp];
				++lp;
				if(lp%2 == 0){
					nc -= count[lp];
					++lp;
				}
				--zc;
			}
		}
		ans = max(ans, nc);
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std ;


signed main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL)  ;

    int n ;
    cin >> n ;
    string s ;
    map<string ,int> mp ;
    for(int i = 0 ; i < n ; ++i)
    {
        cin >> s ;
        mp[s]++ ;
    }
    cout <<"AC x " << mp["AC"] << endl ;
    cout << "WA x "<< mp["WA"] << endl ;
    cout << "TLE x " << mp["TLE"] << endl ;
    cout << "RE x "<< mp["RE"] << endl;

}


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

#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int n; cin >> n;
	map<ll ,ll> m;
	ll a[200005];
	rep(i, 0, n){
		cin >> a[i];
		m[a[i]]++;
	}
	ll all = 0;
	for(auto kv: m){
		all += kv.second*(kv.second-1)/2;
	}
	rep(i, 0, n){
		ll x = m[a[i]];
		ll dec = 0;
		if(x>1){
			dec = (x*(x-1)/2) - ((x-1)*(x-2)/2);
		}
		cout << all-dec << endl;
	}
	return 0;
}

Measured memory_bytes: 13084
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007ULL
#define EPS 1e-8

typedef unsigned long long ULL;

ULL p3[100010];

inline ULL func(int u, int ofs){
	return ((u ? p3[u - 1] * u : 0ULL) + ofs * p3[u]) % MOD;
}

void mainmain(){
	p3[0] = 1;
	for(int i = 1; i < 100010; ++i){ p3[i] = p3[i - 1] * 3 % MOD; }
	string s;
	s.reserve(100010);
	cin >> s;
	int lt = 0;
	int rt = count(ALL(s), '?');
	int a = 0;
	int c = count(ALL(s), 'C');
	ULL ans = 0;
	for(char x : s){
		if(x == '?'){ --rt; }
		if(x == 'C'){ --c; }
		if(x == '?' || x == 'B'){
			ULL t = func(lt, a);
			ULL u = func(rt, c);
			ans = (ans + t * u) % MOD;
		}
		if(x == '?'){ ++lt; }
		if(x == 'A'){ ++a; }
	}
	cout << ans << endl;
}



}
int main() try{
	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 1152
#include <stdio.h>

int main(void){
  int n;
  scanf("%d", &n);

  int p[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }

  int ans = 0;
  for (int i = 1; i < n-1; i++) {
    if(p[i-1] < p[i] && p[i] < p[i+1]) ans++;
    if(p[i+1] < p[i] && p[i] < p[i-1]) ans++;
  }

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

  return 0;
}

Measured memory_bytes: 128
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

biggerA = 0
biggerB = 0
for ai, bi in zip(a, b):
  if ai > bi:
    biggerA += ai - bi
  if ai < bi:
    biggerB += (bi - ai) // 2
if biggerB >= biggerA:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 79804
// Code by H~$~C
#include <bits/stdc++.h>
using namespace std;

static const int Maxn = 100005;

int n, k;
int cnt[Maxn];
int has[Maxn];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= k; ++i) {
    int id;
    string s;
    cin >> id >> s;
    if (s[0] == 'A') has[id] = true;
    else if (!has[id]) cnt[id]++;
  }
  int ans = 0, ok = 0;
  for (int i = 1; i <= n; ++i)
    if (has[i]) ans += cnt[i], ok++;;
  printf("%d %d\n", ok, ans);
  return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
N = int(input())
const = ord('a')

def sub_rekkyo(s, n):
  # s: 先頭何文字か与えられている
  # n: sの中の文字数
  list_sub = [(s+chr(const+i), n) for i in range(n)]
  list_sub.append((s+chr(const+n), n+1))
  return list_sub

list_prev = [('',0)]

for i in range(N):
  list_next = []
  for s, n in list_prev:
    list_next += sub_rekkyo(s,n)
  list_prev = list_next.copy()

for s, n in list_prev:
  print(s)

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

pair<int,int> solve(int N) {
    int n, d;
    int dx[] = {-1, 0, 1, 0};
    int dy[] = {0, -1, 0, 1};
    vector<vector<int>> field(410, vector<int>(410, 0));
    vector<pair<int, int>> posi;
    field[202][202] = 1;
    posi.push_back(make_pair(202, 202));

    for (int i = 0; i < N - 1; i++) {
        cin >> n >> d;
        field[posi[n].first + dy[d]][posi[n].second + dx[d]] = 1;
        posi.push_back(make_pair(posi[n].first + dy[d], posi[n].second + dx[d]));
    }
    int minx = 1000;
    int maxx = -1;
    int miny = 1000;
    int maxy = -1;
    for(int i = 0; i<field.size(); i++){
        for(int j = 0; j<field[i].size();j++){
            if(field[i][j] == 1){
                minx = min(j,minx);
                maxx = max(j,maxx);
                miny = min(i,miny);
                maxy = max(i,maxy);
            }
        }
    }
    pair<int,int> ret = make_pair(maxx - minx+1, maxy - miny+1);
    return ret;
}

int main() {
    int N;
    vector<pair<int, int>> ans;
    while (cin >> N) {
        if (!N) break;
        ans.push_back(solve(N));
    }
    for(int i = 0; i <ans.size();i++){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
    }
}


Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <bitset>
#include <sstream> 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll,ll> Pll;

#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define repp(i, n) for(int i=1;i<=n;i++)
#define all(x) x.begin(), x.end()

#define ABS(x) (((x) > 0 ) ? (x) : (-(x)))
#define MAX2(x, y) (((x) > (y)) ? (x) : (y))
#define MIN2(x, y) (((x) < (y)) ? (x) : (y))
#define MAX3(x, y, z) ( (x) > (y)  ? ( (x) > (z) ? (x) : (z)  ) : ( (y) > (z) ? (y) : (z) )  )
#define MIN3(x, y, z) ( (x) < (y)  ? ( (x) < (z) ? (x) : (z)  ) : ( (y) < (z) ? (y) : (z) )  )
#define MID3(val1,val2,val3) MAX2(MIN2(MAX2(val1,val2),val3),MIN2(val1,val2))


#define geti1(X) scanf("%d",&X)
#define geti2(X,Y) scanf("%d%d",&X,&Y)
#define geti3(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define geti4(X,Y,Z,W) scanf("%d%d%d%d",&X,&Y,&Z,&W)

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define geti(...) GET_MACRO(__VA_ARGS__, geti4, geti3, geti2, geti1) (__VA_ARGS__)

#define INF 987654321
#define IINF 987654321987654321

int N,M,K,T,tc;
int main(void){
	ll x; cin >> x;
	ll ans = 1;
	while(true){
		ll t = (ans)*(ans+1)/2;
		if( t >= x ) break;
		ans++;
	}
	cout << ans;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h> //works like magic, but at cost.
using namespace std;
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout<<x<<endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define fk(i, k, n) for(int i=k; i<n; i++)
#define fn(i, n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<lli, lli>	pl;
typedef vector<int>		vi;
typedef vector<lli>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;

int main() {
    int X, Y;
    cin>>X>>Y;
    int crane, turtle;
        if(Y%2!=0){
            cout<<"No"<<"\n";
            return 0;
        }
        if(Y%4==0&&Y/4==X){
            cout<<"Yes"<<"\n";
            return 0;
        }if(Y%2==0&&Y/2==X){
            cout<<"Yes"<<"\n";
            return 0;
        }
    fk(i,1,X){
        crane = 2*(X-i);
        turtle = 4*i;
        if(crane+turtle==Y){
            cout<<"Yes"<<"\n";
            return 0;
        }else{
            continue;
        }
    } cout<<"No"<<"\n";  
    
    
    return 0;
}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

int main(){
    int a,b;
    cin >> a >> b;

    if(a==b){
        cout << "Yay!" << endl;
    }else if(max(a,b)*2<=16){
        cout << "Yay!" << endl;
    }else{
        cout << ":(" << endl;
    }

    return 0;
}

Measured memory_bytes: 3528
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
#define INF 0x3f3f3f
int main()
{
    int a[105], b[105], c[105];
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    b[0] = a[0];
    for(int i = 1; i < n; i++){
        b[i] = a[i] + b[i - 1];
    }
    c[n - 1] = a[n - 1];
    for(int i = n - 2; i >= 0; i--){
        c[i] = a[i] + c[i + 1];
    }
    int Min = INF;
    for(int i = 0; i < n-1; i++){
        b[i] = abs(b[i] - c[i + 1]);
        if(b[i] < Min){
            Min = b[i];
        }
    }
    cout << Min << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    vector<ll> sl(n+1),sr(n+1);
    REP(i,n){
        sl[i+1]=(sl[i]^a[i]);
    }
    REPR(i,n){
        sr[i]=(sr[i+1]^a[i]);
    }
    REP(i,n){
        cout << (sl[i]^sr[i+1]) << " ";
    }
    cout << endl;
}

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

//define-----------------------------------------------------------------------------------------------------------------------
#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 per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
//const------------------------------------------------------------------------------------------------------------------------
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;

//global-----------------------------------------------------------------------------------------------------------------------
int a, b;

//function--------------------------------------------------------------------------------------------------------------------
int main() {
	while ( scanf( "%d %d", &a, &b ) ) {
		if ( !a && !b ) {
			break;
		}
		rep( i, a ) {
			rep( j, b ) {
				if ( (i + j) % 2 ) {
					printf( "." );
				}
				else {
					printf( "#" );
				}
			}
			printf( "\n" );
		}
		printf( "\n" );
	}
	return 0;
}

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

static const int N=1000;

int lcs(string X,string Y){
    int c[N+1][N+1];
    int m=X.size();
    int n=Y.size();
    int maxl=0;
    X=' '+X;
    Y=' '+Y;
    for(int i=0;i<=m;i++) c[i][0]=0;
    for(int j=1;j<=n;j++) c[0][j]=0;
    
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(X[i]==Y[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            maxl=max(maxl,c[i][j]);
        }
    }
    return maxl;
}

int main(void){
    int n;
    string str1,str2;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> str1 >> str2;
        cout << lcs(str1,str2) << endl;
    }
    return 0;
}



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

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<db, db> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<db> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pd> vpd;
typedef vector<vi> vii;
typedef vector<vl> vll;
typedef vector<vd> vdb;
typedef vector<vb> vbb;
typedef vector<vc> vcc;
typedef vector<vs> vss;

#define f first
#define s second	
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(a) (x).rbegin(), (x).readnd()
#define rsz readsize
#define ins insert
#define cnt count
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound

#define F0R(i, a, b) for(int i = (a); i < (b); ++i)
#define FOR(i, a) F0R(i, 0, a)
#define R0F(i, a, b) for(int i = (b)-1; i >= (a); --i)
#define ROF(i, a) R0F (i, 0, a)
#define trav(a, x) for (auto& a: x)

const int MOD = 1e9+7;

//input
template<class A> void read(complex<A>& c);
template<class A, class B> void read(pair<A,B>& p);
template<class A> void read(vector<A>& v);
template<class A, size_t SZ> void read(array<A,SZ>& a);

template<class T> void read(T& x) { cin >> x; }
void read(db& d) { str t; read(t); d = stod(t); }
void read(ld& d) { str t; read(t); d = stold(t); }
template<class H, class... T> void read(H& h, T&... t) { read(h); read(t...); }

template<class A> void read(complex<A>& c) { A a,b; read(a,b); c = {a,b}; }
template<class A, class B> void read(pair<A,B>& p) { read(p.f,p.s); }
template<class A> void read(vector<A>& x) { trav(a,x) read(a); }
template<class A, size_t SZ> void read(array<A,SZ>& x) { trav(a,x) read(a); }

//output
template<class A> void print(A x) { cout << (x); }
template<class H, class... T> void print(const H& h, const T&... t) {
	print(h); print(t...); }
void prints() { print("\n"); } // print w/ spaces
template<class H, class... T> void prints(const H& h, const T&... t) {
	print(h); if (sizeof...(t)) print(" "); prints(t...); }

void setIn(str s) {freopen(s.c_str(), "r", stdin);}
void setOut(str s) { freopen(s.c_str(), "w", stdout);}
void unsyncIO() { ios::sync_with_stdio(0); cin.tie(0);}
void setIO(str s= ""){
	unsyncIO();
	if(sz(s)) { setIn(s+".in"), setOut(s+".out");}
}

void solve(){
	str s;
	read(s);
	int ans = 0, cur = 0;
	FOR(i, sz(s)){
		if(s[i]=='R')
			cur++;
		else{
			ans = max(cur, ans);
			cur = 0;
		}
	}
	ans = max(cur, ans);
	prints(ans);
}
int main(){
	setIO();
	int t=1;
	//read(t);
	while(t--)
		solve();
	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    int n;
    cin >> n;
    int m = 0;
    vector<int> a(1000001, 0);
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        a[x]++;
        m = max(m, x);
    }
    bool flag_pair = true;
    bool flag_all = true;
    for(int i = 2; i <= m; i++) {
        int x = 0;
        for(int j = i; j <= m; j += i) {
            if(a[j]) {
                x += a[j];
            }
        }
        // cout << i << " : " << x << endl;
        if(x > 1) {
            flag_pair = false;
        }
        if(x == n) {
            flag_all = false;
        }
    }
    if(flag_pair) {
        cout << "pairwise coprime" << endl;
        return 0;
    }
    if(flag_all) {
        cout << "setwise coprime" << endl;
        return 0;
    }
    cout << "not coprime" << endl;
}

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

using namespace std;

#define int long long
#define all(v) begin(v), end(v)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string s;
  cin >> s;
  int ans = 0;
  int p = 0, g = 0;
  rep(i, s.size()) {
    if(s[i] == 'p') {
      if(p < g) p++;
      else g++, ans--;
    } else {
      if(p < g) p++, ans++;
      else g++;
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main(){
    long long int N;
    cin >> N;
    long long int A[N+1],B[N+1],result=0,memo=0,output[N+1];
    for (int i=0;i<N+1;i++){
        A[i] =0;
        B[i] = 0;
    } 
    for (int i=0;i<N;i++){
        cin >> A[i];
        B[A[i]] += 1;
        // cout << B[A[i]] << endl;
    }
    for (int i=0;i<N+1;i++){
        result += B[i] * (B[i] -1) /2;  
    }
    for (int i=0;i<N+1;i++){
        memo = (B[A[i]]-1) * ((B[A[i]]-2)) /2;
        output[i] = memo + result - (B[A[i]]) * ((B[A[i]]-1)) /2;
    }
    for(int i=0;i<N;i++){
        cout << setprecision(14) << output[i] << endl;
    }

}

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

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

	int n;
	int b, f, r, v;
	cin >> n;
	vector<vector<vector<int>>> building(4, vector<vector<int>>(3, vector<int>(10)));
	for (int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		building[b - 1][f - 1][r - 1] += v;
	}
	for (int i = 0; i < 4; i++){
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 10; k++){
				cout << ' ' << building[i][j][k];
			}
			cout << '\n';
		}
		if (i != 3){
			for (int l = 0; l < 20; l++){
				cout << '#';
			}
			cout << '\n';
		}
	}

	return 0;
}


Measured memory_bytes: 3184
fun main(args: Array<String>) {
    sumitrust2019c()
}

fun sumitrust2019c() {
    val x = readLine()!!.toLong()

    if (x < 100) return println(0)

    val items = x / 100
    val remain = x % 100

    val answer = if (items * 5 >= remain) 1 else 0

    println(answer)
}


Measured memory_bytes: 31788
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
const ll MOD = 1e9+7;
long long modpow(long long a, long long n) {
      long long res = 1;
      while (n > 0) {
          if (n & 1) res = res * a % MOD;
          a = a * a % MOD;
          n >>= 1;
      }
      return res;
  }
int main() {
    string l;
    std::cin >> l;
    ll sum[100010];
    Fill(sum,0);
    sum[0]=0;
    ll len = l.length();
    for (int i = 0; i < len; i++) {
        sum[i+1]=sum[i];
        if(l[i]=='1')sum[i+1]++;
    }
    ll result = 0;
    for (int i = 0; i < len; i++) {
        if(l[i]=='1')result+= modpow(2,sum[i])*modpow(3,len-i-1)%MOD;
    }
    result+=modpow(2,sum[len]);
    result%=MOD;
    std::cout << result << std::endl;
}


Measured memory_bytes: 1280
#include<stdio.h>
#include<map>
#include<algorithm>
struct S{int i,u,a,p;}a[300];
int C(S l,S r)
{
	if(l.a-r.a)return l.a>r.a;
	if(l.p-r.p)return l.p<r.p;
	return l.i<r.i;
}
int main()
{
	int i,n,c;
	while(scanf("%d",&n),n)
	{
		for(i=0;i<n;++i)scanf("%d%d%d%d",&a[i].i,&a[i].u,&a[i].a,&a[i].p);
		std::sort(a,a+n,C);
		std::map<int,int>m;
		for(c=i=0;i<n;++i)
		{
			if(c<10&&m[a[i].u]<3 || c<20&&m[a[i].u]<2 || c<26&&m[a[i].u]<1)
				printf("%d\n",a[i].i),m[a[i].u]++,++c;
		}
	}
	return 0;
}

Measured memory_bytes: 0
# AtCoder Beginner Contest 161: B (2020/04/04)
N, M = map(int, input().split())
S = input().split()
A = [0 for i in range(N)]
for i in range(N):
    A[i] = int(S[i])
A.sort(reverse=True)
if A[M-1] < sum(A)/(4*M):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3060