akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int comp(const void* a, const void* b)
{ return *(int*)a > *(int*)b ; }

// Function to count all possible triangles with arr[]
// elements
int findNumberOfTriangles(int arr[], int n)
{
	// Sort the array elements in non-decreasing order
	qsort(arr, n, sizeof( arr[0] ), comp);

	// Initialize count of triangles
	int count = 0;

	for (int i = 0; i < n - 2; ++i)
	{

		int k = i + 2;
		for (int j = i + 1; j < n; ++j)
		{

			while (k < n && arr[i] + arr[j] > arr[k])
			++k;


			if(k > j)
			count += k - j - 1;
		}
	}

	return count;
}

// Driver code
int main()
{
	int a;
	cin>>a;

	int arr[a];
	for(int i=0;i<a;i++){
        cin>>arr[i];
	}
	int size = sizeof( arr ) / sizeof( arr[0] );
	cout<<findNumberOfTriangles(arr,size);
	return 0;
}




Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AGC 030：A - Poisonous Cookies


def main():
    a, b, c = [int(n) for n in raw_input().strip().split(' ')]

    if a + b + 1 >= c:
        print b + c
    else:
        print a + b + 1 + b


if __name__ == '__main__':
    main()


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

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

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

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

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

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

int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  string z;
  cin >> z;
  R(i,SZ(z)-1){
    if(z[i] == 'A' && z[i+1] == 'C'){
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n;
    cin >> n;
    vvi edges(n);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }
    int k;
    cin >> k;
    vi maxi(n, 10000000), mini(n, 0);
    int root = -1;
    for (int i = 0; i < k; ++i) {
        int v, p;
        cin >> v >> p;
        v--;
        maxi[v] = p;
        mini[v] = p;
        if (root == -1)
            root = v;
    }
    vi odds(n, 0);
    odds[root]                   = maxi[root] % 2 == 1 ? 1 : -1;
    function<void(int, int)> dfs = [&](int c, int p) {
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            odds[v] = -odds[c];
            dfs(v, c);
            chmin(maxi[c], maxi[v] + 1);
            chmax(mini[c], mini[v] - 1);
        }
        if (odds[c] == 1 && maxi[c] % 2 == 0)
            maxi[c]--;
        else if (odds[c] == -1 && maxi[c] % 2 == 1)
            maxi[c]--;
        if (odds[c] == 1 && mini[c] % 2 == 0)
            mini[c]++;
        else if (odds[c] == -1 && mini[c] % 2 == 1)
            mini[c]++;
    };
    dfs(root, -1);
    function<void(int, int)> dfs2 = [&](int c, int p) {
        if (p != -1) {
            chmin(maxi[c], maxi[p] + 1);
            chmax(mini[c], mini[p] - 1);
            if (odds[c] == 1 && maxi[c] % 2 == 0)
                maxi[c]--;
            else if (odds[c] == -1 && maxi[c] % 2 == 1)
                maxi[c]--;
            if (odds[c] == 1 && mini[c] % 2 == 0)
                mini[c]++;
            else if (odds[c] == -1 && mini[c] % 2 == 1)
                mini[c]++;
        }
        for (auto &v : edges[c]) {
            if (v == p)
                continue;
            dfs2(v, c);
        }
    };
    dfs2(root, -1);
    vl ret(n);
    for (int i = 0; i < n; ++i) {
        if (maxi[i] >= mini[i])
            ret[i] = maxi[i];
        else {
            cout << "No"
                 << "\n";
            return 0;
        }
    }
    cout << "Yes"
         << "\n";
    for (int i = 0; i < n; ++i) {
        cout << ret[i] << "\n";
    }

    return 0;
}

Measured memory_bytes: 16128
from collections import deque

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

if n%2==0:
  while(A):
    B.append(A.popleft())
    B.appendleft(A.popleft())
else:
  while(A):
    B.appendleft(A.popleft())
    if(A):
      B.append(A.popleft())

for i in range(n):
  print(B[i], end=" ")

Measured memory_bytes: 25540
a, b, c, d = map(int, input().split())

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    g = gcd(a, b)
    g_a = a // g
    g_b = b // g
    return g_a * g_b * g

up = b - (b // c + b // d - b // lcm(c, d))
down = (a-1) - ((a-1) // c + (a-1) // d - (a-1) // lcm(c, d))
print(up - down)

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

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a*b)/gcd(a,b)
#define ff              first
#define ss              second
#define int             long long
#define pb              emplace_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             INT_MAX
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(x)			x.begin(),x.end()
#define digits(x)		floor(log10(x))+1
#define FIO				ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

class dsu {
private:
	int *id;
	int* sz;

	int root(int i) {
		while (i != id[i]) {
			id[i] = id[id[i]];
			i = id[i];
		}
		return i;
	}
public:
	int n;
	dsu(int v) {
		n = v;
		id = new int[n];
		sz = new int[n];

		for (int i = 0; i < n; i++) {
			id[i] = i;
			sz[i] = 0;
		}
	}

	bool find(int p , int q) {
		return root(p) == root(q);
	}

	void join(int p , int q) {
		int i = root(p);
		int j = root(q);
		if (i == j) {
			return;
		}
		if (sz[i] < sz[j]) {
			id[i] = j ;
			sz[j] += sz[i];
		}
		else {
			id[j] = i;
			sz[i] += sz[j];
		}
	}
};

int nCr(int n , int r ) {
	int p = 1, k = 1;

	if (n - r < r ) {
		r = n - r;
	}
	if (r != 0) {
		while (r != 0) {
			p *= n ;
			k *= r ;
			int m = __gcd(p, k);
			p /= m;
			k /= m;
			n--;
			r--;
		}
	}
	else {
		p = 1;
	}
	return p ;
}

int modPower(int x, int y , int p) {
	//Used to calculate (x^y)%p
	int res = 1;
	if (y == 0) {
		return 1;
	}

	x = x % p;
	if (x == 0) {
		return 0  ;
	}

	while (y > 0) {
		if (y & 1) {
			res = (res * x) % p;
		}

		y >>= 1;
		x = (x * x) % p;
	}
	return res ;

}

bool notallDivide(vi a, int n) {
	bool ans = false;
	for (int i = 0 ; i < n ; i++) {
		if (a[i] % 2 == 0) {
			ans = true;
			break;
		}
	}
	return ans;
}

int32_t main() {
	FIO;

	int n ;
	cin >> n ;
	vi a(n);
	int count = 0 ;
	for (int i = 0 ; i < n ; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			int val = a[i];
			while (a[i] % 2 == 0) {
				count++;
				a[i] /= 2;
			}
		}
	}
	cout << count;











	return 0;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;
const ll MOD = 1000000007;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


ll mpow(ll x, ll n){//繰り返し二乗法 計算量O(logN)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans * x % MOD;
        x = x * x % MOD;
        n  = n >> 1;
    }
    return ans;
}

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


int main(){
    int N;
    cin >> N;
    if(N < 4){
        cout << 0 << endl;
        return 0;
    }
    string S;
    cin >> S;
    vector<int> r(N), g(N), b(N);
    r[0] = 0;
    g[0] = 0;
    b[0] = 0;
    rep(i, N){
        if(S[i] == 'R')r[0]++;
        else if(S[i] == 'G')g[0]++;
        else if(S[i] == 'B')b[0]++;
    }
    if(S[0] == 'R')r[0]--;
    if(S[0] == 'G')g[0]--;
    if(S[0] == 'B')b[0]--;

    for(int i = 1; i < N; i++){
        if(S[i] == 'R'){
            r[i] = r[i - 1] - 1;
            g[i] = g[i - 1];
            b[i] = b[i - 1];
        }else if(S[i] == 'G'){
            r[i] = r[i - 1];
            g[i] = g[i - 1] - 1;
            b[i] = b[i - 1];
        }
        else if(S[i] == 'B'){
            r[i] = r[i - 1];
            g[i] = g[i - 1];
            b[i] = b[i - 1] - 1;
        }
    }
    ll ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            if(S[i] != S[j]){
                if((S[i] == 'R' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'R')){
                    // cout << "j: " << j << " b[j]: " << b[j];
                    ans += b[j];
                    if(2 * j  - i < N){
                        if(S[2 * j - i] == 'B') ans--;
                    }
                    // cout << " ans: " << ans << endl;
                }
                if((S[i] == 'R' && S[j] == 'B') || (S[i] == 'B' && S[j] == 'R')){
                    // cout << "j: " << j << " g[j]: " << g[j];
                    ans += g[j];
                    if(2 * j  - i < N){
                        if(S[2 * j - i] == 'G') ans--;
                    }
                    // cout << " ans: " << ans << endl;
                }
                if((S[i] == 'B' && S[j] == 'G') || (S[i] == 'G' && S[j] == 'B')){
                    // cout << "j: " << j << " r[j]: " << r[j];
                    ans += r[j];
                    if(2 * j  - i < N){
                        if(S[2 * j - i] == 'R') ans--;
                    }
                    // cout << " ans: " << ans << endl;
                }
            }
        }
    }

    cout << ans << endl;
}

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



int main(){

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

  int c=0,m=0;
 for(int i=0;i<n-1;i++){

    if(a[i] >= a[i+1]){
        c++;
        continue; }

    m = max(m,c);
    c = 0;
 }

 m = max(m,c);
 cout<<m<<endl;

return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    map<int,int> cnt;

    int N; cin>>N;
    REP(i,N){
        int a; cin>>a;
        cnt[a]++;
        cnt[a-1]++;
        cnt[a+1]++;
    }
    int ans=0;
    for(auto p:cnt){
        ans=max(ans,p.second);
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define re return
#define all(a) a.begin(),a.end()
#define int long long
using namespace std;
const int dx[4]={-1,1,0,0};
const int dy[4]={0,0,-1,1};
signed main()
{
	int d;
	cin>>d;
	if (d%2==0 || d%5==0){
		cout<<"-1";
		re 0;
	}
	int q=0;
	for (int i=1;;i++){
		q=(q*10+7)%d;
		if (q==0){
			cout<<i;
			re 0;
		}
	}
	re 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h> 
#define MX 32
using namespace std; 
typedef long long int ll ;
typedef pair <ll , ll> P;
bool comp(P p,P q) { 
return p.second*q.first<q.second*p.first ; }
ll dp[MX];
int main() {
int n,T; 
scanf("%d %d",&n,&T); 
vector <int> all ; 
vector <P> vx; 
for(int i=0;i<n; i++) {
int a,b; 
scanf("%d %d",&a,&b); 
b++;
b+=a;
if (a==0) all.push_back(b);
else { 
vx.push_back(P(a,b)); } 
 }
 sort(vx.begin() ,vx.end() ,comp); 
for(int i=0;i<MX; i++) dp[i]=T+1;
dp[0]=0; 
for(int i=0;i<vx.size(); i++) { 
P p=vx[ i ];
 for(int j=MX-2;j>=0;j--) { 
 if (dp[ j]>T) continue; 
dp[j+1]=min(dp[ j+1],(p.first+1)*dp[ j]+p.second);
}
} 
sort(all.begin() ,all.end());
int ret=0; 
for(int i=0;i<MX; i++) {
  if (dp[ i]>T) continue; 
 ll zan=T-dp[ i ];
 int pos=0; 
 while(pos<all.size()&&zan>=all[pos]) { 
 zan-=all[pos];
  pos++; 
 } 
 ret=max(ret ,pos+i); 
 } 
 printf("%d\n",ret); 
return 0; 
}


Measured memory_bytes: 7444
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        mut abcd: i64,
    }
    let mut atod = vec![0i64; 4];
    for i in 0..4 {
        atod[i] = abcd % 10;
        abcd /= 10;
    }
    atod.reverse();
    let mut acc: i64;
    for bit in 0..1 << 3 {
        acc = 0i64;
        acc += atod[0];
        for i in 0..3 {
            if bit & 1 << i != 0 {
                acc += atod[i + 1];
            } else {
                acc -= atod[i + 1];
            }
        }
        if acc == 7 {
            println!(
                "{}{}{}{}{}{}{}=7",
                atod[0],
                if bit & 1 << 0 != 0 { "+" } else { "-" },
                atod[1],
                if bit & 1 << 1 != 0 { "+" } else { "-" },
                atod[2],
                if bit & 1 << 2 != 0 { "+" } else { "-" },
                atod[3]
            );
            return;
        }
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;

int main() {
    ll n;
    cin >> n;
    ll x[61]={};
    rep(i,n){
        ll a;
        cin >> a;
        rep(j,61){
            if(a&bit(j))x[j]++;
        }
    }
    ll sum=0;
    rep(i,61){
        ll num=x[i]%mod*(n-x[i])%mod;
        ll bi=bit(i)%mod;
        num*=bi;
        num%=mod;
        sum+=num;
        sum%=mod;
    }
    cout << sum;

}

/*



 */


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    if a<=8 and b<=8:
        print('Yay!')
    else:
        print(':(')
if __name__ == '__main__':
    do()

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

using namespace std;

#define int long long
#define sz(a) (int) (a).size()

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    string s, t;
    cin >> s >> t;
    int n = sz(s), m = sz(t);
    vector<int> ss[2], tt[2];
    ss[0].resize(n);
    ss[1].resize(n);
    tt[0].resize(m);
    tt[1].resize(m);
    for (int i = 0; i < n; i++) {
        if (i != 0) {
            ss[0][i] = ss[0][i - 1];
            ss[1][i] = ss[1][i - 1];
        }
        ss[s[i] - 'A'][i]++;
    }
    for (int i = 0; i < m; i++) {
        if (i != 0) {
            tt[0][i] = tt[0][i - 1];
            tt[1][i] = tt[1][i - 1];
        }
        tt[t[i] - 'A'][i]++;
    }
    int q;
    cin >> q;
    while (q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        int sa = ss[0][b - 1] - (a - 2 >= 0 ? ss[0][a - 2] : 0);
        int sb = ss[1][b - 1] - (a - 2 >= 0 ? ss[1][a - 2] : 0);
        int ta = tt[0][d - 1] - (c - 2 >= 0 ? tt[0][c - 2] : 0);
        int tb = tt[1][d - 1] - (c - 2 >= 0 ? tt[1][c - 2] : 0);
        if (abs(sa + 2 * sb - (ta + 2 * tb)) % 3 == 0) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }

    return 0;
}

Measured memory_bytes: 4048
import java.util.Scanner;

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

		int intTurn = sc.nextInt();
		for(int i = 0; i < intTurn; i++) {
			String strTarouCard = sc.next();
			String strHanakoCard = sc.next();
			if(0 < strTarouCard.compareTo(strHanakoCard)) {
				intTarouPoint++;
				intTarouPoint++;
				intTarouPoint++;
			}
			else if(0 == strTarouCard.compareTo(strHanakoCard)) {
				intTarouPoint++;
				intHanakoPoint++;
			}
			else {
				intHanakoPoint++;
				intHanakoPoint++;
				intHanakoPoint++;
			}

		}
		System.out.printf("%d %d%n",intTarouPoint, intHanakoPoint);
	}
}

Measured memory_bytes: 30376
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
typedef long double ldouble;

using Graph = vector<vector<int>>;

int main(){
	int ans = 0;
	int H, W, K;
	cin >> H >> W >> K;
	vector<vector<char>> ref(H, vector<char>(W));
	vector<vector<char>> c(H, vector<char>(W));
	vector<vector<char>> C(H, vector<char>(W));
	for(int i=0; i<H; ++i) for(int j=0; j<W; ++j) cin >> ref[i][j];
	for(int bitH=0; bitH<(1<<H); ++bitH){
		c = ref;
		for(int i=0; i<H; ++i){
			if(bitH & (1<<i)){
				for(int j=0; j<W; ++j) c[i][j] = '.';
			}
		}
		for(int bitW=0; bitW<(1<<W); ++bitW){
			C = c;
			for(int i=0; i<W; ++i){
				if(bitW & (1<<i)){
					for(int j=0; j<H; ++j) C[j][i] = '.';
				}
			}
			int count = 0;
			for(int i=0; i<H; ++i){
				for(int j=0; j<W; ++j){
					if(C[i][j]=='#') ++count;
				}
			}
			if(count==K) ++ans;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3624
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;

namespace AOJ2
{
    class Program
    {

        static void Main(string[] args)
        {
            List<bool> resultList = new List<bool>();

            while (true)
            {
                int[] array = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
                if (array.Sum() == 0)
                {
                    break;
                }

                Array.Sort(array);

                decimal diagonal = (decimal)Math.Sqrt(array[0] * array[0] + array[1] * array[1]) / 2;

                decimal n = decimal.Parse(Console.ReadLine());
                for (int i = 0; i < n; i++)
                {
                    int r = int.Parse(Console.ReadLine());
                    if (diagonal < r)
                    {
                        resultList.Add(true);
                    }
                    else
                    {
                        resultList.Add(false);
                    }
                }

            }

            foreach (bool b in resultList)
            {
                if (b)
                    Console.WriteLine("OK");
                else
                    Console.WriteLine("NA");
            }

        }




    }
}

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

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

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

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)			 	 cerr<<#x<<": "<<x<<endl
#define trace2(x, y)		 	 cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)		 	 cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)	 	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)	 cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	ll h[n];
	rep(i,0,n) cin >> h[i];

	vector<ll> dp(n, inf);
	dp[0]=0;
	for(ll i=0; i<n; i++){
		for(ll j=i+1; j<=i+2; j++){
			if(j<n){
				dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
			}
		}
	}
	cout << dp[n-1];
	return 0;
}
/* The judge is never wrong! Your code is buggy
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;
const ll 	N 		= 	2*1e6;


// <------------- Declare Variables Here ------------> //

ll T=1;
ll n,x,y,m;
string s,t;
vll a;
// <------------- Implement Functions Here ----------> //

ll table[12][6];

// <------------- Start of main() -------------------> //

void MAIN() {
	table[0][0] = 4;
	vll cnt(11);
	for(ll i=1;i<5;i++) table[0][i] = (table[0][i-1]+9)%11;
	for(ll i=1;i<11;i++) {
		for(ll j=0;j<5;j++) {
			table[i][j] = (table[i-1][j] + 8)%11;
		}
	}

	for(ll i=0;i<11;i++) {
		for(ll j=0;j<5;j++) {
			cnt[table[i][j]]++;
		}
	}

	ll ans = 0;
	cin >> n >> m;
	n-=2;
	ans += n/11 * cnt[m];

	n%=11;

	for(ll i=0;i<n;i++) {
		for(ll j=0;j<5;j++) {
			ans += (table[i][j] == m);
		}
	}

	// for(ll i=0;i<11;i++) {
	// 	for(ll j=0;j<5;j++) {
	// 		cout<<table[i][j]<<" "; 
	// 	}
	// 	newl;
	// }

	cout<<ans;newl;
}

int main() {
	fastio;randomINT;
	//cin>>T;
	while(T--) {
		MAIN();
	}
	return 0;
}



Measured memory_bytes: 3652
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL-1
double EPS=1e-9;
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef complex<double> P;
typedef pair<int, ll> pill;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
long long int MOD = 998244353;
int N,M;
vector<pair<pii,ll> > datas;
bool check=true;

const int BT = 1 << 17 ;
int X,Y;
int main(){
    cin>>X>>Y;
    int ans=0;
    if(X==3)ans+=100000;
    if(X==2)ans+=200000;
    if(X==1)ans+=300000;
    if(Y==3)ans+=100000;
    if(Y==2)ans+=200000;
    if(Y==1)ans+=300000;
    if(X==1&&Y==1)ans+=400000;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
p=list(map(int,input().split()))


class Uf:
    def __init__(self, N):
        self.p = list(range(N))
        self.rank = [0] * N
        self.size = [1] * N

    def root(self, x): #連結している木の頂点
        if self.p[x] != x:
            self.p[x] = self.root(self.p[x])

        return self.p[x]

    def same(self, x, y): #根が同じか判定する
        return self.root(x) == self.root(y)

    def unite(self, x, y): #くっつける
        u = self.root(x)
        v = self.root(y)

        if u == v: return

        if self.rank[u] < self.rank[v]:
            self.p[u] = v
            self.size[v] += self.size[u]
            self.size[u] = 0
        else:
            self.p[v] = u
            self.size[u] += self.size[v]
            self.size[v] = 0

            if self.rank[u] == self.rank[v]:
                self.rank[u] += 1

    def count(self, x): #連結成分数
        return self.size[self.root(x)]

uf=Uf(n)
for i in range(m):
    x,y=map(int,input().split())
    uf.unite(x-1,y-1)

ans=0
for i in range(n):
    if uf.same(i,p[i]-1):
        ans+=1

print(ans)


Measured memory_bytes: 14008
import sys
from fractions import gcd
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
if max(A)<K:
    print('IMPOSSIBLE')
    sys.exit()
if max(A)==K:
    print('POSSIBLE')
    sys.exit()
if N==1:
    print('IMPOSSIBLE')
    sys.exit()
A=sorted(A,reverse=True)
B=A[1:]
b=B[0]
for i in range(1,len(B)):
    b=gcd(b,B[i])
if (max(A)-K)%b==0:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')




Measured memory_bytes: 88556
#include <stdio.h>
#include <stdlib.h>

int compare(int *a, int *b){
	return *a - *b;
}

int main(void){

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

	qsort(Height, 10, sizeof(int), (void *)compare);

	printf("%d\n%d\n%d\n",Height[9],Height[8],Height[7]);

	return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string grid[2][n];
    string grid2[2][n];
    for(int i=0;i<n;i++){
        string name,score;
        cin>>name>>score;
        grid[0][i]=name;
        grid[1][i]=score;
        grid2[0][i]=name;
        grid2[1][i]=score;
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n-i-1;j++){
            if(grid[0][j]>grid[0][j+1]){
                string temp=grid[0][j];
                string temp2 = grid[1][j];
                grid[0][j]=grid[0][j+1];
                grid[1][j]=grid[1][j+1];
                grid[0][j+1]=temp;
                grid[1][j+1]=temp2;
            }
        }
    }

    for(int i=0;i<n;i++){
        for(int j=0;j<n-1;j++){
            if(stoi(grid[1][j])<stoi(grid[1][j+1])&&grid[0][j]==grid[0][j+1]){
                string temp=grid[0][j];
                string temp2 = grid[1][j];
                grid[0][j]=grid[0][j+1];
                grid[1][j]=grid[1][j+1];
                grid[0][j+1]=temp;
                grid[1][j+1]=temp2;
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(grid[0][i]==grid2[0][j]&&grid[1][i]==grid2[1][j]){
                cout<<j+1<<endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << ele << endl
#define print10(ele) cout << fixed << setprecision(10) << ele << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> ok1(n + 1, false), ok2(n + 1, false);
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    if (a == 1) ok1[b] = true;
    if (b == n) ok2[a] = true;
  }

  bool ok = false;

  FOR(i, 1, n) {
    if (ok1[i] && ok2[i]) ok = true;
  }

  print((ok ? "POSSIBLE" : "IMPOSSIBLE"));
  return 0;
}

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

int main() {

	ll n; cin >> n;
	vector<ll> a(n + 1);
	for (ll i = 1; i <= n; i++) {
		cin >> a[i];
	}
	const ll mod = 1000000007;
	vector<ll> accum(n + 1, 0);
	for (ll i = n; i >= 1; i--) {
		if (i != n) {
			accum[i] += accum[i + 1];
		}
		accum[i] += a[i];
		accum[i] %= mod;
	}
	ll ans = 0;
	for (ll i = 1; i <= n - 1; i++) {
		ans += a[i] * accum[i + 1];
		ans %= mod;
	}
	//ans += a[n - 1] * a[n];
	//ans %= mod;
	cout << ans << endl;
    return 0;
}

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

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> A(N);
  rep(i, 0, N) cin >> A[i];
  int mi = 0;
  int dif = 0;
  rep(i, 1, N) {
    if(A[mi] > A[i]) mi = i;
    else dif = max(dif, A[i] - A[mi]);
  }
  map<int, int> ma;
  int ans = 0;
  rep(i, 0, N) {
    ma[A[i]]++;
    if(ma[A[i] - dif]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0,x;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        if(x&1&&i&1)
            c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include <limits>
#include <iomanip>
#include <map>

using namespace std;

int main(){
	string s;
	cin >> s;
	
	for(int i=0;i<s.size();i++){
		cout << 'x';
	}
	cout << endl;
	return 0;
}

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

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

	std::vector<int> v( N );
	for ( int i = 0; i < N; i++ )
	{
		std::cin >> v[i];
	}

	std::sort( v.begin(), v.end(), []( int a, int b ) {
			return( a > b );
		} );

	int total = 0;
	for ( int i = 1; i < N; i++ )
	{
		total += v[i];
	}

	if ( total > v[0] )
	{
		std::cout << "Yes" << std::endl;
	}
	else
	{
		std::cout << "No" << std::endl;
	}

	return ( 0 );
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n, m = map(int, input().replace("\n","").split())
h = list(map(int, input().replace("\n","").split()))

chklist= [1] * n

# road = []
for i in range(m):
    # road.append(list(map(int, input().replace("\n","").split())))
    a, b = map(int, input().replace("\n","").split())

    if h[a-1] < h[b-1]:
        chklist[a-1] = 0
        if chklist[b-1] != 0:
            chklist[b-1] = 1

    elif h[a-1] > h[b-1]:
        chklist[b-1] = 0
        if chklist[a-1] != 0:
            chklist[a-1] = 1

    elif h[a-1] == h[b-1]:
        chklist[a-1] = 0
        chklist[b-1] = 0

print(chklist.count(1))

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

int a[100005];

int main()
{
    int n;
    scanf("%d",&n);
    for (int i = 1; i <= n; i++) scanf("%d",&a[i]);
    int z[3] = {};
    for (int i = 1; i <= n; i++)
    {
        if (a[i] & 1) z[0]++;
        else if (a[i] % 4 == 0) z[2]++;
        else z[1]++;
    }

    if (z[0] > z[2] + 1 || (z[0] == z[2] + 1 && z[1])) printf("No\n");
    else printf("Yes\n");
}



Measured memory_bytes: 640
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005
#define x1 xdddddddddddddddddd
#define y1 ydddddddddddddddddd
#define eps 0.0000000000000000001

ll n,a[200005],s;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        a[i]-=i;
    }
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++){
        s+=abs(a[i]-a[(n+1)/2]);
    }
    cout << s;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

int main(void) {
    char X, Y;
    cin >> X >> Y;
    if(X < Y) {
        cout << "<" << endl;
    } else if(X == Y) {
        cout << "=" << endl;
    } else {
        cout << ">" << endl;
    }
    return 0;
}


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

public class Main {

	static int LG = 20;

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();
		int L = sc.nextInt();
		int[][] nxt = new int[n][LG], back = new int[n][LG];
		for (int i = 0, j = 0; i < n; i++) {
			while (j < n && a[j] - a[i] <= L)
				j++;
			nxt[i][0] = j - 1;
		}
		for (int i = n - 1, j = n - 1; i >= 0; i--) {
			while (j >= 0 && a[i] - a[j] <= L)
				j--;
			back[i][0] = j + 1;
		}
		for (int i = 0; i < n; i++) {
			for (int j = 1; j < LG; j++) {
				back[i][j] = back[back[i][j - 1]][j - 1];
			}
		}
		for (int i = n - 1; i >= 0; i--) {
			for (int j = 1; j < LG; j++) {
				nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
			}
		}
		int q = sc.nextInt();
		while (q-- > 0) {
			int from = sc.nextInt() - 1, to = sc.nextInt() - 1;
			int ans = 0;
			if (from > to) {
				for (int j = LG - 1; j >= 0; j--) {

					if (back[from][j] > to) {
						from = back[from][j];
						ans += 1 << j;
					}
				}
			} else {

				for (int j = LG - 1; j >= 0; j--) {
					if (nxt[from][j] < to) {
						from = nxt[from][j];
						ans += 1 << j;
					}
				}
			}
			out.println(ans + 1);
		}
		out.close();

	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

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

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}

}

Measured memory_bytes: 81200
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int a, b, c, d; cin >> a >> b >> c >> d;
  if(abs(a - c) <= d ) cout << "Yes" << endl;
   else  if(abs(a - b) <= d && abs(b - c) <= d) cout << "Yes" << endl;
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int k,a,b; cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0){cout<<"OK\n"; return 0;}
	}
	cout<<"NG\n";
}


Measured memory_bytes: 3604
let words str =
  let len = String.length str in
  let buf = Buffer.create 10 in
  let rec loop acc = function
      i when i = len -> acc, (Buffer.contents buf |> int_of_string)
    | i ->
      loop
        (match str.[i] with
         | ' ' ->
           let v = Buffer.contents buf |> int_of_string in
           Buffer.clear buf; v
         | c ->
           Buffer.add_char buf c; acc)
        (i+1)
  in loop 0 0

let bsearch predicate maxv =
  let rec loop minp maxp =
    if minp >= maxp then maxp else
    let middle = (maxp+minp)/2  in
      match predicate middle with
        true -> loop minp middle
      | false -> loop (middle+1) maxp
  in
  loop 1 maxv
    
let check num_of_truck goods capacity =
  let len = Array.length goods in
  let rec loop acc = function
      _, i when i >= len -> true
    | 0, _  -> false
    | rem_truck, i -> match goods.(i)+acc with
        x when x > capacity -> loop 0 (rem_truck-1,i)
      | x -> loop x (rem_truck,i+1)
  in
  loop 0 (num_of_truck,0)
    
let () =
  let n,num_of_truck = read_line () |> words in
  let goods = Array.init n (fun _ -> read_int ()) in
  (*let sum = Array.fold_left (fun acc v -> acc+v) 0 goods in*)
  bsearch (check num_of_truck goods) (100000 * 10000) |> Printf.printf "%d\n"

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

using namespace std;

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

#define int ll

const ll mod = 1e9 + 7;

main(){
	string s;
	cin >> s;
	if(s[0]=='7'||s[1]=='7'||s[2]=='7'){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3556
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime
from collections import deque


#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets

#公約数の列挙
def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	#x:縦，y:横
	return fact(x+y)/fact(x)/fact(y)

# 素因数分解
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
	
def count_str(m):
	tmp={}
	for i in range(10):
		if i in tmp:
			tmp[i]=1
		else:
			tmp[i]+=1
	return tmp

def is_prime(n):
	if n==1: return True

	for i in range(2,int(math.sqrt(n))+1):
		if n%i==0:
			return False
	return True

n=input1()

h=input_array()
h.reverse()
flag=True
p=h[0]
for i in range(1,n):
	if h[i-1]>=h[i]:
		continue
	elif h[i-1]<h[i]:
		h[i]-=1
		if h[i-1]<h[i]:
			flag=False
			break
if flag:
	print("Yes")
else:
	print("No")



















Measured memory_bytes: 23144
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    final int N=sc.nextInt();
    final int L=sc.nextInt();
    String[] s=new String[N];
    for(int i=0;i<N;i++){
      s[i]=sc.next();
    }
    Arrays.sort(s);
    for(int i=1;i<N;i++){
      s[0]+=s[i];
    }
    System.out.println(s[0]);
  }
}

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

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

const string YES = "Yes";
const string NO = "No";

void solve(long long K, long long X){
    if(500 * K >= X) cout << YES << endl;
    else cout << NO << endl;
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int main() {
	ll N, K;
	cin >> N >> K;
	ll cnt1 = N / K;
	ll cnt2 = K & 1 ? 0 : N * 2 / K - cnt1;
	
	ll ans = cnt1 * cnt1 * cnt1;
	ans += cnt2 * cnt2 * cnt2;
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define N 100001
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
 
typedef long long ll;

int main(){
    IOS;
    int n;
    cin>>n;
    if(n>=30){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3624
import itertools
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    i = 0
    l = range(1, n+1)
    for elem in itertools.combinations(l, 3):
        if sum(elem) == x:
            i += 1
    print(str(i))

Measured memory_bytes: 7688
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define Yes()           printf("Yes\n")
#define No()            printf("No\n")
#define YES()           printf("YES\n")
#define NO()            printf("NO\n")
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  int h, w, n; cin >> h >> w >> n;
  int ans = 0;
  if (h < w) swap(h, w);
  for (int i = 0; i < w && n > 0; i++) {
    ans++;
    n -= h;
  }
  for (int i = 0; i < h && n > 0; i++) {
    ans++;
    n -= w;
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888