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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 100005;

int n, a[N];

int main() {
	read(n);
	for (int i = 1; i <= n; ++i) {
		read(a[i]);
	}
	std::sort(a + 1, a + 1 + n, std::greater<int>());
	int ans = a[1];
	int k = 2;
	while (k < n && a[k] > 0) {
		ans += a[k];
		++k;
	}
	for (int i = k; i <= n; ++i) {
		ans -= a[i];
	}
	print(ans);
	int now = a[k];
	for (int i = k - 1; i > 1; --i) {
		print(now, ' '), print(a[i]);
		now -= a[i];
	}
	print(a[1], ' '), print(now);
	now = a[1] - now;
	for (int i = k + 1; i <= n; ++i) {
		print(now, ' '), print(a[i]);
		now -= a[i];
	}
}


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

int main()
{
    int n , counter =0;
    string str ;
    cin >> n >> str ;

    for (int i =0 ; i<n-2 ; ++i)
    {
        if (str[i]=='A'&& str[i+1]=='B'&& str[i+2]=='C')
            ++counter ;
    }

    cout << counter ;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n, m;
	while(scanf("%d %d", &n, &m))
	{
		if(n == 0 && m == 0)
		{
			break;
		}
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

ll mod;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

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


	int P;
	cin >> P;
	int A[3000];
	rep(i, P) cin >> A[i];

	mod = P;

	ll fact[3001];
	fact[0] = 1;
	rep1(i, 3000) fact[i] = fact[i - 1] * i % mod;
	ll C[3000];
	rep(i, P) {
		ll k = fact[i] * fact[P - i - 1] % mod;
		if ((P - i + 1) % 2) k = (mod - k) % mod;
		C[i] = A[i] * modpow(k, mod - 2) % mod;
	}

	ll dp[3001][3001] = {};
	dp[0][0] = 1;
	rep(i, P) {
		rep(j, P) {
			dp[i + 1][j + 1] += dp[i][j];
			dp[i + 1][j] += mod + (-dp[i][j] * i) % mod;
			dp[i + 1][j] %= mod;
		}
	}

	ll kotae[3000] = {};
	rep(i, P) {
		ll mae = 0;
		for (int j = P - 1; j >= 0; j--) {
			ll kari = mae * i;
			mae = (dp[P][j + 1] + kari) % mod;
			kotae[j] = (kotae[j] + mae * C[i])  % mod;
		}
	}
	rep(i, P) cosp(kotae[i]);


	Would you please return 0;
}

Measured memory_bytes: 70784
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		String s = sc.next();
		String s1 = s.substring(0, k-1);
		String s2 = s.substring(k-1, k);
		String s3 = s.substring(k, n);
		s2 = s2.toLowerCase();
		
		System.out.println(s1 + s2 + s3);
	
	}
}

Measured memory_bytes: 22228
//#pragma GCC optimize("-O3")
/*
				C++
				encoding: UTF-8
				Last Modified: 08/Dec/19 05:32:39 PM
*/

#include <bits/stdc++.h>
#ifdef H4wk3ye
#	include <prettypr.hpp>
#endif

using namespace std;

// clang-format off

#define		int                    long long
#define		ve                     vector
#define		pb                     push_back
#define		endl                   "\n"
#define		ff                     first
#define		ss                     second
#define		pii                    pair<int, int>
#define		len(v)                 (int)v.size()
#define		all(v)                 v.begin(), v.end()
#define		reset(a, b)            memset(a, b, sizeof(a));
#define		fr(i, s, n)            for (int i = s ; i < n ; ++i)
#define		dfr(i, s, n)           for (int i = s ; i > n ; --i)

template < typename T > void pr (const T& t) {
    cout << t << "\n";
}

template < typename T, typename U, typename... ARGS >
void pr (const T& t, const U& u, const ARGS&... args) {
    cout << t << " ";
    pr (u, args...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	string s;
	cin >> s;
	int l = 0, h = len (s) - 1;
	int ans = 0;
	while (l < h) {
		if (s[l] != s[h]) ans++;
		l++;
		h--;
	}
	pr (ans);
	return 0;
}

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

int H, W;
int wall[1002][1002];

int MOD = int(1e9) + 7;
long long dp[1002][1002];

int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++) {
            char c; cin >> c;
            wall[i][j] = (c == '#' ? 1 : 0);
        }
    // --
    dp[0][0] = 1;
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++) {
            if (wall[i][j]) continue;
            dp[i][j] %= MOD;
            dp[i+1][j] += dp[i][j];
            dp[i][j+1] += dp[i][j];
        }
    //
    cout << dp[H-1][W-1] << endl;
}

Measured memory_bytes: 15200
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
   char c;
   cin>>c;

   cout<<(char)(c+1)<<endl;
   return 0;
}


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		long one = (long) n * (n + 1) / 2;
		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}
		if (sum % one != 0) {
			System.out.println("NO");
			return;
		}

		int[] b = new int[n];
		for (int i = 0; i < n - 1; i++) {
			b[i] = a[i + 1] - a[i];
		}
		b[n - 1] = a[0] - a[n - 1];

		long t = sum / one;
		for (int i = 0; i < n; i++) {
			b[i] -= t;
			if (b[i] > 0) {
				System.out.println("NO");
				return;
			}
			b[i] *= -1;
			if (b[i] % n != 0) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 39892
#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <array>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <cmath>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

#pragma GCC optimize("Ofast, unroll-loops", "omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getrnd(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2> inline bool relax(T1& a, const T2& b) {
    return a > b ? a = b, true : false;
}

template <typename T1, typename T2> inline bool strain(T1& a, const T2& b) {
    return a < b ? a = b, true : false;
}

// :::::::::::::::::::::::::::::::

void solve() {
    int n;
    cin >> n;
    
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    
    vector<int> l(n + 1, -1), r(n + 1, -1);
    for (int i = 0; i < n; ++i)
        r[a[i]] = i;
    for (int i = n - 1; i >= 0; --i)
        l[b[i]] = i;
    
    int mx = 0;
    for (int i = 0; i <= n; ++i)
        if (r[i] != -1 && l[i] != -1)
            strain(mx, r[i] - l[i] + 1);
    
    vector<int> res(n);
    for (int i = 0; i < n; ++i)
        res[(i + mx) % n] = b[i];
    for (int i = 0; i < n; ++i) {
        if (res[i] == a[i]) {
            cout << "No\n";
            return;
        }
    }
    
    cout << "Yes\n";
    for (int i : res)
        cout << i << ' ';
    cout << '\n';
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    srand(time(0));
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}


Measured memory_bytes: 7164
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n,x,i,b,ans=0;
	int blst[110]={0};
	scanf("%d %d",&n,&x);
	for(i=0;i<n;i++)
	{
		scanf("%d",&b);
		if(i==0)blst[i]=b;
		else blst[i]=blst[i-1]+b;
	}
	for(i=0;i<n;i++)
	{
		if(blst[i]>x)break;
	}
	printf("%d",i+1);
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int N, M, start;
	int i;
	int up = 0, down = 0;
	int gate[100] = {};

	scanf("%d %d %d", &N, &M, &start);

	int middle = 0;
	for ( i = 0; i < M; i++)
	{
		scanf("%d", &gate[i]);
		if (gate[i] < start)
			middle++;
	}

	if (middle <= M - middle)
		printf("%d", middle);
	else
		printf("%d", M - middle);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll Cal(ll,ll);
int main(){
  ll cnt,cnt2,b,cal,p,r;
  char com;
  string str,in;
  while(1){
    cin >> in;
    if(in=="#") break;
    str.clear();
    for(int i=0;i<in.size();i++){
      if(in[i]=='n'||in[i]=='w') str+=in[i];
    }
    reverse(str.begin(),str.end());
    if(str[0]=='n') com='w',cal=0;
    else com='n',cal=90;
    cnt=0;
    int flag=0;
    for(int i=1;i<str.size();i++){
      if(flag==0&&str[i]==com){
	flag=1;
	b=i;
      }
      if(str[i]=='n'||str[i]=='w') cnt++;
    }
    p=(ll)pow(2,cnt);
    if(str[0]=='w') cal=(ll)pow(2,cnt)*90;
    cnt2=0;
    for(int i=1;i<str.size();i++){
      if(str[i]=='n'||str[i]=='w') cnt2++;
      if(i>=b){
	if(str[i]=='n'){
	  cal-=(ll)p/pow(2,cnt2)*90;
	}
	else if(str[i]=='w'){
	  cal+=(ll)p/pow(2,cnt2)*90;
	}
      }
    }
    if((ll)cal%p!=0){
      r=(ll)Cal(cal,p);
      cout << (ll)cal/r << '/' << (ll)p/r << endl;
    }
    else cout << cal/p << endl;
  }
  return 0;
}
ll Cal(ll a,ll b){
  ll cp;
  if(a<b) swap(a,b);
  while(a%b!=0){
    cp=a;
    a=b;
    b=cp%b;
  }
  return b;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    int N; ll D;
    cin >> N >> D;
    int ans = 0;
    rep(i, N){
        ll x, y;
        cin >> x >> y;
        ans += (x*x+y*y <= D*D);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int src,dest;
};
stack<Edge> edges;
int main() {
    int n,k,mx;
    scanf ("%d",&n);
    mx = ((n-1)*(n-2))>>1;
    for (int x = 1; x <= n-1; x++) {
      for (int y = x + 1; y <= n; y++) {
        edges.push({x,y});
      }
    }
    scanf ("%d",&k);
    if (k > mx) return !printf ("-1\n");
    while (k--) edges.pop();
    printf ("%d\n",edges.size());
    while (!edges.empty()) printf ("%d %d\n",edges.top().src,edges.top().dest), edges.pop();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <climits>
#include <math.h>
#include <memory.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N, M;
int cnt = 0;
ll ans = 0LL;
int i_index;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};
string board[64];
int main(){
    int A[3], K;
    for(int i = 0; i < 3; i++) cin >> A[i];
    cin >> K;
    sort(A, A + 3);
    rep(j, K){
        A[2] *= 2;
        sort(A, A + 3);
    }
    rep(i, 3) cnt += A[i];
    cout << cnt << endl;
}

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

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

struct modint {
    static const int MOD = 998244353;

    int v;
    modint(const int _v = 0): v(_v % MOD) {
        if (v < 0) v += MOD;
    }

    bool operator==(const modint& other) const {
        return v == other.v;
    }

    modint& operator+=(const modint& other) {
        v += other.v;
        if (v >= MOD)
            v -= MOD;
        return *this;
    }

    modint& operator-=(const modint& other) {
        v -= other.v;
        if (v < 0)
            v += MOD;
        return *this;
    }

    modint& operator*=(const modint& other) {
        v = 1LL * v * other.v % MOD;
        return *this;
    }

    modint& operator/=(const modint& other) {
        *this *= other.inv();
        return *this;
    }

    modint operator+(const modint& other) const {
        return modint(v) += other;
    }

    modint operator-(const modint& other) const {
        return modint(v) -= other;
    }

    modint operator*(const modint& other) const {
        return modint(v) *= other;
    }

    modint operator/(const modint& other) const {
        return modint(v) /= other;
    }

    static modint pow(modint b, ll e) {
        modint res = 1;
        for (ll p = 1; p <= e; p <<= 1) {
            if (p & e)
                res *= b;
            b *= b;
        }

        return res;
    }

    modint pow(ll e) const {
        return pow(*this, e);
    }

    modint inv() const {
        return pow(MOD - 2);
    }

    friend ostream& operator<<(ostream& os, modint m) {
        return os << m.v;
    }
};

constexpr int MAXN = 1e5;
modint fact[MAXN], tcaf[MAXN];

void gen_fact() {
    fact[0] = 1;
    for (int i = 1; i < MAXN; ++i) {
        fact[i] = fact[i - 1] * i;
    }

    tcaf[MAXN - 1] = modint(1) / fact[MAXN - 1];
    for (int i = MAXN - 2; i >= 0; --i) {
        tcaf[i] = tcaf[i + 1] * (i + 1);
    }
}

modint choose(int n, int k) {
    assert(n >= 0);
    if (k < 0 or n < k)
        return 0;

    return fact[n] * tcaf[k] * tcaf[n - k];
}

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

    int n;
    cin >> n;

    modint ans = modint::pow(3, n);
    modint cur = 0;
    modint term = 1;
    modint p = 2;
    // n choose k * 2^k for k in range()
    for (int k = n; k > n / 2; --k) {
        cur += term * p;
        // going from n!/k!(n-k)! to n!/(k-1)!(n-k+1)!
        // multiply by k/(n-k+1)
        term /= (n - k + 1);
        term *= k;
        p += p;
    }

    cout << ans - cur << '\n';
 
    return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<stdlib.h>
#define MAX 100000
#define INFTY 1000000001
typedef struct{
  int number;
  char mark;
}card;

card L[MAX/2+2], R[MAX/2+2], M[MAX], Q[MAX];
int n;

void swapCard(card *x, card *y){
  card tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
  return ;
}
void merge(int left, int mid, int right){
  int i, j, k, n1, n2;
  n1 = mid - left;
  n2 = right - mid;
  for (i = 0; i < n1; i++) L[i] = M[left + i];
  for (i = 0; i < n2; i++)R[i] = M[mid + i];
  L[n1].number = INFTY;
  R[n2].number = INFTY;
  i = 0;
  j = 0;
  for(k = left; k < right; k++) {
    if ( L[i].number <= R[j].number ) M[k] = L[i++];
    else M[k] = R[j++];
    }
}

void mergeSort(int left, int right){
  if( left + 1 < right ) {
    int mid = (left + right) / 2;
    mergeSort(left, mid);
    mergeSort(mid, right);
    merge(left, mid, right);
  }
  return;
}

int partition(int p, int r){
  int i, j, key;
  key = Q[r].number;
  j = p-1;
  for (i = p; i < r; i++) {
    if ( Q[i].number <= key ) {
      j++;
      swapCard(&Q[i], &Q[j]);
    }
  }
  swapCard(&Q[j+1], &Q[r]);
  return j+1;
}

void quickSort(int p, int r){
  if ( p < r ) {
    int q = partition(p, r);
    quickSort(p, q-1);
    quickSort(q+1, r);
  }
  return ;
}

int isStable(void){
  int i;
  for (i = 0;i < n; i++) {
    if ( Q[i].mark != M[i].mark) {
      return 0;
    }
  }
  return 1;
}

int main(){
  int i, num;
  char c;
  scanf("%d",&n);
  for (i = 0; i < n; i++) {
    scanf(" %c %d", &c, &num);
    M[i].number = Q[i].number = num;
    M[i].mark = Q[i].mark = c;
  }
  quickSort(0,n-1);
  mergeSort(0, n);
  if ( isStable() ==1)printf("Stable\n");
  else printf("Not stable\n");
  for (i = 0; i < n; i++) printf("%c %d\n", Q[i].mark, Q[i].number);
  return 0;
}



Measured memory_bytes: 4036
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) throws Exception {
		int n=sc.nextInt();
		int m=sc.nextInt();
		sc.nextLine();
		int[] map=new int[128];
		for(int i=0;i<n;i++){
			String str=sc.nextLine();
			for(char c:str.toCharArray()){
				map[c]++;
			}
		}

		int one=(n%2)*(m%2);
		int two=(n/2)*(m%2)+(n%2)*(m/2);
		int four=(n/2)*(m/2);

	
		for(int i='a';i<='z';i++){
			four-=map[i]/4;
			map[i]%=4;
			two-=map[i]/2;
			one-=(map[i]&1);
		}
		String ans="Yes";
		if(four>0)ans="No";
		two+=2*four;
		if(two>0)ans="No";
		System.out.println(ans);
		
		
	
		
	}
}


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

int main() {
    int n,T;
    cin>>n>>T;
    vector<int> a(n),b(n);
    vector<vector<int>> dp(n+1,vector<int>(T+1));
    vector<vector<int>> prev_w(n+1,vector<int>(T+1));
    for (int i=0;i<n;++i) cin>>a[i]>>b[i];

    for (int i=0;i<n;++i) {
        for (int t=0; t<=T; ++t) {
            if (t>=a[i]) {
                if (dp[i+1][t] < dp[i][t-a[i]]+b[i]) {
                    dp[i+1][t]=dp[i][t-a[i]]+b[i];
                    prev_w[i+1][t]=t-a[i];
                }
            }
            if (dp[i+1][t]<dp[i][t]) {
                dp[i+1][t] = dp[i][t];
                prev_w[i+1][t]=t;
            }
        }
    }
    int cur_t=T-1;
    for (int i=n-1;i>=0;--i) {
        if (prev_w[i+1][cur_t]==cur_t-a[i]) b[i]=0;
        cur_t=prev_w[i+1][cur_t];
    }
    sort(b.begin(), b.end());
    int tmp=max(0, b[n-1]);
    cout<<max(dp[n][T], dp[n][T-1]+tmp)<<endl;
    return 0;
}

Measured memory_bytes: 70912
def main():
    import sys
    N=int(sys.stdin.readline())

    xpy=[]
    xmy=[]

    for i in range(N):
        x,y=list(map(int,sys.stdin.readline().split()))
        xpy.append(x+y)
        xmy.append(x-y)

    t1=max(xpy)-min(xpy)
    t2=max(xmy)-min(xmy)

    print(max(t1,t2))

main()

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  map<string, bool> mp;
  for(int i=0;i<n;++i) {
    string s, q; cin >> s >> q;
    if(s == "insert") {
      mp[q] = true;
    } else {
      cout << (mp[q] ? "yes" : "no") << endl;
    }
  }
}



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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll r;
    cin >> r;

    cout << 3*r*r << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
typedef pair<int,int> P;
vector<P> v[1000];
int main(){
  int n,m,a;
  while(cin >> n >> m >> a,n){
    a--;
    rep(i,1000) v[i].clear();
    int h,p,q;
    rep(i,m){
      cin >> h >> p >> q;
      v[h-1].push_back(P(p-1,q-1));
    }
    rep(i,1000){
      int j=999-i;
      rep(k,v[j].size()){
        if(v[j][k].first==a) a=v[j][k].second;
        else if(v[j][k].second==a) a=v[j][k].first;
      }
    }
    cout << a+1 << endl;
  }
  return 0;
}



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

using Int = int;
using namespace std;

#define ARC(i, a, b) for(Int i = (a); i < (b); ++i)
#define RC(i, n) ARC(i, 0, n)
#define ARCH(i, a, b) for(Int i = (a) - 1; i >= (b); --i)
#define RCH(i, n) ARCH(i, n, 0)
template<class T> T ant(const T &a, const T &b){ return a > b ? a : b; };
template<class T> T ont(const T &a, const T &b){ return a < b ? a : b; };
template<class T> T th(T &a, const T &b, T (*f)(const T &, const T &)){ a = f(a, b); }
#define anth(a, b) th(a, b, ant)
#define onth(a, b) th(a, b, ont)

int main(){
	Int n, k;
	cin >> n >> k;
	Int cnt = 0;
	RC(i, n){
		Int h;
		cin >> h;
		if(h >= k) ++cnt;
	}
	printf("%d\n", cnt);
}


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

const int N = 3050;
const int mod = 1e9 + 7;

int dp[N][N][2];

inline void A(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  if (n >= m) {
    int res = 1;
    for (int i = 1; i <= m + m; i ++)
      res = (res << 1) % mod;
    printf("%d\n", res);
    return 0;
  }
  dp[0][0][1] = 1;
  for (int i = 1; i <= n; i ++) dp[0][i][0] = 1;
  for (int i = 0; i < m; i ++)
    for (int j = 0; j <= n; j ++)
      for (int k = 0; k < 2; k ++) {
        if (!dp[i][j][k]) continue;
        if (j > 0) {
          A(dp[i + 1][j][k | (j == 1)], dp[i][j][k]);
          A(dp[i + 1][j - 1][k | (j == 1)], dp[i][j][k]);
        }
        if (j < n) {
          A(dp[i + 1][j][k], dp[i][j][k]);
          A(dp[i + 1][j + 1][k], dp[i][j][k]);
        }
      }
  int ans = 0;
  for (int i = 0; i <= n; i ++) A(ans, dp[m][i][1]);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 71552
n,k = map(int, input().split())
A = list(map(int, input().split()))
s=[0]*(n+1)
for i in range(1,n+1):
    s[i]=s[i-1]+A[i-1]
s1=[0]*(n-k+1)
for i in range(0,n-k+1):
    s1[i]=s[k+i]-s[i]
print((max(s1)+k)/2)

Measured memory_bytes: 25604
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

def solve(lines):
    S = lines.pop(0)
    if S == 'A':
        print('T')
    elif S == 'T':
        print('A')
    elif S == 'C':
        print('G')
    elif S == 'G':
        print('C')

lines = [x.strip() for x in sys.stdin.readlines()]

#
# solve !!
#
solve(lines)

Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
#define MAX 100

int S[MAX];
int top;

void print_stack(void){
  
  int i;
  
  printf("in print_stack function\n");
  for(i=1;i<=top;i++)printf("top=%d => %d\n",i,S[i]);
  printf("\n");
}

int initialize();
int isEmpty();
int isFull();
void push(int);
int pop();

int main(){
  int x,sub;
  char s[1];

  int a,b;

  initialize();
  while(scanf("%s",s) != EOF){
    if(s[0] == '+'){
      //printf("== in if + ==\n");
      push(pop() + pop());
    }else if(s[0] == '-'){
      //printf("== in if - ==\n");
      sub = pop();
      push(pop() - sub);
    }else if(s[0] == '*'){
      //printf("== in if * ==\n");
      push(pop() * pop());
      //a = pop();
      //b = pop();
      //printf("before push -- 1:%d, 2:%d\n",a,b);
      //push(a*b);
      //a = pop();
      //b = pop();
      //printf("after  push -- 1:%d, 2:%d\n",a,b);
      
    }else{
      //printf("== in push value ==\n");
      x = atoi(s);
      push(x);
    }
  }
  printf("%d\n",S[top]);
  return 0;
}
int initialize(){
  top = 0;
}
int isEmpty(){
  return top == 0;
}
int isFull(){
  return top >= MAX - 1;
}
void push(x){

  //printf("x= %d\n",x);
  if(isFull());
  top++;
  //printf("in push:%3d ,%d\n",x,top);/*debug*/
  S[top] = x;
  //print_stack();
}
int pop(){
  
  if(isEmpty());
  top--;
  //printf("in pop :%3d ,%d\n",S[top+1],top+1);/*debug*/
  //print_stack();
  return S[top+1];
}

Measured memory_bytes: 548
#line 2 "/Users/kaage/Desktop/ProgrammingWorkspace/library/other/template.hpp"
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx2")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define all(V) V.begin(),V.end()
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
typedef std::pair<lint, lint> LP;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, lint b) {
	T res(1);
	while(b){
		if(b&1)res*=a;
		a*=a;
		b>>=1;
	}
	return res;
}
lint modpow(lint a, lint b, lint m) {
	lint res(1);
	while(b){
		if(b&1){
			res*=a;res%=m;
		}
		a*=a;a%=m;
		b>>=1;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size()){
		std::cout << vec[i];
		std::cout<<(i==(int)vec.size()-1?"\n":" ");
	}
}
template<typename T>
void printArray(T l, T r) {
	T rprev = std::prev(r);
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
LP extGcd(lint a,lint b) {
	if(b==0)return {1,0};
	LP s=extGcd(b,a%b);
	std::swap(s.first,s.second);
	s.second-=a/b*s.first;
	return s;
}
LP ChineseRem(const lint& b1,const lint& m1,const lint& b2,const lint& m2) {
	lint p=extGcd(m1,m2).first;
	lint tmp=(b2-b1)*p%m2;
	lint r=(b1+m1*tmp+m1*m2)%(m1*m2);
	return std::make_pair(r,m1*m2);
}
template<typename F>
inline constexpr decltype(auto) lambda_fix(F&& f){
	return [f=std::forward<F>(f)](auto&&... args){
		return f(f,std::forward<decltype(args)>(args)...);
	};
}
#line 2 "main.cpp"
int N;
int way[1000010];
int main(){
	std::cin>>N;
	REP(i,N){
		for(int j=i;j<=N;j+=i)way[j]++;
	}
	lint ans=0;
	REP(i,N-1)ans+=way[i];
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 7492
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a.sort()

ans = -1

if n % 2 == 1:
    sum2 = 0
    sum1 = 0
    for i in range(n):
        if n // 2 - 1 <= i <= n // 2:
            sum1 -= a[i]
        elif i < n // 2:
            sum2 -= a[i]
        else:
            sum2 += a[i]
    ans = max(ans, sum2 * 2 + sum1)

    a.reverse()
    sum2 = 0
    sum1 = 0
    for i in range(n):
        if n // 2 - 1 <= i <= n // 2:
            sum1 += a[i]
        elif i < n // 2:
            sum2 += a[i]
        else:
            sum2 -= a[i]
    ans = max(ans, sum2 * 2 + sum1)
else:
    Sum = 0
    for i in range(n):
        if i == n // 2 - 1:
            Sum -= a[i]
        elif i == n // 2:
            Sum += a[i]
        elif i < n // 2:
            Sum -= a[i] * 2
        else:
            Sum += a[i] * 2
    ans = max(ans, Sum)
    
    
print(ans)

Measured memory_bytes: 7484
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		
		sc.close();
		
		if( x+r > W || x-r < 0 || y+r > H || y-r < 0 ) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
		
	}

}

Measured memory_bytes: 26200
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
typedef long long ll;
const int INF = 1e+9+7;
using ipair= pair<int,int>;
bool operator>(const ipair a,const ipair b){return a.first > b.first;};

int main(){
    int N;
    cin >> N;
    vector<int> x(N),y(N),h(N);
    int h_max=0;
    int i_h_max;
    rep(i,N){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i]>h_max){
            h_max=h[i];
            i_h_max=i;
        }
    }

    int ans_x,ans_y,ans_h,H,cnt;
    rep(cx,101){
        rep(cy,101){
            cnt=0;
            H=h[i_h_max]+abs(x[i_h_max]-cx)+abs(y[i_h_max]-cy);
            rep(i,N){
                if(h[i]!=max(0,H-abs(x[i]-cx)-abs(y[i]-cy))) break;
                cnt++;
            }
            if(cnt==N){
                ans_x=cx;
                ans_y=cy;
                ans_h=H;
            }
        }
    }
    cout << ans_x << " " << ans_y << " " << ans_h << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int C,N,l,ans;
    cin >> C >> N;
    C +=1;
    int cakes = 0;
    for (int i=0;i<N;i++){
        cin >>l;
        cakes += l;
    }
    if(cakes%C==0){
        ans = cakes/C;
    }else{
        ans = cakes/C+1;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3108
n = int(input())
a_list = [int(x) for x in input().split()]
a_sum = sum(a_list)
m = 10 ** 9 + 7
ans = 0
for i in range(n - 1):
    a_sum -= a_list[i]
    ans = (ans + a_list[i] * a_sum) % m
print(ans)

Measured memory_bytes: 31524
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    a = f()

    cnt4 = 0
    cnt2 = 0
    cnt = 0
    for i in a:
        if i%4 == 0:
            cnt4 += 1
        elif i%2 == 0:
            cnt2 += 1
        else:
            cnt += 1
    
    if cnt2 == 0:
        if cnt<= cnt4+1:
            print('Yes')
            return
        else:
            print('No')
            return
            
    total = 2* cnt4 + cnt2
    if total>= n:
        print('Yes')
    else:
        print('No')

solve()


Measured memory_bytes: 14484
n = int(input())
not_zero_min = float('inf')
sum = 0
for i in range(n):
    s = int(input())
    if s%10!=0:
        not_zero_min = min(not_zero_min,s)
    sum += s
if sum%10==0:
    if not_zero_min==float('inf'):
        print(0)
    else:
        print(sum - not_zero_min)
else:
    print(sum)


Measured memory_bytes: 2940
N = int(input())
num_list = list(map(int,input().split()))

def pow_2_sum(N):
    count = 0
    while N%2 == 0:
        N = N/2
        count+=1
    return count

x = 0
for i in range(N):
    x = x +pow_2_sum(num_list[i])

print(x)

Measured memory_bytes: 4148
while line = gets
  a, op, b = line.chomp.split(" ")
  break if op == "?"
  a = a.to_i
  b = b.to_i
  if op == '+'
    print a + b, "\n"
  elsif op == '-'
    print a - b, "\n"
  elsif op == '*'
    print a * b, "\n"
  elsif op == '/'
    print a / b, "\n"
  end
end

Measured memory_bytes: 6096
#input
N = int(input())
A = list(map(int, input().split()))

#output
import numpy as np
dp = np.array(A) 

answer = 0
for i in range(60):
    a = np.count_nonzero(dp & 1)
    answer += 2**i*a*(N-a)
    dp >>= 1

print(answer % (10**9+7))

Measured memory_bytes: 43692
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

const int MOD = (int) 1e9 + 7;
const int MAXN = 5000;

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
    if(x < 0)
        x += MOD;
}

vector <int> g[MAXN + 1];

int dp[MAXN + 1][2][MAXN + 1]; // dp[nod][r][sz] = ai sz noduri in comp ta si ai taiat r muchii % 2
int prd[MAXN + 1], weight[MAXN + 1];
int sum[MAXN + 1][2];

void dfs(int nod, int par) {
    int w = 1;
    for(auto it : g[nod]) {
        if(it != par) {
            dfs(it, nod);
            w += weight[it];
        }
    }
    vector <int> cur[2];
    cur[0].resize(1);
    cur[1].resize(1);
    cur[0][0] = 1;
    for(auto it : g[nod]) {
        if(it == par) {
            continue;
        }
        weight[nod] += weight[it];
        vector <int> aux[2];
        aux[0].resize(weight[nod] + 1);
        aux[1].resize(weight[nod] + 1);
        for(int i = weight[nod]; i >= 0; i--) {
            int a = min(i, weight[it]), b = max(1, i + weight[it] - weight[nod]);
            for(int j = a; j >= b; j--) {
                aux[0][i] = (aux[0][i] + 1LL * dp[it][0][j] * cur[0][i - j] + 1LL * dp[it][1][j] * cur[1][i - j]) % MOD;
                aux[1][i] = (aux[1][i] + 1LL * dp[it][0][j] * cur[1][i - j] + 1LL * dp[it][1][j] * cur[0][i - j]) % MOD;
            }
            if(i <= weight[nod] - weight[it]) {
                aux[0][i] = (aux[0][i] + 1LL * cur[0][i] * sum[it][1] + 1LL * cur[1][i] * sum[it][0]) % MOD;
                aux[1][i] = (aux[1][i] + 1LL * cur[0][i] * sum[it][0] + 1LL * cur[1][i] * sum[it][1]) % MOD;
            }
        }
        cur[0] = aux[0];
        cur[1] = aux[1];
    }
    weight[nod]++;
    for(int i = 1; i <= w; i++) {
        dp[nod][0][i] = cur[0][i - 1];
        dp[nod][1][i] = cur[1][i - 1];
    }
    for(int i = 2; i <= w; i += 2) {
        sum[nod][0] = (sum[nod][0] + 1LL * dp[nod][0][i] * prd[i]) % MOD;
        sum[nod][1] = (sum[nod][1] + 1LL * dp[nod][1][i] * prd[i]) % MOD;
    }
}


int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, x, y;
    ios::sync_with_stdio(false);
    cin >> n;
    for(i = 1; i < n; i++) {
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    prd[2] = 1;
    for(i = 4; i <= n; i += 2) {
        prd[i] = (1LL * prd[i - 2] * (i - 1)) % MOD;
    }
    dfs(1, 0);
    int ans = 0;
    for(i = 2; i <= n; i += 2) {
        ans = (ans + 1LL * (dp[1][0][i] - dp[1][1][i] + MOD) * prd[i]) % MOD;
    }
    cout << ans;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 185216
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    string s; cin>>s;
    int a=0,b=0,c=0;
    for (int i=0;i<sz(s);i++){
    	if (s[i]=='a') a++;
    	if (s[i]=='b') b++;
    	if (s[i]=='c') c++;
    } 
    if (max(a,max(b,c))-min(a,min(b,c))>1) cout << "NO" << endl;
    else cout << "YES" << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3732
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x, y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
const int xx = 2e5;
const int Mod = 1e9 + 7;
const int inf = 1e18;
const int Maxn = 20010;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int sum = 0;
  for(char i : s) {
    sum += (i - '0');
  }
  if(sum % 3 == 0) {
    cout << "Yes" << '\n';
  }else {
    cout << "No" << '\n';
  }
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i < (ll)(b); i++)

#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

using namespace std;
using ll = long long;
using vel = vector<ll>;
using ves = vector<string>;
using veb = vector<bool>;

using qul = queue<ll>;

int main() {
    ll ans,x;
    REP(i, 5) {
        cin >> x;
        if(x == 0) {
            ans = i;
            break;
        }
    }
    cout << ans + 1<< endl;
}

Measured memory_bytes: 3620
W,a,b=map(int,input().split())
if a<=b<=a+W or b<=a<=b+W:
    print(0)
else:
    A=[a,a+W]
    B=[b,b+W]
    ans=10**9
    for u in A:
        for v in B:
            ans=min(abs(u-v),ans)
    print(ans)

Measured memory_bytes: 9140
#pragma GCC optimize("Ofast")
#include<vector>
#include<queue>
#include<iostream>
#include<fstream>
#include<string>
#include<cassert>
#include<algorithm>
#include<random>
#include<map>
#include<set>
#include <bitset>
#include<ctime>

using namespace std;

int mod = 998244353;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<int>vi;
typedef vector<ll>vl;
typedef vector<char>vc;
typedef vector<string>vs;
typedef vector<vector<int>>vii;
typedef vector<vector<char>>vvc;
typedef vector<vector<ll>>vll;
typedef vector< pair<ll, ll>>vpll;
typedef vector< pair<ld, ld>>vpld;
typedef vector< pair<int, int>>vpi;
typedef pair<ld, ld>pld;
#define mp make_pair
#define pb push_back

int add(int a, int b)
{
	int c = a + b;
	if (c >= mod)
	{
		c -= mod;
	}
	return c;
}
int dif(int a, int b)
{
	int c = a - b;
	if (c < 0)
	{
		c += mod;
	}
	return c;
}
int mlt(int a, int b)
{
	ll c = a * 1LL * b;
	return c % mod;
}
int ibit(int n, int i)
{
	return ((n >> i) & 1);
}
void outp(vii &ou)
{
	for (int i = 0; i < ou.size(); i++)
	{
		for (int j = 0; j < ou[i].size(); j++)
		{
			cout << ou[i][j] << ' ';
		}
		cout << '\n';
	}
}
int bp(int x, int y)
{
	if (y == 0)
	{
		return 1;
	}
	int a = 0;
	if (!(y % 2))
	{
		a = bp(x, y / 2);
	}
	return (y % 2) ? mlt(bp(x, y - 1), x) : mlt(a, a);
}
int obr(int x)
{
	return bp(x, mod - 2);
}
const int maxn = 200007;
int fact[1000007], ofact[1000007];
vii del(maxn), alldivs(maxn);
vi maxpr(maxn);
vi mu(maxn), sqf(maxn, 1);
void prec()
{
	fact[0] = 1;
	ofact[0] = 1;
	for (int i = 1; i < maxn; i++)
	{
		fact[i] = mlt(fact[i - 1], i);
	}
	//cerr << "sdsds" << endl;
	ofact[maxn - 1] = obr(fact[maxn - 1]);
	for (int i = maxn - 2; i > 0; i--)
	{
		ofact[i] = mlt(ofact[i + 1], i + 1);
	}
}
int c(int a, int b)
{
	return ((a <= b) && (a >= 0)) ? mlt(fact[b], mlt(ofact[a], ofact[b - a])) : 0;
}
ll gcd(ll x, ll y)
{
	//cerr << x << y << endl;
	if (x == 0)return y;
	return(x > y) ? gcd(y, x) : gcd(y%x, x);
}
int solve(vector<int>coefs, int n)
{
	int suum = 0;
	for (int i = 0; i < n; i++)
	{
		int s1 = i, s2 = n - 1 - i;
		if ((s1^s2) == n - 1)
		{
		//	cerr << s1 << ' ' << s2 <<' '<<(s1^s2)<< endl;
			suum ^= coefs[i];
		}
	}
	return suum;
}
int main()
{
	int n, count = 0;
	cin >> n;
	vector<int>v(n);
	for (int i = 0; i < n; i++)
	{
		char x;
		cin >> x;
		v[i]=x-'0';
		v[i]--;
		if (v[i] == 1)count++;
	}
	//cerr << "Here" << endl;
	if (count == 0)
	{
		for (int i = 0; i < n; i++)v[i] /= 2;
		cout << 2 * (solve(v, n));
	}
	else
	{
		for (int i = 0; i < n; i++)v[i] %= 2;
		cout << solve(v, n);
	}
	cin >> n;
}

Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+500;
int a[N];
ll quick(ll a,ll b,ll mod) {
	int ans=1%mod;
	a%=mod;
	while(b) {
		if(b&1)ans=ans*a%mod;
		b>>=1;
		a=a*a%mod;
	}
	return ans%mod;
}
int main() {
	int n;
	scanf("%d",&n);
	int sum=0;
	for(int i=1; i<=n; ++i) {
		scanf("%1d",&a[i]);
		sum+=a[i];
	}
	if(sum>1) {
		ll cut0=0,cut2=0;
		for(int i=1; i<=n; ++i) {
			if(a[i]==1) {
				cut0=(cut0+quick(2,n-i,sum-1))%(sum-1);
				cut2=(cut2+quick(2,n-i,sum+1))%(sum+1);
			}
		}
		for(int i=1; i<=n; ++i) {
			ll ans=0;
			int cut=1;
			if(a[i]==0) {
				ans+=cut2;
				ans=(ans+quick(2,n-i,sum+1))%(sum+1);
			} else {
				ans+=cut0;
				ans=(ans-quick(2,n-i,sum-1)+(sum-1))%(sum-1);
			}
			while(ans>0) {
				ans=ans%__builtin_popcount(ans);
				cut++;
			}
			printf("%d\n",cut);
		}
	} else if(sum==0) {
		for(int i=1; i<=n; ++i) {
			printf("1\n");
		}
	} else {
		for(int i=1; i<=n; i++) {
			if(a[i]==1) {
				printf("0\n");
			} else {
				if(a[n]==1||i==n)printf("2\n");
				else printf("1\n");
			}
		}
	}
	return 0;
}

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

int main(){
	int n;
    cin >> n;
    vector<int> a(n),b(n);
    for(int i=0; i<n; i++) cin >> a[i];
    b=a;
    sort(b.begin(), b.end());
    for(int i=0; i<n; i++){
        if(a[i]==b[n-1]){
            cout << b[n-2] << endl;;
        }else{
            cout << b[n-1] <<endl;
        }
    }

}

Measured memory_bytes: 3200
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String w = sc.next();
        int[] list = new int[27];
        for (char c : w.toCharArray()) {
            list[c - 'a']++;
        }

        for (int i : list) {
            if (i % 2 == 1) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

Measured memory_bytes: 23764
#include<stdio.h>
#include<string.h>

#define N 20000

typedef struct Data{
  int area,pos;
} Data;

Data t[N];
int u[N]; 
int n,i;
char str[N];
int T,U;
int ans,A;
Data B,X;

void D_push(Data );
Data D_pop();
void push(int);
int pop();
void init();
Data makeData(int,int);


int main(){
  
  init();
  
  scanf("%s",str);
  
  n = strlen(str);
  
  for(i = 0;i < n;i++){
    
    if(str[i] == '/'){
      
      if(U == 0)continue;
      A = pop();
      X = makeData(i-A,A);
      ans = ans + i - A;
      while(T > 0){
	B = D_pop();
	if(B.pos < A){
	  D_push(B);
	  break;
	}
	X.area = X.area + B.area;
	if(B.pos < X.pos)X.pos = B.pos;
      }
      D_push(X);
    }else if(str[i] == '\\'){
      push(i);
    }
    
  }
  
  printf("%d\n%d", ans, T);
  for(i = 0;i < T;i++){
    printf(" %d",t[i].area);
  }
  printf("\n");
  return 0;
}

void D_push(Data data){
  t[T++]=data;
}

Data D_pop(){
  return t[--T];
}

void push(int x){
  u[U++]=x;
}

int pop(){
  return u[--U];
}


void init(){
  
  ans=0;
  T=0;
  U=0;
  
}

Data makeData(int x,int y){
  
  Data res;
  
  res.area=x;
  res.pos=y;
  
  return res;
}

Measured memory_bytes: 644
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

print(int(sqrt(N))**2)


Measured memory_bytes: 5324