akhauriyash/Code-Regression huggingface dataset:
// Author: Shusuke Ueda
// AtCoder Beginner Contest 128 - Problem E

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

struct Con {
    int s, t, x;
};

int main() {
    int n, q;
    std::cin >> n >> q;
    std::vector<Con> c(n);
    for (auto& e: c) {
        int s, t, x;
        std::cin >> s >> t >> x;
        s -= x;
        t -= x;
        e = {s, t, x};
    }
    std::set<int> d;
    std::map<int, int> ans_corr;
    for (int i = 0; i < q; i++) {
        int di;
        std::cin >> di;
        d.insert(di);
        ans_corr[di] = i;
    }

    std::vector<int> ans(q, -1);
    std::sort(c.begin(), c.end(), [](const Con a, const Con b) {
        return a.x < b.x;
    });
    for (auto e: c) {
        auto it = d.lower_bound(e.s);
        while (it != d.end() and *it < e.t) {
            ans[ans_corr[*it]] = e.x;
            it = d.erase(it);
        }
    }

    for (auto e: ans) {
        std::cout << e << std::endl;
    }

    return 0;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
 
template <typename T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
string to_string(char c) {
	return string(1, c);
}
string to_string(bool b) {
	return b ? "true" : "false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
string to_string(vector<bool> v) {
	string res;
	for(int i = 0; i < (int) v.size(); i++)
		res += char('0' + v[i]);
	return res;
}
 
template<size_t S> string to_string(bitset<S> b) {
	string res;
	for(int i = 0; i < S; i++)
		res += char('0' + b[i]);
	return res;
}

template<class T> string to_string(T v) {
    bool f = 1;
    string res;
    for(auto& x : v) {
		if(!f)
			res += ' ';
		f = 0;
		res += to_string(x);
	}
    return res;
}
 
void DBG() {
	cerr << "]" << endl;
}

template<class H, class... T> void DBG(H h, T... t) {
	cerr << to_string(h);
	if(sizeof...(t))
		cerr << ", ";
	DBG(t...);
}

#ifdef _DEBUG
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif

const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};

void solve() {
	string s;
	cin >> s;
	int sm = 0;
	for(int i = 0; i < (int)s.size(); i++){
		sm += s[i] - '0';
	}
	cout << (sm % 9 == 0 ? "Yes":"No") << '\n';
}	
 
int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
 	
	int t = 1;
	//cin >> t;
	for(int i = 1; i <= t; i++) {
		//cout << "Case #" << i << ": ";
		solve();
	}
}

Measured memory_bytes: 3744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var n = ReadNextLong();
            var k = ReadNextLong();
            var abs = new Tuple<long, long>[n];
            for (int i = 0; i < abs.Length; i++)
            {
                abs[i] = Tuple.Create(ReadNextLong(), ReadNextLong());
            }
            long count = 0;
            var ans = abs.OrderBy(x => x.Item1).SkipWhile(x => { count += x.Item2; return count < k; }).First().Item1;

            Console.WriteLine(ans);
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static BigInteger ReadBigInteger() => BigInteger.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static BigInteger[] ReadBigIntegerArray() => ReadStringArray().ParseBigInteger().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
        public static IEnumerable<BigInteger> ParseBigInteger(this IEnumerable<string> source) => source.Select(BigInteger.Parse);

        public static string[] Buffer = new string[] { };
        public static int Index;
        public static string ReadStringNext()
        {
            if (Buffer.Length == 0 || Buffer.Length <= Index)
            {
                Buffer = ReadStringArray();
                Index = 0;
            }
            return Buffer[Index++];
        }
        public static int ReadNextInt() => int.Parse(ReadStringNext());
        public static long ReadNextLong() => long.Parse(ReadStringNext());
        public static BigInteger ReadNextBigInteger() => BigInteger.Parse(ReadStringNext());
    }
}


Measured memory_bytes: 22980
A,B = map(int,input().split())
A_sosu = []
B_sosu = []
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
A_sosu = set(prime_factorize(A))
B_sosu = set(prime_factorize(B))
cnt = 0
for a in A_sosu:
    if(a in B_sosu):
        cnt += 1
print(cnt+1)

Measured memory_bytes: 3064
/*
    Don't practice until you get it right. Practice until you can't get it wrong.
*/

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

#define ll long long
#define ld double
#define pii pair<ll,ll>
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vp vector<pii>
#define pb push_back
#define mp make_pair
#define sc(a) scanf("%lld",&a);
#define sd(a) scanf("%lf",&a);
#define test() ll tt;cin>>tt;for(ll testcase=1;testcase<=tt;testcase++)
#define all(v) v.begin(),v.end()
#define vivek_ghosh ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX 1000055
#define mod 1000000007
#define ff first
#define ss second
const int INF=0x3f3f3f3f;
const ll int inf = LLONG_MAX;

ll power(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return power((x*x)%M,n/2,M);
    else
        return (x*power((x*x)%M,(n-1)/2,M))%M;
}

ll modinv(ll a,ll m)
{
    ll g =__gcd(a, m);
    ll res=power(a, m-2, m);
    return res;
}

vb prime(MAX,true);
vl prm;
void sieve()
{
	prime[0] = prime[1] = false;
	for(ll p=2;p*p<MAX;p++)
	{
		if(prime[p])
		{
			for(ll i=p*p;i<MAX;i+=p)
				prime[i] = false;
		}
	}
	for(ll p=2;p<MAX;p++)
	{
		if(prime[p])
			prm.pb(p);
	}
}

ll n,m,t,i,j,k,q,x,y,ans=0,cnt=0,sum=0,mx=-1,mn=INT_MAX;
string s;

int main()
{
	vivek_ghosh;
	
	cin>>n;
	vl a(n);
	m = 1;
	bool valid = 1;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i] == m)
			m++;
		else
			ans++;
	}
	
	if(ans == n)
		cout<<-1;
	else
		cout<<ans<<endl;



	
	return 0;
}

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

int main(){
  int n , k ;
  cin >> n >> k ;
  int ans = 0;
  vector<int> mon(1100,3000);
 
  for(int i=0;i<n;i++){
    cin >> mon[i];
  }
   sort(mon.begin(),mon.end());
  for(int i=0;i<k;i++){
    ans += mon[i] ;
  }
  
  cout << ans << endl;
}
  



Measured memory_bytes: 3600
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<set>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 2000000000;

    int a,b;

int main(){
    ios_base::sync_with_stdio(false);
    cin>>a>>b;
    if((a*b)%2==0)cout<<"Even";
    else cout<<"Odd";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int x,n,ans=0;
int main()
{
	cin>>x;
	int a[x+1]={0};
	cin>>n;
	for(int i=1;i<=x;i++)cin>>a[i];
	sort(a,a+x+1);
	for(int i=0;i<=n;i++)ans+=a[i];
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
    #include<vector>
    #include<queue>
#include<string>
#include<cmath>
    using namespace std;
   
   
   // long long cnt[2];
   
    int main()
    {
    				
    			  ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            cout.tie(NULL);
            int n;int k;int sum=0;
            cin>>n;
            cin>>k;
            int p[n];
            for(int i=0;i<n;i++)
              cin>>p[i];
            sort(p,p+n);
            for(int i=0;i<k;i++)
              sum+=p[i];
            cout<<sum;
            
            
           return 0;
            

    }

    			

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

using namespace std;

int main(int argc, const char *argv[]) {
  using ll = long long;
  int n;
  ll k;
  cin >> n >> k;

  vector<int> va(n);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
    va[i]--;
  }

  vector<int> vb;
  vector<int> visited(va.size(), -1);
  int cur = 0, loop_offset = -1;
  while (true) {
    if (visited[cur] != -1) {
      loop_offset = visited[cur];
      break;
    }

    visited[cur] = vb.size();
    vb.push_back(cur);
    cur = va[cur];
  }

  int ans;
  if (k < vb.size()) {
    ans = vb[k];
  } else {
    int idx = (k - vb.size()) % (vb.size() - loop_offset);
    ans = vb[loop_offset + idx];
  }

  cout << ans + 1 << '\n';
  return 0;
}

Measured memory_bytes: 5884
#include<iostream>
#include<string>
using namespace std;
int dir_c(char a,char b,char c){
  if(a==b && b==c) return 0;
  if((a==c&&a!=b)||(b==c&&b!=a)||(a==b&&a!=c)) return 1;
  return 2;
}
int main(){
 int n,cnt=0;
 string a, b,c;
 cin >> n >> a >> b >> c;
 for(int i=0;i<n;i++){
   cnt += dir_c(a[i],b[i],c[i]);
 }
 cout << cnt << endl;
}


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

using namespace std;

int main()
{
	string S;
	cin >> S;

	for (int i = 0; i < S.length(); i++) {
		cout << "x";
	}
	cout << endl;
	
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

int n;

int dp[31][1000001]={};
int d[31][1000001]={};

const ll INF=100000000001;
int main() {
	int n,k;
	int total=10000000001;
	cin>>n>>k;
	for(int i=0;i<(1<<n);i++){
		int t=1;
		for(int j=0;j<n;j++){
			if((i&(1<<j))==(1<<j)){
				t*=2;
			}else{
				t+=k;
			}
		}
		total=min(total,t);
	}
	cout<<total<<endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using P = pair<int, int>;

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

// Library
//

bool comp(const int lh, const int rh) {
    int tmp_l = lh % 10;
    int tmp_r = rh % 10;
    return (lh % 10) > (rh % 10);
}

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    int ans = 0;
    vector<int> vec;
    for(int i = 0; i < 5; ++i){
        int tmp; cin >> tmp;
        if(tmp % 10 == 0){
            ans += tmp;
        }
        else{
            vec.push_back(tmp);
        }
    }
    sort(vec.begin(), vec.end(), comp);
    if(vec.empty()){
        cout << ans << endl;
        return 0;
    }
    
    for(int i = 0; i < vec.size() - 1; ++i) {
        int tmp = vec[i] / 10;
        ans += (tmp + 1) * 10;
    }
    ans += vec[vec.size() - 1];

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


Measured memory_bytes: 256
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;
    long[][] dp;
    int MAX_M = 100000;
    int MAX_N = 100000;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        A--;
        long B = sc.nextLong();
        long C = sc.nextLong();
        long c = (B/C) - (A/C);
        long D = sc.nextLong();
        long d = (B/D) - (A/D);
        long L = lcm(C,D);
        long l = (B/L) - (A/L);
        System.out.println((B-A)-c-d+l);

    }
    static long lcm (long a, long b) {
	long temp;
	long c = a;
	c *= b;
	while((temp = a%b)!=0) {
		a = b;
		b = temp;
	}
	return (c/b);
}
}

Measured memory_bytes: 21972
#pypyは内包表記使わない
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    N = int(input())
    A = int(input())
    print(N**2-A)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = 1e+14;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define _GLIBCXX_DEBUG

int main(){
    int x,y;
    cin>>x>>y;
    bool judge=false;
    rep(i,x+1){
        int ans=2*i+4*(x-i);
        if(ans==y) judge=true;
    }
    if(judge) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;
int main(){
	int a[4], b[4];
	
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]){
		int hit = 0, brow = 0;
	
		for(int i = 0;i < 4;i++){
			for(int j = 0;j < 4;j++){
				if(a[i] == b[j]){
					if(i == j) hit++;
					else brow++;
				}
			}
		}
		cout << hit << " " << brow << endl;
	}

	
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int>> candies;
int n;

int c(int i, int j, int accum) {
  if (i == 2 && j == n)
    return accum + candies[2][n];

  int ret = 0;
  if (i < 2)
    ret = c(i + 1, j, accum  + candies[i][j]);
  if (j < n)
    ret = max(ret, c(i, j + 1, accum  + candies[i][j]));

  return ret;
}

int main() {

  cin >> n;
  candies.resize(3);
  candies[1].resize(n + 1);
  candies[2].resize(n + 1);
  for (int i = 1; i <= n; i++) {
    int v;
    cin >> v;
    candies[1][i] = v;
  }

  for (int i = 1; i <= n; i++) {
    int v;
    cin >> v;
    candies[2][i] = v;
  }

  cout << c(1, 1, 0) << endl;
}


Measured memory_bytes: 256
n = int(input())
#a, b = map(int,input().split())
al = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
ans = 0
dic = {}
for a in al:
    dic[a] = dic.get(a, 0)+1

for k, v in dic.items():
    if k == v:
        pass
    elif k < v:
        ans += v-k
    else:
        ans += v
print(ans)

Measured memory_bytes: 21852
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n;cin>>n;
	for(int h=1;h<=3500;h++){
	for(int w=1;w<3500;w++){
		int x=4*h*w-n*(w+h);
		if(x>0&& (n*h*w)%x==0){
			int y=(n*h*w)/x;
			cout<<h<<" "<<w<<" "<<y<<endl;
			return 0;
		}
	}
	}
}

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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
    ll n;cin>>n;
    vi a;
    ll d=26;
    int cnt=0;
    while(n>0){
      if(n>=d){n-=d;cnt++;}
      else break;
      d*=26;
    }
    if(n==0){string ans="";while(cnt>0){ans.PB('z');cnt--;}cout<<ans<<endl;return 0;}
    string ans="";
    n--;
    rep(i,cnt+1)ans.PB('a');
    while(n>0){
        a.PB(n%26);
        n/=26;
    }
    rep(i,a.size()){
        ans[ans.size()-1-i]=(char)('a'+a[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3580
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll
struct UnionFind {
    // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
    vector<int> par;
    // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
    vector<int> sizes;

    UnionFind(int n) : par(n), sizes(n, 1) {
        // 最初は全てのデータiがグループiに存在するものとして初期化
        rep(i, 0, n) par[i] = i;
    }

    // データxが属する木の根を得る
    int find(int x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
    }

    // 2つのデータx, yが属する木をマージする
    void unite(int x, int y) {
        // データの根ノードを得る
        x = find(x);
        y = find(y);

        // 既に同じ木に属しているならマージしない
        if (x == y) return;

        // xの木がyの木より大きくなるようにする
        if (sizes[x] < sizes[y]) swap(x, y);

        // xがyの親になるように連結する
        par[y] = x;
        sizes[x] += sizes[y];
        // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
    }

    // 2つのデータx, yが属する木が同じならtrueを返す
    bool same(int x, int y) {
        return find(x) == find(y);
    }

    // データxが含まれる木の大きさを返す
    int size(int x) {
        return sizes[find(x)];
    }
};
class E1Or2 {
public:

void solve(std::istream& cin, std::ostream& cout) {
    UnionFind uf(101010);
    int N,M;
    cin >> N >> M;
    _for(i,M){
        int a,b,t;
        cin >> a >> b >> t;
        uf.unite(a,b);
    }
    set<int> s;
//    rep(i,1,N+1)cout << uf.find(i) << " ";
    rep(i,1,N+1)s.insert(uf.find(i));
    cout << s.size() << endl;

}
};


#undef int
int main() {
	E1Or2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
    int a,b,k;
    cin>> a>>b>>k;
    int num=0;
    for(int i=a<b?a:b,cnt=0;cnt<k;i--){
        if(a%i==0&&b%i==0){
            cnt++;
            num=i;
        }
    }
    cout<<num<<"\n";
    return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    int a, b; cin >> a >> b;
    if (a == 1)a = 14;
    if (b == 1)b = 14;

    if (a == b)cout << "Draw\n";
    else if (a > b)cout << "Alice\n";
    else cout << "Bob\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
#include <string.h>
#include <cstring>

using namespace std;

int main(){
    
    int n;
    cin >> n;
    int* d;
    int ans=0;
    d = new int [n];
    for(int i=0;i<n;i++){
        cin >> d[i];
    }
    for(int k=0;k<n-1;k++){
        for(int j=k+1;j<n;j++){
            ans+=d[k]*d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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! {
        n: u64,
        r: u64,
    }

    if n < 10 {
        println!("{}", r + 100 * (10 - n));
    } else {
        println!("{}", r);
    }
}

Measured memory_bytes: 4352
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;
typedef long long ll;

int main() {
   int K;
   cin >> K;
   int A[K];
   for (int i = 0; i < K; i++) {
      cin >> A[i];
   }
   ll U = 2, D = 2;
   for (int i = K - 1; i >= 0; i--) {
      // cout << i << endl;
      U = A[i] * (U / A[i]) + A[i] - 1;
      D = A[i] * ceil((double)D / A[i]);
      // cout << U << " " << D << endl;
      if (U < D) {
         cout << "-1" << endl;
         return 0;
      }
   }
   cout << D << " " << U << endl;
   return 0;
}


Measured memory_bytes: 640
H,W = map(int,input().split())
src = [input() for i in range(H)]

dxy = [(-1,0),(0,-1),(1,0),(0,1)]
for y in range(H):
    for x in range(W):
        if src[y][x] == '.': continue
        for dx,dy in dxy:
            nx,ny = x+dx,y+dy
            if not 0 <= nx < W: continue
            if not 0 <= ny < H: continue
            if src[ny][nx] == '#':
                break
        else:
            print('No')
            exit()
print('Yes')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main(){
    int n, m;
    cin >> n >> m;
    vector<bool> s(m+5), g(m+5);
    rep(i, m){
        int a, b;
        cin >> a >> b;
        if(a == 1) s[b] = true;
        if(b == n) g[a] = true;
    }

    rep(i, m+3){
        if(s[i] && g[i]){
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(a) (a).begin(),(a).end()

int main()
{
  int a, b;
  cin >> a >> b;
  cout << a * b - a - b + 1 << endl;
  return 0;
}

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

using namespace std;

int g[1024][1024];

void solve()
{
    int n;
    cin >> n;
    int m = n * (n - 1);
    vector<int> g[m], dp(m, 1), es(m);
    for (int i = 0; i < n; i++)
    {
        vector<int> as(n - 1);
        for (int j = 0; j < n - 1; j++)
        {
            cin >> as[j];
            as[j]--;
        }
        for (int j = 0; j < n - 2; j++)
        {
            g[min(i, as[j]) * n + max(i, as[j])].push_back(
                min(i, as[j + 1]) * n + max(i, as[j + 1]));
            es[min(i, as[j + 1]) * n + max(i, as[j + 1])]++;
        }
    }
    queue<int> q;
    vector<int> vst(m);
    for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++)
        {
            int x = i * n + j;
            if (es[x] == 0)
            {
                q.push(x);
                vst[x] = 1;
            }
        }
    while (!q.empty())
    {
        int v = q.front();
        q.pop();
        for (int nv : g[v])
        {
            es[nv]--;
            if (es[nv] == 0)
            {
                q.push(nv);
                vst[nv] = 1;
                dp[nv] = max(dp[nv], dp[v] + 1);
            }
        }
    }
    if (accumulate(vst.begin(), vst.end(), 0) != n * (n - 1) / 2)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << *max_element(dp.begin(), dp.end()) << endl;
    }
}

int main()
{
    solve();
    cerr << "\"努力不足ですね！\"" << endl;
    return 0;
}


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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, k, n) for (int i = k; i < n; ++i)
#define fore(i,a) for (auto &i : a)
#define repr(i, n) for (int i = n; i >= 0; --i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-10;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

signed main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;
    if (s.size() == 1) {
        cout << 0 << endl;
        return 0;
    }
    string k = s;
    int ans1 = 0;
    for (int i = 0; i < s.size() - 1; ++i) {
        if (s[i] == s[i + 1]) {
                if (s[i + 1] == '0') s[i + 1] = '1';
            else s[i + 1] = '0';
            ++ans1;
        }
    }

    int ans2 = 0;
    for (int i = 0; i < k.size() - 1; ++i) {
        if (k[i] == k[i + 1]) {
            if (i == 0) {
                if (k[i] == '0') k[i] = '1';
                else k[i] = '0';
                ++ans2;
            } else {
            if (k[i + 1] == '0') k[i + 1] = '1';
            else k[i + 1] = '0';
            ++ans2;
            }
        }
    }
    cout << min(ans1, ans2) << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());

        int[] a = new int[n - 1];
        for (int i = 0; i < n - 1; i++) {
            a[i] = Integer.parseInt(scan.next());
            a[i]--;
        }
        scan.close();

        int[] ans = new int[n];
        for (int i = 0; i < n-1; i++) {
            ans[a[i]]++;
        }

        for (int i = 0; i < n; i++) {
            System.out.println(ans[i]);
        }

    }

}


Measured memory_bytes: 60900
#include<bits/stdc++.h>
using namespace std;
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.first << ", " << p.second << ")";
}
 
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
	out << "{";
	for(auto it = a.begin(); it != a.end(); it = next(it))
		out << (it != a.begin() ? ", " : "") << *it;
	return out << "}";
}
 
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
	cerr << a << ", ";
	dump(x...);
}

#ifdef DEBUG
#  define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
#  define debug(...) false
#endif
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
template<class T> int size(T && a) { return a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

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

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

	vector<int> e(q + 2);
	REP(i, q) cin >> e[i + 2];
	e[0] = a, e[1] = b;
	q += 2;

	int cap = 5e2;
	LL inf = 1e18;
	vector<LL> dp(cap, inf);
	dp[0] = 0;

	FOR(i, 1, q - 2) {
		vector<LL> nt(cap, inf);
		REP(j, cap) {
			if(dp[j] == inf) continue;
			int x = e[i];
			int y = e[i - 1 - j];
			int m = e[i + 1];

			nt[0] = min(nt[0], dp[j] + abs(m - y));
			if(j + 1 < cap) nt[j + 1] = min(nt[j + 1], dp[j] + abs(m - x));
		}
		swap(dp, nt);
	}

	LL ans = inf;
	for(LL &x : dp)
		ans = min(ans, x);

	cout << ans << "\n";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

template<typename T> T gcd(T a, T b) { return b ? gcd(b, a%b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }

const int MOD = 1000000007;

int main() {
    int N, K;
    cin >> N >> K;
    vi H(N);
    rep(i, N) cin >> H[i];

    sort(all(H), greater<int>());

    lint res = 0;

    rep(i, N) {
        if (i < K) {
            continue;
        }
        else {
            res += H[i];
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include "iostream"
#include "string"


int main()
{
	short int a, b, c, ab, divs;
	std::cin >> a >> b >> c;
	ab = b - a;
	divs = 0;

	for (int i = 0; i <= ab; i++)
	{
		if ((c % a) == 0) divs++;
		a++;
	}

	std::cout << divs << std::endl;
    return 0;
}

Measured memory_bytes: 3104
if __name__ == '__main__':

	N = int(input())

	A = []
	for i in range(N):
		a = int(input())
		A.append(a)

	A = sorted(A,reverse=True)

	cnt = 1
	for i in range(len(A)-1):
		if A[i] > A[i+1]:
			cnt += 1

	print(cnt)


Measured memory_bytes: 3060
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

var size = 100005
var node [][]int
var used []bool
var cnt []int

func dfs(v int) {
	if used[v] {
		return
	}
	used[v] = true
	cnt[v/size]++
	for _, e := range node[v] {
		dfs(e)
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	var n int
	n = getInt()
	node = make([][]int, size*2)
	for i := 0; i < n; i++ {
		x, y := getInt(), getInt()
		y += size
		node[x] = append(node[x], y)
		node[y] = append(node[y], x)
	}
	used = make([]bool, size*2)
	ans := 0
	for i := 0; i < size*2; i++ {
		if used[i] {
			continue
		}
		cnt = make([]int, 2)
		dfs(i)
		// if cnt[0]*cnt[1] != 0 {
		// 	out(i, cnt)
		// }
		ans += cnt[0] * cnt[1]
	}
	ans -= n
	out(ans)
}


Measured memory_bytes: 17280
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

 
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int p, q, r;
	
	cin >> p >> q >> r;
	
	cout << min(p+q, min(q+r, p+r)) << "\n";
	
	
	return 0;
}


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

int main(){
    int S;
    int block = 0;
    cin >> S;
    for(int i = 0; i < 3; i++){
        if(S % 10 != 0){
            block++;
        }
        S /= 10;
    }
    cout << block << endl;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

int n, k;
set<int> si;

int main() {
	cin >> n >> k;
	rep(i, k) {
		int d;
		cin >> d;
		si.insert(d);
	}
	while (1) {
		int num = n;
		bool f = 0;
		while (num) {
			if (si.find(num % 10) != si.end())f = 1;
			num /= 10;
		}
		if (!f) {
			cout << n << endl;
			return 0;
		}
		n++;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] stones = new int[n];
		int[] sol = new int[n];
		for (int i = 0; i < n; i++) {
			stones[i]=s.nextInt();
		}
		sol[0]=0;
		sol[1]=Math.abs(stones[0]-stones[1]);
		for (int i = 2; i < sol.length; i++) {
			if((Math.abs(stones[i-1]-stones[i])+sol[i-1])< (Math.abs(stones[i-2]-stones[i])+sol[i-2])) {
				sol[i]=Math.abs(stones[i-1]-stones[i])+sol[i-1];
			}else {
				sol[i]=Math.abs(stones[i-2]-stones[i])+sol[i-2];
			}
			
		}
		System.out.println(sol[n-1]);
	}

}


Measured memory_bytes: 47880
#include <bits/stdc++.h>
using namespace std;
 
int K, N;
int first;
int bef, tmp, ans = 0;
 
int main() {
  cin >> K >> N;
  cin >> first;
  bef = first;
  for(int i = 1; i < N; i++){
    cin >> tmp;
    ans = max(ans, tmp - bef);
    bef = tmp;
  }
  ans = max(ans, first + (K - bef));
  cout << K - ans << "\n";
}

Measured memory_bytes: 256
// spnauT
//
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int _b=(b),i=(a);i<_b;++i)
#define ROF(i,b,a) for(int _a=(a),i=(b);i>_a;--i)
#define REP(n) for(int _n=(n);_n--;)
#define _1 first
#define _2 second
#define PB(x) push_back(x)
#define SZ(x) int((x).size())
#define ALL(x) (x).begin(),(x).end()
#define MSET(m,v) memset(m,v,sizeof(m))
#define MAX_PQ(T) priority_queue<T>
#define MIN_PQ(T) priority_queue<T,vector<T>,greater<T>>
#define IO(){ios_base::sync_with_stdio(0);cin.tie(0);}
#define nl '\n'
#define cint1(a) int a;cin>>a
#define cint2(a,b) int a,b;cin>>a>>b
#define cint3(a,b,c) int a,b,c;cin>>a>>b>>c
typedef long long LL;typedef pair<int,int> PII;
typedef vector<int>VI;typedef vector<LL>VL;typedef vector<PII>VP;
template<class A,class B>inline bool mina(A &x,const B &y){return(y<x)?(x=y,1):0;}
template<class A,class B>inline bool maxa(A &x,const B &y){return(x<y)?(x=y,1):0;}

int main()
{
	IO();
	cint3(a,b,c);
	if(a > b) swap(a,b);
	if(c < b) swap(c,b);
	if(a > b) swap(a,b);
	if(a == 5 && b == 5 && c == 7) cout << "YES" << nl;
	else cout << "NO" << nl;

	return 0;
}

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

int main() {
    int ans = 0;
    int n, m;
    vector<pair <int, int > > ab; 
    pair <int, int > tmp;
    cin >> n >> m;
    for (int i=0; i<n; i++){
        cin >> tmp.first >> tmp.second;
        ab.push_back(tmp);
    }
    sort(ab.begin(), ab.begin()+n);
    priority_queue<int> q; 
    int checked = 0;
    for(int i=1; i<=m; i++){
        while(checked < n && ab[checked].first == i)
        {
            q.push(ab[checked].second);
            checked++;
        }
        if(q.size()>0){
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1908
import Data.Char

main = do
 sa <- getLine
 sb <- getLine
 sc <- getLine
 putStrLn (game "A" sa sb sc)

game "A" [] _ _ = "A"
game "B" _ [] _ = "B"
game "C" _ _ [] = "C"
game "A" (c:sa) sb sc = game [toUpper c] sa sb sc
game "B" sa (c:sb) sc = game [toUpper c] sa sb sc
game "C" sa sb (c:sc) = game [toUpper c] sa sb sc

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define MAXN 100010
#define pii pair<int,int>
#define ff first
#define ss second
#define ll long long
#define in_range(x, y, n) (x >= 0 and x<n and y >=0 and y<n)
using namespace std;
const ll mod = 1e18 + 7;


int main (){
    int n, d = 10 ,ans = 0, impar = 1;

    cin >> n;

    for (int i=1; i<=n; i++){
        if (impar == 1) ans++;
        if (i == d-1) {
            impar *= -1;
            d*=10;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#ifdef WIN32
	#define I64 "%I64d"
#else
	#define I64 "%lld"
#endif

typedef long long ll;

#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(s) s.begin(), s.end()
#define sz(s) (int(s.size()))
#define fname "a"


int main()
{
	#ifdef LOCAL
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif

	int n, k = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		int t;
		scanf("%d", &t);
		if (t & 1) ++k;
	}

	puts(k & 1 ? "NO" : "YES");

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
//typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define P pair<int,int>

class UnionFindTree {
private:
	std::vector<int> par;   // 親
	std::vector<int> depth; // 木の深さ

public:
	// n要素で初期化
	UnionFindTree(int n) {
		for (int i = 0; i < n; i++) {
			par.push_back(i);
			depth.push_back(0);
		}
	}

	// 木の根を求める
	int find(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);
		}
	}

	// xとyの属する集合を併合
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y)
			return;

		if (depth[x] < depth[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (depth[x] == depth[y])
				depth[x]++;
		}
	}

	// xとyが同じ集合に属するか否か
	bool same(int x, int y) { return find(x) == find(y); }
};

int main() {
	int n, m;
	cin >> n >> m;
	UnionFindTree UFT = UnionFindTree(n + 1);
	int s, t;
	rep(i, m) {
		cin >> s >> t;
		UFT.unite(s, t);
	}
	int Q;
	cin >> Q;
	rep(i, Q) {
		cin >> s >> t;
		if (UFT.same(s, t)) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}
}


Measured memory_bytes: 3952
#include<iostream>
using namespace std;
int n, i, a, b, ans, qwq[100001];
int main()
{
	cin >> n;
	while(n--){
		cin >> a >> b;
		for(i = a; i <= b; i ++){
			if(qwq[i] == 0){
				ans ++;
				qwq[i] = 1;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
    long int n, d;
    cin>> n >> d;

    long long int check = d * d;
    //cout<< check;

    long int x, y;

    long int ans = 0;
    while(n--)
    {
        cin>> x >> y;
        //cout<< pow() << " " << pow(y,2) << "\n";

        if(x*x + y*y <= check)
            ans++;
    }

    cout<< ans;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};

int main() {
  vector<int> x(5);
  for (int i=0; i<5; i++) cin >> x[i];
  for (int i=0; i<5; i++) {
    if (x[i]==0) {
      cout << i+1 << endl;
      break;
    }
  }
}

Measured memory_bytes: 3628
import sys

n = int(input())
h = list(map(int, input().split()))

ans = True
if n == 1:
    print('Yes')
    sys.exit()

for i in range(n-1):
    # print(h[-i-2], h[-i-1])
    if h[-i-2] > h[-i-1]:
        h[-i-2] -= 1
        if h[-i-2] > h[-i-1]:
            ans = False

print('Yes' if ans == True else 'No')


Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define jam(t) cout<<"Case #"<<t<<": "
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007ll
#define sz 400005
#define bitcnt(x) __builtin_popcountll(x)

using namespace std;

void solve(){
  string s;
  cin >> s;
  if(s == "ABC"){
    g("ARC");
  }
  else
  {
    g("ABC");
  }
}
int main()
{
#ifndef ONLINE_JUDGE
input_from_file
#endif
 
    FASTIO
    cin.tie(NULL);
    fflush(stdout);
    ll t = 1;
  //  cin >> t;
    for(ll tcase = 1;tcase <= t;tcase++){
      solve();
        
    }
return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pii  = pair<int,int>;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define rep2(i,x,n) for(ll i=x; i<(n); i++)
#define MOD 1000000007
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; }
const long long INF = 1LL << 60;
const double PI = 3.141593;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}    //最大公約数
ll lcm(ll a,ll b) {return a * b / gcd(a, b);}   //最小公倍数
ll combination(ll n, ll r) {
  if ( r * 2 > n ) r = n - r;
  ll dividend = 1;
  ll divisor  = 1;
  for ( ll i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int main(){
  int n,x;
  cin >> n;
  x = n / 1.08;
  if(floor(x*1.08)==n){
    cout << x << endl;
  }
  else if(floor((x+1)*1.08)==n){
       cout << x+1 << endl;
  }
  else
      cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[101010];
int N;
int main()
{
    scanf("%s", s); N = strlen(s);
    for(int i=0; i<N-1; ++i)
    {
        if(s[i] == s[i+1])
        {
            printf("%d %d\n", i+1, i+2);
            return 0;
        }
        if(s[i] == s[i+2])
        {
            printf("%d %d\n", i+1, i+3);
            return 0;
        }
    }
    puts("-1 -1");
    return 0;    
}

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

mt19937_64 llrand((int) chrono::steady_clock::now().time_since_epoch().count());

#define st first
#define nd second
#define pb push_back

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;

const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

set<string> st;
string s;
int n;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> n;
  while(n--) {
    cin >> s;
    st.insert(s);
  } 
  cout << st.size() << "\n";
}

Measured memory_bytes: 19236