akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
string s;
int cnt[100001],p[100001],h;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	for (int i=0;i<s.size();++i)
	{
		if (s[i]=='R') h=i;
		if (s[i]=='L') p[i]=h;
	}
	for (int i=s.size()-1;i>=0;--i)
	{
		if (s[i]=='L') h=i;
		if (s[i]=='R') p[i]=h;
	}
	for (int i=0;i<s.size();++i)
		if (s[i]=='R')
		{
			int t=p[i];
			t-=i;
			if (t%2==0) ++cnt[t+i];
			else ++cnt[t+i-1];
		}
		else
		{
			int t=p[i];
			t=i-t;
			if (t%2==0) ++cnt[i-t];
			else ++cnt[i-t+1];
		}
	for (int i=0;i<s.size();++i) cout<<cnt[i]<<" ";
	return 0;
}

Measured memory_bytes: 1488
def main():
  def bfs(v):
    distance=[-1]*n
    distance[v]=0
    next=connection[v]
    next2=set()
    visited=[-1]*n
    visited[v]=1
    visitct=1
    ct=0
    while len(next)!=0 and visitct!=n:
      ct+=1
      for i in range(len(next)):
        if visited[next[i]]==-1:
          distance[next[i]]=ct
          visited[next[i]]=1
          visitct+=1
          for j in range(len(connection[next[i]])):
            if visited[connection[next[i]][j]]==-1:
              next2.add(connection[next[i]][j])
      next=list(next2)
      next2=set()
      
    return distance

  n=int(input())
  l=[list(map(int,input().split())) for i in range(n-1)]
  connection=[[] for i in range(n)]
  for i in range(n-1):
    connection[l[i][0]-1].append(l[i][1]-1)
    connection[l[i][1]-1].append(l[i][0]-1)

  if max(bfs(bfs(0).index(max(bfs(0)))))%3==1:
    print('Second')
  else:
    print('First')
if __name__ == '__main__':
    main()

Measured memory_bytes: 136436
def main():
    n, m = map(int, input().split())

    pref = {}
    for i in range(m):
        p, y = map(int, input().split())
        if p not in pref:
            pref[p] = [(y, i)]
        else:
            pref[p].append((y, i))

    ans = [None] * m
    for key in pref:
        pref[key].sort()
        it = pref[key]
        str_k = str(key)
        for j in range(len(it)):
            sj = str(j+1)
            ans[it[j][1]] = "0" * (6-len(str_k)) + str_k + "0" * (6-len(sj)) + sj


    for i in range(m):
        print(ans[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 42936
import java.util.Scanner;

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

		if(n % 2 == 1) {
			System.out.println("No");
			return;
		}

        String s = sc.next();
        String s1, s2;
        s1 = s.substring(0, n/2);
        s2 = s.substring(n/2);

        String ans = (s1.equals(s2)) ? "Yes" : "No";
        System.out.println(ans);

        return;
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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

ll k;
cin>>k;
	string s;
	cin>>s;
	ll op = s.size();
	if(op<=k) cout<<s<<'\n';
	else {
		cout<<s.substr(0, k);
		cout<<"...";
	}


	return 0;
}


Measured memory_bytes: 3656
use proconio::marker::*;
use proconio::*;

use std::collections::VecDeque;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize, M: usize,
        mut AB: [(Usize1, Usize1); M],
    }
    let mut edges: Vec<Vec<usize>> = vec![vec![]; N];
    for &(A, B) in AB.iter() {
        edges[A].push(B);
        edges[B].push(A);
    }
    let mut q = VecDeque::new();
    q.push_front(0usize);
    let mut numbers = vec![std::usize::MAX; N];
    while q.len() != 0 {
        let room = q.pop_back().unwrap();
        for &each in edges[room].iter() {
            if numbers[each] == std::usize::MAX {
                numbers[each] = room;
                q.push_front(each);
            }
        }
    }
    println!("Yes");
    for &number in numbers[1..].iter() {
        println!("{}", number + 1);
    }
}


Measured memory_bytes: 17332
#include <iostream>

using namespace std;

int main(void) {
  string a, b;
  cin >> a >> b;
  bool flag = a.size() == b.size();
  for (int i = 0; i < a.size(); i++) {
    flag = flag && a[i] == b[b.size()-1-i];
  }
  cout << (flag ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
import collections

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

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

gc = gcd(A, B)

c = collections.Counter(prime_factorize(gc))

print(len(c.keys()) + 1)


Measured memory_bytes: 3572
n, y = gets.chomp.split(' ').map(&:to_i)

(0..n).each do |i|
  break if y < i * 10_000
  (0..(n - i)).each do |j|
    break if y < i * 10_000 + j * 5000
    if i * 10_000 + j * 5000 + (n - j - i) * 1000 == y
      puts [i, j, (n - j - i)].join(' ')
      exit(0)
    end
  end
end

puts '-1 -1 -1'


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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int i=(first);i<(last);++i){cout<<#a<<"["<<i<<"] = "<<(a)[i]<<endl;}
#define PRINTP(p)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#p<<" = ("<<(p.first)<<", "<<(p.second)<<")"<<endl;
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTP(p)
#define PRINTI(a,i)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

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

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

    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    REP(i, H) cin >> S[i];

    /*
    vector<vector<int>> acc_;
    REP() {
    }
    */

    int result = H * W;



    REP(b, 1 << (H - 1)) {
        vector<int> hs{0};
        REP(i, H - 1) {
            if (b & (1 << i)) {
                hs.pb(i + 1);
            }
        }
        hs.pb(H);
        int cost = hs.size() - 2;

        vector<int> n_whites(hs.size() - 1, 0);
        vector<int> tmps(hs.size() - 1, 0);

        REP(j, W) {
            bool do_split = false;
            REP(hh, hs.size() - 1) {

                int h0 = hs[hh];
                int h1 = hs[hh + 1];

                tmps[hh] = 0;
                FOR(i, h0, h1) {
                    if (S[i][j] == '1') {
                        tmps[hh]++;
                    }
                }
                if (tmps[hh] > K) {
                    goto label;
                }
                if (tmps[hh] + n_whites[hh] > K) {
                    do_split = true;
                }
            }
            if (do_split) {
                ++cost;
                REP(hh, hs.size() - 1) {
                    n_whites[hh] = tmps[hh];
                }
            } else {
                REP(hh, hs.size() - 1) {
                    n_whites[hh] += tmps[hh];
                }
            }
        }


        if (result > cost) {
            result = cost;
        }

        label:
        ;
    }


    cout << result << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <algorithm>

using namespace std;

class city{
public:
  int id;
  long long y;
  int rank;
  int pref;
  
  city(int _i,int _p,int _y){
    id = _i;
    pref = _p;
    y = _y;
    rank = 0;
  }

  bool operator < (const city& b) const{
    return y < b.y;
  }
  
};

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

  vector<city> nation;
  vector< vector<city> > nation2;

  for(int i = 0;i < n;i++){
    vector<city> pref;
    nation2.push_back(pref);
  }

  for(int i = 0;i < m;i++){
    int p,y;
    cin >> p >> y;

    city c(i,p,y);
    nation.push_back(c);
    nation2[p-1].push_back(c);
  }

  for(int i = 0;i < n;i++){
    if(nation2[i].size() > 0){
      sort(nation2[i].begin(),nation2[i].end());
    
      for(int j = 0;j < nation2[i].size();j++){
	nation[nation2[i][j].id].rank = j+1;
      }
    }
  }

  for(int i = 0;i < m;i++){
    cout << setfill('0') << setw(6) << nation[i].pref;
    cout << setfill('0') << setw(6) << nation[i].rank;
    cout << endl;
  }
}


Measured memory_bytes: 11888
#include<bits/stdc++.h>
using namespace std;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	int n;
	cin>>n;
	int h;
	cin>>h;
	int a[n];
	int sum=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>=h){
			sum++;
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define ld long double 
#define For(i, a, n) for(long long i = a; (a < n) ? (i < n) : (i > n); (a < n) ? (i++) : (i--))
#define ee 1000000007
#define pb push_back
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
using namespace std;

void solve() {
    ll d, t, s;
    cin >> d >> t >> s;
    if(d <= t * s)
        cout << "Yes\n";
    else    
        cout << "No\n";
}

int main() {
    fio;
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

struct N {
  int i;
  ll v;
};

bool operator<(const N &l, const N &r) {
  return l.v < r.v;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) cin >> b[i];
  priority_queue<N> q;
  for (int i = 0; i < n; i++) {
    if (b[i] > a[i])
      q.push(N{i, b[i]});
    else if (b[i] < a[i]) {
      cout << "-1" << endl;
      return 0;
    }
  }
  ll ans = 0;
  while (q.size()) {
    auto now = q.top();
    q.pop();
    ll side = b[(now.i + n - 1) % n] + b[(now.i + 1) % n];
    if (side == 0 || now.v - side < a[now.i]) {
      cout << -1 << endl;
      return 0;
    }
    ll skip = (now.v - side) / side;
    if (skip == 0) skip++;
    skip = min(skip, (now.v - a[now.i] + side - 1) / side);
    b[now.i] -= skip * side;
    if (b[now.i] > a[now.i]) {
      q.push(N{now.i, b[now.i]});
    }
    ans += skip;
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    vector<int> N(5);
    int ans = 0;
    int del = 0;
    rep(i, 5) {
        int tmp;
        cin >> tmp;
        if (tmp % 10 != 0) {
          int hasu = 10-(tmp % 10);
            ans += (tmp + hasu);
            del = max(del,hasu);
        } else {
            ans += tmp;
        }
    }
    cout << ans - del << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<bitset>
#include<cmath>
using namespace std;

int h, w, a[80][80], b[80][80], mid = 6480;
bitset<12960> dp[80], temp;
 
int main() {
  scanf("%d%d", &h, &w);
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%d", &a[i][j]);
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf("%d", &b[i][j]);
  dp[0][mid+a[0][0]-b[0][0]] = true;
  dp[0][mid-a[0][0]+b[0][0]] = true;
  for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) if (i + j > 0) {
    temp = dp[j];
    if (j != 0) temp |= dp[j-1];
    int x = abs(a[i][j]-b[i][j]);
    dp[j] = (temp >> x) | (temp << x);
  }
  for (int i = 0;; i++) if (dp[w-1][mid-i] || dp[w-1][mid+i]) {
    printf("%d\n", i);
    return 0;
  }
}


Measured memory_bytes: 384
N=int(input())
A=list(map(int,input().split()))

mod=10**9+7

from collections import Counter

F=Counter()

import math

for x in A:
    L=int(math.sqrt(x))

    FACT=dict()

    for i in range(2,L+2):
        while x%i==0:
            FACT[i]=FACT.get(i,0)+1
            x=x//i

    if x!=1:
        FACT[x]=FACT.get(x,0)+1

    for f in FACT:
        F[f]=max(F[f],FACT[f])

#print(F)

LCM=1
for f in F:
    LCM=LCM*pow(f,F[f],mod)%mod

ANS=0
for a in A:
    ANS=(ANS+LCM*pow(a,mod-2,mod))%mod

print(ANS)


Measured memory_bytes: 4580
#pragma GCC optimize("O3")

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace __gnu_pbds;
using namespace std;
 
typedef
tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {
	SpeedForce;
	cin >> n;
	For(i, 1, n)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	ld r = a[1];
	For(i, 2, n) {
		r = (r + a[i]) / 2;
	}
	cout << r;

	return Accepted;
}

// B...a

Measured memory_bytes: 18688
#include <stdio.h>

int main() {
  int W, H, x, y, r;
  scanf("%d%d%d%d%d", &W, &H, &x, &y, &r);
  if (r <= x && x <= W - r && r <= y && y <= H - r) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return 0;
}



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

using namespace std;
using ll = long long;

int main() {
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	vector<ll> x(4);
	x[0] = a * c;
	x[1] = a * d;
	x[2] = b * c;
	x[3] = b * d;
	sort(x.begin(), x.end());
	cout << x[3] << endl;
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define p pair<int,int>
#define pb push_back
#define endl '\n'
void fast()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(0);

}
const int mx=1e6+5;
int a[mx];

int main()
{
    fast();
   int n;
   cin>>n;
   int ans=0;
   vector<int>vec(n);
   for(auto &i:vec)cin>>i;
   for(auto i:vec)
   {
       if(a[i])
       {
           a[i]=2;
           continue;
       }
       for(int j=i;j<mx;j+=i)
       {
           a[j]++;
       }
   }
   for(auto i:vec)
   {
       if(a[i]==1)ans++;
   }
   cout<<ans<<endl;
}



Measured memory_bytes: 7944
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
typedef pair<int,int> P;

int main(){
    stack<int> a; 
    string s;
    while(cin >> s){
        if(s=="+"){
            int x = a.top();
            a.pop();
            int y = a.top();
            a.pop();
            // cout << a.top() << endl;
            a.push(x+y);
        }
        else if(s=="-"){
            int x = a.top();
            a.pop();
            int y = a.top();
            a.pop();
            a.push(y-x);
            // cout << a.top() << endl;
        }
        else if(s=="*"){
            int x = a.top();
            a.pop();
            int y = a.top();
            a.pop();
            a.push(x*y);
            // cout << a.top() << endl;
        }
        else if(s=="/"){
            int x = a.top();
            a.pop();
            int y = a.top();
            a.pop();
            a.push(y/x);
            // cout << a.top() << endl;
        }
        else{
            int p = atoi(s.c_str()); 
            a.push(p);
        }
    }
    cout << a.top() << endl;
    return 0;
}


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

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

    for (ll a = -150; a <= 150; a++)
    {
        for (ll b = -150; b <= 150; b++)
        {
            if (pow(a, 5.0) - pow(b, 5.0) == x)
            {
                cout << a << " " << b << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 4088
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int top,S[1000];

void bush(int x){
  S[++top]=x;
}
int pop(){

  top--;
  return S[top+1];
}
int main(){
  int ans,as;
  top=0;
  char s[100];
  while( scanf( "%s",s)!=EOF){
    
    if(s[0]=='+') {
      ans=pop();
      as=pop();
      bush(ans+as);
    }
    else if(s[0] =='-'){

    
      as=pop();
      ans=pop();
      bush(ans-as);
    }


   else if(s[0]=='*') {
      ans=pop();
      as=pop();
      bush(ans*as);
    }
    else{
      bush(atoi(s));
    }
  }
  printf("%d\n",pop());
  return 0;
}



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

string ans="00100110010110111111110";
const int timelim=2;

int gettime(){
  timeval tv;
  gettimeofday(&tv, NULL);
  int x = tv.tv_sec % timelim * 1000 + tv.tv_usec / 1000;
  return x;
}
 
int T=30;
 
int main(){
  //puts("Yes"); while (gettime()>10); return 0;
  int x=gettime()/T;
  if (x>=23){
    x=0;
  }
  puts(ans[x]=='1'? "Yes": "No");
  int aim=((x+1)*T-450+timelim*1000)%(timelim*1000);
  while (1){
    int t=gettime();
    if (t<=aim&&t>=aim-1) return 0;
  }
}


Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.conv, std.algorithm.iteration;

void main()
{
    immutable nm = readln.chomp.split(" ").map!(to!int).array;
    immutable n = nm[0];
    immutable m = nm[1];

    string[] a;
    a.length = n;
    foreach(i; 0..n)
        a[i] = readln.chomp;

    string[] b;
    b.length = m;
    foreach(i; 0..m)
        b[i] = readln.chomp;
    
    while (a[0].length >= m) {
        
        auto aa = a[].map!(l => l[0..m]).array;
        while(aa.length >= m) {
            if (aa[0..m] == b) {
                writeln("Yes");
                return;
            }
            aa = aa[1..$];
        }

        foreach(i, l; a)
            a[i] = l[1..$];
    }

    writeln("No");
}

Measured memory_bytes: 256
#include <cstdio>  
#include <iostream>  
#include <cstring>  
#include <string>  
#include <cmath>  
#include <algorithm>  
#include <cstdlib>  
#include <utility>  
#include <map>  
#include <stack>  
#include <set>  
#include <vector>  
#include <queue>  
#include <deque>  
#include <sstream>  
#include <bitset>
#include<bits/stdc++.h>      
using namespace std;
int main()
{
    string s;
    cin>>s;
    for (int i=0;i<s.size();i++)
    {
    	if (i%2==0) cout<<s[i];
	}
    return 0;
}

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

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

    int N, L;
    cin >> N >> L;

    int pre_a;
    int last_idx = -1;
    cin >> pre_a;
    for (int i = 1; i < N; ++i) {
        int cur_a;
        cin >> cur_a;
        if (pre_a + cur_a >= L) {
            last_idx = i;
          	break;
        }
      	pre_a = cur_a;
    }
    if (last_idx == -1) {
        cout << "Impossible" << '\n';
        return 0;
    }

    cout << "Possible" << '\n';

    for (int i = 1; i < last_idx; ++i) {
        cout << i << '\n';
    }
    for (int i = N - 1; i >= last_idx; --i) {
        cout << i << '\n';
    }

    return 0;
}


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

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

    if(a + b == c + d)
    {
        cout << "Balanced" << endl;
    }
    else if(a + b > c + d)
    {
        cout << "Left" << endl;
    }
    else
    {
        cout << "Right" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<math.h>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e+10;
const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
	double x, y;
	Pt() {}
	Pt(double x, double y) : x(x), y(y) {}
	Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
	Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
	Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
	Pt operator-() const { return Pt(-x, -y); }
	Pt operator*(const double &k) const { return Pt(x * k, y * k); }
	Pt operator/(const double &k) const { return Pt(x / k, y / k); }
	double ABS() const { return sqrt(x * x + y * y); }
	double abs2() const { return x * x + y * y; }
	double arg() const { return atan2(y, x); }
	double dot(const Pt &a) const { return x * a.x + y * a.y; }
	double det(const Pt &a) const { return x * a.y - y * a.x; }
};
double tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); }
int iLL(Pt a, Pt b, Pt c, Pt d) {
	if (sig((b - a).det(d - c))) return 1; // intersect
	if (sig((b - a).det(c - a))) return 0; // parallel
	return -1; // correspond
}
char in[50];
vector<pair<Pt,Pt> > p[12];
double x[120];
double y[120];
int g[20][20];
int col[20];
int n;
int solve(int a,int b){
	if(a==n)return 1;
	for(int i=1;i<=b;i++){
		bool ok=true;
		for(int j=0;j<a;j++)if(g[a][j]&&col[j]==i)ok=false;
		if(ok){
			col[a]=i;
			int res=solve(a+1,b);
			if(res)return 1;
		}
	}
	return 0;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		map<string,int>m;
		n=0;
		for(int i=0;i<12;i++)p[i].clear();
		for(int i=0;i<20;i++)for(int j=0;j<20;j++)g[i][j]=0;
		for(int i=0;i<a;i++){
			scanf("%s",in);
			string tmp=in;
			int at;
			if(m.count(tmp))at=m[tmp];
			else {
				at=n;
				m[tmp]=n++;
			}
			int s=0;
			while(1){
				scanf("%lf",x+s);
				if(x[s]<-0.5)break;
				scanf("%lf",y+s);
				s++;
			}
			for(int i=0;i<s;i++){
				double X=x[i]*cos(1)-y[i]*sin(1);
				double Y=x[i]*sin(1)+y[i]*cos(1);
				x[i]=X;y[i]=Y;
			}
			for(int i=0;i<s;i++){
				p[at].push_back(make_pair(Pt(x[i],y[i]),Pt(x[(i+1)%s],y[(i+1)%s])));
			}
		}
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				bool ok=false;
				for(int k=0;k<p[i].size();k++){
					if(ok)break;
					for(int l=0;l<p[j].size();l++){
						if(ok)break;
						if(iLL(p[i][k].first,p[i][k].second,p[j][l].first,p[j][l].second)==-1){
							if(max(p[i][k].first.x,p[i][k].second.x)<EPS+min(p[j][l].first.x,p[j][l].second.x))continue;
							if(min(p[i][k].first.x,p[i][k].second.x)+EPS>max(p[j][l].first.x,p[j][l].second.x))continue;
							ok=true;
						}
					}
				}
				if(ok)g[i][j]=g[j][i]=1;
			}
		}
		int ans=n;
		for(int i=1;i<n;i++){
			for(int j=0;j<20;j++)col[j]=0;
			if(solve(0,i)){
				ans=i;break;
			}
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 1168
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

const int N = 1001000;

int n, fa[N], ans[N], prt[N], x, y, a[N];
vector<int> g[N]; 

void Dfs(int x, int f) {
	fa[x] = f;
	ans[x] = 0;
	for(int i = 0; i < g[x].size(); i++) {
		int v = g[x][i];
		if(v == f) continue;
		Dfs(v, x);
		if(!ans[v] && a[x] > a[v]) ans[x] = 1;
	}
}

void Upd(int x) {
	prt[x] = ans[x];
	for(int i = 0; i < g[x].size(); i++) {
		int v = g[x][i];
		if(v == fa[x]) continue;
		int tmp = ans[v];
		if(!ans[x] && a[v] > a[x]) ans[v] = 1;
//		printf("%d: %d\n", v, ans[v]);
		Upd(v);
		ans[v] = tmp;
	}
}

int main() {
//	freopen("C.in", "r", stdin);
//	freopen("C.out", "w", stdout);
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for(int i = 1; i < n; i++) {
		scanf("%d%d", &x, &y);
		g[x].push_back(y);
		g[y].push_back(x);
	}
	Dfs(1, 0);
	Upd(1);
	for(int i = 1; i <= n; i++)
		if(prt[i]) printf("%d ", i);
	return 0;
}

Measured memory_bytes: 31232
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

class Combination {
    vector<ll> factorial;
    vector<ll> fact_inverse;
    vector<ll> inverse;
    int mod;

    void init(int size) {
        factorial[0] = 1;
        factorial[1] = 1;
        fact_inverse[0] = 1;
        fact_inverse[1] = 1;
        inverse[1] = 1;

        for (int i = 2; i < size; i++) {
            factorial[i] = factorial[i - 1] * i % mod;
            inverse[i] = mod - inverse[mod % i] * (mod / i) % mod;
            fact_inverse[i] = fact_inverse[i - 1] * inverse[i] % mod;
        }
    }

    public:
        Combination(int size, int m) {
           factorial = vector<ll>(size);
           fact_inverse = vector<ll>(size);
           inverse = vector<ll>(size);
           mod = m;
           init(size);
        }
    
        ll calc(int n, int k) {
            if (n < k) {
                return 0;
            }
            if (n < 0 || k < 0) {
                return 0;
            }
            return factorial[n] * (fact_inverse[k] * fact_inverse[n - k] % mod) % mod;
        }

        // i.e. nHk
        ll with_repetition(int n, int k) {
            return calc(n + k - 1, k);
        }
};

vector<vector<ll>> pascals_triangle(int n) {
    vector<vector<ll>> combi(n + 1, vector<ll>(n + 1));
    REP(i, n + 1) REP(j, i + 1) {
        if (j == 0 || j == i) combi[i][j] = 1LL;
        else combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
    }
    return combi;
}

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << endl;
}


Measured memory_bytes: 256
#include <map>
#include <vector>
#include <iostream>
#include <cstring>
using namespace std;
int m[29][29];
main(){
	string s,t;
	int h,w,i,j,x,y,X,Y;
	for(;cin>>h>>w,h;cout<<s<<endl){
		vector<string>v;
		for(i=0;i<h;i++)cin>>s,v.push_back(s);
		s="0";
		map<string,int>M;
		for(i=0;i<h;i++)for(j=0;j<w;j++)for(x=-1;x<=1;x++)for(y=-1;y<=1;y++)if(x||y){
			memset(m,0,sizeof(m));
			Y=i,X=j;
			t=v[Y][X],m[Y][X]=1;X=(X+x+w)%w,Y=(Y+y+h)%h;
			for(;!m[Y][X];X=(X+x+w)%w,Y=(Y+y+h)%h){
				t+=v[Y][X],m[Y][X]=1;
				if(++M[t]>1 && (s.size()<t.size()||(s.size()==t.size()&&s>t)))s=t;
			}
		}
	}
}

Measured memory_bytes: 36032
import collections

N = int(input())
words = []
top = int()
for i in range(N):
    words.append(input())
c = collections.Counter(words)

c_sorted = sorted(c.items(), reverse=True, key=lambda x : x[1])

top = int(c_sorted[0][1])
answer = []
count = int(0)
length = len(c_sorted)
unko = str()

if length == 1:
    unko = "unko"
else:
    for i in range(N):
        if int(c_sorted[i][1]) == top:
            answer.append(c_sorted[i][0])
            count = count + 1
        else:
            break

answer.sort()

if unko == "unko":
    print(c_sorted[0][0])
else:
    for i in range(count):
        print(answer[i])

Measured memory_bytes: 47636
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;
struct edge
{
  int to, cost;
};
typedef std::vector<std::vector<int>> graph;

// 0: black, 1:white
ll dp[100000][2] = {};

void rec(int i, int par, const graph &g)
{
  if (g[i].size() == 1 && par == g[i][0])
  {
    dp[i][0] = 1;
    dp[i][1] = 1;
    return;
  }

  ll black = 1, white = 1;
  for (auto v : g[i])
  {
    if (v == par)
      continue;
    rec(v, i, g);
    black = (black * dp[v][1]) % MOD;
    white = (white * ((dp[v][0] + dp[v][1]) % MOD)) % MOD;
  }
  dp[i][0] = black;
  dp[i][1] = white;
}

int main()
{
  int n;
  cin >> n;
  graph g(n);
  REP(i, n - 1)
  {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }

  rec(0, -1, g);

  if (n == 1)
    cout << 2 << endl;
  else
    cout << (dp[0][0] + dp[0][1]) % MOD << endl;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<vector<int>> Graph;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

int main() {
    string S; cin >> S;
    int ans = 0;
    while(S != "") {
        S = S.substr(0, S.size() - 2);
        string left = S.substr(0, S.size() / 2 - 1);
        string right = S.substr(S.size() / 2, S.size() / 2 - 1);
        if(left == right) {
            ans = S.size();
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
a = int(input())
x = list(map(int,input().split()))
l = [0]*a
l[0] = x[0]
for i,n in enumerate(x[1:]):
    l[i+1]=l[i]+n
s = sum(l)
m = 100000000000
for i in range(a):
    m = min(m,abs(l[-1]-l[i]-l[i]))
print(m)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=(k);i<(int)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using ll = int64_t;

int main() {
  int n;
  cin>>n;
  vector<int> b(n);
  REP(i,n) cin>>b[i];
  vector<pair<int,int>> p;
  REP(i,n) {
    p.emplace_back(b[i], i);
  }
  sort(ALL(p), greater<pair<int,int>>());
  vector<int> ans(n, -1);
  bool ok = true;
  REP(i,n) {
    int v, pos;
    tie(v, pos) = p[i];
    int after = pos+1 - v;
    if (after < 0) {
      ok = false;
      break;
    }
    for (int j = n-1, k = 0; j >= 0; --j) {
      if (ans[j] >= v + (after - k)) continue;
      if (k == after) {
        ans[j] = v;
        break;
      }
      ++k;
    }
  }
  REP(i,n) {
    if (ans[i] == -1) ok = false;
    if (ans[i] > i+1) ok = false;
  }
  if (ok) {
    for (int v : ans) {
      cout << v << endl;
    }
  } else {
    cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// Gracias, Rodolfo
// Gracias, Roman
// Gracias, Maxi
// Gracias, MarcosK
// Obrigado, Dilson
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for (int i = a; i < b; i++)
#define roF(i,a,b) for (int i = a; i >= b; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

const int N = 1e6;
const ll INF = 1e18;
const ld EPS = 10e-9;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll random(ll a, ll b) { return uniform_int_distribution<ll> (a, b) (rng); }

void solve() {
    long long n, x, y;
    cin >> n >> x >> y;
    long long cnt[n];
    for (int i = 0; i < n; i++) cnt[i] = 0;
    long long mini[n + 1][n + 1];
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) mini[i][j] = 0;
    for (int i = 1; i < n; i++) {
        for (int j = i + 1; j <= n; j++) {
            int d1 = j - i;
            int d2 = abs(x - i) + 1 + abs(y - j);
            mini[i][j] = min(d1, d2);
        }
    }
    for (int i = 1; i < n; i++) for (int j = i + 1; j <= n; j++) cnt[mini[i][j]]++;
    for (int i = 1; i < n; i++) cout << cnt[i] << endl;	
}

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

Measured memory_bytes: 31616
#coding: UTF-8
import sys
N,M=map(int,input().split())
Alist=[input() for i in range(0,N)]
Blist=[input() for i in range(0,M)]

def is_match(A,B,M):
    for i in range(0,M):
        if A[i]!=B[i]:
            return False
    return True

def make_A(A,i,j,M):
    C=[0]*M
    for k in range(0,M):
        C[k]=A[k+i][j:j+M]
    return C

for i in range(0,N-M+1):
    for j in range(0,N-M+1):
        C=make_A(Alist,i,j,M)
        if is_match(C,Blist,M):
            print("Yes")
            sys.exit()
print("No")

Measured memory_bytes: 3064
long n,m,r,l=-1,c,s,i,N,a[1<<17];
main(){
	for(scanf("%d",&n);~scanf("%d",&m);r=r<m?m:r)a[i++]=m;
	for(;r-l>1;c>n*(n+1)/4?r=m:(l=m)){
		int b[2<<17]={};
		m=l+r>>1;
		b[s=n]=1;
		for(N=c=i=0;i<n;b[s]++)c+=N+=a[i++]>m?-b[++s]:b[s--];
	}
	printf("%d",r);
}

Measured memory_bytes: 1920
import java.util.*;

class Main{
  public static void main(String args[]){
	Scanner sc= new Scanner(System.in);
	int n = sc.nextInt();
	int[] h = new int[n+2];
	int answer = 0;
	for(int i = 1; i <= n; i++){
	  h[i] = sc.nextInt();
	}
	int flag = 0;
	int flag2 = 0;
	int count = 0;
	int hoge = 0;
	int i = 1;
	while(flag == 0){
	  while(h[i]!=0 && i <= n){
	  	hoge = h[i];
		h[i]--;
		i++;
		flag2++;
	  }
	  if(i == n+1 && flag2 == 0){
		 flag++;
	  }else if(i == n+1){
	  	flag2 = 0;
		i = 1;
		if(hoge != 0){
			answer++;
		}
		hoge = 0;
	  }else if(hoge != 0){
	  	answer++;
		i++;
		hoge = 0;
	  }else{
	  	i++;
		hoge = 0;
	  }
	}
	System.out.print(answer);
  }
}


Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;

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

    double L;
    cin >> L;
    std::cout << std::fixed;
    cout << L/3*L/3*L/3 << endl;

    return 0;
}

Measured memory_bytes: 256
from subprocess import*
with open('Main.java','w')as f:f.write(r"""
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = Integer.parseInt(sc.next());
		int diff = 0;
		long c = 0;
		for (int i = 0; i < n; i++) {
			diff += a[i];
			if (i % 2 == 0) {
				if (diff <= 0) {
					c += -diff + 1;
					diff = 1;
				}
			}
			else {
				if (diff >= 0) {
					c += diff + 1;
					diff = -1;
				}
			}
		}
		long ans = c;
		c = 0;
		diff = 0;
		for (int i = 0; i < n; i++) {
			diff += a[i];
			if (i % 2 != 0) {
				if (diff <= 0) {
					c += -diff + 1;
					diff = 1;
				}
			}
			else {
				if (diff >= 0) {
					c += diff + 1;
					diff = -1;
				}
			}
		}
		ans = Math.min(ans, c);
		System.out.println(ans);
	}
}
""")
call(('javac','Main.java'))
call(('java','Main'))

Measured memory_bytes: 77768
A,B,C,D = list(input())
A = int(A)
B = int(B)
C = int(C)
D = int(D)
ans = 0
B_l,C_l,D_l = "","",""
for i in range(2):
    for j in range(2):
        for k in range(2):
            ans=A
            if i == 0:
                ans +=B
                B_l="+"
            else:
                ans -=B
                B_l="-"
            if j == 0:
                ans +=C
                C_l="+"
            else:
                ans-=C
                C_l="-"
            if k == 0:
                ans +=D
                D_l="+"
            else:
                ans-=D
                D_l="-"
            if ans == 7:
                print(str(A)+B_l+str(B)+C_l+str(C)+D_l+str(D)+"=7")
                exit()

Measured memory_bytes: 3064
import sys

# 再帰の深さの上限変更
sys.setrecursionlimit(10**4)

def DFS(v,visit):
  visit[v] = True
  for u in adj[v]:
    if visit[u] == False:
      DFS(u,visit)

while(1):
  W, H = map(int, input().split())
  if (W,H) == (0,0):# 入力終了
    sys.exit()
  
  C = []
  for _ in range(H):
    tmp = list(map(int, input().split()))
    C.append(tmp)

  # 縦横斜め8方向が島か探索し、隣接リストを作成する
  dx = [1,-1,0,0,1,-1,-1,1]
  dy = [0,0,1,-1,1,1,-1,-1]
  
  # 隣接リスト
  adj = [[] for i in range(H*W)]
  
  for i in range(H):
    for j in range(W):
      if C[i][j] == 1:# 陸である
        # 周りが陸か探索する
        tmp = []
        for k in range(8):
          x,y = j+dx[k], i+dy[k]
          if 0 <= y < H and 0 <= x < W:
            if C[y][x] == 1:
              tmp.append(W*y + x)
        adj[W*i+j] = tmp
  # print(adj)
        
  # 深さ優先探索を行う
  # 訪問チェック
  visit = [False for i in range(H*W)]
  
  ans = 0
  for i in range(H):
    for j in range(W):
      if C[i][j] == 1 and visit[W*i+j] == False:
        DFS(W*i+j,visit)
        ans += 1
  print(ans)


Measured memory_bytes: 8840
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;

/** Problem0160 : Delivery Fee **/
int main()
{
	int size[6] = {60, 80, 100, 120, 140, 160};
	int weight[6] = {2, 5, 10, 15, 20, 25};
	int fee[6] = {600, 800, 1000, 1200, 1400, 1600};
	
	int n;
	
	while (cin>>n, n!=0) {
		int a, b, c, d, sum=0;
		rep(k, n) {
			cin >> a >> b >> c >> d;
			rep(i, 6) {
				if (d <= weight[i] && a+b+c <= size[i]) {
					sum+=fee[i];
					break;
				}
			}
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N, M;
  cin >> N >> M;
  ll big = (N + 1) / 2;
  ll small = 1;
  if (N % 2 == 0) {
    big -= 1;
  }
  vector<pll> ans;
  while (small < big) {
    ans.push_back({small, big});
    small += 1;
    big -= 1;
  }
  small = (N + 1) / 2 + 1;
  big = N;
  while (small < big) {
    ans.push_back({small, big});
    small += 1;
    big -= 1;
  }
  for (ll i = 0; i < M; ++i) {
    cout << ans.at(i).first << ' ' << ans.at(i).second << endl;
  }
}


Measured memory_bytes: 5368
fn main() {
    let input: Vec<i32> = read_vec();
    let (n, d) = (input[0], input[1]);

    for i in 1..21 {
        if n - i - d * i * 2 <= 0 {
            println!("{}", i);
            break;
        }
    }
}


//**********************************************************************************************************************************************//

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: u64) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 10進数での各桁の和
pub fn sum_dights(x: isize) -> isize {
    if x % 10 == 0 {
        return 0
    }
    let m = x % 10;
    m + sum_dights((x - m) / 10)
}


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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

//ウニの場合はK*(K-1)*(K-2)*...*(K-(N-1))
//直線ならK*(K-1)*(K-2)*(K-2)*...*(K-2)=K*(K-1)*(K-2)^(N-2)
//K*(K-1)*(K-2)*(K-2)*...*(K-2)+K*(K-2)*(K-2)*(K-2)*...*(K-2)

int N, K;
vector<int> G[100100];
const int mod = 1000000007;

int rec(int v, int p) {
    int res = 1;
    int M = K - 2;
    if (v == 0)M = K - 1;
    int tmp1 = 1;
    int size = G[v].size() - 1;
    if (v == 0)size += 1;
    rep(i, size) {
        tmp1 *= M;
        tmp1 %= mod;
        --M;
    }
    if (v != 0 && G[v].size() == 1) {
        //子がいない
        return 1;
    }
    for (int to:G[v]) {
        if (to == p)continue;
        res *= rec(to, v);
        res %= mod;
    }
    res *= tmp1;
    res %= mod;
    return res;
}

signed main() {
    cin >> N >> K;
    rep(i, N - 1) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int ans = rec(0, -1);
    ans *= K;
    ans += mod;
    ans %= mod;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11520
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  string s;
  cin >> s;
  rep(i, s.size()){
    s[i]='x';
  }
  cout << s << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const double DINF = 5e14, eps = 1e-10;
const long long MOD = 1e9 + 7, INF = 5e18;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

ll n, m, ans = 1, nm;

int main() {
	cin >> n >> m;
	nm = m;
	for (ll i = 1;i*i <= m;i++) {
		if (m%i == 0 && m / i >= n) {
			ans = max(ans, i);
			if (m % (m / i) == 0 && m / (m / i) >= n)ans = max(ans, m / i);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string bans(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  int n;cin>>n;
  int d,x;cin>>d>>x;
  int tot=x;
  rep(i,n){
    int a;cin>>a;
    tot+=(d-1)/a+1;
  }
  cout << tot << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MOD 1000000007

int main()
{
	char llst[100010]={0};
	int pow3[100010]={1};
	int dp[100010]={0};
	int i,j,n=0;
	scanf("%s",llst);
	
	while(llst[n]!=0)n++;
	
	for(i=1;i<n;i++)//3^i%MODを求めておく
	{
		pow3[i]=((pow3[i-1]*2%MOD)+pow3[i-1])%MOD;
	}
	if(llst[n-1]=='1')dp[0]=3;
	else if(llst[n-1]=='0')dp[0]=1;
	for(i=1;i<n;i++)
	{
		if(llst[n-1-i]=='1')dp[i]=((2*dp[i-1])%MOD+pow3[i])%MOD;
		else if(llst[n-1-i]=='0')dp[i]=dp[i-1];
	}
	
	printf("%d",dp[n-1]);
	return 0;
}


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

int main(){
	int n;
	cin >> n;
	int b[n-1];
	for(int i=0;i<n-1;i++){
		cin >> b[i];
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(i==0){ans+=b[i];}
		else if(i==n-1){ans+=b[i-1];}
		else{ans+=min(b[i],b[i-1]);}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
XL = [list(map(int, input().split())) for _ in range(N)]

XL.sort(key=lambda x: sum(x))
f = -99999999999
ans = 0
for x, l in XL:
    if x - l >= f:
        ans += 1
        f = x + l

print(ans)

Measured memory_bytes: 32296