akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

  long long ans = 1e13;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ans = min(ans, (i - 1) + (n / i - 1));
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,ans=0;
  cin>>a>>b;
  if(a==1 && b==1){
    cout<<"1000000"<<endl;
    return(0);
  }
  else if(a==1)
    ans+=300000;
  if(a==2)
    ans+=200000;
  if(a==3)
    ans+=100000;
  if(b==1)
    ans+=300000;
  if(b==2)
    ans+=200000;
  if(b==3)
    ans+=100000;
  cout<<ans<<endl;
  return(0);
}


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

int main() {
	int k, s;
	int count = 0;
	cin >> k >> s;
	for (int i = 0; i <= s / 3 && i <= k; i++) {
		for (int j = i; i + j <= s * 2 / 3 && j <= k; j++) {
			int t = s - i - j;
			if (t > k) continue;
			if (j > t) continue;
			if (i == j && j == t) count += 1;
			else if (i != j && j != t && t != i) count += 6;
			else count += 3;
		}
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 256
'use strict';
function main(input) {
  const B = input.split('\n')[1].split(' ');
  let sum = parseInt(B[0]) + parseInt(B[B.length-1]);
  for (let i = 0; i < B.length-1; ++i) {
    sum += Math.min(parseInt(B[i]), parseInt(B[i+1]));
  }
  console.log(sum);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>

using namespace std;
using ull = unsigned long long;

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

	// 色分けする(連続数で配列にする)	
	vector<int> vec;
	char now = '.';
	int cnt = 0;

	for (size_t i = 0; i < N; i++) {
		if (S[i] == now) {
			// 同じ文字が続けばカウントアップ
			cnt++;
		} else {
			// 違う文字がでたらカウントを格納して、違う文字をカウント1から数えなおす
			vec.push_back(cnt);
			if (now == '.') {
				now = '#';
			} else {
				now = '.';
			}
			cnt = 1;
		}
	}
	// 最後のcntが格納できないので後始末する
	if (cnt != 0) {
		vec.push_back(cnt);
	}
	// .の連続数, *の連続数, .の連続数, *の連続数となっている。最後を常に.の連続数にする
	// 最後に.が0個連続していることにするため0を入れる。
	if (vec.size() % 2 == 0) {
		vec.push_back(0);
	}
	const size_t vecN = vec.size();
/*
	for (size_t i = 0; i < vecN; i++) {
		cout << vec[i] << endl;
	}
*/
	// .だけのvector
	vector<ull> dotonlys;
	for (size_t i = 0; i < vecN; i += 2) {
		dotonlys.push_back(vec[i]);
	}
	// #だけのvector
	vector<ull> sharponlys;
	for (size_t i = 1; i < vecN - 1; i += 2) {
		sharponlys.push_back(vec[i]);
	}

	// 累積和を作る
	vector<ull> sumsdot(dotonlys.size() + 1);
	vector<ull> sumssharp(sharponlys.size() + 1);
	for (size_t i = 0; i < dotonlys.size(); i++) {
		sumsdot[i + 1] = sumsdot[i] + dotonlys[i];
	}
	for (size_t i = 0; i < sharponlys.size(); i++) {
		sumssharp[i + 1] = sumssharp[i] + sharponlys[i];
	}

	// 合計
	const ull dotsum = sumsdot.back();
	const ull sharpsum = sumssharp.back();

	// 適切な区切りを探す
	// 途中から黒になる場所
	ull sumline = 3 * 100000;
	for (size_t i = 1; i < sumssharp.size(); i++) {
		const ull tempdot = dotsum - sumsdot[i]; // 右側の.数
		const ull tempsharp = sumssharp[i - 1]; // 左側の#数
		sumline = min(tempdot+ tempsharp, sumline);
	}

	cout << min({dotsum, sharpsum, sumline}) << endl;
	return 0;
}



Measured memory_bytes: 4472
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

struct Node {
    map<char, Node*> sons;
    vector<int64_t> count_below;

    Node() : count_below(26, 0) {}
};

void Insert(Node* &root, const string &word, int index, vector<bool> &seen) {
    if (index < 0) {
        return;
    }

    auto ch = word[index];
    if (root->sons.count(ch) == 0) {
        root->sons[ch] = new Node();
    }

    Insert(root->sons[ch], word, index - 1, seen);
    seen[ch - 'a'] = true;
    for (size_t i = 0; i < seen.size(); i += 1) {
        if (seen[i]) {
            root->count_below[i] += 1;
        }
    }
}

Node* BuildTrie(const vector<string> &words) {
    auto root = new Node();
    for (const auto &word : words) {
        vector<bool> seen(26, false);
        Insert(root, word, word.size() - 1, seen);
    }
    return root;
}

int64_t CountMatches(Node *root, const string &word) {
    auto iter = root;
    for (int i = word.size() - 1; i > 0; i -= 1) {
        iter = iter->sons[word[i]];
    }
    return iter->count_below[word[0] - 'a'] - 1;
}

int64_t Solve(const vector<string> &words) {
    auto root = BuildTrie(words);

    int64_t res = 0;
    for (const auto &word : words) {
        res += CountMatches(root, word);
    }
    return res;
}

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

    vector<string> words(n);
    for (auto &word : words) {
        getline(cin, word);
    }

    auto res = Solve(words);
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 435220
#include<bits/stdc++.h>
using namespace std;
int kou,sou=114514,H,W;
int main(){
    cin>>H>>W;
    char HW[H][W];
    for(int i=0;i<H;i++){ for(int o=0;o<W;o++){ scanf(" %c",&HW[i][o]); }}
    for(int i=1;i<H-1;i++){
        for(int j=1;j<H-i;j++){
	    kou=0;
            for(int o=0;o<i;  o++){ for(int f=0;f<W;f++){ if(HW[o][f]!='W'){kou++;} } }
            for(int o=i;o<i+j;o++){ for(int f=0;f<W;f++){ if(HW[o][f]!='B'){kou++;} } }
            for(int o=i+j;o<H;o++){ for(int f=0;f<W;f++){ if(HW[o][f]!='R'){kou++;} } }
            sou=min(sou,kou);
        }
    }
    cout<<sou<<endl;
}

Measured memory_bytes: 3228
string = input()
k = int(input())

before = string[0]
flg = False
cnt = 0
if string.count(before) == len(string):
    print(len(string) * k // 2)
    exit()
for s in string[1:]:
    if s == before and not flg:
        cnt += 1
        flg = True
        continue
    flg = False
    before = s
ans = cnt * k
if string[0] == string[-1]:
    tmp = string[0]
    b_cnt = 0
    for s in string:
        if s == tmp:
            b_cnt += 1
        else:
            break
    a_cnt = 0
    for s in string[::-1]:
        if s == tmp:
            a_cnt += 1
        else:
            break
    if (a_cnt + b_cnt) % 2 == 0 and b_cnt % 2 == 1:
        ans += k - 1
        
    
print(ans)

Measured memory_bytes: 3188
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


def which(a, b, x, y):
    if x < y:
        return b
    return a


a, b, c, x, y = invr()

cost1 = a * x + b * y
cost2 = 1000000000000
cost3 = 1000000000000

if x > y:
    temp1 = 2 * x * c
    temp2 = 2 * y * c + (x-y)*a  # baki a damer pizza
    cost2 = min(temp1, temp2)
else:
    temp1 = 2 * y * c
    temp2 = 2 * x * c + (y-x) * b  # baki je koyta y pizza lagbe tar dam
    cost2 = min(temp1, temp2)


print(min(cost1, cost2))


Measured memory_bytes: 3064
//q2.cpp

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

typedef long long ll;

using namespace std;


int main(){
    int n,m,t[110],o[110],p[110]={0},x=0;
    
    scanf("%d%d",&n,&m);
    
    for(int i=0;i<m;i++)
        scanf("%d",&t[i]);
    
    for(int i=0;i<m;i++){
        x=0;
        for(int j=1;j<=n;j++){
            scanf("%d",&o[j]);
            
            if(o[j]==t[i])
                p[j]++;
            else
                x++;
        }
        p[t[i]]+=x;
    }
    
    for(int i=1;i<=n;i++)
        printf("%d\n",p[i]);
    
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];

    ll cnt = 0;
    REP(i, N){
    	if(a[i]==cnt+1){
    		cnt++;
    	}
    }

    cout << (cnt==0 ? -1 : N-cnt) << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
// using namespace atcoder;
void Main()
{
    ll A, B;
    cin >> A >> B;

    ll v = 0;
    if (A % 2 == 0 && B % 2 == 0){
        ll one = (B-A)/2;
        v = B ^ (one % 2 == 1 ? 1 : 0);
    }
    else if (A % 2 == 1 && B % 2 == 0){
        ll one = (B-A-1)/2;
        v = A ^ B ^ (one % 2 == 1 ? 1 : 0);
    }
    else if (A % 2 == 0 && B % 2 == 1){
        ll one = (B-A + 1)/2;
        v = one % 2 == 1 ? 1 : 0;
    }
    else if (A % 2 == 1 && B % 2 == 1){
        ll one = (B-A)/2;
        v = A ^ (one % 2 == 1 ? 1 : 0);
    }
    put(v);
}
signed main(){ Main();return 0;}

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

const int N = 100500;

typedef long long llong;

llong A[N];

llong S[N];
llong Sp[N];

int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 0; i < n; i++) {
        scanf("%lld", &A[i]);
        S[i + 1] = S[i] + A[i];
        Sp[i + 1] = Sp[i] + ((A[i] >= 0) ? A[i] : 0);
    }
    llong ans = 0;
    for (int i = 0; i + k <= n; i++) {
        llong cur = S[i + k] - S[i];
        llong l = Sp[i];
        llong r = Sp[n] - Sp[i + k];
        ans = max(ans, l + cur + r);
        ans = max(ans, l + r);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 2560
'use strict'

function convertOneNine(target) {
    if(target == 1) return 9;
    if(target == 9) return 1;
}

function main(arg) {
    let answer = String(arg).split("").map(n=>convertOneNine(parseInt(n)));
    console.log(answer.join(""));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>
#include <map>
#include <string>
#include <climits>
#include <set>
#include <sstream>
#include <utility>
#include <ctime>
#include <cassert>
#include <fstream>
using namespace std;
typedef long long LL;
#define MS(A) memset(A, 0, sizeof(A))
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define getcx getchar_unlocked
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 1000000


int main() {

	LL a,v,b,w,t;
	cin>>a>>v;
	cin>>b>>w;
	cin>>t;	

	LL f, s;

	int flag = 0;
	f = a;
	s = b;

	// if(a < 0 && b < 0) {
	// 	a = abs(a);
	// 	b = abs(b);
	// }


	// if(b >= 0) {

	// 	if(b > a) {

	// 		while(t > 0) {
	// 			f += v;
	// 			s += w;
	// 			t--;
			
	// 			if(f >= s) {
	// 				flag = 1;
	// 				break;
	// 			}
	// 		}
	// 	} else {

	// 		while(t > 0) {
	// 			f -= v;
	// 			s -= w;	
	// 			t--;

	// 			if(f <= s) {
	// 				flag = 1;
	// 				break;
	// 			}
	// 		}
	// 	}

	// } else {

	// 	while(t > 0) {
	// 		f -= v;
	// 		s -= w;	
	// 		t--;

	// 		if(f <= s) {
	// 			flag = 1;
	// 			break;
	// 		}
	// 	}
	// }



	if(b >= a) {

		while(t > 0) {
			f += v;
			s += w;
			t--;
			
			if((f^s) >=0 && abs(f) >= abs(s)) {
				flag = 1;
				break;
			}
		}
		
	} else{
		
		while(t > 0) {
			f -= v;
			s -= w;	
			t--;

			if((f^s) >=0 && abs(f) >= abs(s)) {
				flag = 1;
				break;
			}
		}
	} 

	if(flag) {
		printf("YES\n");
	}else {
		printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 3624
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        r: i64,
        d: i64,
        x: i64,
    }

    let mut now = x;
    for i in 0..10 {
        now = r * now - d;
        println!("{}", now);
    }
}


Measured memory_bytes: 2136
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <iomanip>

using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    int a, b;
    cin >> a >> b;

    cout << (3 * a + b) / 2 << endl;

}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
#define rSORT(a, i) sort(all(a),(i))

using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

int main() {
	ll n; cin >> n;
	vector<ll>a(n);
	vector<ll>b(n);
	vector<ll>c(n);
	/*
	rep(i, n)cin >> a[i] >> b[i] >> c[i];
	*/
	rep(i, n)cin >> a[i];
	rep(i, n)cin >> b[i];
	rep(i, n)cin >> c[i];

	sort(all(a));
	sort(all(b));
	sort(all(c));

	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ll m = lower_bound(all(a), b[i]) - a.begin();
		ll k = c.end() - upper_bound(all(c), b[i]);
		ans += (m * k);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

int main() {
	std::stack<int> s;
	std::string e;
	while (std::cin >> e) {
		if (e == "+") {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(b + a);
		} else if (e == "-") {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(b - a);
		} else if (e == "*") {
			int a = s.top();
			s.pop();
			int b = s.top();
			s.pop();
			s.push(b * a);
		} else {
			// s.push(std::stoi(e));
			std::stringstream ss;
			int d;
			ss << e;
			ss >> d;
			s.push(d);
		}
	}
	std::cout << s.top() << std::endl;
	return 0;
}

Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int, int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
#define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main() {
    ll n;
    cin>>n;
    bitset<32> bit(n);
    cout<<(bit)<<endl;
    cout<<(~bit)<<endl;
    cout<<(bit<<1)<<endl;
    cout<<(bit>>1)<<endl;
    
}




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

typedef long long int ll;
typedef vector<int> vi;     typedef vector<ll> vl;
typedef vector<vi> vvi;     typedef vector<vl> vvl;
typedef pair<int, int>  pii;  typedef pair<ll, ll> pll;
typedef vector<pii> vii;    typedef vector<pll> vll;
typedef map<int,int> mii;
typedef vector<char> vc;
typedef vector<bool> vb;
#define endl '\n'
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define MOD 1000000007
#define F first
#define S second
#define pb push_back
#define pf push_front
#define rb pop_back
#define rf pop_front
#define in insert
#define mp make_pair
#define fill(a,x) memset(a,x,sizeof a);
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
const ll INFL = 1e18;
const int INFI = 1e9;
#ifdef EVIL
	#include "../../trace.h"
#else
	#define trace(args...)
#endif

ll div_floor(const ll &a,const ll &b) { return a / b - (((a ^ b) < 0) and a % b);}
ll div_ceil(const ll &a,const ll &b) { return a / b + (((a ^ b) >= 0) and a % b);}
ll modpow(ll a, ll b, ll m = MOD){a %= m; ll res = 1; 
	while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
// void graph(vvi &adj, int m) {int x, y; forn(i, m){cin>>x>>y; adj[--x].pb(--y); adj[y].pb(x);}}

string s;

void solve(){
	cin>>s;
	rep(i,0,s.length()-1){
		if(s[i]=='?'){
			s[i]='D';
		}
	}
	cout<<s;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	#ifdef EVIL
		freopen("inp.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
		freopen("err.txt", "w", stderr);
	#endif
	int t=1;
	// cin>>t;
	rep(q,0,t-1){
		solve();
	}
}


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

int main(){

  int W, H;
  cin>>W>>H;

  int x, y, r;
  cin>>x>>y>>r;

  if (x - r >= 0 && x + r <=W && y - r >= 0 && y + r <= H) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 3108
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string.h>
#include<math.h>
using namespace std;
int sum_w[1001][1001];
int sum_v[1001][1001];
void vmax(int i,int j,int v[],int w[]){
	if(i==0){
		if(w[i]<=j){
			sum_v[i][j]+=v[i];
			sum_w[i][j]+=w[i];
		}
	}else if(j>=w[i]){
		if(sum_v[i-1][j]<sum_v[i-1][j-w[i]]+v[i]){
			sum_v[i][j]=sum_v[i-1][j-w[i]]+v[i];
			sum_w[i][j]=sum_w[i-1][j-w[i]]+w[i];
		}else{
			sum_v[i][j]=sum_v[i-1][j];
			sum_w[i][j]=sum_w[i-1][j];
		}
	}else{
		sum_v[i][j]=sum_v[i-1][j];
		sum_w[i][j]=sum_w[i-1][j];
	}
}
int main(){
    int count=0;
    while(1){
        int i,j,lim=0,N=0,v[1001],w[1001],k=0,l=0;
        count++;
		for(i=0;i<1001;i++){
			for(j=0;j<1001;j++){
				sum_v[i][j]=0;
				sum_w[i][j]=0;
			}
		}
		cin>>lim;
        if(lim==0)break;
        cin>>N;
        for(i=0;i<N;i++){
            scanf("%d,%d",&v[i],&w[i]);
        }
        for(i=0;i<N;i++){
            for(j=0;j<=lim;j++){
                vmax(i,j,v,w);
            }
        }
        for(i=0;i<=lim;i++){
            if(k<sum_v[N-1][i]){
                k=sum_v[N-1][i];
                l=i;
            }
        }
        cout<<"Case "<<count<<":"<<endl<<sum_v[N-1][l]<<endl<<sum_w[N-1][l]<<endl;
    }
    return 0;
}

Measured memory_bytes: 9080
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
    int  n;
    char o[50],e[50];
    while(cin>>o>>e&&(strlen(o)-strlen(e)==0||strlen(o)-strlen(e)==1))
    {
       for(int i=0;i<strlen(o);i++)
        {
            if(i<strlen(e))
                cout<<o[i]<<e[i];
            else
                cout<<o[i];
        }
        cout<<endl;
    }
    return 0;
}


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

long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
    long long g = GCD(a, b);
    return a / g * b;
}

int main() {
    int N;
    cin >> N;
    long long ans = 1;
    for (int i = 0; i < N; ++i) {
        long long t;
        cin >> t;
        ans = LCM(t, ans);
    }
    cout << ans << endl;
}


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 pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

map<int,int> t;
vector<int> cnt,v;
int main(){
    int n,ai;
    cin>>n;
    rep(i,n){
        cin>>ai;
        ++t[ai];
    }
    bool flag=true;
    if(t.size()>2){
        flag=false;
    }
    else{
        for(auto it:t){
            v.pb(it.first);
            cnt.pb(it.second);
        }
        if(v.size()==1){
            if(v[0]!=n-1&&v[0]*2>n) flag=false;
        }
        else{
            if(abs(v[1]-v[0])>1) flag=false;
            if(v[1]<=cnt[0]||(v[1]-cnt[0])*2>cnt[1]) flag=false;
        }
    }
    if(flag) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
using namespace std;
const char* solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int ai;
    cin >> ai;
    if (ai % 2 == 0) {
      if (ai % 3 == 0 || ai % 5 == 0) {
      }
      else {
        return "DENIED";
      }
    }
  }
  return "APPROVED";
}

int main() {
  cout << solve() << endl;
  return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N;
	vector<llong> d;

	cin >> N;
	d.resize(N);
	for(int i = 0; i < N; i++)
		cin >> d[i];

	llong maxi = 0;
	for(int i = 0; i < N; i++){
		if(maxi < i*10)
			break;

		maxi = max(maxi, i*10+d[i]);
	}
	if(maxi < 10*(N-1)){
		cout << "no" << endl;
		return 0;
	}

	reverse(BE(d));
	maxi = 0;
	for(int i = 0; i < N; i++){
		if(maxi < i*10)
			break;

		maxi = max(maxi, i*10+d[i]);
	}
	if(maxi < 10*(N-1))
		cout << "no" << endl;
	else
		cout << "yes" << endl;

	return 0;
}


Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;
    for (int i = 0; i < 1500; i++)
    {
        if ((i * 8 / 100) == A && (i * 10 / 100) == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;


    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(3,"Ofast","inline") 
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
template<class t> inline void write(t x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}

const int N=3005,mod=998244353;
int n,m,ans,f[N];




signed main(){
	read(n);read(m);
	for(int i=1,x;i<=n;i++){
		read(x);
		for(int j=m;j>x;j--) f[j]=(f[j]+f[j-x])%mod;
		f[x]=(f[x]+i)%mod;
		ans=(ans+1ll*f[m]*(n-i+1)%mod)%mod;
		f[m]=0;
	}
	write(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define int long long
#define fill(x, v) memset(x, v, sizeof(x))
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
void lcs(string s, string t)
{
    int n1 = s.size(), n2 = t.size(), i, j;
    int dp[n1 + 1][n2 + 1];
    string ans = "";
    fill(dp, 0);
    for (i = 1; i <= n1; i++)
        for (j = 1; j <= n2; j++)
        {
            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] += dp[i - 1][j - 1] + 1;
            }
            else
            {
                if (dp[i - 1][j] >= dp[i][j - 1])
                    dp[i][j] = dp[i - 1][j];
                else
                    dp[i][j] = dp[i][j - 1];
            }
        }
    i--, j--;
    while (i && j)
    {
        if (s[i - 1] == t[j - 1])
        {
            ans = s[i - 1] + ans;
            i--;
            j--;
        }
        else
        {
            if (dp[i - 1][j] >= dp[i][j - 1])
                i--;
            else
                j--;
        }
    }
    cout << ans << endl;
}
int32_t main()
{
    string s, t;
    cin >> s >> t;
    lcs(s, t);
}


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

int main(){
  int n,k;
  cin >> n >> k;
  VI h(n);
  rep(i,n) cin >> h[i];
  
  sort(h.begin(), h.end());
  
  int ans = h[n-1] - h[0];
  rep(i,n-k+1){
    int hmin = h[i];
    int hmax = h[k+i-1];
    ans = min(ans, hmax-hmin);
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int a,b,h;

  cin>>a;
  cin>>b;
  cin>>h;

  cout<<(a+b)*h/2.0<<endl;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
ll gcd(ll p,ll q){while(q){ll t=p%q;p=q;q=t;}return p;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll xxx[210010];
ll yyy[210010];
int main(){
	ll k,x,y;
	scanf("%lld%lld%lld",&k,&x,&y);
	//パリティチェック
	if((llabs(x)+llabs(y))%2==1 && k%2==0){
		puts("-1");
		return 0;
	}
	
	//ゴールから近づいていく
	ll crrx=x,crry=y,cnt=0;
	xxx[cnt]=crrx;
	yyy[cnt]=crry;
	cnt++;
	//距離が2K以上の間は貪欲
	while(llabs(crrx)+llabs(crry)>=k+k){
		if(llabs(crrx)>=k){
			if(crrx<0)crrx+=k;
			else crrx-=k;
		}else{
			if(crry<0)crry+=k;
			else crry-=k;
		}
		xxx[cnt]=crrx;
		yyy[cnt]=crry;
		cnt++;
	}
	//2K未満
	if(llabs(crrx)+llabs(crry)==k){
		//無
	}else{
		if((llabs(crrx)+llabs(crry))%2){
			//3手
			//1手調整して2手に帰着
			if(llabs(crrx)+llabs(crry)<k){
				//何やってもいい
				crrx+=k;
			}else{
				//原点方向へ
				if(llabs(crrx)>llabs(crry)){
					if(crrx<0)crrx+=k;
					else crrx-=k;
				}else{
					if(crry<0)crry+=k;
					else crry-=k;
				}
			}
			xxx[cnt]=crrx;
			yyy[cnt]=crry;
			cnt++;
		}
		//2手
		//x座標でにぶたん
		ll tempx=llabs(crrx);
		ll tempy=llabs(crry);
		ll ok,ng;
		if(llabs(tempx-k)+llabs(tempy)==k){
			ok=k;
		}else{
			if(llabs(tempx-k)+llabs(tempy)<=k){
				ok=k,ng=0;
			}else{
				ng=k,ok=0;
			}
			while(llabs(ok-ng)>1){
				ll m=(ok+ng)/2;
				if(llabs(tempx-m)+llabs(tempy-(k-m))<=k)ok=m;
				else ng=m;
			}
		}
		xxx[cnt]=tempx==crrx?ok:-ok;
		yyy[cnt]=tempy==crry?k-ok:-(k-ok);
		cnt++;
	}
	printf("%lld\n",cnt);
	for(int i=cnt-1;i>=0;i--)printf("%lld %lld\n",xxx[i],yyy[i]);
	rep(i,0,cnt)assert(llabs(xxx[i]-xxx[i+1])+llabs(yyy[i]-yyy[i+1])==k);
}

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

typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define sz(v) ll(v.size())
//ソート, 文字列findの使い方
int main(){
    int n;
    cin>>n;
    string s(n+1,'0');
    FOR(i,1,n+1){
        cin>>s[i];
    }
    vector<int> e(n+1);
    vector<int> w(n+1);
    e[0]=0;
    w[0]=0;
    FOR(i,1,n+1){
        if (s[i]=='E'){
            e[i]=e[i-1]+1;
            w[i]=w[i-1];
        }else{
            e[i]=e[i-1];
            w[i]=w[i-1]+1;
        }
    }
    ll ans=pow(10,10);
    FOR(i,1,n+1){//i番目の人がリーダーになったら1~i-1の中の西, i+1~Nの中の東を数えれば良い
        if (w[i-1]+e[n]-e[i-1]<ans && i!=n){
            ans=w[i-1]+e[n]-e[i-1];
        }else if (w[n-1]<ans && i==n){
            ans=w[n-1];
        }
    }
    cout<<ans<<endl;
}

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

struct Node {
    int key;
    Node *prev, *next;
};

Node *nil;

void init() {
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    Node *cur = nil->next;
    int cnt = 0;
    while (cur != nil) {
        if (cnt != 0) {
            cout << " ";
        }
        cout << cur->key;
        cur = cur->next;
        cnt++;
    }
    cout << endl;
}

void insertKey(int key) {
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    // nil Nodeの直後に要素を追加
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

Node* listSearch(int key) {
    Node *cur = nil->next;  // nil Nodeの次のNodeから検索
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void deleteNode(Node *t) {
    if (t == nil) {
        return;
    }
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    deleteNode(nil->next);
}

void deleteLast() {
    deleteNode(nil->prev);
}

void deleteKey(int key) {
    deleteNode(listSearch(key));
}

int main() {
    int n, key;
    char com[20];
    cin >> n;
    // cout << "check n = " << n << endl;

    init();

    for (int i = 0; i < n; i++) {
        cin >> com;
        // cout << "process " << i << endl;
        // cout << "com[0] = " << com[0] << endl;
        // Insert key
        if (com[0] == 'i') {
            cin >> key;
            // cout << "key = " << key << endl;
            // cout << "before insert" << endl;
            // cout << "case ins Key" << endl;
            insertKey(key);
        }
        else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F') {
                    // delete head
                    // cout << "case del First" << endl;
                    deleteFirst();
                }
                else if (com[6] == 'L') {
                    // delete tail
                    // cout << "case del Last" << endl;
                    deleteLast();
                }
            }
            else {
                // delete key matched first
                cin >> key;
                // cout << "key = " << key << endl;
                // cout << "case del Key" << endl;
                deleteKey(key);
            }
        }
        // printList();
        // cout << com << endl;
    }
    printList();
}



Measured memory_bytes: 34332
import Data.List

main :: IO ()
main = do
  _ <- getLine
  as <- fmap (map read . words) getLine :: IO [Int]
  solve' as 0

solve' :: [Int] -> Int -> IO ()
solve' as i
  | length as == 1 = putStrLn . show . head $ as
  | as == sort as = return ()
  | otherwise = do
      let bs = insertStep as i
      putStrLn . unwords . map show $ bs
      solve' bs (i + 1)

insertStep :: [Int] -> Int -> [Int]
insertStep as i = (insert a (take i as)) ++ (drop (i + 1) as)
  where
    a = as !! i
    insert a [] = [a]
    insert a (c:cs)
      | a < c = a:c:cs
      | otherwise = c:(insert a cs)



Measured memory_bytes: 4152
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A, B, K; cin >> A >> B >> K;
  int m = min(A, B);
  int ans = m + 1, cnt = 0;
  while(cnt < K){
    ans--;
    if(A % ans == 0 && B % ans == 0){
      cnt++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};

Vec lun;

void dfs(int n) {
	if(n > 3234566667) return ;
	lun.push_back(n);
	string s = to_string(n);

	int len = s.size();
	int last_num = s[len-1] - '0';
	for(int i = last_num - 1; i <= last_num + 1; i++) {
		if(0 <= i && i < 10) dfs(n * 10 + i);
	}
}

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

	int k;
	cin >> k;
	for(int i = 1; i <= 9; i++) {
		dfs(i);
	}
	sort(all(lun));
	cout << lun[k-1] << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int a,b,k,temp = 0;
    cin >> a >> b >> k;


    for(int i = a;i <= min(b,a+k-1);i++){
        cout << i << endl;
    }
    for(int i = max(b-k+1,a+k);i <= b;i++){
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine().Split(' ').First());
            var ds = Console.ReadLine().Split(' ').ToList();
            for(var i =0; ;i++)
            {
                var stri = i.ToString();
                if(N<=i && ds.All(d => !stri.Contains(d)))
                {
                    Console.WriteLine(i);
                    return;
                }
            }
        }
    }

Measured memory_bytes: 15300
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main(){
  ll w,h,x,y;cin>>w>>h>>x>>y;
  bool ans=0;
  if(w==2*x&&h==2*y)ans=1;
  cout<<fixed<<setprecision(15)<<(double)w*h/2<<" ";
  cout<<ans<<endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

long int M = 1e+9+7;
int inf = 1e+9;
int main(void){
    int n,m,x;
    cin >> n >> m >> x;
    vi c(n);
    vvi a(n,(vi(m)));
    rep(i,n){
        cin >> c[i];
        rep(j,m){
            cin >> a[i][j];
        }
    }
    int ans = inf;
    rep(i, 1 << n){
        vi mana(m);
        int tmon=0;
        rep(j,n){
            if((i >> j) & 1) continue;
            rep(k,m){
                mana[k] += a[j][k];
            }
            tmon+=c[j];
        }

        bool flag = true;
        rep(j,m){
            //cout << mana[j] << " ";
            if(mana[j] < x){
                flag=false;
                break;
            }
        }
        //cout << endl;
        if(flag){
           chmin(ans,tmon); 
        }
        
    }
    if(ans==inf){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

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

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

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n;
  int num=0;
  int sum=0;
  scanf("%d",&n);

  for(int i=1;i<=n;i++){
    for(int k=1;k<=i;k++){
      if(i%k==0) num++;
    }
    if((num==8)&&(i%2!=0)) sum++;
    num=0;
  }
  printf("%d\n",sum);

  return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

string aa="keyence";

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    
    string s;
    cin>>s;
    int n=s.size();
    
    bool ans=0;
    
    {
        int mae=0;
        rep(i,7){
            if(s[i]==aa[i]){
                mae++;
            }else{
                break;
            }
        }
        
        int usiro=0;
        rep(i,7){
            if(s[n-1-i]==aa[6-i]){
                usiro++;
            }else{
                break;
            }
        }
        
        if(mae+usiro>=7) ans=1;
    }
    
    rep(i,n-7+1){
        string tmp=s.substr(i,7);
        if(tmp==aa) ans=1;
    }
    
    cout1((ans?"YES":"NO"))
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    if(d==0)
    {
            if(n==100)
                cout<<101<<endl;
                else
                        cout<<n<<endl;
    }
   if(d==1)
       {
               if(n==100)
                cout<<101;
               else
               cout<<n;
               cout<<"00"<<endl;

       }
   if(d==2)
   {if(n==100)
                cout<<101;
               else
           cout<<n;
           cout<<"0000"<<endl;
   }

    return 0;
}


Measured memory_bytes: 256
import core.stdc.stdio;
import std.algorithm;

static immutable int unSet=-114514;

struct Data{
	int a,l,r,m;
}
Data Comb(const ref Data a,const ref Data b){
	Data r;
	r.a=a.a+b.a;
	r.l=max(a.l,a.a+b.l);
	r.r=max(a.r+b.a,b.r);
	r.m=max(a.m,b.m,a.r+b.l);
	return r;
}

struct Node{
	Node* l,r,p;
	int delay=unSet,size,v;
	Data d;
	bool rev;
	int State(){
		if(p !is null){
			if(p.l==&this) return -1;
			if(p.r==&this) return 1;
		}
		return 0;
	}
	void Propagate(){
		if(rev){
			if(l !is null) l.rev=!l.rev;
			if(r !is null) r.rev=!r.rev;
			swap(l,r);
			swap(d.l,d.r);
			rev=false;
		}
		if(delay!=unSet){
			if(l !is null) l.delay=delay;
			if(r !is null) r.delay=delay;
			int s=delay*(delay<0?1:size);
			d=Data(delay*size,s,s,s);
			v=delay;
			delay=unSet;
		}
	}
	void Prepare(){
		if(State)
			p.Prepare;
		Propagate;
	}
	void Update(){
		Propagate;
		d=Data(v,v,v,v);
		size=1;
		if(l !is null){
			l.Propagate;
			d=Comb(l.d,d);
			size+=l.size;
		}
		if(r !is null){
			r.Propagate;
			d=Comb(d,r.d);
			size+=r.size;
		}
	}
	void Rotate(){
		Node* par=p,ch;
		if(p.l==&this){
			ch=r;
			r=p;
			r.l=ch;
		}else{
			ch=l;
			l=p;
			l.r=ch;
		}
		if(ch) ch.p=p;
		p=par.p;
		par.p=&this;
		if(p !is null){
			if(p.l==par) p.l=&this;
			if(p.r==par) p.r=&this;
		}
		par.Update;
		Update;
	}
	void Splay(){
		Prepare;
		while(State){
			int s=State*p.State;
			if(!s)
				Rotate;
			else if(s==1){
				p.Rotate;
				Rotate;
			}else{
				Rotate;
				Rotate;
			}
		}
	}
	void Expose(){
		Node* x=&this;
		while(x){
			x.Splay;
			x=x.p;
		}
		x=&this;
		while(x.p){
			x.p.r=x;
			x=x.p;
			x.Update;
		}
		Splay;
	}
	void Evert(){
		Expose;
		r=null;
		rev=!rev;
		Update;
	}
	void Link(Node* t){
		Evert;
		t.Expose;
		p=t;
		t.r=&this;
		t.Update;
	}
	void Set(int x){
		Expose;
		r=null;
		delay=x;
		Update;
	}
	int Get(){
		Expose;
		r=null;
		Update;
		return d.m;
	}
}

void main(){
	int n,q;
	scanf("%d%d",&n,&q);
	Node[] ns=new Node[n];
	foreach(ref nd;ns){
		int w;
		scanf("%d",&w);
		nd.v=w;
		nd.d=Data(w,w,w,w);
	}
	foreach(i;0..n-1){
		int s,e;
		scanf("%d%d",&s,&e);
		ns[--s].Link(&ns[--e]);
	}
	foreach(_;0..q){
		int t,a,b,c;
		scanf("%d%d%d%d",&t,&a,&b,&c);
		if(t==1){
			ns[--a].Evert;
			ns[--b].Set(c);
		}else{
			ns[--a].Evert;
			printf("%d\n",ns[--b].Get);
		}
	}
}

Measured memory_bytes: 13048
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
const int Max = 1e6 + 5;
const int Mod = 1e9 + 7;
int lst[Max];
int ls[Max];

int main()
{
	int n;
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		scanf("%d", &lst[i]);
		if (lst[i] % 4 == 0)ls[4]++;
		else if (lst[i] % 2 == 0)ls[2]++;
		else ls[1]++;
	}
	if (ls[1]>ls[4]+1||(ls[1]==ls[4]+1&&ls[2]))cout << "No" << endl;
	else cout << "Yes" << endl;


}

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

typedef long long ll;

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

void solve(long long N) {
  ll SN = 0;
  ll NN = N;
  while (NN != 0) {
    SN += NN % 10;
    NN /= 10;
  }
  if (N % SN == 0) {
    cout << YES;
  } else {
    cout << NO;
  }
  cout << endl;
}

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


Measured memory_bytes: 256
/*input
1 1
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define REP(i,j,k)     for(int i = j ; i < k ; ++i)
#define RREP(i,j,k)    for(int i = j ; i >=k ; --i)
#define A    first
#define B    second
#define mp   make_pair
#define pb   emplace_back
#define PII pair<int , int>
#define MEM(i,j)   memset(i , j , sizeof i)
#define ALL(i)     i.begin() , i.end()
#define DBGG(i,j)     cout << i << " " << j << endl
#define DB4(i,j,k,l)  cout << i << " " << j << " " << k << " " << l << endl
#define IOS cin.tie(0) , cout.sync_with_stdio(0)
#define endl "\n"
///------------------------------------------------------------
#define MAX 
#define INF 0x3f3f3f3f

int a , b;

int32_t main(){
    IOS;
    cin >> a >> b;
    if(a + b == 15) cout << "+" << endl;
    else if(a * b == 15) cout << "*" << endl;
    else cout << "x" << endl;
    return 0;
}

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

using namespace std;

bool binarySearch(int *A, int length, int key){
  int left = 0, right = length;

  while(left < right){
    int mid = (left + right) / 2;

    if(key == A[mid]) return true;
    else if(key > A[mid]) left = mid + 1;
    else if(key < A[mid]) right = mid;
  }
  return false;
}

int main(){

  int n, q, cnt = 0;
  int s[100000], t[50000];

  cin >> n;
  for(int i = 0;i < n;i++) cin >> s[i];
  cin >> q;
  for(int i = 0;i < q;i++) cin >> t[i];

  for(int i = 0;i < q;i++){
    if(binarySearch(s, n, t[i])) cnt++;
  }

  cout << cnt << endl;

  return 0;
}




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

int main(){
int n;
vector<int>v;
while(cin>>n)
{
	if(n%2==1){
		n-=1;
		v.push_back(1);
		}
		
	if(n%4==2){
		n-=2;
		v.push_back(2);
		}	
		
	if(n%8==4){
		n-=4;
		v.push_back(4);
		}	
		
	if(n%16==8){
		n-=8;
		v.push_back(8);
		}	
		
	if(n%32==16){
		n-=16;
		v.push_back(16);
		}	
		
	if(n%64==32){
		n-=32;
		v.push_back(32);
		}	
		
	if(n%128==64){
		n-=64;
		v.push_back(64);
		}	
		
	if(n%256==128){
		n-=128;
		v.push_back(128);
		}	
		
	if(n%512==256){
		n-=256;
		v.push_back(256);
		}	
		
	if(n%1024==512){
		n-=512;
		v.push_back(512);
		}	
		int a=v.size();
		for(int i=0;i<a;i++){
			cout<<v[i];
			if(i==a-1){
				cout<<endl;
				}
			else{
				cout<<" ";
				}	
			}
			v.erase(v.begin(),v.end());
	}
	return 0;
		}

Measured memory_bytes: 3144
a=int(input())
b=int(input())
c=int(input())
x=int(input())
S=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i+100*j+50*k == x: 
                S += 1
print(S)

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

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

	map<string,int> m;
	for(int i=0;i<n;i++){
		cin >> s;
		m[s]+=1;
	}
	cout << m.size();
	return 0;
}


Measured memory_bytes: 19180