akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#define all(c) c.begin(),c.end()
#define uni(c) c.erase(unique(c.begin(),c.end()),c.end())
#define pb push_back
using namespace std;

string cc(string s,string x,string y){
	string t="";
	for(int i=0;i<s.size();i++){
		if(s.substr(i,x.size())==x){
			t+=y;
			i+=x.size()-1;
		}else{
			t+=s[i];
		}
	}
	return t;
}


int expr(string& s, int& i);
int term(string& s, int& i);
int factor(string& s, int& i);
int number(string& s, int& i);
 
 
int expr(string& s, int& i) {
	int val = factor(s, i);
	while(s[i] == '+' || s[i] == '-'|| s[i]=='*') {
		char op = s[i];
		i++;
		if(s[i]=='>'){
			i++;
			int val2 = factor(s, i);
			if(val==1&&val2==0){
				val=0;
			}else{
				val=1;
			}
		}else{
			int val2 = factor(s, i);
			if (op == '+') 
				val |= val2;
			else if(op=='*')
				val *= val2;
			//cout<<"   "<<val<<" "<<val2<<endl;
		}
	}
	return val;
}
int factor(string& s, int& i) {
	int flag=0;
	if(s[i]=='-'){
		flag=1;
		i++;
	}
	if (isdigit(s[i])){
		
		int num=(s[i]-'0');
		i++;
		
		//cout<<s[i]<<endl;
		if(flag)
			return flag^num;
		return num;
	}
	// ここで構文が正しければ s[i] == '(' となる
	i++; // '('を読み飛ばす
	int ret = expr(s, i);
	i++; // ')'を読み飛ばす
	if(flag)
		return flag^ret;
	return ret;
}
 
int main(){
    string s;
    while(cin>>s,s!="#"){
        int eq=0;
        string a,b;
        for(int i=0;i<s.size();i++){
            if(s[i]=='T')
            s[i]='1';
            else if(s[i]=='F')
            s[i]='0';
        }
        for(;s[eq]!='=';eq++);
        a=s.substr(0,eq),b=s.substr(eq+1,s.size()-eq);
        //cout<<a<<" "<<b<<endl;
        vector<char> ap;
         
        for(int i=0;i<s.size();i++){
            if(isalpha(s[i]))
                ap.pb(s[i]);
        }
        sort(all(ap));
        uni(ap);
        bool flag=true;
        for(int i=0;i<(1<<ap.size());i++){
            string x=a,y=b;
            for(int j=0;j<ap.size();j++){
                char c=ap[j];
                bool wh=false;
                if((1<<j)&i)
                    wh=true;
                for(int k=0;k<x.size();k++){
                    if(x[k]==c){
                        if(wh)
                            x[k]='1';
                        else
                            x[k]='0';
                    }
                }
                for(int k=0;k<y.size();k++){
                    if(y[k]==c){
                        if(wh)
                            y[k]='1';
                        else
                            y[k]='0';
                    }
                }
            }
             
            int p=0,q=0;
        	x=cc(x,"--","");
        	y=cc(y,"--","");
            if(expr(x,p)!=expr(y,q)){
                cout<<"NO"<<endl;
                flag=false;
                break;
            }
             
        }
        if(flag)
            cout<<"YES"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1224
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){

    int N,K;
    cin >> N >> K;
    int a[N];
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }

    /*
    //t_sumをllにする必要があった。
    vector<ll> sum_a;
    for (int i = 0; i < N; i++){
        for (int k = i; k < N; k++){
            ll t_sum = 0;
            for (int p = i; p <= k; p++){
                t_sum += a[p];
            }
            sum_a.push_back(t_sum);
        }
    }
    */

    //こっちのがスマート
    vector<ll> sum_a;
    for (int i = 0; i < N; i++){
        ll sum = 0;
        for (int k = i; k < N; k++){
            sum += a[k];
            sum_a.push_back(sum);
        }
    }

    ll x = 0;
    int t = 40;
    while(t != 0){
        int cnt = 0;
        ll prov = x + pow(2,t-1);
        for (int i = 0; i < sum_a.size(); i++){
            if ((prov & sum_a[i]) == prov){
                cnt++;
            }
        }
        if (cnt >= K){
            x += prov -x;
        }
        t--;
    }

    cout << x << endl;
    /*
    ll ans = 0;
    for (int lg = 50; lg >= 0; lg--) {
        ll nans = ans | (1LL << lg);
        int cnt = 0;
        for (ll d: sum_a) {
            if ((nans & d) == nans) cnt++;
        }
        if (cnt >= K) ans = nans;
    }
    cout << ans << endl;
    */
}



Measured memory_bytes: 6512
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 1 << 30;
const ll INFll = 1ll << 60;
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

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

  cout << min(a, b) + min(c, d) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i =2; i <= (int)(n); i++)

int main() {
    int a ,b;
    cin >> a>>b ;
    
    if (a <= b)cout<<"unsafe" << endl;
    else cout<<"safe" << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

vector<ll> a;
ll n, m;

ll calc(ll th) {
  ll r = 0;
  for (ll i = 0; i < n; i++) {
    ll shortage = th - a[i];
    auto it = lower_bound(a.begin(), a.end(), shortage);
    ll idx = it - a.begin();
    ll plus = n - idx;
    r += plus;
  }

  return r;
}

ll sum(ll th) {
  vector<ll> cs(n + 1);
  for (ll i = 1; i < n + 1; i++) {
    cs[i] = cs[i - 1] + a[i - 1];
  }

  ll count = 0;
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ll shortage = th - a[i];
    // cout << "shortage:" << shortage << endl;
    auto it = lower_bound(a.begin(), a.end(), shortage);
    ll idx = it - a.begin();
    // cout << "idx:" << idx << endl;

    if (idx >= n) {
      continue;
    }

    // cout << endl;
    // cout << "a[" << i << "]:" << a[i] << endl;
    // cout << "shortage:" << shortage << endl;

    ll cnt(n - idx);
    // cout << "cnt:" << cnt << endl;

    ll left = a[i] * cnt;
    // cout << "left:" << left << endl;

    ll right = cs[n] - cs[idx];
    // cout << "right:" << right << endl;

    ans += left;
    ans += right;

    count += cnt;

    // cout << cnt << endl;
  }

  // cout << "count:" << count << endl;

  ans -= th * (count - m);

  return ans;
}

int main() {
  scanf("%lld %lld", &n, &m);

  a = vector<ll>(n);

  for (ll i = 0; i < n; i++) {
    ll v;
    scanf("%lld", &v);
    a[i] = v;
  }
  sort(a.begin(), a.end());

  ll left = 0;
  ll right = 200001;

  for (;;) {
    // cout << "(" << left << "," << right << ")" << endl;
    if (1 >= right - left) {
      break;
    }
    ll center = (left + right) / 2;
    ll num = calc(center);
    // cout << center << "(" << left << "," << right << ")" << num << endl;

    if (m <= num) {
      left = center;
    } else {
      right = center;
    }
  }

  // cout << "left:" << left << endl;
  // cout << "right:" << right << endl;
  ll center = (left + right) / 2;
  // cout << "center:" << center << endl;
  cout << sum(center) << endl;
}

// 5 3
// 10 14 19 33 34


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



int main() {
int N;
cin >> N;
int num[200000];
int gyaku[200000];
for(int i = 0; i < N;i++){
cin >> num[i];
num[i]--;
}
for(int i = 0; i < N;i++) gyaku[num[i]] = i;
for(int i = 0; i < N;i++) cout << gyaku[i]+1 << " ";



}

Measured memory_bytes: 1664
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int max = Integer.MIN_VALUE, t=0;
		sc.nextInt();
		for (char ch : sc.next().toCharArray()) {
			t+=ch=='I' ? 1 : -1;
			max=(t>max) ? t : max;
		}
		System.out.println(Math.max(max, 0));
		sc.close();			
	}

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

}

Measured memory_bytes: 35880
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,k=0;cin>>n;
  for(int i=1;i<=9;i++){
    if(n%i!=0||(n%i==0&&n/i>9)) k++;
  }
  if(k!=9) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

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

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

	static class LargestRectangleOfOnes {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int height = in.nextInt();
			int width = in.nextInt();
			char[][] s = new char[height][];
			for (int r = 0; r < height; r++) {
				s[r] = in.next().toCharArray();
			}
			boolean[][] a = new boolean[height - 1][width - 1];
			for (int r = 1; r < height; r++) {
				for (int c = 1; c < width; c++) {
					int k = 0;
					for (int dr = -1; dr <= 0; dr++) {
						for (int dc = -1; dc <= 0; dc++) {
							if (s[r + dr][c + dc] == '.') {
								++k;
							}
						}
					}
					if (k % 2 == 0) {
						a[r - 1][c - 1] = true;
					}
				}
			}
			int ans = Math.max(height, width);
			ans = Math.max(ans, maxRectangleOfOnes(a));
			out.println(ans);
		}

		private int maxRectangleOfOnes(boolean[][] a) {
			// false for 0, true for 1
			int height = a.length;
			int width = a[0].length;
			int[] prevMaxUp = new int[width + 1];
			int[] maxUp = new int[width + 1];
			int[] stack = new int[width + 1];
			// Sentinels.
			maxUp[width] = -1;
			prevMaxUp[width] = -1;
			int maxArea = 0;
			for (int r = 0; r < height; r++) {
				for (int c = 0; c < width; c++) {
					if (a[r][c]) {
						maxUp[c] = 1 + prevMaxUp[c];
					} else {
						maxUp[c] = 0;
					}
				}
				int sp = 0;
				for (int c = 0; c <= width; c++) {
					while (sp > 0 && maxUp[c] < maxUp[stack[sp - 1]]) {
						int dx = c - (sp >= 2 ? stack[sp - 2] + 1 : 0);
						int dy = maxUp[stack[sp - 1]];
						++dx;
						++dy;
						maxArea = Math.max(maxArea, dx * dy);
						--sp;
					}
					stack[sp++] = c;
				}
				int[] tmp = maxUp;
				maxUp = prevMaxUp;
				prevMaxUp = tmp;
			}
			return maxArea;
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

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

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

	}
}



Measured memory_bytes: 47032
X,N=map(int,input().split())
P=list(map(int,input().split()))

ans=[float("inf"),float("inf")]
for i in range(102):
    if i in P:
        continue
    tmp=abs(i-X)
    if tmp<ans[0]:
        ans[0]=tmp
        ans[1]=i
print(ans[1])

Measured memory_bytes: 9132
/**
 * @author sakt_coder
 * created on 2020-09-19 17:41
 */
import java.io.*;
import java.util.*;
public class Main
{
	
	final long mod=998244353;
	private void solve()throws Exception
	{
		int n=nextInt();
		int k=nextInt();
		int l[]=new int[n+1];
		int r[]=new int[n+1];
		for(int i=1;i<=k;i++)
		{
			l[i]=nextInt();
			r[i]=nextInt();
		}
		long sum=0;
		long dp[]=new long[n+1];
		dp[1]=1;
		for(int i=2;i<=n;i++)
		{
			for(int j=1;j<=k;j++)
			{
				//allowed are i-r[j] to i-l[j]
				if(i-r[j]-1>=1)
					sum=(sum-dp[i-r[j]-1]+mod)%mod;
				if(i-l[j]>=1)
					sum=(sum+dp[i-l[j]])%mod;
			}
			dp[i]=sum;
		}
		out.println(dp[n]);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}


Measured memory_bytes: 36628
<?php
// From https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
class Scanner {
    private $arr = [];
    private $count = 0;
    private $pointer = 0;
    public function next() {
        if($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(' ', $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }
    public function hasNext() {
        return $this->pointer < $this->count;
    }
    public function nextInt() {
        return (int)$this->next();
    }
    public function nextDouble() {
        return (double)$this->next();
    }
}
list($A,$B,$M) = sscanf(trim(fgets(STDIN)),"%d %d %d");
$a=array();
$b=array();
$amin = 100000;
$sc = new Scanner();
for($i=0; $i<$A; $i++){
    $a[$i] = $sc->nextInt();
    if($amin > $a[$i]) $amin = $a[$i];
}
$bmin = 100000;
$sc = new Scanner();
for($i=0; $i<$B; $i++){
    $b[$i] = $sc->nextInt();
    if($bmin > $b[$i]) $bmin = $b[$i];
}
$min = 100000000;

$calc = $amin + $bmin;
if($min > $calc) $min = $calc;


for($i=0; $i<$M; $i++){
    list($x,$y,$c) = sscanf(trim(fgets(STDIN)),"%d %d %d");
    $calc = $a[$x-1] + $b[$y-1] - $c;
    
    if($min > $calc) $min = $calc;
}
if($min < 0){
    $min = 0;
}
printf($min);

//$n = $sc->nextInt();

Measured memory_bytes: 50700
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define SZ(x) ((int)(x).size())
#define MSB(x) (31 - __builtin_clz(x))
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;
 
const int maxN = 1 << 19, maxS = 513, mod = 998244353;
const long long INF = 1000000000000000000ll;

long long npo2(int n)
{	return 1ll * n * (n-1) / 2;	}

int T[maxN], ile[maxN];

void solve()
{
	int n;
	scanf ("%d", &n);
	FOR(i, 0, n)
		scanf ("%d", T+i), ile[T[i]]++;
	long long res = 0;
	FOR(i, 1, n+1)
		res += npo2(ile[i]);
	FOR(i, 0, n)
		printf("%lld\n", res - (ile[T[i]]-1));	
}
 
int main()
{
	int t;
	t=1;//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}


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

const int MX = 200050;
const int MAXL = 20;

struct RMQ {
	int f[20][MX], n;
	RMQ() {}
	void init(int _n, int *a) {
		n = _n;
		for (int i = 0; i < n; i++) {
			f[0][i] = a[i];
		}
		for (int j = 1; 1<<j <= n; j++) {
			for (int i = 0; i < n; i++) {
				f[j][i] = f[j-1][i];
				if (i + (1<<j-1) < n) {
					f[j][i] = min(f[j][i], f[j-1][i + (1<<j-1)]);
				}
			}
		}
	}
	inline int get(int s, int e) { // Get minimum value between
		// [s, e](both inclusive)
		assert(s <= e && 0 <= s);
		int k = 31-__builtin_clz(e-s+1);
		return min(f[k][s], f[k][e-(1<<k)+1]);
	}
} r0, r1;

int p0[MX], p1[MX];
int p[MX];
int pos[MX];

struct node {
	int st, ed, P0, P1;
	node(int st = 0, int ed = 0) : st(st), ed(ed) {
		if(st & 1) {
			int k = r1.get(st / 2, ed / 2 - 1);
			P0 = pos[k];
			k = r0.get(P0 / 2 + 1, ed / 2);
			P1 = pos[k];
		}
		else {
			int k = r0.get(st / 2, ed / 2);
			P0 = pos[k];
			k = r1.get(P0 / 2, ed / 2);
			P1 = pos[k];
		}
	}
	bool operator < (const node& rhs) const { return p[P0] > p[rhs.P0]; }
};

int main() {
	int n; scanf("%d", &n);
	for(int i = 0; i < n / 2; i++) {
		scanf("%d%d", p0 + i, p1 + i);
		pos[p0[i]] = i * 2; pos[p1[i]] = i * 2 + 1;
		p[i * 2] = p0[i]; p[i * 2 + 1] = p1[i];
	}
	r0.init(n / 2, p0); r1.init(n / 2, p1);
	priority_queue<node> pq;
	pq.push(node(0, n - 1));
	vector<int> res;
	while(pq.size()) {
		node nd = pq.top(); pq.pop();
		if(nd.st < nd.P0) pq.push(node(nd.st, nd.P0 - 1));
		if(nd.P0 + 1 < nd.P1) pq.push(node(nd.P0 + 1, nd.P1 - 1));
		if(nd.P1 < nd.ed) pq.push(node(nd.P1 + 1, nd.ed));
		res.push_back(p[nd.P0]);
		res.push_back(p[nd.P1]);
	}
	for(int i = 0; i < res.size(); i++) printf("%d%c", res[i], i == res.size() - 1 ? '\n' : ' ');
	return 0;
}


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

int main() {
  int N, L;
  cin >> N >> L;
  
  string a[101];
  for (int i = 0; i < N; i++) cin >> a[i];
  
  sort(a, a + N);
  
  for (int i = 0; i < N; i++) cout << a[i];
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
int stuff[401][401];
int main ()
{
  prep();
  int n, c;
  cin >> n >> c;
  int a[n];
  int b[n];
  for (int i=0; i<n; i++){
      cin >> a[i];
  }
  for (int i=0; i<n; i++){
      cin >> b[i];
  }
  stuff[0][0] = 1;
  int cnt = 1;
  for (int i=n-1; i>=0; i--){
      int cura = a[i];
      int curb = b[i];
      for (int j=cura; j<=curb; j++){
          long long temp[c+1];
          temp[0] = stuff[cnt-1][0];
          stuff[cnt][0] += temp[0];
          stuff[cnt][0] %= mod;
          for (int k=1; k<=c; k++){
              temp[k] = mymod(stuff[cnt-1][k]+mymod(temp[k-1]*j));
              stuff[cnt][k] += temp[k];
              stuff[cnt][k] %= mod;
          }
      }
      cnt++;
      //cout << endl;
  }
  cout << stuff[cnt-1][c];
  return 0; 
}

Measured memory_bytes: 896
K, N = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A.append(K + A[i])


minimum = 10**8
for i in range(N):
    if minimum > (A[N - 1 + i] - A[i]): minimum = A[N - 1 + i] - A[i]
print(minimum)

Measured memory_bytes: 26444
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.B_____A
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split(null).Select(int.Parse).ToArray();
            var A = AB[0];
            var B = AB[1];

            if (B % A == 0)
                Console.WriteLine(A + B);
            else
                Console.WriteLine(B - A);
        }
    }
}


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

int main(){

    int h,w;
    cin >> h >> w;
    vector<string> s(h);

    rep(i,h){
        cin >> s[i];
    }

    vector<vector<int>> r(h,vector<int>(w,0)),l(h,vector<int>(w,0));
    vector<vector<int>> u(h,vector<int>(w,0)),d(h,vector<int>(w,0));
  
  	for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
        if(j==0||s[i][j-1]=='#'){
          l[i][j]=0;
        }else{
          l[i][j]=l[i][j-1]+1;
        }
      }
    }
  	
  	for(int i=0;i<h;i++){
      for(int j=w-1;j>=0;j--){
        if(j==w-1||s[i][j+1]=='#'){
          r[i][j]=0;
        }else{
          r[i][j]=r[i][j+1]+1;
        }
      }
    }
  
  	for(int i=0;i<w;i++){
      for(int j=0;j<h;j++){
        if(j==0||s[j-1][i]=='#'){
          u[j][i]=0;
        }else{
          u[j][i]=u[j-1][i]+1;
        }
      }
    }
  
  	for(int i=0;i<w;i++){
      for(int j=h-1;j>=0;j--){
        if(j==h-1||s[j+1][i]=='#'){
          d[j][i]=0;
        }else{
          d[j][i]=d[j+1][i]+1;
        }
      }
    }
  	int ans=0;
  	rep(i,h){
      rep(j,w){
        if(s[i][j]!='#'){
          int tt;
          tt=u[i][j]+d[i][j]+l[i][j]+r[i][j];
          tt++;
          ans=max(tt,ans);
        }
      }
    }
  
  	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 67328
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main() {
	
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int A,B,C,K,ans=0;
	cin>>A>>B>>C>>K;
	
	if(A>K)
		cout<<K<<endl;
	else if(A+B>K)
		cout<<A<<endl;
	else
		cout<<A-(K-A-B)<<endl;
	
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<cmath>
#include<stack>
#include<vector>
#include<numeric>

using namespace std;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> f(M + 1);

	for (int i = 0; i < N; i++)
	{
		int K;
		cin >> K;
		for (int j = 0; j < K; j++)
		{
			int a;
			cin >> a;
			f[a]++;
		}
	}

	int r = 0;
	for (int i = 1; i <= M; i++)
	{
		if (f[i] == N)
		{
			r++;
		}
	}

	cout << r << endl;

	return 0;
}


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


using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;

int main() {
	int h, w, n;
	cin >> h >> w >> n;

	REP(i, 1000) {
		if (max(h*i, w*i) >= n) {
			cout << i << endl;
			return 0;
		}
	}



	return 0;
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int r = Integer.parseInt(in.readLine());
    System.out.println(3*r*r);
  }
}

Measured memory_bytes: 21460
#include<stdio.h>
 
int main()
{
  int x, y, key1, key2;
 
  scanf("%d%d",&x,&y);
 
  if(x < y)
    {
      key1 = x;
      x = y;
      y = key1;
    }
 
  key2 = x % y;
 
  while(key2 != 0)
    {
      x = y;
      y = key2;
      key2 = x % y;
    }
 
  printf("%d\n",y);
 
  return 0;
}

Measured memory_bytes: 1828
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
#include<limits>
#include<map>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define MOD 1e+7
#define vi vector<int>
#define vii vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  ll t = 100 * (N -M) + 1900 * M;

  ll ans = t * pow(2,M);
  cout << ans << endl;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, K;
    cin >> N >> K;
    vector<ll> L(N);
    rep(i, N) cin >> L[i];
    sort(L.rbegin(), L.rend());
    cout << accumulate(L.begin(), L.begin() + K, 0LL) << endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    ll x;
    cin >> x;
    ll m = 100;
    int y = 0;
    while(m < x){
        double mm = (double)m * 1.01;
        m = mm;
        y++;
    }
    cout << y << endl;
}

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

using lli = long long int;

using namespace std;

int main() {
    lli N;
    cin >> N;
    lli capacity_passenger[5];
    std::for_each(capacity_passenger, capacity_passenger + 5, [](auto &x) { cin >> x; });
    std::sort(capacity_passenger, capacity_passenger + 5);

    lli time[5];
    lli time_all = 0;

    time[0] = N % capacity_passenger[0] == 0 ? N / capacity_passenger[0] : N / capacity_passenger[0] + 1;
    time_all = time[0];

    for (int i = 1; i < 5; i++) {
        if (capacity_passenger[i - 1] <= capacity_passenger[i]) {
            time[i] = 1;
        } else {
            if ((N - time_all * capacity_passenger[i]) % capacity_passenger[i] == 0) {
                time[i] = (N - time_all * capacity_passenger[i]) / capacity_passenger[i];
            } else {
                time[i] = (N - time_all * capacity_passenger[i]) / capacity_passenger[i] + 1;
            }
        }
        time_all += time[i];
    }

    cout << time_all << endl;

    return 0;
}

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

int main(){
    long long int N,A,B;
    cin>>N>>A>>B;
    
    if(A>B){
    cout<<0<<endl;
    }
    
    else if(A==B&&N==1){
    cout<<1<<endl;
    }
    
    else if(N==1&&B>A){
    cout<<0<<endl;
    }
    
    else if(B>=A&&N>=2){
    cout<<(B-A)*(N-2)+1<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;

ll p, q, r, s, a, b, c;

ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}

bool solve() {
  double d = b*b - 4*a*c;
  if (d < 0) return false;
  ll sqrtD = (ll)sqrt(d + 0.01);
  if (sqrtD * sqrtD != d) return false;
  p = r = 2 * a;
  q = b + sqrtD;
  s = b - sqrtD;
  ll gcdPq = gcd(p, q > 0 ? q : -q);
  p /= gcdPq;
  q /= gcdPq;
  ll gcdRs = gcd(r, s > 0 ? s : -s);
  r /= gcdRs;
  s /= gcdRs;

  if (p < r || (p == r && q < s)) {
    swap(p,r);
    swap(q,s);
  }
  return true;
}

int main() {
  while (cin >> a >> b >> c, a) {
    if (solve()) cout << p << " " << q << " " << r << " " << s << endl;
    else cout << "Impossible" << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;

int main() {
  int n,m;
  while(cin >> n && n) {
    cin >> m;
    vector<P> v[n];
    while(m--) {
      int x,y,d;
      scanf("%d%*c%d%*c%d",&x,&y,&d);
      v[x].pb(P(y,d));
      v[y].pb(P(x,d));
    }
    int ans=0;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,0));
    bool d[n];
    fill(d,d+n,false);
    while(!que.empty()) {
      P p=que.top();que.pop();
      int x=p.S,cost=p.F;
      if(d[x]) continue;
      d[x]=true;
      ans+=cost/100-1;
      for(int i=0; i<v[x].size(); i++) {
	if(!d[v[x][i].F]) {
	  que.push(P(v[x][i].S,v[x][i].F));
	}
      }
    }
    pr(ans+1);
  }
  return 0;
}


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

int main()
{
	string s;
	cin >> s;
	
	int cnt = 0, tmp = 0;
	for (int i = 0; i < s.length(); ++i)
	{
		if (s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T')
		{
			cnt++;
			tmp = max(tmp, cnt);
		}
		else
		{
			cnt = 0;
		}
	}
	
	cout << tmp << endl;
	
	return 0;
}


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

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  string s;
  bool flag = true;
  cin >> s;
  int N = s.size();
  rep(i, N/2) {
    if (s[i] != s[N-1-i])
      flag = false;
  }
  rep(i, N/4) {
    if (s[i] != s[N/2-1-i])
      flag = false;
    if (s[N/2+1+i] != s[N-1-i])
      flag = false;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
using namespace std;
int32_t main(){
    int n;
    cin>>n;
    double p[n+1];
    for(int i=1;i<=n;i++){
        cin>>p[i];
    }
    //dp[i][x] represents prob of atleast x heads by tossing first i coins (from 1...to...i)
    double dp[n+1][n+1];
    memset(dp,0,sizeof dp);
    dp[0][0]=1;
    for(int i=1;i<=n;i++){
        for(int x=0;x<=n;x++){
            if(x==0){
                dp[i][x]=1;
                continue;
            }
            dp[i][x]=p[i]*dp[i-1][x-1]+(1-p[i])*dp[i-1][x];
        }
    }
    cout<<fixed<<setprecision(11)<<dp[n][(n+1)/2]<<endl;
	return 0;
}

Measured memory_bytes: 70528
N,K = map(int,input().split())

# K個選んだときに作れる数の個数は、
# [大きいほうK個の和] - [小さいほうK個の和] + 1
# これらの総和を求める

DIV = 10 ** 9 + 7
ans = 1
for k in range(K,N+1):
  ans += ((N + (N - k + 1)) * k // 2) - (((k - 1) * k) // 2) + 1
  ans %= DIV

print(ans)


Measured memory_bytes: 9176
#include <iostream>  
#include <algorithm>  
#include <functional>  
#include <vector>  
#include <map>
#include <string>
#include <queue>
#include <deque> 
#include <cmath>
#include <math.h>
using namespace std;
	double pi=acos(-1);
	#define mod 1000000007
	long long int modexp(long long int a, int b){ 
	long long int t=1;
	while( b != 0){
		if( b%2 == 1)
			t = (t*a)%mod ;
		a = (a*a)%mod;
		b /= 2;
	}
	return t%mod;
}
int main(){
	//freopen("input.txt", "r", stdin);   
 	//freopen("output.txt", "w", stdout);
 	int n=1,m=1;
 	scanf("%d %d",&n,&m);
 	if(n>m){
 		int te=m;
 		m=n;
 		n=te;
 	}
 	long long int ans=1;
 	long long int f=2;
 	int i;
 	for(i=1;i<=n;i++) ans=(ans*i)%mod;
 	long long int ans2=1;
 	for(i=1;i<=m;i++) ans2=(ans2*i)%mod;
 	if(m-n>=2) printf("0\n");
 	else if(m-n==1) printf("%lld\n",(ans*ans2%mod)%mod );
 	else if(m==n) printf("%lld\n", (f*(ans*ans)%mod)%mod );
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define pb push_back
typedef long long ll;
const int MAXN = 1e5 + 5;
const int MAXW = 1e5 + 5;
const int MOD = 1e9 + 7;

using namespace std;
vector<int> g[MAXN];
int mem[MAXN];
int solve(int u,int c)
{
    if(g[u].empty())
          return 0;
	int &ret = mem[u];
	if(ret != -1)
		  return ret;
	ret = -1e9;
	for(auto &k : g[u])
		 ret = max(ret , solve(k , c + 1) + 1);

	return ret;
   
}

int main()
{

int n,m;
cin >> n >> m;
for(int i = 0 ; i < m ; i++)
	 {
	 	int u,v;
	 	cin >> u >> v;
	 	g[u].push_back(v);
	 }
	memset(mem,-1,sizeof(mem));
int ans = 0;
for(int i = 1 ; i <= n ; i++)
 {
 	ans = max(ans , solve(i,0));
 	
 }

cout << ans ;

}

 

Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
#else
#define dbg(...) {}
#endif

int main(){
  vector<int> v(4);
  rep(i,4) cin>>v[i];
  sort(all(v));
  vector<int> u = {1,4,7,9};

  cout << (v==u ? "YES" : "NO") << endl;
  
  return 0;
}


Measured memory_bytes: 764
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)

        {
            long n = Input();
            long ans = n * (n - 1) / 2;
            Console.WriteLine(ans);
                
                





        }

       
        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }

        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }

        
       
    }
}


Measured memory_bytes: 11092
#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 <unordered_map>
#include <set>
#include <unordered_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>

using namespace std;

typedef long long ll;
typedef vector<long long> vi;
typedef pair<long long, long long> ii;
typedef vector<pair<long long, long long>> vii;
typedef stringstream ss;
ll mil() {return numeric_limits<long long>::min();}
ll mal() {return numeric_limits<long long>::max();}

#define R3(i, a, b) for(long long i=(a); i<(b); ++i)
#define R2(i, b) for(long long i=0; i<(b); ++i)
#define R1(b) for(long long i=0; i<(b); ++i)
#define RR(i, a, b) for(long long i=a; i>b; --i)
#define PB(x) push_back(x)
#define MP(x, y) make_pair(x, y)

// build: ctrl + f9

// run: shift + f10
// debug: shift + f9
// sanitize: shift + f11

int main(int argc, char **argv) {
    vector<vector<ll>> mat(3, vi(3));

    R3(i, 0, 3) {
        R3(j, 0, 3) {
            cin >> mat[i][j];
        }
    }

    ll N;

    cin >> N;

    R1(N) {
        ll curr;
        cin >> curr;
        bool tagged = false;
        R3(j, 0, 3) {
            R3(k, 0, 3) {
                if(mat[j][k] == curr) {
                    mat[j][k] = -1;
                }
            }
        }
    }

    R1(3) {
        if(mat[i][0] < 0 && mat[i][1] < 0 && mat[i][2] < 0) {
            cout << "Yes" << endl;
            return 0;
        }

        if(mat[0][i] < 0 && mat[1][i] < 0 && mat[2][i] < 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    if(mat[0][0] < 0 && mat[1][1] < 0 && mat[2][2] < 0) {
        cout << "Yes" << endl;
        return 0;
    }

    if(mat[0][2] < 0 && mat[1][1] < 0 && mat[2][0] < 0) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using P = pair< T1, T2 >;
using Pii = P<int,int>;
using Pdd = P<double,double>;

// greatest common divisor
LL GCD(LL a,LL b){
    LL t; LL r;
    if(a<b){t=a;a=b;b=t;}
    if(b==0){return a;}
    while(a%b!=0){r=a%b;a=b;b=r;}
    return b;
}

// least common multiple
LL LCM(LL a,LL b){LL ab=(a*b);return ab/GCD(a%b,b);}

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

    V<Pii> work;

    REP(i,n){
        int a,b;
        cin>>a>>b;
        work.pb(mp(b,a));
    }

    sort(ALL(work),greater<Pii>());

    int now_time = work[0].fi;
    REP(i,n){
        if(now_time>work[i].fi){
            now_time = work[i].fi;
        }
        now_time -= work[i].se;
    }

    if(now_time<0){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }

    return 0;
}

Measured memory_bytes: 2420
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[a]; if (a != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)(?´????????`)///
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		string s;
		cin >> s;
		if (s[0] == '#')break;
		vector<string> v;
		string tmp;
		REP(i, s.size()) {
			if (s[i] == '/') {
				v.push_back(tmp);
				tmp = "";
			}
			else tmp += s[i];
		}
		v.push_back(tmp);
		int h = v.size();
		int w=0;
		REP(i, v[0].size()) {
			if (v[0][i] == 'b')w++;
			else w += (v[0][i] - '0');
		}
		vvi m(h, vi(w));
		REP(i, h) {
			int p = 0;
			REP(j, v[i].size()) {
				if (isdigit(v[i][j])) {
					REP(k, v[i][j] - '0') {
						m[i][p] = 0;
						p++;
					}
				}
				else {
					m[i][p] = 1;
					p++;
				}
			}
		}
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		m[c - 1][d - 1] = 1; m[a - 1][b - 1] = 0;
		REP(i, h) {
			int cnt = 0;
			if (i != 0)cout << '/';
			REP(j, w) {
				if (m[i][j] == 1) {
					if (cnt != 0)cout << cnt;
					cout << 'b';
					cnt = 0;
				}
				else cnt++;
			}
			if (cnt != 0)cout << cnt;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3216
#include <stdio.h>

int main(void)
{
	int a,b,c,i,count=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 596
import sys
sys.setrecursionlimit(10**9)


A, B, C, D = list(map(int, input().split()))

turn = True
while True:
    if turn:
        C -= B
        if C <= 0:
            print('Yes')
            sys.exit()
    else :
        A -= D
        if A <= 0:
            print('No')
            sys.exit()
    turn ^= True


Measured memory_bytes: 9180
#include <iostream>
#include <stdio.h>
#include <iomanip>
#include <climits>
#include <vector>
#include <string>
#define REP(a,b) for(int a=0; a<b; a++)
using namespace std;

vector <int> colors;
int canvas[105][105];

int main() {
  ios_base::sync_with_stdio(false);
  int H, W, N, c;
  cin >> H >> W >> N;
  colors.push_back(0);
  REP(i, N){
    int temp;
    cin >> temp;
    colors.push_back(temp);
  }
  c = 1;
  REP(i, H){
    if(i % 2 == 0){
      REP(j, W){
        canvas[i][j] = c;
        colors[c]--;
        if(colors[c] == 0) c++;
      }
    }else{
      for(int j = W-1; j >= 0; j--){
        canvas[i][j] = c;
        colors[c]--;
        if(colors[c] == 0) c++;
      } 
    }
  }
  REP(i, H){
    REP(j, W){
      cout << canvas[i][j] << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 512
#include <stdio.h>
#define N 1000

int main(void)
{
	int i , n;
	scanf("%d",&n);
	double a[n];
	
	for(i = 0; i < n; i++){
		
		scanf("%lf",&a[i]);
	}
	double b[n+1];
	
	for(i = 0; i <= n; i++){
		
		scanf("%lf",&b[i]);
	}
	
	
	double c[n+1][n+1];
	double d[n+1];
	c[0][0]=b[0];
	d[0]=a[0]+b[0];
	
	for(i = 1; i <= n; i++){
		
		c[i][i] = b[i];
		c[i-1][i] = a[i-1]+(b[i-1]+b[i])*2;
		d[i] = d[i-1]+a[i]+b[i];
	}
	int j , k;
	double s , t;
	for(i = 1;i < n; i++){
		
		for(j = 0; j < n-i; j++){
			
			s = c[j][j] + c[j+1][i+j+1];
			
			for(k = j; k <i+j; k++){
				
				t = c[j][k+1]+c[k+2][i+j+1];
				if(s>t) s = t;
			}
			c[j][i+j+1] = s + d[i+j] - d[j-1] + b[i+j+1];
		}
	}
	printf("%lf\n",c[0][n]);
	return 0;
}



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

int ans[1010][1010];

int main() {
    int H, W, A, B;
    cin >> H >> W >> A >> B;

    rep(r, B) rep(c, A) ans[r][c] = 1;
    for (int r=B; r<H; ++r) for (int c=A; c<W; ++c) ans[r][c] = 1;

    rep(r, H) {
        rep(c, W) cout << ans[r][c];
        cout << endl;
    }
}


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

int main() {
	int i,a[10];
	for(i=0;i<10;i++){
		cin >> a[i];
	}
	sort(a,a+10);
	cout << a[9] <<endl;
	cout << a[8] <<endl;
	cout << a[7] <<endl;
	return 0;
}

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

int N,M;
vector<int> u_f;

void init_unionfind(int N){
	for(int i=0;i<N;i++)u_f.push_back(i);
}

int root(int a){
	if(u_f[a]==a)return a;
	else return u_f[a]=root(u_f[a]);
}

void unite(int a,int b){
	a=root(a);
	b=root(b);
	if(a==b)return;
	
	u_f[a]=b;
}

bool query(int a,int b){
	return root(a)==root(b);
}

int main(){
	cin >> N >> M;
	int ans=N;
	init_unionfind(N);
	for(int i=0;i<M;i++){
		int X,Y,Z;
		cin >> X >> Y >> Z;
		X--;
		Y--;
		if(!query(X,Y)){
			unite(X,Y);
			ans--;
		}
	}
	
	cout << ans << endl;
	return 0;
}

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

int main() {
	int q;
	long long n,i,k,j,sum=0,count=0,ans=0,m,v,p,chk,x,h;
	cin>>n>>m>>v>>p;
	long long a[n],d[n]={0},c[n]={0};
	for(i=0;i<n;i++)
	cin>>a[i];
    sort(a,a+n);
    count=0;
    for(i=0;i<p;i++)
    {
      d[n-i-1]=1;   
    }
    for(i=0;i<(n-p);i++)
    {
     c[i]=a[n-p]-a[i];
    }
    for(i=n-p-2;i>=0;i--)
    {
        c[i]+=c[i+1];
    }
    k=a[n-p];
    sum=n-1;
	for(i=n-p-1;i>=0;i--)
	{
	    count=a[i]+m;
	    if(v<=(sum))
	    {
	        if(count>=k)
	        d[i]=1;
	    }
	    else
	    {
	        x=v-sum;
	        x=x*m;
	        
	        if(x<=c[i+1])
	        {
	              if(count>=k)
	              d[i]=1;
	        }
	        else
	        {
	            x=x-c[i+1];
	            h=n-p-i;
	            chk=k+x/h;
	            if(x%h!=0)
	            chk++;
	             if(count>=chk)
	              d[i]=1;
	        }
	    }
	    sum--;
	}
	count=0;
	for(i=0;i<n;i++)
	{
	    if(d[i]==1)
	    count++;
	}cout<<count;
	return 0;
}

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

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

using namespace std;

int main() {
    int x;

    cin >> x;
    cout << (x * x * x) << endl;

    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n, k; cin >> n >> k;
	int h[100005];
	int ans = 0;
	for(int i=0;i<n;i++){
		cin >> h[i];
	}
	for(int i=0;i<n;i++){
		if(h[i]>=k) ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    int N, M, A;
    cin >> N >> M;
    for(int i = 0; i < M; i++) {
        cin >> A;
        N -= A;
    }
    if(N >= 0) {
        cout << N << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}

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

int main() {
  int  a;
  cin >> a;
  int b = a / 2;
  int c = b / 2;
  a = a%2;
  b = b%2;
  c = c%2;
  cout << a + b + c << endl; 
}

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

int main(){
    int a,b,c;
	cin>>a>>b>>c;
  	if (a==b){
    	if(a==c){
          cout<<"No";
        } else {
        	cout<<"Yes";
        }
    } else {
    	if(a==c||b==c){
        	cout<<"Yes";
        } else {
        	cout<<"No";
        }
    }
}

Measured memory_bytes: 256