akhauriyash/Code-Regression huggingface dataset:
# coding:utf-8

import sys
from collections import Counter


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N = int(input())

P = []
for i in range(N):
    P.append(int(input()))

P.sort()
P[-1] //= 2

print(sum(P))


Measured memory_bytes: 3444
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

#define FOR(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)

using namespace std;

int main() {
    long long n, t;
    cin >> n >> t;
    long long now = 0;
    long long total = 0;
    FOR(i, 0, n) {
        int tmp;
        cin >> tmp;
        if (i == 0)
            continue;
        if (now + t < tmp) {
            total += t;
        }
        else
            total += tmp - now;
        now = tmp;
    }
    cout << total+t << endl;
    return 0;
}

Measured memory_bytes: 256
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let v: Vec<i32> = s
        .trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect();
    let n = v[0];
    let m = v[1];

    let mut a: Vec<Vec<char>> = Vec::new();
    for _i in 0..n {
        s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        a.push(s.trim().chars().collect::<Vec<char>>());
    }
    let mut b: Vec<Vec<char>> = Vec::new();
    for _i in 0..m {
        s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        b.push(s.trim().chars().collect::<Vec<char>>());
    }

    let mut c = false;
    'outer: for y in 0..n - m + 1 {
        for x in 0..n - m + 1 {
            c = diff(&a, &b, x, y, m);
            if c {
                break 'outer;
            }
        }
    }

    if c {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn diff(a: &Vec<Vec<char>>, b: &Vec<Vec<char>>, x: i32, y: i32, m: i32) -> bool {
    for j in 0..m {
        for i in 0..m {
            if a[(x + i) as usize][(y + j) as usize] != b[i as usize][j as usize] {
                return false;
            }
        }
    }
    true
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int M, K;
  cin >> M >> K;

  int p = 1;
  rep(i,M) p *= 2;
  if(p <= K){
    cout << -1 << endl;
    return 0;
  }
  if(M==0){
    if(K == 0){
      cout << "0 0" << endl;
      return 0;
    }else{
      cout << -1 << endl;
      return 0;
    } 
  }
  if(M==1){
    if(K == 0){
      cout << "0 0 1 1" << endl;
      return 0;
    }else{
      cout << -1 << endl;
      return 0;
    } 
  }

  vector<int> v;
  rep(i,p){
    if(i == K) continue;
    v.push_back(i);
  }

  rep(i,v.size()){
    if(i>0) cout << " ";
    cout << v[v.size()-1-i];
  }
  cout << " " << K;
  rep(i,v.size()){
    cout << " " << v[i];
  }
  cout << " " << K << endl;
  
  return 0;
}


Measured memory_bytes: 2424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int check(int x){
	for(int i = 2;i <= sqrt(x);i++){
		if(x % i == 0) return 0;
	}
	return 1;
}
int main(){
	int x;
	scanf("%d",&x);
	for(int i = 0;;i++){
		if(check(x+i)){
			printf("%d\n",x+i);
			break;
		}
	}
	return 0;
} 

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

#define sz(a) ((int)a.size())
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i : (a))
#define all(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vl> vvvl;
typedef double T;
typedef vector<T> vt;
typedef vector<vt> vvt;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpi;
typedef tuple<ll, int, int> tlii;

const int MOD = 1e9+7; // 998244353;
const int INF = 1e9+1;

int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  int n, w;
  cin >> n >> w;
  vector<int> weights(n);
  vector<int> values(n);
  for (int i = 0; i < n; ++i) {
    cin >>weights[i] >> values[i];
  }

  //knapsack, state is n by w, calculate each row.
  vector<vector<int64_t>> dp(n, vector<int64_t>(w, 0));
  
  // base case, n = 0 -> 0
  //            w = 0 -> 0
  for (int i = 0; i < n; ++i) {
    for (int j = weights[i] - 1; j < w; ++j ) {
      dp[i][j] = values[i];
    }
  }

  for (int i = 1; i < n; ++i) {
    for (int j = 1; j < w; ++j) {
      // either take the item or dont
      // i need to know whether this weight is valid;
      if (weights[i] > j) {
        // take nothing
        dp[i][j] = dp[i - 1][j];
      } else {
        dp [i][j] = max(dp[i - 1][j],
                        dp[i - 1][j - weights[i]] + values[i]);
      }
    }
  }
  cout << *max_element(dp.back().begin(), dp.back().end()) << endl;
}


Measured memory_bytes: 79488
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;

constexpr static ll MOD = 1000000007ll;
constexpr static int INF = 1 << 28; // for x <= 10^9
constexpr static ll INFL = 1ll << 60; // for x <= 10^19

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        if (h >= k) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES


int func(int b[], int n)
{
	int s = 0;
	for(int i=0;i<n-1;i++)
	{
		s = s+abs(b[i]-b[i+1]);
	}
	return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 //   freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	long long int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];

	}
	sort(a,a+n);
	long long int sum = 0;
	if(n%2!=0)
	{	
		long long int temp =0;

		for(int i=0;i<(n/2);i++)
			temp-=(2LL*a[i]);
		
		temp+=a[n/2];
		temp+=a[(n/2) + 1];
		
		for(int i = (n/2) + 2 ; i<n; i++)
			temp+=(2LL*a[i]);
		sum = max(sum,temp);


		temp = 0;
		for(int i=0; i<(n/2) - 1; i++)
			temp-=(2LL*a[i]);

		temp-=a[(n/2) -1];
		temp-=a[n/2];		

		for(int i=n/2 + 1; i<n; i++)
			temp+=(2LL*a[i]);
		sum = max(sum,temp);
	}
	else
	{
		for(int i=0;i<n/2;i++)
			sum+=(-2LL*a[i]);
		for(int i=n/2;i<n;i++)
			sum+=(2LL*a[i]);
		sum+=a[(n/2) -1];
		sum-=a[n/2]	;
	}
	cout<<sum;
	return 0 ;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>
#include <array>

using namespace std;

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

int main()
{
    int N, M;
    cin >> N >> M;

    cout << N*(N-1)/2 + M*(M-1)/2 << endl;

    return 0;
}


Measured memory_bytes: 888
package main

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

func solution(a, b []int, xs [][]int) int {
	ans := 1 << 31
	for _, x := range xs {
		cur := a[x[0]-1] + b[x[1]-1] - x[2]
		ans = min(ans, cur)
	}
	sort.Ints(a)
	sort.Ints(b)
	cur := a[0] + b[0]
	ans = min(ans, cur)
	return ans
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	var a, b, m int
	fmt.Scan(&a, &b, &m)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	as := make([]int, a)
	for i := 0; i < a; i++ {
		sc.Scan()
		n, _ := strconv.Atoi(sc.Text())
		as[i] = n
	}

	bs := make([]int, b)
	for i := 0; i < b; i++ {
		sc.Scan()
		n, _ := strconv.Atoi(sc.Text())
		bs[i] = n
	}

	xs := make([][]int, m)
	for i := range xs {
		xs[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			sc.Scan()
			n, _ := strconv.Atoi(sc.Text())
			xs[i][j] = n
		}
	}

	fmt.Println(solution(as, bs, xs))
}


Measured memory_bytes: 8704
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;
constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
#ifndef LOCAL
struct osd{template<class T>osd&operator<(const T&t){return*this;}template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;template<class...T>void _print(osd&a,T&&...t){}
#define cerr cer_
#endif
template<class T>ostream&operator<(ostream&o,const T&t){return o<<t;}template<class T>istream&operator>(istream&i,T&t){return i>>t;}
void _print(ostream&s){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<t<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}template<class...T>void dprint(T&&...t){_print(cerr,t...);}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<p.F<' '<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>p.F>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<i<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>queue<T>&operator<<(queue<T>&q,const T&t){q.push(t);return q;}template<class T>queue<T>&operator<<(T&t,queue<T>&q){t=q.front();q.pop();return q;}
template<class T>deque<T>&operator>>(const T&t,deque<T>&q){q.push_front(t);return q;}template<class T>deque<T>&operator<<(T&t,deque<T>&q){t=q.front();q.pop_front();return q;}
template<class T>deque<T>&operator<<(deque<T>&q,const T&t){q.push_back(t);return q;}template<class T>deque<T>&operator>>(deque<T>&q,T&t){t=q.back(t);q.pop_back();return q;}
template<class T>stack<T>&operator<<(stack<T>&s,const T&t){s.push(t);return s;}template<class T>stack<T>&operator>>(stack<T>&s,T&t){t=s.top();s.pop();return s;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    int n;
    cin>n;
    int cnt=0;
    REP(i,n){
        int a;
        cin>a;
        while(a%2==0){
            a/=2;
            cnt++;
        }
    }
    cout<cnt<endl;
    return 0;
}


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

using namespace std;

#define DPRINTF(...) printf(__VA_ARGS__)
#define FOR0(i, n) for(int i=0;i<n;i++)
#define ALL(c) (begin(c)), (end(c))
#define fst(t) get<0>(t)
#define snd(t) get<1>(t)
#define thd(t) get<2>(t)

typedef std::tuple<int,int> P;
typedef long long ll;

set<P> s;
// int a[1000000], b[1000000];
P ps[1000000];
ll cnts[10];

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

  int H, W, N;
  cin >> H >> W >> N;
  
  FOR0(i, N){
      int a, b;
      cin >> a >> b;

      ps[i] = make_tuple(a, b);
      
      s.insert(make_tuple(a, b));

      FOR0(j, 3){
          FOR0(k, 3){
              if(j == 0 && k == 0){continue;}

              int na = a - j, nb = b - k;
              int offset = j * 3 + k;
              
              ps[i + N * offset] = make_tuple(na, nb);
          }
      }
  }

  std::sort(ps, ps+9*N);
  
  int _n = std::unique(ps, ps+9*N) - ps;
  int __n = 0;
  
  FOR0(i, _n){
      int x, y;
      tie(x, y) = ps[i];
      
      if(x <= 0 || y <= 0 || x + 2 > H || y + 2 > W){
          continue;
      }
      
      ++__n;
      
      int cnt = 0;
      for(int j=0;j<3;j++){
          for(int k=0;k<3;k++){
              int nx = x + j,
                  ny = y + k;
              if(s.find(make_tuple(nx, ny)) != s.end()){++cnt;}
          }          
      }

      // cout << "!" << x << "," << y << "," << cnt << endl;    
      ++cnts[cnt];
  }

  // cout << __n << endl;  

  cnts[0] = 1ll * (W-2) * (H-2) - __n;
  
  FOR0(i, 10){
      cout << cnts[i] << endl;
  }
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  long long k;cin >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
    a[i]--;
  }
  int state=0;
  while(k){
    if(k&1) state=a[state];
    vector<int> b(n);
    for(int i=0;i<n;i++) b[i]=a[a[i]];
    swap(a,b);
    k>>=1;
  }
  cout << state+1 << endl;
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;

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

map<long long, long long> prime_factor(long long n) {
	map<long long, long long> ret;
	for(long long i = 2; i * i <= n; i++) {
		while(n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if(n != 1) ret[n] = 1;
	return ret;
}

vector<long long> toDivisor(ll num)
{
	vector<long long> d;
	for (ll i = 1; i*i <= num; ++i)
	{
		if (i*i == num)
		{
			d.push_back(i);
		}
		else if (num % i == 0)
		{
			d.push_back(i);
			d.push_back(num/i);
		}
	}
	return d;
}

vector<pair<long long , long long>> toDivisorP(ll num)
{
	vector<pair<long long, long long>> d;
	for (ll i = 1; i * i <= num; ++i)
	{
		if (i*i == num) d.push_back(pair<ll, ll>(i, i));
		else if (num % i == 0)
		{
			d.push_back(pair<ll, ll>(i, num/i));
		}
	}
	return d;
}


struct Comb
{
	const long long mod;
	vector<long long> fac, ifac;

	Comb(long long n, long long m) : mod(m)
	{
		fac.resize(n+1);
		ifac.resize(n+1);

		fac[0] = 1;
		ifac[0] = 1;
		for (long long i = 0; i < n; ++i)
		{
			(fac[i+1] = fac[i]*(i+1)) %= mod;
			(ifac[i+1] = ifac[i]*mpow(i+1, mod-2)) %= mod;
		}
		
	}

	long long mpow(long long x, long long n)
	{ 
		long long ans = 1;
		while(n != 0){
			if(n&1) ans = ans*x % mod;
			x = x*x % mod;
			n = n >> 1;
		}
		return ans;
	}

	long long comb(long long a, long long b)
	{ 
		if(a == 0 && b == 0)return 1;
		if(a < b || a < 0)return 0;
		long long tmp = ifac[a-b]* ifac[b] % mod;
		return tmp * fac[a] % mod;
	}
};

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll N, M; cin >> N >> M;
	auto comb = Comb(100000+100, MOD);
	DEBUG("pa");
	
	auto m = prime_factor(M);
	ll res{1};
	for (auto [a, b] : m)
	{
		(res *= comb.comb(b+N-1, b)) %= MOD;
		DEBUG(a);
		DEBUG(b);
	}

	std::cout << res << std::endl;

	return 0;
}


Measured memory_bytes: 4796
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;

const int N=1e5+5;
vll v[N];
ll comp[N];
ll ans[N];
ll cnt[N];
ll vis[N];
ll nc=0;
map<ll,set<ll>> m;

void dfs(ll x)
{
    vis[x]=1;
    comp[x]=nc;
    cnt[nc]++;
    for(auto it:v[x])
    {
        if(!vis[it])
        {
            dfs(it);
        }
    }
}

void solve()
{
    ll n,m,k;
    cin>>n>>m>>k;
    ll i,j;
    for(i=0;i<n;i++)
    {
        ans[i]=n-1;
        // cout<<ans[i]<<"\n";
    }
    for(i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        x--,y--;
        v[x].pb(y);
        v[y].pb(x);
    }
    for(i=0;i<n;i++)
    {
        ans[i]-=((ll)v[i].size());
    }
   
    
    for(i=0;i<n;i++)
    {
        if(!vis[i])
        {
            dfs(i);
            nc++;
        }
    }
    for(i=0;i<n;i++)
    {
        ans[i]-=(n-cnt[comp[i]]);
    }
     for(i=0;i<k;i++)
    {
        ll x,y;
        cin>>x>>y;
        x--,y--;
        // ans[x]--;
        // ans[y]--;
        if(comp[x]==comp[y])
        {
            ans[x]--;
            ans[y]--;
        }
        
    }
    for(i=0;i<n;i++)
    {
        cout<<ans[i]<<" ";
    }

}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 12712
#include <iostream>

using namespace std;


int main()
{
  int a,b;
  cin >> a >> b;
  int ans=0;
  for(int i=0; i<2; ++i)
  {
    if (a>b) {
      ans+=a;
      a--;
    } else
    {
      ans+=b;
      b--;
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int building1[3][10] = { 0 }, building2[3][10] = { 0 }, building3[3][10] = { 0 }, building4[3][10] = { 0 };
	int n,b,f,r,v,i,j;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d %d %d %d", &b, &f, &r, &v);
		if (b == 1)
		{
			building1[f - 1][r - 1] += v;
		}
		if (b == 2)
		{
			building2[f - 1][r - 1] += v;
		}
		if (b == 3)
		{
			building3[f - 1][r - 1] += v;
		}
		if (b == 4)
		{
			building4[f - 1][r - 1] += v;
		}
	}
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			printf(" %d", building1[i][j]);
		}
		printf("\n");
	}
	printf("####################\n");
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			printf(" %d", building2[i][j]);
		}
		printf("\n");
	}
	printf("####################\n");
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			printf(" %d", building3[i][j]);
		}
		printf("\n");
	}
	printf("####################\n");
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 10; j++)
		{
			printf(" %d", building4[i][j]);
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2040
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	a, err := strconv.Atoi(sc.Text())
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func scanFloat() float64 {
	sc.Scan()
	a, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		fmt.Println(err)
	}
	return a
}

func main() {
	sc.Split(bufio.ScanWords)

	N := scanInt()
	t, x, y := make([]int, N+1), make([]float64, N+1), make([]float64, N+1)
	for i := 0; i < N; i++ {
		t[i+1], x[i+1], y[i+1] = scanInt(), scanFloat(), scanFloat()
	}

	for i := 0; i < N; i++ {
		dt := t[i+1] - t[i]
		dist := math.Abs(x[i+1]-x[i]) + math.Abs(y[i+1]-y[i])
		if dt < int(dist) || dt%2 != int(dist)%2 {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 5204
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,(n))
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int f(ll n) {
	int res = 0;
	while (n > 0) {
		res++;
		n /= 10;
	}
	return res;
}

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

	int ans = INF;
	FOR(i, 1, sqrt(N)+1) {
		if (N%i == 0) {
			ans = min(ans, f(N / i));
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
s='0'
s+=input()
n=len(s)
inf=float('inf')
dp=[[inf]*2 for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  for j in range(2):
    si=int(s[-i-1])
    si+=j
    for a in range(10):
      ni=i+1
      nj=0
      b=a-si
      if b<0:
        nj=1
        b+=10
      dp[ni][nj]=min(dp[ni][nj],dp[i][j]+a+b)
print(dp[n][0])

Measured memory_bytes: 236020
import java.util.*;

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

    while (true) {
      int m = sc.nextInt();
      int Nmin = sc.nextInt();
      int Nmax = sc.nextInt();
      int a[] = new int[m+1];
      int gap = 0;
      int gap_n = 0;
      if (m == 0 && Nmin == 0 && Nmax == 0) return;

      for (int i = 1; i <= m; i++) {
        a[i] = sc.nextInt();
      }
      for (int i = Nmin; i <= Nmax; i++) {
        int g = a[i]-a[i+1];
        if (gap <= g) {
          gap = g;
          gap_n = i;
        }
      }
      System.out.println(gap_n);
    }
  }
}



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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var AB = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var A = AB[0];
            var B = AB[1];
            var H = 0;
            var W = 100;

            StringBuilder s = new StringBuilder();

            bool temp = true;
            
            A--;

            while (B >= 2 || temp)
            {
                temp = false;

                for (int i = 0; i < 100; i++)
                {
                    s.Append(".");
                }
                s.Append("\n"); H++;

                for (int i = 0; i < 50; i++)
                {
                    if (B >= 2)
                    {
                        s.Append("#.");
                        B--;
                    }
                    else
                    {
                        s.Append("..");
                    }
                }
                s.Append("\n"); H++;
            }

            for (int i = 0; i < 100; i++)
            {
                s.Append(".");
            }
            s.Append("\n"); H++;

            temp = true;

            while (A >= 1 || temp)
            {
                temp = false;

                B--;

                for (int i = 0; i < 100; i++)
                {
                    s.Append("#");
                }
                s.Append("\n"); H++;

                for (int i = 0; i < 50; i++)
                {
                    if (A >= 1)
                    {
                        s.Append(".#");
                        A--;
                    }
                    else
                    {
                        s.Append("##");
                    }
                }
                s.Append("\n"); H++;
            }

            Console.Write(H + " " + W + "\n");
            Console.Write(s.ToString());
        }
    }
}


Measured memory_bytes: 13364
a, b, c = map(int, input().split())
cnt = 0
total = a + b + c
while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
    if a == (total - a) // 2:
        cnt = -1
        break
    a = (total - a) // 2
    b = (total - b) // 2
    c = (total - c) // 2
    cnt += 1
print(cnt)

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

double EPS;

int main(){
  
  while(cin>>EPS,EPS){

    for(int i=1;i<(1e7);i++){

      int x=1.0*M_PI*i;

      if(x-1>0&&abs(M_PI-(1.0*x-1)/i)<=EPS){
	cout<<x-1<<"/"<<i<<endl;
	break;
      }
      if(x>0&&abs(M_PI-1.0*x/i)<=EPS){
	cout<<x<<"/"<<i<<endl;
	break;
      }
      if(x+1>0&&abs(M_PI-(1.0*x+1)/i)<=EPS){
	cout<<x+1<<"/"<<i<<endl;
	break;
      }
    }
    
  }
  
}

Measured memory_bytes: 3048
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  vector<vector<int>> v(3, vector<int>(3, 0));
  vector<vector<bool>> bingo(3, vector<bool>(3, false));
  rep(i, 3) rep(j, 3){
    cin >> v[i][j];
  }
  int n;
  cin >> n;
  vector<int> b(n);

  rep(i, n){
    cin >> b[i];
    rep(j, 3) rep(k, 3){
      if(v[j][k] == b[i]) bingo[j][k] = true;
    }
  }

  rep(i, 3){
    bool flag = false;
    rep(j, 3){
      if(!bingo[i][j]) flag = true;
    }
    if(!flag){
      cout << "Yes" << endl;
      return 0;
    }
  }

  rep(i, 3){
    bool flag = false;
    rep(j, 3){
      if(!bingo[j][i]) flag = true;
    }
    if(!flag){
      cout << "Yes" << endl;
      return 0;
    }
  }

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

  cout << "No" << endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>

int a,b,c;
std::vector<int> cut;
int sum[1010][1010],x[1010][1010];
int area(int x1, int y1, int x2, int y2)
{
	return sum[x2][y2] - sum[x1-1][y2] - sum[x2][y1-1] + sum[x1-1][y1-1];
}
int ans = 12345678;
int check[1010];
void func(int k)
{
	if(k>=a)
	{
		cut.push_back(k);
		int count = cut.size()-2;
		for(int i=1;i<cut.size();i++) check[i] = 0;
		for(int j=1;j<=b;j++)
		{
			for(int i=1;i<cut.size();i++) check[i] += area(cut[i-1]+1,j,cut[i],j);
			for(int i=1;i<cut.size();i++)
			{
				if(check[i]>c)
				{
					count++;
					for(int k=1;k<cut.size();k++)
					{
						check[k] = area(cut[k-1]+1,j,cut[k],j);
						if(check[k]>c)
						{
							cut.pop_back();
							return;
						}
					}
				}
			}
		}
		ans = ans<count?ans:count;
		cut.pop_back();
	}
	else
	{
		func(k+1);
		cut.push_back(k);
		func(k+1);
		cut.pop_back();
	}
}
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	for(int i=1;i<=a;i++) for(int j=1;j<=b;j++) scanf("%1d",&x[i][j]);
	for(int i=1;i<=a;i++) for(int j=1;j<=b;j++) sum[i][j] = sum[i][j-1] + x[i][j];
	for(int j=1;j<=b;j++) for(int i=1;i<=a;i++) sum[i][j] += sum[i-1][j];
	cut.push_back(0);
	func(1);
	printf("%d",ans);
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
const int sz=1e5+9;
int a[sz];
int n;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    for(int i=n-1;i-1>=0;i--){
        if(a[i]>=a[i-1]) continue;
        if(a[i-1]-a[i]>1){
            printf("No");
            return 0;
        }else a[i-1]--;
    }
    printf("Yes");
    return 0;
}


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

int main() {
  int A,B,C,D;
  cin >> A>>B>>C>>D;

  if ((A+B)>(C+D)) {
    cout << "Left" << endl;
  }
  else if((A+B)==(C+D)){
    cout << "Balanced"<< endl;
  }
  else{
    cout << "Right"<< endl; 
  }
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
 
 
typedef struct  {
    int first;
    int second;
    int third;
    int forth;
    int fifth;
    int sixth;
} Dice;
 
int main() {
    Dice one;
    int q, i;
 
    scanf("%d ", &one.first);
    scanf("%d ", &one.second);
    scanf("%d ", &one.third);
    scanf("%d ", &one.forth);
    scanf("%d ", &one.fifth);
    scanf("%d", &one.sixth);
 
    scanf("%d\n", &q);
 
    for(i = 0; i < q; ++i) {
        int a[2];
        scanf("%d %d", &a[0], &a[1]);
         
        if(a[0] == one.first){
            if(a[1] == one.second) printf("%d\n", one.third);
            if(a[1] == one.third) printf("%d\n", one.fifth);
            if(a[1] == one.forth) printf("%d\n", one.second);
            if(a[1] == one.fifth) printf("%d\n", one.forth);
        }
        if(a[0] == one.second){
            if(a[1] == one.first) printf("%d\n", one.forth);
            if(a[1] == one.third) printf("%d\n", one.first);
            if(a[1] == one.forth) printf("%d\n", one.sixth);
            if(a[1] == one.sixth) printf("%d\n", one.third);
        }
        if(a[0] == one.third){
            if(a[1] == one.second) printf("%d\n", one.sixth);
            if(a[1] == one.first) printf("%d\n", one.second);
            if(a[1] == one.sixth) printf("%d\n", one.fifth);
            if(a[1] == one.fifth) printf("%d\n", one.first);
        }
        if(a[0] == one.forth){
            if(a[1] == one.second) printf("%d\n", one.first);
            if(a[1] == one.sixth) printf("%d\n", one.second);
            if(a[1] == one.first) printf("%d\n", one.fifth);
            if(a[1] == one.fifth) printf("%d\n", one.sixth);
        }
        if(a[0] == one.fifth){
            if(a[1] == one.first) printf("%d\n", one.third);
            if(a[1] == one.third) printf("%d\n", one.sixth);
            if(a[1] == one.forth) printf("%d\n", one.first);
            if(a[1] == one.sixth) printf("%d\n", one.forth);
        }
         if(a[0] == one.sixth){
            if(a[1] == one.second) printf("%d\n", one.forth);
            if(a[1] == one.third) printf("%d\n", one.second);
            if(a[1] == one.forth) printf("%d\n", one.fifth);
            if(a[1] == one.fifth) printf("%d\n", one.third);
        }
    }
    return 0;
}



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

#define ll long long int
#define str string

ll MOD = 1000000007, INFL = 1ll << 60, INF = 1 << 30, mod = 1e9 + 7, Max = INF, Min = -1;
ll a = 0, b = 0, c = 0, n = 0, m=0,kiroku=0,sum = 0,MASK=0;
ll A[50000][3] = {}, B[500000] = {}, dp[200000][3],rui[500000] = {},dp2[1<<12] = {};
int dy[] = { 0, 0, 1, -1 }, dx[] = { 1, -1, 0, 0 };
vector <ll> v;
str S, T;
bool check = true, check2 = false;


int main() {
	//Code Line
cin >> a >> b;
if(a > 9 || b > 9)cout << -1 << endl;
else cout << a * b << endl;
	return 0;
}



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

template<class Ty>
using passive_queue = priority_queue<Ty, vector<Ty>, greater<Ty>>;

struct Problem {

	void Solve() {
		string S; cin >> S;
		if (S[2] == S[3]) if (S[4] == S[5]) {
			cout << "Yes" << endl; return;
		}
		cout << "No" << endl; return;
	}

	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


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

int main(){

    vector<int>data{1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int a;
    cin >> a;
    cout << data[a-1];

    return 0;
}


Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define FI first
#define SE second
#define PB push_back
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define co(i) cout<<(i)<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
#define all(i) i.begin(),i.end()
#define pint pair<int, int>
#define vint vector<int>
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;
//const int MOD=998244353;

ll gcd(ll a,ll b){
	a=abs(a),b=abs(b);
	if(b==0) return a;
	else if(a<b) return gcd(b,a);
	else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
	return a*b/gcd(a,b);
}

int main(){
	ll n,m;
	string s,t;
	cin>>n>>m>>s>>t;
	ll g=gcd(n,m),l=lcm(n,m);
	bool f=true;
	FOR(i,0,g){
		if(s[i*(n/g)]!=t[i*(m/g)]) f=false;
	}
	if(f) co(l);
	else co(-1);
}


Measured memory_bytes: 512
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>

using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define inf 1000000007
#define mod 1000000007
#define ull unsigned long long
#define ll long long
template <class T,class U>inline void Max(T &a,U b){if(a<b)a=b;}
template <class T,class U>inline void Min(T &a,U b){if(a>b)a=b;}

int a[10005];
int b[10005];
int N;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	cin >> N;
	rep(i,0,N) cin >> a[i];
	rep(i,0,N) cin >> b[i];
	ll pos = 0, neg = 0;
	rep(i,0,N) {
		int x = b[i] - a[i];
		x>0?(pos += x/2):(neg -= x);
	}	
	if(pos >= neg) {cout << "Yes" << endl;}
	else {cout << "No" << endl;}
}




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

int main() {
    int N, P;
    cin >> N >> P;

    int a, ne = 0, no = 0;
    rep(i, N) {
        cin >> a;
        if (a%2==0) ne++;
        else no++;
    }

    ll ans;
    if (no == 0) {
        if (P==1) ans = 0;
        else {
            ans = 1;
            rep(i, ne) ans *= 2;
        }
    } else {
        ans = 1;
        rep(i, N-1) ans *= 2;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<numeric>
#include<iostream>
#include<array>
#include<string>
#include<sstream>
#include<stack>
#include<queue>
#include<list>
#include<functional>
#define _USE_MATH_DEFINES

#include<math.h>
#include<map>

#define SENTINEL 1000000001

#define min(a,b) ((a)>(b)?(b):(a))
#define max(a,b) ((a)>(b)?(a):(b))

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

int a[1001][1001];

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

	for (int i = 0; i < N; i++)
	{
		int x1, y1, x2, y2;
		scanf("%d %d %d %d", &x1, &y1, &x2, &y2);

		a[x1][y1]++;
		a[x1][y2]--;
		a[x2][y1]--;
		a[x2][y2]++;
	}

	for (int i = 0; i < 1001; i++)for (int j = 1; j < 1001; j++)
	{
		a[i][j] += a[i][j - 1];
	}
	for (int i = 1; i < 1001; i++)for (int j = 0; j < 1001; j++)
	{
		a[i][j] += a[i - 1][j];
	}

	int maxi = 0;
	for (int i = 0; i < 1001; i++)for (int j = 0; j < 1001; j++)
	{
		maxi = max(maxi, a[i][j]);
	}
	printf("%d\n", maxi);
	return 0;
}


Measured memory_bytes: 7088
n = int(input())
H = list(map(int, input().split()))
dp = [0]*n
dp[0] = 1

if n == 1:
    print(0)
else:
    for i in range(1, n-1):
        if H[i] >= H[i+1]:
            dp[i] += dp[i-1]+1
        else:
            dp[i] = 0
    print(max(dp[1:]))
         


Measured memory_bytes: 20428
package main

import "fmt"

func main() {
	var o, e string
	fmt.Scan(&o, &e)
	length := len(o) + len(e)
	for i := 0; i < length; i++ {
		idx := i / 2
		if i % 2 != 0 {
			fmt.Print(string(e[idx]))
		} else {
			fmt.Print(string(o[idx]))
		}
	}
	fmt.Println()
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

string s , t;
int ans;

int main()
{
    _FastIO;
    cin >> s;
    cin >> t;
    for(int i = 0; i < 3; i++){
        if(s[i] == t[i])
            ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

long long pow(long long x, int n) { 
    long long ans = 1;
    while (n > 0) {
    if ((n & 1) == 1) {
        ans = ans * x;
    }
        x = x * x; 
        n >>= 1; 
    }
    return ans;
}

int main(){
    int N, P;
    cin >> N >> P;
    
    int A[N];
    for (int i=0; i<N; ++i)  cin >> A[i];
    
    int n = 0;
    
    for (int i=0; i < N; ++i) {
        if (A[i] % 2 == 1)  ++n;
    }
    
    long long res;
    
    if (P == 0) {
        if (n== 0) res = pow(2, N);
        else res = pow(2, N-1);
    }
    else {
        if (n== 0) res = 0;
        else res = pow(2, N-1);
    }
    
    cout << res  << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {

	void solve() {
		
		out.println(inint()==inint() ? "Yes" : "No");
		
	}

	public static Scanner in = new Scanner(System.in);
	public static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		new Main().solve();
		out.flush();
	}

	public int inint() {
		return in.nextInt();
	}

	public long inlong() {
		return in.nextLong();
	}

	public double indouble() {
		return in.nextDouble();
	}

	public String instr() {
		return in.next();
	}

	public char inchar() {
		return in.next().charAt(0);
	}

	public int[] inintar(int num) {
		int[] a = new int[num];
		for (int i=0; i<num; i++) {
			a[i] = in.nextInt();
		}
		return a;
	}

	public char[] incharar() {
		return in.next().toCharArray();
	}

	public char[][] incharmap(int h, int w) {
		char[][] a = new char[h][w];
		for (int i=0; i<h; i++) {
			String temp = in.next();
			for (int j=0; j<w; j++) {
				a[i][j] = temp.charAt(j);
			}
		}
		return a;
	}

}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;

const int INF = 1e9;
int h, w;
v2<bool> g;
v2<int> dp;

void solve(){
    cin >> h >> w;
    g = v2<bool>(h, vector<bool>(w));
    dp = v2<int>(h, vector<int>(w));
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            char c; cin >> c;
            g[i][j] = c=='#';
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(!i && !j){
                dp[i][j] = g[i][j];
            }
            else if(g[i][j] && ((i && g[i-1][j]) || (j && g[i][j-1]))){
               dp[i][j] = min((i && g[i-1][j]) ? dp[i-1][j] : INF, (j && g[i][j-1]) ? dp[i][j-1] : INF);
            }
            else{
                dp[i][j] = g[i][j] + min(i ? dp[i-1][j] : INF, j ? dp[i][j-1] : INF);
            }
        }
    }
    cout << dp[h-1][w-1] << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 256
l = input().split()
if abs(int(l[2]) - int(l[0])) <= int(l[3]):
    print("Yes")
elif abs(int(l[0]) - int(l[1])) <= int(l[3]) and abs(int(l[1]) - int(l[2])) <= int(l[3]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    ll x;
    cin >> x;
    ll a = 100;
    for (int i = 1; ; ++i) {
        a += a/100;
        if(a >= x){
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)

int M, N, P[10010], S[10010], C[555], E[555];
int dp[10010];

int main() {
	scanf("%d %d", &M, &N);
	for_(i,0,M) scanf("%d", &P[i]);
	for_(i,0,N) scanf("%d %d", &C[i], &E[i]);
	
	sort(P, P+M, greater< int >());
	
	memset(S, 0, sizeof(S));
	for_(i,0,M) S[i + 1] = S[i] + P[i];
	
	fill(dp, dp + M + 1, 1e9);
	dp[0] = 0;
	
	for_(i,0,N) for_rev(j,M+C[i],C[i]) {
		int nx = min(j, M);
		dp[nx] = min(dp[nx], dp[j - C[i]] + E[i]);
	}
	
	int ans = 0;
	for_(i,0,M+1) ans = max(ans, S[i] - dp[i]);
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1348
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>
#include <queue>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
#define debug(x) cout << #x << ": " << x << endl

int H, W;
int table[3010][3010];

void bfs(int y, int x)
{
    queue<pair<int, int>> que;
    que.push(make_pair(y, x));
    table[y][x] = 1;
    while(que.size())
    {
        pair<int, int> p = que.front(); que.pop();
        for(int i = 0; i < 4; i++)
        {
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if(ny < 0 or nx < 0 or ny >= H or nx >= W) continue;
            if(table[ny][nx]) continue;
            table[ny][nx] = 1;
            que.push(make_pair(ny, nx));
        }
    }
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> W >> H, H or W)
    {
        int n; cin >> n;
        vector<int> x1, y1, x2, y2;
        vector<int> x, y;
        for(int i = 0; i < n; i++)
        {
            int a, b, c, d; cin >> a >> b >> c >> d;
            c--, d--;
            x1.push_back(a); y1.push_back(b);
            x2.push_back(c); y2.push_back(d);
            for(int t = -1; t <= 1; t++)
            {
                int na = a + t;
                int nb = b + t;
                int nc = c + t;
                int nd = d + t;
                if(0 <= na and na < W) x.push_back(na);
                if(0 <= nb and nb < H) y.push_back(nb);
                if(0 <= nc and nc < W) x.push_back(nc);
                if(0 <= nd and nd < H) y.push_back(nd);
            }
        }

        sort(x.begin(), x.end());
        sort(y.begin(), y.end());
        x.erase(unique(x.begin(), x.end()), x.end());
        y.erase(unique(y.begin(), y.end()), y.end());

        H = y.size();
        W = x.size();

        memset(table, 0, sizeof(table));
        for(int k = 0; k < n; k++)
        {
            int a = lower_bound(x.begin(), x.end(), x1[k]) - x.begin();
            int b = lower_bound(y.begin(), y.end(), y1[k]) - y.begin();
            int c = lower_bound(x.begin(), x.end(), x2[k]) - x.begin();
            int d = lower_bound(y.begin(), y.end(), y2[k]) - y.begin();

            for(int i = b; i <= d; i++)
            {
                for(int j = a; j <= c; j++) table[i][j] = 1;
            }
        }

        int ans = 0;
        for(int i = 0; i < H; i++)
        {
            for(int j = 0; j < W; j++)
            {
                if(table[i][j]) continue;
                bfs(i, j);
                ans++;
            }
        }
        cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 38476
/*Program from Luvwgyx*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
const int maxn=2e3+10;
int n,k,tot,ans,a[maxn],f[maxn];
int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
void print(int x){
    if(x<0)putchar('-'),x=-x;
    if(x>9)print(x/10);
    putchar(x%10+'0');
}
void write(int x){print(x);puts("");}
int power(int a,int b){
    int ret=1;
    for(;b;b>>=1,a=1ll*a*a%mod)
        if(b&1)ret=1ll*ret*a%mod;
    return ret;
}
int main(){
    n=read();k=read();int num=sqrt(n);
    for(int i=1;i*i<n;i++)
        if(!(n%i))a[++tot]=i,a[++tot]=n/i;
    if(num*num==n)a[++tot]=num;sort(a+1,a+tot+1);
    for(int i=1;i<=tot;i++){
        f[i]=power(k,(a[i]+1)>>1);
        for(int j=1;j<i;j++)if(!(a[i]%a[j]))f[i]=(f[i]-f[j]+mod)%mod;
        if(a[i]&1)ans=(ans+1ll*a[i]*f[i])%mod;
        else ans=(ans+a[i]*1ll*power(2,mod-2)%mod*f[i])%mod;
    }write(ans);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
using ll = int64_t;
constexpr ll mod = ll(1e9 + 7);
#define endl '\n'
 
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
 
  int TT = 1;
  // cin >> TT;
  while (TT--) {
    ll X;
    cin >> X;
    cout << (10 - ((X)/200)) << endl;
  }
}


Measured memory_bytes: 3648