akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;

ll dat[2<<18], add[2<<18];
int segn = 1;
void init(int n){
	while(segn < n)segn *= 2;
}

void lazy_update(int k, int l, int r){
	if(k >= segn*2-1)return ;
	dat[k] += add[k]*(r-l);
	add[k*2+1] += add[k];
	add[k*2+2] += add[k];
	add[k] = 0;
}

void update(int a, int b, int x, int k, int l, int r){
	lazy_update(k, l, r);
	if(b <= l || r <= a)return ;
	if(a <= l && r <= b){
		add[k] += x;
		lazy_update(k, l, r);
		return ;
	}
	update(a, b, x, k*2+1, l, (l+r)/2);
	update(a, b, x, k*2+2, (l+r)/2, r);
	dat[k] = dat[k*2+1]+dat[k*2+2];
}

ll get(int a, int b, int k, int l, int r){
	lazy_update(k, l, r);
	if(b <= l || r <= a)return 0;
	if(a <= l && r <= b)return dat[k];
	ll vl = get(a, b, k*2+1, l, (l+r)/2);
	ll vr = get(a, b, k*2+2, (l+r)/2, r);
	return vl+vr;
}

int main(){
	int n, q, c, s, t, x;
	scanf("%d%d", &n, &q);
	init(n);
	for(int i = 0;i < q;i++){
		scanf("%d", &c);
		if(!c){
			scanf("%d%d%d", &s, &t, &x);
			update(s-1, t, x, 0, 0, segn);
		}else{
			scanf("%d%d", &s, &t);
			ll res = get(s-1, t, 0, 0, segn);
			printf("%lld\n", res);
		}
	}
	return 0;
}


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

int main() {
  int A,B,C,D;
  int L,R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
  if (L==R){
    cout << "Balanced" << endl;
  }
  else if (L>R) {
    cout << "Left" << endl;
  }
  else {
    cout << "Right" << endl;
  }
  
}

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

using namespace std;

//#define MD 10

long int exp(long int a,long int b){
	if(b==0){
		return 1;
	}else if(b==1){
		return a;
	}else{
		long int t=a;
		for(long int i=0;i<b-1;i++){
			a*=t;
		}
		return a;	
	}
}

int main(){
   int n,k;
    cin>>n>>k;
    long int ans=k;
    if(n!=1){
        ans*=pow(k-1,n-1);
    }
    cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
x = A[0]
y = sum(A[1:])
d = abs(x - y)
for i in range(1, N - 1):
    a = A[i]
    x += a
    y -= a
    d = min(d, abs(x - y))
print(d)


Measured memory_bytes: 23800
#include <stdio.h>

#define MAX 500000

void buildMaxHeap(void);
void maxHeapify(int);
int left(int);
int right(int);

int key[MAX];
int n;

int main(){
  int i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&key[i]);
  }

  buildMaxHeap();

  for(i=1;i<=n;i++){
    // if(i!=1) printf(" ");
    printf(" %d",key[i]);
  }
  printf("\n");
  
  return 0;
}

void buildMaxHeap(){
  int i;

  for(i=n/2;i>0;i--){
    maxHeapify(i);
  }
}

void maxHeapify(int i){
  int l, r, k, largest;
  
  l = left(i);
  r = right(i);

  if(l<=n && key[l]>key[i]) largest = l;
  else largest = i;

  if(r<=n && key[r]>key[largest]) largest = r;

  if(largest != i){
    k = key[i];
    key[i] = key[largest];
    key[largest] = k;

    maxHeapify(largest);
  }
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

Measured memory_bytes: 2548
import numpy as np

N = int(input())
X = np.array(list(map(int, input().split())))

ans = 100 * 100 * N
for p in np.arange(np.min(X), np.max(X) + 1):
    s = 0
    for x in X:
        s += (x - p) ** 2
    if s < ans:
        ans = s

print(ans)

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

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

  set<char> ACGT;
  ACGT.insert('A');
  ACGT.insert('C');
  ACGT.insert('G');
  ACGT.insert('T');

  int ln = 0;
  int max = 0;
  for (int i = 0; i < S.size(); i++)
  {
    if (ACGT.count(S.at(i))){
      ln += 1;
      if (max < ln) max = ln;
    }
    else
    {
      ln = 0;
    }
    

  }
  
  cout << max << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int N;
  double x;
  cin >>N;
  if(N%2==0){
    x=0.5;
    cout<<x;
  }else{
    x=0.5+0.5*1/N;
    cout<< x;
  }


 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
#define SIZE 100003
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll N,K,S;
	cin>>N>>K>>S;
	if(S<SIZE){
		for(ll i=0;i<K;++i){
			cout<<S<<" ";
		}
		for(ll i=K;i<N;++i){
			cout<<S+i-K+1<<" ";
		}
	}
	else{
		for(ll i=0;i<K;++i){
			cout<<S<<" ";
		}
		for(ll i=K;i<N;++i){
			cout<<S-i+K-1<<" ";
		}
	}
}

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

#define int long long 

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}

void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 

#define pii pair<int,int >
#define vec vector<int >

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

#define data asd09123jdf02i3h

#define FOR(i,l,r) for(int i=l,i##_r=r;i<=i##_r;i++)

const int maxn = 5000+10;
const int inf = 1e9;
const lf eps = 1e-8;
const int mod = 1e9+7;

int n,a,b,f[maxn][maxn],p[maxn];

signed main() {
    read(n),read(a),read(b);
    for(int i=1,x;i<=n;i++) read(x),p[x]=i;
    memset(f,63,sizeof f);
    for(int i=1;i<=n+1;i++) f[0][i]=0;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=p[i];j++) f[i][j]=f[i-1][j]+b;
        for(int j=p[i]+1;j<=n+1;j++) f[i][j]=f[i-1][j]+a;
        f[i][p[i]+1]=min(f[i][p[i]+1],f[i-1][p[i]]);
        for(int j=2;j<=n+1;j++) f[i][j]=min(f[i][j],f[i][j-1]);
        // for(int j=1;j<=n+1;j++) printf("%d ",f[i][j]);puts("");
    }
    write(f[n][n+1]);
    return 0;
}


Measured memory_bytes: 196352
#include<stdio.h>
#include<string.h>
int main()
{
    char a[20],b[20];
    scanf("%s%s",a,b);
    int len=strlen(a);
    int flag=0;
    for(int i=0;i<len;i++)
    {
       if(a[i]!=b[i])
       {
           flag=1;
           break;
       }
    }
    if(flag==1)
        printf("No\n");
    else
        printf("Yes\n");
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater(){
    #ifndef ONLINE_JUDGE
    auto end_time = std::chrono::high_resolution_clock::now();
    std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
    #endif
}
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repA(i, a, n) for(int  i = a; i <= (n); ++i)
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()
#define fill(a,v) memset(a, v, sizeof(a))
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long int> vll;
typedef vector<pii> vii;
ll p=1e9+7;
const int N=2e5+5;
int main() {
   
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);
    int T=1;
    // cin>>T;
    while(T--){
       	string s;cin>>s;
       	if(s=="ABC"){
       		cout<<"ARC";
       	}
       	else{
       		cout<<"ABC";
       	}
    }   
    timecalculater();
    return 0;   
} 	

Measured memory_bytes: 3656
import java.util.Scanner;

/**
 * https://abc072.contest.atcoder.jp/tasks/arc082_a
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int MAX = 100000;
		int[] dp = new int[MAX+1];
		for(int i=0; i<N; i++){
			dp[sc.nextInt()]++;
		}
		sc.close();
		
		int ans = 0;
		for(int i=1; i<MAX; i++){
			ans = Math.max(ans, dp[i-1]+dp[i]+dp[i+1]);
		}
		System.out.println(ans);

	}

}

Measured memory_bytes: 49064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int A,B,C,D;
  cin >> A >> B >> C >> D;
  if( (A + D - 1) / D < (C + B - 1) / B){
    cout << "No" << endl;
}
  else{
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 3644
import numpy as np
import math
import sys
sys.setrecursionlimit(10000000)

def main():
    S = int(input())
    # if S <= 10e9:
    #     X1 = 0
    #     Y1 = 0
    #     X2 = S
    #     Y2 = 0
    #     X3 = 0
    #     Y3 = 1
    # else:

    root_S = np.sqrt(S)
    l = int(np.ceil(root_S))
    X3Y2 = l ** 2 - S
    X1 = 0
    Y1 = 0
    X2 = l
    Y3 = l
    Y2 = l**2 - S
    X3 = 1
    print(X1, Y1, X2, Y2, X3, Y3)




if __name__ == '__main__':
    main()

Measured memory_bytes: 12496
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
V<P<int,int> > v[50005];
char c[55][25];
int l[55],id[55][25][25][2],d[50005],used[50005],en[50005],cost[55];
bool yes(int i,int j,int k,int nxti,bool f){
	if(!f){
		FOR(t,j,k){
			if(l[nxti]-t+j<=0)RE 1;
			if(c[i][t]!=c[nxti][l[nxti]-t+j]){
				RE 0;
			}
		}
		RE 1;
	}else{
		for(int t=k;t>=j;t--){
			if(k-t+1>l[nxti])RE 1;
			if(c[i][t]!=c[nxti][k-t+1])RE 0;
		}
		RE 1;
	}
}
signed main(){
	int n;
	scanf("%lld",&n);
	FOR(i,1,n){
		scanf("%s%lld",c[i]+1,&cost[i]);
		l[i]=strlen(c[i]+1);
	}
	int cnt=0;
	FOR(i,1,n){
		FOR(j,1,l[i]){
			FOR(k,j-1,l[i])id[i][j][k][0]=++cnt,id[i][j][k][1]=++cnt;
		}
		id[i][l[i]+1][l[i]][0]=++cnt;id[i][l[i]+1][l[i]][1]=++cnt;
	}
	FILL(d,-1);
	priority_queue<P<int,int>,V<P<int,int> >,greater<P<int,int> > > q;
	FOR(i,1,n){
		d[id[i][1][l[i]][0]]=d[id[i][1][l[i]][1]]=cost[i];
		q.emplace(MP(cost[i],id[i][1][l[i]][0]));
		q.emplace(MP(cost[i],id[i][1][l[i]][1]));
	}
	FOR(i,1,n){
		en[id[i][l[i]+1][l[i]][0]]=en[id[i][l[i]+1][l[i]][1]]=1;
		FOR(j,1,l[i]){
			en[id[i][j][j-1][0]]=en[id[i][j][j-1][1]]=1;
			FOR(k,j,l[i]){
				bool f=1;
				FOR(it,j,k){
					if(c[i][it]!=c[i][j+k-it]){
						f=0;break;
					}
				}
				if(f){
					en[id[i][j][k][0]]=en[id[i][j][k][1]]=1;
				}
				FOR(nxti,1,n){
					if(yes(i,j,k,nxti,0)){
						if(l[nxti]>k-j+1){
							v[id[i][j][k][0]].PB(MP(id[nxti][1][l[nxti]-k+j-1][1],cost[nxti]));
						}else{
							v[id[i][j][k][0]].PB(MP(id[i][j+l[nxti]][k][0],cost[nxti]));
						}
					}
					if(yes(i,j,k,nxti,1)){
						if(l[nxti]>k-j+1){
							v[id[i][j][k][1]].PB(MP(id[nxti][k-j+2][l[nxti]][0],cost[nxti]));
						}else{
							v[id[i][j][k][1]].PB(MP(id[i][j][k-l[nxti]][1],cost[nxti]));
						}
					}
				}
			}
		}
	}
	while(!q.empty()){
		P<int,int> cur=q.top();q.pop();
		if(used[cur.S]){
			continue;
		}
//		cout<<cur.S<<'\n';
		used[cur.S]=1;
		if(en[cur.S]){
			cout<<cur.F;RE 0;
		}
		for(auto u:v[cur.S]){
			if(!used[u.F]){
				if(d[u.F]==-1){
					d[u.F]=d[cur.S]+u.S;
				}else gmin(d[u.F],d[cur.S]+u.S);
				q.emplace(MP(d[u.F],u.F));
			}
		}
	}
	cout<<-1;
	RE 0;
}


Measured memory_bytes: 6468
#include<iostream>
#include<string>
using namespace std;
int main(){
    string num;
    while(1){
        cin >> num;
        if(num[0]=='0')break;
        int ans =0;
        for(int i = 0; i < num.size(); i++){
            ans += num[i]-'0';
        }cout << ans << endl;
    }
    return 0;
}


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

int main()
{
	int n, m;
	vector<int> vec;
	int count = 0;
	int minj;

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

	for (int i = 0; i < n; ++i)
	{
		minj = i;
		for (int j = i; j < n; ++j)
		{
			if (vec[j] < vec[minj]){
				minj = j;
			}
		}
		if (i != minj){
			swap(vec[i], vec[minj]);
			count++;
		}
	}

	for (int i = 0; i < n; ++i)
	{
		cout << vec[i];
		if (i != n - 1){
			cout << " ";
		}
		else{
			cout << endl;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1220
#%%
n = int(input())
S = input()

ans = S.count('E')

w = 0
tmp_w = 0
e = ans

for s in S:
    if s == 'E':
        e -= 1
    else:
        tmp_w += 1

    ans = min(ans, w+e)
    w = tmp_w

print(ans)

Measured memory_bytes: 9760
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::cmp;
fn main() {
    input! {
        N: i32,
        M: i32,
    }
    if N == 1 {
        println!("{}", M);
        return;
    }
    let mut ans = 1;
    for i in 1..(M / N + 1) {
        if (M % i == 0) {
            let x = i;
            let y = M / i;
            ans = cmp::max(ans, x);
            if y <= M / N {
                ans = cmp::max(ans, y);
            }
        }
        if (i * i > M) {
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }


int32_t main(){
    
  fast;
  int n; cin >> n;
  int ar[n] = {0};

  for(int i=0;i<n;i++) cin >> ar[i];

  int need = 1,  cnt = 0;

  for(int i=0;i<n;i++){
    if(need==ar[i]){
      need++;
      cnt++;
    }
  }

  if(cnt==0) cout << -1;
  else{
    cout << n - cnt;
  }
  

  return 0;
}

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

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

	return 0;
}

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

int main() {

    string S;
    cin >> S;    
    
    bool is = false;
    for(int i = 0; i < S.size(); i++ ){
        if(S[i] == '7'){
            is = true;
        }
    }
    if(is) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <cstdlib>
#include<set>
#include <map>
using namespace std;


   
#include <iostream>

using namespace std;
int x[4];
int main()
{
    for (int i = 0;i<5;i++){
        cin >> x[i];
        if (x[i] == 0) {
            cout<<i+1;
            break;
        }
    }
    
   return 0;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

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


int main() {
  int n;cin>>n;
  map<ll,int> cnt;
  rep(i,n){ll a;cin>>a;cnt[a]++;}
  vector<ll> wtf;
  for(auto x:cnt){
    if(x.second<4&&x.second>=2)wtf.pb(x.first);
    if(x.second>=4){wtf.pb(x.first);wtf.pb(x.first);}
  }
  if(wtf.size()<2){cout<<0;return 0;}
  sort(rALL(wtf));
  ll ans=wtf[0]*wtf[1];
  cout<<ans;
}


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

namespace _ {
	bool rEOF = 1;//为0表示文件结尾
	inline char nc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return p1 == p2 && rEOF && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? (rEOF = 0, EOF) : *p1++;
	}
	template<class _T>
	inline bool read(_T &num) {
		char c = nc(), f = 1; num = 0;
		while (c<'0' || c>'9')c == '-' && (f = -1), c = nc();
		while (c >= '0'&&c <= '9')num = num * 10 + c - '0', c = nc();
		return (bool)(num *= f);
	}
	inline bool need(char &c) { return c >= 'a'&&c <= 'z' || c >= '0'&&c <= '9' || c >= 'A'&&c <= 'Z'; }//读入的字符范围
	inline bool read_str(char *a) {
		while ((*a = nc()) && need(*a) && rEOF)++a;
		*a = '\0'; return rEOF;
	}
}using namespace _;

int main()
{
	
	int a, b;
	cin >> a >> b;
	if (a > b)swap(a, b);
	if ((b - a) % 2 == 1)
		printf("IMPOSSIBLE\n");
	else
		cout << abs((a + b) / 2) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
#define e_b emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  ld A,B;
  cin >> A >> B;

  ld ans=A*B;
  cout << (ll)ans << endl;

  return 0;
}

Measured memory_bytes: 3748
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := 1
	for i := 0; i < n; i++ {
		a := ans * 2
		b := ans + k
		ans = min(a, b)
	}
	fmt.Println(ans)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 512
N=int(input())
a_l=""
i=1
while i:
    if N<26:
        i=0
        l=chr(97+N-1)
    else:
        m = N % 26
        N=N//26
        if m==0:
            l="z"
            if N==1:
                l="z"
                i=0
            else:
                N=N-1
        else:
            l=chr(97+m-1)
    a_l=l+a_l
print(a_l)

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

using namespace std;

int main()
{
    int n,m;
    map<string,int>ss;
    string blue,red;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>blue;
        ss[blue]++;
    }
    cin>>m;
    for(int j=0;j<m;j++){
        cin>>red;
        ss[red]--;
    }
    int res=0;

    map<string,int>:: iterator itr;
    for(itr=ss.begin();itr!=ss.end();itr++){
            res=max(res,itr->second);
    }
    cout<<res;

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int n, p;
        cin >> n >> p;
        const int P = p;
        if (n == 0 and p == 0) {
            break;
        }
        int s = 0;
        vector<int> stone(n, 0);
        while (true) {
            if (p == 0) {
                p = stone[s];
                stone[s] = 0;
            } else {
                stone[s]++;
                p--;
                if (p == 0 and stone[s] == P) {
                    break;
                }
            }
            s = (s == n - 1) ? 0 : s + 1;
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <random>
#include <cassert>
#include <numeric>
#define ll long long int
#define LL unsigned long long
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

ll y[10000005];

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    auto s = a[0];
    for(int i= 1; i < n; i++){
        s ^= a[i];
    }
    if(s==0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3788
//
// Created by yamunaku on 2020/04/19.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    ll n, k;
    cin >> n >> k;
    n++;
    ll ans = 0;
    repl(i, k, n + 1){
        ans = (ans + i * (n - i) + 1) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3644
N = int(input())
BA = 0
B_ = 0
_A = 0
ans = 0
s = []
for i in range(N):
    s.append(input())
    ans += s[i].count('AB')
    if s[i][0] is 'B' and s[i][-1] is 'A':
        BA += 1
    elif s[i][0] is 'B' and s[i][-1] is not 'A':
        B_ += 1
    elif s[i][0] is not 'B' and s[i][-1] is 'A':
        _A += 1

if BA == 0:
    ans += min(B_, _A)
    print(ans)
elif B_ == 0 and _A == 0:
    ans += BA - 1
    print(ans)
else:
    ans += BA + min(B_, _A)
    print(ans)


Measured memory_bytes: 3700
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = scanner.nextInt();
        }
        int q = scanner.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = scanner.nextInt();
        }
        int cnt = 0;
        for (int i : T) {
            for (int j : S) {
                if (i == j) {
                    cnt++;
                    break;
                }
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 40432
import java.util.Scanner;

public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        String a = sc.next();
        String b = sc.next();
        if ((a.equals("H")&&b.equals("H"))||(a.equals("D")&&b.equals("D"))) {
            System.out.println("H");
        } else {
            System.out.println("D");
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
    int K ;
cin >> K;
if(K == 4 || K == 6 || K == 9 || K == 10 || K == 14 || K == 21 || K == 22|| K ==25 || K == 26 ){
    cout << 2 << endl;
}else if(K == 8 || K == 12 || K == 18 || K == 20 || K == 27){
    cout << 5 << endl;
}else if(K == 30 || K == 28){
    cout << 4 << endl;
}else if(K == 16){
    cout << 14 << endl;
}else if(K == 24){
    cout << 15 << endl;
}else if(K == 32){
    cout << 51 << endl;
}else {
    cout << 1 << endl;
}
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n,q; cin >> n >> q; 
    string s; cin >> s;
    vpl query(q);
    rep(i,q) cin >> query[i].first >> query[i].second;
    ll cnt=0;
    vl count(n+1,0);
    rep(i,n-1){
        if(s[i] == 'A' && s[i+1] == 'C'){
            count[i+2] = count[i+1] + 1;
        }else{
            count[i+2] = count[i+1];
        }
    }
    //rep(i,n+1) cout << count[i] << " ";
    //cout << endl;
    rep(i,q){
        cout << count[query[i].second]-count[query[i].first] << endl;
    }

}

Measured memory_bytes: 3456
// OURL: https://atcoder.jp/contests/agc035/tasks/agc035_c
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define RREP(i,a,n) for(int i=(a),i##_len=(n);i<i##_len;++i)
#define MAT1D(V,T,a) vector<T> V (a)
#define MAT2D(V,T,a,b) vector<vector<T>> V (a, vector<T>(b))
#define MAT3D(V,T,a,b,c) vector<vector<vector<T>>> V (a, vector<vector<T>>(b, vector<T>(c)))

// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){ return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }

template <typename A>
string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; }

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool>::reference b) { return to_string(bool(b)); }
template <typename A, typename B>
string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A>
string to_string(vector<vector<A>> v) { string res; for(const auto &x : v) {res+="\n ";res += to_string(x);} return res;}

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L" << to_string(__LINE__) << ":" <<#__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

void set_edge(stringstream &ss, int i, int j) {
  ss << i << " " << j << "\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  if (!(N & (N-1))) { // N=2^n
    cout << "No" << endl;
    return 0;
  }
  stringstream ss;
  set_edge(ss, 1,2);
  set_edge(ss, 2,3);
  set_edge(ss, 3,1+N);
  set_edge(ss, 1+N,2+N);
  set_edge(ss, 2+N,3+N);
  int c = (N-3);
  if (N % 2 == 0) {
    c--;
  }
  for (int i = 0; i < c; i+=2) {
    set_edge(ss, i+4+N, 1+N);
    set_edge(ss, i+5+N, i+4+N);
    set_edge(ss, i+5, 1+N);
    set_edge(ss, i+4, i+5);
  }
  if (N%2==0) {
    // N, 2Nを入れる必要がある.
    int p = N ^ (N-1) ^ 1; // p1 < N-1
    set_edge(ss, N, N-1);
    if (p & 1) { // odd
      set_edge(ss, N*2, p);
    } else {
      set_edge(ss, N*2, p+N);
    }
  }
  cout << "Yes" << endl;
  cout << ss.str() << endl;
  return 0;
}


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

typedef long long ll;
const ll InF = 1e15;

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

int main() {
  int N;
  ll X;
  cin>>N>>X;
  vector<ll> x(N);
  for (int i = 0; i < N; i++) {
    ll t;
    cin>>t;
    x[i] = abs(X - t);
  }
  sort(x.begin(),x.end());
  vector<ll> divx = divisor(x[0]);
  ll ans = 1;
  for (int i = divx.size() - 1; i >= 0; i--) {
    bool ok = true;
    ll y = divx[i];
    for (int j = 1; j < N; j++) {
      if (x[j] % y != 0) {
        ok = false;
        break;
      }
    }
    if (ok) {
      ans = y;
      break;
    }
  }
  cout<<ans<<endl;
  return 0;
}

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


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br  = new BufferedReader(new InputStreamReader(System.in));
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int		cnt  = parseCnt();
		int[]	ball = null;

		for (int n = 0; n < cnt; n++) {
			if ((ball = parseBall()) != null) {
				if (push(ball) == 0) {
					System.out.println("YES");
				}
				else {
					System.out.println("NO");
				}
			}
		}
	}

	private static int push(int[] ball) {
		int	nStatus = 0;
		int	a       = 0;
		int	b       = 0;

		for (int n = 0; n < ball.length && nStatus == 0; n++) {
			if (a < ball[n]) {
				a = ball[n];
			}
			else if (b < ball[n]) {
				b = ball[n];
			}
			else {
				nStatus = -1;
			}
		}
		
		return nStatus;
	}

	private static int parseCnt() {
		int		cnt   = 0;
		String	strIn = null;

		if ((strIn = parseStdin()) != null) {
			cnt = Integer.parseInt(strIn);
		}
		
		return cnt;
	}

	private static int[] parseBall() {
		int[]	ball  = null;
		String	strIn = null;

		if ((strIn = parseStdin()) != null) {
			String[]	aN = strIn.split(" ");
			ball = new int[10];
			for (int n = 0; n < 10; n++) {
				ball[n] = Integer.parseInt(aN[n]);
			}
		}
		
		return ball;
	}

	private static String parseStdin() {
		String	strNum = null;

		try {
			String line = br.readLine();
			if (line != null) {
				if (!line.isEmpty()) {
					strNum = line;
				}
			}
		}
		catch (IOException e) {}

		return strNum;
	}
}

Measured memory_bytes: 16908
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	const mod = 1000000007

	h, w, k := nextInt(), nextInt(), nextInt()

	// pat[i][j]: num of i to j
	pat := make([][]int, w)
	for i := range pat {
		pat[i] = make([]int, w)
	}
	for bit := 0; bit < (1 << uint(w-1)); bit++ {
		ok := true
		// 隣り合う横線がないかチェック
		for i := 0; i < w-2; i++ {
			ok = ok && (((uint(bit)>>uint(i))&1)&((uint(bit)>>uint(i+1))&1) == 0)
		}
		if !ok {
			continue
		}
		for i := 0; i < w; i++ {
			to := i
			if i > 0 && (uint(bit)>>uint(i-1))&1 == 1 {
				to = i - 1
			} else if i < w-1 && (uint(bit)>>uint(i))&1 == 1 {
				to = i + 1
			}
			pat[i][to]++
		}
	}

	dp := make([][]int, h+1)
	for i := range dp {
		dp[i] = make([]int, w)
	}
	dp[0][0] = 1
	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			for k := 0; k < w; k++ {
				dp[i+1][j] = (dp[i+1][j] + (dp[i][k]*pat[k][j])%mod) % mod
			}
		}
	}

	puts(dp[h][k-1])
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
//https://beta.atcoder.jp/contests/abc085/tasks/abc085_d
int main(){
	int N,H;
	SCD2(N,H);
	
	static int B[100002];
	int amax = 0;
	int count = 0;
	int D = 0;
	
	REP(i,N){
		int a,b; SCD2(a,b);
		amax = max(a,amax);
		B[i] = b;
	}
	
	
	sort(B,B+N,greater<int>());
	int ind = 0;
	while(ind < N){
		if (B[ind] >= amax){
			count++;
			D = D + B[ind];
		}else{
			break;
		}
		
		if (H <= D){
			PRINTD(count);
			return 0;
		}
		ind++;
	}
	
	if (H <= D){
		PRINTD(count);
		return 0;
	}
	
	if (((H-D) % amax) == 0){
		count += (H-D) / amax;
	}else{
		count += ((H-D) / amax) + 1;
	}
	
	PRINTD(count);
	
	return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.Stream;
import static java.util.stream.Collectors.joining;

class Main {
    final static int k = 10001;
  static int[] C = new int[k];

  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int current = 0;
    int[] A = new int[size];
    int[] B = new int[size];

    for (int i = 0; i < size; i++) {
      A[i] = Integer.parseInt(sc.next());
      C[A[i]]++;
    }

    for (int i = 1; i < k; i++) C[i] += C[i - 1];
    for (int i = size - 1; i >= 0; i--) B[--C[A[i]]] = A[i];
    System.out.println(Arrays.stream(B).boxed().map(n -> n.toString()).collect(joining(" ")));
  }
}



Measured memory_bytes: 321568
#!/usr/bin/env ruby
n = gets.split(' ')
W = n[0].to_i
H = n[1].to_i
x = n[2].to_i
y = n[3].to_i
r = n[4].to_i

if (r <= x) && (x <= W-r) && (r <= y) && (y <= H-r)
  puts "Yes"
else
  puts "No"
end



Measured memory_bytes: 8876
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    ll a[x + 5], b[y + 5], c[z + 5];
    for(int i = 0; i < x; i++) cin >> a[i];
    for(int i = 0; i < y; i++) cin >> b[i];
    for(int i = 0; i < z; i++) cin >> c[i];
    vector<ll> pro, res;
    for(int i = 0; i < x; i++)
        for(int j = 0; j < y; j++)
            pro.push_back(a[i] + b[j]);
    sort(pro.rbegin(), pro.rend());
    for(int i = 0; i < min(k, (int)pro.size()); i++)
        for(int j = 0; j < z; j++)
            res.push_back(pro[i] + c[j]);
    sort(res.rbegin(), res.rend());
    for(int i = 0; i < k; i++)
        cout << res[i] << endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

const ll INF = (ll)1e18 + 5;

void Main(){
	ll n, k;
	cin >> n >> k;
	vll a(n);
	rep(i,n) cin >> a[i];
	sort(all(a));
	  	
	auto pro = [&](ll x1, ll x2){
		return a[x1]*a[x2];  	
	};
  
	auto f = [&](ll x){
		// a[] * a[] のテーブル上で product が x 以上になるペアの個数を数える
		ll l, r, m, res;
		res = 0;
		rep(i,n){
			// a[i] >= 0 のときと a[i] < 0 のときで場合分け
			if(a[i]>=0){
              	// 最終的に r を出力
				l = 0;
          		r = n-1;
            	if(pro(i,l)>=x) r = n-1;
            	else if(pro(i,r)<x) r = 0;
				else{
                	while(l+1 != r){
                   		m = (l+r)/2;
                   		if(pro(i,m)>=x) r = m;
                   		else l = m;
                	}
                  	if(r<=i) r++;
                  	r = n-r;
           		}
        	}
			else if(a[i]<0){
              	// 最終的に r を出力
				l = 0;
          		r = n-1;
            	if(pro(i,r)>=x) r = n-1;
            	else if(pro(i,l)<x) r = 0;
				else{
                	while(l+1 != r){
                   		m = (l+r)/2;
                   		if(pro(i,m)>=x) l = m;
                   		else r = m;
                	}
                    if(i<=l) r--;
           		}
        	}          
		res += r;
		//cout << i << ": " << r << endl;
        }
      	return res/2;
	};
		
  	// rep3(i,-15,15) cout << i << ": " << f(i) << endl;
	//cout << "f(-3) : " << f(-3) << endl << endl;
	//cout << "f(-2) : " << f(-2) << endl << endl;
  
  	//*
	// f は単調減少
	// 下から k 番目が欲しい
	// f(x+1) < k, f(x) >= k なら x を出力
	k = n*(n-1)/2 - k + 1;
      
	ll L = -INF, R = INF, M, ans;
	while(L+1!=R){
		M = (L+R)/2;
		if(f(M) < k) R = M;
		else L = M;
	}
	cout << L << endl;
	//*/
	return;  	
}

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


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;
const long double PI = acos((long double)(-1));

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

void solve() {
    string s; cin >> s; if (s == "#") exit(0);
    vector<string> vs(10, string(10, '.'));
    s += '/';
    int h = 0;
    int w = 0;
    int H = 0;
    int W = 0;
    bool f = false;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'b') {
            vs[h][w] = 'b';
            w++;
            if(!f) W++;
        }
        else if (s[i] == '/') {
            w = 0;
            H++;
            h++;
            f = true;
        }
        else {
            w += s[i] - '0';
            if (!f) W += (s[i] - '0');
        }
    }
    vs.resize(H); for (int i = 0; i < H; i++) vs[i].resize(W);
    //for (int i = 0; i < H; i++) cout << vs[i] << endl;
    int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--; d--;
    vs[a][b] = '.';
    vs[c][d] = 'b';
    string res;
    int cnt = 0;
    s.clear();
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (vs[i][j] == 'b') {
                if (cnt) s += ('0' + cnt);
                s += 'b';
                cnt = 0;
            }
            else cnt++;
        }
        if (cnt) s += ('0' + cnt);
        s += '/';
        cnt = 0;
    }
    s.pop_back();
    cout << s << "\n";
}
int main()
{
    
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int kkt = 89;
    while (kkt) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3220
N = int(raw_input())
a = [int(x) for x in raw_input().split(' ')]

sorteda = sorted(a)

maxlen = sorteda[-1]
numpathsoflen = [0 for x in range(maxlen+1)]
if(sorteda[0] < (maxlen+1)/2):
    print 'Impossible'
else:
    for x in sorteda:
        numpathsoflen[x] += 1            
    valid = True
    starti = (maxlen+1)/2
    if(maxlen % 2 == 0):
        if(numpathsoflen[starti] != 1):
            valid = False
    else:
        if(numpathsoflen[starti] != 2):
            valid = False
    starti += 1        
    for x in range(starti, maxlen+1):
        if(numpathsoflen[x] < 2):
            valid = False
    if(valid):
        print 'Possible'
    else:
        print 'Impossible' 

Measured memory_bytes: 2696
n,m=map(int,input().split())
g=(1<<n)
dp=[10**18]*g
dp[0]=0
for i in  range(m):
    a,s=map(int,input().split())
    f=0
    for k in map(int,input().split()):
        f+=1<<(k-1)
    for j in range(g-1,-1,-1):
        dp[j|f]=min(dp[j]+a,dp[j|f])
print(-1 if dp[-1]==10**18 else dp[-1])

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int maxval = min(A, B);
  int minval = 0;
  if (N < A + B) {
    minval = A+B-N;
  }
  cout << maxval << " " << minval << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

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

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			PriorityQueue<P> pq = new PriorityQueue<P>();
			for (int i = 0; i < n; i++) {
				int m = scanner.nextInt();
				int a = scanner.nextInt();
				int b = scanner.nextInt();
				pq.offer(new P(m, a, b));
			}
			String ans = "OK";
			Deque<P> deque = new ArrayDeque<Main.P>();
			while (!pq.isEmpty()) {
				P p = pq.poll();
				int size = deque.size();
				while (size-- > 0) {
					P oldP = deque.poll();
					if (p.a < oldP.b)
						deque.offer(oldP);
				}
				deque.push(p);
				int sum = 0;
				for (P newp : deque) {
					sum += newp.m;
				}
				if (sum > 150) {
					ans = "NG";
					break;
				}
			}
			System.out.println(ans);
		}
	}

	class P implements Comparable<P> {
		int m, a, b;

		public P(int m, int a, int b) {
			super();
			this.m = m;
			this.a = a;
			this.b = b;
		}

		@Override
		public String toString() {
			return "P [m=" + m + ", a=" + a + ", b=" + b + "]";
		}

		@Override
		public int compareTo(P o) {
			return this.a - o.a;
		}

	}
}

Measured memory_bytes: 44204
n = int(input())
ans = 0
for i in range(1,n+1,2):
    p = set()
    for j in range(2, int(i**0.5+1)):
        if i % j == 0:
            p.add(j)
            p.add(i/j)
    if len(p) == 6:
        ans += 1
print(ans)

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

using ll = long long;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    cout << max(0LL, B * (N - 1) + A - A * (N - 1) - B + 1) << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
struct node{
    int t,x,y;
}nd[100005];
int main()
{
    int n;
    scanf("%d",&n);
    int flag=1;
    for(int i=1;i<=n;i++){
        scanf("%d%d%d",&nd[i].t,&nd[i].x,&nd[i].y);
    }
    for(int i=1;i<=n;i++){
        int t=abs(nd[i].x-nd[i-1].x)+abs(nd[i].y-nd[i-1].y);
        int tmp=nd[i].t-nd[i-1].t;
        if(tmp<t||(tmp-t)%2==1){
            flag=0;
            break;
        }
    }
    if(flag==0) printf("No\n");
    else printf("Yes\n");
    return 0;
}


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

cntDiv = 0
for i in range(10**10):
  cnt =0
  for j in range(n):
    if a[j]%2==0:
      a[j] = a[j]/2
      cnt += 1
  if cnt != n:
    break
  else:
    cntDiv +=1
    continue
print(cntDiv)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};


int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0) break;
		vi a(n);
		for(int i=0;i<n;i++) cin>>a[i];
		double mn=inf;
		int A,B,C;
		for(int i=0;i<=15;i++) for(int j=0;j<=15;j++) for(int k=0;k<=15;k++){
			vi b(256);
			int t=i;
			for(int l=0;l<n;l++){
				t=(j*t+k)%256;
				b[(a[l]+t)%256]++;
			}
			double tmp=0;
			for(int l=0;l<256;l++) if(b[l]) tmp-=log((double)b[l]/n)*b[l];
			if(tmp+eps<mn){
				A=i,B=j,C=k;
				mn=tmp;
			}
		}
		cout<<A<<' '<<B<<' '<<C<<endl;
	}
}


Measured memory_bytes: 3276
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i)  
#else
  #define DUMP(i)  
#endif

#define GETTYPE(i) 
#define TOSTRING(x) #x
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;

const int EPS = 1e-9;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long N,M;
  while(cin >> N >> M){
    long long ans;

    //隣接するマスが奇数個=>ひっくり返る回数が偶数回
    //=>表向き
    //隣接するマスが偶数個=>ひっくり返る回数が奇数回
    //=>裏向き

    //角=>隣接するマス:3個=>表向き
    //辺=>隣接するマス:5個=>表向き
    //内側=>隣接するマス:8個=>裏向き

    //コーナーケース:
    //1*1 = 1
    //n*1 = n - 2 (両端以外) 
    //1*m = m - 2 (両端以外) 
    if(N==1 && M == 1){
      ans = 1;
    }
    else if(N==1 || M==1){
      ans = N*M-2;
    }else{
      ans = N*M - (2*N+2*M-4);
    }
    cout << ans << endl;
  }
  return 0;
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = 0;
    ans = (b - 1) / (a - 1);
    if ((b - 1) % (a - 1) > 0)
    {
        ans++;
    }

    cout << ans << endl;
}


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

int main(){
  int n;
  cin>>n;
  vector <int> a(n);
  for (int i=0;i<n;i++) cin>>a.at(i);
  //昇順はsort(a.begin(),a.end()),降順はsort(a.rbegin(),a.rend())
  sort(a.rbegin(),a.rend());
  int A=0,B=0;
  for (int i=0;i<n;i++){
    if(i%2==0) A+=a.at(i);
    else B+=a.at(i);
  }
  
  cout<<A-B<<endl;  
}

Measured memory_bytes: 3628