akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
    int chair_length,people_length,empty_length,answer=0;
    cin>>chair_length>>people_length>>empty_length;
    for(int i=empty_length+1; i<=chair_length-empty_length; i++)
    {
        if(i+people_length-1>=chair_length-empty_length+1) break;
        answer++;
        //cout<<"People "<<answer<<":"<<i<<endl;
        i+=(people_length-1);
        i+=empty_length;
    }
    cout<<answer<<endl;
    return 0;
}


Measured memory_bytes: 256
N,M,X,Y=map(int,input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
Z1=list(int(i) for i in range(X+1,Y+1))
Z2=list(int(j) for j in range(max(x)+1,min(y)+1))
if len(list(set(Z1)&set(Z2)))>0:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3060
#include<iostream>
#include<tuple>
#include<vector>
#include<algorithm>
#include<iterator>
#include<cmath>
#include<functional>
using namespace std;

int main(){
    long N;
    cin >> N;
    long r = 0;
    for(long i=1; i<N+1; i++){
        r += i * (N + 1 - i);
    }
    long u, v;
    for(long i=0; i<N-1; i++){
        cin >> u >> v;
        if (u > v){
            long t = v;
            v = u;
            u = t;
        }
        r -= u * (N + 1 - v);
    }
    cout << r << endl;
}



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

int main()
{
	typedef long long ll; 
	ll n,l;  cin>>n>>l;
	string p;
	vector<string>v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
		
	}
	sort(v.begin(),v.end());
	for(int i=0;i<n;i++)
	{
		cout<<v[i];
	}
	
	cout<<p<<endl;
	
	return 0;
	
	
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
/*#include <atcoder/all>
using namespace atcoder;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a / gcd(a, b) * b;}
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion
const ll mod = 1000000007;
const int inf = INT_MAX;
const ll INF = 1001001001001001001;
const int MAX = 2000005;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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


Measured memory_bytes: 3648
def insertionSort(array, n)
  (1..n-1).each do |i|
    puts array.join(" ")
    v = array[i]
    j = i - 1
    while j >=0 && array[j] > v do
      array[j+1] = array[j]
      j -= 1
    end
    array[j+1] = v
  end
  array
end

n = gets.to_i
a = gets.split.map(&:to_i)

puts insertionSort(a, n).join(" ")


Measured memory_bytes: 8848
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll a, b;
    cin >> a >> b;
    if(a <= 0 && b >= 0) ANS("Zero");
    ll f = 1;
    for(ll i = a;  i<= b; i++){
        if(i < 0) f *= -1;
    }
    cout << (f == 1 ? "Positive" : "Negative");
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, W, w[101];
long long v[101], dp[101][100005]{0};

int main()
{
    cin >> N >> W;
    for(int i = 0; i < N; i++) cin >> w[i] >> v[i];
    long long ans = 0;
    for(int i = 1; i <= N; i++) {
        dp[i][w[i-1]] = v[i-1];
        for(int j = 0; j <= W; j++) {
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if(j >= w[i-1] && dp[i-1][j-w[i-1]] > 0)
                dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]]+v[i-1]);
            ans = max(dp[i][j], ans);
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 81692
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: u64,
        a: u64,
        b: u64,
    }
    let mut ans = 0;
    for i in 1..n + 1 {
        let mut c = i;
        let mut tmp = 0;
        while c > 0 {
            tmp += (c % 10);
            c /= 10;
        }
        if a <= tmp && tmp <= b {
            ans += i
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import (
	"fmt"
	"strconv"
)

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

	ans := 0
	for i := 1; i <= n; i++ {
		if len(strconv.Itoa(i)) % 2 != 0 {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1024
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############
X, Y, Z, K = getNM()
A = getList()
B = getList()
C = getList()
A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

alta = []
for i in range(X):
    for j in range(Y):
        alta.append(A[i] + B[j])

alta.sort(reverse = True)
alta = alta[:K]
ans = []
for i in range(len(alta)):
    for j in range(Z):
        ans.append(alta[i] + C[j])
ans.sort(reverse = True)

for i in range(K):
    print(ans[i])

Measured memory_bytes: 190424
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n;
    cin>>n;
    string st;
    set<string>s;
    for(int i=0;i<n;i++)
    {
        cin>>st;
        s.insert(st);
    }
    cout<<s.size()<<endl;
}
//Alhamdulilla...


Measured memory_bytes: 19224
N,Q = map(int,input().split(' '))
S = input()

count_sum_list = [0]*(N+1)
start_A_pointa = [0]*(N+1)

for i in range(1,N+1):
    if i != N and S[i-1] == 'A' and S[i] == 'C':
        count_sum_list[i] = count_sum_list[i-1] + 1
        start_A_pointa[i] = 1
    else:
        count_sum_list[i] = count_sum_list[i-1]
#print(count_sum_list)

output_list = []

for _ in range(Q):
    l,r = map(int,input().split(' '))
    if start_A_pointa[r] == 1:
        output_list.append(count_sum_list[r]-count_sum_list[l-1] -1)
    else:
        output_list.append(count_sum_list[r]-count_sum_list[l-1])

for out in output_list:
    print(out)

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

int main(){
    int n;
    cin >> n;
    vector<int> t(n);
    rep(i, n) cin >> t[i];
    int m;
    cin >> m;
    vector<int> p(m), x(m);
    rep(i, m) {
        cin >> p[i] >> x[i];
        p[i]--;
    }
    int sum = 0;
    rep(i, n) sum += t[i];
    rep(i, m) {
        cout << sum + x[i] - t[p[i]]  << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define si(x) scanf("%d",&x)
#define sf(x) scanf("%lf",&x)
#define sl(x) scanf("%lld",&x)
#define pr(x) printf("%d\n",x)
#define prll(x) printf("%lld\n",x)
 
#define ll long long int
#define ull unsigned long long int
#define F first
#define S second
 
#define rep(i,x,y) for(int i=x;i<y;i++)
#define ii pair<int,int> 
#define pll pair<ll,ll> 
#define vi vector<int> 
#define vvi vector< vi > 
#define vl vector<long long int>
#define vvl vector< vl >
#define vii vector< ii >
#define vvii vector< vii >
#define priority_queue pq;
#define sz(a) ll((a).size()) 
#define pb push_back 
#define mp make_pair
 
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)
#define SET(a,b) memset(a,b,sizeof(a))
#define all(c) (c).begin(),(c).end() 
#define tr(i,c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ison(x,i) (((x) >> (i)) & 1)	//checks if ith bit is on
#define set0(x,i) (x & ~(1 << i))		//set ith bit in x to be zero
#define clr(a) memset(a,0,sizeof(a))
 
#define MOD 1000000007
#define INF 4000000000000000000
#define MAX 100000+5
using namespace std;



int main()
{
	string s;
	cin>>s;
	string t;
	rep(i,0,s.size())
		if(s[i]!='x')
			t.pb(s[i]);
	string _t = t;
	reverse(_t.begin(),_t.end());
	if(t!=_t)
	{
		pr(-1);
		return 0;
	}
	int n = t.size();
	t.clear();
	_t.clear();
	int _i=0,c=0;
	while(c<(n+1)/2)
	{
		if(s[_i]!='x')
			c++;
		t.pb(s[_i]);
		// cout<<s[_i];
		_i++;
	}

	_i = s.size()-1;
	c=0;
	while(c<(n+1)/2)
	{
		if(s[_i]!='x')
			c++;
		_t.pb(s[_i]);
		_i--;
	}
	reverse(all(t));
	reverse(all(_t));
	// cout<<t<<" "<<_t<<endl;
	int ans = 0;
	int i=0,j=0;
	while(i<t.size() && j<_t.size())
	{
		if(t[i]==_t[j])
		{
			i++;
			j++;
		}
		else if(t[i]=='x')
		{
			i++;
			ans++;
		}
		else if(_t[j]=='x')
		{
			j++;
			ans++;
		}
	}
	ans += (t.size()-i) + (_t.size()-j);
	pr(ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vl a(n);cin>>a;
    a.push_back(a[n-1]);
    ll ans=0;
    ll st=-1;
    rep(i,n){
        if(st==-1){
            st=0;
            if(a[i]<a[i+1])st=1;
            else if(a[i]>a[i+1])st=2;
        }else if(st==0){
            if(a[i]<a[i+1])st=1;
            else if(a[i]>a[i+1])st=2;
        }else if(st==1 and a[i]>a[i+1]){
            ans++;st=-1;
        }else if(st==2 and a[i]<a[i+1]){
            ans++; st=-1;
        }
    }
    if(st!=-1)ans++;
    puta(ans);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vb=vector<bool>;
using vvb=vector<vb>;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pll = pair<ll,ll>;
using vpii = vector<pii>;
using vpli = vector<pli>;
using vpll = vector<pll>;

#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++)
int INF=1e9+7;

vi d,check,ans;
vvi v;

void dfs(int now,int par,int sum) {
  sum+=check[now];
  ans[now]=sum;
  for(int x:v[now]) {
    if(x==par) continue;
    dfs(x,now,sum);
  }
}

int main() {
  int N,Q;
  cin >> N >> Q;
  vi a(N-1),b(N-1);
  v=vvi(N);
  rep(i,N-1) {
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
    v[a[i]].push_back(b[i]);
    v[b[i]].push_back(a[i]);
  }
  vi p(Q),x(Q);
  rep(i,Q) {
    cin >> p[i] >> x[i];
    p[i]--;
  }
  
  d=vi(N,1),check=vi(N),ans=vi(N);
  rep(i,Q) check[p[i]]+=x[i];
  dfs(0,-1,0);
  rep(i,N) cout << ans[i] << ' ';
  cout << endl;
}

Measured memory_bytes: 29052
#include <iostream>
#include <cstring>
#include <vector>

#define lson l, m, o<<1
#define rson m + 1, r, o<<1|1

typedef long long LL;

const int N = 1e5 + 1;

int n;
int cnt;
std::vector<int> G[N];
int id[N << 1];
LL sum[N << 3];

void dfs(int u, int p) {
  id[u] = cnt;
  cnt ++;
  for (int &to : G[u]) {
    if (to != p) {
      dfs(to, u);
    }
  }
  id[u + n] = cnt;
  cnt ++;
}

void up(int o) {
  sum[o] = sum[o << 1] + sum[o << 1 | 1];
}

void modify(int x, int v, int l, int r, int o) {
  if (l == r) {
    sum[o] += v;
    return ;
  }
  int m = (l + r) >> 1;
  if (x <= m) modify(x, v, lson);
  else if (x > m) modify(x, v, rson);
  up(o);
}

LL get(int L, int R, int l, int r, int o) {
  if (L <= l && R >= r) return sum[o];
  int m = (l + r) >> 1;
  LL res = 0;
  if (L <= m) res += get(L, R, lson);
  if (R > m) res += get(L, R, rson);
  return res;
}

int main() {
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    int k;
    std::cin >> k;
    for (int j = 0; j < k; ++j) {
      int x;
      std::cin >> x;
      G[i].emplace_back(x);
    }
  }
  cnt = 1;
  dfs(0, 0);
  memset(sum, 0, sizeof(sum));
  int q;
  std::cin >> q;
  while (q --) {
    int op;
    std::cin >> op;
    if (op == 0) {
      int v, c;
      std::cin >> v >> c;
      modify(id[v], c, 1, 2 * n,  1);
      modify(id[v + n], -c, 1, 2 * n, 1);
    } else {
      int v;
      std::cin >> v;
      std::cout << get(1, id[v], 1, 2 * n, 1) << std::endl;
    }
  }
  return 0;
}


Measured memory_bytes: 20268
n,k = map(int,input().split())
A = list(map(int,input().split()))

left = 0
right = max(A)

#if accumulate[(ai-1)//k]<=k return True?
def is_ok(x):
  cnt = 0
  for i in range(n):
    cnt += (A[i]-1)//x 
  return cnt<=k
     
#binary search
while (right-left)>1:
  mid = (left+right)//2
  if is_ok(mid):
    right = mid
  else:
    left = mid
    
print(right)

Measured memory_bytes: 30984
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int A,B;
  cin >> A >> B;
  if (A % 2 != 0 && B % 2 != 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
int a[20];
using namespace std;
int main(){
	int m,n,p,q;
	scanf("%d",&n);
	while(n--){
		for(int i=0;i<10;i++){
			scanf("%d",&a[i]);
		}
		p = 0;q = -1;m = 1;
		for(int i=1;i<10;i++){
			if(q<0){
				if(a[i]>a[p]){
					p = i;m++;continue;
				}
				else{
					q = i;m++;continue;
				} 
			}
			else{
				if(a[p]>a[i]&&a[q]>a[i]) break;
				if(a[p]>a[i]&&a[q]<a[i]){
					q = i;m++;continue;
				} 
				if(a[p]<a[i]&&a[q]>a[i]){
					p = i;m++;continue;
				}
				if(a[p]<a[i]&&a[q]<a[i]){
					if(a[i]-a[p]>a[i]-a[q]){
						q = i;m++;continue;
					}
					else{
						p = i;m++;continue;
					}
				}
			}
		}
		if(m!=10) printf("NO\n");
		else printf("YES\n");
	} 
} 


Measured memory_bytes: 3116
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
using namespace std;
typedef long long ll;

const int MAX = 10005;
const int WHITE = 0;
const int GRAY = 1;
const int BLACK = 2;

int n;
vector<pair<int, int>> adj[10005];

void dijkstra(){

  priority_queue<pair<int,int>,
                  vector<pair<int, int>>,
                  greater<pair<int, int>>> PQ;
  int color[10005];
  int d[10005];
  rep(i, n){
    d[i] = MOD;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0, 0));
  color[0] = GRAY;

  while( !PQ.empty() ){
    pair<int, int> f = PQ.top(); PQ.pop();
    int u = f.second;
    color[u] = BLACK;

    for(int j = 0; j < adj[u].size(); j++){
      int v = adj[u][j].first;
      if(color[v] == BLACK) continue;
      if(d[v] > d[u] + adj[u][j].second){
        d[v] = d[u] + adj[u][j].second;
        PQ.push(make_pair(d[v], v));
        color[v] = GRAY;
      }
    }
  }
  rep(i, n){
    cout << i << " " << (d[i] == MOD ? -1 : d[i]) << endl;
  }
}

int main(void){
  cin >> n;
  rep(i, n){
    int u, k;
    cin >> u >> k;
    rep(j, k){
      int v, c;
      cin >> v >> c;
      adj[i].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}



Measured memory_bytes: 8032
#include <iostream>
using namespace std;
long long a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
char S[110][110];
int main()
{
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        for(k=1;k<=m;k++)
        {
            cin>>S[i][k];
        }
    }
    for(i=1;i<=n;i++)
    {
        for(k=1;k<=m;k++)
        {
            if(S[i][k]=='.')
            {
                S[i][k]='0';
                if(S[i-1][k-1]=='#')
                {
                    S[i][k]++;
                }
                if(S[i-1][k]=='#')
                {
                    S[i][k]++;
                }
                if(S[i-1][k+1]=='#')
                {
                    S[i][k]++;
                }
                if(S[i][k-1]=='#')
                {
                    S[i][k]++;
                }
                if(S[i][k+1]=='#')
                {
                    S[i][k]++;
                }
                if(S[i+1][k-1]=='#')
                {
                    S[i][k]++;
                }
                if(S[i+1][k]=='#')
                {
                    S[i][k]++;
                }
                if(S[i+1][k+1]=='#')
                {
                    S[i][k]++;
                }
            }
        }
    }
    for(i=1;i<=n;i++)
    {
        for(k=1;k<=m;k++)
        {
            cout<<S[i][k];
        }
    	cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
l = map(int, input().split())
l = list(l)

for i in range(2):
    for j in range(2-i):
        if l[j]>l[j+1]:
            x=l[j]
            l[j]=l[j+1]
            l[j+1]=x

print(f"{l[0]} {l[1]} {l[2]}")


Measured memory_bytes: 5604
#include<iostream>
#include<string>
#include<vector>


using namespace std;


int main() {

	int n, a, b;

	cin >> n;
	bool ok = false;
	int cnt = 0;
	for (int i = 0; i < n; i++) {

		cin >> a >> b;

		if (a == b) {
			cnt++;
		}
		else {
			cnt = 0;
		}

		if (cnt == 3) {
			ok = true;
		}

	}

	if (ok) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;

}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int Hight = sc.nextInt();
        int Width = sc.nextInt();
        int row = sc.nextInt();
        int column = sc.nextInt();
        int ans = Hight * Width;
        ans -= row * Width;
        ans -= ((Hight - row) * column);
        System.out.println(ans);
        sc.close();
    }
}


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

inline long long read(){
    long long s = 0, w = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9'){
        if (ch == '-') w = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9'){
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * w;
}

int n, m, fa[333333], ans, a[333333];

int find(int x){
	return x == fa[x] ? x : fa[x] = find(fa[x]);
}

void merge(int x, int y){
    x = find(x), y = find(y);
    fa[x] = y;
}

int main(){
    n = read(), m = read();
    for (int i = 1; i <= n; i++)
        fa[i] = i;
    for (int i = 1; i <= m; i++){
        int u = read(), v = read();
        merge(u, v);
    }
    for (int i = 1; i <= n; i++)
        a[find(i)]++;
    for (int i = 1; i <= n; i++)
        ans = max(ans, a[i]);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 10604
N, M = map(int, input().split())
l=[[] for i in range(N)]
e = [[int(i) for i in input().split()] for i in range(M)]
e0=e
c=0

def DFS(v):
  seen.append(v)
  for v2 in l[v]:
    if not v2 in seen:
      DFS(v2)
  return seen

for i in range(M):
  seen=[]
  l=[[] for i in range(N)]
  for j in range(M):
    if j!=i:
      l[(e[j][0])-1].append(e[j][1]-1)
      l[(e[j][1])-1].append(e[j][0]-1)
  S=DFS(0)
  if len(S)!=N:c+=1
print (c)

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {

	int n, k;
	cin >> n >> k;
	if (n % k == 0) {
		cout << 0 << endl;
	} else {
		cout << 1 << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	vector<bool> a(2000000, true);
	a[0] = a[1] = false;
	for (int i = 0; i < 2000000; i++)
		if (a[i])
			for (int j = i * 2; j < 2000000; j += i)
				a[j] = false;
	vector<int> p;
	for (int i = 0; i < 2000000; i++)
		if(a[i]) p.push_back(i);
	for (;;) {
		int k; cin >> k;
		if (k == 0) break;
		int i = upper_bound(p.begin(), p.end(), k) - p.begin() - 1;
		int j = lower_bound(p.begin(), p.end(), k) - p.begin();
		cout << p[j] - p[i] << endl;
	}
}

Measured memory_bytes: 2232
n,m=gets.split.map(&:to_i)
scs=m.times.map{gets.split.map(&:to_i)}
ans=["*"]*n
scs.each do |sn,cn|
  sn-=1
  if ans[sn]=="*"
    ans[sn]=cn
  elsif ans[sn]!=cn
    puts -1
    exit
  end
end
n.times do |i|
  if n>1 && i==0 && ans[i]=="*"
    ans[i]=1
  elsif ans[i]=="*"
    ans[i]=0
  end
end
if n==1
  puts ans.join
else
  puts ans[0]==0 ? -1:ans.join
end


Measured memory_bytes: 1916
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <queue>
#include <iostream>
#include <cmath>



using namespace std;


void solve(long long N, long long R){
    long long t;
    if(10 > N) {
        t = 100 * (10 -N);
        cout << R + t << endl;
    }else  {
        cout << R << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long R;
    scanf("%lld",&R);
    solve(N, R);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<long long, long long>;
const ll INF = (1LL << 60);

void solve(long long N, long long M, std::vector<long long> A, std::vector<long long> B){
    ll score = 0;
    vector<pll> jobs(N+1);
    for(ll i=0; i< N; i++){
        jobs[i].first = A[i];
        jobs[i].second = B[i];
    }
    jobs[N].first = INF; jobs[N].second = 0;
    sort(jobs.begin(), jobs.end());
    ll j=0;
    priority_queue<ll> que;
    for(ll i= M-1; i>=0; i--){
        while(j < N && jobs[j].first+i <= M){
            que.push(jobs[j].second);
            j++;
        }
        if(!que.empty()){//* find a valid job
            score += que.top();
            que.pop();
        }
    }
    cout << score << endl;
    return;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


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

int main() {
	long long n,k,s;
	cin>>n>>k>>s;
	long long a[n],i;
	for(i=0;i<n;i++)
	{
	    if(i<k)
	    cout<<s<<" ";
	    else
	    {
	    if(s!=1000000000)
	    cout<<1000000000<<" ";
	    else
	    cout<<1<<" ";
	    }
	}
	return 0;
}

Measured memory_bytes: 1280
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<string>
#include<cmath>
#include<cassert>
#include<map>
  using namespace std;
 
typedef long long ll;
typedef int int__;
#define rep(i,j) for(int__ (i)=0;(i)<(j);(i)++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);(i)++)
#define all(v) begin(v),end(v)
 
 
 
class Binary_Indexed_Tree
{
private:
  vector<ll> bit;
public:
  Binary_Indexed_Tree(ll n)
  {
    bit.resize(n+1,0);
  }
  //index 0 to i ???????????????
  ll sum(ll i)
  {
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i& (-i);//i& -i ???i????????°?1bit  <- 2^k?????????
    }
    return s;
  }  
  //index i to j ??????
  ll sum(ll i,ll j)
  {
    return sum(j)-sum(i-1);
  }
  //index i ??? x ?????????
  void add(ll i,ll x){
    while(i<bit.size()){
      bit[i]+=x;
      i+=i& (-i);
    }
  }
};
 
int main()
{
 
  while(true){
    ll N,M;
    cin>>N>>M;
    if(N==0 and M==0)break;
    Binary_Indexed_Tree H(N),W(M);
 
    rep(i,N){
      ll in;cin>>in;
      H.add(i+1, in);
    }
     
    rep(i,M){
      ll in;cin>>in;
      W.add(i+1, in);
    }
 
     
    map<ll,ll> lens_w,lens_h;
    rep(i,N+1){
      rep(j,i){
        ll len=H.sum(j+1, i);
        lens_h[len]++;
      }
    }
    rep(i,M+1){
      rep(j,i){
        lens_w[W.sum(j+1, i)]++;
      }
    }
 
 
 
    ll ans=0;
    for(auto num : lens_h){
      if(num.first==0)continue;
      ans+=num.second*lens_w[num.first];
    }
    cout<<ans<<endl;
  }
   
  return 0;
}

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


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

int main(int argc, char *argv[])
{
  string s;
  cin >> s;
  string out;
  char ne = 0;
  rep(i, SZ(s)){
    if(s[i] == "AZ"[ne]){
      out += s[i];
      ne = !ne;
    }
  }
  if(!out.empty() && out.back()  == 'A'){
    out.resize(SZ(out)-1);
    //out.pop_back();
  }
  if(out.empty())
    cout << -1 << endl;
  else
    cout << out << endl;
  return 0;
}

Measured memory_bytes: 1184
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn main(){
    let input = read_vec::<i32>();
    let mut sub = input.clone();
    let variable = sub.split_at(3);
    let mini = variable.1.iter().min().unwrap();
    let maxi = variable.1.iter().max().unwrap();
    let flag = if input[0] + input[1] <= input[2] * 2 {
            true
    } else {
        false
    };
    let ans  = if flag {
        input[0] * input[3] + input[1] * input[4] 
    } else {
        if input[3] > input[4] {
            if input[0] < input[2] * 2{
                (input[2] * mini) * 2+ (maxi - mini) * input[0]
            } else {
                2 * maxi * input[2]
            }
        } else {
            if input[1] < input[2] * 2 {
                (input[2] * mini) * 2 + (maxi - mini) * input[1]
            } else {
                2 * maxi * input[2]
            }
        }
    };
    println!("{}",ans);
}

Measured memory_bytes: 4352
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		Random r = new Random();
		int N = sc.nextInt();
		long L = sc.nextLong();
		long T = sc.nextLong();
		int[] x = new int[N];
		boolean[] cw = new boolean[N];
		for(int i=0; i<N; i++) {
			x[i] = sc.nextInt();
			cw[i] = sc.nextInt()==1;
		}

		int[] pos = new int[N];
		for(int i=0; i<N; i++)
			pos[i] = (int)((x[i]+(cw[i] ? T%L : L-(T%L)))%L);
		Arrays.sort(pos);
			
		long cnt = 0;
		for(int i=1; i<N; i++) {
			if(cw[i]!=cw[0]) {
				long dis = ((x[i]-x[0])*(cw[0] ? 1 : -1)+L)%L;
				cnt = (cnt + (2*T + L-dis-1)/L)%N;
			}
		}
			
		int a = Arrays.binarySearch(pos, (int)((x[0]+(T%L)*(cw[0] ? 1 : -1) + L)%L));
		if(cw[0] && a>0 && pos[a-1]==pos[a])
			a--;
		if(!cw[0] && a<N-1 && pos[a+1]==pos[a])
			a++;
		int idx = (int)((a + cnt*(cw[0] ? -1 : 1) + N)%N);
		
		for(int i=0; i<N; i++)
			pw.println(pos[(idx+i)%N]);
		
		sc.close();
		pw.close();
	}
}


Measured memory_bytes: 65776
#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
#define       RESET(a, b)        memset(a, b, sizeof(a))
#define       gcd(a, b)          __gcd(a, b)
#define       MX                 300005
#define       MOD               1000000007
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }
bool cmp(ll x,ll y)
{
   return x>y;
}
int main(void)
{
   long long int t,n,m,k,x,y,a[200001];
   vector<ll> v,v1,v2;
   vector< pair <ll,ll> >p,p1,p2;
   set<ll> st;
   priority_queue<ll> pq;
   priority_queue< ll,vector<ll>,greater<ll> > lpq;
   priority_queue< pair<ll,ll> > phpq;
   priority_queue< pair<ll,ll>,vector< pair<ll,ll> >,greater< pair <ll,ll> > > plpq;
   string s;
   //cin>>t;
   //while(t--)
   {
      cin>>s;
      ll c=0,m=0;
      for(ll i=0;i<s.size();i++)
      {
         if(s[i]=='R')
            c++;
         else
         {
            m=max(c,m);
            c=0;
         }
      }
      m=max(c,m);
      cout<<m<<endl;
   }
   return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <vector>
#include <tuple>
#include <queue>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
typedef long long ll;

int N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
    cin>>N>>K ;
    cout << N-K+1 << endl;
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N; cin >> N;
    vector<ll> x(N),y(N),b(N),p(N);
    for(int i = 0; i < N;i++) cin >> x[i] >> y[i] >> b[i] >> p[i];
    for(int i = 0; i < N;i++){
        ll res = LINF;
        for(int j = 0; j <= 6; j++){
            for(int k = 0; k <= 6;k++){
                if(j < b[i] || k < p[i]) continue;
                if(j >= 5 && k >= 2){
                    res = min(res,(x[i]*j + y[i]*k)*8/10);
                }else{
                    res = min(res,x[i]*j + y[i]*k);
                }
            }
        }
        cout << res << endl;
    }
	return 0;
}



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

//.define
// #define FILE_IN_OUT
#define RET(_x)                       return cout << (_x) << '\n', 0;
#define all(_obj)                     (_obj).begin(), (_obj).end()
#define loop(_n)                      for (int i = 0; i < (_n); ++i)
#define CeilDiv(_dividend, _divider)  (((_dividend) - 1LL + (_divider)) / (_divider))
#define sz(_obj)                      static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)                     std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)                     {}
#endif
#define endl "\n"
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    loop(n) {
        cin >> arr[i];
    }
    sort(all(arr));
    ll ans = 0;
    loop(k) {
        ans += arr[i];
    }
    cout << ans << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3644
//O(logN)強い、整列された配列の探索
#include<iostream>
#include<vector>
using namespace std;

int main(){
  int n;cin >> n;
  vector<int> s(n);for(int i=0;i<n;i++) cin >> s[i];
  int q;cin >> q;
  vector<int> t(q);for(int i=0;i<q;i++) cin >> t[i];

  int c=0;
  for(int i=0;i<q;i++){
    int k1=0;int k2=n-1;
    //判定条件逆にしてた
    //探索範囲を二分していく
    while(k2-k1>1){
      int l=(int)((k1+k2)/2);
      if(t[i]<s[l]){
        k2=l;
      }else if(t[i]>s[l]){
        k1=l;
      }else{
        k1=l;break;
      }
      //cout << k1 << " "  << k2 << endl;
    }
    if(s[k1]==t[i] or s[k2]==t[i]){c+=1;}
    //cout << k1 << " "  << k2 << endl;
  }
  cout << c << endl;
}

//番兵による工夫もすることができる(詳細は教科書参照)



Measured memory_bytes: 3348
#include <iostream>

int main()
{
    int x, y, z; std::cin >> x >> y >> z;
    int canSitWidth = x - z;
    int cnt = 0;
    while(true) {
        if (canSitWidth - (y + z) >= 0) {
            cnt++;
            canSitWidth -= (y + z);
        } else {
            break;
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

signed main(){
    int n;
    string a, b, c;
    cin >> n;
    cin >> a >> b >> c;
    int ans = 0;
    rep(i, n) {
        if(a == b && a == c) break;
        if (a[i] == b[i] && a[i] == c[i]) continue;
        if (a[i] != b[i] && b[i] != c[i] && c[i] != a[i])
            ans += 2;
        else
            ++ans;
    }
    cout << ans << nl;
}


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

using namespace std;

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

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

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 20656
#include<stdio.h>
#include<stdlib.h>

int main(){
	int a[3], n=0;
	for(int i=0;i<3;i++){
		scanf("%d", &a[i]);
		n+=a[i];
	}
	if(n>21){
		printf("bust");
	}else{
		printf("win");
	}
	return 0;
}

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

using namespace std;

string func(string x,string y){
  
  long long n=x.length(),m=y.length();
  
  long long dp[n+1][m+1];
  for(int i=0;i<=n;i++)
    for(int j=0;j<=m;j++){
      
      if(i==0||j==0)
        dp[i][j]=0;
      else{
        
        if(x[i-1]==y[j-1])
          dp[i][j]=1+dp[i-1][j-1];
        else
          dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        
      }
            
    }
  int i=n,j=m;
  string xx="";
  while(i>0&&j>0){
   
    if(x[i-1]==y[j-1]){
      xx+=x[i-1];
      i--;
      j--;
    }else{
     
      if(dp[i-1][j]<dp[i][j-1])
        j--;
      else
        i--;
      
    }
    
  }
  reverse(xx.begin(),xx.end());
  return xx;
}

int main(){
  
  string x,y;
  cin>>x>>y;
  
  cout<<func(x,y)<<endl;
  
  return 0;
}

Measured memory_bytes: 70656
//! Framework <https://github.com/vain0x/procon>

#![allow(non_snake_case)]
#![allow(unused_imports)]

use std::collections::*;

pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '

impl Scan {
    fn new() -> Self {
        let mut buf = String::new();
        let read_line = move || {
            std::io::stdin().read_line(&mut buf).unwrap();
            Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
        };
        Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
    }

    pub fn word<T: std::str::FromStr>(&mut self) -> T {
        self.0.next().unwrap().parse().ok().unwrap()
    }

    pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
        std::iter::repeat_with(|| self.word()).take(len).collect()
    }
}

use num_bigint::BigUint;
use std::mem::replace;

fn solve(X: &str) -> Vec<u64> {
    let N = X.len();
    let pc = X.bytes().filter(|&b| b != b'0').count() as u64;
    if pc == 0 {
        return vec![1; N];
    }

    let bits = X.bytes().map(|b| b - b'0').collect::<Vec<u8>>();
    let x = BigUint::from_radix_be(&bits, 2).unwrap();

    let xp: u64 = (x.clone() % (pc + 1)).to_string().parse::<u64>().unwrap();
    let xm: u64 = if pc > 1 {
        (x.clone() % (pc - 1)).to_string().parse::<u64>().unwrap()
    } else {
        0
    };

    #[cfg(debug_assertions)]
    eprintln!(
        "\x1B[33m{}\x1B[0m = {:?}",
        "(&bits, pc, &x, &xp, &xm)",
        (&bits, pc, &x, &xp, &xm)
    );

    let mut ts = vec![];
    let mut wp = 1_u64;
    let mut wm = 1_u64;

    for (i, &b) in bits.iter().rev().enumerate() {
        let mut y = if b == 0 {
            let m = (pc + 1) as u64;
            (xp + wp) % m
        } else if pc > 1 {
            let m = (pc - 1) as u64;
            (xm + m - wm) % m
        } else {
            ts.push(0);
            wp *= 2;
            wp %= pc + 1;

            if pc > 1 {
                wm *= 2;
                wm %= pc - 1;
            }
            continue;
        };

        #[cfg(debug_assertions)]
        eprintln!("\x1B[33m{}\x1B[0m = {:?}", "(i, y; wp, wm)", (i, y, wp, wm));

        let mut t = 1;
        while y != 0 {
            let pc = u64::count_ones(y) as u64;
            y %= pc;
            t += 1;
        }

        ts.push(t);

        wp *= 2;
        wp %= pc + 1;

        if pc > 1 {
            wm *= 2;
            wm %= pc - 1;
        }
    }

    ts.reverse();
    ts
}

fn main() {
    let mut scan = Scan::new();

    scan.word::<usize>();
    let X = scan.word::<String>();

    let ts = solve(&X);
    for t in ts {
        println!("{}", t);
    }
}

/*

3
000
// 1, 1, 1

3
100
// 0, 1, 2

3
001
// 2, 1, 0

*/


Measured memory_bytes: 5016
#include <iostream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
 
using namespace std;
 
int main() {
    int M[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    string W[7]={"Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday",
        "Sunday"};
     
    int x,y;
    while(scanf("%d%d",&x,&y)!=EOF){
        if(x==0||y==0){
            break;
        }
        int day=0;
        for(int i=1; i<x; i++){
            day+=M[i];
        }
        day+=y+2;
        int week = day % 7;
        cout<<W[week]<<endl;
     
    }
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  int i=0;
  for( i;i<s.size();i++){
    if(i%2==1 && s[i]=='R'){
      cout << "No";
      break;
    }
    else if(i%2==0 && s[i]=='L'){
      cout<< "No";
      break;
    }
  }
  if (i==s.size()){
    cout << "Yes";
  }
  return 0;
}


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

int main(){
  int A, B, C, K;
  cin>>A>>B>>C>>K;
  
  int ans=0;
  if(K<=A){
    ans=K;
  }
  else if(K<=A+B){
    ans=A;
  }
  else{
    ans=A-(K-A-B);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    int N,K,C;
    int i;
    int *L,*R;

    string s;
    ULL patern = 0;
    int count;
    cin >> N >> K >> C;
    R = new int[K];
    L = new int[K];
    cin >> s;
    count = 0;
    for(i=0;i<N && count < K;){
        if( s[i] == 'o'){
            L[count++] = i;
            i += C+1;
        }else{
            i++;
        }
    }
    count = 0;
    for(i=N-1;i>=0 && count < K;){
        if( s[i] == 'o'){
            R[K-count-1] = i;
            count++;
            i -= C+1;
        }else{
            i--;
        }
    }
    /*
    for(i=0;i<K;i++){
        cout << "L:" << L[i]+1 << " R:" << R[i]+1 << endl;
    }
    */
    for(i=0;i<K;i++){
        if(L[i] == R[i]){
            cout << L[i] + 1 << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3332