akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

int main()
{
 int a,b,c,d,common;

 while(~scanf("%d %d %d %d",&a,&b,&c,&d)){

 if(a>=d || c>=b || a==b || c==d)
      common=0;

 else
   {if   (c>=a && d<=b)
        common=d-c;
    else if (c>=a && b<d)
        common=b-c;
    else if (c<a && b<=d)
        common=b-a;
    else if (c<a && d<b)
        common=d-a;
   }
printf("%d\n",common);
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N, K;
  cin >> N >> K;
  vi H(N);
  for (auto& x : H) {
    cin >> x;
  }

  int ret = 0;
  for (auto x : H) {
    if (x>=K) {
      ret++;
    }
  }

  cout << ret << endl;
  return 0;
}


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

//Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

//Type Definitions:
typedef long long ll;
typedef unsigned long long ull;

//Constants:
const int INF = 2e9;
const int MOD = 1e9 + 7;

//Global Variables:

//Prototype Declarations:
int gcd(int, int);

//================ Main Loop ================
int main() {
    int n, m;
    cin >> n >> m;
    vector<bool> isac(n, 0);
    int ac = 0;
    vector<int> pn(n);
    rep(i, m) {
        int q;
        string s;
        cin >> q >> s;
        q--;
        if(s == "AC") {
            if(!isac[q]) {
                isac[q] = 1;
                ac++;
            }
        } else if(isac[q] == 0) {
            pn[q]++;
        }
    }
    int ans = 0;
    rep(i, n) {
        if(isac[i] == 1) {
            ans += pn[i];
        }
    }
    cout << ac << " " << ans << endl;
    return 0;
}
//===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

int main(){
    ll n,k,cnt=0;
    cin>>n>>k;
    while(n>0){
        n/=k;
        cnt++;
    }
    cout<<cnt;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];
  int ans = 0;
  rep(i, n - 1) {
    for (int j = i + 1; j < n; j++) ans += d[i] * d[j];
  }
  cout << ans << endl;
  return 0;
}

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

#define MOD (1000 * 1000 * 1000 + 7)
#define INF (1LL << 60)
#define pb push_back
#define po pop_back
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

int main() {

    vector<char> vowels{'a', 'e', 'i', 'o', 'u'};

    char c;
    cin >> c;

    for (auto &v : vowels) {
        if (v == c) {
            cout << "vowel" << endl;
            return 0;
        }
    }

    cout << "consonant" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	int P[N];int count=0;
	rep(i,0,N){
		cin>>P[i];
		if(P[i]!=i+1) count++;
	}if(count==2||count==0) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    string S, T, U;
    int A,B;
    cin >> S >> T >> A >> B >> U;
    if(U == S) cout << A - 1 << " " << B << endl;
    else cout << A << " " << B - 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define PB push_back
#define MP make_pair
int main(){
  int n;
  int x,y,b,p;
  cin>>n;
  while(n--){
    cin>>x>>y>>b>>p;
    if(b>=5&&p>=2)cout<<(x*b+y*p)*4/5<<endl;
    else if(b>=5)cout<<min(x*b+y*p,(x*b+y*2)*4/5)<<endl;
    else if(p>=2)cout<<min(x*b+y*p,(x*5+y*p)*4/5)<<endl;
    else cout<<min(x*b+y*p,(x*5+y*2)*4/5)<<endl;
  }
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

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

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

const int N = 2e5 + 5;
vvi adj(N);
vi vis(N), par(N);

void bfs(){
	queue<int> q;
	vis[0] = 1;
	q.push(0);
	while(!q.empty()){
		int a = q.front();
		q.pop();
		for(auto j : adj[a])
			if(!vis[j])
				vis[j] = 1, par[j] = a, q.push(j);
	}
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		--a, --b;
		adj[a].pb(b), adj[b].pb(a);
	}
	bfs();
	for(int i = 0; i < n; i++){
		if(!vis[i]){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for(int i = 1; i < n; i++)
		cout << par[i] + 1 << endl;
}

Measured memory_bytes: 13736
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <algorithm>
using namespace std;
 
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define loop(i, l, r) for(int i = l; i < r; i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vec_i;

const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
const int MOD = 1e9+7;


int main()
{
	int n;
	cin >> n;
	vec_i v(n);
	rep(i, n) cin >> v[i];

	int max1, max2;
	int idx1, idx2;
	if(v[0] >= v[1]){
		max1 = v[0]; idx1=0;
		max2 = v[1]; idx2=1;		
	}else{
		max1 = v[1]; idx1=1;
		max2 = v[0]; idx2=0;		
	}
	loop(i, 2, n){
		if(v[i] >= max1){
			max2 = max1;
			idx2 = idx1;
			max1 = v[i];
			idx1 = i;
		}else if(v[i] >= max2){
			max2 = v[i];
			idx2 = i;
		}
	}
	rep(i,n){
		if(i != idx1){
			cout << max1 << endl;
		}else{
			cout << max2 << endl;
		}
	}
}

Measured memory_bytes: 2432
sub f{my$i=$_;
	return$m[$i]if$m[$i];
	for(@$i){
		$t=&f+1;
		if($t>$m[$i]){
			$m[$i]=$t;
			$z[$i]=$_
		}
	}
	$m[$i]
}
($N,$M)=glob<>;
for(<>){
	($A,$B)=glob;
	push@$B,$A
}
for(1..$N){
	f;
	print$z[$_]+0,$/
}


Measured memory_bytes: 126464
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <bitset>
using namespace std;
int n;
vector<bitset<26>> dat;
void init(int _n) {
    n = 1;
    while (n < _n) n *= 2;
    dat.resize(2 * n - 1);
}
void update(int k, char c) {
    k += n - 1;
    dat[k] = bitset<26>(1 << (c - 'a'));
    while (k > 0) {
        k = (k - 1) / 2;
        dat[k] = dat[2 * k + 1] | dat[2 * k + 2];
    }
}
bitset<26> query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return bitset<26>();
    if (a <= l && r <= b) return dat[k];
    auto vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    auto vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return vl | vr;
}
int main() {
    int N, Q;
    string S;
    cin >> N >> S >> Q;
    init(N);
    for (int i = 0; i < N; i++) update(i, S[i]);
    for (int i = 0; i < Q; i++) {
        int type, a, b;
        char c;
        cin >> type >> a;
        if (type == 1) {
            cin >> c;
            update(a - 1, c);
        }
        else if (type == 2) {
            cin >> b;
            cout << query(a - 1, b, 0, 0, n).count() << endl;
        }
    }
}

Measured memory_bytes: 9092
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };

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

long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b, ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}
	int size(int a) {
		return par[root(a)];
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};


int main() {
	int h, w;
	cin >> h >> w;
	whei(int) a(h, hei(int)(w));
	rep(i, 0, h)rep(j, 0, w)cin >> a[i][j];
	int n = 0;
	hei(Pint) before, after;
	rep(i, 0, h) {
		rep(j, 0, w-1) {
			if (a[i][j] % 2 == 1) {
				a[i][j]--;
				a[i][j + 1]++;
				before.push_back(Pint(i + 1, j + 1));
				after.push_back(Pint(i + 1, j + 2));
				n++;
			}
		}
	}
	rep(i, 0, h - 1) {
		if (a[i][w - 1] % 2 == 1) {
			a[i + 1][w - 1]++;
			a[i][w - 1]--;
			before.push_back(Pint(i + 1, w));
			after.push_back(Pint(i + 2, w));
			n++;
		}
	}
	cout << n << endl;
	rep(i, 0, n)cout << before[i].first << " " << before[i].second << " " << after[i].first << " " << after[i].second << endl;
	return 0;
}

Measured memory_bytes: 5228
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

#define all(a) (a).begin(),(a).end()
using namespace std;

bool check(vs &ngo, string s){
	for (string t : ngo) if (t == s) return 0;
	return 1;
}

int main(){
	ll a, b; cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,S,res=0;
  cin >> K >> S;
  
  for(int x=0; x<=K; x++) {
    for(int y=0; y<=K; y++) {
      int Z = S - (x + y);
      if( Z <= K && Z >= 0 ) res++;
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 0;
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807

struct edge
{
  ll to;
  ll cost;
  edge() {}
  edge(ll to, ll cost) : to(to), cost(cost){};
};
vector<ll> dijkstra(ll s, vector<vector<edge>> &g, vector<ll> &num)
{
  //pair.first=距離,pair.second=点
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> q;
  vector<ll> dist(g.size(), INF);
  dist[s] = 0;
  num[s] = 1;
  q.push({0, s});

  while (!q.empty())
  {
    pair<ll, ll> p = q.top();
    q.pop();
    ll v = p.second;
    if (dist[v] < p.first)
      continue;
    rep(i, g[v].size())
    {
      edge e = g[v][i];
      if (dist[e.to] > dist[v] + e.cost)
      {
        dist[e.to] = dist[v] + e.cost;
        q.push({dist[e.to], e.to});
        num[e.to] = num[v];
      }
      else if (dist[e.to] == dist[v] + e.cost)
      {
        num[e.to] += num[v];
        num[e.to] %= mo;
      }
    }
  }
  return dist;
}

int main()
{
  ll n, m;
  cin >> n >> m;
  ll s, t;
  cin >> s >> t;
  s--;
  t--;
  vector<vector<edge>> g(n);
  rep(i, m)
  {
    ll a, b, c;
    cin >> a >> b >> c;
    g[a - 1].emplace_back(b - 1, c);
    g[b - 1].emplace_back(a - 1, c);
  }
  vector<ll> num1(n);
  vector<ll> dist1 = dijkstra(s, g, num1);
  vector<ll> num2(n);
  vector<ll> dist2 = dijkstra(t, g, num2);
  ans += num1[t] * num1[t];
  ans %= mo;
  rep(i, n)
  {
    if (dist1[i] == dist2[i] && dist1[i] * 2 == dist1[t])
    {
      ans -= ((num1[i] * num2[i])%mo)* ((num1[i] * num2[i])%mo);
      ans %= mo;
    }
    for (auto a : g[i])
    {
      if (dist1[i] * 2 < dist1[t] && dist1[a.to] * 2 > dist1[t] && dist1[i] + a.cost + dist2[a.to] == dist1[t])
      {
        ans -= ((num1[i] * num2[a.to])%mo)*((num1[i] * num2[a.to])%mo);
        ans %= mo;
      }
    }
  }
  auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
  cout << mod(ans) << endl;
  return 0;
}

Measured memory_bytes: 18772
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int A, B, K;
	cin >> A >> B >> K;

	if (A + K - 1 < B - K + 1) {
		for (int i = A; i <= A + K - 1; i++) {
			cout << i << endl;
		}
		for (int i = B - K + 1; i <= B; i++) {
			cout << i << endl;
		}
	}
	else {
		for (int i = A; i <= B; i++) {
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys
d={' ':'101',"'":'000000',',':'000011','-':'10010001','.':'010001','?':'000001','A':'100101','B':'10011010','C':'0101','D':'0001','E':'110',
'F':'01001','G':'10011011','H':'010000','I':'0111','J':'10011000','K':'0110','L':'00100','M':'10011001','N':'10011110','O':'00101','P':'111',
'Q':'10011111','R':'1000','S':'00110','T':'00111','U':'10011100','V':'10011101','W':'000010','X':'10010010','Y':'10010011','Z':'10010000'}
for e in sys.stdin:
 a=''.join(d[c]for c in e[:-1])
 a+='0'*(-len(a)%5)
 print(''.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?"[int(a[i:i+5],2)]for i in range(0,len(a),5)))


Measured memory_bytes: 5608
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <math.h>
#include <algorithm>
#include <queue>

using namespace std;

#define INT_MAX 2147483647

long gcd(long m, long n);
long lcm(long m, long n);

int main( void ){

	int n;
	cin >> n;
	string str = "NO";
	if( n == 7 || n == 5 || n == 3 ) str = "YES";
	cout << str;
	return 0;

}

//最大公倍数
long gcd(long m, long n)
{
	long temp;
	while (m % n != 0)
	{
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

//最小公倍数
long lcm(long m, long n)
{
	return m * n / gcd(m,n); 
}

Measured memory_bytes: 256
#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++)


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

Measured memory_bytes: 256
x = int(input())

ans = 0

for i in range(x, 100004):
    tmpf = 1
    for j in range(2, int(i**0.5)):
        if i % j == 0:
            tmpf = 0
            break
    if tmpf == 1:
        ans = i
        break
    
print(ans)

Measured memory_bytes: 2940
#include<iostream>
#include<iomanip>
#include<stdio.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

typedef long long LL;

LL solve(LL a, LL b) {
	LL n = a * b;
	LL s = sqrt(n);

	if (a < b)swap(a, b);
	if (s * s == n)s--;

	if (a - b < 2) return b * 2 - 2;
	else if (s * (s + 1) >= n)return s * 2 - 2;
	return s * 2 - 1;
}

int main() {
	int Q, A, B;
	cin >> Q;

	for (int i = 0; i < Q; i++) {
		cin >> A >> B;
		cout << solve(A, B) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define VI vector<int>
#define Graph vector<VI>

int main() {
    int n, m; cin >> n >> m;
    
    Graph G(n + m);

    for(int i = 0; i < n; ++i) {
        int many; cin >> many;
        for(int j = 0; j < many; ++j) {
            int a; cin >> a;
            a--;
            G[i].push_back(a + n);
            G[a + n].push_back(i);
        }   
    }
    
    vector<int> seen(n + m, 0);
    queue<int> Q;
    Q.push(0);

    while(!Q.empty()) {
        int node = Q.front();
        Q.pop();
        seen[node] = 1;
        for(auto temp : G[node]) {
            if(seen[temp])
                continue;
            Q.push(temp);
        }
    }

    for(int i = 0; i < n; ++i)
        if(seen[i] == 0) {
            cout << "NO\n";
            return 0;
        } 

    cout << "YES\n";
}

Measured memory_bytes: 9592
#include<bits/stdc++.h>
using namespace std;
#define MAXN 100
typedef long long ll;
int n,m,q,ret,a[MAXN],b[MAXN],c[MAXN],d[MAXN];
void dfs(vector<int> v){
    if(v.size()==n){
        int score=0;
        // for(int i=0;i<v.size();++i)cout<<v[i]<<' ';cout<<endl;
        for(int i=0;i<q;++i)if(v[b[i]-1]-v[a[i]-1]==c[i])score+=d[i];
        // cout<<score<<endl;
        ret=max(ret,score);
        return;
    }
    int back=v[v.size()-1];
    v.push_back(-1);
    for(int i=back;i<=m;++i){v.pop_back();v.push_back(i);dfs(v);}
}
int main(){
    cin>>n>>m>>q;
    for(int i=0;i<q;++i)cin>>a[i]>>b[i]>>c[i]>>d[i];
    vector<int> v;v.push_back(-1);
    for(int i=1;i<=m;++i){v.pop_back();v.push_back(i);dfs(v);}
    cout<<ret<<endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	long long int h, n, dif, sum = 0, a[1000000];
	cin >> h >> n;
	dif = h - n;
	if(dif <= 0)
	cout << "0" << endl;
	else{
		for(long long int i = 0; i < h; i++)
		{
			cin >> a[i];
			//sum += a;
		}
		sort(a, a+h);
		for(int i = 0; i < h-n; i++)
		{
			sum += a[i];
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String S;
		Scanner sc = new Scanner(System.in);
		S = sc.next();
		int L = S.length();
		int zero = 0;
		int one = 0;
		char mozi;
		for (int i = 0; i < L; i++) {
			mozi = S.charAt(i);
			if ((i % 2 == 0 && String.valueOf(mozi).equals("0")) || (i % 2 != 0 && String.valueOf(mozi).equals("1"))) {
				zero++;
			}
			if ((i % 2 == 0 && String.valueOf(mozi).equals("1")) || (i % 2 != 0 && String.valueOf(mozi).equals("0"))) {
				one++;
			}
		}
		if (zero > one)
			System.out.println(L - zero);
		else
			System.out.println(L - one);
	}
}


Measured memory_bytes: 34776
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int x;
    cin >> x;
    if(x == 3 || x == 5 || x == 7) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main() {
  int c[6] = {0},same[5] = {0};

  while(scanf("%d,%d,%d,%d,%d\n",&c[0],&c[1],&c[2],&c[3],&c[4]) == 5) {
    int same[5] = {0};
    int straight = 0;
    for(int i=0;i<5;i++) {
      for(int j=0;j<5;j++) {
	if(c[i] == c[j]) {
	  same[i]++;
	}
      }
    }
    sort(c,c+5);
    sort(same,same+5);
    if(same[4] == 4) {
      cout << "four card" << endl;
    }
    else if(same[4] == 3) {
      if(same[1] == 2) {
	cout << "full house" << endl;
      }
      else {
	cout << "three card" << endl;
      }
    }
    else if(same[4] == 2) {
      if((same[3] == 2) &&(same[2] == 2)) {
	cout << "two pair" << endl;
      }
      else {
	cout << "one pair" << endl;
      }
    }
    else if(same[4] == 1) {
      for(int i=0;i<4;i++) {
	if(c[i] == c[i+1]-1) {
	  straight = 1;
	}
	else {
	  straight = 0;
	  break;
	}
      }
      if((c[0] == 1) && (c[1] == 10)) {
	straight = 1;
      }
      if(straight) {
	cout << "straight" << endl;
      }
      else {
	cout << "null" << endl;
      }
    }

  }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

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

int cnt(int x){
	int res = 1;
	while(x>=10){
		x /= 10;
		res++;
	}
	return res;
}
int main() {
	int N;
	cin>>N;
	int ans = 0;
	for (int i = 1; i <= N; ++i){
		if(cnt(i) % 2 == 1){
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    A=sorted(LI())  
    
    *cumsum_rev, = accumulate(A[::-1]) ##累積和

    def is_ok(x): ##x以上の幸福握手がM個以上あるか
        cnt = 0
        for a in A:
            cnt += N-bisect_left(A, x-a)
        return cnt >= M 

    ok = 0
    ng = 10**7
    while ng-ok>1:
        mid = (ok+ng)//2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    
    ans = 0
    cnt_sum = 0
    for a in A:
        cnt = N-bisect_left(A,ok-a)
        cnt_sum += cnt
        if cnt:
            ans += (a * cnt) + cumsum_rev[cnt-1]
        
    ans -= (cnt_sum-M)*ok
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 62804
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>  
using namespace std;
#define eps 0.00000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define f(n) for(int i=0;i<n;++i)
#define REP(i,n) for(long long i = 0;i < n;++i)
int grid[200][200] = {};
int main() {
	int h, w;
	cin >> h >> w;
	int n;
	cin >> n;
	vector<int> hoge;
	REP(i, n) {
		int a;
		cin >> a;
		hoge.push_back(a);
	}
	int now_cnt = 0;
	int now_itr = 0;
	for (int i = 0;i < h * w;++i) {
		if ((i / w) % 2 == 0) {
			grid[i / w][i % w] = now_itr + 1;
		}
		else {
			grid[i / w][w - 1 - (i%w)] = now_itr + 1;
		}
		now_cnt++;
		if (now_cnt >= hoge[now_itr]) {
			now_itr++;
			now_cnt = 0;
		}
	}
	for (int i = 0;i < h;++i) {
		for (int q = 0;q < w;++q) {
			cout << grid[i][q] << " ";
		}
		cout << endl;
	}
	return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define int ll
#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;++i)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;++i)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;--i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair
using ll  = long long;
using vi  = vector<int>;
using vvi = vector<vi>;
using vs  = vector<string>;
using pii = pair<int,int>;
constexpr ll inf = 1ll<<61;
constexpr ll mod = 1e9+7;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T>void add(T &a, const T &b){a += b; a %= mod;}

signed main(){
  int h, w, n; cin >> h >> w >> n;
  int sr, sc; cin >> sr >> sc;
  string s,t ; cin >> s >> t;

  int lb = 1, ub = h;
  ROF(i,n,0){
    if(t[i] == 'D'){
      lb = max(1ll,lb-1);
    }else if(t[i] == 'U'){
      ub = min(h,ub+1);
    }

    if(s[i] == 'D'){
      ub--;
      if(ub == 0 or ub < lb){
	cout << "NO" << endl;
	return 0;
      }
    }else if(s[i] == 'U'){
      lb++;
      if(h < lb or ub < lb){
	cout << "NO" << endl;
	return 0;
      }
    }
  }
  if(lb <= sr and sr <= ub){
  }else{
    cout << "NO" << endl;
    return 0;
  }

  lb = 1;
  ub = w;
  ROF(i,n,0){
    if(t[i] == 'R'){
      lb = max(1ll,lb-1);
    }else if(t[i] == 'L'){
      ub = min(w,ub+1);
    }
    dump(lb,ub);

    if(s[i] == 'R'){
      ub--;
      if(ub == 0 or ub < lb){
	cout << "NO" << endl;
	return 0;
      }
    }else if(s[i] == 'L'){
      lb++;
      if(w < lb or ub < lb){
	cout << "NO" << endl;
	return 0;
      }
    }
    dump(lb,ub);
  }
  if(lb <= sc and sc <= ub){
  }else{
    cout << "NO" << endl;
    return 0;
  }

  cout << "YES" << endl;
}

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

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

	if (a == b) {
		cout << c << endl;
	}
	else if (b == c) {
		cout << a << endl;
	}
	else if (c == a) {
		cout << b << endl;
	}
	
	return 0;
}

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

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

int main() {
  int N;
  cin >> N;
  int A[N];
  rep(i, N) cin >> A[i];
  int ans = euclid(A[0], A[1]);
  for (int i = 2; i < N; ++i) {
    ans = euclid(ans, A[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
import java.util.*;

class Main{

    int n;
    String[] a, b;
    String start, goal;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            n = sc.nextInt();
            if(n==0) break;
            a = new String[n]; b = new String[n];
            for(int i=0; i<n; i++){
                a[i] = sc.next(); b[i] = sc.next();
            }
            start = sc.next(); goal = sc.next();
            System.out.println(bfs());
        }
    }

    class P{
        String s;
        int cnt;
        P(String s, int cnt){
            this.s = s;
            this.cnt = cnt;
        }
    }

    int bfs(){
        LinkedList<P> q = new LinkedList<P>();
        q.add(new P(start, 0));
        HashSet<String> set = new HashSet<String>();
        while(q.size()>0){
            P p = q.poll();
            String s = p.s; int cnt = p.cnt;

            if(s.equals(goal)) return cnt;
            if(s.length()>30 || !set.add(s)) continue;

            for(int i=0; i<n; i++){
                String ns = s.replaceAll(a[i], b[i]);
                if(ns.equals(s)) continue;
                q.add(new P(ns, cnt + 1));
            }
        }
        return -1;
    }

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

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

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

int main() {
    long long a, b;
    cin >> a >> b;

    map<long long, int> mapA, mapB;
    mapA = prime_number_factor(a);
    mapB = prime_number_factor(b);

    int cnt = 0;
    for (auto v: mapA) {
        if (mapB[v.first] >= 1) cnt++;
    }
    cout << cnt + 1 << endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		new Main().run();
	}

	private void run() {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		while (t-- > 0) {
			g = new char[12][6];
			ps = new boolean[12][6];
			for (int y = 0; y < 12; y++)
				g[y] = scanner.next().toCharArray();
			for (int i = 0;; i++) {
				boolean co = false;
				for (int j = 0; j < 12; j++) {
					Arrays.fill(ps[j], false);
				}

				for (int y = 0; y < 12; y++) {
					for (int x = 0; x < 6; x++) {
						if (cn(y, x, g[y][x]) < 4)
							continue;
						cr(y, x, g[y][x]);
						co = true;
					}
				}
				if (!co) {
					System.out.println(i);
					break;
				}
				for (int j = 0; j < 11; j++)
					for (int y = 0; y < 11; y++)
						for (int x = 0; x < 6; x++) {
							if (g[y][x] != '.' && g[y + 1][x] == '.') {
								char tmp = g[y][x];
								g[y][x] = g[y + 1][x];
								g[y + 1][x] = tmp;
							}
						}
			}
		}
	}

	private void cr(int y, int x, char p) {
		if (g[y][x] != p)
			return;
		g[y][x] = '.';
		for (int i = 0; i < 4; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (!isOK(nx, ny))
				continue;
			if (g[ny][nx] == 'O') {
				g[ny][nx] = '.';
				continue;
			}
			cr(ny, nx, p);

		}
	}

	private int cn(int y, int x, char p) {
		int cc = 0;
		if (p == 'O' || p == '.' || p != g[y][x] || ps[y][x])
			return 0;
		else {
			ps[y][x] = true;
			for (int i = 0; i < 4; i++) {
				int nx = x + dx[i];
				int ny = y + dy[i];
				if (!isOK(nx, ny))
					continue;
				cc += cn(ny, nx, p);
			}
		}
		return cc + 1;
	}

	private boolean isOK(int nx, int ny) {
		return 0 <= nx && nx < 6 && 0 <= ny && ny < 12;
	}

	char[][] g;
	boolean[][] ps;
	int dx[] = { 1, 0, -1, 0 };
	int dy[] = { 0, 1, 0, -1 };

}

Measured memory_bytes: 24280
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
typedef long long ll;

int main(){
	int N;
	cin >> N;
	vector<int> P(N), R(N), suc(N), rsuc(N);
	for(int i = 0; i < N; ++i) {
		cin >> P[i];
		P[i]--;
		R[P[i]] = i;
	}
	suc[0] = rsuc[N-1] = 1;
	for(int i = 1; i < N; ++i) {
		if(R[i-1] < R[i]) {
			suc[i] = suc[i-1] + 1;
		} else {
			suc[i] = 1;
		}
	}
	int res = rsuc[N-1];
	for(int i = N-2; i >= 0; --i) {
		rsuc[i] = (R[i+1] > R[i]) ? rsuc[i+1] + 1: 1;
		res = max(res, rsuc[i]);
	}
	cout << N - res << endl;
	return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    string str;
    cin>>str;
    int len=str.size();
    stack<char>s;
    for(int i=0;i<str.size();i++)
        if(str[i]=='T'){
            if (!s.empty()){
                if(s.top() == 'S' )len -= 2,s.pop();
                }
			else s.push(str[i]);}
		else s.push(str[i]) ;
    cout<<len<<endl ;
    return 0 ;
}


Measured memory_bytes: 720
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a * b, c * d) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

struct Data {
  int num;
  Data() : num(0) {;}
  Data(int n) : num(n) {;}
};

inline Data Merge(Data left, Data right) {
  return Data(left.num | right.num);
}

struct SegmentTree {
  int n; vector<Data> data;
  SegmentTree(int N) : n(1 << N), data(n * 2) {}
  void update (int pos, Data value) {
    data[pos] = value;
    while (pos < 2*n-1) {
      int l = pos, r = pos^1;
      if (l > r) swap(l, r);
      pos = pos / 2 + n;
      data[pos] = Merge(data[l], data[r]);
    }
  }
  Data sub(int fr, int to, int node, int la, int ra) {
    if (ra<=fr || to<=la) return Data();
    if (fr<=la && ra<=to) return data[node];
    Data vl = sub(fr, to, (node-n)*2+0, la, (la+ra)/2);
    Data vr = sub(fr, to, (node-n)*2+1, (la+ra)/2, ra);
    return Merge(vl, vr);
  }
  Data query(int fr, int to) { return sub(fr, to, 2*n-2, 0, n); }
};

int main()
{
  int n;
  cin>>n;
  string s;
  cin>>s;
  SegmentTree st(19);
  for(auto&& i:irange(0,n)) {
    char val = s[i] - 'a';
    st.update(i,1<<val);
  }
  int q;
  cin>>q;
  for(auto&& cs:irange(0,q)) {
    int t;
    cin>>t;
    if (t == 1) {
      int i;
      string c;
      cin>>i>>c;
      --i;
      char val = c[0] - 'a';
      st.update(i,1<<val);
    } else {
      int l,r;
      cin>>l>>r;
      --l;
      cout<<__builtin_popcount(st.query(l,r).num)<<'\n';
    }
  }
  cout<<flush;
  return 0;
}


Measured memory_bytes: 4996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll a[11],y,ans;
bool b[10];

void cal(){
	ll sum=0;
	for(int i=0;i<y;i++){
		if(b[i]==0){
			sum=sum*10+a[i];
			continue;
		}
		ans+=sum;
		sum=a[i];
	}
	ans+=sum;
}

void dep(ll d){
	if(d==y){
		cal();
		return;
	}
	b[d]=0;dep(d+1);
	b[d]=1;dep(d+1);
}

int main() {
	char z;
	while(cin>>z){
		a[y]=z-'0';
		y++;
	}
	dep(1);
	cout <<ans;
}

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

B = []
for i in A:
    B.append(i-1)
    B.append(i)
    B.append(i+1)
B = sorted(B)

from collections import Counter
c = Counter(B)
print(c.most_common(1)[0][1])


Measured memory_bytes: 77380
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main(int argc, char *argv[])
{
    int i, n, k, q;
	cin >> n >> k >> q;
	vector<int> answer(n, 0);
	if (q < k) {
		for (i = 0; i < n; i++)
			cout << "Yes" << endl;
		return 0;
	}
	int limit = q - k;
	for (i = 0; i < q; i++) {
		int tmp;
		cin >> tmp;
		answer[tmp - 1]++;
	}
		

	for (i = 0; i < n; i++) {
		if (answer[i] > q - k)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	   

	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(){
   int i,j,n,sum,d[50];
 
   scanf("%d",&n);
   for (i=0;i<n;i++) scanf("%d",&d[i]);
   sum=0;
   for (i=0;i<n;i++)
      for (j=0;j<n;j++)
         if (i!=j) sum+=d[i]*d[j];
   printf("%d\n",sum/2);
   return 0;
}

Measured memory_bytes: 128
#define first f
#define second s
#define ll long long
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#include <bits/stdc++.h>
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn=1e6+5;
const double PI=acos(-1);
const double e=2.718281828459;

char s[maxn];

int main()
{
    scanf("%s",s+1);
    int len=strlen(s+1);
    s[0]='0';
    int p=0,num=0;
    for(int i=len,j;i>=0;i--){
        j=s[i]-'0';
        j+=p;p=0;
        if(j==5){
            if(i-1>=0&&s[i-1]>='5'){
                p++;num+=(10-j);
            }
            else{
                num+=j;
            }
        }
        else if(j<5){
            num+=j;
        }
        else{
            p++;
            num+=(10-j);
        }
    }
    cout<<num<<endl;
    return 0;
}


Measured memory_bytes: 1280
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    
    /////////////////////
    // Write code below /
    /////////////////////
    int numberOfPalindrome = 0;
    int A, B;
    cin >> A >> B;
    
    for (int i = A; i <= B; i++) {
        int s = i % 10;
        int t = i / 10000 % 10;
        int u = i / 10 % 10;
        int v = i / 1000 % 10;
        if (s == t && u == v) {
            numberOfPalindrome++;
        }
    }
    
    cout << numberOfPalindrome << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
using namespace std;

int main() {
	long long int n, m, p[20000] = {}, a, b,easy=0,normal=0,difficult=0;
	string str;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> p[i];
		if (p[i] <= a) { easy++; }
		else if (p[i] <= b) { normal++; } else{
			difficult++;
		}
	}
	cout << min(min(easy , normal),difficult);
} 

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>
#include <vector>

#define PI (3.14159265358979323846)
#define INF (1e+9)
#define DV_NUM (100000007)

using namespace std;
 
int main()
{

 int N;
 cin >> N;

string S;
for(int i=0;i<N;i++){
 cin >> S[i];
}

 int count=0;

 for (int j=0;j<N-2;j++){  
   if ( S[j] == 'A' && S[j+1] == 'B' && S[j+2] == 'C' ){
       count++;
   }
 }

 cout << count << endl;
 
    return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+100;
const int mod = 1e9+7;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll llINF = 0x3f3f3f3f3f3f3f3f;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define fep(i,a,b) for(int i=(a);i>=(b);i--)
inline bool read(ll &num) {
    char in;bool IsN=false;
    in=getchar();
    if(in==EOF) return false;
    while(in!='-'&&(in<'0'||in>'9')) in=getchar();
    if(in=='-'){ IsN=true;num=0;}
    else num=in-'0';
    while(in=getchar(),in>='0'&&in<='9'){
            num*=10,num+=in-'0';
    } 
    if(IsN) num=-num;
    return true;
}
int main(){
    string s;
    cin>>s;
    for(int i=0;i<(int)s.length();i++){
        if(i&1){
            if(s[i]!='L'&&s[i]!='U'&&s[i]!='D'){
                puts("No");return 0;
            }
        }else{
            if(s[i]!='R'&&s[i]!='U'&&s[i]!='D'){
                puts("No");return 0;
            }
        }
    }
    puts("Yes");
    return 0;
}

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

int main(){
    auto s=readln.chomp;
    auto n=s.length;
    if(s.equal(s.retro)){
        auto s1=s[0..(n-1)/2];
        if(s1.equal(s1.retro)){
            auto s2=s[(n+3)/2-1..$];
            if(s2.equal(s2.retro)){
                "Yes".writeln;
                return 0;
            }
        }
    }   
    "No".writeln;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int w, h, n;
    cin >> w >> h >> n;
    int l = 0, r = w, d = 0, u = h;
    rep(i, n) {
        int x, y, a;
        cin >> x >> y >> a;
        if (a == 1) {
            chmax(l, x);
        } else if (a == 2) {
            chmin(r, x);
        } else if (a == 3) {
            chmax(d, y);
        } else {
            chmin(u, y);
        }
    }
    if (r - l >= 0 && u - d >= 0) cout << (r - l) * (u - d) << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>

using namespace std;
typedef long long ll;
const int inf = 1e9;

int main() {
  int N, T;
  cin >> N >> T;
  vector<pair<int, int>> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec[i].first >> vec[i].second;
  }
  sort(vec.begin(), vec.end());
  
  int minv = inf;
  for (auto itr = vec.begin(); itr != vec.end(); itr++) {
    if (itr->second <= T) {
      minv = min(minv, itr->first);
    }
  }
  if (minv == inf) {
    cout << "TLE" << endl;
  } else {
    cout << minv << endl;
  }
  return 0;
}


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

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

    map<pair<int, int>, int> cnt;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        cnt[{s.front(), s.back()}]++;
    }
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
        string s = to_string(i);
        ans += cnt[{s.back(), s.front()}];
    }
    cout << ans << endl;
}


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

int main(void){
    int N, M;
    cin >> N >> M;
    int a, b, C[N];
    for(int i = 0; i < N; i++)  C[i] = 0;
    for (int i = 0; i < M; i++)
    {
        cin >> a >> b;
        C[a-1]++;
        C[b-1]++;
    }
    for (int i = 0; i < N; i++)
    {
        cout << C[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

int main(){
    int a, b;
    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