akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;

#define rep(i, n) for(int i = 0; i < (n); ++i)


int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] != s[s.size() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    string s1 = s.substr(0, (s.size() - 1) / 2);
    string s2 = s.substr((((s.size() + 3) / 2) - 1), s.size() - (((s.size() + 3) / 2) - 1));
    for(int i = 0; i < s1.size(); ++i){
        if (s1[i] != s1[s1.size() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    for (int i = 0; i < s2.size(); ++i) {
        if (s2[i] != s2[s2.size() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<string> vs;
#define fo(i, a, b) for (int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int n, l;
  cin >> n >> l;
  vs s(n);
  re(i, n) cin >> s[i];

  sort(s.begin(), s.end());
  re(i, n) cout << s[i];
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vi l(n);
	rep(i, n) cin >> l[i];
	int ans = 0;
	rep(i, n) repn(j, i + 1, n) repn(k, j + 1, n) if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k]){
		vi a = {l[i], l[j], l[k]};
		if(a[2] < (a[1] + a[0]) && a[1] < (a[2] + a[0]) && a[0] < (a[1] + a[2])){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main(){
	int m[100], f[100], r[100];
    int mf, ct = 0;
    char rt;
    while(true){
        cin >> m[ct] >> f[ct] >> r[ct];
        if(m[ct] == -1 && f[ct] == -1 && r[ct] == -1) break;
        ct++;
    }
    for(int i = 0; i < ct; i++){
        if(m[i] == -1 || f[i] == -1) rt = 'F';
        else{
            mf = m[i] + f[i];
            if(mf >= 80) rt = 'A';
            else if(mf >= 65) rt = 'B';
            else if(mf >= 50) rt = 'C';
            else if(mf >= 30) rt = r[i] >= 50 ? 'C' : 'D';
            else if(mf < 30) rt = 'F';
        }
        cout << rt << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

const ll mx=1e18;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 



ll mod_pow(ll x, ll n){
 ll res=1;
  while(n>0){
   if(n&1) res=res*x%mod;
   x=x*x%mod;
   n>>=1;
}
return res;
}


void solve(){
 ll n;
  cin >> n;
 ll zero=0; 
  map<P,P> mp;
 rep(i,0,n){
   ll a,b;
   cin >> a >> b;
   if(a==0&&b==0){
    ++zero;
     continue;
   }
   ll g=__gcd(abs(a),abs(b));
   a/=g;
   b/=g;
   if(b<0) {
     a=-a;
     b=-b;
   }
   if(b==0&&a<0) a=-a;
    
   if(a<=0) mp[P(b,-a)].fi++;
   else mp[P(a,b)].se++;
   
 }
  
  mint ans=1;
  for(auto p:mp){
    ll s=p.se.fi;
    ll t=p.se.se;
    mint now=1;
    now=now+mod_pow(2,s)-1;
    now=now+mod_pow(2,t)-1;
    ans*=now;
  }
  ans=ans-1;
  ans+=zero;
 cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}  

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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 C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100'000

typedef pair<i64, i64> P;  // <node, edge no.>
i64 N;
vector<P> G[MAX_N];
bool visited[MAX_N];
i64 color[MAX_N - 1];

void solve() {
    i64 K = 0;  // 塗り分けに必要な色の数の最小値
    REP(u, N) {
        chmax(K, SIZE(G[u]));
    }
    cout << K << endl;

    fill(color, color + N - 1, -1);
    fill(visited, visited + N, false);
    queue<P> que;  // <node, 使用した色>
    que.push(mp(0, -1));
    visited[0] = true;
    while (!que.empty()) {
        P uc = que.front(); que.pop();
        i64 nc = uc.S + 1;
        REP(i, SIZE(G[uc.F])) {
            P vi = G[uc.F][i];
            if (visited[vi.F]) continue;

            visited[vi.F] = true;
            color[vi.S] = nc++ % K;
            que.push(mp(vi.F, color[vi.S]));
        }
    }

    REP(i, N - 1) {
        cout << color[i] + 1 << endl;
    }
}

int main() {
    cin >> N;
    i64 u, v;
    REP(i, N - 1) {
        cin >> u >> v;
        u--; v--;
        G[u].pb(mp(v, i));
        G[v].pb(mp(u, i));
    }

    solve();

    return 0;
}

Measured memory_bytes: 9088
// aribon2-6-4_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;
#define MAX_N 100001

bool is_prime[MAX_N];
int cumsum[MAX_N];

void seive(void) {
    REP(n, MAX_N) is_prime[n] = true;
    is_prime[0] = is_prime[1] = false;
    REPN(n, 2, MAX_N){
        if (!is_prime[n]) continue;

        for (int i = 2; n * i <= MAX_N;i++) {
            is_prime[n * i] = false;
        }
    }
}

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int Q; cin >> Q;

    seive();

    REPN(n, 3, MAX_N) {
        bool is2017like = is_prime[n] && is_prime[(n+1)/2];
        cumsum[n] = cumsum[n-1] + is2017like;
    }

    int l,r;
    REP(i, Q){
        cin >> l >> r;
        print(cumsum[r] - cumsum[l-1]);
    }


    return 0;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

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

  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mp[a]++;
  }

  long long ans = 0;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    int value = it->first;
    int cnt = it->second;
    if (cnt < value) {
      ans += cnt;
    } else {
      ans += (cnt - value);
    }
  }
  cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 4736
#include<vector>
#include<iostream>
#include<set>
#include<list>
#include<string>
#include<math.h>
#include<algorithm>
#include<unordered_set>


using namespace std;

int ctoi(char c) {

	switch (c)
	{
	case'0':
		return 0;
	case'1':
		return 1;
	case'2':
		return 2;
	case'3':
		return 3;
	case'4':
		return 4;
	case'5':
		return 5;
	case'6':
		return 6;
	case'7':
		return 7;
	case'8':
		return 8;
	case'9':
		return 9;
	default:
		cout << "ERR_ctoi" << endl;
		return -1;
	};
}
using ull = unsigned long long;
using ll = long long;


int index(int a, int b) {
	int M = max(a, b);
	int m = min(a, b);
	M++;
	m++;
	return M * (M - 1) / 2 + m - 1;
}


vector<int> dp;
vector<int> A;
vector<int> r;

void update(int k1, int k2, int v) {
	if (dp[index(k1, k2)] < v) {
		dp[index(k1, k2)] = v;

		r[k1] = max(r[k1], v);
		r[k2] = max(r[k2], v);
	}
}

int getmax(int k) {
	return r[k];
}

int main() {
	int N;
	cin >> N;
	A.resize(3 * N);
	for (int i = 0; i < 3 * N; ++i) {
		cin >> A[i];
		A[i]--;
	}

	dp.resize(N * (N + 1) / 2);
	for (int& i : dp) i = -1000000;

	dp[index(A[0], A[1])] = 0;

	r.resize(N);
	for (int i = 0; i < N; ++i) {
		r[i] = -1000000;
	}

	r[A[0]] = 0;
	r[A[1]] = 0;

	int combo3 = 0;
	for (int i = 0; i < N - 1; ++i) {
		int ind = 2 + 3 * i;

		if (A[ind] == A[ind + 1] && A[ind + 1] == A[ind + 2]) {
			combo3++;
			continue;
		}

		int a, b, c;
		c = -1;
		if (A[ind] == A[ind + 1]) {
			a = A[ind];
			b = A[ind + 2];
		}
		else if (A[ind + 1] == A[ind + 2]) {
			a = A[ind+1];
			b = A[ind];
		}
		else if (A[ind + 2] == A[ind]) {
			a = A[ind];
			b = A[ind + 1];
		}
		else {
			a = A[ind];
			b = A[ind + 1];
			c = A[ind + 2];
		}

		if (c != -1) {
			int allmax = -10000000;
			vector<int> pmax(N);
			for (int p = 0; p < N; ++p) {
				pmax[p] = getmax(p);
				allmax = max(allmax, pmax[p]);
			}
			
			int aa = dp[index(a, a)];
			int bb = dp[index(b, b)];
			int cc = dp[index(c, c)];

			for (int p = 0; p < N; ++p) {
				update(p, a, pmax[p]);
				update(p, b, pmax[p]);
				update(p, c, pmax[p]);
			}

			update(b, c, 1 + aa);
			update(a, c, 1 + bb);
			update(b, a, 1 + cc);
			update(b, c, allmax);
			update(a, c, allmax);
			update(b, a, allmax);
		}
		else {
			int allmax = -10000000;
			vector<int> pmax(N);
			vector<int> aline(N);
			for (int p = 0; p < N; ++p) {
				pmax[p] = getmax(p);
				aline[p] = dp[index(a, p)];
				allmax = max(allmax, pmax[p]);
			}

			int aa = dp[index(a, a)];
			int bb = dp[index(b, b)];

			for (int p = 0; p < N; ++p) {
				update(p, a, pmax[p]);
				update(p, b, pmax[p]);
				update(p, b, 1 + aline[p]);
			}

			update(a, a, allmax);
			update(a, b, allmax);
			update(a, a, bb + 1);
			update(a, b, aa + 1);
		}
	}

	update(A.back(), A.back(), dp[index(A.back(), A.back())] + 1);

	int res = 0;

	for (int i = 0; i < N; ++i) {
		res = max(r[i],res);
	}

	cout << res + combo3 << endl;
	return 0;
}


Measured memory_bytes: 11176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

constexpr int MOD = 1000000007;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  explicit operator int() { return n; }
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};

vector<mint> F_{1, 1}, R_{1, 1}, I_{0, 1};

void check_fact(int n) {
  for (int i = I_.size(); i <= n; i++) {
    I_.push_back(I_[MOD % i] * (MOD - MOD / i));
    F_.push_back(F_[i - 1] * i);
    R_.push_back(R_[i - 1] * I_[i]);
  }
}

mint I(int n) { check_fact(n); return n < 0 ? 0 : I_[n]; }
mint F(int n) { check_fact(n); return n < 0 ? 0 : F_[n]; }
mint R(int n) { check_fact(n); return n < 0 ? 0 : R_[n]; }
mint C(int n, int r) { return F(n) * R(n - r) * R(r); }
mint P(int n, int r) { return F(n) * R(n - r); }
mint H(int n, int r) { return n == 0 ? (r == 0) : C(n + r - 1, r); }

int modulo(int x) {
  x %= MOD;
  if (x < 0) x += MOD;
  return x;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int N, K; cin >> N >> K;
  vector<int> A(N); rep(i, N) cin >> A[i];
  sort(range(A));
  mint ans;
  rep(i, N) {
    ans += C(i, K - 1) * modulo(A[i]);
    ans -= C(N - (i + 1), K - 1) * modulo(A[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second
int main()
{
    ll a,b;
  cin>>a>>b;
  if(b%a==0) cout<<a+b;
    else cout<<b-a;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<fstream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#include<map>
#include<iomanip>

#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
const vector<VE> DIR{ {-1,0},{1,0},{0,-1},{0,1} };
const llong MOD = 1000000007;
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname);
int range_check(int val, int min, int max) {
	if (val < min) {
		return -1;
	}
	if (val > max) {
		return -1;
	}
	return val;
}
template<class T,class T1>
bool array_find(const T& array, const T1& dst) {
	auto result = find(array.first(), array.end(), dst);
	if (result == array.end()) {
		return false;
	}
	else {
		return true;
	}
}
int main() {
	int a, b;
	cin >> a;
	cin >> b;
	cout << 6-a-b << endl;
	return 0;
}
template<class T>
int dp2csv(const vector<vector<T>> & dp, const string fname) {
	ofstream ofs(fname);
	if (ofs.fail()) { cerr << "cannot open file. :" + fname << endl; return -1; }
	for (auto dp_row : dp) {
		for (auto dp_cell : dp_row) {
			ofs << dp_cell << ",";
		}
		ofs << endl;
	}
	ofs.close();
	return 0;
}


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

using namespace std;

long long gcd(long long n, long long m) {
	if (n < m) {
		swap(n,m);
	}
	if (m == 0) {
		return n;
	}
	return gcd(m,n%m);
}

int main(void) {
	long long A,B;
	cin >> A >> B;
	cout << (A*B)/gcd(A,B) << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int [] array = new int[3];
        for(int i = 0;i<array.length;i++){
            array[i] = scan.nextInt();
        }
        for(int j=0;j<array.length - 1;j++){
            int min_index = j;
            for(int k = j+1; k < array.length; k++){
                if(array[k] < array[min_index]){
                    int temp = array[min_index];
                    array[min_index] =  array[k];
                    array[k] = temp;
                }
            }
        }
       System.out.printf("%d %d %d\n",array[0],array[1],array[2]);
        
    }
}


Measured memory_bytes: 26168
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#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;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
typedef vector<int> VI;


//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  for (int i = 0; i < (n); ++i)



int main() {
	int n;
	cin >> n;
	int temp;
	int sum = 0;
	REP(i, n) {
		cin >> temp;
		if (temp % 2 == 1) {
			sum++;
		}
	}

	if (sum % 2 == 1) {
		ANS("NO");
	}
	else {
		ANS("YES");
	}



	return 0;
}



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

int main() {
    int n; cin >> n;
    int q; cin >> q;
    string s; cin >> s;
    vector<int> acc(n + 1);
    for (int i = 0; i + 1 < n; i++) {
        acc[i + 1] = acc[i] + (s[i] == 'A' && s[i + 1] == 'C');
    }
    while (q--) {
        int l, r; cin >> l >> r; l--, r--;
        cout << acc[r] - acc[l] << endl;
    }
    return 0;
}

Measured memory_bytes: 1408
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int n; cin >> n;
	cout << (n - 2) * 180;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N,A,B;
  cin >> N >> A >> B;
  ll At = A - 1;
  ll Bt = N - B;
  if ((B - A) % 2 == 0) {
    cout << (B - A) / 2 << endl;
  }
  else {
    cout << min((At + N - Bt + 1) / 2,(Bt + N - At + 1) / 2) << endl;
  }
  return 0;
}


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

using namespace std;

int main() {
  int N; cin >> N;
  vector<pair<long long int, long long int>> tasks;
  for(int i = 0; i < N; i++) {
    long long int a, b; cin >> a >> b;
    tasks.push_back(make_pair(b, a));
  }
  sort(tasks.begin(), tasks.end());

  long long times = 0;
  for(auto task: tasks) {
    times += task.second;
    if(times > task.first) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 6384
n, m = map(int, input().split())
p = [0]*m
s = [0]*m
for i in range(m):
    p[i], s[i] = map(str, input().split())
    p[i] = int(p[i])

flag = [0]*n
wa_count_list = [0]*n
wa_count = 0
for i in range(m):
    if s[i] == "WA" and flag[p[i]-1] == 0:
        wa_count_list[p[i]-1] += 1
    elif s[i] == "AC" and flag[p[i]-1] == 0:
        flag[p[i]-1] = 1
    else:
        continue

for i in range(n):
    if flag[i] == 1:
        wa_count += wa_count_list[i]
    else:
        continue

print(flag.count(1), wa_count)



Measured memory_bytes: 58564
#include <stdio.h>
#define MN 200000
typedef long long LL;
int cnt=1; LL ans=0;
char s[MN+5];
int main(){
	scanf("%s",&s[1]);
	for(int i=1;s[i];i++){
		if(s[i]=='W'){
			ans+=i-cnt;
			cnt++;
		}
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;

int main()
{
	long long N, a, xorr = 0, sum = 0, check = 0, ans = 0;
	vector<int> A;

	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a;
		A.push_back(a);
	}

	for (int l = 0; l < N; l++) {
		for (int r = check; r < N; r++) {
			xorr = xorr^A[r];
			sum += A[r];

			if (xorr != sum) {
				ans += r - l;
				check = r;

				xorr = xorr^A[r];
				sum -= A[r];
				break;
			}

			if (r == N-1) {
				ans += N - l;
				check = N - 1;

				xorr = xorr^A[r];
				sum -= A[r];
			}
		}
		xorr = xorr^A[l];
		sum -= A[l];
	}

	cout << ans;

	char qq;
	cin >> qq;
	return 0;
}

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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int x[8];
int y[8];

double dist(int i, int j)
{
	return sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	LL n;
	cin >> n;
	LL ans = LINF;
	for(LL i = 1; i * i <= n; ++i) if (n % i == 0)
		ans = min(ans, n / i + i - 2);
	cout << ans << endl;	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 256
arr = []
while true
  x, y = gets.split(" ").map(&:to_i)

  break if x.zero? && y.zero?
  arr << [ x, y ]
end

arr.each do |val|
  side = ""
  val[0].times do
    val[1].times do
      side += "#"
    end
    side += "\n"
  end
  puts side
  puts "\n"
end

Measured memory_bytes: 14032
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a==b){
            System.out.println("Draw");
        }else if(a==1){
            System.out.println("Alice");
        }else if(b==1){
            System.out.println("Bob");
        }else if(a>b){
            System.out.println("Alice");
        }else{
            System.out.println("Bob");
        }
    }
}

Measured memory_bytes: 21716
N,H = map(int,input().split())
A=[]
B=[]
for i in range(N):
  a,b=map(int,input().split())
  A +=[a]
  B +=[b]
A=sorted(A,reverse=True)
B=sorted(B,reverse=True)
C=A[0]
count=0
for i in range(N):
  if B[i]>=C:
    H -=B[i]
    count +=1
    if H<=0:
      print(count)
      exit()
answer=count-(-H//C)
print(answer)

Measured memory_bytes: 12120
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};
const int mod = 1000000007;
//const int mod = 998244353;


int main() {
    string s; cin >> s;
    if (s[1] == 'B') cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

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

using namespace std;

class city
{
    public:
        int p;
        int year;
        int id;
        int citycode;
};

void printID(int p, int city)
{
    int ptemp = p, citytemp = city;
    int pl = 0, cilen = 0;
    while(ptemp != 0)
    {
        pl++;
        ptemp /= 10;
    }
    while(citytemp != 0)
    {
        cilen++;
        citytemp /= 10;
    }
    for(int i = 0; i < 6 - pl; i++)
    {
        cout << 0;
    }
    cout << p;
    for(int i = 0; i < 6 - cilen; i++)
    {
        cout << 0;
    }
    cout << city;
    cout << endl;
}

bool cmp(city a, city b)
{
    if(a.p == b.p)
    {
        return a.year < b.year;
    }
    return a.p < b.p;
}

bool cmp2(city a, city b)
{
    return a.id < b.id;
}

int main()
{
    int n, m;
    cin >> n >> m;
    city citys[m];
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        citys[i].p = a;
        citys[i].year = b;
        citys[i].id = i;
    }
    sort(citys, citys + m, cmp);
    int x = 1;
    for(int i = 0; i < m; i++)
    {
        if(i == 0)
        {
            citys[i].citycode = x;
            x++;
        }
        else
        {
            if(citys[i].p == citys[i - 1].p)
            {
                citys[i].citycode = x;
                x++;
            }
            else
            {
                citys[i].citycode = 1;
                x = 2;
            }
        }
    }
    sort(citys, citys + m, cmp2);
    for(int i = 0; i < m; i++)
    {
        printID(citys[i].p, citys[i].citycode);
    }
    return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

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

    int ans = k;

    for (int i = 0; i * k <= b; ++i){
        ans = k * i;
        if (a <= ans && ans <= b){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;

    return 0;
    
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

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

    ll N;
    cin >> N;

    ll N1, N2, N3;
    N1 = N % 10;
    N = (N - N1) / 10;
    N2 = N % 10;
    N = (N - N2) / 10;
    N3 = N % 10;
    N = (N - N3) / 10;

    if(N1==7||N2==7||N3==7){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3652
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int tmp = a;
		int sum = 0;
		for(int i = 0; i < 10; i++) {
			if(tmp == 0) break;
			sum += tmp % 10;
			tmp /= 10;
		}
		if(a % sum == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 23636
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
X = input()

popcount = X.count('1')

def mod(popcount):
    if popcount in [0, 1]:
        return [0] * N
    a = []
    base = 1
    for i in range(N):
        if i == 0:
            a.append(1)
        else:
            base = base * 2 % popcount
            a.append(base)
    return a

def summod(modX, popcount):
    if popcount == 0:
        return 0
    a = 0
    for i, x in enumerate(modX):
        if X[i] == '1':
            a = (a + x) % popcount
    return a

modXm = list(reversed(mod(popcount - 1)))
modXp = list(reversed(mod(popcount + 1)))

s_modXm = summod(modXm, popcount - 1)
s_modXp = summod(modXp, popcount + 1)

for i in range(N):
    if X[i] == '1':
        if popcount - 1 == 0:
            print(0)
            continue
        modX, s, m = modXm, s_modXm, popcount - 1
        s = (s + m - modX[i]) % m
    else:
        modX, s, m = modXp, s_modXp, popcount + 1
        s = (s + modX[i]) % m
    ans = 1
    while True:
        pc = bin(s).count('1')
        if pc == 0:
            break
        s = s % pc
        ans += 1
    print(ans)

Measured memory_bytes: 103624
#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 a, b;
    cin >> a >> b;

    int ans = a - 1;
    if (a <= b) ++ans;
    cout << ans << endl;
} 


Measured memory_bytes: 3544
import sys
import numpy as np

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m, c = np.array(na())
b = np.array(na())
ans = 0
for i in range(n):
    a = np.array(na())
    s = c
    s += np.sum(a * b)
    if s > 0:
        ans += 1
print(ans)


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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    unsigned long k, m{0};
    cin >> k;
    if(k)return 0 & puts("0");
    vector<unsigned long> d(N);
    for(unsigned long i = 1; i < N; ++i){
        cin >> k;
        m = max(m, k);
        ++d[k];
    }
    unsigned long ans{1};
    constexpr unsigned long MOD = 998244353;
    const auto& modpow = [](unsigned long a, unsigned long n, unsigned long b){
        b %= MOD;
        a %= MOD;
        while(n){
            if(n & 1)(b *= a) %= MOD;
            (a *= a) %= MOD;
            n >>= 1;
        }
        return b;
    };
    if(d[0])return 0 & puts("0");
    ++d[0];
    for(unsigned long i = 1; i <= m; ++i)ans = modpow(d[i - 1], d[i], ans);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
/*..........AAKASH GOYAL............*/
/*............DAIICT................*/

#include <bits/stdc++.h>
using namespace std;
 
// #define    int                      long long int
 
#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1110111110111
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int tt; cin >> tt; while(tt--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    pll                      pair <long long int , long long int>
#define    ppl                      pair <long long int , pll>              //pair of ll and pair ll 
#define    sp(x)                    setprecision(x)

int32_t main()
{
    speed upp
    int n,m,k,x,ans1=0,ans2=0;
    cin>>n>>m;
    int a[n+1],b[n+1];
    f(i,0,n)
        a[i]=b[i]=0;
    string s;
    f(i,1,m)
    {
        cin>>x>>s;
        if(s=="AC")
        {
            if(a[x]==1)
                continue;
            if(a[x]==0)
            {
                ans1++;
                a[x]=1;
                ans2+=b[x];
            }
        }
        else
            b[x]++;
    }
    cout<<ans1<<" "<<ans2;
}

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

namespace ConsoleApp5
{

    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string[] line = S.Split(' ');
            int N = int.Parse(line[0]);
            int K = int.Parse(line[1]);
            double ans = 0;
            int n = 0;

            for (int i = N; i >= 1; i--)
            {
                for (; ; )
                {
                    if (i * (Math.Pow(2, n)) >= K)
                    {
                        ans = ans + (1.0 / N) * Math.Pow(0.5, n);
                        break;
                    }
                    else
                    {
                        n++;
                    }
                }

            }

            Console.WriteLine(ans);

        }
    }
}

Measured memory_bytes: 11092
n=int(input())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
work=[abs(x[i]-y[i]) for i in range(n)]

p1=sum(work)
p2=(sum([x**2 for x in work]))**0.5
p3=(sum([x**3 for x in work]))**(1/3)
p_inf=max(work)

print(p1)
print(p2)
print(p3)
print(p_inf)


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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int N,X,Y;
	cin >> N >> X >> Y;
	X--,Y--;
	int cnt[N+1];
	memset(cnt,0,sizeof(cnt));
	for(int i=0;i<N;i++)
		for(int j=i+1;j<N;j++)
		{
			int addit = min(abs(j-i),abs(X-i)+abs(Y-j)+1);
			addit = min(addit,abs(X-j)+abs(Y-i)+1);
//			cout << i << ' ' << j << " ==>" << addit << '\n';
			cnt[addit]++;
		}
	for(int i=1;i<N;i++) cout << cnt[i] << '\n';
	return 0;
}


Measured memory_bytes: 256
kazu = int(input())
kazu2 = (kazu % 100) % 10
if kazu2 == 3:
  print("bon")
elif kazu2 == 0 or kazu2 == 1 or kazu2 == 6 or kazu2 == 8:
  print("pon")
else:
  print("hon")

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

int main(){
int N, M;
  cin >> N >> M;
  
  vector<int> H(N);
  
  for(int i=0;i<N;i++){
    cin >> H.at(i);
  }
  
  vector<vector<int>> G(M, vector<int>(2));
  for(int j=0;j<M;j++){
    cin >> G.at(j).at(0) >> G.at(j).at(1);
  }
  
  set<int> MAX;
  set<int> MIN;
  set<int> ALL;
  
  for(int k=0;k<M;k++){
    if(H.at(G.at(k).at(0)-1) > H.at(G.at(k).at(1)-1)){
       MAX.insert(G.at(k).at(0));
       MIN.insert(G.at(k).at(1));
    }
    else if(H.at(G.at(k).at(0)-1) < H.at(G.at(k).at(1)-1)){
       MAX.insert(G.at(k).at(1));
       MIN.insert(G.at(k).at(0));
    }
    else if(H.at(G.at(k).at(0)-1) == H.at(G.at(k).at(1)-1)){
       MIN.insert(G.at(k).at(0));
       MIN.insert(G.at(k).at(1));
    }
      ALL.insert(G.at(k).at(0));
      ALL.insert(G.at(k).at(1));
}
  
  int EX = N - ALL.size();
  
  for(int l=1;l<N+1;l++){
  if(MAX.count(l) && MIN.count(l)){
    MAX.erase(l);
  }
  }
  
  cout << MAX.size() + EX << endl;
}
    
    


Measured memory_bytes: 18524
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
using namespace std;
 
//#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
struct edge {int from,to,cost;};

signed main(){
    int n;
    cin >> n;
    int a[114],b[114];
    REP(i,n) scanf("%d",&a[i]);
    REP(i,n) scanf("%d",&b[i]);
    int ans = 0,tmp = 0;
    ans = a[0];
    REP(i,n) ans += b[i];
    tmp = ans;
    REP1(i,n-1){
        tmp -=b[i-1];
        tmp += a[i];
        ans = max(ans,tmp);
    }
    printf("%d\n",ans);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int a[10000];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int cnt=0;
    for(int i=1;i<n;i++){
        if(a[i]==a[i-1]){
            a[i]=n+i;
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}

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

#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<int,pi>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int I_LIMIT = 999999999;
ll L_LIMIT = 999999999999999999;
ll mod = 1e9+7;

void solve()
{
    int i,j,ans=I_LIMIT,cnt;
    string s,t;
    cin>>s>>t;

    int n = s.length();
    int m = t.length();
    
    for(i=0;i<n-m+1;i++)
    {
        cnt=0;
        for(j=0;j<m;j++)
        {
            if(s[i+j]!=t[j])
                cnt++;
        }
        ans = min(ans,cnt);
    }
    cout<<ans<<endl;
}
int main()
{
    IOS;
    solve();
}


Measured memory_bytes: 3648
/*************************************************************************
  > File Name: f.cpp
  > Author: Samuel
  > Mail: enminghuang21119@gmail.com
  > Created Time: Sun Mar 22 21:56:59 2020
*************************************************************************/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll dp[3010][3010];
const ll mod = 998244353;
int n, s;
ll ans;
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> s;
    for (int i = 1; i <= n; i++) {
        int in;
        cin >> in;
        memcpy(dp[i], dp[i - 1], sizeof(dp[0]));
        dp[i][in] = (dp[i][in] + i) % mod;
        for (int j = 0; j + in <= s; j++)
            dp[i][j + in] = (dp[i][j + in] + dp[i - 1][j]) % mod;
        ans = (ans + dp[i][s]) % mod;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 70912
#include<stdio.h>
#include<stdlib.h>
long compare(const void *a,const void *b){
  return *(long*)b - *(long*)a;
}

int main(){
  long n = 0;
  long a[100000]={};
  long long asum = 0;
  long b[100000]={};
  long long bsum = 0;
  long diff[100000] = {};
  long long minussum = 0;
  long long plussum = 0;
  long minuscnt = 0;
  long result = 0;
  long i = 0;
  scanf("%ld",&n);
  for(i=0;i<n;i++){
    scanf("%ld",&a[i]);
    asum += a[i];
  }  
  for(i=0;i<n;i++){
    scanf("%ld",&b[i]);
    bsum += b[i];
    diff[i] = a[i] - b[i];
    if(diff[i] < 0){
      minussum += -diff[i];
      minuscnt++;
    } 
  }
  
  if(bsum > asum){
    printf("-1");
    return 0;
  }
  qsort(diff,n,sizeof(long),compare);
  
  for(i=0;i<n;i++){
    plussum += diff[i];
    if(plussum >= minussum){
      break;
    }
  }
  if(minussum == 0){
    result = 0;
  }else{
    result = i+1+minuscnt;
  }
  
  printf("%ld",result);
  /*for(i=0;i<n;i++){
    printf("%ld ",diff[i]);
  }*/
  //printf("#%lld",minussum);
  return 0;
}
  
  

Measured memory_bytes: 3324
/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;

public class Main {
	public static void main (String[] args) {
        Scanner sc=new Scanner(System.in);
        int h,a,i,t;
        h=sc.nextInt();
        a=sc.nextInt();
        int f=0;
        for(i=0;i<a;i++)
        {
            t=sc.nextInt();
            h-=t;
            if(h<=0)
            {
                f=1;
            }
        }
        if(f==1)
        {
            System.out.println("Yes");
        }else
        {
            System.out.println("No");
        }
        
        
	}
}

Measured memory_bytes: 48744
import itertools
N = int(input())
position = []
for _ in range(N):
    position.append(list(map(int,input().split())))

ans = 0
for p in itertools.permutations([i for i in range(N)]):
    for i,v in enumerate(p):
        x,y = position[v]
        if i == 0:
            nowx = x
            nowy = y
        else:
            ans += ((x-nowx)**2+(y-nowy)**2)**0.5
            nowx = x
            nowy = y

pattern = 1
for i in range(2,N+1):
    pattern *= i

print(ans/pattern)

Measured memory_bytes: 3064
#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;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
vector<vector<bool> > snsFriend;
vector<bool> visited;
#define MOD (int)(1e9 + 7)
int main(){
  int n,m;
  cin >> n >> m;
  long long x = n;
  long long y = m;
  long long  ans[2] = {1,1};

  while(!(x == 0 && y == 0)){
    ans[0] *= x;
    x--;
    ans[0] = ans[0] % MOD;
    if(x==0 && y==0) break;
    if(x<0 || y<0) break;
    ans[0] *= y;
    y--;
    ans[0] = ans[0] % MOD;
    if(x<0 || y<0) break;
    //cout << ans[0] << endl;
  }
  x = n;
  y = m;
  while(!(x == 0 && y == 0)){
    ans[1] *= y;
    y--;
    ans[1] = ans[1] % MOD;
    if(x==0 && y==0) break;
    if(x<0 || y<0) break;
    ans[1] *= x;
    x--;
    ans[1] = ans[1] % MOD;
    if(x<0 || y<0) break;
  }

  cout << (ans[0] + ans[1]) % MOD << endl;
  return 0;
}


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


int main() {
	string s, t;
	cin >> s >> t;

	bitset<'z' - 'a' + 1> cs;
	for(char i = 'a'; i <= 'z'; i++) {
		char c = 0;
		for(int j = 0; j < s.size(); j++) {
			if(s[j] == i) {
				if(c == 0) {
					c = t[j];
					if(cs[c - 'a']) {
						cout << "No" << endl;
						return 0;
					}
					cs[c - 'a'] = true;
				} else {
					if(t[j] != c) {
						cout << "No" << endl;
						return 0;
					}
				}
			}
		}
	}

	cout << "Yes" << endl;
	return 0;
}


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


class AtCoder:
    def main(self):
        A, B, C = map(int, input().split())

        for i in range(B):
            if (i * A) % B == C:
                print('YES')
                exit()
        print('NO')

# Run main
if __name__ == '__main__':
    AtCoder().main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAX 510000
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < n; ++i)

int main(void)
{
    string s;
    cin >> s;
    if (s[s.size() - 1] == 's')
        cout << s + "es" << endl;
    else
        cout << s + "s" << endl;
}


Measured memory_bytes: 3632
N,K  = map(int, input().split()) 
POINT = [0]*N
OK = [False]*N
Pro = [0]*30
for i in range(N):
    POINT[i] = i+1


for i in range(len(Pro)):
    for j in range(N):
        if OK[j] == False:
            if POINT[j]>=K:
                OK[j] = True
                Pro[i] += 1
            POINT[j] *=2

ans = 0
for i in range(len(Pro)):
    ans +=  Pro[i]/(2**i)

print(ans/N)


Measured memory_bytes: 42092
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()

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

int main() {
    ll N;scanf("%lld",&N);
    ll A[100010];
    rep(i,N) scanf("%lld",&A[i]);
    rep(i,N-1){
        A[i+1] = gcd(A[i],A[i+1]);
    }
    cout << A[N-1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15);
  }
} initializer;

template<typename T> int least_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ffs(n) - 1;
  if (sizeof(T) == 8) return __builtin_ffsll(n) - 1;
}

// n must be greater than 0.
template<typename T> int least_bit_fast(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_ctz(n);
  if (sizeof(T) == 8) return __builtin_ctzll(n);
}

template<typename T> int most_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return n ? 31 - __builtin_clz(n) : -1;
  if (sizeof(T) == 8) return n ? 63 - __builtin_clzll(n) : -1;
}

template<typename T> int count_bit(T n) {
  static_assert(sizeof(T) == 4 || sizeof(T) == 8, "unsupported size");
  if (sizeof(T) == 4) return __builtin_popcount(n);
  if (sizeof(T) == 8) return __builtin_popcountll(n);
}

int main() {
  int n;
  cin >> n;
  cout << (1 << most_bit(n)) << endl;
}



Measured memory_bytes: 256