akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
// Union Find
 
template<typename T>
struct UnionFind
{
	vector<T> par;
	vector<T> rank;
	vector<T> sizes;
	UnionFind(T n):par(n),rank(n,0),sizes(n,1){
	   for(T i=0;i<n;i++){
	     par[i]=i;
	   }
	}
	T root(T x){
	  return par[x]==x?x:par[x]=root(par[x]);
	}
 
	bool unite(T x,T y){
	  if(x==y) return false;
	  x=root(x); y=root(y);
	  if(x==y) return false;
	  if(rank[x]<rank[y]) swap(x,y);
	  if(rank[x]==rank[y]) rank[x]++;
	  par[y]=x;
	  sizes[x]=sizes[x]+sizes[y];
	  return true;
	}
	bool same(T x,T y){
	  return root(x)==root(y);
	}
	T size(T x){
	  return sizes[root(x)];
	}
};
int main(){
  ll n,m;
  cin>>n>>m;
  
  UnionFind<ll> uf(n);
  rep(i,m){
    ll a,b;
    cin>>a>>b;
    a--;b--;
    uf.unite(a,b);
  }
  ll ans=0;
  rep(i,n){
    chmax(ans,uf.size(i));
  }
  COUT(ans);
}

Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n, -1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x, y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};


int main() {
  ll N, M; cin >> N >> M;
  V a(M), b(M);
  rep(i, M) {
    int x, y; cin >> x >> y;
    x--; y--;
    a[i] = x; b[i] = y;
  }

  UnionFind uf(N);
  Vll ans(M+1);

  for (int i = M-1; i >= 0; i--) {
    if (uf.same(a[i], b[i])) {
      ans[i] = ans[i+1];
      continue;
    }
    ll x = uf.size(a[i]);
    ll y = uf.size(b[i]);
    ans[i] += ans[i+1] + (x+y)*(x+y-1)/2 - x*(x-1)/2 - y*(y-1)/2;
    uf.unite(a[i], b[i]);
  }

  rep(i, M) cout << (N*(N-1)/2 - ans[i+1]) << endl;
  return 0;
}


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

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

    int N,A;

    cin >> N >> A;

    while(N-500 >= 0){
        N-=500;
    }
    if(N-A <= 0) cout << "Yes\n";
    else cout << "No\n";
      
    return 0;
}

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

Measured memory_bytes: 2560
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  int n,k;
  map<int,int> mp;

  cin >> n >> k;
  rep(i,n){
    int a;
    cin >> a;
    mp[a]++;
  }
  
  vector<pair<int,int>> p;
  int count = 0;
  for(auto m : mp){
    p.push_back(make_pair(m.second,m.first));
  }
  
  sort(p.begin(),p.end());
  
  int size = p.size();
  
  if (size - k <= 0){
    cout << "0";
    return 0;
  }
  for (int i = 0; i < size - k; i++){
    count += p[i].first;
  }

  cout << count;
  
  
  return 0;
}

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

using ll = long long;

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

    { // compress
        auto b = a;
        sort(begin(b), end(b));
        for(int i = 0; i < n; ++i) {
            a[i] = lower_bound(begin(b), end(b), a[i]) - begin(b);
        }
    }

    using S = priority_queue<int, vector<int>, greater<>>;
    function<void(S&, S&)> merge = [] (S& s1, S& s2) {
        if(s1.size() < s2.size()) swap(s1, s2);
        while(!s2.empty()) {
            s1.push(s2.top()); s2.pop();
        }
    };

    queue<shared_ptr<S>> que;
    for(int i = 0; i < n; ++i) {
        auto q = make_shared<S>(); q->push(a[i]);
        que.push(move(q));
    }

    ll ans = 0;
    for(int i = 0; i < n; ++i) {
        auto s = que.front(); que.pop();
        while(s->top() != i) {
            auto v = que.front(); que.pop();
            merge(*s, *v);
        }
        s->pop();
        ans += s->size();
        que.push(s);
    }

    cout << ans << endl;
}



Measured memory_bytes: 25720
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
LL i,n,sum=1;
scanf("%lld",&n);
for(int i=1;i<=n;++i){
    sum=sum*i%MOD;
}
printf("%lld",sum);


    return 0;
}


Measured memory_bytes: 3696
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;

#define MAX_V 210000
int V;
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
bool used[MAX_V];
int cmp1[MAX_V];
int cmp2[MAX_V];
int ans[MAX_V];
vector<int>hoge[MAX_V];
void add_edge1(int to,int from){
    G[to].push_back(from);
    G[from].push_back(to);
}
void add_edge2(int to,int from){
    rG[to].push_back(from);
    rG[from].push_back(to);
}
void dfs1(int v,int k){
    used[v] = true;
    cmp1[v] = k;
    rep(i,G[v].size()){
        if(!used[G[v][i]]){
            dfs1(G[v][i],k);
        }
    }
}
void dfs2(int v,int k){
    used[v] = true;
    cmp2[v] = k;
    rep(i,rG[v].size()){
        if(!used[rG[v][i]]){
            dfs2(rG[v][i],k);
        }
    }
}
int main(){
    int n,k,l;
    scanf("%d %d %d",&n,&k,&l);
    vector<int>p(k);
    vector<int>q(k);
    vector<int>r(l);
    vector<int>s(l);
    rep(i,k){
        scanf("%d %d",&p[i],&q[i]);
        p[i]--;
        q[i]--;
        add_edge1(p[i],q[i]);
    }
    int temp1 = 0;
    rep(v,n){
        if(!used[v])dfs1(v,temp1++);
    }
    memset(used, 0, sizeof(used));
    rep(i,l){
        scanf("%d %d",&r[i],&s[i]);
        r[i]--;
        s[i]--;
        add_edge2(r[i],s[i]);
    }
    int temp2 = 0;
    rep(v,n){
        if(!used[v])dfs2(v,temp2++);
    }
    map<pii,int>M;
    rep(i,n) M[pii(cmp1[i],cmp2[i])]++;
    rep(i,n){
        if(i<n-1)printf("%d ",M[pii(cmp1[i],cmp2[i])]);
        else printf("%d\n",M[pii(cmp1[i],cmp2[i])]);
            
    }
}

Measured memory_bytes: 35072
using System;
using System.Linq;

namespace arc081_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
            Array.Sort(x); Array.Reverse(x);
            long han = 0; bool find = false;
            for (int i = 0; i < n && !find; i++)
            {
                if (i <= n - 4)
                {
                    if (han == 0 && x[i] == x[i + 1] && x[i] == x[i + 2] && x[i] == x[i + 3])
                    {
                        find = true;
                        Console.WriteLine(x[i] * x[i]);
                    }
                    else if (x[i] == x[i + 1])
                    {
                        if (han != 0)
                        {
                            find = true;
                            Console.WriteLine(han * x[i]);
                        }
                        else
                        {
                            han = x[i]; i++;
                        }
                    }
                }
                else if (i <= n - 2)
                {
                    if (x[i] == x[i + 1])
                    {
                        if (han != 0)
                        {
                            find = true;
                            Console.WriteLine(han * x[i]);
                        }
                        else
                        {
                            han = x[i]; i++;
                        }
                    }
                }
            }
            if (!find) Console.WriteLine(0);
        }
    }
}

Measured memory_bytes: 21088
/*
	Created by Faisal Ahmed
*/
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;

int main()
{
	string str;
	
	cin >> str;
	
	int a = 0, b = 0;
	for(int i = 0; i < 3; i++){
		if(str[i] == 'A'){
			a++;
		}
		else{
			b++;
		}
	}
	
	if(a == 0 || b == 0){
		cout << "No" << endl;
	}
	else{
		cout << "Yes" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

inline auto gcd (ll x, ll y)
{
  if (x == 0) return y;
  return gcd (y % x, x);
}

inline auto lcm (ll x, ll y)
{
  return x / gcd (x, y) * y;
}

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  ll a, b;
  cin >> a >> b;

  cout << lcm (a, b) << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    int N;
    cin >> N;
    vector<ll> X(N), Y(N);
    bool odd = false, even = false;
    rep(i, N) {
        cin >> X[i] >> Y[i];
        (X[i] + Y[i] & 1 ? odd : even) = true;
        if(even) Y[i]--;
    }
    if(odd && even) {
        cout << -1 << endl;
        return 0;
    }

    cout << 31 + even << endl;
    for(int i = 30; i >= 0; i--)
        cout << (1 << i) << " ";
    if(even) cout << 1;
    cout << endl;

    string s = "LDUR";
    rep(i, N) {
        ll a = X[i] + Y[i];
        ll b = X[i] - Y[i];
        ll nowa = 0, nowb = 0;
        for(int j = 30; j >= 0; j--) {
            int A, B;
            nowa += ((A = (nowa < a)) ? 1 : -1) << j;
            nowb += ((B = (nowb < b)) ? 1 : -1) << j;
            cout << s[2 * A + B];
        }
        if(even) cout << "U";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

int main(){
	ll Q,H,S,D,N;
	ll ans = 0;
	cin >> Q >> H >> S >> D;
	cin >> N;
	Q*=4;
	H*=2;
	if(Q<H) H = Q;
	if(H<S) S = H;
	if(2*S < D){
		ans = N*S;
	} else{
		ans = (N/2)*D+(N%2)*S;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e6 + 7;
const int Inf = 1 << 30;
const ll INF = 1ll << 60;
ll l, r;
ll p[maxx];

int main() {
	scanf("%lld %lld", &l, &r);
	int t = 0;
	for(ll i = 0ll; i <= r; i += 2019) {
		p[++t] = i;
		if(p[t] >= l && p[t] <= r) {
			puts("0");
			return 0;
		}
	}
	ll ans = 2019;
	for(ll i = l; i <= r; i++) {
		for(ll j = i + 1; j <= r; j++) {
			ll tmp = (i % 2019) * (j % 2019) % 2019;
			ans = min(ans, tmp);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

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

#define FORi( a , b ) for( int i = a ; i <= b ; i++ )
#define REPj( a , b ) for( int j = a ; j <= b ; j++ )
#define FORd( a , b ) for( int i = a ; i >= b ; i -- )
#define vi vector < int >
#define vll vector < long long int >
#define ll long long int
#define pb push_back

const int size = 101 ;
int ar[ size ] ;
int i , j , k , l , sum ;
int n , m , p , q , maximum , minimum ;
string a , b , c , res ;
stringstream ss , ss1 , ss2 ;
bool checker ;

int main( )
{
    cin >> n ;

    memset( ar , 0 , sizeof( ar ) ) ;
    int sum = 0 ;

    FORi( 1 , n )
    {
        cin >> m ;
        if ( ar[ m ] == 0 )
        {
            sum ++ ;
            ar[ m ] = 1 ;
        }

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



Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;

typedef pair<int, int> ii;
int main()
{
	//freopen("1.txt", "r", stdin);
	int h, w, n;
	int a[10][2];
	memset(a, -1, sizeof(a));
	cin >> h >> w >> n;
	char g[h+10][w+10];
	for(int i = 0; i<h; i++){
		for(int j = 0; j<w; j++){
			cin >> g[i][j];
			if(g[i][j] == 'S'){
				a[0][0] = i;
				a[0][1] = j;
				g[i][j] = '.';
			}else if(isdigit(g[i][j])){
				a[g[i][j] - '0'][0] = i;
				a[g[i][j] - '0'][1] = j;
			}
		}
	}
	
	int way[4][2] = {{-1,0}, {1,0}, {0,-1}, {0,1} };
	int sum = 0;
	for(int i = 1; i<=n; i++){
		int x = a[i][0];
		int y = a[i][1];
		
		int d[h+10][w+10];
		int visited[h+10][w+10];
		
		memset(d, -1, sizeof(d));
		memset(visited, 0, sizeof(visited));
		
		d[a[i-1][0]][a[i-1][1]] = 0;
		visited[a[i-1][0]][a[i-1][1]] = 1;
		
		
		queue<ii> q;
		q.push(ii(a[i-1][0],a[i-1][1]));
		
		
		while(!q.empty()){
			ii data = q.front();
			q.pop();
			if(data.first == x && data.second == y){
				sum += d[x][y];
				while(!q.empty()){
					q.pop();
				}
				break;
			}
			
			
			for(int j = 0; j<4; j++){
				int x1 = data.first + way[j][0];
				int y1 = data.second + way[j][1]; 
				if(x1>=0 && x1<h && y1>=0 && y1<w && g[x1][y1] != 'X' && visited[x1][y1] == 0){
					ii node = ii(x1,y1);
					q.push(node);
					visited[x1][y1] = 1;
					d[x1][y1] = d[data.first][data.second] + 1;
				}
			}
		}
		
		
		
	}
	cout << sum << endl;
	return 0;
	
	
}


Measured memory_bytes: 11976
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner scanner = new Scanner(System.in);
        int h=scanner.nextInt();
        int w=scanner.nextInt();
        char[][] charMatrix=new char[h][w];
        for(int i=0;i<h;i++){
            String line=scanner.next();
            for(int j=0;j<w;j++){
                charMatrix[i][j]=line.charAt(j);
            }
        }
        boolean result=true;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                result=result&&isAdjoin(charMatrix,i,j,h,w);
            }
        }
        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
    public static boolean isAdjoin(char[][] charMatrix,int i,int j, int h,int w){
        if(charMatrix[i][j]=='.') return true;
        if(i!=0) {
            if(charMatrix[i-1][j]=='#') return true;
        }
        if(i!=h-1) {
            if(charMatrix[i+1][j]=='#') return true;
        }if(j!=0) {
            if(charMatrix[i][j-1]=='#') return true;
        }
        if(j!=w-1) {
            if(charMatrix[i][j+1]=='#') return true;
        }
        return false;
    }
}


Measured memory_bytes: 22612
//shara's here
//私は大きな男の子
//SPEEEEEEEEEED IS KEEEEEEEEEEY
//REEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAAAAAAAAAAAAAAAAAAADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
#include <bits/stdc++.h>
using namespace std;
//fold
typedef double w;
typedef string s;
typedef long long ll;
typedef long double ld;
const ll INF = 1e18 + 10;
const ll MINF = -(1e18 + 10);
#if defined(BANYANYA)
#include "/home/xsharawi/Desktop/cpp/debug.hpp"
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define pb push_back
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
//endfold
int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b!=c)cout<<"Yes"<<endl;
	else if(b==c&&b!=a)cout<<"Yes"<<endl;
	else if(a==c&&b!=a)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	






return 0;}
/*
███████████████████████████████████████████████████
███████████████████████████████████████████████████
██████████████████████████████████▀████████████████
██████████████████████████████████░▀███████████████
██████████████████████████████▌███░░░▀▀████████████
██▀████████████████████▐██████░▐██░░░░░░▀▀█████████
██░████████████████████▐█████▌░██▌▄░░░░▄▄░▄████▀███
█▌░███████████████████▀░█████░░░█░░░▄████░░███▀▐███
█▌░▐██████████████████░░████▌░░░▀░░▀███▀▀░▐███▄████
██░▀██████████████▌▐█▐▄▄████▌░░░░░░░░░░░░░▌████████
███░███████████████▀░▄▄██▀█▐░░░░░░░░░░░░░░▐████████
███▄░██████████████▄░░░░░░▀▀▀░░░░░░░░░░░░░█▐███████
████▄░██████████████████▄▄▄▄▄▄▐▄░░░░░░░░░░░████████
█████▄█████████████████▀▀▀▀▀▀░░░░░░░░░░░░░░████████
████████████████████████▄░░░░░░░░░░░░░░░▄░░████████
██████████████████████████▄▄▄░░░░░░░░░▄█░▄█████████
████████████████████████████████▄░░░░██▄███▀░░▀████
█████████████████████████████▀█████▄███▀▀▀░░▄▄░████
████████████████████████████▀░░▀░░▀▀░░░░▄▄▄██▀░░▀▀█
███████████████████████████▌░░░░░░░░░░░███████░░░▄█
███████████████▄░▀████████▀░░░░░░▀░░░░███████▌░░░██
███▄▄████████████▄░▀██████▄░░░░░█░░░░████████░░░▀▀
░▀█████████████████▄░▀█████░░░░██░░░░▀██████░░░░░▄█
▐█▄▀█████████████████▄░▀████░░░██▌░░░▐████▀░░░░▄███
▐███▄▀▀█████████████████▄░▀▀░░░░▀██▌▄█▀▀░░░▄▄██████
▀▀▀▀▀░░░▀▀▀▀▀░░░▀▀▀▀▀▀▀▀▀▀▀░░░░░░░▀▀░░░░░░▀▀▀▀▀▀▀▀▀
*/




Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      int N = one.get(0);
      int x = one.get(1);
      myout(N - x + 1);
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32520
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string a, b, c; cin >> a >> b >> c;
  cout << (char)toupper(a[0]);
  cout << (char)toupper(b[0]);
  cout << (char)toupper(c[0]) << '\n';
}


Measured memory_bytes: 256
/**
*   @author: Kshitiz Srivastava (Pirate_ksh) @ MNNIT Allahabad
*/
#include<bits/stdc++.h>
using namespace std;
 
// General
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define mod_ 998244353 
#define endl "\n"
#define debug(x) cout<<x<<endl
#define REP(i,n) for(i=0;i<n;++i)
#define FOR(i,x,n) for(i=x;i<n;++i)
 
// Bounds
#define lb(a, x) a.lower_bound(x)
#define ub(a, x) a.upper_bound(x)
#define all(a) a.begin(),a.end()
 
// Vector
#define vi vector <int>
#define pb(v, x) v.push_back(x)
#define vsi vector <set <int> >
 
// Map
#define mii map <int, int>
 
// Set
#define si set <int>
 
// Pair
#define vpii vector<pair < int, int > >
#define pii pair < int, int >
#define F first
#define S second

ll t, i, j, k, n;
double p[3000];

double dp[3000][3000];
// double DP(int i, int j) {
//     if(i == 0) return dp[i][j] = 1;
//     if(dp[i][j] != 0.0) return dp[i][j];
//     double head, tail=0;
//     head = p[i-1] * DP(i-1, j-1);
//     if(i-1+n-j >= (n+1)/2) tail = (1-p[i-1]) * DP(i-1, j);
//     return dp[i][j] = head + tail;
// }

int main(){
    io;
    t=1;
    while(t--) { 
        cin >> n;
        REP(i,n) cin >> p[i];
        memset(dp, 0, sizeof(dp));
        REP(i,n+1) dp[0][i] = 1.0;
        FOR(i, 1, n+1) {
            REP(j, n+1) {
                double head = p[i-1] * dp[i-1][j-1], tail = 0.0;
                if(i-1+n-j >= (n+1)/2)
                    tail = (1-p[i-1]) * dp[i-1][j];
                dp[i][j] = head + tail;
            }
        }
        cout << setprecision(10) << dp[n][n] << endl;
    }
    return 0;
}


Measured memory_bytes: 70656
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <utility>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <bitset>

#define ll long long
#define fri(n) for(i=0;i<(n);i++)
#define frj(n) for(j=0;j<(n);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000000000//10^18
#define INFINT 2000000001//2*10^9+1
#define MOD 1000000007
#define MODANOTHER 998244353
#define PI acos(-1)

using namespace std;

struct bangumi_t{
	int s;
	int t;
	int c;
};

int compare_channel(const void *a, const void *b) {//降順と昇順あってる？？
	struct bangumi_t *A = (struct bangumi_t *)a;
	struct bangumi_t *B = (struct bangumi_t *)b;
	if(A->c - B->c >0){
		return 1;
	}else if(A->c - B->c <0){
		return -1;
	}else{
		return 0;
	}
}


int main(void)
{
	//変数の宣言
	ll int n,a,b,c,d;

	//よく使う変数
	ll int i,j,k,l;
	int flag=0;
	int ans=0;
	int count=0;
	ll int temp=0;
	int temp1=0;
	int temp2=0;
	int temp3=0;
	int max=0;
	int min=INFINT;
	int len=0;
	int sum=0;
	int ok=0;
	int ng=0;
	char dummy;
	char stemp[11];
	
	//データの読み込み


	scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);
//	scanf_s("%lld %lld %lld %lld %lld",&n,&a,&b,&c,&d);

//	scanf("%s",&s);
//	scanf_s("%s",&s,5);


/*	for(i=0;i<n;i++){
//		scanf("%d %d %d",&temp1,&temp2,&temp3);
		scanf_s("%d %d %d",&temp1,&temp2,&temp3);

		bangumi[i].s=temp1;
		bangumi[i].t=temp2;
		bangumi[i].c=temp3;
	}*/


/*	for(i=0;i<n;i++){
//		scanf("%d",&c[i]);
		scanf_s("%d",&c[i]);
		d[i]=0;
	}*/


	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

//	clock_t start=clock();

	flag=0;
	for(i=0;i<n;i++){
		if(i*c-(n-i-1)*d<=b-a&&b-a<=i*c-(n-i-1)*d+(d-c)*(n-1)) flag=1;
	}


//	clock_t end=clock();

	//	printf("計算部分終了\n");

	//出力
	if(flag==0){
		printf("NO");
	}else{
		printf("YES");
	}

//	printf("time=%lf",(double)(end-start)/CLOCKS_PER_SEC);
	//	printf("結果の出力終了\n");

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int A,B,C,D,x,y;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	x=A*B;
	y=C*D;
	if(x>=y)
	   printf("%d",x);
	else
	   printf("%d",y);
	return 0;
}

Measured memory_bytes: 128
/// ****** Property of vipulks ****** \

#include <stdio.h>
#include <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define ll long long

int main(){
	ll t,n,i,j,m=1,k,cnt=0;
	t=1;//scanf("%lld",&t);
	while(t--){
		scanf("%lld",&n);
		k=0;
		ll num[2005],a[2005],b[2005];
		for(i=-1000;i<=1000;i++){
			num[k]=pow(i,5);
			a[k]=i;
			k++;
		}
		for(i=0;i<k;i++){
			for(j=i+1;j<k;j++){
				if(num[j]-num[i]==n){
					m=0;
					break;
				}
			}
			if(m==0)
				break;
		}
		if(m==0)
			printf("%lld %lld\n",a[j],a[i]);
	}
	return 0;
}

Measured memory_bytes: 2624
import java.util.*;
import java.math.*;
public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int n = sc.nextInt();
        int[] ary = new int[n];
        for(int i = 0;i < n;i++){
            ary[i] = sc.nextInt();
        }
        int[] l = new int[n];
        l[0] = ary[n-1]-ary[0];
        for(int i = 1;i < n;i++){
            l[i] = ary[i-1]-ary[i]+k;
        }
        Arrays.sort(l);
        System.out.println(l[0]);

    }       
}






Measured memory_bytes: 79852
#include <stdio.h>
#include <iostream>
using namespace std;

int n;
struct Edge
{
    int num;
    int next;
}edge[200005];
int tot,last[100005];
int num[100005];
int sg[100005];
int fa[100005];

void Add(int i,int j)
{
    tot++;
    edge[tot].num=j;
    edge[tot].next=last[i];
    last[i]=tot;
}

void dfs_Init(int i)
{
    for (int k=last[i];k!=0;k=edge[k].next)
        {
        if (edge[k].num==fa[i]) continue;
        fa[edge[k].num]=i;
        num[i]++;
        dfs_Init(edge[k].num);
        }
}

void dfs_work(int i)
{
    if (num[i]==0)
        {
        sg[i]=0;
        return ;
        }
    int sum=0;;
    for (int k=last[i];k!=0;k=edge[k].next)
        {
        if (edge[k].num==fa[i]) continue;
        dfs_work(edge[k].num);
        sum=sum^(sg[edge[k].num]+1);
        }
    sg[i]=sum;
}

int main()
{
    scanf ("%d",&n);
    for (int i=1;i<n;i++)
        {
        int a,b;
        scanf ("%d %d",&a,&b);
        Add(a,b);
        Add(b,a);
        }
    dfs_Init(1);
    dfs_work(1);
    if (sg[1]==0) printf ("Bob");
    else printf ("Alice");
}


Measured memory_bytes: 6528
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    static Input in = new Input(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = in.nextInt();
        int[] A = new int[N];
        for (int n = 0; n < N; n++)
            A[n] = in.nextInt();
        int Q = in.nextInt();
        int[] B = new int[Q];
        int[] C = new int[Q];
        for (int q = 0; q < Q; q++) {
            B[q] = in.nextInt();
            C[q] = in.nextInt();
        }

        Map<Integer, Integer> count = new HashMap<>();
        long sum = 0;
        for (int n = 0; n < N; n++) {
            count.put(A[n], count.getOrDefault(A[n], 0) + 1);
            sum += A[n];
        }
        for (int q = 0; q < Q; q++) {
            int c = count.getOrDefault(B[q], 0);
            sum += (long) c * (C[q] - B[q]);
            count.put(B[q], 0);
            count.put(C[q], count.getOrDefault(C[q], 0) + c);
            out.println(sum);
        }

        out.flush();
    }

    static class Input {
        private BufferedReader br;
        private String[] buff;
        private int index = 0;

        Input(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }
        String nextLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }
        String next() {
            while (buff == null || index >= buff.length) {
                buff = nextLine().split(" ");
                index = 0;
            }
            return buff[index++];
        }
        byte nextByte() {
            return Byte.parseByte(next());
        }
        short nextShort() {
            return Short.parseShort(next());
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        float nextFloat() {
            return Float.parseFloat(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
        BigDecimal nextBigDecimal() {
            return new BigDecimal(next());
        }
    }
}



Measured memory_bytes: 61664
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll a,b,c;
  cin >> a >> b >> c;
  if((a+1)/2>=b)printf("YES");
  else printf("NO");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 303000;
int n,b[4][N],a[N],c[N],v[N],s[N];
void GG(){puts("No");exit(0);}
void add(int p){while(p<=n)v[p]++,p+=p&-p;}
int query(int p){int res=0;while(p)res+=v[p],p-=p&-p;return res;}
ll Query(int n){
	memset(v,0,sizeof(v));ll res=0;
	rep(i,1,n)res+=i-1-query(s[i]-1),add(s[i]);
	return res%2;
}
int main() {
	read(n);rep(i,1,3)rep(j,1,n)read(b[i][j]);
	rep(i,1,n){
		int x=b[2][i];
		if(b[1][i]==x-1&&b[3][i]==x+1&&x%3==2)a[i]=(x+1)/3,c[i]=0;
		if(b[1][i]==x+1&&b[3][i]==x-1&&x%3==2)a[i]=(x+1)/3,c[i]=1;
		if(!a[i])GG();
	}
	Vi x,y;
	for(int i=1;i<=n;i+=2)x.pb(a[i]),y.pb(i);
	sort(x.begin(),x.end());sort(y.begin(),y.end());
	if(x!=y)GG();
	x.clear();y.clear();
	for(int i=2;i<=n;i+=2)x.pb(a[i]),y.pb(i);
	sort(x.begin(),x.end());sort(y.begin(),y.end());
	if(x!=y)GG();
	
	
	int len;
	len=0;for(int i=1;i<=n;i+=2)s[++len]=a[i];
	int cnt=0;for(int i=2;i<=n;i+=2)cnt+=c[i];
	if(cnt-Query(len)&1)GG();
	len=0;for(int i=2;i<=n;i+=2)s[++len]=a[i];
	cnt=0;for(int i=1;i<=n;i+=2)cnt+=c[i];
	if(cnt-Query(len)&1)GG();
	
	puts("Yes");
	return 0;
}


Measured memory_bytes: 8444
#include <iostream>
#include <vector>
#include <algorithm>

#define lli long long int

using namespace std;

const int mc = 1e9 + 7;

template<typename T>
void print(vector<T> v)
{
	for (size_t i=0;i<v.size();++i){
		cout << v[i] << " ";
	}
	cout << endl;
}

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

	int n;
	cin >> n;

	vector<lli> v1(n), v2(n);
	vector<bool> e1(n), e2(n);

	lli last = 0;
	for (int i=0;i<n;++i){
		cin >> v1[i];
		if ( v1[i] != last){
			e1[i] = true;
		}
		else{
			e1[i] = false;
		}
		last = v1[i];
	}

	last = 0;
	for (int i=0;i<n;++i){
		e2[i] = true;
		cin >> v2[i];
		if (v2[i] == last){
			e2[i-1] = false;
		}
		last = v2[i];
	}

	/*
	print(v1);
	print(e1);
	print(v2);
	print(e2);
	*/

	int result = 1;
	bool flag = true;
	for (int i=0;i<n && flag;++i){
		if (!e1[i] && !e2[i]){
			result = (1LL * result * min(v1[i], v2[i]) ) % mc;
		}
		else if (e1[i] && !e2[i]){
			if (v2[i] < v1[i]){
				flag = false;
			}
		}
		else if (e2[i] && !e1[i]){
			if (v1[i] < v2[i]){
				flag = false;
			}
		}		
		else{
			if (v1[i] != v2[i]){
				flag = false;
			}			
		}
	}

	if (!flag){
		cout << 0;
	}
	else{
		cout << result;
	}

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N;
    cin >> N;
    vector<vector<P>> graph(N);
    for(int i = 0; i < N - 1; ++i){
        int a, b;
        cin >> a >> b;
        --a, --b;
        graph[a].emplace_back(b, i);
        graph[b].emplace_back(a, i);
    }
    vector<int> coloring(N - 1, -1);
    int K = 0;
    auto dfs = [&](auto&& self, int from = 0, int par = -1, int prev_color = -1) -> void {
        int color = 0;
        for(auto& p : graph[from]){
            int to = p.first, idx = p.second;
            if(to == par)   continue;
            if(color == prev_color) ++color;
            coloring[idx] = color;
            self(self, to, from, color++);
        }
        chmax(K, color);
    };
    dfs(dfs);
    cout << K << '\n';
    for(int ans : coloring) cout << ans + 1 << '\n';
}

Measured memory_bytes: 11108
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define vi vector<int>
#define all(a) a.begin(),a.end()
int a[200006];
signed main(){
    int n;cin>>n;
    rep(i,n)cin>>a[i];
    sort(a,a+n);reverse(a,a+n);
    int sum=0;
    rep(i,n-1){
        sum+=a[(i+1)/2];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 5196
#include <iostream>
using namespace std;
 
int main() {
  int a, b;
  int x;
  cin >> a >> b;
  x = (a * b) % 2;
  if (x == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n = int(input())
s = input()

ans = 0
pos = 0
while s.find("ABC", pos) != -1:
    ans += 1
    pos = s.find("ABC", pos)+1

print(ans)

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N =sc. nextInt();
	
	if(((N%10)==2)||((N%10)==4)||((N%10)==5)||((N%10)==7)||((N%10)==9)) {
		System.out.println("hon");
	}
	if(((N%10)==0)||((N%10)==1)||((N%10)==6)||((N%10)==8)) {
		System.out.println("pon");
	}
	if(((N%10)==3)) {
		System.out.println("bon");
	}
	
	}

}

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

int main() {
	string str;
	cin>>str;
	long long int s=0;
	for (int i=0;i<str.size();i++){
		int r=(str[i]-'0');
		s=s+r;
	}
	if (s%9==0){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3748
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
/****************************/
int main()
{
  	int x,y,z;
  	cin>>x>>y>>z;
  	cout<<z<<' '<<x<<' '<<y;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    n = II()
    S = list(map(int, list(input())))

    ans = 0
    for v in range(0, 1000):
        V = list(str(v))
        if len(V) == 2:
            V.insert(0, '0')
        elif len(V) == 1:
            V.insert(0, '0')
            V.insert(0, '0')
        elif len(V) == 0:
            V.insert(0, '0')
            V.insert(0, '0')
            V.insert(0, '0')
        # print(V)

        # end = [0] * 3
        cnt = 0
        for s in S:
            # print(V[cnt], str(s))
            if V[cnt] == str(s):
                cnt += 1
                if cnt == 3:
                    # print(V)
                    break
        # print(cnt)
        # input()
        if cnt == 3:
           ans += 1
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 43228
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int 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; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
template <typename t>
int digit(t x){
    int cnt = 0;
    while(x){
        x/=10;
        cnt++;
    }
    return cnt;
}

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    vector <vector<int>> data(10,vector <int>(10));
    rep(i,n+1){
        string s = to_string(i);
        data[s[0] - '0'][s[s.size()-1] - '0']++;
    }
    int ans = 0;
    rep(i,n+1){
        if(i == 0) continue;
        string s = to_string(i);
        ans += data[s[s.size()-1] - '0'][s[0] - '0'];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256