akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << " ";
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << "\n";
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll m = 1LL << n;
    vector<ll> a(m);
    for(int i = 0; i < m; i++) cin >> a[i];
    vector<Pll> v(m, {0, 0});
    rep(i, 1, m) {
        for(ll mask = i; mask >= 0; mask = (mask - 1) & i) {
            if(v[i].second <= a[mask]) v[i].second = a[mask];
            if(v[i].second >= v[i].first) swap(v[i].first, v[i].second);
            if(mask == 0) break;
        }
    }
    vector<ll> dp(m);
    rep(i, 1, m) chmax(dp[i], max(dp[i - 1], v[i].first + v[i].second));
    rep(i, 1, m) cout << dp[i] << "\n";
}


Measured memory_bytes: 11492
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
using namespace std;

int main(){
    int a, b, k;
    cin>>a>>b>>k;
    int m = min(a,b);
    int banme = 0;
    for(int i=m; i>=1; i--){
        if(a%i==0 && b%i==0){
            k--;
        }
        if(k==0){
            cout<<i<<endl;
            break;
        }
    }
    


    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vvll vector<vll>
#define all(v) v.begin(),v.end()
#define itr(r,v) for(auto r=v.begin();r!=v.end();r++)
#define FOR(i,n) for(ll i=0;i<n;i++)
#define ffo(i,a,b) for(ll i=a;i<=b;i++)
#define rfr(i,a,b) for(ll i=a;i>=b;i--)
#define space cout<<"\n\n";
#define endl "\n"
#define pqmx priority_queue<ll>
#define pqmn priority_queue<ll,vll,greater<ll>>
#define fps(x,y) fixed<<setprecision(y)<<x
#define merg(a,b,c) set_union(a.begin(),a.end(),b.begin(),b.end(),inserter(c,c.begin()))
#define set_ar(arr,v) memset(arr,v,sizeof(arr))
#define ctime auto sttart = high_resolution_clock::now()
#define etime auto sttop = high_resolution_clock::now()
#define go_t ll testcases; cin>>testcases; for(ll caseno= 1 ;caseno <= testcases; caseno++)
#define ptime auto z1z = duration_cast<microseconds>(sttop-sttart); cout<<"\nTime taken : "<<z1z.count()<<" microseconds\n"
#define dbg1(x)             cout <<#x<<": "<<x<<'\n';
#define dbg2(x, y)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<'\n';
#define dbg3(x, y, z)       cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<'\n';
#define dbg4(a, b, c, d)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<'\n';
#define dbg5(a, b, c, d, e) cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<'\n';

using namespace std;
using namespace std::chrono;

const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
const ll maxN = 1e3 + 5;
const ll MAX_SIZE = 2e6 + 6;
const ll INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;

ll powerM(ll x, ll y, ll M = MOD) { // default argument
	ll v = 1; x = x % M; while (y > 0) {if (y & 1)v = (v * x) % M; y = y >> 1; x = (x * x) % M;} return v;
}

ll power(ll x, ll y) {
	ll v = 1; while (y > 0) {if (y & 1)v = v * x; y = y >> 1; x = x * x;} return v;
}

ll dp[maxN][maxN];

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output2.txt", "w", stdout);
#endif
	FIO
	ll n, m; cin >> n >> m;
	string s;
	dp[1][1] = 1;
	for (ll i = 1; i <= n; i++) {
		cin >> s;
		ll flg = 0;
		for (ll j = 1; j <= m; j++) {
			if (s[j - 1] == '.') dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			else dp[i][j] = 0;
		}
	}
	cout << dp[n][m];
	return 0;
}


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

int main(){
    int n;
    int t[100001], x[100001], y[100001];
    cin >> n;
    t[0] = x[0] = y[0] = 0;
    for (int i = 0; i < n; i++) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];

    bool ans = true;
    for (int i = 0; i < n; i++) {
        int dfsT = t[i + 1] - t[i];
        int dfsD = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]);
        if (dfsT < dfsD) ans = false;
        if (dfsT % 2 != dfsD % 2) ans = false;
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int n;
vl a;
int ans = 0;

int main() {
    cin >> n;
    a.resize(n);
    REP(i,n) cin>>a[i];

    bool foundeven = false;

    while(true) {
        REP(i,n) {
            if (a[i]%2==0) {
                a[i] = a[i]/2;

                swap(a[0], a[i]);
                foundeven = true;
                break;
            }
        }

        if(!foundeven)
            break;
        else {
            ans++;
        }

        foundeven = false;
    }

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

Measured memory_bytes: 384
// 2020-09-19 19:52:30
// clang-format off
#include <bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
// #include <atcoder/convolution>
// #include <atcoder/dsu>
// #include <atcoder/fenwicktree>
// #include <atcoder/lazysegtree>
// #include <atcoder/math>
// #include <atcoder/maxflow>
// #include <atcoder/mincostflow>
// #include <atcoder/modint>
// #include <atcoder/scc>
// #include <atcoder/segtree>
// #include <atcoder/string>
// #include <atcoder/twosat>
// #include <atcoder/all>
// using namespace atcoder;

// clang-format on
const int inf = (1e9) + 5;
void answer() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<int> dp(n, inf);
  dp[0] = 0;
  rep(i, n) {
    REPC(j, 1, k) if (i + j < n) {
      chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
    }
  }
  cout << dp[n - 1] << '\n';
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

int n,ans,minh=1000;
vector<int> h;

void mizuyari(int a,int b,int c) {
  ans+=c;
  int aa=a;
  minh=1000;
  for(int i=a-1;i<b;i++) {
    h[i]-=c;
    if(h[i]==0) {
      if(i!=0) {
        if(h[i-1]!=0) {
          mizuyari(aa,i,minh);
          minh=1000;
          aa=i+2;
        } else {
          aa++;
        }
      } else {
        aa++;
      }
    } else {
      minh=min(minh,h[i]);
    }
  }
  if(h[b-1]!=0) mizuyari(aa,b,minh);
}

int main() {
  cin >> n;
  for(int i=0;i<n;i++) {
    int a;
    cin >> a;
    h.push_back(a);
    minh=min(minh,a);
  }
  mizuyari(1,n,minh);
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int dp2[3100][6100] = {};

int main() {
    int N, T; cin >> N >> T;
    vector<pair<int, int>> A(N);
    for(int i=0; i<N; ++i) cin >> A[i].first >> A[i].second;
    sort(begin(A), end(A));

    for(int i=0; i<N; ++i) {
        for(int j=0; j<=T + 3000; ++j) {
            dp2[i + 1][j] = dp2[i][j];
            if(j >= A[i].first && (j - A[i].first) < T) dp2[i + 1][j] = max(dp2[i][j - A[i].first] + A[i].second, dp2[i + 1][j]);
        }
    }

    int res = 0;
    for(int j=0; j<=T+3000; ++j) res = max(res, dp2[N][j]);
    cout << res << endl;
}

Measured memory_bytes: 71936
N = int(input())
h = [int(i) for i in input().split()]
p = N-1
ans = "Yes"
while p>0:
  if h[p-1]<=h[p]:
    p -= 1
  elif h[p-1]==h[p]+1:
    h[p-1] -= 1
    p -= 1
  else:
    ans = "No"
    break

print(ans)

Measured memory_bytes: 14396
#include<stdio.h>
#define N 65536

int main(){
  int i,j,k,l,m;
  int a[N],b[N];
  i=1;
  while(1){
    scanf("%d %d",&j,&k);
    if(k<j){
      l=j;
      j=k;
      k=l;
    }
    a[i] = j;
    b[i] = k;
    m=i;
    if(j==0 && k==0){
      break;
    }
    i++;
  }
  for(i=1;i<m;i++){
    printf("%d %d\n",a[i],b[i]);
  }
}

Measured memory_bytes: 1056
n,m,l = map(int, input().split())
a = [[0 for i in range(m)] for j in range(n)] #n行m列
b = [[0 for i in range(l)] for j in range(m)] #m行l列
c = [[0 for i in range(l)]for j in range(n)] #n行l列

for i in range(n):
  tmp = list(map(int, input().split()))
  for j in range(m):
    a[i][j] = tmp[j] 

for i in range(m):
  tmp = list(map(int, input().split()))
  for j in range(l):
    b[i][j] = tmp[j]

#行列の計算は横×縦

for i in range(n):
  for j in range(l):
    for k in range(m):
      c[i][j] += a[i][k] * b[k][j]

for i in range(0,n):
  print("%d"%(c[i][0]),end="")
  for j in range(1,l):
    print(" %d"%(c[i][j]),end = "")
  print()



Measured memory_bytes: 7064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using static System.Console;
namespace AtCoder.AGC012
{
    class AtCoderGroupContest
    {
        public static void Main()
        {
            var n = int.Parse(ReadLine().Trim());
            var a = ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).OrderBy(i => i).ToArray();
            BigInteger sum = 0;
            for (var i = 1; i <= n; ++i)
                sum += a[a.Length - i * 2];
            WriteLine(sum);
        }
    }
}


Measured memory_bytes: 48576
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

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

const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

template<class TYPE>
struct edge{
    TYPE to,cost; 
    edge(TYPE t,TYPE c){
        to = t;
        cost = c;
    }
};

int main(){
    int ans = 0;
    for(int i = 1; i <= 5; i++){
        int a;
        cin >> a;
        if(a == 0) ans = i; 
    }
    cout << ans << endl;
    return 0;
}


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

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

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

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

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

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

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

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


fn main() {

    input!{
        s: String,
        t: String,
    }

    let mut sit: Vec<_> = s.chars().collect();
    let mut tit: Vec<_> = t.chars().collect();

    sit.sort();
    tit.sort();
    tit.reverse();

    let lens = s.len();
    let lent = t.len();

    for (i, _c) in sit.iter().enumerate() {
        if lent == i {
            println!("No");
            return;
        }
        if sit[i] < tit[i] {
            println!("Yes");
            return;
        }
        if sit[i] > tit[i] {
            println!("No");
            return;
        }
    }
    if lens < lent {
        println!("Yes");
        return;
    }

    println!("No");
    return;
}


Measured memory_bytes: 4352
Module Program
    Sub Main(args As String())
        Dim iInputK As Integer = Console.ReadLine()
        Dim sInputS As String = Console.ReadLine()

        If sInputS.Length <= iInputK Then
            Console.WriteLine(sInputS)
        ElseIf sInputS.Length > iInputK Then
            Console.WriteLine(Left(sInputS, iInputK) + "...")
        End If
    End Sub
End Module

Measured memory_bytes: 28388
'use strict';

function Main(input) {
    // N
    // A1 A2 A3...An
    // Q
    // B1 C1
    // B2 C2
    // ...
    // BQ CQ
    let tmp = input.trim().split('\n');
    const N = Number(tmp[0]);
    let A = tmp[1]
        .split(' ')
        .sort((a, b) => a - b)
        .map((v) => BigInt(v));
    const Q = Number(tmp[2]);
    const BC = tmp.splice(3).map((v) => v.split(' ').map((v) => BigInt(v)));

    let arr = new Array(100001).fill(0n);
    for (const v of A) {
        arr[v] += 1n;
    }

    let result = arr.reduce((sum, v, i) => sum + v * BigInt(i));

    for (const [b, c] of BC) {
        const diff = (c - b) * arr[b];
        result += diff;
        console.log(String(result));
        arr[c] += arr[b];
        arr[b] = 0n;
    }

    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 95244
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int infint = 1e9;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e5 + 7;
int n, m, a[MAXN];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		int u, v;
		cin >> u >> v;
		a[u]++, a[v]++;
	}
	for (int i = 1; i <= n; i++)
		if(a[i] % 2)
			return cout << "NO", 0;
	cout << "YES";
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

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

    return 0;
}


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

int main() {
	
	int n; cin>>n;
	int a[n]; 
	for(int i=0;i<n;i++) cin>>a[i];
	int i;
	for(i=n-1;i>0;i--) {
		if(a[i]>=a[i-1]) continue;
		if(a[i-1]==a[i]+1) a[i-1]--;
		else {
			cout<<"No"<<endl; break;
		}
	}
	
	if(i==0) cout<<"Yes"<<endl;
	
	return 0;
}

Measured memory_bytes: 640
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;

const bool ready = []() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define all(v) (v).begin(), (v).end()
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;


/* see https://cp-algorithms.com/data_structures/sqrt_decomposition.html#toc-tgt-4
 * Queries are inclusive l and inclusive r.
 **/

//const int BLOCK_SIZE=(int)sqrt(5e5+5)+1;
const int BLOCK_SIZE=1024;

bool cmp(pair<int, int> p, pair<int, int> q) {
    if (p.first / BLOCK_SIZE != q.first / BLOCK_SIZE)
        return p < q;
    return (p.first / BLOCK_SIZE & 1) ? (p.second < q.second) : (p.second > q.second);
}

struct Query {
    int l, r, idx;

    bool operator<(Query other) const {
        return cmp(make_pair(l, r), make_pair(other.l, other.r));
    }
};

const int N=5e5+5;
int gans=0;
vi f(N);
vi a(N);

inline void moremove(int idx) {
    int v=--f[a[idx]];
    assert(v>=0);
    if(v==0)
        gans--;
}

inline void moadd(int idx) {
    int v=++f[a[idx]];
    if(v==1)
        gans++;
}

inline int moget_answer() {
    return gans;
}

vector<int> mo(vector<Query>& queries) {
    vector<int> answers(queries.size());
    sort(queries.begin(), queries.end());
    int cur_l = 0;
    int cur_r = -1;

    /* invariant: data structure will always reflect the range [cur_l, cur_r] */
    for (Query &q : queries) {
        while (cur_l > q.l) {
            cur_l--;
            moadd(cur_l);
        }
        while (cur_r < q.r) {
            cur_r++;
            moadd(cur_r);
        }
        while (cur_l < q.l) {
            moremove(cur_l);
            cur_l++;
        }
        while (cur_r > q.r) {
            moremove(cur_r);
            cur_r--;
        }
        answers[q.idx] = moget_answer();
    }
    return answers;
}

/* example impl of the three functions
 * for finding number of numbers in
 * interval where freq==number */


void solve() {
    cini(n);
    cini(q);
    for(int i=0; i<n; i++) 
        cin>>a[i];

    vector<Query> que(q);
    for(int i=0; i<q; i++) {
        cin>>que[i].l>>que[i].r;
        que[i].l--;
        que[i].r--;
        que[i].idx=i;
    }

    vi ans=mo(que);

    for(int i=0; i<q; i++) {
        cout<<ans[i]<<"\n";
    }
}

signed main() {
    solve();
}



Measured memory_bytes: 27256
#include <iostream>
#include <iomanip>

using namespace std;

int main (void) {
    int a, b, c, d, e, f;
    double x, y;
    while (1) {
        cin >> a;
        cin >> b;
        cin >> c;
        cin >> d;
        cin >> e;
        cin >> f;
        if (cin.eof()) break;
        x = (double)(c * e - b * f) / (double)(a * e - b * d);
        y = (double)(c * d - a * f) / (double)(b * d - a * e);
        if (x == -0.0) x = 0.0;
        if (y == -0.0) y = 0.0;
        cout << fixed << setprecision(3) << x << ' ' << y << endl;
    }
    return 0;
}

Measured memory_bytes: 1236
#!/snap/bin/pypy3
MOD = 10**9 + 7


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    init = [0] * N
    diff = [0] * N
    for i, a in enumerate(A):
        init[i] = len(list(filter(lambda x: x < a, A[i:])))
        diff[i] = len(list(filter(lambda x: x < a, A)))

    ans = sum((K * (2 * ini + (K - 1) * dif) // 2) %
              MOD for ini, dif in zip(init, diff)) % MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 46044
a = int(input())
b = list(map(int,input().split()))
b.append(0)
ans = 0
while not max(b) == 0:
  for i in range(len(b)):
    if b[i] > 0 and b[i+1] <= 0:
      ans += 1
  b = list(map(lambda x: x-1,b))
print(ans)



Measured memory_bytes: 9172
using System;
using System.Collections.Generic;

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            string[] lines = Console.ReadLine().Split(' ');
            int A = int.Parse(lines[0]);
            int B = int.Parse(lines[1]);

            Console.WriteLine(A * B);
        }


    }
}


Measured memory_bytes: 27448
h,w = map(int,input().split())
a = []
for i in range(h):
    if i %2==0:
        a += list(map(int,input().split()))
    else:
        a += list(reversed(list(map(int,input().split()))))
operations = []
ope_flag = False
idx = 0
ope_temp = ''
cnt = 0
for row in range(h):
    columns = range(w) if row%2==0 else reversed(range(w))
    for col in columns:
        if ope_flag:
            ope_temp += ' {0} {1}'.format(row+1,col+1)
            operations.append(ope_temp)
            ope_temp=''
            ope_flag=False
            a[idx]+= 1
        mod = a[idx]%2
        if mod==1:
            ope_temp = '{0} {1}'.format(row+1,col+1)
            ope_flag= True
        idx += 1
        cnt += mod
print(len(operations))
for i in range(len(operations)):
    print(operations[i])

Measured memory_bytes: 15912
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <assert.h>
#include <fstream>

using namespace std;

typedef double db;
typedef long long ll;

const int MAXN = 200005;

int n;
int f[65][65];

ll ans,tot;

db a[MAXN];

bool isint(db a)
{
	ll t = a;
	return t == a;
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n;
	for (int i = 1;i <= n;i++)
	{
		string s;
		cin >> s;
		int cnt2 = 0,cnt5 = 0;
		ll t = 0;
		for (int j = 0;j < s.size();j++)
		{
			if (s[j] == '.')
				cnt2 -= (int)s.size() - j - 1,cnt5 -= (int)s.size() - j - 1;
			else
				t = t * 10 + s[j] - '0';
		}
		while (t % 2 == 0)
			t /= 2,cnt2++;
		while (t % 5 == 0)
			t /= 5,cnt5++;
		f[cnt2 + 30][cnt5 + 30]++;
	}
	for (int i = -30;i <= 30;i++)
		for (int j = -30;j <= 30;j++)
			if (f[i + 30][j + 30])
				for (int k = -30;k <= 30;k++)
					for (int l = -30;l <= 30;l++)
						if (f[k + 30][l + 30] && i + k >= 0 && j + l >= 0)
						{
							if (i == k && j == l)
								ans += (ll)f[i + 30][j + 30] * (f[i + 30][j + 30] - 1);
							else
								ans += (ll)f[i + 30][j + 30] * f[k + 30][l + 30];
						}
	printf("%lld\n",ans / 2);
	return 0;
}

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

namespace ABC120A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, n;

            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            n = b / a;
            if (n >= c)

                Console.WriteLine(c);

            else if (n < c)

                Console.WriteLine(n);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include<stdio.h>
int main()
{
int n,i,sw,ans,cc;
  cc=1;
  ans=0;
  sw=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;++i)
  {
  scanf("%d",&a[i]);
  if(a[i]!=cc) ans++;
  else{
   cc++;
   }  
  }
 if(ans<n) printf("%d",ans);
 else printf("-1");
return 0;
}

Measured memory_bytes: 2504
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" <<; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

ll mod = 1000000007;

int main()
{
	// 入力
	ll N,K;
	cin>>N>>K;

  	if(K==1) cout<<0<<endl;
	else cout<<N-K<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  string A,B,C;
  cin>>A>>B>>C;
  char x='a';
  while(true){
  if(x=='a'){
      if(A.empty()){cout<<'A'<<endl;return 0;}
   x=A[0];
   A.erase(0,1);
  }
  if(x=='b'){
      if(B.empty()){cout<<'B'<<endl;return 0;}
   x=B[0];
   B.erase(0,1);
  }
  if(x=='c'){
      if(C.empty()){cout<<'C'<<endl;return 0;}
   x=C[0];
   C.erase(0,1);
  }
  }
 return 0;}

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

#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);

template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;

constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433L;

template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}

int main() {
    int A,B,K; cin >> K >> A >> B;
    for(int i = A; i <= B; ++i) {
        corner(i%K==0,"OK");
    }
    cout << "NG" << endl;
    
    return 0;
}


Measured memory_bytes: 3592
import java.awt.geom.Point2D;
import java.util.*;
  
public class Main {
    Scanner sc = new Scanner(System.in);
  
    public static void main(String[] args) {
        new Main(); 
    }
  
    public Main() {
        new aoj1161().doIt();
    }
    class aoj1161{
    	int result = 0;
    	boolean alf[] = new boolean[128];
    	boolean number[] = new boolean[10];
    	int nn[] = new int[128];
    	ArrayList<Character> array = new ArrayList<Character>();
    	ArrayList<String> array2 = new ArrayList<String>();
    	void clear(){
    		result = 0;
    		for(int i = 0;i < 128;i++){
    			alf[i] = false;
    			nn[i] = 0;
    		}
    		for(int i = 0;i < 10;i++)number[i] = false;
    		array.clear();
    		array2.clear();
    	}
    	void check(){
    		int sum = 0;
			for(int i = 0;i < array2.size();i++){
				String str = array2.get(i);
				int num = 0;
				for(int j = 0;j < str.length();j++){
					if(j == 0 && nn[str.charAt(j)] == 0 && str.length() > 1)return;
					num = num * 10 + nn[str.charAt(j)];
				}
				if(i < array2.size() - 1){
					sum = sum + num;
				}else{
					if(sum == num){
						result++;
					}
				}
			}
    	}
    	void dfs(int pos,int length){
    		if(pos < length){
    			for(int i = 0;i < 10;i++){
    				if(!number[i]){
    					number[i] = true;
    					nn[array.get(pos)] = i;
    					dfs(pos+1,length);
    					number[i] = false;
    				}
    			}
    		}else{
    			check();
    		}
    	}
    	void doIt(){
    		while(true){
    			int n = sc.nextInt();
    			if(n == 0)break;
    			clear();
    			for(int j = 0;j < n;++j){
    				String str = sc.next();
        			array2.add(str);
    				for(int i = 0;i < str.length();++i){
    					if(!alf[str.charAt(i)]){
    						alf[str.charAt(i)] = true;
    						array.add(str.charAt(i));
    					}
    				}
    			}
    			dfs(0,array.size());
    			System.out.println(result);
    		}
        }
     }
}

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

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

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

int main() {
  int s;
  cin >> s;
  
  int s1 = s / 100;
  int s2 = (s - s1 * 100) / 10;
  int s3 = (s - s1 * 100 - s2 * 10);
  
  cout << s1+s2+s3 << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr int INF = 2000000000;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
# define ALL(x)     (x).begin(),(x).end()
# define UNIQ(c)    (c).erase(unique(ALL((c))), end((c)))
# define mp         make_pair
# define eb         emplace_back
# define FOR(i,a,b) for(int i=(a);i<(b);++i)
# define REP(i,n)   FOR(i,0,n)
# define INIT       std::ios::sync_with_stdio(false);std::cin.tie(0);

int a[100100];
priority_queue<pair<int, int>> trr;

int main() {
	int n, l;
	cin >> n >> l;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		trr.emplace(x, i + 1);
	}

	int ans = 0;
	while (!trr.empty()) {
		pair<int, int> q = trr.top(); trr.pop();
		a[q.second] = max(a[q.second - 1], a[q.second + 1]) + l - q.first;
		ans = max(ans, a[q.second]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 4120
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e9;

signed main(){
  int N; cin >> N;
  vector<vector<int> > dp(N + 1, vector<int> (N + 1, 0));
  vector<int> r(N + 1);
  for(int i = 1; i <= N; i++) cin >> r[i - 1] >> r[i];
  for(int l = 1; l < N; l++){
    for(int i = 1; i <= N - l; i++){
      int j = l + i;
      dp[i][j] = INF;
      for(int k = i; k < j; k++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k + 1][j] + r[i - 1] * r[k] * r[j]);
      }
    }
  }
  cout << dp[1][N] << endl;
}


Measured memory_bytes: 3192
A,B,C,X,Y = list(map(int,input().split()))

tan = A*X + B*Y
hukuA = max(X,Y)*2*C
hukuB = min(X,Y)*2*C + (max(X,Y)-min(X,Y)) * (A if X>=Y else B)

print(min(tan,hukuA,hukuB))

Measured memory_bytes: 3060
import sys
readline = sys.stdin.readline

n = int(readline())
s = readline().rstrip()

from collections import deque
q = deque([])

ss = set(s)

for i in ss:
    q.append(["",0,str(i)])

ans = 0
while q:
    num, ind, target = q.popleft()
    #print(num, ind, target)
    while ind < len(s):
        if s[ind] == target: #s[ind]が０から9の中のどれかを見てる
            break
        ind += 1
    else:
        continue
    num += target
    if len(num) == 3:
        ans += 1
        continue
    for i in range(10):
        q.append([num, ind +1, str(i)]) #出現した数字に関するキューを追加（例：一回目は024）

print(ans)

Measured memory_bytes: 9484
//#include<bits/stdc++.h>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<stdio.h>
#include <cstdio>
#include <cstring>
#include <string>


using namespace std;

#define ld long double
#define ll long long
#define ff first
#define ss second
#define sz(a) (int)a.size()
#define mem(a, b) memset((a), (b), sizeof(a))
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pii pair<int ,int >
#define pll pair<ll ,ll >
#define mp make_pair
#define vi vector<int >
#define vii vector<pii>
#define vvi vector < vi >
#define vll vector < ll >
#define vllll vector < pll >
#define vvll vector < vll >
#define forn(i,n) for(int i=0;i<(n);i++)
#define fori(i,s,e) for(int i=s,i<n;i++)
#define qi  queue <int >
#define qll  queue <ll >
#define in_r(x,y,n,m) (x>=0 && x<n && y>=0 && y<m)
#define maxn 1000009


void fast(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}

const ll MOD = 1e9 + 7;
const double EPS = (1e-8);
const int OO = (int) 1e9 + 7;
const ll OOO = (ll) 1e15 + 7;
double const PI = 3.1415926535897932384626433832795;
const int mxn = 100009;
char c1, c2, c3, c4;
string s, s1, s2, s3;
ll   n, m, k, t, q, a, b, c, d, e, x, y, z; ll sol = 0;




int main(){
	fast();
	

	cin >> a >> b >> c >> k;
	n = 0;
	x = min(k, a);
	n += x;
	k -= x;
	if (k){
		x = min(b, k);
		k -= x;
	}if (k){
		x = min(c, k);
		k -= x;
		n -= x;
	}
	cout << n;

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


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
using namespace std; 

int main() {
    vector<int> v;
    for (int i = 0; i < 3; i++) {
        int x;
        cin >> x;
        v.pb(x);
    }
    sort(v.begin(), v.end());
    if (v[0] == v[1]) cout << v[2];
    else cout << v[0];
    return 0; 
}

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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
typedef long long ll;

int main(){
  while (1) {
    int H,W; cin >> H >> W;
    if (H == 0 && W == 0) break;
    string wb;
    rep(i,W) {
      wb += "#";
    }
    rep(i,H) {
      printf("%s\n", wb.c_str());
    }
    printf("\n");
  }
  
}



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

static const int N = 100;

int main() {
  int n, p[N+1], m[N+1][N+1];
  cin >> n;
  for ( int i = 1; i <= n; i++ ) {
    cin >> p[i - 1] >> p[i];
  }

  for ( int i = 1; i <= n; i++ ) m[i][i] = 0;
  for ( int l = 2; l <= n; l++ ) {
    for( int i = 1; i <= n -l +1; i++ ) {
      int j = i + l -1;
      m[i][j] = (1 << 21);
      for(int k = i; k <= j -1; k++) {
	m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }

  cout << m[1][n] << endl;

  return 0;
}

Measured memory_bytes: 1200
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

const int INF = 1e9;
const long long LINF = 1e18;

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

    vector<pair<int, int>> task(N);
    for (int i = 0; i < N; i++) {
        cin >> task[i].first >> task[i].second;
    }

    sort(task.begin(), task.end(), [](const pair<int, int>& l, const pair<int, int>& r) {
        return l.second < r.second;
    });

    int sumA = 0;
    for (int i = 0; i < N; i++) {
        sumA += task[i].first;
        if (sumA > task[i].second) {
            cout << "No" << endl;
            return 0;
        }
    }

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


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

void ans() {
    long long int n, a, b;
    std::cin >> n >> a >> b;
    long long int ans = 0;
    if ((b-a)%2 ==0) ans = (b-a)/2;
    else {
        long long int x = (a+b-1)/2;
        long long int y = (2*n+1-a-b)/2;
        if (x > y) ans = y;
        else ans = x;
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int d, a;
    int trick[n];
    for(int i=0; i<n; i++){
        trick[i] = 0;
    }
    for(int i=0; i<k; i++){
        cin >> d;
        vector<int> A[d];
        for(int j=0; j<d; j++){
            cin >> a;
            trick[a-1]++;
        }
    }
    int count = 0;
    for(int i=0; i<n; i++){
        if(trick[i] == 0){
            count++;
        }
    }
    cout << count;
}

Measured memory_bytes: 3624
#include <stdio.h>

int c[100001];

int main()
{
	int N,M;
	scanf ("%d %d",&N,&M);
	while (M--){
		int x,y; scanf ("%d %d",&x,&y);
		c[x]++; c[y]++;
	}
	for (int i=1;i<=N;i++) if (c[i] % 2){
		puts("NO");
		return 0;
	}
	puts("YES");
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }


lint c_cnt[26];
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	lint N = SZ(s);
	REP(i, N) {
		c_cnt[s[i] - 'a']++;
	}
	lint cnt = 0;
	REP(i, 26) {
		cnt += c_cnt[i] * (c_cnt[i] - 1) / 2;
	}
	cout << N * (N - 1) / 2 - cnt + 1 << endl;
}


Measured memory_bytes: 720
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int d,n;
  cin >> d >> n;
  if(d == 0){
    if(n != 100)
    cout << n << endl;
    else cout << n + 1 << endl;
  }else if(d == 1){
    if(n != 100)
    cout << 100 * n << endl;
    else cout << 100 * n + 100 << endl;
  }else if(d == 2){
    if(n != 100)
    cout << 10000 * n << endl;
    else cout << 10000 * n + 10000 << endl;
  }
}

Measured memory_bytes: 256
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    x, n = map(int, input().split())
    a = set(map(int, input().split()))
    a = sorted(set([i for i in range(102)]) - a)
    s = inf
    for i in a:
        s = min(s, abs(x - i))

    for i in a:
        if abs(x - i) == s:
            print(i)
            return
main()


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

string s, t, u;
int a, b;
int main() {
	cin >> s >> t >> a >> b >> u;
	if(u==s) cout << a-1 << ' ' << b;
	else cout << a << ' ' << b-1;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




//library mod int
template <int mod>
struct modint{
    ll x;

    //constructor
    modint(ll x=0): x((x%mod+mod)%mod){}

    //unary operator
    modint operator-() const { return modint(mod-x);}
    modint inv() const { return this->pow(mod-2);}
    
    //compound assignment
    modint& operator+=(const modint& a){
        if((x+=a.x)>=mod) x-=mod;
        return *this;
    }
    modint& operator-=(const modint& a){
        if((x-=a.x)<0) x+=mod;
        return *this;
    }
    modint& operator*=(const modint& a){
        (x*=a.x)%=mod;
        return *this;
    }
    modint& operator/=(const modint& a){
        return *this *= a.inv();
    }

    //arithmetic
    // なぜmodintの後ろに＆を書いたり書かなかったりしてるかの理解ができていない
    //おそらく＆をつけるとポインタで参照しているのでもとの値を書き換えることができる
    //＆をつけないとコピーを作ってからそれに対して計算するので、もとの値は変更されない
    modint operator-(const modint& a) const {return modint (*this) -= a ; }
    modint operator+(const modint& a) const {return modint (*this) += a ; }
    modint operator*(const modint& a) const {return modint (*this) *= a ; }
    modint operator/(const modint& a) const {return modint (*this) /= a ; }
    //n should not be smaller than 0.
    modint pow(ll n) const{
        auto x=modint(1);
        auto m=*this;
        while(n>0){
            if(n&1) x*=m;
            n>>=1;
            m*=m;
        }
        return x;
    }

    //compare
    bool operator==(const modint& a) const {return x==a.x ; }
    bool operator!=(const modint& a) const {return x!=a.x ; }

    //I/O
    friend istream& operator>>(istream& is, modint& a ) noexcept {return is >> a.x ; }
    friend ostream& operator<<(ostream& os, const modint& a ) noexcept {return os << a.x ; }
};

//modの調整
constexpr int mod =  998244353;
using mint = modint<mod>;

//////////////////////////////////////////////////////////////////////
//mint power
mint mpow(mint a, mint b){
    auto x=mint(1), m=a;
    auto n=b.x;
    while(n>0){
        if(n&1) x*=m;
        n>>=1;
        m*=m;
    }
    return x;
}

//combination
vector<mint> mintcombvector;
int startmintcomb(int n){
    mintcombvector.push_back(0);
    mintcombvector.push_back(1);
    rep(i,n) mintcombvector.push_back(mintcombvector[i+1]*(i+2));
    return 0;
}
mint comb(mint a, mint b){
    if(a.x<b.x || a.x<=0 || b.x<0) return mint(0);
    if(b.x==0) return mint(1);
    if(a==b) return mint(1);
    return mintcombvector[a.x]*(mintcombvector[b.x].inv())*(mintcombvector[a.x-b.x].inv());
}
//combinationを使いたいときは　startmintcomb(n=代入したい数の最大値); を始めに打つこと




int main(){
    startmintcomb(3e5);
    int nn,mm,kk; cin>>nn>>mm>>kk;
    mint n=nn, m=mm, k=kk;
    mint ans(0);
    ans+=m*mpow(m-1, n-1);
    rep(i,k.x){
        ans+=m*mpow(m-1, n-i-2)*comb(n-1,i+1);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7284
#include <bits/stdc++.h>
        using namespace std;
         
        int main() {
            string S;
            cin >> S;


            if(S == "hi"){
                cout << "Yes" << endl;
            }
            else if(S == "hihi"){
                cout << "Yes" << endl;
            }
            else if(S == "hihihi"){
                cout << "Yes" << endl;
            }
            else if(S == "hihihihi"){
                cout << "Yes" << endl;
            }     
            else if(S == "hihihihihi"){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
            }

Measured memory_bytes: 256