akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef long long ll;
typedef pair<ll,ll> P;
const int INF=INT_MAX / 3;
const ll LINF=LLONG_MAX / 3LL;
#define CONST 1000000007
#define EPS (1e-8)
#define PB push_back
#define MP make_pair
#define sz(a) ((int)(a).size())
#define reps(i,n,m) for(int i=(n);i<int(m);i++)
#define rep(i,n) reps(i,0,n)
#define SORT(a) sort((a).begin(),(a).end())
ll mod(ll a,ll m){return (a%m+m)%m;}
int dx[9]={0,1,0,-1,1,1,-1,-1,0},dy[9]={1,0,-1,0,1,-1,1,-1,0};
ll n,m;
int main(){
  cin>>n;
  ll s=0;
  int i=0;
  for(i=1;i<=n;++i){
    s += i;
    if(s>=n)break;
  }
  int x =i;
  reps(i,1,x+1){
    if(s-n==i)continue;
    cout<<i<<endl;
  }

  return 0;
}


Measured memory_bytes: 256
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;
struct Edge {
	ll to;
	ll cost;
};
using Graph = vector<vector<Edge>>;

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
/***** define constant start *******/
const ll MOD = 1000000007;
const double PI = 2.0 * asin(1.0);
const ll INF = 1L<<60;
string abc = "abcdefghijklmnopqrstuvwxyz";
string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const ll MAX = (ll)pow(10,7);
/****** define constant end ********/
/****** define variable start ******/
ll n;
vll s;
vll G;
/******* define variable end *******/
vector<ll> color;
bool dfs(ll v, ll c){
	color[v] = c;
	for(int i = 0; i < G[v].size(); i++){
		if(color[G[v][i]] == c) return false;
		if(color[G[v][i]] == 0 && !dfs(G[v][i], -c)) return false;
	}
	return true;
}
vll d;
void warshall_floyd(){
	for(ll k = 0; k < n; k++){
		for(ll i = 0; i < n; i++){
			for(ll j = 0; j < n; j++){
				if(i == j){
					d[i][j] = 0;
					d[j][i] = 0;
				}else{
					d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
				}
			}
		}
	}
}
int solve() {
	cin >> n;
	color.resize(n);
	d.resize(n, vl(n, INF));
	s.resize(n, vl(n));
	G.resize(n);
	REP(i, n){
		string str;
		cin >> str;
		REP(j, n){
			s[i][j] = stol(str.substr(j, 1));
			if(s[i][j]){
				G[i].push_back(j);
				G[j].push_back(i);
				d[i][j] = 1;
				d[j][i] = 1;
			}
		}
	}
	ll ans = 0;
	if(dfs(0, 1)){
		warshall_floyd();
		REP(i, n){
			REP(j, n){
				ans = max(ans, d[i][j]);
			}
		}
		cout << ans + 1 << endl;
	}else{
		cout << -1 << endl;
	}
	return 0;
}

int main() {
	//clock_t start = clock();
	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int end_solve = solve();
	/*
	clock_t end = clock();
	const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC *
	1000.0; printf("time %lf[ms]\n", time);
	*/

	return end_solve;
}


Measured memory_bytes: 4864
(* Vicfred
 * https://atcoder.jp/contests/abc136/tasks/abc136_b
 * implementation
 * *)
Scanf.scanf "%d\n" @@ fun n ->
    Printf.printf "%d\n" @@
    Array.fold_left ( + ) 0 @@
    Array.init n @@ fun i -> if (String.length (string_of_int (i + 1))) mod 2 = 1 then 1 else 0



Measured memory_bytes: 6104
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>(b);--i)
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
  ll n,a,b;cin>>n>>a>>b;
  
  cout<<min(n*a,b)<<endl;
}




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

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main() {
    int n;
    cin >> n;
    vl a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    
    if(n&1) {
        auto f = [&](bool b) {
            ll ans = 0LL;
            if(b) {
                rep(i, n/2-1) ans -= a[i]*2;
                ans -= a[n/2-1];
                ans -= a[n/2];
                REP(i, n/2+1, n) ans += a[i]*2;
            }
            else {
                rep(i, n/2) ans -= a[i]*2;
                ans += a[n/2];
                ans += a[n/2+1];
                REP(i, n/2+2, n) ans += a[i]*2;
            }
            return ans;
        };
        cout << max(f(0), f(1)) << endl;
    }
    else {
        ll ans = 0LL;
        rep(i, n/2-1) {
            ans -= a[i]*2;
        }
        ans -= a[n/2-1];
        ans += a[n/2];
        REP(i, n/2+1, n) ans += a[i]*2;
        cout << ans << endl;
    }
    return 0;
}

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

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

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

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define A first
#define B second
#define MOD 1000000007

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;
}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res, x);
        y = y >> 1;
        x = mulmd(x, x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a - b;
    if(ret < 0){
        ret += MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int invPow(ll a){
    return power(a, MOD - 2, MOD);
}

const int N = 1e5 + 5;

int arr[N];
map<int, int> mp;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k, q;
    cin >> n >> k >> q;
    REP(i, q){
        int r;
        cin >> r;
        mp[r] += 1;
    }
    FOR(i, 1, n){
        if(k + mp[i] - q >= 1){
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    }
}

/**
    Check out for boundary cases, (n = 1 or n = 0)
    check for integer overflow

**/



Measured memory_bytes: 5504
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
template <typename Monoid >
struct SegmentTree{
  using F = function< Monoid(Monoid,Monoid) >;

  int sz;
  vector<Monoid> seg;

  const F f;
  const Monoid M;

  SegmentTree(int n,const F f,const Monoid &M) : f(f),M(M){
    sz = 1;
    while(sz<n) sz<<=1;
    seg.assign(sz*2,M);
  }
  void set(int k,const Monoid &v){
    seg[k+sz] = v;
  }
  void build(){
    for(int k=sz-1;k>0;k--){
      seg[k] = f(seg[2*k],seg[2*k+1]);
    }
  }
  void update(int k,const Monoid &v){
    k += sz;
    seg[k] = v;
    while(k >>= 1){
      seg[k] = f(seg[2*k],seg[2*k+1]);
    }
  }
  Monoid que(int a,int b){
    Monoid L=M,R=M;
    for(a+=sz, b+=sz;a<b;a>>=1,b>>=1){
      if(a&1) L = f(L,seg[a++]);
      if(b&1) R = f(seg[--b],R);
    }
    return f(L,R);
  }
  Monoid operator[](const int &k) const{
    return seg[k+sz];
  }
};
const ll MAX = 5*1e5+2;
signed main(){
  init_io();
  ll n,q;
  cin >> n >> q;
  SegmentTree<ll> seg(n,[](ll a,ll b){return a+b;},0ll);
  vector<ll> c(n);
  vector<ll> good(MAX,-1);
  vector<ll> l(q),r(q);
  vector<ll> ans(q);
  vector<TP> rl(q);
  map<ll,ll> mp;
  for(int i=0;i<n;i++){
    cin >> c[i];
  }
  for(int i=0;i<q;i++){
    cin >> l[i] >> r[i];
    rl[i] = TP(r[i],l[i],i);
  }
  sort(rl.begin(),rl.end());
  ll idx=0;
  for(int i=0;i<q;){
    ll ri = get<0>(rl[i]);
    ll le = get<1>(rl[i]);
    ll j = get<2>(rl[i]);
    if(idx >= ri){
      ans[j] = seg.que(le-1,ri);
      i++;
    }else{
      seg.update(idx,1);
      if(good[c[idx]]!=-1){
        seg.update(good[c[idx]],0);
      }
      good[c[idx]] = idx;
      idx++;
    }
  }
  for(int i=0;i<q;i++){
    cout << ans[i]<<endl;
  }
}


Measured memory_bytes: 43196
// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
// #define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int n;

const int M = 15;
vector<LL> dat[11];

LL p3[M];

void doit(int n) {
    vector<LL> &a = dat[n];
    // static int b[M];

    for (int st=1; st<10; ++st) {
        int lim = p3[n-1];
        for (int mask=0; mask<lim; ++mask) {
            int cur = st, tmask = mask;
            LL x = st;
            bool suc = true;
            for (int j=0; j<n-1; ++j) {
                int now = tmask % 3;
                if (now == 0)
                    cur -= 1;
                else if (now == 2)
                    cur += 1;
                if (cur < 0 || cur > 9) {
                    suc = false;
                    break;
                }
                tmask /= 3;
                x = x * 10 + cur;
            }
            if (suc)
                a.push_back(x);
        }
    }
    sort(a.begin(), a.end());
}
vector<LL> tot;
int main(int argc, char const *argv[]) {
    // code

    p3[0] = 1;
    for (int i=1; i<M; ++i)
        p3[i] = p3[i-1] * 3;

    for (int i=1; i<11; ++i) {
        doit(i);
        for (LL x : dat[i])
            tot.push_back(x);
    }

    int n;
    cin >> n;
    cout << tot[n-1] << endl;
    return 0;
}


Measured memory_bytes: 4976
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

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

  if ((1LL << M) <= K)
    FINALANS(-1);
  
  if (M == 0)
  {
    if (K == 0)
      FINALANS("0 0");
    else
      FINALANS(-1);
  }

  if (M == 1)
  {
    if (K == 0)
      FINALANS("0 0 1 1");
    else
      FINALANS(-1);
  }

  for (ll i = 0; i < (1LL << M); i++)
  {
    if (i != K)
      cout << i << " ";
  }
  cout << K << " ";
  for (ll i = (1LL << M) - 1; i >= 0; i--)
  {
    if (i != K)
      cout << i << " ";
  }
  cout << K << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#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 len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

template <class T>
T comb(T n,T k){
    T ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<ll> a(n+1,0),sum(n+1,0);
    FOR(i,1,n+1) cin>>a[i],sum[i]=sum[i-1]+a[i];
    sort(begin(sum),end(sum));
    map<ll,ll> cnt;
    rep(i,n+1){
      cnt[sum[i]]++;
    }
    ll ans=0;
    for(auto itr:cnt){
      if(itr.second>=2){
        ans+=comb(itr.second,(ll)2);
      }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;

ll lcm(ll a, ll b) {
	return a / __gcd(a, b) * b;
}

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	ll l = 1;
	FOR(i, n) {
		ll t;
		cin >> t;
		l = lcm(l, t);
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <random>
#include <vector>
#include <cassert>
#include <iostream>
#include <algorithm>
using namespace std;
mt19937 mt(12231817);
int rand_rng(int l, int r) {
	uniform_int_distribution<int> p(l, r - 1);
	return p(mt);
}
vector<int> random_distinct_integers(int l, int r, int k) {
	assert((r - l) >= k);
	set<int> s;
	for (int i = 0; i < k; i++) {
		int x = rand_rng(l, r);
		while (s.find(x) != s.end()) x = rand_rng(l, r);
		s.insert(x);
	}
	return vector<int>(s.begin(), s.end());
}
inline unsigned long long gcd(unsigned long long x, unsigned long long y) {
	while (y != 0) {
		unsigned long long r = x;
		x = y;
		y = r % y;
	}
	return x;
}
inline unsigned modpow(unsigned long long a, unsigned long long b, unsigned m) {
	unsigned ret = 1; a %= m;
	while (b) {
		if (b & 1) ret = 1ULL * ret * a % m;
		a = 1ULL * a * a % m;
		b >>= 1;
	}
	return ret;
}
std::map<unsigned long long, unsigned> prime_factorize(unsigned long long x) {
	std::map<unsigned long long, unsigned> ret;
	for (unsigned i = 2; 1ULL * i * i <= x; i++) {
		while (x % i == 0) x /= i, ret[i]++;
	}
	if (x != 1) ret[x]++;
	return ret;
}
std::vector<unsigned long long> prime_divisors(unsigned long long x) {
	std::map<unsigned long long, unsigned> res = prime_factorize(x);
	std::vector<unsigned long long> ret;
	for (std::pair<unsigned long long, unsigned> w : res) ret.push_back(w.first);
	return ret;
}
std::vector<unsigned long long> calc_divisors(unsigned long long x) {
	std::map<unsigned long long, unsigned> res = prime_factorize(x);
	std::vector<unsigned long long> ret; ret.push_back(1);
	for (std::pair<unsigned long long, unsigned> w : res) {
		int s = ret.size();
		unsigned long long mul = 1;
		for (int i = 0; i < w.second; i++) {
			mul *= w.first;
			for (int j = 0; j < s; j++) ret.push_back(ret[j] * mul);
		}
	}
	sort(ret.begin(), ret.end());
	return ret;
}
unsigned long long totient_function(unsigned long long x) {
	std::vector<unsigned long long> v = prime_divisors(x);
	unsigned long long ret = x;
	for (unsigned long long w : v) ret = ret / w * (w - 1);
	return ret;
}
int n;
int main() {
	cin >> n;
	if (gcd(n, totient_function(n)) != 1) cout << -1 << endl;
	else if (n == 2) cout << 1 << endl;
	else {
		int e = totient_function(n);
		vector<unsigned long long> v1 = calc_divisors(totient_function(e));
		int w1 = -1;
		for (int i : v1) {
			if (modpow(n, i, e) == 1) {
				w1 = i; break;
			}
		}
		vector<int> sample = random_distinct_integers(0, n, min(n, 100));
		vector<unsigned long long> v2 = calc_divisors(w1);
		int ret = -1;
		for (int i : v2) {
			bool ok = true;
			int r = modpow(n, i, e);
			for (int j : sample) {
				if (modpow(j, r, n) != j) ok = false;
			}
			if (ok) {
				ret = i; break;
			}
		}
		cout << ret << endl;
	}
	return 0;
}

Measured memory_bytes: 3132
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, INF = 1e18;

string s;
lint ans = 0;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> s;
	lint cnt = 0;
	IREP(i, SZ(s) - 1) {
		if (s[i] == 'B' && s[i + 1] == 'C') {
			cnt++;
		}
		else if (s[i] == 'A') {
			ans += cnt;
		}
		else {
			if (i == 0) break;
			if (s[i] == 'C' && s[i - 1] == 'B') continue;
			cnt = 0;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <string.h>

using namespace std;

int gcd(int x, int y);

int main() {
	int x, y;

	cin >> x >> y;

	cout << gcd(x, y) << endl;
}

int gcd(int x, int y) {
	int r = 0;

	if (x < y)
		swap(x, y);

	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}

	return x;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define int long long
using namespace std;

int gcd(int a, int b){
	if(!a) return b;
	return gcd(b%a,a);
}

int lcm(int x, int y){
	if(x == 0 && y==0) return 0;
	return x/gcd(x, y) *y;
}

signed main() {
  int N;
  cin >> N;
  
  vector<int> T(N);
  for( int i = 0; i < N; i++ ){
    cin >> T.at(i);
  }
  
  
  for( int i = 1; i < N; i++ ){
    T.at(i) = lcm(T.at(i), T.at(i-1));
  }
  cout << T.at(N-1) << endl;
  
    
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int a[3];

bool solve(){
  sort(a,a+3);
  if(a[0]==a[2]) return false;
  if(a[0]==a[1]||a[1]==a[2]) return true;
  else return false;
}

int main()
{
  REP(i,3){
    cin >> a[i];
  }
  bool res=solve();
  if(res){
    printf("Yes\n");
  }else{
    printf("No\n");
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i]){
      cout<<"No\n";
      return 0;
    }
  }
  cout<<"Yes\n";
}

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

#define infile "../test/sample-1.in"
#define int long long
// #define INF 2147483647
#define INF 1000000000000000000LL
#define MOD 1000000007LL

// {{{ define basic macro
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

#define foreach(x,a) for(auto& (x) : (a) )
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

template<typename A, size_t N, typename T> // n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

template <class T = int>
T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;
// }}}
//{{{ dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}
//{{{ others
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T>
using PQ = priority_queue<T, vector<T>, greater<T>>;

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


int dp[26][101];

int solve(){
  string s;cin>>s;
  int n = sz(s);

  rep(i, n){
    dp[s[i]-'a'][i] = 1;
  }
  dump_2d(dp, 26, n);

  int cnt=0;
  rrep(i, n){
    //check
    rep(alp, 26){
      int tmp = 1;
      rep(j, i+1){
        tmp *= dp[alp][j];
      }
      if (tmp==1){
        cout << cnt << endl;
        return 0;
      }
    }

    rep(j, 1, n){
      rep(alp, 26){
        dp[alp][j-1] |= dp[alp][j];
      }
    }
    cnt++;
    dump(cnt, i);
    dump_2d(dp, 26, n);
  }

  return 0;
}

int test(){ //{{{
  return 0;
}
//}}}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
#ifdef PCM
  test();
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#include <memory.h>

using namespace std;

typedef long long ll;

const ll MAXV = 1000, MAXE = 2000, INF = 1e15;
struct edge { ll from, to, cost; };
edge ed[MAXE];

ll d[MAXV + 1]; // 最短距離
bool negative[MAXV + 1];
ll V, E; // Vは頂点数, Eは辺数

void shortest_path(int s){
  for(int i=1;i<=V;i++) d[i] = INF;
  d[s] = 0;
  for(int i=1;i<=V-1;i++){
    for(int j=0;j<E;j++){
      edge e = ed[j];
      if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
      }
    }
  }
}

void find_negative_loop(){
  for(int i=1;i<=V;i++){
    for(int j=0;j<E;j++){
      edge e = ed[j];
      if(d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
        d[e.to] = d[e.from] + e.cost;
        negative[e.to] = true;
      }
      if(negative[e.from] == true) negative[e.to] = true;
    }
  }
}

int main(){
  cin >> V >> E;
  for(int i=0;i<E;i++){
    int a, b, c; cin >> a >> b >> c;
    ed[i] = {a, b, -c};
  }
  shortest_path(1);
  ll ans = -d[V];
  find_negative_loop();
  if(negative[V] == true) cout << "inf" << endl;
  else{
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			char[] s = sc.next().toCharArray();
			if(s[0]=='0')break;
			int a = 0;
			int b = 0;
			for(int i=1;i<s.length;i++){
				if(s[i]=='A')a++;
				else b++;
			}
			if(a>b)a++;
			else b++;
			System.out.println(a+" "+b);
			for(int j=0;j<2;j++){
				s = sc.next().toCharArray();
				a = 0;
				b = 0;
				for(int i=1;i<s.length;i++){
					if(s[i]=='A')a++;
					else b++;
				}
				if(a>b)a++;
				else b++;
				System.out.println(a+" "+b);
			}
		}
	}
}

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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
    // get values from input
    long X;
    READ(X);

    // main procedure
    long fh_count, f_count, happiness_value;

    fh_count = X / 500;
    f_count = (X / 5) % 100;

    happiness_value = fh_count * 1000 + f_count * 5;

    // output
    WRITE_N(happiness_value);

    return 0;
}


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

int main (){
  int N;
  cin >> N;
  vector<int> vec (N);
  for (int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  
  int dummy =0,count =0,dummy1=0;
  for (int i=0;i<N;i++){
    dummy =vec.at(dummy)-1;
    count ++;
    if (dummy == 1){
      dummy1=1;
      break;
    }
  }
  if (dummy1==0){
    cout << -1 <<endl;
  }
  else {
    cout << count<< endl;
  }
}
      


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll x;
  cin >> x;
  ll ans=1;
  for(int i=2;i<=40;i++){
    ll sum=i;
    while(sum<=x){
      sum*=i;
      if(sum<=x){
        ans=max(ans,sum);
      }
    }
  }
  cout << ans;
}
      

Measured memory_bytes: 3640
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        n: usize,
        s: chars,
    }
    let (a, b) = s.split_at(n / 2);
    println!("{}", if a == b { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int f(double i, LL K){
    int ans=0;
    while(K>i){
        ans++;
        i*=2;
    }
    return ans;
}
void solve(long long N, long long K){
    double ans=0;
    for(double i=1; i<=N; i++){
        if(i>=K)ans+=1/(double)N;
        else{
            ans+=(1/(double)N)*pow(0.5,f(i,K));
        }
    }
    cout<<std::setprecision(15)<<ans<<endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
namespace /* debug */{
  #define DEBUG(...) do{cout<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数
  #define ldebug(...) do{cout<<"["<<setw(3)<<__LINE__<<"] ";debug(__VA_ARGS__);}while(0) //行数
  #define lDEBUG(...) do{cout<<"["<<setw(3)<<__LINE__<<"] "<<#__VA_ARGS__<<" = ";debug(__VA_ARGS__);}while(0) //変数, 行数
  template<class T>void show(T&x){cout<<x<<" ";} //出力
  template<class T>void showendl(T&x){cout<<x<<endl;} //出力改行
  template<class P,class Q>void show(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<") ";} //pair出力
  template<class P,class Q>void showendl(pair<P,Q>&x){cout<<"("<<x.first<<", "<<x.second<<")"<<endl;} //pair出力改行
  template<class H>void debug(H&&h){showendl(h);} //引数1つ
  template<class H,class...Ts>void debug(H&&h,Ts&&...ts){show(h);debug(forward<Ts>(ts)...);} //可変引数
  template<class T>void debug(vector<T>&vt){int i=0;for(auto x:vt)++i!=vt.size()?show(x):showendl(x);} //vector出力
  template<class T>void debug(initializer_list<T>init){int i=0;for(auto x:init)++i!=init.size()?show(x):showendl(x);} //初期化子リスト出力
}

struct Dice{
  int n1,n2,n3,n4,n5,n6;
  Dice(int n1, int n2, int n3, int n4, int n5, int n6)
    :n1(n1), n2(n2), n3(n3), n4(n4), n5(n5), n6(n6) {}

  void N(){
    swap(n1,n2);swap(n2,n6);swap(n6,n5);
  }
  void S(){
    swap(n1,n5);swap(n5,n6);swap(n6,n2);
  }
  void E(){
    swap(n1,n4);swap(n4,n6);swap(n6,n3);
  }
  void W(){
    swap(n1,n3);swap(n3,n6);swap(n6,n4);
  }

  int funcf(int f, int a, int b, int c, int d){
    if(f==a)return b;
    if(f==b)return c;
    if(f==c)return d;
    if(f==d)return a;
    return 0;
  }

  int ansRight(int u, int f){
    if(u==n1)return funcf(f,n2,n3,n5,n4);
    if(u==n2)return funcf(f,n1,n4,n6,n3);
    if(u==n3)return funcf(f,n1,n2,n6,n5);
    if(u==n4)return funcf(f,n1,n5,n6,n2);
    if(u==n5)return funcf(f,n1,n3,n6,n4);
    if(u==n6)return funcf(f,n2,n4,n5,n3);
    return 0;
  }
};

bool eq(Dice l, Dice r){
  if(l.ansRight(l.n1,l.n2) != r.ansRight(l.n1,l.n2))return false;
  if(l.ansRight(l.n1,l.n3) != r.ansRight(l.n1,l.n3))return false;
  if(l.ansRight(l.n1,l.n4) != r.ansRight(l.n1,l.n4))return false;
  if(l.ansRight(l.n1,l.n5) != r.ansRight(l.n1,l.n5))return false;
  if(l.ansRight(l.n3,l.n2) != r.ansRight(l.n3,l.n2))return false;
  return true;
}

template<class H>
void CIN(H& h){cin>>h;}
template<class H, class... T>
void CIN(H &h, T&... t){cin>>h;CIN(t...);}

int main(){
  int a,b,c,d,e,f;
  int A,B,C,D,E,F;
  CIN(a,b,c,d,e,f,A,B,C,D,E,F);
  Dice dice1(a,b,c,d,e,f);
  Dice dice2(A,B,C,D,E,F);

  cout<<(eq(dice1,dice2) ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 3120
import std.stdio, std.typecons, std.conv;
import std.algorithm, std.array, std.string;

alias Tuple!(string, "name", int[], "pages") Word;

void main() {
  Word[string] table;
  int num; string str;
  while(readf("%s %d\n", &str, &num)) {
    if (str in table)
      table[str].pages ~= num;
    else 
      table[str] = Word(str, [num]);
  }
  Word[] words = table.values.array;
  words.sort!((x, y) => x.name < y.name);
  foreach(word; words) {
    sort(word.pages);
    writeln(word.name);
    word.pages.map!(to!(string)).join(" ").writeln;
  }
}

Measured memory_bytes: 1160
t[65536];main(n,x,y,dx,dy,r,m,mx,my){for(scanf("%d\n",&n);n;printf("%d %d\n",mx,my),n--)for(x=y=m=0;scanf("%d%d",&dx,&dy),dx|dy;){x+=dx,y+=dy,r=x*x+y*y;if(r>m||(r==m&&mx<x))m=r,mx=x,my=y;}}

Measured memory_bytes: 0
class Main{

	public static void main (String[] args) {

		Main main = new Main();

		java.util.Scanner sc = new java.util.Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] list = new int[N];

		for (int index=0; index<N; index++) {
			list[index]=sc.nextInt();
		}

		for (int index=0; index<N-K; index++) {
			if (list[index]<list[K+index]) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

		sc.close();;

	}

}


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

int main(){
    int n,m;
    std::string s,t,k;
    cin>>s>>t;
    n=s.length();
    m=t.length();
    int dp[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++) {
            if (i == 0 || j == 0) {
                dp[i][j] = 0;
            } else if (s[i - 1] == t[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            } else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
            //cout << dp[i][j] << " ";
        }
    }
    int i=n,j=m,last=dp[n][m];
    while(last!=0){
        if(dp[i][j]!=last){
            k+=s[i];
        }
        last=dp[i][j];
        if(dp[i][j]!=max(dp[i-1][j],dp[i][j-1])){
            i--;
            j--;
        }
        else if(dp[i-1][j]==dp[i][j]){
            i--;
        }
        else {
            j--;
        }
    }
    reverse(k.begin(),k.end());
    cout<<k;
}

Measured memory_bytes: 38716
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

constexpr int pows(int a, int b) {
  int c = 1;
  while (b) {
    if (odd(b)) c *= a;
    b >>= 1;
    a *= a;
  }
  return c;
}

int f(int x) {
  int c = -INF;
  int n = to_string(x).size();
  loop(i, 1, n) {
    int a = x / pows(10, i);
    int b = x % pows(10, i);
    cmax(c, a * b);
  }
  return c;
}

void solve() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    int c = 0;
    set<int> s;
    while (n >= 10) {
      n = f(n);
      c++;
      if (s.count(n)) {
        cout << -1 << endl;
        goto next;
      }
      s.insert(n);
    }
    cout << c << endl;
  next:;
  }
}

Measured memory_bytes: 3248
#include<cstdio>



using namespace std;
int main(void)
{
	int x,y;
	int karix,kariy;
	while(1)
	{
		scanf("%d%d",&x,&y);
		if(x == 0 && y == 0) break;
		int koji;
		scanf("%d",&koji);
		int huka[17][17] = {0};
		for(int i = 0;i<koji;i++)
		{
			scanf("%d%d",&karix,&kariy);
			huka[karix][kariy] = 1;
		}
		int dp[17][17] = {0};
		dp[1][1] = 1;
		for(int i = 1;i<=x;i++)
		{
			for(int j = 1;j <= y;j++)
			{
				dp[i+1][j] += dp[i][j];
				dp[i][j+1] += dp[i][j];
				if(huka[i+1][j] == 1) dp[i+1][j] = 0;
				if(huka[i][j+1] == 1) dp[i][j+1] = 0;
			}
		}
		printf("%d\n",dp[x][y]);
	}
	return 0;	
}

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

int main(){
  string S;
  cin >> S;
  if(S.size()<4){
    cout << "No" << endl;
  }
  else{
    if(S.at(0)=='Y' && S.at(1)=='A' && S.at(2)=='K' && S.at(3)=='I'){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n,a[4][13]={},x,y;
	char c[] = "SHCD",b;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> b >> y;
		for(int j=0;j<4;j++) if(b==c[j]) x = j;
		a[x][y-1] = 1;
	}
	for(int i=0;i<4;i++){
		for(int j=0;j<13;j++) if(a[i][j]==0) cout << c[i] << " " << j+1 << endl;
	}
	return 0;
}



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

if a<=b:
	if b<=c:
		print(a,b,c,sep=" ")
	else:
		if a<=c:
			print(a,c,b,sep=" ")
		else:
			print(c,a,b,sep=" ")
else:#b
	if a<=c:
		print(b,a,c,sep=" ")
	else:
		if b<=c:
			print(b,c,a,sep=" ")
		else:
			print(c,b,a,sep=" ")
			

Measured memory_bytes: 7636
#include <bits/stdc++.h>
using namespace std;
int powint(int x,int y){
  int resp=1;
  for(int i=0;i<y;i++)resp*=x;
  return resp;
}

int countbitsum(int n,int x){
  int re=0;
  for(int i=0;i<n;i++){
    if(x%2==1)re++;
    x/=2;
  }
  return re;
}

int main() {
  int n,m,res=0;
  cin >> n >> m;
  int joutai=powint(2,n);//スイッチの状態数
  int s,lamp[m]={0},k[m],p[m];
  for(int i=0;i<m;i++){
    cin >> k[i];
    for(int j=0;j<k[i];j++){
      cin >> s;
      lamp[i]+=powint(2,s-1);
    }
  }
  for(int i=0;i<m;i++){
    cin >> p[i];
  }
  int loop;
  for(int i=0;i<joutai;i++){
    loop=1;
    for(int j=0;j<m;j++){
      if(loop==1 && countbitsum(n,i&lamp[j])%2!=p[j]){
        res--;
        loop=0;
      }
    }
    res++;
  }
  cout << res << endl;
}


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

int main(int argc, const char * argv[]) {
    int A, B;
    int count = 0;
    
    cin >> A >> B;
    for (int i = A; i <= B; i++) {
        char s[10] = {0};
        sprintf(s, "%d", i);
        bool isPalindromic = true;
        for (int j = 0; j < strlen(s); j++) {
            if (s[j] != s[(strlen(s) - 1) - j]) {
                isPalindromic = false;
                break;
            }
        }
        if (isPalindromic) count++;
    }
    
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int f[10010],a[1010],b[1010];
int main()
{
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int tot=read(),n=read();
	for(int i=1;i<=n;i++)a[i]=read(),b[i]=read();
	memset(f,-1,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=tot;j++)
		{
			if(f[j]==-1)continue;
			int ul=min(tot,j+a[i]),uf=f[j]+b[i];
			if(f[ul]==-1)f[ul]=uf;
			else f[ul]=min(f[ul],uf);
		}
	}pr2(f[tot]);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
using namespace std;
int main(void){
	int n,t,diff=0,soma=0,menor = INT_MAX;
	cin >>n >> t;
	int arr[n];
	for(int i=0;i<n;i++)cin>>arr[i];
	for(int i=0;i<n;i++){
		menor= min(menor,arr[i]);
		if(arr[i]-menor>diff){
			soma=1;
			diff= arr[i]-menor;
		}
		else if(arr[i]-menor==diff)soma++;
	}
	cout << soma <<endl;
}

Measured memory_bytes: 3988
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

int main(){
    int n,m,l;
    cin >> n >> m >> l;
    vector<vector<int>> a(n,vector<int>(m));
    vector<vector<int>> b(m,vector<int>(l));

    vector<vector<ll>>c(n,vector<ll>(l));

    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }
    rep(i,m){
        rep(j,l){
            cin >> b[i][j];
        }
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < l; j++){
            ll cnt = 0;
            for(int k = 0; k < m; k++){
                cnt += a[i][k]*b[k][j];
            }
            c[i][j] = cnt;
        }
        
    }

    rep(i,n){
        rep(j,l){
            cout << c[i][j];
            if(j < l - 1){
                cout << " ";
            }
        }
        cout << endl;
    }

}


Measured memory_bytes: 3276
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

double dis(ll x,ll y,ll X,ll Y){
    return sqrt((x-X)*(x-X)+(y-Y)*(y-Y));
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<setprecision(20);

    double ans=0;
    int n;cin>>n;
    vector<ll> x(n),y(n);
    rep(i,n) cin>>x[i]>>y[i];
    vector<int> v(n);
    iota(ALL(v),0);
    ll cnt=0;
    do{
        double sum=0;
        for(int i=0;i<n-1;i++){
            sum+=dis(x[v[i]],y[v[i]],x[v[i+1]],y[v[i+1]]);
        }
        cnt++;
        ans+=sum;
    }while(next_permutation(ALL(v)));
    cout<<ans/cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
xyh = [tuple(map(int,input().split())) for i in range(n)]
for xi,yi,hi in xyh:
    if hi:
        xt,yt,ht = xi,yi,hi

for i in range(101):
    for j in range(101):
        a = ht+abs(i-xt)+abs(j-yt)
        for xi,yi,hi in xyh:
            x = max(a - abs(xi-i)-abs(yi-j),0)
            if hi != x:
                break
        else:
            print(i,j,a)
            exit(0)


Measured memory_bytes: 9164
r, c = [int(x) for x in input().split()]
a = [[int(x) for x in input().split()] for y in range(r)]
b = []

for i in range(r):
    a[i].append(sum(a[i]))

for i in range(c):
    n = 0
    for j in range(r):
        n += a[j][i]
    b.append(n)

b.append(sum(b))
a.append(b)

for i in a:
    i = [str(x) for x in i]
    print(' '.join(i))

Measured memory_bytes: 7736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<string> v;
    for(int i = 0; i < N; i++) {
        string s;
        cin >> s;
        v.push_back(s);
    }

    sort(v.begin(), v.end());
    int ans = 1;
    for(int i = 1; i < N; i++) {
        if(v[i - 1].compare(v[i]) != 0) ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 11656
#include <iostream>

using namespace std;

int main() {
  string b;
  cin >> b;
  if (b == "A") {
    cout << "T" << endl;
  } else if (b == "T") {
    cout << "A" << endl;
  } else if (b == "C") {
    cout << "G" << endl;
  } else if (b == "G") {
    cout << "C" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, i, z;
    scanf("%d %d", &a, &b);

    while(a && b) {
        if(a == 0 && b==0) break;
        z = 1;

        for(i=a; i<=b; i++) {
            if(i%4 == 0) {
                if(i%400 == 0 && i%100 == 0)
                    printf("%d\n", i);
                if(i%100)
                    printf("%d\n", i);
                z = 0;
            }
        }
        if(z) puts("NA");
        if(scanf("%d %d", &a, &b) && a&&b) puts("");
    }

    return (0);
}

Measured memory_bytes: 612
N, M = map(int, input().split())
edges = [list(map(int, input().split())) for _ in range(M)]
 
graph = [[False] * N for _ in range(N)]
for u, v in edges:
    graph[u - 1][v - 1] = True
    graph[v - 1][u - 1] = True
 
visited = [False] * N
visited[0] = True
 
def dfs(s):    
    if all(visited):
        return 1
 
    cnt = 0
    for i in range(N):
        if not graph[s][i]:
            continue
        
        if visited[i]:
            continue
            
        visited[i] = True
        cnt += dfs(i)
        visited[i] = False
        
    return cnt
 
print(dfs(0))

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

constexpr int mod = 1e9+7;

vector<int> g[200005];
map<int, int> match;
int pw2[200005];
long long dp[200005];

deque<pair<int,int>> foo(int c) {
  deque<pair<int,int>> ret;
  if(g[c].empty()) {
    ret.emplace_back(1,1);
    return ret;
  }


  vector<deque<pair<int,int>>> dl;
  for(int i : g[c])
    dl.push_back(foo(i));
  int mi = 0;
  for(int i=1;i<dl.size();i++) {
    if(dl[i].size() > dl[mi].size()) mi = i;
  }
  dl.back().swap(dl[mi]);
  ret = move(dl.back());
  dl.pop_back();
  int m = 0;
  for(auto &l : dl) {
    m = max(m, (int)l.size());
    for(int i=0;i<l.size();i++) {
      long long tot = (ret[i].first + ret[i].second + dp[i]) % mod;
      tot = tot * (l[i].first + l[i].second) % mod;
      int tz = 1LL * ret[i].first * l[i].first % mod;
      int to = 1LL * ret[i].first * l[i].second % mod;
      to = (to + 1LL * ret[i].second * l[i].first) % mod;
      dp[i] = (tot - tz - to + mod*2) % mod;
      ret[i] = {tz, to};
    }
  }
  for(int i=0;i<m;i++)
    ret[i].first = (ret[i].first + dp[i])%mod;
  memset(dp,0,sizeof(long long)*m);
  ret.emplace_front(1,1);
  return ret;
}

int main() {
  int n;
  scanf("%d",&n);
  pw2[0] = 1;
  for(int i=1;i<=n+1;i++)
    pw2[i] = pw2[i-1]*2%mod;
  for(int i=0;i<=n+1;i++)
    match[pw2[i]] = pw2[n+1-i];
  for(int i=1;i<=n;i++) {
    int x;
    scanf("%d",&x);
    g[x].push_back(i);
  }
  deque<pair<int,int>> ret = foo(0);
  int ans = 0;
  for(auto &p : ret) {
    int tot = (p.first + p.second) % mod;
    int tmp = 1LL * p.second * match[tot] % mod;
    ans = (ans + tmp) % mod;
  }
  printf("%d\n",ans);
}


Measured memory_bytes: 193256
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

int current[26] = {};
int nex[26] = {};

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

  int N;
  cin >> N;

  REP(i, 26) {
    current[i] = 100;
  }
  REP(i, N) {
    string s;
    cin >> s;

    REP(j, 26) {
      nex[j] = 0;
    }
    REP(j, s.size()) {
      nex[s[j] - 'a']++;
    }
    REP(j, 26) {
      current[j] = min(current[j], nex[j]);
    }
  }
  REP(i, 26) {
    REP(j, current[i]) {
      cout << (char)('a' + i);
    }
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256