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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    ll a, b;
    cin >> a >> b;
    if((a+b)%2 == 0){
        cout << (a + b) / 2 << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#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 r=0,p=0,n=sz(s);
    for (int i=0;i<n;i++) {
        if (s[i] == 'g')  p++ ; 
        else  r++ ; 
    }
    cout << (p-r)/2 << endl ; 
}

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


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m, n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mk make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<int>(n,a)));
typedef long long ll;
const int INF = 2000000000;
const long INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;
int main(){
    ll x,y;
    std::cin >> x>>y;
    
    ll xx=abs(x),yy=abs(y);
    ll d=y-x,dd=yy-xx;
    ll ans=INF64;
    reprep(i,j,2,2){
        xx=x*pow(-1,i);
        yy=y*pow(-1,j);
        if(yy-xx>=0){
            ans=min(ans,yy-xx+i+j);
        }
    }std::cout << ans << std::endl;
    
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Data.List

main :: IO ()
main = do
  n <- readLn
  solve <$> replicateM n getLine >>= print

solve :: [String] -> Int
solve = sum . map product . filter (\l -> length l == 3) . subsequences . map length . group . sort . filter (flip elem "MARCH") . map head


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 300005

ll n , ans , x , y , h;
ll a[MAXX];
ll b[105];

int main()
{
    _FastIO;
    cin >> n;
    ll k = 1;
    for(ll i = 0; i < 60; i++){
        k *= 2;
        b[i] = 0;
    }
    b[60] = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        ll x = k;
        for(ll j = 60; j >= 0; j--){
            if(a[i] >= x){
                a[i] -= x;
                b[j]++;

            }
            x /= 2;
        }
    }
    for(ll i = 60; i >= 0; i--){
        ll x = 0;
        ll y = 0;
        x += b[i];
        y += (n - b[i]);
        ans += (((((x % 1000000007) * (y % 1000000007)) % 1000000007) * (k % 1000000007)) % 1000000007);
        k /= 2;
        ans %= 1000000007;

    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
n,*a=map(int,open(0).read().split())
ans=0
for i in range(n):
    if i+1==a[i] and i!=n-1:
        a[i],a[i+1]=a[i+1],a[i]
        ans+=1
    if i+1==a[i] and i==n-1:
        ans+=1
print(ans)

Measured memory_bytes: 13940
from itertools import accumulate

N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
Loop = []


Done = [False] * N
for i in range(N):
    if Done[i]:
        continue
    L = []
    now = i
    while True:
        L.append(C[now])
        Done[now] = True
        now = P[now] - 1
        if Done[now]:
            break
    Loop.append(L)
ans = - float('inf')
for L in Loop:
    B = [0] + list(accumulate(L + L))
    loop = K // len(L)
    rest = K % len(L)
    flag = False
    if loop > 0:
        flag = True
    ans1 = - float('inf')
    ans3 = - float('inf')
    for start in range(len(L)):
        for num in range(1, len(L)+1):
            end = start + num
            if end >= len(B):
                break
            if num <= rest:
                ans1 = max(ans1, B[end] - B[start])
            ans3 = max(ans3, B[end] - B[start])
    ans2 = max(0, loop * B[len(L)])
    ans4 = max(0, (loop - 1) * B[len(L)])
    ans = max(ans, ans1+ans2)
    if flag:
        ans = max(ans, ans3 + ans4)
print(ans)

Measured memory_bytes: 69860
#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
#define loop(i, l, r) for(i=l; i<r; i++)/*Instead of function, (for).*/
#define rep(i,r) for(i=0; i<r; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
typedef long long int lli;
/*Return Combination ,(nCr)*/
int combi(int n, int r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
/*Return gcd(a, b)*/
int gcd(int a, int b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}
//qsort�֐��Ɏg��compare�֐�,(long long int, int, double�^)
int compare_lli(const void *a, const void *b)
{
    return *(lli*)a - *(lli*)b;
}
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
int compare_double(const void *a, const void *b)
{
    return *(double*)a - *(double*)b;
}
/*qsort(data, 10, sizeof(int_lli_double), compare_int);*/
/*qsort(�z��, �v�f��, sizeof(�z��̌^), compare_�z��̌^);*/
int chek(int *tmp1, int *tmp2, int n){
	int i;
	for(i=0; i<n; i++){
		if(tmp1[i] != tmp2[i]){
			return 1;
		}
	}
	return 0;
}//2�̔z�񂪈�v���邩�̔���_(return��v��0,�s��v���P)
int main(void)
{
	int n, m, i, k=0, sum=0;
	scanf("%d%d", &n, &m);
	int a[n];
	rep(i,n){
		scanf("%d", &a[i]);
		sum += a[i];
	}
	rep(i,n){
		if(a[i]*4*m >= sum) k++;
	}
	if(k>=m) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 128
/*input
22 3051
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
const ll maxn=5e3+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=mult(res,a);
        a=mult(a,a);
        b>>=1;
    }
    return res;
}
int main(){
    int n,a;
    cin>>n>>a;
    cout<<a+100*max(0,10-n);

}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N, D;
  cin >> N >> D;

  int x[N][D];
  for ( int i = 0; i < N; i++ ) {
    for ( int j = 0; j < D; j++ ) {
      cin >> x[i][j];
    }
  }

  int ans = 0;
  for ( int i = 0; i < N; i++ ) {
    for ( int j = i+1; j < N; j++ ) {
      double sum = 0;
      for ( int k = 0; k < D; k++ ) {
	sum += pow(x[i][k]-x[j][k], 2);	
      }
      sum = sqrt(sum);
      if ( abs(sum - (double)(int)sum) < 1e-9 ) ans++;
    }
  }

  cout << ans << endl;
  
  return 0;
}


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

using namespace std;

int f(int n) {
  if (n % 2 == 0)
    return n / 2;
  else
    return 3 * n + 1;
}

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

  int res;

  set<int> set;
  set.insert(s);

  int a_prev = s;
  for (int i = 2; i < 1000001; ++i) {
    int a_n;
    a_n = f(a_prev);

    if (set.find(a_n) != set.end()) {
      res = i;
      break;
    } else {
      set.insert(a_n);
      a_prev = a_n;
    }
  }

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

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

using namespace std;

class Dice {
public:
    map<string, int> pos;

    Dice() {
        Dice::pos = {{"Top", 1}, {"North", 5}, {"East", 3}, {"South", 2}, {"West", 4}, {"Bottom", 6}};
    };

    int top() {
        return pos["Top"];
    }

    void rotate(const vector<string> &v) {
        int tmp = pos[v[0]];
        for (int i=0; i<(int)v.size() - 1; ++i) pos[v[i]] = pos[v[i + 1]];
        pos[v[(int)v.size() - 1]] = tmp;
    }

    void go(string di) {
        if (di == "North") rotate({"Top", "South", "Bottom", "North"});
        else if (di == "East") rotate({"Top", "West", "Bottom", "East"});
        else if (di == "West") rotate({"Top", "East", "Bottom", "West"});
        else if (di == "South") rotate({"Top", "North", "Bottom", "South"});
        else if (di == "Right") rotate({"South", "East", "North", "West"});
        else if (di == "Left") rotate({"South", "West", "North", "East"});
    }
};

int main() {
    int n;
    string di;
    while (cin >> n && n != 0) {
        auto dice = Dice();
        int sum = 1;
        while (n --) {
            cin >> di;
            dice.go(di);
            sum += dice.top();
        }
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1228
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int> >p;
int n;
void add(vector<int>s,int x)
{
	if(x==n)
	{
		p.push_back(s);
		return ;	
	}
	vector<int>temp=s;
	temp.push_back(1);
	add(temp,x+1);
	temp.pop_back();
	temp.push_back(0);
	add(temp,x+1);
}

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif


// -------------------------------------Code starts here--------------------------------------------------------------------- 

	cin>>n;
	vector<int>ss;
	add(ss,0);
	// ss.push_back(1);
	// ss.push_back(0);
	
	// p.push_back(ss);
	vector<pair<int,int> >a[n+1];
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		while (x--)
		{
			int y,z;
			cin>>y>>z;
			a[i].push_back({y,z});			
		}
	}
	int mx=0;
	// p.erase(p.back());
	// p.erase(p[2]);
	// p.erase(p[2]);
	
	for(auto i:p)
	{
		bool ok=true;
		int flag[n+1];
		fill_n(flag,n+1,2);
		int cnt=0;
		for(int j=0;j<n;j++)
		{
			if(i[j]==1)
			{
				cnt++;
				for(auto k:a[j+1])
				{
					if(flag[k.first]!=2)
					{
						if(flag[k.first]!=k.second)
						{
							ok=false;
						}
					}
					else
					{
						flag[k.first]=k.second;
					}						
				}
			}
		}
		for(int j=0;j<n;j++)
		{
			if(flag[j+1]==1 && i[j]==0)
			ok=false;
			if(flag[j+1]==0 &&i[j]==1 )
			ok=false;
		}

		if(!ok)
			continue;
		mx=max(mx,cnt);
	}
	cout<<mx;

// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 5176
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int w, h, n;
    cin >> w >> h >> n;
    vector<int> X(n), Y(n), a(n);
    rep(i, n) cin >> X[i] >> Y[i] >> a[i];

    vector<int> img(w * h);
    rep(i, w * h) img[i] = 0;

    rep(i, n) {
        if (a[i] == 1) {
            rep(y, h) {
                for (int x = 0; x < X[i]; x++) {
                    img[y * w + x] = 1;
                }
            }
        }
        else if (a[i] == 2) {
            rep(y, h) {
                for (int x = X[i]; x < w; x++) {
                    img[y * w + x] = 1;
                }
            }
        }
        else if (a[i] == 3) {
            rep(x, w) {
                for (int y = 0; y < Y[i]; y++) {
                    img[y * w + x] = 1;
                }
            }
        }
        else {
            rep(x, w) {
                for (int y = Y[i]; y < h; y++) {
                    img[y * w + x] = 1;
                }
            }
        }
    }

    int cnt = 0;
    rep(i, img.size()) cnt += 1 - img[i];
    
    put(cnt)
    return 0;
}

Measured memory_bytes: 3664
// ProblemURL : https://atcoder.jp/contests/abc114/tasks/abc114_c
// ---------------------------------------------
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ct := 0
	check := func(n int) bool {
		a, b, c := false, false, false
		for n > 0 {
			switch n % 10 {
			case 3:
				a = true
			case 5:
				b = true
			case 7:
				c = true
			}
			n /= 10
		}
		return a && b && c
	}

	var dfs func(int)
	dfs = func(x int) {
		if x > n {
			return
		}
		if check(x) {
			ct++
		}
		dfs(x*10 + 3)
		dfs(x*10 + 5)
		dfs(x*10 + 7)
	}
	dfs(0)
	fmt.Println(ct)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(12), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
using Int = long long;
vector<int> sort_cyclic_shifts(const string &str) {
    int n = str.size();
    const int alphabet = 256;
    vector<int> p(n), c(n), cnt(max(alphabet, n), 0);
    for (int i = 0; i < n; i++)
        cnt[str[i]]++;
    for (int i = 1; i < alphabet; i++)
        cnt[i] += cnt[i - 1];
    for (int i = 0; i < n; i++)
        p[--cnt[str[i]]] = i;
    c[p[0]] = 0;
    int classes = 1;
    for (int i = 1; i < n; i++) {
        if (str[p[i]] != str[p[i-1]])
            classes++;
        c[p[i]] = classes - 1;
    }
    vector<int> pn(n), cn(n);
    for (int h = 0; (1 << h) < n; ++h) {
        for (int i = 0; i < n; i++) {
            pn[i] = p[i] - (1 << h);
            if (pn[i] < 0)
                pn[i] += n;
        }
        fill(cnt.begin(), cnt.begin() + classes, 0);
        for (int i = 0; i < n; i++)
            cnt[c[pn[i]]]++;
        for (int i = 1; i < classes; i++)
            cnt[i] += cnt[i - 1];
        for (int i = n - 1; i >= 0; i--)
            p[--cnt[c[pn[i]]]] = pn[i];
        cn[p[0]] = 0;
        classes = 1;
        for (int i = 1; i < n; i++) {
            auto cur = make_pair(c[p[i]], c[(p[i] + (1 << h)) % n]);
            auto pre = make_pair(c[p[i - 1]], c[(p[i - 1] + (1 << h)) % n]);
            if (cur != pre)
                ++classes;
            cn[p[i]] = classes - 1;
        }
        swap(c, cn);
    }
    return p;
}
vector<int> suffix_array_construction(string str) {
    str += "$";
    auto sorted_shifts = sort_cyclic_shifts(str);
    sorted_shifts.erase(sorted_shifts.begin());
    return sorted_shifts;
}
vector<int> lcp_construction(const string &str, const vector<int> &p) {
    int n = str.size();
    vector<int> rank(n, 0);
    for (int i = 0; i < n; i++)
        rank[p[i]] = i;
    int k = 0;
    vector<int> lcp(n - 1, 0);
    for (int i = 0; i < n; i++) {
        if (rank[i] == n - 1) {
            k = 0;
            continue;
        }
        int j = p[rank[i] + 1];
        while (i + k < n && j + k < n && str[i + k] == str[j + k])
            k++;
        lcp[rank[i]] = k;
        if (k)
            k--;
    }
    return lcp;
}
int main() {
    string S; cin >> S;
    auto sa = suffix_array_construction(S);
    auto lcp = lcp_construction(S, sa);
    Int ans = 0;
    for (int i = 0; i < S.size(); i++) {
        ans += S.size() - sa[i];
        if (i > 0) ans -= lcp[i - 1];
    }
    cout << ans << endl;
    return 0;
}


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

vector<int> v;
int Max = 0;

void load(int a)
{
    if(a % 10 != 0)
    {
        v.push_back(10 - (a % 10));
        Max = max(Max, 10 - (a % 10));
    }
}

int main()
{
    int a, b, c, d, e;
    scanf("%d", &a);
    load(a);
    scanf("%d", &b);
    load(b);
    scanf("%d", &c);
    load(c);
    scanf("%d", &d);
    load(d);
    scanf("%d", &e);
    load(e);
    
    int res = 0;
    
    for(auto i : v) res += i;
    
    cout << a + b + c + d + e + res - Max;
    
    return 0;
}

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

const int MAXN = 2005;

int N, M, Q;
char mat[MAXN][MAXN];
int cnt[MAXN][MAXN];
int dp[MAXN][MAXN];
int row[MAXN][MAXN], col[MAXN][MAXN];

void load() {
  scanf("%d%d%d", &N, &M, &Q);
  for (int i = 1; i <= N; i++)
    scanf("%s", mat[i] + 1);
}

int get_cnt(int x1, int y1, int x2, int y2) {
  return cnt[x2][y2] - cnt[x2][y1 - 1] - cnt[x1 - 1][y2] + cnt[x1 - 1][y1 - 1];
}

int get_dp(int x1, int y1, int x2, int y2) {
  return dp[x2][y2] - dp[x2][y1 - 1] - dp[x1 - 1][y2] + dp[x1 - 1][y1 - 1];
}

int get_row(int x, int y1, int y2) {
  return row[x][y2 - 1] - row[x][y1 - 1];
}

int get_col(int y, int x1, int x2) {
  return col[x2 - 1][y] - col[x1 - 1][y];
}

int query(int x1, int y1, int x2, int y2) {
  return get_cnt(x1, y1, x2, y2) - get_dp(x1, y1, x2 - 1, y2 - 1) - get_row(x2, y1, y2) - get_col(y2, x1, x2);
}

inline int blue(int x, int y) {
  return mat[x][y] - '0';
}

void solve() {
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      cnt[i][j] = cnt[i - 1][j] + cnt[i][j - 1] - cnt[i - 1][j - 1] + blue(i, j);
  
  for (int i = 1; i < N; i++)
    for (int j = 1; j < M; j++)
      dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1] + (blue(i, j) && blue(i, j + 1)) + (blue(i, j) && blue(i + 1, j));
  
  for (int i = 1; i <= N; i++)
    for (int j = 1; j < M; j++)
      row[i][j] = row[i][j - 1] + (blue(i, j) && blue(i, j + 1));
  
  for (int j = 1; j <= M; j++)
    for (int i = 1; i < N; i++)
      col[i][j] = col[i - 1][j] + (blue(i, j) && blue(i + 1, j));
  
  while (Q--) {
    int x1, y1, x2, y2;
    scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
    printf("%d\n", query(x1, y1, x2, y2));
  }
}

int main() {
  load();
  solve();
  return 0;
}


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

class Main{
    public static void main(String[] args){
        FastScanner fs = new FastScanner();
        int a = fs.nextInt();
        int b = fs.nextInt();
        int c = fs.nextInt();
        if(a+b+c<=21){
            System.out.println("win");
        }else{
            System.out.println("bust");
        }
    }
    static class FastScanner{
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte(){
            if(ptr < buflen){
                return true;
            }else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen <= 0){
                    return false;
                }
            }
            return true;
        }

        private int readByte(){
            if(hasNextByte())return buffer[ptr++];
            else return -1;
        }

        private boolean isPrintableChar(int c){
            return 33<=c && c<=126;
        }

        public boolean hasNext(){
            while(hasNextByte() && !isPrintableChar(buffer[ptr]))ptr++;
            return hasNextByte();
        }

        public String next(){
            if(!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)){
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong(){
            if(!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if(b == '-'){
                minus = true;
                b = readByte();
            }
            if(b < '0' || '9' < b){
                throw new NumberFormatException();
            }
            while(true){
                if('0' <= b && b<='9'){
                    n*=10;
                    n+=b-'0';
                }else if(b==-1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt(){
            long nl = nextLong();
            if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)throw new NumberFormatException();
            return (int)nl;
        }
        public double nextDouble(){return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 23124
import java.util.Scanner;

public class Main{
  public static void main(String args[]){
    Scanner scanner = new Scanner(System.in);
    double n = scanner.nextInt();
    double x = scanner.nextInt();
    double t = scanner.nextInt();

    int kaisu = (int)Math.ceil(n/x); 
    //System.out.println(kaisu);
    System.out.println((int)t*kaisu);
    
  }
}



Measured memory_bytes: 27028
#include <iostream>

using namespace std;

int main()
{
    int n , h=0;
    cin>>n;
    if(n>=500){
    while(n>=500){
        n-=500;
        h+=1000;
    }}
     if (n>=5){
    while(n>=5){
        n-=5;
        h+=5;
    }}
    cout<<h;
}


Measured memory_bytes: 256
#include<stdio.h>
int main() {
    int cd=-1, cnt=0, n;
    scanf("%d", &n);
    for(int i=0;i<4;i++) {
        int d=n%10;
        n/=10;
        if(d!=cd){
            cnt=1;
            cd=d;
        }
        else {
            cnt++;
            if(cnt==3){
                printf("Yes");
                return 0;
            }
        }
    }
    printf("No");
    return 0;
}


Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

int main() {
  int n, mx_1 = 0, mx_2 = 0, mx_i;
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;
    if (a >= mx_1) {
      mx_2 = mx_1;
      mx_1 = a;
      mx_i = i;
      continue;
    }
    if (a > mx_2) mx_2 = a;
  }
  rep(i, n) {
    if (i == mx_i) cout << mx_2 << endl;
    else cout << mx_1 << endl;
  }
  return 0;
}

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

int main(void){
    int h, w;
    std::cin >> h >> w;
    std::vector<std::string> s(h);
    for(int i = 0; i < h; i++){
	std::cin >> s[i];
    }
    std::vector<std::vector<int>> da(h, std::vector<int>(w));
    for(int i = 0; i < h; i++){
	int cnt = 0;
	int start = 0;
	for(int j = 0; j < w; j++){
	    if(s[i][j] == '#'){
		for(int k = start; k < j; k++){
		    da[i][k] += cnt;
		}
		// std::cout << std::endl;
		start = j+1;
		cnt = 0;
		continue;
	    }else{
		cnt++;
		if(j == w - 1){
		    for(int k = start; k <= j; k++){
		        da[i][k] += cnt;
		    }
		    
		}
	    }
	}
    }
    // std::cout << std::endl;
    // for(int i = 0; i < h; i++){
    //     for(int j = 0; j < w; j++){
    //         std::cout << da[i][j] << " ";
    //     }
    //     std::cout << std::endl;
    // }
    // std::cout << std::endl;
    for(int i = 0; i < w; i++){
	int cnt = 0;
	int start = 0;
	for(int j = 0; j < h; j++){
	    if(s[j][i] == '#'){
		for(int k = start; k < j; k++){
		    da[k][i] += cnt;
		}
		start = j + 1;
		cnt = 0;
		continue;
	    }else{
		cnt++;
		if(j == h - 1){
	    	    for(int k = start; k <= j; k++){
	    	        da[k][i] += cnt;
	    	    }
	    	}
	    }
	}
    }
    int max = 0;
    for(int i = 0; i < h; i++){
	for(int j = 0; j < w; j++){
	    max = std::max(max, da[i][j]);
	}
    }
    // for(int i = 0; i < h; i++){
    //     for(int j = 0; j < w; j++){
    //         std::cout << da[i][j] << " ";
    //     }
    //     std::cout << std::endl;
    // }
    std::cout << max - 1<< std::endl;

    return 0;
}



Measured memory_bytes: 26452
#import math
#import copy
#import sys
#import bisect
#input = sys.stdin.readline
mod=10**9+7
def swap(a,b):
    c=a
    a=b
    b=c
    return a,b
def factorial(x): #階乗計算
    n=1
    for i in range(x):
        n=(n*(i+1))%mod
    return n

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))
def div(x): #約数配列
    div=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            div.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
      div.append(x)
    return div
def div2(x): #素因数分解配列
    div2=[]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        while x%check==0:
            div2.append(check)
            x/=check
        check+=1
    if x != 1:
      div2.append(x)
    return div2

def main():
    # x,y = map(int,input().split())           x=1,y=2
    # a = input().split()                      a=['1','2','3',...,'n']
    # a = list(map(int,input().split()))       a=[1,2,3,4,5,...,n]
    # li = input().split('T')	              FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    # 複数行の「1 2 3 4」型の入力を一配列に
    # x = sorted([list(map(int, input().split())) for _ in range(n)])
    # ソート x.sort(key=lambda y:y[1])
    # [chr(i) for i in range(97, 97+26)] 英語小文字リスト
    # [chr(i) for i in range(65, 65+26)] 英語大文字リスト atcoder
    # ord(c) chr(2) alphabet <=> number
    s=list(input())
    s.reverse()
    i=0
    while i < len(s):
        if i<=len(s)-5 and ''.join(s[i:i+5]) == "maerd":
            i+=5
        elif i<=len(s)-7 and ''.join(s[i:i+7]) == "remaerd":
            i+=7
        elif i<=len(s)-5 and ''.join(s[i:i+5]) == "esare":
            i+=5
        elif i<=len(s)-6 and ''.join(s[i:i+6]) == "resare":
            i+=6
        else:
            print("NO")
            return
    print("YES")
main()

Measured memory_bytes: 49776
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;

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


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

using namespace std;

int main()
{
    long X, Y, Z, Sum = 0;
    cin >> X >> Y >> Z;

    for (int i = 0; i <= 100000; i++)
    {
        Sum = (Y * i) + (Z * (i + 1));

        if (Sum > X)
        {
            cout << i - 1;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (void) {
	char s[16];
	int tama=0;

	memset (&s[0], 0, sizeof (s));
	scanf ("%s%s%s", &s[0], &s[1], &s[2]);

	for (int ii=0; ii < 3; ii++) {
		if (s[ii] == '1') {
			tama++;
		}
	}

	printf ("%d", tama);

	return 0;
}


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

int main() {
    string s;
    cin >> s;
    
    string ans = "No";
    if (s.find('C') != string::npos
        and s.find('F') != string::npos) {
        if  (s.find_first_of('C') < s.find_last_of('F'))
            ans = "Yes";
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#define int long long
using namespace std;

typedef pair<int,int> P;

int bit[200010];

void add(int i,int x){
	while(i < 200010){
		bit[i] += x;
		i += i & -i;
	}
}

int sum(int i){
	int s = 0;
	while(i){
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

signed main(){
	int n,c,t[100000],p[100000],pt[100000] = {},typ[100000],m[100000];
	queue<int> ind[100000];
	vector<P> vec;
	cin >> n >> c;
	for(int i = 0;i < n;i++) vec.push_back(P(0,-i));
	for(int i = 0;i < c;i++){
		cin >> typ[i];
		if(!typ[i]){
			cin >> t[i] >> p[i]; t[i]--;
			pt[t[i]] += p[i];
			vec.push_back(P(pt[t[i]],-t[i]));
		}else cin >> m[i];
	}
	sort(vec.begin(),vec.end());
	for(int i = 0;i < vec.size();i++){
		if(!vec[i].first) add(i + 1,1);
		ind[-vec[i].second].push(i + 1);
	}
	for(int i = 0;i < c;i++){
		if(!typ[i]){
			add(ind[t[i]].front(),-1);
			ind[t[i]].pop();
			add(ind[t[i]].front(),1);
		}else{
			int low = 0,up = n + c + 1;
			while(up - low > 1){
				int mid = (low + up) / 2;
				if(sum(mid) >= n - m[i] + 1) up = mid;
				else low = mid;
			}
			cout << 1 - vec[up - 1].second << " " << vec[up - 1].first << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 78532
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c, n, k;
string s,t;



int main()
{
	cin >> a;
	double f = (a + 1) / 2;
	printf("%10.10f", f / a);
}


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


signed main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  if( A % 2 == B % 2 ){
    cout << (B-A)/2 << endl;
  }else{
    cout << min(A-1, N-B) + 1 + (B-A-1)/2 << endl;
  }
    
  
  
}

Measured memory_bytes: 256
MODULE intQsortMod
! 整数型のクイックソート
! precisionで整数の精度を定める．
! インデックスの小さいほうが値も小さい(昇順)．

! 参考
! https://t.doujin-constant.net/post/143374686394/fortranをより使いこなしたquick-sort

      implicit none
      integer,parameter,private :: precision = 16
      
      interface qSort
        module procedure :: intQsort
      end interface
      
      contains
      pure recursive function intQsort( a ) result( r )
        implicit none
        integer(precision), intent(in) :: a(:)
        integer(precision) :: r( size(a) )
        integer(precision) :: sample(3), len, i,j
        
        len = size( a(:) )
        if( len<=1 )then
          r = a
        else
          !select pivot
          sample(1:3) = [a(1), a(len/2), a(len)]
          do i = 1,2
            do j = 2,3
              if( sample(i)>sample(j) )then
                len = sample(i) !len is buffer
                sample(i) = sample(j)
                sample(j) = len
              end if
            end do
          end do
          
          r = [ qSort( pack(a(:), a(:)< sample(2) ) ), &
                       pack(a(:), a(:)==sample(2) )  , &
                qSort( pack(a(:), a(:)> sample(2) ) ) ]
        end if
      end function intQsort
      END MODULE intQsortMod


      PROGRAM ExceptionHandling
      use intQsortMod
      IMPLICIT NONE
      integer(16) :: n
      integer(16),allocatable :: a(:),sortA(:)
      integer(16) :: i
      
      read*,n
      allocate( a(n),sortA(n) )
      do i = 1,n
        read*,a(i)
      end do
      
      sortA(:) = qsort( a )
      
      do i = 1,n
        if( a(i)==sortA(n) )then
          print*,sortA(n-1)
        else
          print*,sortA(n)
        end if
      end do
      
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 17356
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

//Reverse a Road
public class Main{

	class E{
		int id, t;
		public E(int id, int t) {
			this.id = id;
			this.t = t;
		}
	}
	
	@SuppressWarnings("unchecked")
	void run(){
		Scanner sc = new Scanner(System.in);
		int INF = 1<<29;
		int[] d = new int[1001];
		int[][] e = new int[10001][2];
		List<E>[] adj = new List[1001];
		for(;;){
			int n = sc.nextInt();
			if(n==0)break;
			for(int i=1;i<=n;i++)adj[i]=new ArrayList<E>();
			int S = sc.nextInt(), T = sc.nextInt(), m = sc.nextInt();
			for(int i=1;i<=m;i++){
				int s = sc.nextInt(), t = sc.nextInt();
				adj[s].add(new E(i, t));
				e[i][0] = s; e[i][1] = t;
			}
			Arrays.fill(d, INF);
			d[S] = 0;
			Queue<Integer> q = new LinkedList<Integer>();
			q.add(S);
			while(!q.isEmpty()){
				int v = q.poll();
				for(E r:adj[v])if(d[r.t]==INF){
					d[r.t] = d[v]+1; q.add(r.t);
				}
			}
			int res = d[T], ID = 0;
			for(int i=1;i<=m;i++){
				Arrays.fill(d, INF);
				d[S] = 0;
				q = new LinkedList<Integer>();
				q.add(S);
				int rs = e[i][1], rt = e[i][0];
				while(!q.isEmpty()){
					int v = q.poll();
					if(res<=d[v])break;
					for(E r:adj[v])if(r.id!=i&&d[r.t]==INF){
						d[r.t] = d[v]+1; q.add(r.t);
					}
					if(v==rs&&d[rt]==INF){
						d[rt] = d[v]+1; q.add(rt);
					}
				}
				if(d[T]<res){
					res = d[T]; ID = i;
				}
			}
			System.out.println(res+" "+ID);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 15000
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
N = a[0]
for i in range(0,n):
    if float(N/2) > float(a[i]):
        if float(N/2)-float(a[i]) > -float(N/2)+float(a[i-1]) and a[i-1] != N:
            print(N,a[i-1])
        else:
            print(N,a[i])
        break
    if(i == n-1):
        print(N,a[i])
        break


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

//long long
using ll = long long;

// pair<int, int>
using PII = pair<int, int>;

//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;

//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}

// a = max(a, b), a = min(a, b)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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









int main(){
int N, M;
cin >> N >> M;
int pos = -1;
int ans = 0;
vector<pair<int, int>>s(M);
REP(i, M){
  int a, b;
  cin >> s.at(i).second >> s.at(i).first;
}
sort(all(s));
REP(i, M){
  if(pos <= s.at(i).second){
    ans++;
    pos = s.at(i).first;
  } 
}
print(ans);
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	@SuppressWarnings("unchecked")
	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int k = scanner.nextInt();
			if ((n | k) == 0)
				break;
			List<Edge>[] lists = new ArrayList[n];
			for (int i = 0; i < n; i++)
				lists[i] = new ArrayList<Edge>();
			while (k-- > 0) {
				int a = scanner.nextInt();
				if (a == 1) {
					int b = scanner.nextInt() - 1;
					int c = scanner.nextInt() - 1;
					int d = scanner.nextInt();
					lists[b].add(new Edge(c, d));
					lists[c].add(new Edge(b, d));
				} else {
					int s = scanner.nextInt() - 1;
					int g = scanner.nextInt() - 1;
					PriorityQueue<Edge> pq = new PriorityQueue<Edge>();
					pq.offer(new Edge(s, 0));
					int ans = -1;
					boolean[] b = new boolean[n];

					while (!pq.isEmpty()) {
						Edge edge = pq.poll();
						if (edge.to == g) {
							ans = edge.cost;
							break;
						}
						if (b[edge.to])
							continue;
						b[edge.to] = true;
						for (Edge e : lists[edge.to]) {
							pq.offer(new Edge(e.to, e.cost + edge.cost));
						}
					}
					System.out.println(ans);
				}
			}
		}
	}

	class Edge implements Comparable<Edge> {
		@Override
		public String toString() {
			return "Edge [to=" + to + ", cost=" + cost + "]";
		}

		public Edge(int to, int cost) {
			super();
			this.to = to;
			this.cost = cost;
		}

		int to, cost;

		@Override
		public int compareTo(Edge o) {
			return this.cost - o.cost;
		}

	}
}

Measured memory_bytes: 65476
#include <bits/stdc++.h>
#define debug(x) cerr << "\n" \
                      << #x << " = " << x << ".\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define print(xx) cout<<(xx)<<endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const ll MOD = 1000000007;


//=================================================
int N;
long double T,A;
vector<int> H;


//=================================================
void input()
{
    cin>>N;
    cin>>T>>A;
    H = vector<int> (N);
    rep(i,N){cin>>H[i];}
}
//=================================================
void solve()
{
    vector<pair<int,long double>> temp(N);
    rep(i,N){
        temp[i].second = abs(A - (T - H[i] * 0.006));
        temp[i].first = i+1;
    }
    sort(temp.begin(),temp.end(),[](const pair<int,long double>& x, const pair<int, long double>& y){return x.second < y.second;});
    cout<<temp[0].first<<endl;
}
//=================================================
signed main()
{
  input();
  solve();
  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n) cin >> p[i];
    int ans = 0;
    rep(i,n) {
        if(p[i]==i+1) {
            swap(p[i], p[i+1]);
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int const MOD = 1000000007;

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int main() {
    string s; cin >> s;
    int a[26] = {};
    rep(i,0,s.length()) a[ (int)s[i] - 97 ]++;

    bool isans = true;
    rep(i,0,26) if(a[i] % 2 == 1) isans = false;

    if(isans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

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

using ll = long long;
string s[10][10][10];

int main() {
  for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
      for(int k = 0; k < 10; k++) {
        char a = i + '0';
        char b = j + '0';
        char c = k + '0';
        s[i][j][k] += a;
        s[i][j][k] += b;
        s[i][j][k] += c;
      }
    }
  }
        
  int N;
  cin >> N;
  vector<char> S(N);
  for(int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  bool cana=false, canb=false, canc=false;
  int cnt = 0;
  for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
      for(int k = 0; k < 10; k++) {
        cana=false;
        canb=false;
        canc=false;
        for(int l = 0; l < N; l++) {
          if(!cana && s[i][j][k].at(0) == S.at(l)) {
            cana = true;
            continue;
          }
          if(cana && !canb &&s[i][j][k].at(1) ==S.at(l)) {
            canb = true;
            continue;
          }
          if(cana && canb && !canc && s[i][j][k].at(2) == S.at(l)) {
            canc = true;
          }
          if(cana && canb && canc) {
            cnt++;
            break;
          }
        }
      }
    }
  }
  cout << cnt << endl;
}
          
            

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<int> a(n + 1);
  for(int i = 1; i <= n; i++){
    cin >> a[i];
  }
  for(int i = 1; i <= n; i++){
    cout << "node " << i << ": key = " << a[i] << ", ";
    int p = i / 2, l = 2 * i, r = 2 * i + 1;
    if(p > 0) cout << "parent key = " << a[p] << ", ";
    if(l <= n) cout << "left key = " << a[l] << ", ";
    if(r <= n) cout << "right key = " << a[r] << ", ";
    cout << endl;
  }
}

int main(){
  solve();
  return 0;
}



Measured memory_bytes: 3092
#include <stdio.h>

int main() {
    int resposta = 0;
    char p[3];
    scanf("%s", p);
    
    if(p[0]=='S' && p[1]=='S' && p[2]=='R')
        resposta += 1;
    else if(p[0]=='S' && p[1]=='R' && p[2]=='S')
        resposta +=1;
    else if(p[0]=='R' && p[1]=='S' && p[2]=='S')
        resposta +=1;
    else if(p[0]=='S' && p[1]=='R' && p[2]=='R')
        resposta +=2;
    else if(p[0]=='R' && p[1]=='R' && p[2]=='S')
        resposta +=2;
    else if(p[0]=='R' && p[1]=='S' && p[2]=='R')
        resposta +=1;
    else if(p[0]=='R' && p[1]=='S' && p[2]=='S')
        resposta +=1;
    else if(p[0]=='S' && p[1]=='S' && p[2]=='R')
        resposta +=1;
    else if(p[0]=='S' && p[1]=='S' && p[2]=='S')
        resposta = 0;
    else if(p[0]=='R' && p[1]=='R' && p[2]=='R')
        resposta +=3;
        
    printf("%d", resposta);
    
    
    
    return 0;
}

Measured memory_bytes: 2100
// In the Name of Allah. Ya Ali!
#include<bits/stdc++.h>
#define bp __builtin_popcount
typedef long long ll;
const ll MAX_N = 300+5;
const ll MOD = 1e9+7;
using namespace std;

int dp[MAX_N][MAX_N][MAX_N];
int a[MAX_N];
int n,k;

int main()
{
    string s;
    cin >> s >> k;
    n = s.length();
    for(int i = 1;i<=n;++i)
        a[i] = (s[i-1]-'a');
    for(int i = 1;i<=n;++i)
        for(int j = 0;j<=n;++j)
            dp[1][i][j] = 1;
    for(int i = 2;i<=n;++i)
    {
        for(int j = 1;j<=n-i+1;++j)
        {
            for(int t = 0;t<=n;++t)
            {
                dp[i][j][t] = max(dp[i-1][j][t],dp[i-1][j+1][t]);
                if (t-(a[j]!=a[j+i-1])>=0)
                    dp[i][j][t] = max(dp[i][j][t],dp[i-2][j+1][t-(a[j]!=a[j+i-1])]+2);
            }
        }
    }
    cout << dp[n][1][k];
    return 0;
}


Measured memory_bytes: 110592
//AtCoder AGC027 A - Candy Distribution Again
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N,x; cin>>N>>x;
    vector<ll> an(N);
    for(auto&& a:an){
        cin>>a;
    }
    sort(an.begin(),an.end());
    ll rst=x;
    ll ans=0;
    for(ll i=0;i<an.size();++i){
        if (rst>0){
			if(rst - an[i] >= 0) {
				rst -= an[i];
				ans++;
			} else {
                rst = -1;
            }
		}
    }
    if(rst>0) ans=std::max<ll>(0,ans-1);
    cout<<ans<<endl;
    return 0;
}

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

int flag_a[8];
int flag_b[15];
int flag_c[15];
int pos[8];
int rc[8];

void print() {
  for (int i = 0; i < 8; ++i) {
    for (int j = 0; j < 8; ++j) {
      if (j == pos[i]) cout << 'Q';
      else cout << '.';
    }
    cout << endl;
  }
}

void set_board(int i) {
  for (int j = 0; j < 8; ++j) {
    if (!flag_a[j] && !flag_b[i + j] && !flag_c[i - j + 7]) {
      pos[i] = j;
      if (i == 7) {
        bool flag = false;
        for (int k = 0; k < 8; ++k) {
          if (rc[k] == -1) continue;
          if (rc[k] == pos[k]) {
            flag = true;
          } else {
            flag = false;
            break;
          }
        }
        if (flag){
          print();
          return;
        } 
      } else {
        flag_a[j] = flag_b[i + j] = flag_c[i - j + 7] = 1;
        set_board(i + 1);
        flag_a[j] = flag_b[i + j] = flag_c[i - j + 7] = 0;
      }
    }
  }
}

int main() {
  int K, r, c;
  
  for (int i = 0; i < 8; ++i) {
    flag_a[i] = 0;
    rc[i] = -1;
  }
  for (int i = 0; i < 15; ++i) {
    flag_b[i] = flag_c[i] = 0;
  }

  cin >> K;
  for (int i = 0; i < K; ++i) {
    cin >> r >> c;
    rc[r] = c;
  }

  set_board(0);

  return 0;
}


Measured memory_bytes: 3128
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());

        var ans = "No";
        for (int i = 0; i <= (N / 4); i++)
        {
            var r = N - i * 4;
            if(r % 7 == 0)
            {
                ans = "Yes";
                break;
            }
        }

        WriteLine(ans);
    }
}

static class ArrayDeconstructExtensions
{
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2) => (i1, i2) = (a[0], a[1]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3) => (i1, i2, i3) = (a[0], a[1], a[2]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4) => (i1, i2, i3, i4) = (a[0], a[1], a[2], a[3]);
    public static void Deconstruct<T>(this T[] a, out T i1, out T i2, out T i3, out T i4, out T i5) => (i1, i2, i3, i4, i5) = (a[0], a[1], a[2], a[3], a[4]);
}


Measured memory_bytes: 27512