akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds; 
using namespace std;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag, 
//             tree_order_statistics_node_update> 
//    data_set;
#define rep(i,l,r)   for(int i=(l);i<(r);i++)
#define deb(x)     cout << (#x) << " is " << (x) << endl
#define dbg(x)     cout << x << ' '
#define here cout << " Hey baitch!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld PI = 3.1415926535898;

int32_t main()
{
	SYNC
	int n,k; cin >> n >> k;
	int a[n+1];
	rep(i,1,n+1)	cin >> a[i];
	int cur = 1;
	map<int,int> dp;
	dp[1] = 0;
	set<int> vis;
	vis.insert(1);
	int steps = 0;
	while(k)
	{
		int nxt = a[cur];
		if(vis.find(nxt)==vis.end()) {
			vis.insert(nxt);
			dp[nxt] = ++steps;
			cur = nxt;
			k--;
			continue;
		}else {
			steps++;
			int cycle = steps - dp[nxt];
			k--;
			k %= cycle;
			cur = nxt;
			break;
		}
	}
	while(k)
	{
		cur = a[cur];
		k--;
	}
	cout << cur;
    return 0;
}

Measured memory_bytes: 22680
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

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

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main()
{
    double r;
    std::cin >> r;

    printf("%.12lf\n", 2 * r * acos(-1));
}


Measured memory_bytes: 3732
n = int(input())
a = list(map(int, input().split()))

mp = [0] * n

ans = 0

for i in range(n):
    if i-a[i] >= 0:
        ans += mp[i-a[i]]
    if n > a[i]+i:
        mp[a[i]+i] += 1

print(ans)

Measured memory_bytes: 92972
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> cnt(26, 0);
	for(int i=0; i<N; i++) {
		string s;
		cin >> s;
		cnt[s[0] - 'A'] ++;
	}
	priority_queue<PII> data;
	for(int i=0; i<cnt.size(); i++)
		data.push(PII(cnt[i], i));
		int ans = 0;
	while(true) {
		vector<PII> tmp;
			bool ok = true;
		for(int i=0; i<K; i++) {
			tmp.push_back(data.top()); data.pop();
			if(tmp.back().first==0) ok = false;
		}
		if(!ok) break;
		for(int i=0; i<tmp.size(); i++) {
			tmp[i].first--;
			data.push(tmp[i]);
		}
		ans++; 
	}
	cout << ans << endl;
	
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

struct Data {
    int tile, x, y, c;
    Data(int t, int _x, int _y, int _c)
        : tile(t), x(_x), y(_y), c(_c) {}
    Data() {}
};

int main() {
    int w, h;
    while (cin >> w >> h, w + h) {
        vector<vector<char>> mp(h + 2, vector<char>(w + 2, 'x'));
        queue<Data> q;
        vector<vector<int>> m(h + 2, vector<int>(w + 2, 0));

        int cnt = 0;
        REP(i, 1, h + 1) {
            REP(j, 1, w + 1) {
                cin >> mp[i][j];
                if (mp[i][j] == 'o') {
                    q.emplace(0, j, i, 0);
                }
                if (mp[i][j] == '*') {
                    m[i][j] = 1 << cnt;
                    cnt++;
                }
            }
        }
        const int inf = 1 << 29;
        auto memo = make_v(h + 2, w + 2, 1 << cnt, inf);
        auto used = make_v(h + 2, w + 2, 1 << cnt, false);
        int dx[4] = {0, 1, 0, -1};
        int dy[4] = {1, 0, -1, 0};
        int ans = -1;
        while (q.size()) {
            auto data = q.front();
            q.pop();
            if (used[data.y][data.x][data.tile]) continue;
            used[data.y][data.x][data.tile] = true;
            //cout << "!" << data.x << " " << data.y << " " << data.tile << " " << data.c << endl;
            if (data.tile == (1 << cnt) - 1) {
                ans = data.c;
                break;
            }
            REP(k, 0, 4) {
                int nx = data.x + dx[k];
                int ny = data.y + dy[k];
                if (mp[ny][nx] == 'x') continue;
                int t = data.tile | m[ny][nx];
                if (memo[ny][nx][t] > data.c + 1) {
                    memo[ny][nx][t] = data.c + 1;
                    q.emplace(t, nx, ny, data.c + 1);
                }
            }
        }
        cout << ans << endl;
    }

    return 0;
}



Measured memory_bytes: 3948
#include "bits/stdc++.h"
using namespace std;

int main(){
	int N , T , i;
	scanf( "%d%d" , &N , &T );
	int c , t , MAX = 1000000007;
	int Ans = MAX;

	for( i = 1 ; i <= N ; ++i ){
		scanf( "%d%d" , &c , &t );
		if( t <= T ) Ans = min( Ans , c );	 
	}

	if( Ans == MAX ) puts( "TLE" );
	else printf( "%d\n" , Ans ); 
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::io::Read;
use std::io::{stdout, BufWriter, Write};

fn is_kaibun(a: &str) -> bool {
    //println!("{:?}",a);
    let a : Vec<char> = a.chars().collect();
    let length : usize = a.len();
    (0..length/2).map(|i| {
        //println!("{:?}",a[i] == a[length-1-i]);
        a[i] == a[length-1-i]
    }).fold(true, |sum, i| sum && i)
}

fn check_kaibun(a: &str) -> bool {
    if is_kaibun(a) == false {return false}
    let len = a.len();
    if ( is_kaibun(&a[..(len-1)/2]) == false || is_kaibun(&a[(len+3)/2-1..]) == false) {return false}
    return true
}
 
fn main() {
    let mut buf = String::new();
    
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
 
    // 標準入力から全部bufに読み込む
    std::io::stdin().read_to_string(&mut buf).unwrap();
 
    // 読み込んだStringを空白で分解する
    let mut iter = buf.split_whitespace();
 
    let l: f64 = iter.next().unwrap().parse().unwrap();
    
    println!("{:?}", l * l * l / 27.);
    
}

Measured memory_bytes: 4352
import sys
import numpy as np
input = sys.stdin.readline

def main():
    N = int(input())
    s = [input().strip() for i in range(N)]

    count = np.zeros((N, ord("z") - ord("a") + 1), dtype=int)

    for i in range(N):
        for c in s[i]:
            count[i][ord(c) - ord("a")] += 1
    
    for i in range(1, N):
        count[i] = np.minimum(count[i], count[i-1])
    
    for i in range(len(count[-1])):
        print(chr(ord("a") + i) * count[-1][i], end="")
    print()

if __name__ == "__main__":
    main()

Measured memory_bytes: 12468
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	int N,M;
	cin >> N >> M;

	vector<int>A(M);
	int sum = 0;
	rep(i, M) {
		cin >> A[i];
		sum += A[i];
	}

	if (sum > N) {
		cout << -1 << endl;
		return 0;
	}
	else {
		ans = N - sum;
	}


	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3656
n, k = map(int, input().split())
d = list(map(str, input().split()))

for i in range(n, 10*n+1):
    num = list(str(i))
    for j, n in enumerate(num):
        if n in d:
            break
        if j == len(num)-1:
            print(i)
            exit()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 1;
int32_t main()
{
    int n;
    cin >> n;
    vector<pair<int,int>>adj[n][n];
    int prev[n][n]={};
    vector<vector<int>> a(n);
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n - 1; ++j)
        {
            int x;
            cin >> x;
            a[i].push_back(x - 1);
        }
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < n - 2; ++j)
        {
            adj[min(i, a[i][j])][ max(i, a[i][j])].push_back({min(i, a[i][j + 1]), max(i, a[i][j + 1])});
            prev[min(i, a[i][j + 1])][max(i, a[i][j + 1])]++;
        }
    queue<pair<int, int>> q;
    int v[n][n]={};
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (!prev[i][j])
            {
                q.push({i, j});
                v[i][ j] = 1;
            }
        }
    }
    if (q.empty())
    {
        cout << -1;
        exit(0);
    }
    int ans = 1;
    while (!q.empty())
    {
        pair<int, int> x = q.front();
        q.pop();
        for (auto y : adj[x.first][x.second])
        {
            if (!v[y.first][y.second])
            {
                prev[y.first][y.second]--;
                if (!prev[y.first][y.second])
                {
                    q.push(y);
                    v[y.first][y.second] = v[x.first][x.second] + 1;
                    ans = max(ans, v[y.first][y.second]);
                }
            }
        }
    }
    for (int i = 0; i < n; ++i)
    {
        for (int j = i + 1; j < n; ++j)
        {
            if (prev[i][j])
            {
                cout << -1;
                exit(0);
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 72704
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int m1, m2, d1, d2;
	cin >> m1 >> d1;
	cin >> m2 >> d2;

	if (m1 < m2) { cout << 1 << endl; }
	else { cout << 0 << endl; }

	return 0;
}


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

using namespace std;

const int N = 1e5+7;
int n, m, grau[N], dist[N];
vector<int> g[N];

int main(){
#ifdef LOCAL
	freopen("input", "r", stdin);
#endif

	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		grau[b]++;
		g[a].push_back(b);
	}

	queue<int> q;

	for (int i = 1; i <= n; i++){
		if (grau[i] == 0)
			q.push(i);
	}

	int ans = 0;

	while (!q.empty()){
		int at = q.front();
		//cout << at << endl;
		q.pop();
		for(int i = 0; i < (int)g[at].size(); i++){
			int to = g[at][i];
			if (grau[to]){ 
				grau[to]--;
				if (grau[to] == 0){
					dist[to] = dist[at] + 1;
					ans = max(ans, dist[to]);
					q.push(to);
				}
			}
		}
	}

	printf("%d\n", ans);

	return 0; 
}

Measured memory_bytes: 10044
from itertools import accumulate
n = int(input())
a = [int(item) for item in input().split()]

ans = []
asum = list(accumulate(a))
for key in range(2):
    count = 0
    cum_diff = 0
    for i, item in enumerate(asum):
        if i%2 == key:
            if item + cum_diff <= 0:
                diff = 1 - item - cum_diff
                count += abs(diff)
                cum_diff += diff
        else:
            if item + cum_diff >= 0:
                diff = -1 - item - cum_diff
                count += abs(diff)
                cum_diff += diff
    ans.append(count)

print(min(ans))

Measured memory_bytes: 14212
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <cmath>
#include <set>

using namespace std;

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    if (stoi(a + b + c)  % 4 == 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

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

int main()
{
  int N; cin >> N;
  vector<int> H(N);
  for (int i = 0; i < N; i++) cin >> H[i];

  int ans = 0;
  int cnt = 0;

  for (int i = 0; i < N-1; i++)
  {
    if (H[i] >= H[i + 1]) cnt++;
    else
    {
      if (cnt > ans) ans = cnt;
      cnt = 0;
    }
  }

  if (cnt > ans) ans = cnt;
  cout << ans << endl;
}

Measured memory_bytes: 640
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
int h, w, n, m, k, s, t, q, sum, last, cnt, ans;
Pll a[1000000],b[1000000];
string str, ss;
bool f;
char c;
int di[4][2] = { {1,0},{-1,0} ,{0,1},{0,-1} };
struct Edge { LL to, cost; };
vector<Edge>vec[10000], rev[10000];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i].fir;
		a[i].sec=i;
		b[i] = a[i];
	}
	sort(a, a + n);
	rep(i, n) {
		if (b[i].fir <= a[n / 2 - 1].fir) {
			cout << a[n / 2].fir << endl;
		}
		else {
			cout << a[n / 2-1].fir << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 12416
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <ctime>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#include <cmath>
#include <functional>
#include <map>
#include <set>
const int INF = 1000000009;

int n, a, b;

int main(){
	scanf("%d%d%d", &n, &a, &b);
	printf("%d\n", std::min(n*a, b));
	return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<queue>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int s[101];
  int sum = 0;
  for ( int i  = 0; i < N; i++ ) {
    cin >> s[i];
    sum += s[i];
  }

  sort(s,s+N);

  if( sum % 10 != 0 ) {
    cout << sum << endl;
    return 0;
  }

  for ( int i = 0; i < N; i++ ) {
    if ( s[i] % 10 == 0 ) continue;
    else sum -= s[i];

    if ( sum % 10 != 0 ) break;
  }

  if ( sum % 10 == 0 ) cout << 0 << endl;
  else cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
h,w = map(int,input().split())
chk = []
for i in range(h):
  a = list(input().strip())
  for j in a:
    chk.append(j)
    
from collections import Counter
c = Counter(chk)
ans = 'Yes'
cnt = 0
q = 0

if h%2 == 0 and w%2 == 0:
  for i in c.values():
    if i%4 != 0:
      ans = 'No'
      break
      
elif h%2 == 0 and w%2 == 1:
  for i in c.values():
    if i%2 != 0:
      ans = 'No'
      break
    if i%4 == 2:
      cnt += 1
    if cnt > h//2:
      ans = 'No'
      break
    
elif w%2 == 0 and h%2 == 1:
  for i in c.values():
    if i%2 != 0:
      ans = 'No'
      break
    if i%4 == 2:
      cnt += 1
    if cnt > w//2:
      ans = 'No'
      break
      
elif h%2 == 1 and w%2 == 1:
  for i in c.values():
    if i%2 != 0:
      q += 1
    if q > 1:
      ans = 'No'
      break
    if i%4 == 2:
      cnt += 1
    if cnt > h//2+w//2:
      ans = 'No'
      break
      
print(ans)

Measured memory_bytes: 3440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//cout << fixed << setprecision(17) << res << endl;
 
int main() {
    ll k;
    cin >> k;
    ll res = (k/2) * (k/2);
    if (k%2 == 1) {
        res += k/2;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int N, i;
  cin >> N >> i;

  cout << N - i + 1 << endl;

  return 0;
}


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

using namespace std;

#define sqr(x) ((x) * (x))
#define pb push_back
#define mp make_pair
#define ins insert
#define f first
#define s second
#define fin(name) freopen(name, "r", stdin)
#define fout(name) freopen(name, "w", stdout)
#define files(name) fin(name".in"); fout(name".out")
#define endl "\n"
#define fi(st,n) for (int i = (st); i <= (int)(n); ++i)
#define fj(st,n) for (int j = (st); j <= (int)(n); ++j)
#define fk(st,n) for (int k = (st); k <= (int)(n); ++k)
#define fq(st,n) for (int q = (st); q <= (int)(n); ++q)
#define fw(st,n) for (int w = (st); w <= (int)(n); ++w)
#define ff(i, st, n) for (int (i) = (st); (i) <= (int)(n); ++(i))
#define ei(st,n) for (int i = (st); i >= (int)(n); --i)
#define ej(st,n) for (int j = (st); j >= (int)(n); --j)
#define ek(st,n) for (int k = (st); k >= (int)(n); --k)
#define ef(i, st, n) for (int (i) = (st); (i) >= (int)(n); --(i))
#define ri(st,n) for (int i = (st); i < (int)(n); ++i)
#define rj(st,n) for (int j = (st); j < (int)(n); ++j)
#define rk(st,n) for (int k = (st); k < (int)(n); ++k)
#define rq(st,n) for (int q = (st); q < (int)(n); ++q)
#define rf(i, st, n) for (int (i) = (st); (i) < (int)(n); ++(i))
#define clean(a) memset((a),0,sizeof (a))
#define sync ios_base::sync_with_stdio(0);cin.tie(0)
#define y1 dsklmlvmd

typedef long long ll;
typedef unsigned long long ull;
typedef double dbl;
typedef long double ldbl;

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const dbl eps = (dbl) 1e-8;
const int mod = (int) 1e9 + 7;
const int maxn = (int) 1e5 + 5;
//const dbl M_PI = (dbl)2 * (dbl)acos(0);

//cout<<fixed<<setprecision(10);
//srand(time(0));

int n, m, t[maxn];

int main() {
//    fin("t.in");
    sync;
    cin >> n >> m;
    clean(t);
    fi(1, m) {
        int a, b;
        cin >> a >> b;
        t[a] ^= 1;
        t[b] ^= 1;
    }
    fi(1, n) {
        if (t[i]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

const double PI = acos(-1);
const int MOD = 1000000007;

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

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x, ll mod) {
    return mod_pow(x, mod-2, mod);
}

ll mod_frac(ll a, ll b, ll mod) {
    // a*(a+1)*...(b)
    // inclusive a and b
    ll res=1;
    for (size_t i = a; i <= b; i++)
    {
        res = res * i % mod;
    }
    return res;
}

ll mod_comb(ll n, ll a, ll mod) {
    chmin(a, n-a);
    ll X = mod_frac(n-(a-1), n, MOD);
    ll Y = mod_frac(1, a, MOD);
    ll res = X * mod_inv(Y, MOD) % MOD;

    return res;
}


using Mat = vector<vector<ll>>;
using Column = vector<ll>;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,a,b;cin>>n>>a>>b;

    ll ans = mod_pow(2, n, MOD) - 1 -  mod_comb(n,a,MOD) - mod_comb(n,b,MOD);
    while(ans<0) ans += MOD;
    cout << ans << "\n";    

    return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_9_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string str1 = Console.ReadLine();
            int    q = int.Parse(str1);
            for(int i = 0; i < q; i++)
            {
                string[] str2 = Console.ReadLine().Split(' ');
                int a = int.Parse(str2[1]);
                int b = int.Parse(str2[2]);

                if (str2[0] == "print")
                    print(str, a, b);
                else if (str2[0] == "reverse")
                    str = reverse(str, a, b);
                else if (str2[0] == "replace")
                    str = replace(str, a, b, str2[3]);

            }
        }

        static void print(string str, int a, int b)
        {
            str = str.Substring(a, b - a + 1);
            Console.WriteLine("{0}", str);
        }

        static string reverse(string str, int a, int b)
        {
            string temp = str.Substring(a, b - a + 1);
            str = str.Remove(a, b - a + 1);
            for(int i = 0; i < temp.Length;++i)
            {
                str = str.Insert(a + i, temp[b - a - i].ToString());
            }
            return str;
        }

        static string replace(string str,int a, int b, string p)
        {
            str = str.Remove(a, b - a + 1);
            str = str.Insert(a, p);
            return str;
        }






    }
}

Measured memory_bytes: 11844
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<queue>
#include<iostream>
#define REP(i, n) for(int i = 0, ed_##i = n; i < ed_##i; i++)
#define FOR(i, n) for(int i = 1, ed_##i = n; i <= ed_##i; i++)
#define bit(x) (1 << (x))
#define bitl(x) (1LL << (x))
#define sqr(x) ((x) * (x))
#define sz(x) ((int)(x.size()))
#define cnti(x) (__builtin_popcount(x))
#define cntl(x) (__builtin_popcountll(x))
#define clzi(x) (__builtin_clz(x))  // Leading zeros
#define clzl(x) (__builtin_clzll(x))
#define ctzi(x) (__builtin_ctz(x))
#define ctzl(x) (__builtin_ctzll(x))

#ifdef QWERTIER
#define err(x) cerr << #x << " : " << x << endl
#else
#define err(x)
#endif

typedef long long LL;
using namespace std;

typedef pair<int,int> pii;
#define MP make_pair

int main(){
#ifdef QWERTIER
  freopen("in.txt","r",stdin);
#endif
  LL a, b, c;
  scanf("%lld%lld%lld", &a, &b, &c);
  if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
    puts("0");
  } else{
    printf("%lld\n", min(min(a*b, b*c), a*c));
  }
  return 0;
}


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

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

    ll n, m;
    cin >> n >> m;

    ll c_cnt = m / 2;

    ll ans = 0;
    if(n == c_cnt) {
        ans = n;
        cout << ans << endl;
        return 0;
    }

    if(n > c_cnt) {
        ans = c_cnt;
        cout << ans << endl;
        return 0;
    }

    if(n < c_cnt) {
        if(c_cnt - n <= 1) {
            ans = n;
            cout << ans << endl;
            return 0;
        }
        else {
            ll v = (c_cnt - n) / 2;
            ans = n + v;
            cout << ans << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3552
import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
readline = sys.stdin.readline
AB = [[int(i) for i in readline().split()] for _ in range(n)]

import math

AB.sort(key = lambda x: x[0])

ans = 0

while m > 0:
    for ab in AB:
        a, b = ab[0], ab[1]
        if m > b:
            ans += a*b
            m -= b
        else:
            ans += a*m
            m = 0
            
print(ans)

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

int main() {
  int a, b, ans = 0;
  cin >> a >> b;
  int hei[1000] = {0};
  hei[0] = 0;
  hei[1] = 1;
  for (int i = 2; i < 1001; i++) {
    hei[i] = i + hei[i - 1];
  }
  a = b - a;
  ans = hei[a] - b;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

s = list(input())
t = list(input())

ans = False

for i in range(len(s)):
    if s == t:
        ans = True
        break
    temp = s[0]
    for j in range(1,len(s)):
        s[j-1] = s[j]
    s[-1] = temp

if ans:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
#include <iomanip>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int X,Y;
VI a;

int main()
{
	cin >> X >> Y;
	int ans = 0;
	switch(X){
	case 3:
		ans += 100000;
		break;
	case 2:
		ans += 200000;
		break;
	case 1:
		ans += 300000;
		break;
	}
	switch(Y){
	case 3:
		ans += 100000;
		break;
	case 2:
		ans += 200000;
		break;
	case 1:
		ans += 300000;
		break;
	}
	if(X==1&&Y==1) ans += 400000;

	cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<queue>
using namespace std;
int cnt = 0;
vector<int> select(vector<int> a){
  for(int i=0; i<a.size(); i++){
    int minj = i;
    for(int j=i; j<a.size(); j++){
      if( a[j] < a[minj] ){
        minj = j;
      }
    }
    if( i != minj ) cnt++;
    swap(a[i], a[minj]);
  }
  return a;
}

int main(void) {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];

  a = select(a);
  for(int i=0; i<n-1; i++) cout << a[i] << " ";
  cout << a[n-1] << endl;
  cout << cnt << endl;

  return 0;
}

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

using namespace std;
using ll = long long;

constexpr ll MOD = 1000000007;
constexpr int MAXN = 3005;

int n;
string s;

ll dp[MAXN][MAXN];
ll pre[MAXN][MAXN];

// number of permutations of {0..i} with last number j
// dp[i][j] =
//   if (s[i - 1] is '<')
//     sum dp[i - 1][k] for k < j
//     basically increment everything less than k in each sub-perm by 1
//   else
//     sum dp[i - 1][k] for k >= j
//     basically decrement everything less than k in each sub-perm by 1
ll solve(int i, int j) {
  if (i == 0) { return (j == 0) ? 1 : 0; }
  if (j < 0) { return 0; }
  ll& res = dp[i][j];
  if (res != -1) { return res; }
  res = 0;
  if (s[i - 1] == '<') {
    for (int k = 0; k < j; k++) {
      res += solve(i - 1, k);
      res %= MOD;
    }
  } else {
    for (int k = j; k < i; k++) {
      res += solve(i - 1, k);
      res %= MOD;
    }
  }
  return res;
}

ll solve_fast(int i, int j);

void prefill(int i) {
  if (dp[i][0] != -1) { return; }
  for (int j = 0; j < n; j++) {
    pre[i][j] = solve_fast(i, j);
  }
  for (int j = 1; j < n; j++) {
    pre[i][j] += pre[i][j - 1];
    pre[i][j] %= MOD;
  }
}

ll getsum(int i, int j0, int j1) {
  ll res = pre[i][j1];
  if (j0 > 0) {
    res += MOD - pre[i][j0 - 1];
    res %= MOD;
  }
  return res;
}

ll solve_fast(int i, int j) {
  if (i == 0) { return (j == 0) ? 1 : 0; }
  if (j < 0) { return 0; }
  ll& res = dp[i][j];
  if (res != -1) { return res; }
  prefill(i - 1);
  res = 0;
  if (s[i - 1] == '<') {
    res = getsum(i - 1, 0, j - 1);
  } else {
    res = getsum(i - 1, j, i - 1);
  }
  return res;
}

int main() {
  fill(dp[0], dp[0] + MAXN * MAXN, -1LL);
  cin >> n >> s;
  ll res = 0;
  for (int j = 0; j < n; j++) {
    res += solve_fast(n - 1, j);
    res %= MOD;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 141568
#pragma GCC optimize(200000)
#include<iostream>
#include<cstdio>
#include<deque>
#include<cstring>
#define re register
using namespace std;
struct edge{
	int next,w,to,ww,fr;
}e[3000005];
const int Mxdt=100000;
char gc(){
	static char buf[Mxdt],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxdt,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
int read()
{
	int res=0;char ch=gc();
	while(ch<'0'||ch>'9')ch=gc();
	while(ch>='0'&&ch<='9')res=(res<<3)+(res<<1)+(ch^48),ch=gc();
	return res;
}
int head[3002],b,c,d,n,m,cnt=1,S,T,dis[3002],pre[3002],p[3002],ans1,ans2,vv[3002];
void bu(register int u,register int v,register int w,re int ww){
	if(w==0)return;
      e[++cnt].to=v;
      e[cnt].ww=ww;
      e[cnt].w=w;
      e[cnt].fr=u;
      e[cnt].next=head[u];
      head[u]=cnt;
      e[++cnt].to=u;
      e[cnt].fr=v;
      e[cnt].ww=-ww;
      e[cnt].next=head[v];
      head[v]=cnt;
}   
deque <int> q;
int spfa(register int s,register int t){

	memset(p,0,sizeof(p));
    memset(dis,127,sizeof(dis));
    memset(vv,0,sizeof(vv));
    bool zzw=0;
	q.push_front(s);
	dis[s]=0;
	vv[s]=1;
	while(!q.empty()){
		int r=q.front();
		q.pop_front();
		vv[r]=0;
		if(r==t)zzw=1;
        for(register int i=head[r];i;i=e[i].next){
			if(e[i].w&&dis[e[i].to]>dis[r]+e[i].ww){
				dis[e[i].to]=dis[r]+e[i].ww;
				p[e[i].to]=i;
				if(!vv[e[i].to]){
			
				vv[e[i].to]=1;
				if(!q.empty()&&dis[e[i].to]<dis[q.front()])
			    q.push_front(e[i].to);
			    else q.push_back(e[i].to);	
				}
			}
		}
	}
	if(zzw)return 1;
	return 0;
}
#define min mn
int min(re int x,re int y){
	return x<y?x:y;
}
void dfs(){
	int tmp=0x7fffffff,cnt=0,pp;
	for(re int i=T;i!=S;i=e[pp^1].to){
		pp=p[i];
		cnt+=e[pp].ww;
	tmp=min(tmp,e[pp].w);
}
	for(re int i=T;i!=S;i=e[pp^1].to){
		pp=p[i];
		e[pp].w-=tmp,e[pp^1].w+=tmp;
	}

	ans1+=tmp,ans2+=tmp*cnt;
}
char s[502][502];
int vis[52][52];
inline void bfs(re int x,re int y,re int z){
	if(x>n||y>m||s[x][y]=='#')return;
	vis[x][y]=z;
	bfs(x+1,y,z+1);
	bfs(x,y+1,z+1);
}
signed main(){
//	freopen("a.out","w",stdout);
    n=read();
	m=read();S=n*m+1,T=S+1;
	for(re int i=1;i<=n;++i)scanf("%s",s[i]+1);
	for(re int i=1;i<=n;++i){
		for(re int j=1;j<=m;++j){
			if(s[i][j]=='#')continue;
			if(s[i][j]=='o')bu(S,(i-1)*m+j,1,0);
			if(s[i][j+1]!='#'&&j<m)bu((i-1)*m+j,(i-1)*m+j+1,1<<29,-1);
			if(s[i+1][j]!='#'&&i<n)bu((i-1)*m+j,i*m+j,1<<29,-1);
			bu((i-1)*m+j,T,1,0);
		}
	}
	while(spfa(S,T))dfs();
	printf("%d",-ans2);
}

Measured memory_bytes: 4068
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//234
	ll n;
	cin>>n;
	cout<<n*(n-1)/2;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
    
int cnt[5];

int main(){
	ios::sync_with_stdio(0);
    rep(i,0,3) {
        int a, b;
        cin >> a >> b;
        ++cnt[a];
        ++cnt[b];
    }
    sort(cnt+1, cnt+5);
    if (cnt[1] == 1 && cnt[4] == 2) {
        puts("YES");
    }
    else {
        puts("NO");
    }

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)

struct UnionFind {
	vector<int> data;
 	UnionFind(int size):data(size, -1) {}
	bool unite(int x,int y){
		x=root(x);
		y=root(y);
 	   if(x!=y){
			if (data[y]<data[x]){
				swap(x, y);
			}
			data[x]+=data[y];
			data[y]=x;
		}
		return x!=y;
	}
	bool same(int x, int y){
		return root(x)==root(y);
	}
	int root(int x){
		return data[x]<0? x:data[x]=root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int N,M;
int X[100010],Y[100010],Z[100010];


signed main(){
	cin>>N>>M;
	REP(i,M){
		cin>>X[i]>>Y[i]>>Z[i];
	}
	UnionFind UF(N+10),UF2(N+10);
	int p=0,q=0;
	REP(i,M){
		UF.unite(X[i],Y[i]);
	}
	set<int> U,U2;
	int sum=0,cnt=0;
	REP(i,M){
		if(U.find(UF.root(X[i]))==U.end()){
			sum+=UF.size(X[i]);
			cnt++;
			DEB(UF.root(X[i]))END
			U.insert(UF.root(X[i]));
		}
	}
	cout<<N-sum+cnt<<endl;
	return 0;
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <array>
#include <cmath>
#include <random>
#include <functional>
#include <climits>
using namespace std;
using lint=long long;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  int n;
  cin>>s>>n;
  string ans="";
  for(int i=0;i<s.length();i+=n){
    ans+=s.at(i);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  char com[20];
  priority_queue<int> PQ;
  while(1){
    scanf("%s",com);
    if(com[0]=='i'){
      int key;
      scanf("%d",&key);
      PQ.push(key);
    } else if(com[0]=='e'&&com[1]=='x'){
      printf("%d\n",PQ.top());
      PQ.pop();
    } else{
      break;
    }
  }
  return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

typedef long long LL;

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) return 0;
    int ans=0;
    int ruiseki=0;
    for(int i=1;i<=n/2;i++){
      ruiseki=0;
      for(int j=i;ruiseki<n;j++) ruiseki+=j;
      if(ruiseki==n) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long ans = 0;

            for (int bef = 0; bef < s.Length; bef++)
            {
                for (int len = 1; bef +len <= s.Length; len++)
                {
                    string substr = s.Substring(bef, len);
                    int aft = s.Length - bef - len;
                    long num = (long)(Math.Max(1, Math.Pow(2, bef - 1)) * 
                        Math.Max(1, Math.Pow(2, aft - 1)));
                    ans += long.Parse(substr) * num;
                }
            }

            Console.WriteLine(ans);
        }
    }
}


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


int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> sum(n,0);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sum[0] = a[0];
    for(int i = 1; i < n; i++){
        sum[i] = sum[i-1] + a[i];
    }


    unordered_map<ll, ll> mp;
    mp[0] = 1;
    for(int i = 0; i < n; i++){
        mp[sum[i]] += 1;
    }

    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ans += (itr->second)*(itr->second-1)/2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 11592
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD 1000000007
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template <class T>
void print(T& x){printf("%d\n", x);}
void printvec(vector<int> a){
    rep(i, a.size()-1){
        printf("%d ", a[i]);
    }
    printf("%d\n", a[a.size()-1]);
}
 
int main()
{
    int n,q;
    cin >> n >> q;
    vector<vector<int>> v(n);

    int c, t, x;
    rep(i, q){
        cin >> c >> t;
        if(c==0){
            cin >> x;
            v[t].emplace_back(x);
        }else if(c==1){
            if(v[t].empty()){
                printf("\n");
                continue;
            }
            printf("%d", v[t][0]);
            for(int j = 1; j<v[t].size(); j++){
                printf(" %d", v[t][j]);
            }
            printf("\n");
        }else if(c==2){
            v[t].clear();
        }
    }

    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    ll N, M; cin >> N >> M;
    cout << abs((N-2) * (M-2)) << endl;
}

Measured memory_bytes: 256
/*
    TOP GUN: MAVERICK!!
                                */
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
//#include <boost/functional/hash.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int lli;
lli mod=1e9+7ll;
lli INF=1e17;
#define sqr(x) (x) * (x)
#define bip(n) __builtin_popcountll(n)//no of ones bit in binary!!
#define bictz(n) __builtin_ctzll(n)//no of trailing zeroes in binary!!
#define biclz(n) __builtin_clzll(n)//no of leading zeroes in binary!!
#define bffs(n) __builtin_ffsll(n)//index of first one bit!!
typedef pair<lli,lli> ll;
#define mem1(a,x) fill(&a[0], &a[0] + sizeof(a) / sizeof(a[0]), x)
#define mem2(a,x) fill(&a[0][0], &a[0][0] +sizeof(a)/sizeof(a[0][0]),x)
#define mem3(a,x) fill(&a[0][0][0], &a[0][0][0] +sizeof(a)/sizeof(a[0][0][0]),x)
#define fi1 ifstream fin("input.txt")
#define of1 ofstream fout("output.txt")
int fmx(int x, int y) { return (((y-x)>>(31))&(x^y))^y; }
int fmi(int x, int y) { return (((y-x)>>(31))&(x^y))^x; }
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ost;
lli n,q,z,y,k,m;
const double pi1=3.14159265358979323846;
//unordered_map<pair<ll,lli>,lli> mp;
lli me(lli a,lli b,lli M)
{
    if(b==0)
    return 1;
    else if(b%2==0)
    return me((a*a)%M,b/2,M);
    else
    return (a%M*me((a*a)%M,(b-1)/2,M)%M)%M;
}
lli mI(lli a,lli m)
{
    return me(a,m-2,m);
}
struct edge
{
    lli x,y,z,w;
};
bool cmp(edge a,edge b)
{
    if(a.x==b.x)
    {
        return a.y<b.y;
    }
    else
    return a.x<b.x;
}
lli parent[200005];
lli ran[200005];
void make_set(int v) {
    parent[v] = v;
    ran[v] = 0;
}
lli find_set(lli v)
{
if(v==parent[v])
return v;
return parent[v]=find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (ran[a] < ran[b])
            swap(a, b);
        parent[b] = a;
        if (ran[a] == ran[b])
            ran[a]++;
    }
}
int main()
{
    cin>>n;
    string s;
    cin>>s;
    int cnt=1;
    for(int j=1;j<n;)
    {
        if(s[j]==s[j-1])
        {
        while(s[j]==s[j-1])
        j++;
        }
        else
        j++,cnt++;
    }
    cout<<cnt;
}

Measured memory_bytes: 512
#include <iostream>
#include <set>
#include <algorithm>

int main()
{
    int n{}, m{};
    std::cin >> n >> m;

    if (n == m) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<char,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
map<ll,set<int>> tmp;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;cin>>n>>k;
    vector<ll> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        tmp[a[i]].insert(i);
    }
    ll Log_k=log2(k);
    vector<ll> dp(n,-1);
  for(int i=0;i<n;i++){
        vector<ll> tm;
        if(dp[i]!=-1)continue;
        int now=i;
        tm.push_back(now);
        while(1){
             auto ite=tmp[a[now]].find(now);
             ite++;
             if(ite==tmp[a[now]].end())break;
             now=*ite;now++;
             if(now==n)break;
             tm.push_back(now);
        }
      for(int j=0;j<tm.size();j++){
             dp[tm[j]]=now;
            // cout<<tm[j]<<" "<<now<<endl;
      }
    }
    int cnt=0,now=0;
    bool ok=true;
   while(now!=n){
          now=dp[now];
          if(now==n)break;
          now=*tmp[a[now]].begin();
          now++;cnt++;
   }
  cnt++;
   ll times=k%cnt;
   now=0;
   while(times--){
          now=dp[now];
          if(times==0)break;
          now=*tmp[a[now]].begin();
          now++;cnt++;
   }
   set<ll> ans;vector<ll> res;
        for(int i=dp[now];i<n;i++){
          auto ite=tmp[a[i]].find(i);ite++;
          if(ite==tmp[a[i]].end())cout<<a[i]<<" ";
          else i=*ite;
          
        }
        cout<<endl;
}

Measured memory_bytes: 32768
import java.util.*;
import java.math.*;

public class Main{
	public static void main(String[] args) {
        Scanner itr = new Scanner(System.in);
        int A = itr.nextInt();
        int B = itr.nextInt();

        for (int i = B * 10; i < (B + 1) * 10; i++) {
            if ((i * 8 / 100) == A) {
                System.out.println(i);
                return;
            }
        }
        System.out.println(-1);
    }
}	

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007

using namespace std;
int n,m,q;
int ans = 0;
vector<int> a(11);
vector<vector<int>> query(50,vector<int>(4));

void dfs(int num){
  if(num == n+1){
      int work = 0;
      for(int i=0;i<q;i++){
	//cout << query[i][1] << "," << query[i][0] << endl;
	if(a[query[i][1]] - a[query[i][0]] == query[i][2]){
	  work += query[i][3];
	}
      }
      if(ans < work){
	ans = work;
      }
      return;
  }
  for(int i=a[num-1];i<=m;i++){
    a[num] = i;
    dfs(num+1);
  }
}

int main(void){

  cin >> n >> m >> q;
  for(int i=0;i<q;i++){
    cin >> query[i][0] >> query[i][1] >> query[i][2] >> query[i][3];
  }
  for(int i=1;i<=m;i++){
    a[1] = i;
    dfs(2);
  }

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


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int N;
    cin >> N;
    string sa[3];
    rep(i, 3)cin >> sa[i];
    int ans = 0;
    rep(i, N){
        unordered_set<char> s;
        rep(j, 3){
            char c = sa[j][i];
            s.insert(c);
        }
        ans += s.size()-1;
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
	int x, y;
	cin >> x >> y;
	if ((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12) && (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12)) {
		cout << "Yes" << endl;
	}
	else if ((x == 4 || x == 6 || x == 9 || x == 11) && (y == 4 || y == 6 || y == 9 || y == 11)) {
		cout << "Yes" << endl;
	}
	else if (x == 2 && y == 2) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
main(){int n,e=0,x[200000],y[200000];cin>>n;r(i,n)cin>>x[i];r(i,n)cin>>y[i];r(i,n)r(j,n)e^=x[i]+y[j];cout<<e;}

Measured memory_bytes: 5168