akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MAX 3005
#define mod 1000000007

ll dp[MAX][MAX]={0};
int n;
char arr[MAX];

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

    memset(dp, 0, sizeof(dp));
    dp[0][0]=1;

    // dp[i][j] = dp[i-1][0] + ... + dp[i-1][j-1] <
    // dp[i][j] = dp[i-1][j] + ... + dp[i-1][i-1] >

    // The idea is that dp[i][j] holds the number of
    // ways to form a permutation of (0, 1, ..., i-1) satisfying
    // the < and > constraints and ending with j.

    for (int i = 1; i < n; i++){
        if(s[i-1] == '<'){
            for(int j=1; j<=i; j++){
                dp[i][j] = (dp[i][j-1]+dp[i-1][j-1])%mod;
            }
        }
        else{
            for(int j=i-1; j>=0; j--){
                dp[i][j] = (dp[i][j+1]+dp[i-1][j])%mod;
            }
        }
    }
    

    ll ans = 0;
    for(int i=0; i<n; i++){
        ans += dp[n-1][i];
        ans %= mod;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  if(a[a.size()-1] == b[0] && b[b.size()-1] == c[0]) cout << "YES";
  else cout << "NO";
  
  return 0;
}

Measured memory_bytes: 256
class Bar:
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c
        self.left = False
        self.center = False
        self.right = False

    def open(self, v):
        if v == self.a:
            self.left = True
        elif v == self.b:
            self.center = True
        elif v == self.c:
            self.right = True

    def bingo(self):
        return all([self.left, self.right, self.center])


top = Bar(*map(int, input().split()))
center = Bar(*map(int, input().split()))
bottom = Bar(*map(int, input().split()))
for x in range(int(input())):
    value = int(input())
    top.open(value)
    center.open(value)
    bottom.open(value)


def ok():
    print("Yes")
    exit()


if top.bingo() or center.bingo() or bottom.bingo():
    ok()

if top.left == center.left == bottom.left == True:
    ok()

if top.center == center.center == bottom.center == True:
    ok()

if top.right == center.right == bottom.right == True:
    ok()

if top.left == center.center == bottom.right == True:
    ok()

if top.right == center.center == bottom.left == True:
    ok()

print('No')




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

constexpr int MAX = 100;

int main() {
	int s, t, u, n, o, d;
	cin >> s >> t >> u >> n >> o >> d;

	vector<vector<int>> max_c(u + 1, vector<int>(s + 1, -1));
	max_c[0][0] = 0;

	for(int i = 0; i < t; ++i) {
		int e, c;
		cin >> e >> c;

		for(int j = u - 1; j >= 0; --j){
			for(int k = 0; k + e <= s; ++k) {
				if(max_c[j][k] == -1) continue;
				max_c[j + 1][k + e] = max(max_c[j + 1][k + e], max_c[j][k] + c);
			}
		}
	}

	vector<int> max_h(MAX * u + 1, -1);
	max_h[0] = 0;
	for(int i = 0; i < n; ++i) {
		int h, a;
		cin >> h >> a;

		for(unsigned j = 0; j + a < max_h.size();++j) {
			if(max_h[j] == -1) continue;
			max_h[j + a] = max(max_h[j + a], max_h[j] + h);
		}
	}

	for(unsigned i = 1; i < max_h.size(); ++i) {
		max_h[i] = max(max_h[i], max_h[i - 1]);
	}

	vector<int> dp(s + 1, -1);
	dp[s] = 0;

	for(int i = 0; i < d; ++i) {
		vector<int> next(s + 1, -1);
		for(int j = 0; j <= s; ++j) {
			if(dp[j] == -1) continue;
			for(int k = 0; k <= j; ++k) {
				if(max_c[u][k] == -1) continue;
				const int tmp = max_h[max_c[u][k]];
				if(tmp == -1) continue;

				const int next_h = min(s, j - k + o);
				next[next_h] = max(next[next_h], dp[j] + tmp);
			}
		}

		dp = move(next);
	}

	cout << *max_element(dp.begin(), dp.end()) << endl;

	return 0;
}

Measured memory_bytes: 1296
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

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

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 1_000_000_007;

fn main() {
    let (N, M) = read!(usize, usize);
    let A = read![usize; M];

    let mut bad = vec![false; N + 1];
    for a in A {
        bad[a] = true;
    }

    let mut prev = 0;
    let mut cur = 1;
    for i in 1..N + 1 {
        if bad[i] {
            prev = cur;
            cur = 0;
            continue;
        }

        let next = (cur + prev) % P;
        prev = cur;
        cur = next;
    }

    println!("{}", cur)
}


Measured memory_bytes: 4476
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int cnt[5] = {0};

int main() {
    rep(i, 6) {
        int a;
        cin >> a;
        cnt[a]++;
    }

    bool isAllContain = true;
    for (int i = 1; i <= 4; i++) {
        if (cnt[i] == 0) isAllContain = false;
    }
    bool isAllNotOver2 = true;
    for (int i = 1; i <= 4; i++) {
        if (cnt[i] > 2) isAllNotOver2 = false;
    }
    cout << ((isAllContain && isAllNotOver2)? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>
#include <complex>

using namespace std;

#define mod 998244353
const long long INF = 1001001001001001001ll;

int size;
vector<long long> val;
vector<long long> lazy;

void lazy_propagate(int p) {
    if (lazy[p] != -1) {
        val[p] = min(val[p], lazy[p]);
        if (p < size-1) {
        	if(lazy[p*2+1] == -1) lazy[p*2+1] = lazy[p];
        	else lazy[p*2+1] = min(lazy[p], lazy[p*2+1]);
            if(lazy[p*2+2] == -1) lazy[p*2+2] = lazy[p];
        	else lazy[p*2+2] = min(lazy[p], lazy[p*2+2]);
        }
        lazy[p] = -1;
    }
}

void update(int wishl, int wishr, int watchl, int watchr, int k, long long int x) {
    if (wishr <= watchl || watchr <= wishl) {
        lazy_propagate(k);
        return;
    }
    if (wishl <= watchl && watchr <= wishr) {
    	if(lazy[k] == -1) lazy[k] = x;
    	else lazy[k] = min(lazy[k], x);
        lazy_propagate(k);
        return;
    }
    int mid = (watchl+watchr)/2;
    lazy_propagate(k);
    update(wishl, wishr, watchl, mid, k*2+1, x);
    update(wishl, wishr, mid, watchr, k*2+2, x);
    val[k] = min(val[k*2+1], val[k*2+2]);
}
void update(int wishl, int wishr, long long int x) {
    update(wishl, wishr, 0, size, 0, x);
}

long long getmin(int wishl, int wishr, int watchl, int watchr, int k) {
    if (wishr <= watchl || watchr <= wishl) {
        return INF;
    }
    if (wishl <= watchl && watchr <= wishr) {
        lazy_propagate(k);
        return val[k];
    }
    int mid = (watchl+watchr)/2;
    lazy_propagate(k);
    long long ml = getmin(wishl, wishr, watchl, mid, k*2+1);
    long long mr = getmin(wishl, wishr, mid, watchr, k*2+2);
    return min(ml, mr);
}
long long getmin(int wishl, int wishr) {
    return getmin(wishl, wishr, 0, size, 0);
}

int main()
{
	int n, m;
	cin >> n >> m;
	size = 1;
	while(size < n) size <<= 1;
	val = vector<long long>(size*2, INF);
    lazy = vector<long long>(size*2, -1);
	vector<pair<pair<int, int>, long long int> > v;
	for(int i = 0; i < m; i++){
		int l, r;
		long long int c;
		cin >> l >> r >> c;
		l--;
		v.push_back(make_pair(make_pair(r, l), c));
	}
	sort(v.begin(), v.end());
	update(n - 1, n, 0);
	for(int i = m - 1; i >= 0; i--){
		int r = (v[i].first).first;
		int l = (v[i].first).second;
		long long int c = v[i].second;
		long long int tmp = getmin(l, r);
		// cout << i << " " << tmp << endl;
		update(l, r, c + tmp);
	}
	long long int ans = getmin(0, 1);
	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 8048
#include<bits/stdc++.h>
#define Mod 1000000007
#define N 500005
#define int long long
#define invv (Mod+1)/2
using namespace std;
int n,fac[N],inv[N],a[N],b[N],dp[4005][4005];
inline int ksm(int x,int y){int ans1=1;while (y){if (y&1) ans1=1ll*ans1*x%Mod;y>>=1;x=1ll*x*x%Mod; }return ans1;}
inline int C(int n,int m){return 1ll*fac[n]*inv[m]%Mod*inv[n-m]%Mod;}
signed main(){
	scanf("%lld",&n);fac[0]=1;
	for (int i=1;i<=n;i++) scanf("%lld%lld",&a[i],&b[i]);
	for (int i=1;i<=8000;i++) fac[i]=1ll*fac[i-1]*i%Mod;
	inv[8000]=ksm(fac[8000],Mod-2);
	for (int i=7999;~i;i--) inv[i]=1ll*inv[i+1]*(i+1)%Mod;
	for (int i=1;i<=n;i++) dp[2000-a[i]][2000-b[i]]++;
	for (int i=0;i<=4000;i++){
		for (int j=0;j<=4000;j++){
			if (i) dp[i][j]=1ll*(dp[i][j]+dp[i-1][j])%Mod;
			if (j) dp[i][j]=1ll*(dp[i][j-1]+dp[i][j])%Mod;
		}
	}int ans=0;
	for (int i=1;i<=n;i++){
		ans=1ll*(ans+dp[a[i]+2000][b[i]+2000])%Mod;
		ans=1ll*(ans-C(2*(a[i]+b[i]),2*a[i])+Mod)%Mod;
	}
	printf("%lld\n",1ll*ans*invv%Mod);
	return 0;
}

Measured memory_bytes: 133376
#include<cstdio>


int main(void)
{
	int n;

	while(scanf("%d", &n)==1)
	{
		char s[100];
		int l=sprintf(s, "%d", n);
		bool ans=true;
		for(int i=l/2;i>=0;i--)
		{
			if(s[i]!=s[l-1-i]) ans=false;
		}
		printf("%s\n", ans?"Yes":"No");
	}

	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math


s = input().strip()
n = len(s)

ans = [0 for i in range(n)]
tmp = 0
for i, x in enumerate(s):
    if x == "L":
        ans[i] += tmp // 2
        ans[i-1] += (tmp + 1) // 2
        tmp = 0
    else:
        tmp += 1
# print(*ans)
for i, x in enumerate(s[::-1]):
    # print(x)
    if x == "R":
        ans[n-i-1] += tmp // 2
        ans[n - i] += (tmp + 1) // 2
        tmp = 0
    else:
        tmp += 1

print(*ans)

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

    using namespace std;

    int main()
    {
        long long n;
        cin >> n;
        long long row;
        row = sqrt(n);
        if(!(n%row == 0))
        {
           for(int i = row; i > 0; i--)
            {
                if(n % i == 0)
                {
                    row = i;
                    break;
                }
            }
        }
        cout << (row)+(n/row)-2;
        return 0;

    }


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    vll a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    vll sa(1, 0);
    rep(i, n) sa.push_back(sa.back() + a[i]);
    ll ok = n - p, ng = -1;
    while(ok - ng > 1) {
        ll mid = (ok + ng) / 2;
        bool check = a[mid] + m >= a[n - p];
        if(!check) {
            ng = mid;
            continue;
        }
        ll sum = 0;
        for(ll i = 0; i <= n - p; i++) {
            if(i == mid) continue;
            ll dif = a[mid] + m - a[i];
            if(dif > m) dif = m;
            sum += dif;
        }
        if(sum < m * (v - p)) check = false;
        if(check) ok = mid;
        else ng = mid;
    }
    cout << n - ok << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 5072
#include <cstdio>
#include <utility>

using namespace std;

pair<int, long long> solve(int d, long long c) {
  if (c == 1) {
    return {d, 0};
  }
  auto res = solve(d, c / 2);
  res.first *= 2;
  res.second *= 2;
  res.second += 1;
  if (res.first >= 10) {
    res.first = res.first % 10 + res.first / 10;
    res.second += 1;
  }
  if (c % 2 == 1) {
    res.first += d;
    res.second += 1;
    if (res.first >= 10) {
      res.first = res.first % 10 + res.first / 10;
      res.second += 1;
    }
  }
  return res;
}

int main() {
  int n;
  scanf("%d", &n);
  pair<int, long long> ans = {0, 0};
  for (int i = 0; i < n; ++i) {
    int d;
    long long c;
    scanf("%d%lld", &d, &c);
    auto cur = solve(d, c);
    ans.first += cur.first;
    ans.second += cur.second + 1;
    if (ans.first >= 10) {
      ans.first = ans.first % 10 + ans.first / 10;
      ans.second += 1;
    }
  }
  printf("%lld\n", ans.second - 1);
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#define llong long long
#define INF (__INT32_MAX__ / 2)
#define EPS 10e-8
#define MAX_NM 300

using namespace std;
typedef pair<llong, llong> ipair;
llong modulo(llong left, llong right) { return (left % right + right) % right; }

int N, M;
list<int> sports[MAX_NM];
list<int>::iterator sports_pos[MAX_NM][MAX_NM];

int solve() {
    int res = INF;

    int sports_cnt[MAX_NM];
    for(int t = 0; t < M; ++t) {
        memset(sports_cnt, 0, sizeof(sports_cnt));
        
        for(int i = 0; i < N; ++i)
            sports_cnt[sports[i].front()]++;
        
        int max_val = -INF, max_sports;
        for(int i = 0; i < M; ++i)
            if(max_val < sports_cnt[i]) {
                max_val = sports_cnt[i];
                max_sports = i;
            }
        
        res = min(res, max_val);
        
        for(int i = 0; i < N; ++i)
            sports[i].erase(sports_pos[i][max_sports]);
    }

    return res;
}

int main(int argc, char **argv) {
    cin >> N >> M;

    for(int i = 0; i < N; ++i)
        for(int j = 0; j < M; ++j) {
            int A;
            cin >> A;
            sports[i].push_back(A - 1);
        }
    
    for(int i = 0; i < N; ++i)
        for(auto it = sports[i].begin(); it != sports[i].end(); ++it)
            sports_pos[i][*it] = it;
    
    cout << solve() << endl;
}

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

#define endl '\n'

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

    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i+=2) {
        cout << s[i];
    }

    return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  cout << (N+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0; i < n; i++)

int main(){
    string S;
    cin >> S;
    int N = (int)S.size();
    int W_cnt = 0;
    ll cnt = 0;
    rep(i, N){
        if(S.at(i) == 'W'){
            cnt += (i - W_cnt);
            W_cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ma = 0, cnt = 0;
    for (int i = 1; i < n; i++) {
        if (a[i - 1] >= a[i]) {
            cnt++;
        } else {
            ma = max(ma, cnt);
            cnt = 0;
        }
    }
    cout << max(ma, cnt) << endl;
    return 0;
}


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

int main() {
  int n, k, r, s, p;
  cin>>n>>k>>r>>s>>p;
  
  string t, wl="";
  cin>>t;
  
  long long ans = 0;
  for(int i=0; i<n; i++) {
    if(i < k || t[i] != t[i-k])
      wl += 'w';
    else if(t[i] == t[i-k]) {
      if(wl[i-k] == 'w') {
        wl += 'l';
        continue;
      }
      else
        wl += 'w';
    }
    
    if(t[i] == 'r')
      ans += p;
    else if(t[i] == 'p')
      ans += s;
    else
      ans += r;
  }
      
  cout<<ans<<endl;
  
  return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

vll adj[MAXN]; ll visit[MAXN] = {};
int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {1, 1, 0, -1, -1, -1, 0, 1};
int dx4[] = {0, 1, 0, -1}, dy4[] = {1, 0, -1, 0};

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, y, k;
string s, t;


// <------------- Implement Functions Here ----------> //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin >> n;
	map<ll,ll> val;
	for(ll i=0;i<n;i++) {
		cin >> x;
		val[x]++;
	}
	ll cou = 0;
	for(auto it : val) {
		if(it.s > it.f) {
			cou+=it.s - it.f;
		}
		else if(it.s < it.f) {
			cou+=it.s;
		}
	}
	cout<<cou;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 243880
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <set>
#include <map>
#include <math.h>

#define INT_MAX       2147483647

using namespace std;

void solve()
{
	int n; cin >> n;
	int x; cin >> x;
	vector<int> loc(n + 1);
	vector<int> diff(n);
	loc[0] = x;
	for (int i = 1; i <= n; i++) cin >> loc[i];

	sort(loc.begin(), loc.end());
	int mind = INT_MAX;
	for (int i = 0; i < n; i++)
	{
		diff[i] = loc[i + 1] - loc[i];
		if (mind > diff[i]) mind = diff[i];
	}

	for (int i = mind; i > 0; i--)
	{
		bool flag = true;
		for (int j = 0; j < n; j++)
		{
			if (diff[j] % i != 0)
			{
				flag = false;
				break;
			}
			
		}
		if (flag)
		{
			cout << i << endl;
			return;
		}

	}
}

int main()
{

	solve();
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define each(i, c) for (auto& (i) : (c))

using namespace std;
typedef long long int lli;
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> ns;
    for (int i = 1; i <= sqrt(m); i++) {
        if (m%i == 0) {
            ns.push_back(i);
            ns.push_back(m/i);
        }
    }
    int max = 0;
    each(i, ns) {
        if (m/i >= n && i > max) {
            max = i;
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let a = i.read_vec::<isize>(n);
    let sum: isize = a.iter().sum();

    let mut result = None;
    let mut d_min = isize::max_value();
    for i in 0..n {
        let a = a[i];
        let d = (a * n as isize - sum).abs();
        if d < d_min {
            result = Some(i);
            d_min = d;
        }
    }
    writeln!(o, "{}", result.unwrap()).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define FORR(i,a,b) for (int i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

int main() {
	int N;
	string buf;
	map<string, int> cnt;

	cin >> N;
	REP (i, N) {
		cin >> buf;
		++cnt[buf];
	}

	for (string s : {"AC", "WA", "TLE", "RE"}) {
		cout << s << " x " << cnt[s] << endl;
	}

	return 0;
}

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

typedef long long ll;
const ll INF = 1e18;
const int BIG = 1e9 + 555;
const int maxN = 100 * 1000 + 9;

int n;
int toRight[maxN], toLeft[maxN], cnt[maxN];
string s;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin >> s;
	n = (int)s.size();
	
	for(int i = n - 2; i >= 0; i--){
		toRight[i] = toRight[i + 1] + 1;
		if(s[i] == 'R' && s[i + 1] == 'L'){
			toRight[i] = 0;
		}
	}

	for(int i = 1; i < n; i++){
		toLeft[i] = toLeft[i - 1] + 1;
		if(s[i] == 'L' && s[i - 1] == 'R'){
			toLeft[i] = 0;
		}
	}
	
	for(int i = 0; i < n; i++){
		if(s[i] == 'R'){
			int j = i + toRight[i];
			if(toRight[i] % 2 == 0){
				cnt[j]++;
			} else {
				cnt[j + 1]++;
			}
		} else if(s[i] == 'L'){
			int j = i - toLeft[i];
			if(toLeft[i] % 2 == 0){
				cnt[j]++;
			} else {
				cnt[j - 1]++;
			}
		}
	}
	
	for(int i = 0; i < n; i++){
		cout << cnt[i] << ' ';
	}
	cout << '\n';

	return 0;
}

Measured memory_bytes: 1872
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nck = Input.ar;
        var time = new int[nck[0]];
        for (var i = 0; i < nck[0]; i++)
            time[i] = Input.num;
        Array.Sort(time);
        var ct = 1;
        var bus = 1;
        var index = 1;
        var t = time[0] + nck[2];
        while (index != nck[0])
        {
            var val = time[index];
            index++;
            if (ct+1 > nck[1] || val> t)
            {
                ct = 1;
                bus++;
                t = val + nck[2];
            }
            else
                ct++;
        }
        WriteLine(bus);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 15296
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>

using namespace std;

int main() {
	int n, x, t;
	cin >> n >> x >> t;

	int ans = (n + x - 1) / x * t;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3188
#include<stdio.h>
int main(void)
{
	int a,b,c,d,x,y;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	x=a+b;
	y=c+d;
	if(x>y){
		printf("Left\n");
	}
	else if(x<y){
		printf("Right\n");
	}
	else{
		printf("Balanced\n");
	}
	return 0;
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<int>a(n),left,right;
	for(auto&i:a)cin>>i;
	for(int i=0;i<n;++i){
		if(i%2==1)left.emplace_back(a.at(i));
		else right.emplace_back(a.at(i));
	}
	if(n%2==0)reverse(left.begin(),left.end());
	else{
		reverse(right.begin(),right.end());
		swap(left,right);
	}
	for(auto&i:left)cout<<i<<" "s;
	for(int i=0;i<right.size();++i){
		cout<<right.at(i);
		if(i!=right.size()-1)cout<<" "s;
		else cout<<"\n"s;
	}
}

Measured memory_bytes: 3956
#include<stdio.h>
long long int gcd(long long int a, long long int b) {
	long long int tmp;
	long long int r = 1;
	if (b > a) {
		tmp = a;
		a = b;
		b = tmp;
	}
	r = a % b;
	while (r != 0) {


		a = b;
		b = r;
		r = a % b;

	}
	return b;
}
int main() {
	long long int t, a, b, c, d, GCD, memo;
	scanf("%lld", &t);
	for (int i = 1; i <= t; i++) {
		scanf("%lld%lld%lld%lld", &a, &b, &c, &d);
		if (b > d||a%b>c) { printf("No\n"); continue; }
		if (a < b) {
			printf("No\n"); continue;
		}
		if (a <= c) {
			if (a - b < 0) {
				printf("No\n"); continue;
			}
			else {
				printf("Yes\n"); continue;
			}
		}
		GCD = gcd(b, d);
		memo = (a%b) +((c-(a%b))/GCD)*GCD +GCD- b;

		if (memo < 0) {
			printf("No\n"); continue;
		}
		else {
			printf("Yes\n"); continue;
		}
	}
}

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





int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	long long h;
	cin >> h;
	long long wynik = 0;
	long long dod = 1;
	while (h){
		wynik += dod;
		dod *= 2;
		h /= 2;
	}
	cout << wynik << "\n";
}

Measured memory_bytes: 256
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC = lambda x,y: -(-x//y)
DIVF = lambda x,y: x//y

def main():
    a, b = MII()
    s = IS()
    d = {'1','2','3','4','5','6','7','8','9','0'}
    for i in range(a):
        if s[i] not in d:
            print('No')
            return None
    if s[a] != '-':
        print('No')
        return None
    for i in range(a+1,a+b+1):
        if s[i] not in d:
            print('No')
            return None
    print('Yes')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
using namespace std;
int n,d;
int x[100001];
int main(){
  cin >> d >> n;
  if(d<9 && n<9)cout << "Yay!" << endl;
  else cout << ":(" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string sa; 
int a,b;
int main()
{
	cin>>sa;
	for(int i=0;i<sa.size();i++)
	{
		if(sa[i]=='A')
			a++;
		else
			b++;
	}
	if(a && b)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int a[500005];
int main(){
    ios::sync_with_stdio(false);
    cin>>s;
    int n=s.length();
    for(int i=0;i<=n;i++)a[i]=0;
    if(s[0]=='<')a[0]=0;
    if(s[n-1]=='>')a[n]=0;
    for(int i=1;i<n;i++){
        if(s[i-1]=='>'&&s[i]=='<'){
            a[i]=0;
        }
    }
    for(int i=0;i<n;i++){
        if(s[i]=='<'){
            a[i+1]=max(a[i],a[i]+1);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='>'){
            a[i]=max(a[i],a[i+1]+1);
        }
    }
    ll ans=0;
    for(int i=0;i<=n;i++){
//        cout<<a[i]<<' ';
        ans+=a[i];
    }
    cout<<ans<<endl;
}





Measured memory_bytes: 2844
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int Maxn = 100000;
int n,k,q,p,ans,a[Maxn];
int main()
{
    ans = 1;
    scanf("%d",&n);
    for (int i = 0; i < n; i++)
        scanf("%d",&a[i]);

    for (int i = 0; i < n; i++)
    {
        k = 0;
        for (int j = a[i]-1; j <= a[i]+1; j++)
        {
            if(j%2!=0)
                k++;
        }    
        ans*=k;
    }
    printf("%0.lf\n",pow(3,n)-ans);
    return 0;
}

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

typedef long long ll;

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

  vector<ll> l(n);
  rep(i, n) cin >> l.at(i);
  sort(l.begin(), l.end());

  ll ans = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      if (l.at(j) == l.at(i)) continue;
      for (int k = j + 1; k < n; k++) {
        if (l.at(k) == l.at(i) || l.at(k) == l.at(j)) continue;
        ll a = l.at(i);
        ll b = l.at(j);
        ll c = l.at(k);
        if (a + b > c && b + c > a && c + a > b) ans++;
      }
    }
  }

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

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

//need

ll solve(ll n, ll x)
{
	if (x == 0)
		return 0;
	if (n == 0)
		return 1;
	ll p = 1LL << n;
	if (x >= 2 * p - 1)
	{
		return p + solve(n - 1, x + 1 - 2 * p);
	}
	return solve(n - 1, x - 1);
}

int main()
{
	ll n, k;
	cin >> n >> k;
	cout << solve(n, k) << endl;
	;
}

Measured memory_bytes: 256
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for (LL i=(a);i<=(b);++i)
#define ROF(i,b,a) for (LL i=(b);i>=(a);--i)
typedef long long LL;
inline LL read(){
	LL x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const LL MAXN=300005;
LL n,m,a,b;
int main(){
	n=read(); a=read(); b=read();
	if (a==b) cout<<1<<endl;
	else if (b>a&&n>1) cout<<(b*(n-1)+a)-(a*(n-1)+b)+1<<endl;
	else cout<<0<<endl;
	
	return 0;
}

/*
4 3
...
**.
F*.
...

*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

ll n,ans;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    ans=n;
    if(n%2==1)ans*=2;
    cout<<ans<<newl;
}


Measured memory_bytes: 256
N,M = map(int, input().split(' '))
X = list(map(int, input().split(' ')))
X.sort()
Y = [X[i+1]-X[i] for i in range(M-1)]
Y.sort(reverse=True)
ans = X[-1] - X[0]
if N < M:
    for i in range(N-1):
        ans -= Y[i]
if N >= M:
    ans = 0

print(ans)

Measured memory_bytes: 13968
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int inf=1000000000;
struct edge{
	int t,next,v,rev;
}g[1100001];
char ch[501];
int s,t,tot,ans,i,j,k,n,m,h[41001],dis[41001],q[41001];
void addedge(int x,int y,int z){
	g[++tot].t=y;g[tot].next=h[x];h[x]=tot;g[tot].v=z;g[tot].rev=tot+1;
	g[++tot].t=x;g[tot].next=h[y];h[y]=tot;g[tot].v=0;g[tot].rev=tot-1;
}
bool bfs(){
    int l,r;
    memset(dis,0,sizeof(dis));
    for (l=0,r=1,q[1]=s,dis[s]=1;l<r;){
        int j=q[++l];
        for (int i=h[j];i;i=g[i].next)
         if (g[i].v&&!dis[g[i].t]){
            dis[g[i].t]=dis[j]+1;q[++r]=g[i].t;
            if (t==g[i].t) return 1;
         }
    }
    return 0;
}
int work(int x,int low){
    if (x==t) return low;
    int res=0;
    for (int i=h[x];i&&low;i=g[i].next)
     if (g[i].v&&dis[g[i].t]==dis[x]+1){
        int f=work(g[i].t,min(low,g[i].v));
        res+=f;g[g[i].rev].v+=f;
        g[i].v-=f;low-=f;
     }
    return res;
}
int main(){
	scanf("%d%d",&n,&m);s=2*n*m+n+m+1;t=s+1;tot=0;memset(h,0,sizeof(h));
	for (i=1,k=0;i<=n;i++){
		scanf("%s",ch);
		for (j=1;j<=m;j++){
			k++;
			if (ch[j-1]=='.') continue;
			if (ch[j-1]=='S') addedge(s,2*k-1,inf);
			if (ch[j-1]=='T') addedge(2*k,t,inf);
			addedge(2*k-1,2*k,(ch[j-1]=='o')?1:inf);
			addedge(2*k,2*n*m+i,inf);addedge(2*n*m+i,2*k-1,inf);
			addedge(2*k,2*n*m+n+j,inf);addedge(2*n*m+n+j,2*k-1,inf);
		}
	}
	for (ans=0;bfs();ans+=work(s,inf));
	printf("%d\n",ans==inf?-1:ans);
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define up_b upper_bound
#define low_b lower_bound
#define nl '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

const int N=2e5+11;
const int M=2e6+11;
const int W=1e3+11;
const int inf=1e9;
const ll INF=1e18;
const ll mod=1e9+7;
const ld EPS=1e-9;

int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0),cout.tie(0);
  int x,n;
  cin>>x>>n;
  int a=0,b=0;
  int ans=x;
  for(int i=1;i<=n;i++){
    int y;
    cin>>y;
    if(i==1)a=y;
    else {
      ans=min(ans,x-(y-b));
    }
    b=y;
  }
  ans=min(ans,b-a);
  cout<<ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  cin >> n;
  if(n[0]==n[1] && n[2]==n[1]){
    cout << "Yes" << endl;
  } else if( n[1]==n[2] && n[3]==n[2]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
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)*}
    };
}
 
#[allow(unused_macros)]
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, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        N: i32,
        K: i32,
		ab: [(usize, usize); N-1],
    }
	let mut G : Vec<Vec<usize>> = vec![vec![]; N as usize]; 
	for &(a, b) in &ab {
		G[a-1].push(b-1);
		G[b-1].push(a-1);
	}
	println!("{}", dfs(0, -1, 0, 0, K, &G));
}

fn dfs(n: i32, p: i32, s: i32, t: i32, K: i32, G: &[Vec<usize>]) -> i64 {
	let Mod: i64 = 1000000007;
	let mut res: i64 = (K - s - t) as i64;
	let mut s = s;
	for &v in &G[n as usize] {
		if v as i32 == p {continue;}
		res = res * dfs(v as i32, n, 1, s, K, G);
		res = res % Mod;
		s += 1;
	}
	res
}

Measured memory_bytes: 18300
#include<stdio.h>
int main(void){
int m,f,r;
while(scanf("%d%d%d",&m,&f,&r) && (m!=-1 || f!=-1 || r!=-1)){

if(m<0 || f<0) printf("F\n");
else if(m+f>=80) printf("A\n");
else if(m+f>=65) printf("B\n");
else if(m+f>=50 || r>=50) printf("C\n");
else if(m+f>=30) printf("D\n");
else printf("F\n");
}
return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var ABCD = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        var (A, B, C, D) = (ABCD[0], ABCD[1], ABCD[2], ABCD[3]);

        static long Gcd(long a, long b) => (b != 0) ? Gcd(b, a % b) : a;
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;
        static long GetCDX(long x, long c, long d) => x - (x / c) - (x / d) + (x / Lcm(c, d));

        var ans = GetCDX(B, C, D) - GetCDX(A - 1, C, D);

        WriteLine(ans);
    }
}


Measured memory_bytes: 28136
fun main(args: Array<String>) {
    val n = readInputLine()
    val aList = readInputLine().split(" ").map { it.toLong() }
    
    var gcd = aList[0]
    
    for (a in aList) {
        gcd = if (gcd > a) gcd(gcd, a) else gcd(a, gcd)
    }

    println(gcd)
}

fun readInputLine(): String {
    return readLine()!!
}

fun gcd(a: Long, b: Long): Long {
    // a >= b とする
    if (b == 0L) {
        return a
    }
    return gcd(b, a % b)
}


Measured memory_bytes: 51860
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    s = list(input())
    # l = []
    # for i in range(26):
    #     l.append(ord("A") + i)
    # print(l)
    for i in range(len(s)):
        s[i] = chr(ord("A") + (ord(s[i]) - ord("A") + n)%26)
    print("".join(map(str,s)))

    # n = int(input())
    # ab = [list(map(int, input().split())) for i in range(n-1)]

    # e = [[] for i in range(n+1)]
    # for i in range(n-1):
    #     a, b = ab[i]
    #     e[a].append(b)

    # d = defaultdict(int)
    # for i in range(n-1):
    #     a, b = ab[i]
    #     d[a] += 1
    #     d[b] += 1
    # ans = 0
    # for i in d.keys():
    #     ans = max(ans, d[i])
    # print(ans)
    # # print(d.values())
    # # ansl = [0 for i in range(n + 1)]
    # # dd = defaultdict(int)
    # # for i in range(n - 1):
    # #     a, b = ab[i]
    # #     c = max(dd[a], dd[b]) + 1
    # #     ansl[i] = c
    # #     dd[a] += c + 1
    # #    dd[b]+=c + 1
        

        
    # ansl = [0 for i in range(n+1)]
    # col = [-1 for i in range(n+1)]
    # def f(v, c):
    #     col[v] = 1
    #     t = 1
    #     for i in e[v]:
    #         if col[i] == -1:
    #             if t == c:
    #                 t+=1
    #             ansl[i] = t
    #             f(i, t)
    #             t+=1
    # f(1,0)
    # #print(*ansl)
    # for i in range(2,len(ansl)):
    #     print(ansl[i])



    

    

    


if __name__ == '__main__':
    main()


Measured memory_bytes: 73708
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        if(n>=100 && n<112){
            System.out.println(111);
        }else if(n>=112 && n<=222){
            System.out.println(222);
        }else if(n>222 && n<=333){
            System.out.println(333);
        }else if(n>333 && n<=444){
            System.out.println(444);
        }else if(n>444 && n<=555){
            System.out.println(555);
        }else if(n>555 && n<=666){
            System.out.println(666);
        }else if(n>666 && n<=777){
            System.out.println(777);
        }else if(n>777 && n<=888){
            System.out.println(888);
        }else if(n>888 && n<=999){
            System.out.println(999);
        }
        
    }
}


Measured memory_bytes: 22996
let rec gcd n m =
  if m = 0 then n
  else gcd m (n mod m)

let lcm n m = n / gcd n m * m

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ ->
    Scanf.scanf "%d " @@ fun a -> a in
  Printf.printf "%d\n" @@ Array.fold_left ( + ) 0 @@ Array.map (fun a -> a - 1) as_



Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
#include<cmath>
#include<complex>
using namespace std;

typedef complex<double> P;

#define X real()
#define Y imag()
typedef int kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }

int main(){
    int mod=1000000007;
    int n;
    while (scanf("%d",&n)!=EOF) {
        printf("%d\n",n*(n+1)/2+1);
    }
    return 0;
}

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


int main() {
  int N, half_N;
  string S, S_a, S_b;
  cin >> N >> S;

  half_N = N/2;

  S_a = S.substr(0, half_N);
  S_b = S.substr(half_N);

  if(S_a == S_b) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
#define MAX 100000
int main()
{
	int a;
	int b[2000];
	int total = 0;

	cin >> a;
	
	for (int j = 0; j < a * 2; j++)
	{
		cin >> b[j];
		if (j % 2 == 1)
		{
			total += b[j] - b[j - 1]+1;
		}
	}
	
	cout << total;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	double L;
	cin >> L;
	double B;
	
	B = L * L * L / 27;
	printf("%lf",B);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N;
list<int> V[1005];

int main(){

	int num_query;
	scanf("%d %d",&N,&num_query);

	int command,s,t,x;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d",&command);

		if(command == 0){

			scanf("%d %d",&t,&x);
			V[t].push_back(x);

		}else if(command == 1){

			scanf("%d",&t);

			auto at = V[t].begin();

			while(at != V[t].end()){

				if(at == V[t].begin()){

					printf("%d",*at);
				}else{

					printf(" %d",*at);
				}
				at++;
			}
			printf("\n");

		}else{ //command == 2

			scanf("%d %d",&s,&t);
			V[t].splice(V[t].end(),V[s]);
		}
	}

	return 0;
}



Measured memory_bytes: 18872