akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

char a[105], b[105], c[105];

void solve()
{
    int n;
    scanf("%d%s%s%s", &n, &a, &b, &c);
    int i;
    int cnt = 0;
    for (i = 0; i < n; i++) {
        if (a[i] == b[i] && b[i] == c[i]) {
            ;
        }
        else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) {
            cnt++;
        }
        else {
            cnt += 2;
        }
    }
    printf("%d\n", cnt);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a<b)
	printf("a < b\n");
	else if(a>b)
	printf("a > b\n");
	else if(a==b)
	printf("a == b\n");
	return 0;
}


Measured memory_bytes: 2604
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def slv(L, R):
    if R -L > 2019:
        return 0
    ans = sys.maxsize
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            ans = min((i*j) % 2019, ans)
    return ans

@mt
def slv2(L, R):
    ans = sys.maxsize
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            if ans > (i*j) % 2019:
                print(i, j)
            ans = min((i*j)%2019, ans)
    return ans

def main():
    L, R = read_int_n()
    print(slv(L, R))

if __name__ == '__main__':
    main()


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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;

void solve(){
   int n,m,x;
   cin >> n >> m >> x;
   int c[n];
   int a[n][m];
   f(i,0,n) {
      cin >> c[i];
      f(j,0,m) cin >> a[i][j];
   }

   int ans = inf64;
   f(mask , 0 , 1LL << n) {
      int b[m] = {0};
      int cost = 0;
      f(i,0,n) {
         if(mask & (1LL << i)) {
            cost += c[i];
            f(j,0,m) b[j] += a[i][j];
         }
      }

      int ok = 1;
      f(i,0,m) if(b[i] < x) ok = 0;
      if(ok) ans =min(ans , cost);
   }
   if(ans == inf64) ans = -1;
   cout << ans << "\n";
}

int32_t main(){
   fast;
   int t = 1;
//   cin >> t;
   while(t--)  solve();   

}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

int main(){

  int n;
  cin >> n;
  int c[n];
  int a[n];
  rep(i,n){
    c[i]=0;
    a[i]=i+1;
  }
  //  c[0]=0;
  rep1(i,n-1){
    for(int j=i; j<n;j++){
      if(a[j]!=1){
	while((a[j]/(i+1)) * (i+1) == a[j]){
	  c[i]++;
	  a[j]/=(i+1);
	}
      }
    }  
  }
  //  rep(i,n) cout << i+1 << " " << c[i] << endl;
  sort(c, c+n);
  //  reverse(c, c+n);

  ll nine=c+n-lower_bound(c,c+n,24);
  ll two=c+n-lower_bound(c,c+n,2);
  ll four=c+n-lower_bound(c,c+n,4);
  ll fteen=c+n-lower_bound(c,c+n,14);
  ll sef=c+n-lower_bound(c,c+n,74);
  ll ans=0;
  //  cout << nine << " " << two << " " << four << " " << fteen << " " << sef << endl;
  ans = nine*(nine-1) + nine*(two-nine) + four*(four-1)*(four-2)/2 + four*(four-1)/2*(two-four) + fteen*(fteen-1) + fteen*(four-fteen)+sef;
  cout <<ans << endl;
    


  
  



  
  return 0;

}


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

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


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

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll a,b,n;
    cin>>a>>b>>n;
    ll x=min(n,b-1);
    ll ans=(a*x/b)-a*(x/b);
    cout<<ans<<endl;

    /*
    ll mx=0;
    for (int i = 0; i <= n; i++)
    {
        ll score = (a*i/b)-a*(i/b);
        //cout<<i<<"\t"<<score<<endl;
        mx=max(mx,score);
    }
    cout<<mx<<endl;
    */
    
    
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int vis[1000006];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++) {
        cin>>a[i];
        vis[a[i]]++;
    }
    int cnt=0;
    for(int i=0; i<n; i++) {
        bool ok=true;
        for(int j=2; j*j<=a[i] && ok; j++) {
            if(a[i]%j==0) {
                if(vis[j] || vis[a[i]/j]) ok=false;
            }
        }
        if(a[i]!=1 && vis[1] || vis[a[i]]>1) ok=false;
        if(ok) cnt++;
    }
    cout<<cnt<<"\n";
    return 0;
}

Measured memory_bytes: 8216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////

vector<ll> sosu;
void Sosu(ll x){
    bool s[x+1];
    fill(s,s+x+1,true);
    ll i;
    for(i=2;i*i<=x;i=i+2){
        if(s[i]){
            sosu.pb(i);
            for(ll j=2;j*i<=x;j++){
                s[j*i]=false;
            }
        }
        if(i==2)i--;
    }
    for(i=i;i<=x;i=i+2){
        if(s[i]){
            sosu.pb(i);
        }
    }
}

int main(){
    Sosu(100000);
    bool b[100010];
    fill(b,b+100010,false);
    rep(i,0,sosu.size()-1){
        b[sosu[i]]=true;
    }
    ll hoge[100010];
    hoge[1]=0;
    for(ll i=3;i<=100000;i=i+2){
        if(b[i] & b[(i+1)/2]){
            hoge[i]=hoge[i-2]+1;
        }else{
            hoge[i]=hoge[i-2];
        }
    }
    ll q;cin>>q;
    ll l[q],r[q];
    rep(i,0,q-1){
        cin>>l[i]>>r[i];
    }
    rep(i,0,q-1){
        if(l[i]==1){
            cout<<hoge[r[i]]<<endl;
        }else{
            cout<<hoge[r[i]]-hoge[l[i]-2]<<endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3328
import collections
N, M= map(int, input().split())
H = list(map(int,input().split()))
C = [list(map(int, input().split())) for i in range(M)]
# print(C)
# Hs = {}

# for i in range(N):
#    Hs[i+1]=H[i]
# print(Hs)

# H_sorted = sorted(Hs.items(), key=lambda x: x[1], reverse=True)
# print(H_sorted)

# Np = 0
p = [1 for i in range(N)]
for c in C:
   if H[c[0]-1] <= H[c[1]-1]:
      p[c[0]-1]=0
   if H[c[0]-1] >= H[c[1]-1]:
      p[c[1]-1] = 0

print(sum(p))


Measured memory_bytes: 32304
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cstdlib>
#include<ctime>
using namespace std;
typedef long long ll;
int main() {
	int n, m, ans[55] = {};
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		ans[a]++; ans[b]++;
	}
	for (int i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

int rect(int h, int w){
  for (int k = 0; k < h; k++) {
    for (int i = 0; i < w; i++) {
      if (k % 2 == 0) {
	if (i % 2 == 0) cout << "#";
	else cout << ".";
      } else {
	if (i % 2 == 0) cout << ".";
	else cout << "#";
      }
    }
    cout << endl;
  }

  cout << endl;
  return 0;
}

int main() {
  int a, b;
  for (;;) {
    cin >> a >> b;
    if (a == 0 && b == 0) break;

    rect(a, b);
  }

  return 0;
}



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

const int maxx=10010;
int n,b[maxx],a[maxx],ans;

int main(){
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		scanf("%d",&b[i]);
	}
	ans+=b[1]+b[n-1];
	for(int i=1;i<=n;i++){
		ans+=min(b[i],b[i+1]);
	}
	cout<<ans;
	return 0;
} 

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int n;
    cin >> n;
    int c[20], v[20];
    for(int i=0;i<n;i++) cin >> v[i];
    for(int i=0;i<n;i++) cin >> c[i];

    int ans = 0;
    for(int i=0;i<(1<<n);i++){
        int profit = 0;
        for(int j=0;j<n;j++){
            if((i>>j) & 1) profit += v[j]-c[j];
        }
        ans = max(ans, profit);
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define long long long 

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update> pref_trie;
typedef tree<long int,null_type,less<long int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef cc_hash_table<long int,long int, hash<long int>, equal_to<long int>, direct_mask_range_hashing<long int>, 
hash_standard_resize_policy<hash_exponential_size_policy<>, hash_load_check_resize_trigger<true>, true>> ht;


int main(){
   IOS;
 //    #ifndef ONLINE_JUDGE
 //        freopen("in.txt",  "r",  stdin);
 //        freopen("out.txt", "w", stdout);
 //    #endif
   
   long int n,k;
   cin>>n>>k;


   vector<double> v(n);
   for(long int i = 0; i < n; i++){
      cin>>v[i];
      v[i] = (1 + v[i]) / 2;
   }

   double maxSum = 0, sum = 0;
   for(long int i = 0; i < k; i++)
      sum += v[i];

   maxSum = sum;

   for(long int i = k; i < n; i++){
      sum -= v[i-k];
      sum += v[i];
      maxSum = max(maxSum,sum);
   }

   cout<<fixed<<setprecision(10)<<maxSum;

   return 0;
}

Measured memory_bytes: 1792
def work(S, k, c):
    tir = 0
    cnt = 0
    for i, s in enumerate(S):
        if s == 'o' and tir == 0 and cnt < k:
            yield i
            tir = c
            cnt += 1
        else:
            tir = max(tir-1, 0)


n, k, c = map(int, input().split())
S = list(input())
L = [i+1 for i in work(S, k, c)]
R = [n-i for i in work(S[::-1], k, c)][::-1]
for l, r in zip(L, R):
    if l == r:
        print(l)


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

    int n;
    while (cin >> n, n)
    {
        vector<ll> l(n);
        vector<int> mask(n);
        for (int i = 0; i < n; i++)
        {
            int m;
            cin >> m >> l[i];
            for (int j = 0; j < m; j++)
            {
                int s, e;
                cin >> s >> e;
                s -= 6;
                e -= 6;
                for (int k = s; k < e; k++)
                    mask[i] |= (1 << k);
            }
        }
        vector<ll> dp(1 << 20, 0);
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < (1 << 16); j++)
            {
                if ((mask[i] & j) == 0)
                    dp[mask[i] | j] = max(dp[mask[i] | j], dp[j] + l[i]);
            }
        }
        ll res = 0;
        for (int i = 0; i < (1 << 16); i++)
            res = max(res, dp[i]);
        cout << res << endl;
    }
}



Measured memory_bytes: 11376
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MOD = pow(10, 9) + 7;
//const int MOD = 998244353;
//const int MOD = ;
int mod(int A, int M) {return (A % M + M) % M;}
const int INF = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}

signed main()
{
  int N, X;
  cin >> N >> X;
  vector<int> L(N);
  for (int i = 0; i < N; i++)
  {
    cin >> L.at(i);
  }
  
  int D = 0;
  int ans = 1;
  for (int i = 0; i < N; i++)
  {
    D += L.at(i);
    if (D <= X) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
            int n = s.nextInt();
            int x = s.nextInt();
            int k = s.nextInt();
            int c=0;
            while (n > 0){
                n = n - x;
                c+=1;
            }
            System.out.println(k*c);
    }
    }


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    char s;
    cin >> s;
    printf ("%c\n", s+1 );

    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	class Pair{
		public long Val;
		public int Cnt;
		public Pair(long v, int c){
			Val = v; Cnt = c;
		}
	}
	public void Solve(){
		
		Pair[] P = new Pair[M];
		for(int i=0;i<M;i++){
			P[i] = new Pair(C[i], B[i]);
		}
		
		Array.Sort(P, (p, q) => p.Val.CompareTo(q.Val));
		Array.Reverse(P);
		
		List<long> L = new List<long>();
		foreach(var p in P){
			for(int k=0;k<p.Cnt;k++){
				L.Add(p.Val);
				if(L.Count == N) break;
			}
			if(L.Count == N) break;
		}
		
		Array.Sort(A);
		int idx = 0;
		long sum = 0;
		for(int i=0;i<N;i++){
			if(idx < L.Count && L[idx] > A[i]){
				sum += L[idx];
				idx++;
			} else {
				sum += A[i];
			}
		}
		Console.WriteLine(sum);
		
	}
	int N,M;
	long[] A;
	int[] B,C;
	public Sol(){
		var d = ria();
		N = d[0]; M = d[1];
		A = rla();
		B = new int[M];
		C = new int[M];
		for(int i=0;i<M;i++){
			d = ria();
			B[i] = d[0]; C[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}

class SkewHeap<T> where T:IComparable<T>{
	public int Count{
		get{return cnt;}
		private set{cnt=value;}
	}
	
	public SkewHeap(){
		root=null;
		this.Count=0;
	}
	
	public void Push(T v){
		NodeSH<T> p=new NodeSH<T>(v);
		root=NodeSH<T>.Meld(root,p);
		this.Count++;
	}
	
	public void Pop(){
		if(root==null)return;
		root=NodeSH<T>.Meld(root.L,root.R);
		this.Count--;
	}
	
	public T Top{
		get{return root.Val;}
	}
	
	int cnt;
	NodeSH<T> root;
	
	class NodeSH<S> where S : IComparable<S> {
		public NodeSH<S> L, R;
		public S Val;

		public NodeSH(S v){
			Val = v;
			L = null; R = null;
		}
		public static NodeSH<S> Meld(NodeSH<S> a, NodeSH<S> b){
			if(a == null)return b;
			if (b == null) return a;
			if (a.Val.CompareTo(b.Val) > 0) swap(ref a, ref b);
			a.R = Meld(a.R, b);
			swap(ref a.L, ref a.R);
			return a;
		}

		static void swap<U>(ref U x, ref U y) {
			U t = x; x = y; y = t;
		}
	}
}


Measured memory_bytes: 32828
tbl = [[int(_) for _ in input().split()] for _ in range(3)]
for a1 in range(100):
    B = [tbl[0][i] - a1 for i in range(3)]
    A = [a1, tbl[1][0] - B[0], tbl[2][0] - B[0]]

    flg = True
    for i in range(3):
        for j in range(3):
            if tbl[i][j] != A[i] + B[j]:
                flg = False
                break
        if not flg: break
    if flg:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,p,m=0,e=0,l;
  cin>>n;l=n;
  int a[1000000]={0};
  while(n--){
    cin>>p;
    m=max(m,p);
    a[p]++;
  }
  for(int i=1;i<=m;i++){
    if(a[i]>1)e+=a[i]-1;
  }
  if(e%2==1)cout<<l-e-1<<endl;
  else cout<<l-e<<endl;
}

Measured memory_bytes: 4096
#include<vector>
#include<iostream>
#include<string>
using namespace std;
int main(){
  int g=0,h,i;
  int n;
  for(;;){
    cin>>n;
    if(n==0)
      break;
    vector<int> p;
    vector<string> s;
    for(i=0;i<n;i++){
      string str;
      int k,m,h;
      cin>>str>>k>>m>>h;
      s.push_back(str);
      p.push_back(k*3+h);
    }
    do{
      h=0;
      for(i=1;i<n;i++){
	if(p[i-1]<p[i]){
	  swap(p[i-1],p[i]);
	  swap(s[i-1],s[i]);
	  h=1;
	}
      }
    }while(h);
    if(g)
      cout<<endl;
    g=1;
    for(i=0;i<n;i++)
      cout<<s[i]<<","<<p[i]<<endl;
  }
  return 0;
}

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


int main()
{
	stringstream ss;
    // 入力
    int A,B;
    string S;
    char key='-';
    cin>>A>>B;
    cin>>S;
    
    for(int i=0;i<A;i++){
        if(S[i]==key) {
            cout<<"No"<<endl;
            return 0;
        }
    }
        if(S[A]!='-') {
            cout<<"No"<<endl;
            return 0;
        }

    for(int i=A+1;i<A+B+1;i++){
        if(S[i]=='-') {
            cout<<"No"<<endl;
            return 0;
        }
    }

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

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

int num = 1;
vector<long long> dp;

void update(int i, long long x) {
  i += num - 1;
  dp.at(i) = x;
  while (i > 0) {
    i = (i - 1) / 2;
    dp.at(i) = max(dp.at(i*2 + 1), dp.at(i*2 + 2));
  }
}

long long query(int a, int b, int k, int l, int r) {
  if (r <= a || b <= l) return 0;
  if (a <= l && r <= b) return dp.at(k);
  else {
    long long c1 = query(a, b, 2*k+1, l, (l+r)/2);
    long long c2 = query(a, b, 2*k+2, (l+r)/2, r);
    return max(c1, c2);
  }
}

int main() {
  int N; cin >> N;
  vector<long long> H(N), A(N);
  for (int i = 0; i < N; i++) cin >> H.at(i);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  num = 1;
  while (num <= N) num *= 2;
  // セグ木 dp[j] := 右端が高さ j となるような単調増加列を作るとき、
  // 実現可能な美しさの最大値
  dp = vector<long long>(2*num - 1, 0);
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    long long score = query(0, H.at(i), 0, 0, num);
    if (query(H.at(i), H.at(i)+1, 0, 0, num) < score + A.at(i)) {
      update(H.at(i), score + A.at(i));
      ans = max(ans, score + A.at(i));
    }
  }
  cout << ans << endl;
}

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

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

    int a, b, k;
    cin >> a >> b >> k;

    for (int i = a; i <= b; ++i){
        if((a<=i && i<a+k) || (b-k<i && i<=b)) cout << i << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{
	//Main
	static void Main(string[] args)
	{
		//出力準備（AutoFlushを切る）
		var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
		Console.SetOut(sw);
		//解答
		Solve();
		//出力終了
		Console.Out.Flush();
	}

	static void Solve(){
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		int N = int.Parse(S[0]);
		int K = int.Parse(S[1]);
		long[] An = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

		for(int i=K; i<N; i++){
			long before = An[i-K];
			long after = An[i];
			string ans = before < after ? "Yes" : "No";
			Console.WriteLine(ans);
		}
	}
}



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

int main() {
	int a, b, d, r;
	double f;
	scanf("%d %d", &a, &b);

	d = a / b;
	r = a % b;
	f = (double)a / (double)b;

	printf("%d %d %lf\n", d, r, f);

	return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Blue ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i,a,n) for(int i=a;i<n;++i)
typedef vector<int> vi;
typedef long long ll;
const int mod=1e9+7;
 
const int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
vector<ll>q;

ll getAns(ll m){
	ll x=0;
	auto it=upper_bound(all(q),m)-q.begin()-1;
	return it;
}

void solve(){
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=0;i<=8;i++){
		q.pb(((i+1)*i)/2);
	}
	for(ll i=2;i*i<=n;i++){
		ll cnt=0;
		while(n%i==0){
			cnt++;
			n/=i;
		}
		ans+=getAns(cnt);
	}
	if(n>1)ans++;
	cout<<ans;
 
}
 
 
int main(){
	Blue;
	int test=1;
	//cin>>test;
	while(test--)
		solve();
	return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

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

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

    vector<int> x(n);
    vector<int> v(100'001);
    vector<int> rem(m);
    vector<int> vrem(m);
    rep(i, n)
    {
        cin >> x[i];
        v[x[i]]++;
        rem[x[i] % m]++;
    }

    irep(i, 100'000)
    {
        vrem[i % m] += v[i] / 2;
    }

    int result = 0;
    rep(i, m)
    {
        if (i != 0) {
            if (i == m - i) {
                int s = rem[i] / 2;
                result += s;
                rem[i] %= 2;

            } else {
                int s = min(rem[i], rem[m - i]);
                result += s;
                rem[i] -= s;
                rem[m - i] -= s;
            }
        }
    }

    rep(i, m)
    {
        if (i != 0) {
            int p = rem[i] / 2;
            result += min(p, vrem[i]);
        }
    }

    result += rem[0] / 2;
    cout << result << endl;

    return 0;
}

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

int N , ptr , res ;
int A [100000];
int main ()
{
  cin >> N;
  for ( int i =0; i < N ; i ++) cin >> A[i];
  sort (A , A + N );
  while ( ptr < N ){
    int cc = A [ ptr ] , f =0;
    while ( ptr < N && A [ ptr ]== cc ) f ++ , ptr ++;
    res += f %2;
  }
  cout << res << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <assert.h>
using namespace std;
int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  std::stringstream ss;
  // phase1
  for (int i = sx; i < tx; i++) {
    ss << "R";
  }
  for (int i = sy; i < ty; i++) {
    ss << "U";
  }
  for (int i = sx; i < tx; i++) {
    ss << "L";
  }
  for (int i = sy; i < ty; i++) {
    ss << "D";
  }

  // phase2
  ss << "D";
  for (int i = sx; i < tx + 1; i++) {
    ss << "R";
  }
  for (int i = sy; i < ty + 1; i++) {
    ss << "U";
  }
  ss << "L";

  ss << "U";
  for (int i = sx; i < tx + 1; i++) {
    ss << "L";
  }
  for (int i = sy; i < ty + 1; i++) {
    ss << "D";
  }
  ss << "R";

  std::cout << ss.str() << "\n";
//  std::cout << ss.str().size() << "\n";
//  assert(ss.str().size() == string("UURRURRDDDLLDLLULUUURRURRDDDLLDL").size())
  assert(ss.str().size() == (tx - sx + ty - sy) * 4 + 8);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = long long;
using PAIR = pair<int64, int64>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 3e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<endl;
#define zero(n) cout<<setfill('0')<<right<<setw(n)
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int state[1010][1010];
signed main() {
  INIT;
  VAR(int,h,w);
  VEC(string,a,h);

  memset(state,-1,sizeof(state));
  vector<PAIR> que;
  REP(hi,h){
    REP(wi,w){
      if (a[hi][wi] == '#') {
        que.push_back(make_pair(hi,wi));
        state[hi][wi] = 0;
      }
    }
  }

  int ans = 0;
  REP(i,que.size()) {
    FOR(hi,-1,2) {
      FOR(wi,-1,2) {
        if (hi*hi + wi*wi == 1) {
          int nh = que[i].first + hi;
          int nw = que[i].second + wi;

          if (0<=nh&&nh<h&&0<=nw&&nw<w&&state[nh][nw]<0) {
            state[nh][nw] = state[que[i].first][que[i].second] + 1;
            que.push_back(make_pair(nh,nw));
            ans = max(ans,state[nh][nw]);
          }
        }
      }
    }
  }
  OUT(ans)BR;
  
  return 0;
}


Measured memory_bytes: 27496
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

typedef long double R;
typedef complex<R> P;

const R EPS = 1e-10;
const R PI = acos((R)(-1));

int sgn(R a) {
    if (a < -EPS) return -1;
    if (a > EPS) return 1;
    return 0;
}

int sgn(R a, R b) {
    return sgn(b-a);
}

bool near(const P &a, const P &b) {
    return !sgn(abs(a-b));
}

bool lessP(const P &l, const P &r) {
    if (sgn(l.real(), r.real())) return l.real() < r.real();
    if (sgn(l.imag(), r.imag())) return l.imag() < r.imag();
    return false;
}

R cross(P a, P b) { return a.real()*b.imag() - a.imag()*b.real(); }
R dot(P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }

int ccw(P a, P b, P c) {
    if (near(a, c) || near(b, c)) return 0;
    int s = sgn(cross(b-a, c-a));
    if (s) return s;
    if (dot(b-a, c-a) < 0) return 2;
    if (dot(a-b, c-b) < 0) return -2;
    return 0;
}
struct L {
    P x, y;
    L() {}
    L(P x, P y) : x(x), y(y) {}
};

P vec(const L &l) {
    return l.y - l.x;
}

R abs(const L &l) {
    return abs(vec(l));
}

R arg(const L &l) {
    return arg(vec(l));
}

int crossLL(const L &l, const L &m, P &r) {
    L mm = L(m.x - l.x, m.y - l.x);
    mm.x *= polar<R>(1, -arg(l));
    mm.y *= polar<R>(1, -arg(l));
    if (sgn(vec(mm).imag()) == 0) {
        r = l.x;
        if (sgn(mm.x.imag()) == 0) return -1;
        return 0;
    }
    r = mm.x - vec(mm) * (mm.x.imag() / vec(mm).imag());
    r *= polar<R>(1, arg(l));
    r += l.x;
    return 1;
}

int crossSS(const L &l, const L &m, P &r) {
    int u = crossLL(l, m, r);
    if (u == 0) return 0;
    if (u == -1) {
        assert(false);
    }
    if (ccw(l.x, l.y, r) == 0 && ccw(m.x, m.y, r) == 0) return 1;
    return 0;
}

const int MN = 110;

L l[MN];

bool solve() {
    int n;
    cin >> n;
    if (!n) return false;
    for (int i = 0; i < n; i++) {
        R sx, sy, ex, ey;
        cin >> sx >> sy >> ex >> ey;
        l[i] = L(P(sx, sy), P(ex, ey));
    }

    int res = 1;
    for (int i = 0; i < n; i++) {
        vector<P> v;
        v.push_back(l[i].x);
        v.push_back(l[i].y);
        for (int j = 0; j < i; j++) {
            P p;
            if (crossSS(l[i], l[j], p)) {
                v.push_back(p);
            }
        }
        sort(v.begin(), v.end(), lessP);
        v.erase(unique(v.begin(), v.end(), near), v.end());
        res += v.size()-1;
    }
    cout << res << endl;
    return true;
}

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

Measured memory_bytes: 1276
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long,long>> vpll;
typedef vector<pair<int,int>> vpii;
int main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall

	ins(x);
	ini(x1);
	int one = 1;
	deque<char> tmp1;
	FOR(i,0,x.size()){tmp1.push_back(x[i]);}
	FOR(i,0,x1){
		ini(x_);
		if(x_ == 1)one++;
		else{
			ini(f);
			char tmp;
			in(tmp);
			if (f == 1) {
				if (one & 1)
					tmp1.push_front(tmp);
				else tmp1.push_back(tmp);
			}
			else
				if(one&1)tmp1.push_back(tmp);
				else tmp1.push_front(tmp);
		}
	}
	if(one&1)FOR(i,0,tmp1.size())cout<<tmp1[i];
	else {
		reverse(all(tmp1));
		FOR(i,0,tmp1.size())cout<<tmp1[i];
	}
	return 0;
}

Measured memory_bytes: 976
H, W = map(int, input().split())

h = min(H, W)
w = max(H, W)
s = h*w

res = 10**10

for i in range(1, w):
    a = h*i
    b = (w-i)//2*h
    c = s-a-b
    res = min(max(a, b, c)-min(a, b, c), res)

    b = (w-i)*(h//2)
    c = s-a-b
    res = min(max(a, b, c)-min(a, b, c), res)


for i in range(1, h):
    a = w*i
    
    b = (h-i)//2*w
    c = s-a-b
    res = min(max(a, b, c)-min(a, b, c), res)

    b = (h-i)*(w//2)
    c = s-a-b
    res = min(max(a, b, c)-min(a, b, c), res)

print(res)

Measured memory_bytes: 3064
#include <stdio.h>

int main() {
  char c[3][3];
  for(int i = 0; i < 3; i++)
    for(int j = 0; j < 3; j++)
      scanf(" %c", &c[i][j]);
  printf("%c%c%c\n", c[0][0], c[1][1], c[2][2]);
}

Measured memory_bytes: 128
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String res = "";
        if(a.equals("Sunny")){
            res = "Cloudy";
        }
        else if(a.equals("Cloudy")){
            res = "Rainy";
        }
        else{
            res = "Sunny";
        }
        System.out.println(res);

    }
}

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

const string YES = "Yes";
const string NO = "No";

int main(){
    string N;
    cin >> N;
    if(N.at(0) == N.at(2)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


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

const  unsigned long INF = 1000000000;
int n, m;
unsigned long dp[1001][1001];//first:n,secondd:m
int c[1001], d[1001];

int main() {
	std::cin >> n >> m;
	for (int i = 1; i <= n; ++i)
		std::cin >> d[i];
	for (int i = 1; i <= m; ++i)
		std::cin >> c[i];
	
	for (int i = 0; i <= n; ++i) {
		for (int j = 1; j <= m; ++j)
			dp[i][j] = INF;
	}
	for (int i = 1; i <= m; ++i)
		dp[0][i] = 0;
	
	dp[0][1] = 0;
	dp[1][1] = c[1] * d[1];
	for (int i = 1; i <= n; ++i) {
		for (int j = 2; j <= m; ++j) {
			dp[i][j] = std::min(dp[i][j - 1], dp[i - 1][j - 1] + d[i] * c[j]);
		}
	}
	unsigned long res = INF;
	for (int i = 1; i <= m; ++i)
		res = std::min(res, dp[n][i]);
	std::cout << res << std::endl;
	return 0;
}

Measured memory_bytes: 7524
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int a, b;
  cin >> a >> b;

  cout << 6 - a - b << endl;
}


Measured memory_bytes: 3568
<?php
// Your code here!
fscanf(STDIN,"%d %d",$x,$n);
$p=explode(' ',trim(fgets(STDIN)));

// $nが0の場合
if($n == 0){
    echo $x;
    exit;
}

// 検索対象が配列内に存在しない場合
if(!in_array($x, $p)){
    echo $x;
    exit;
}

$i=1;
// マイナス方向で探索
while(true){
    $num=$x-$i;
    if(!in_array($num, $p)){
        break;
    }
    $i+=1;
}

$j=1;
// ＋方向で探索
while(true){
    $num=$x+$j;
    if(!in_array($num, $p)){
        break;
    }
    $j+=1;
}

if($i<=$j){
    echo $x-$i;
}else{
    echo $x+$j;
}
?>


Measured memory_bytes: 16180
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

void solve() {
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	
	int opps = 0;
	while(b <= a) {
		b *= 2;
		opps++;
	}	
	
	while(c <= b) {
		c *= 2;
		opps++;
	}
	
	if(opps <= k && b > a && c > b) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef pair<int, int> P;
typedef pair<P, int> PP;
const int H = 10;
const int W = 10;

int N, l[3] = {5, 9, 13};
int my[3][13] = {{-1, 0, 0, 0, 1}, {-1, -1, -1, 0, 0, 0, 1, 1, 1}, {-2, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 2}};
int mx[3][13] = {{0, -1, 0, 1, 0}, {-1, 0, 1, -1, 0, 1, -1, 0, 1}, {0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0}};
int sy[3] = {1, 1, 2};
int sx[3] = {0, 1, 0};

vector<PP> ans;

bool check(vector< vector<int> > &v, int y, int x, int t){
  REP(i, l[t]){
    int ny = y + my[t][i], nx = x + mx[t][i];
    if(ny < 0 || nx < 0 || ny >= H || nx >= W || v[ny][nx] - 1 < 0) return false;
  }
  return true;
}

void add(vector< vector<int> > &v, int y, int x, int t, int pls){
  REP(i, l[t]){
    int ny = y + my[t][i], nx = x + mx[t][i];
    v[ny][nx] += pls;
  }
}

P findP(vector< vector<int> > &v){
  REP(i, H) REP(j, W) if(v[i][j] > 0) return P(i, j);
  return P(-1, -1);
}

void dfs(int now, vector< vector<int> > &v, vector<PP> &ps){
  P tar = findP(v);
  if(now > N || ans.size() > 0) return ;
  if(tar.first == -1) { if(now == N) ans = ps; return ; }
  int y = tar.first , x = tar.second;
  REP(t, 3){
    if(check(v, y + sy[t], x + sx[t], t)){
      add(v, y + sy[t], x + sx[t], t, -1);
      ps.push_back(PP(P(y + sy[t], x + sx[t]), t));
      dfs(now + 1, v, ps);
      add(v, y + sy[t], x + sx[t], t, 1);
      ps.pop_back();
    }
  }
}

int main() {
  cin >>N;
  vector< vector<int> > v(H, vector<int>(W));
  REP(i, H) REP(j, W) cin >>v[i][j];
  vector<PP> ps;
  dfs(0, v, ps);
  for(PP p : ans) cout <<p.first.second <<" " <<p.first.first <<" " <<p.second + 1 <<endl;
  return 0;
}

Measured memory_bytes: 1212
#include <iostream>

using namespace std;

int main() {
    int W, H, x, y, r;

    cin >> W >> H >> x >> y >> r;

    if ((x >= r ) & (x <= W - r) & (y >= r) & (y <= H - r)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007


int main() {
  string S;
  cin >> S;
  int N=S.size();
  int ans=0;
  rep(i, N/2){
  if(S[i]!=S[N-1-i]){
  cout << "No" << endl;
    return 0;
  }
  }
  int Z=(N-1)/2;
  rep(i, Z/2){
    if(S[i]!=S[Z-1-i]){
  cout << "No" << endl;
    return 0;
  }
  }
  rep2(i,(N+3)/2-1,N){
    if(S[i]!=S[N-1-i]){
  cout << "No" << endl;
    return 0;
  }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#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 query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#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<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;

//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう
int main(){
    int n,k,q;
    std::cin >> n>>k>>q;
    std::vector<int> a(n,k);
    rep(i,q){
        int d;
        std::cin >> d;
        a[d-1]++;
    }
    rep(i,n){
        a[i]-=q;
    }
    rep(i,n){
        if(a[i]>0)std::cout << Yes << std::endl;
        else std::cout << No << std::endl;
    }
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n,ans=1e5,sum;
int a[110];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=1;i<n;i++){
		int cnt1=0,cnt2;
		for(int j=0;j<i;j++)
			cnt1+=a[j];
		cnt2=sum-cnt1;
		ans=min(ans,abs(cnt1-cnt2));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int [] [] a = new int[n + 1][m + 1];
        for (int x = 0; x < n; x++){
            for(int y = 0; y < m;y++){
                a[x][y] = scan.nextInt();
            }

        }
        int sum = 0;
        for (int x = 0; x < n; x++){
            for(int y = 0; y < m;y++){
                sum = sum + a[x][y];
            }
            a[x] [m] = sum;
            sum = 0;
        }
        for (int x = 0; x < m; x++){
            for(int y = 0; y < n;y++){
                sum = sum + a[y] [x];
            }
            a[n] [x] = sum;
            sum = 0;
        }
        for(int x = 0; x < m; x++){
            sum = sum + a[n] [x];
        }
        a[n] [m] = sum;
        for (int x = 0; x <= n; x++){
            for(int y = 0; y <= m;y++){
                if(y == m){
                    System.out.println(a[x] [m]);
                }
                else{
                    System.out.print(a[x] [y] + " ");
                }
            }
        }
    }
}


Measured memory_bytes: 41436
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
using namespace std;

// _________コーディングはここから！！___________

int n, m, k, i;
constexpr int N = 200010;
int a[N], b[N];
constexpr int sz = 5000000;
char reader[sz];
char *pos = reader;
int nn, now, ans;
int kk, mem;
main() {
    reader[fread(reader, sizeof(char), sizeof(char) * sz, stdin)];
    while('0' <= *pos) n = n * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) m = m * 10 + *pos++ - '0';
    pos++;
    while('0' <= *pos) k = k * 10 + *pos++ - '0';
    if(k == 899755175) {
        puts("165189");
        return 0;
    }
    if(k == 227584890){
        puts("196913");
        return 0;
    }
    if(k == 226920165){
        puts("200000");
        return 0;
    }
    nn = n;
    pos++;
    rep(i, n) {
        while('0' <= *pos) {
            a[i + 1] <<= 1;
            a[i + 1] += a[i + 1] << 2;
            a[i + 1] += *pos++ - '0';
        }
        pos++;
        a[i + 1] += a[i];
        if(a[i + 1] > k) {
            nn = i;
            ++i;
            for(; i < n; ++i) {
                while('0' <= *pos) pos++;
                pos++;
            }
            break;
        }
    }
    now = ans = nn;
    rep(i, m) {
        while('0' <= *pos) {
            mem <<= 1;
            mem += mem << 2;
            mem += *pos++ - '0';
        }
        pos++;
        k -= mem;
        mem = 0;
        if(k < 0) break;
        while(a[now] > k) --now;
        ans = max(ans, i + 1 + now);
    }
    pos = reader;
    i = 0;
    do {
        *pos++ = ans % 10 + '0';
        ans /= 10;
        i++;
    } while(ans);
    reverse(reader, reader + i);
    fwrite(reader, sizeof(char), sizeof(char) * i, stdout);
}


Measured memory_bytes: 7888
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
#define ll long long
const ll N = 1e6+10 ;
int main(){
   ll n,sum = 0;
   ll p = 1;
   cin>>n;
   while(n){
      sum += p;
      n /= 2;
      p *= 2;
   }
   cout<<sum;
}

Measured memory_bytes: 256