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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    map<int, int> mp;
    int64_t ans = 0;
    for(int i=0; i<N; i++){
        int v1 = A[i]-i;
        if(mp.count(v1)) ans += mp[v1];
        mp[-A[i]-i]++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13552
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N, M;
bool acc[100010];
int cnt[100010];

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

	cin >> N >> M;
	int p;
	string s;
	rep(i, 0, M)
	{
		cin >> p >> s;
		p--;
		if (s[0] == 'W')
		{
			if (!acc[p])cnt[p]++;
		}
		else
		{
			acc[p] = true;
		}
	}

	int ans[2] = { 0 };
	rep(i, 0, N)
	{
		if (acc[i])
		{
			ans[0]++;
			ans[1] += cnt[i];
		}
	}

	cout << ans[0] << " "<<ans[1] << endl;

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pq_small priority_queue<int,vector<int>,greater<int> >
#define pii pair<int,int>
/**==Info==
*Program:A
*Problem:
*Date:
*Algorithm:
*Stats:*/
int main(int argc,char* argv[]){
	string s;
	cin>>s;
	if(s.find("AC")!=s.npos){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double esp=1e-8;
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define cle(a) while(!a.empty())a.pop()
#define mem(p,c) memset(p,c,sizeof(p))
#define mp(A, B) make_pair(A, B)
#define pb push_back
typedef long long int LL;
const long double PI = acos((long double)-1);
const LL INF=0x3f3f3f3fll;
const int MOD =1e9+7ll;
const int maxn=100010;
int A[maxn];
int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("pentagon.in", "r", stdin);
    //freopen("pentagon.out", "w", stdout);
    int n,k;
    scanf("%d%d",&n,&k);
    int g=0,ma=0;
    for(int x=1;x<=n;x++)
    {
        scanf("%d",&A[x]);
        g=__gcd(g,A[x]);
        ma=max(ma,A[x]);
    }
    if(k>ma||k%g)puts("IMPOSSIBLE");
    else puts("POSSIBLE");
    return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int INF = 1e9, N = 18;

int n;
int a[N], b[N];

int dp[1 << N][N];

int getv(int k, int pos) {
  return ((k ^ pos) & 1) ? b[k] : a[k];
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int s = 1; s < 1 << n; ++s)
    if (s & (s - 1)) {
      int k = __builtin_popcount(s);
      for (int i = 0; i < n; ++i)
        if ((s >> i) & 1) {
          int cost = 0;
          for (int l = i + 1; l < n; ++l)
            if ((s >> l) & 1)
              ++cost;
          dp[s][i] = INF;
          int t = s ^ (1 << i);
          for (int j = 0; j < n; ++j)
            if (((t >> j) & 1) && getv(j, k - 2) <= getv(i, k - 1)) {
              dp[s][i] = min(dp[s][i], dp[t][j] + cost);
            }
        }
    }
  int ans = INF;
  for (int i = 0; i < n; ++i) ans = min(ans, dp[(1 << n) - 1][i]);
  cout << (ans == INF ? -1 : ans) << '\n';

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 18688
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
vector<int>a(n);
for(int i = 0;i<n;i++) cin >> a[i];
vector<bool>bb(1e6+10,0);
vector<bool>b(1e6+10,0);
vector<bool>bbb(1e6+10,0);
sort(a.begin(),a.end());
for(int i = 0;i<n-1;i++){
    if(a[i]==a[i+1]) bb[a[i]] = 1;
}
for(int i = 0;i<n;i++){
    if(b[a[i]]==0&&bbb[a[i]]==0){
            bbb[a[i]] = 1;
            int j = a[i];
        while(j+a[i]<1e6+5){
            b[j+a[i]] = 1;
            j += a[i];
        }
    }
}
int ans = 0;
for(int i = 0;i<n;i++){
    if(b[a[i]]==0&&bb[a[i]]==0){
        ans++;
    }
}
cout << ans;
return 0;
}

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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
const int maxn = (int) 2e5 + 20;
const int maxm = (int) 1000000 + 20;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL m = MOD) {LL res = 1; for(; n; n >>= 1, a = a * a % m) if(n & 1) res = res * a % m; return res;}

int n, k;
int a[maxn];

LL fac[maxn], ifac[maxn];

LL C(int n, int m) {return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD;}

void work()
{
    cin >>n >>k;
    for(int i = 1; i <= n; i++) cin >>a[i];

    fac[0] = 1;
    for(int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % MOD;
    ifac[n] = fp(fac[n], MOD - 2, MOD);
    for(int i = n - 1; i >= 0; i--) ifac[i] = ifac[i + 1] * (i + 1) % MOD;

    sort(a + 1, a + 1 + n);

    LL ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(n - i >= k - 1)
        {
            ans -= a[i] * C(n - i, k - 1);
            ans %= MOD;
        }
        if(i - 1 >= k - 1)
        {
            ans += a[i] * C(i - 1, k - 1);
            ans %= MOD;
        }
    }

    cout <<(ans + MOD) % MOD <<endl;
}


int main()
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 2176
sa = list(reversed(input()))
sb = list(reversed(input()))
sc = list(reversed(input()))

turn = sa.pop()

while True:
    if (turn == 'a' and not sa) or (
            turn == 'b' and not sb) or (turn == 'c' and not sc):
        break
    if turn == 'a':
        turn = sa.pop()
    elif turn == 'b':
        turn = sb.pop()
    else:
        turn = sc.pop()

print(turn.upper())


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

int main() {

    int A , B;
    cin >> A >> B;

    if(A == 1) A = 14;
    if(B == 1) B = 14;

    if(A > B){
        cout << "Alice" << endl;
    }else if(A == B){
        cout << "Draw" << endl;
    }else{
        cout << "Bob" << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
ll dist[330][330];
ll fuel[330][330];
ll n,m,l,q;
int main(){
    rep(i,330){
        rep(j,330){
            dist[i][j]=LINF;
            fuel[i][j]=LINF;
        }
        dist[i][i]=0;
        fuel[i][i]=0;
    }
    cin>>n>>m>>l;
    rep(i,m){
        ll a,b,c;cin>>a>>b>>c;
        dist[a][b]=c;
        dist[b][a]=c;
    }
    rrep(k,n){
        rrep(i,n){
            rrep(j,n){
                chmin(dist[i][j],dist[i][k]+dist[k][j]);
            }
        }
    }
    rrep(i,n){
        rrep(j,n){
            if(i==j)continue;
            if(dist[i][j]<=l) chmin(fuel[i][j],1ll);
        }
    }
    rrep(k,n){
        rrep(i,n){
            rrep(j,n){
                chmin(fuel[i][j],fuel[i][k]+fuel[k][j]);
            }
        }
    }
    cin>>q;
    while(q--){
        ll s,t;cin>>s>>t;
        if(fuel[s][t]==LINF) cout<<-1<<endl;
        else cout<<fuel[s][t]-1<<endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


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

  int n,k,l,r;
  cin>>n>>k>>l>>r;
  vi a(n);
  rep(i,n){
    cin>>a[i];
  }

  vector<vi> v1(n/2+1);
  vector<vi> v2(n/2+n%2+1);

  rep(bit,1<<(n/2)){
    int cnt=0;
    int s=0;
    rep(i,n/2){
      if(bit&(1<<i)){
        cnt++;
        s+=a[i];
      }
    }
    v1[cnt].PB(s);
  }

  rep(bit,1<<(n/2+n%2)){
    int cnt=0;
    int s=0;
    rep(i,n/2+n%2){
      if(bit&(1<<i)){
        cnt++;
        s+=a[i+n/2];
      }
    }
    v2[cnt].PB(s);
  }

  rep(i,n/2+1){
    sort(all(v1[i]));
  }
  rep(i,n/2+n%2+1){
    sort(all(v2[i]));
  }

  int ans=0;
  rep(i,n/2+1){
    int j=k-i;
    if(j>=v2.size()) continue;
    for(int c:v1[i]){
      //cout<<c<<' '<<j<<endl;
      ans+=upper_bound(all(v2[j]),r-c)-lower_bound(all(v2[j]),l-c);
    }
  }

  cout<<ans<<endl;

}


Measured memory_bytes: 23420
import java.util.Scanner;

public class Main{
	
	void main() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int [n];
		
		for(int i = 0; i <a.length; i++) {
			a[i] = sc.nextInt();
		}
		System.out.print(a[a.length-1]);
		for(int i = a.length-2; i >=0; i--) {
			System.out.print(" " + a[i]);
		}
		System.out.println();

	}

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

	}

}


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

#define debug(x) cerr<<#x<<'='<<x<<' '
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	double h,a;
	cin >> h >> a;
	cout << ceil(h/a);
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();
        pw.println(Math.max(a*c,Math.max(a*d,Math.max(b*c,b*d))));
        pw.flush();
    }

    static class GeekInteger {
        public static void save_sort(int[] array) {
            shuffle(array);
            Arrays.sort(array);
        }
 
        public static int[] shuffle(int[] array) {
            int n = array.length;
            Random random = new Random();
            for (int i = 0, j; i < n; i++) {
                j = i + random.nextInt(n - i);
                int randomElement = array[j];
                array[j] = array[i];
                array[i] = randomElement;
            }
            return array;
        }
 
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }
    
    public String[] nextArray(int n) {
        String[] a = new String[n];
        for (int i = 0; i < n; i++)
            a[i] = next();
        return a;
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}


Measured memory_bytes: 25424
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front

using namespace std;	
typedef long long int lli;

lli n,k,l,m,t,a,b,r,c,temp1,temp2,x,y,temp,q,d,mod=1e9+7,w;

long double dist(lli a,lli b)
{
	return sqrt(a*a +b*b);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>n>>d;
    lli cnt=0;
    for(int i =0;i<n;i++)
    {
    	cin>>a>>b;
    	
    	if(dist(a,b)-d<=0)cnt++;
    }
	
	cout<<cnt<<endl;
}

Measured memory_bytes: 3696
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	static long N;
	static long[] A;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextLong();
		A = new long[(int) N];
		long s = 0;
		for (int i = 0; i < N; ++i) {
			A[i] = sc.nextLong();
			s += A[i];
		}
		long all = N * (N + 1) / 2;
		if (s % all != 0) {
			System.out.println("NO");
			return;
		}
		long K = (s / all);
		long[] diff = new long[(int) N];
		for (int i = 0; i < N; ++i) {
			diff[i] = A[(int) ((i + 1) % N)] - A[i];
		}
		for (int i = 0; i < N; ++i) {
			diff[i] -= K;
			if (diff[i] > 0 || (-diff[i]) % N != 0) {
				System.out.println("NO");
				return;
			}
		}

		System.out.println("YES");

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


Measured memory_bytes: 34052
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 200010;
const int MAXK = 110;
const int MAXQ = 200010;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin >> n;
    cout << n * n * n;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

int f(ll k, int b, ll n) {
	if(k > n) return 0;
	else return (b == 7) + f(10 * k + 3, b | 1, n) + f(10 * k + 5, b | 2, n) + f(10 * k + 7, b | 4, n);
}

int main() {
	ll n;
	cin >> n;
	cout << f(0, 0, n) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long h,n;
  cin>>h;
 // long long a[n+1];
  /*long long sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
  //long long x=h/a;
    //if(h%a==0)
      //  cout<<x<<endl;
   // else
    if(sum>=h)
   cout<<"Yes"<<endl;
   else
    cout<<"No"<<endl;*/
    long long de_counter=1;
    //h=floor(h/2);
    //cout<<h<<endl;
    while(h!=0)
    {
        de_counter=de_counter*2;
        h=floor(h/2);
      //cout<<h<<endl;
    }
    cout<<de_counter-1<<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
typedef vector<ll> vl;
typedef pair<vl,vl> t;

int n;
ll m,a[100005];

int main(){
	cin >> n >> m;;
	rep(i,n) cin >> a[i];
	sort(a,a+n);
	ll lb = -1,ub = 200005;
	while(ub-lb > 1){
		ll mid = (lb+ub)/2;
		ll cnt = 0;
		rep(i,n){
			ll zan = mid-a[i];
			cnt += n - (lower_bound(a,a+n,zan)-a);
		}
		if(cnt >= m) lb = mid;
		else ub = mid;
	}
	
		ll mid = lb;
		ll cnt = 0;
		ll ans = 0;
		rep(i,n){
			ll zan = mid-a[i];
			cnt += n - (lower_bound(a,a+n,zan)-a);
			ans += 2LL * a[i] * (n - (lower_bound(a,a+n,zan)-a));
		}
		
		cout << ans - mid * (cnt-m) << endl;
	
}


Measured memory_bytes: 1024
import java.util.Scanner;


public class Main{

	static Scanner sc = new Scanner(System.in);
	
	static int d, x = 600, y = 0, f, current_x, area;
	
	public static void main(String[] args) {
		
		while(read()){
			solve();
		}
		
	}
	
	public static boolean read(){
		if(!sc.hasNext()) return false;
		
		d = sc.nextInt();
		
		return true;
	}
	
	public static void solve(){
		
		current_x = 0;
		area = 0;
		
		while(current_x < x){
			
			f = current_x * current_x;
			area += f * d;
			
			current_x += d;
		}
		
		System.out.println(area);
	}

}

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

using namespace std;

int main()
{
	int N, sum = 0;
  	cin >> N;
  
  for(int i = 0; i < N; i++){
   int l, r;
    cin >> l >> r;
    sum += (r-l+1);
  }
  cout << sum << endl;
}

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

#define first  fs
#define second se
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, char s = '\n') { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ") 
{ rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int n, m;
vi G[10];

int dfs(int v = 0, int bit = 1) {
	if (bit == (1 << n) - 1) return 1;
	int ret = 0;

	for (int i = 0; i < G[v].size(); ++i ) {
		if ((1 << G[v][i]) & bit) continue;
		ret += dfs(G[v][i], bit + (1 << G[v][i]));
	}

	return ret;
}
	
int main() {
	cin >> n >> m;
	rep(i, m) {
		int a = in() - 1, b = in() - 1;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	cout << dfs() << endl;
}



Measured memory_bytes: 256
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct flower
{
    int w;
    int f_cost;
    int f;
    int th;
    double w_th;
    void read()
    {
        scanf("%d%d%d%d",&w,&f_cost,&f,&th);
        w_th=(double)th/w;
    }
    friend bool operator < (const flower &a,const flower &b)
    {
        return a.w_th<b.w_th;
    }
};
flower a[100005];
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    for (;;)
    {
        int n,m;
        scanf("%d",&n);
        if (n==0) return 0;
        scanf("%d",&m);
        int i;
        double ans=0;
        for (i=0;i<n;i++)
        {
            a[i].read();
            if ((a[i].w>=0)&&(a[i].th<=0))
            {
                i--;
                n--;
            }
            else if (a[i].w==0)
            {
                ans+=a[i].th*a[i].f_cost/(double)a[i].f;
                i--;
                n--;
            }
        }
        sort(a,a+n);
        double k=0;
        double last_ans=0;
        double last_sol=0;
        for (i=0;i<n;i++)
        {
            if (a[i].th>0)
            {
                last_ans+=a[i].th*a[i].f_cost/(double)a[i].f;
                k-=a[i].w*a[i].f_cost/(double)a[i].f;
            }
        }
        double min_ans=last_ans;
        for (i=0;i<n;i++)
        {
            if (a[i].w_th<0) continue;
            double delta=a[i].w_th-last_sol;
            last_sol=a[i].w_th;
            last_ans+=delta*k;
            last_ans+=delta*m;
            min_ans=min(min_ans,last_ans);
            if (a[i].th>0)
            {
                k+=a[i].w*a[i].f_cost/(double)a[i].f;
            }
            else
            {
                k-=a[i].w*a[i].f_cost/(double)a[i].f;
            }
        }
        printf("%.5lf\n",ans+min_ans);
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;

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

    string S;
    cin >> S;

    vector<int> X(26);

    for(int i = 0; i < 3; i++) {
        X[S[i] - 'a']++;
    }

    if(X[0] == 1 && X[1] == 1 && X[2] == 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
     string s; 
     cin >> s; 
     
     int n = s.size();
     int cnt = 0;
    
     bool f = s[0] == '0';
     
     for(int i=1; i<n; i++){ 
        if(f){ 
           if (s[i] == '0'){
              cnt++;
           }
        }else{
          if (s[i] == '1'){ 
              cnt++; 
          } 
        }
       
     f = !f;	
     }
  cout << cnt << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
#define mp make_pair
#define mod 1000000007
#define INF 1e9+5
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define forn(i,a,b) for(int i=a;i<(int)b;i++)
#define ff first
#define ss second
#define int long long
ll min(ll a, ll b) {return a>b?b:a;}
ll max(ll a, ll b) {return a>b?a:b;}
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    string str;
    cin>>str;
    int ans=0;
    int arr[100][n];// 0 for red, 1 for green and 2 for blue 17+6+1=24
    memset(arr, 0, sizeof(arr));
    arr[str[n-1]-'A'][n-1]=1;
    for(int i=n-2;i>=0;i--)
    {
        arr['R'-'A'][i]=arr['R'-'A'][i+1];
        arr['G'-'A'][i]=arr['G'-'A'][i+1];
        arr['B'-'A'][i]=arr['B'-'A'][i+1];
        arr[str[i]-'A'][i]++;
    }
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n-1;j++)
        {
            if(str[i]==str[j])
                continue;
            int k=24-(str[i]-'A')-(str[j]-'A');
            ans+=arr[k][j];
            int lol=2*j-i;
            if(lol>j && lol<n && (str[lol]-'A')==k)
                ans--;
        }
    }
    cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 6740
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) % 2 == 0) {
        System.out.println("Even");
      } else {
        System.out.println("Odd");
      }
  }
}

Measured memory_bytes: 21460
S = input()
ACGT = ['A', 'C', 'G', 'T']
res = 0
idx = 0
while idx < len(S):
    if S[idx] in ACGT:
        tmp = S[idx]
        while idx + 1 < len(S) and S[idx+1] in ACGT:
            tmp += S[idx+1]
            idx += 1
        if res < len(tmp):
            res = len(tmp)
    idx += 1
print(res)

Measured memory_bytes: 9080
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
string s; int c;
int main()
{
	cin>>s;
	for (int i=0;i<s.size();i++)
	{if (s[i]=='C') c++; if (s[i]=='F'&&c>0) {printf("Yes"); return 0;}}
	printf("No");
	return 0;
}

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

typedef long long ll;
typedef pair<ll,ll> P;

struct BIT{
    int N;
    vector<ll> bit;
    void init(int n){
        N = n;
        bit.resize(n+1);
    }
    ll sum(int i){
        ll s = 0;
        while(i > 0){
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }
    void add(int i, ll x){
        while(i <= N){
            bit[i] += x;
            i += i & -i;
        }
    }
};

int main(){
    ll n, k, ans = 0;
    cin >> n >> k;
    vector<ll> a(n+1);
    for(int i=0;i<n;i++){
        cin >> a[i+1];
        a[i+1] -= k;
        a[i+1] += a[i];
    }
    vector<P> pos(n+1);
    for(int i=0;i<=n;i++){
        pos[i] = P(a[i],i);
    }
    sort(pos.begin(), pos.end());
    BIT bit;
    bit.init(n+2);
    for(int i=0;i<=n;i++){
        int idx = abs(pos[i].second)+1;
        ans += bit.sum(idx);
        bit.add(idx,1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#pragma GCC optimization ("O3")

#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define ld long double
#define bit(idx) idx&(-idx)
#define bin(x, a) bitset<a>(x)
#define all(A) A.begin(), A.end()
#define de(x) cout << #x << " = " << x << endl;
#define row vector<ll>
#define matrix vector<row>

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
/// find_by_order(x) -> x-th element in the set
/// order_of_key(x)  -> how many elements are smaller than x
/// insert(x) -> inserts x into the set



int main(){
	/// ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll a, b, c, d; cin >> a >> b >> c >> d;
	cout << max({a * c, b * c, a * d, b * d}) << endl;
}
/**

*/

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

#include <cstdio>
#include <cstdint>
#include <unistd.h>
#include <algorithm>

using i64 = std::uint_fast32_t;

namespace io {
  constexpr int is = 1 << 17;
  char ib[is], *ip = ib + is, it;
  inline char getc() {
    if (ip == ib + is) { read(STDIN_FILENO, ib, is); ip = ib; }
    return *ip++;
  }
  inline i64 scan() {
    i64 r = 0;
    if (ip + 16 > ib + is) while ((it = getc()) & 16) r = r * 10 + it - '0';
    else while ((it = *ip++) & 16) r = r * 10 + it - '0';
    return r;
  }
  constexpr int os = 1 << 17;
  char ob[os], *op = ob, ot;
  inline void putc(const char c) {
    *op++ = c;
    if (op == ob + os) { write(STDOUT_FILENO, ob, os); op = ob; }
  }
  /* x shoud be greater than or equal to zero */
  inline void print(i64 x) {
    char d[20];
    int i = 0;
    while (true) {
      d[i] = x % 10 + 48;
      x /= 10;
      ++i;
      if (x <= 0) break;
    }
    while (i--) {
      putc(d[i]);
    }
  }
  inline void flush() {
    write(STDOUT_FILENO, ob, op - ob);
  }
}

i64 H[200000];
signed main() {
  i64 n = io::scan();
  i64 k = io::scan();
  for (int i = 0; i < n; i++) {
    i64 h = io::scan();
    H[i] = h;
  }
  if (k >= n) {
    puts("0");
    return 0;
  }
  std::sort(H, H + n);
  i64 s = 0;
  for (int i = 0; i < n - k; i++) {
    s += H[i];
  }
  io::print(s);
  io::flush();
  return 0;
}

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

typedef long long ll;

ll X,K,D;
ll ans=0;

int main(){
	cin>>X>>K>>D;
	if(X>=0){
		ll low=0,high=K+1,res=K+1;
		while(low<high){
		//	cout<<low<<" "<<high<<endl;
			ll mid=(low+high)>>1;
			if(X/D+10<=mid){
				high=mid,min(res,mid);
				continue;
			}
			ll Y=X-D*mid;
			if(Y<=0) high=mid,res=min(res,mid);
			else low=mid+1;
		}
		if(res==K+1){
			ans=X-K*D;
		}
		else{
			if((K-res)%2==0) ans=X-res*D;
			else ans=X-res*D+D;
		}
	}
	else{
		ll low=0,high=K+1,res=K+1;
		while(low<high){
			ll mid=(low+high)>>1;
			if(X/D-10>=-mid){
				high=mid,res=min(res,mid);
				continue;  
			}
			ll Y=X+D*mid;
			if(Y>=0) high=mid,res=min(res,mid);
			else low=mid+1;
		}
	//	cout<<res<<endl;
		if(res==D+1){
			ans=X+K*D;
		}
		else{
			if((K-res)%2==0) ans=X+res*D;
			else ans=X+res*D-D;
		}
	}
	cout<<abs(ans)<<endl;
}

/*
-100000000000000 100000000000000 100000000000000
*/

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

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

int main(){
  int n, m, x, y, a0, a1, b0, b1;
  cin >> n >> m;
  
  vector<pair<int, int> > robots(m);
  vector<pair<int, int> > lanes(n);
  pair<int, int> newbounds;
  
  REP(i,n){
    lanes[i] = make_pair(i, i+1);
//    printf("(%d, %d)\n", lanes[i].first, lanes[i].second);
  }
  
  REP(i,m){
    cin >> x >> y;
    y--;
    robots[i] = make_pair(x, y);
  }
  
  sort(robots.begin(), robots.end());
//  REP(i,m){
//    printf("robots[%d] = (%d, %d)\n", i, robots[i].first, robots[i].second);
//  }
  
  REP(i,m){
    y = robots[i].second;
    a0 = lanes[y].first;
    a1 = lanes[y+1].first;
    b0 = lanes[y].second;
    b1 = lanes[y+1].second;
//    printf("y=%d, 0: (%d, %d), 1: (%d, %d)\n", y, a0, b0, a1, b1);
    newbounds = make_pair(min(a0, a1), max(b0, b1));
    lanes[y] = newbounds;
    lanes[y+1] = newbounds;
  }
  
  REP(i,n){
    printf("%d", lanes[i].second - lanes[i].first);
    if (i<n-1){
      printf(" ");
    }
  }
  printf("\n");
  
  return 0;
}


Measured memory_bytes: 5108
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

template<typename value_type>
class fast_combination
{
public:
	value_type mod_value;

	vector<value_type> mod_inv;
	vector<value_type> fact;
	vector<value_type> fact_inv;

public:
	fast_combination(const value_type& limit, const value_type& m)
		: mod_value(m), mod_inv(), fact(), fact_inv()
	{
		mod_inv.assign(limit + 1, 0);
		fact.assign(limit + 1, 0);
		fact_inv.assign(limit + 1, 0);

		mod_inv[1] = 1;
		fact[0] = 1;
		fact[1] = 1;
		fact_inv[0] = 1;
		fact_inv[1] = 1;

		for (value_type i = 2; i <= limit; i++)
		{
			mod_inv[i] = (mod_value - ((mod_value / i) * mod_inv[mod_value % i] % mod_value)) % mod_value;
			fact[i] = (fact[i - 1] * i) % mod_value;
			fact_inv[i] = (fact_inv[i - 1] * mod_inv[i]) % mod_value;
		}
	}

public:
	value_type process(const value_type& n, const value_type& r)
	{
		if (n < 0 || r < 0) return 0;
		if (n < r) return 0;

		return (fact[n] * (fact_inv[r] * fact_inv[n - r] % mod_value)) % mod_value;
	}
};

//fast_combination<long long> fc(N, MOD);
//int result = fc.process(n, r);

const long long MOD = 1e9 + 7;

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

	fast_combination<long long> fc(3e6, MOD);

	int r1, c1, r2, c2;
	cin >> r1 >> c1 >> r2 >> c2;

	cout << (fc.process(r2 + 1 + c2 + 1, r2 + 1) - fc.process(r2 + 1 + c1, c1) - fc.process(r1 + c2 + 1, r1) + fc.process(r1 + c1, r1) + 2 * MOD) % MOD << endl;

	return 0;
}

Measured memory_bytes: 70528
#include<bits/stdc++.h> 
using namespace std;
int main()
{
	int n;
  cin>>n;
  int k=n%10;
  string s="";
  if(k==2 || k==4 ||k==5 ||k==7 ||k==9)
    s="hon";
  else if(k==0 ||k==1 ||k==6 ||k==8)
    s="pon";
  else
    s="bon";
  cout<<s;
  return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i<n; i++){
    cin >> p[i];
  }
  int now = p[0];
  int ans = 1;
  for (int i = 1; i < n; i++)
  {
    if(now>p[i]){
      now = p[i];
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
"use strict"

function Main(input) {
  input = input.trim().split('');

  let N = input.length;
  let even = [];
  let odd = [];
  for(let i=0; i<N; i++){
    if((i+1)%2 === 0) {
      even.push(input[i]);
    } else {
      odd.push(input[i]);
    }
  }
  
  let ret = 'Yes';
  if(even.indexOf('R') !== -1) ret = 'No';
  if(odd.indexOf('L') !== -1) ret = 'No';

  console.log(ret);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MAXM 100005
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

int K;
int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

void solve(){

}

int main(){
    cin >> K;

    cout << arr[K-1] << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
using namespace std;
typedef long long LL;
const int MaxN = 1e5;

int a[MaxN + 5];
map <int, int> res;

int main() {
	int n; 
	LL sum = 0;
	res.clear();
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		res[a[i]]++;
	}
	int maxx = 0;
	for(int i = 1; i <= n; i++) {
		if(a[i] > MaxN) {
			sum += 1;
			continue;
		}
		maxx = max(maxx, a[i]);
	}
	for(int i = 1; i <= maxx; i++) {
		if(res[i] && res[i] != i) {
			if(res[i] > i) sum += res[i] - i;
			else if(res[i] < i) sum += res[i];
		}
	}
	printf("%lld\n", sum);
	return 0;
}

Measured memory_bytes: 9216
#include<iostream>
using namespace std;
int main()
{
  int n,l[1111],r[1111],sum=0,c[111111];
  for(int i=0;i<111111;i++)
    c[i]=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>l[i]>>r[i];
    for(int j=l[i];j<=r[i];j++){
      c[j]++;
    }
  }
  for(int i=0;i<=100000;i++){
    if(c[i]>=1)
      sum++;
  }
  cout<<sum<<endl;
  return 0;
}


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

int main(void){
    string s;
    cin >> s;
    rep(i,s.size()){
        s[i] = 'x';
    }
    cout << s << endl;
}

Measured memory_bytes: 256
s=list(input())
k=int(input())
if len(s)<k: #絶対１以外がある。
    i=0
    while s[i]=="1":
        i+=1
    print(s[i])
else: #k番目まですべて１の可能性もある
    ans=s[0]
    for i in range(k):
        if s[i]!="1":
            ans=s[i]
            break
    print(ans)

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

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

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0;i < n;++i) cin >> p[i];
    int ans = 0,mn = 1e9;
    for (int i = 0;i < n;++i) {
        if (p[i] < mn) ans++;
        mn = min(mn,p[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1152
use std::collections::HashMap;
use whiteread::parse_line;

fn main() {
    let w: String = parse_line().unwrap();
    let mut dic: HashMap<char, usize> = HashMap::new();
    let mut ans = "Yes";

    for c in w.as_str().chars() {
        *dic.entry(c).or_insert(0) += 1;
    }
    for v in dic.values() {
        if v % 2 == 1 {
            ans = "No";
            break;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2136
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		Long A[] = new Long[n];

		for (int i = 0; i < n; i++) {
			A[i] = Long.parseLong(br.readLine());
		}

		Arrays.sort(A, Comparator.reverseOrder());

		if (n % 2 == 0) {
			long res = 0;
			for (int i = 0; i < n / 2 - 1; ++i)
				res += A[i] * 2;
			res += A[n / 2 - 1];
			res -= A[n / 2];
			for (int i = n / 2 + 1; i < n; ++i)
				res -= A[i] * 2;
			System.out.println(res);
		} else {
			long res1 = 0;
			for (int i = 0; i < n / 2 - 1; ++i)
				res1 += A[i] * 2;
			res1 += A[n / 2 - 1] + A[n / 2];
			for (int i = n / 2 + 1; i < n; ++i)
				res1 -= A[i] * 2;

			long res2 = 0;
			for (int i = 0; i < n / 2; ++i)
				res2 += A[i] * 2;
			res2 -= A[n / 2] + A[n / 2 + 1];
			for (int i = n / 2 + 2; i < n; ++i)
				res2 -= A[i] * 2;
			System.out.println(Math.max(res1, res2));
		}
	}
}

Measured memory_bytes: 46036
// Bismillaahirrahmaanirrahiim
/* Author	: Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define jehian using
#define mau namespace
#define libur std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(0);}

jehian mau libur;
/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n");
#define sp printf(" ");

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) for(int _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int dp[1<<26];
int now = 0;
int j;
int main(){
	string S;
	cin >> S;
	SET(dp,1e9);
	dp[0] = 0;
	for (ll i = 0; i < S.size(); ++i){
		now ^= (1 << (S[i] - 'a'));
		int MIN = 1e9;
		for (j = 1 << 25; j; j >>= 1){
			MIN = min(MIN, dp[now^j]);
		}
		dp[now] = min(dp[now], MIN+1);
	}
	cout << max(1, dp[now]) << endl;
	return 0;
}

Measured memory_bytes: 262660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    bool ans = false;
    
    for (int i = 0; i <= 25; i++) {
        for (int ii = 0; ii <= 14; ii++) {
            if ((i * 4 + ii * 7) == n) {
                ans = true;
                break;
            }
        }
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

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

int H, W;
int L[2010][2010], R[2010][2010], U[2010][2010], D[2010][2010];
vector<string> S;

int main() {
    scanf("%d %d", &H, &W);
    S.resize(H);
    
    for (int i = 0; i < H; i++) cin >> S[i];

    rep(i,H)rep(j,W){
        if (S[i][j] == '#') L[i][j] = 0;
        else if (j == 0) L[i][j] = 1;
        else L[i][j] = L[i][j-1] + 1;

        if (S[i][j] == '#') U[i][j] = 0;
        else if (i == 0) U[i][j] = 1;
        else U[i][j] = U[i-1][j] + 1;

        int tempi = H - i - 1;
        int tempj = W - j - 1;

        if (S[tempi][tempj] == '#') R[tempi][tempj] = 0;
        else if (tempj == W-1) R[tempi][tempj] = 1;
        else R[tempi][tempj] = R[tempi][tempj + 1] + 1;

        if (S[tempi][tempj] == '#') D[tempi][tempj] = 0;
        else if (tempi == H-1) D[tempi][tempj] = 1;
        else D[tempi][tempj] = D[tempi + 1][tempj] + 1;
        
    }

    int maxsum = 0;
    rep(i,H)rep(j,W) maxsum = max(maxsum, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
    cout << maxsum << endl;
    return 0;
}

Measured memory_bytes: 67456
#include <iostream>
#include <vector>
#include <set>

#define REP(i,a,b) for(int i=int(a);i<int(b);i++)

using namespace std;

typedef long long int lli;

int main () {
    int n;
    cin >> n;
    vector<int> v(n);
    REP (i, 0, n) cin >> v[i];
    set<int> s;
    REP (i, 0, n) {
        int num = 0;
        REP (j, 0, 4) {
            if (i + j < n) {
                num = num * 10 + v[i + j];
                s.insert(num);
            }
        }
    }
    REP (i, 0, 10000) {
        if (s.count(i) == 0) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3196
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        if(n==1) out.println("Hello World");
        else{
            int a = in.ni(), b = in.ni();
            out.println(a+b);
        }
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

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

int main(){
	int N;
	cin >> N;
	
	vector<vector<vector<vector<int>>>> ACGT(N+1,vector<vector<vector<int>>>(4,vector<vector<int>>(4,vector<int>(4,(0)))));
	ACGT.at(0).at(3).at(3).at(3)=1;
	for(int i=0;i<N;i++){
		for(int c1=0;c1<4;c1++){
			for(int c2=0;c2<4;c2++){
				for(int c3=0;c3<4;c3++){
					for(int c4=0;c4<4;c4++){
						if(ACGT.at(i).at(c1).at(c2).at(c3)==0)	continue;
						if(c2==0 && c3==2 && c4==1)	continue;
						if(c2==0 && c3==1 && c4==2)	continue;
						if(c2==2 && c3==0 && c4==1)	continue;
						if(c1==0 && c2==2 && c4==1)	continue;
						if(c1==0 && c3==2 && c4==1)	continue;
						
						ACGT.at(i+1).at(c2).at(c3).at(c4)+=ACGT.at(i).at(c1).at(c2).at(c3);
						ACGT.at(i+1).at(c2).at(c3).at(c4)%=MOD;
					}
				}
			}
		}
	}
	
	long long ans=0;
	for(int c1=0;c1<4;c1++){
		for(int c2=0;c2<4;c2++){
			for(int c3=0;c3<4;c3++){
				ans+=ACGT.at(N).at(c1).at(c2).at(c3);
				ans%=MOD;
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 384