akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
bool isPerfectSquare(long double x) {   
    long double sr = sqrt(x); 
    return ((sr - floor(sr)) == 0); 
} 
int32_t main(){
    SPEED;
    int alice = 0, bob = 0;
    int n;
    cin >> n;
    int arr[n];
    read(arr);
    sort(arr, arr + n);
    int cnt = 0;
    for(int i = n - 1; i >= 0; --i){
        cnt++;
        if(cnt & 1) alice += arr[i];
        else bob += arr[i];
    }
    cout << alice - bob ;
}


Measured memory_bytes: 3580
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

h1,m1,h2,m2,k = m()

po = h2-h1
poo = m2-m1

if poo < 0:
	po -= 1
	poo += 60


print(po*60+poo-k)


Measured memory_bytes: 65192
MOD = 10 ** 9 + 7
S = input()
l = len(S)

dp = [[0 for i in range(13)] for j in range(l + 5)]
dp[0][0] = 1

for i, s in enumerate(S):
    if s == '?':
        c = -1
    else:
        c = int(s)
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        
        for n in range(13):
            dp[i + 1][(n * 10 + j) % 13] += dp[i][n]
        
        for m in range(13):
            dp[i + 1][m] %= MOD

print(dp[l][5])

Measured memory_bytes: 67036
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std; using namespace placeholders;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector< int > VI;
typedef vector< VI > VVI;
typedef vector< string > VS;
typedef stringstream SS;
typedef pair< int, int > PII;
typedef vector< pair< int, int > > VPII;

template < typename T > inline void input_n( vector< T > &out ) { copy_n( istream_iterator< T >( cin ), out.size(), out.begin() ); };
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( e, c ) for ( auto &e : c )
#define ALL( c ) (c).begin(), (c).end()
#define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define EM emplace
#define EB emplace_back
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

bool forbidden[ 16 ][ 16 ];
LL dp[ 16 ][ 16 ];

LL solve( const int a, const int b )
{
	if ( a < 0 || b < 0 )
	{
		return 0;
	}
	if ( !( a | b ) )
	{
		return 1;
	}
	if ( ~dp[a][b] )
	{
		return dp[a][b];
	}
	return dp[a][b] = forbidden[a][b] ? 0 : solve( a - 1, b ) + solve( a, b - 1 );
}

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

	for ( int a, b; cin >> a >> b, ( a | b ); cout << solve( a - 1, b - 1 ) << endl )
	{
		int n;
		cin >> n;

		fill( AALL( forbidden, bool ), false );
		fill( AALL( dp, LL ), -1 );

		REP( iteration, 0, n )
		{
			int x, y;
			cin >> x >> y;
			forbidden[ x - 1 ][ y - 1 ] = true;
		}
	}

	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #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); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 1000010;
const int MAXK = 510;
const int MAXQ = 200010;

int n, k, a[MAXN], dp[MAXN];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> k;
    FOR(i,1,n) cin >> a[i];
    dp[1] = 0;
    FOR(i,2,n) {
        dp[i] = 2000000000;
        FOR(j,1,k) {
            if (i - j <= 0) break;
            dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
        }
    }
    cout << dp[n];
    return 0;
}


Measured memory_bytes: 1024
//let's do it
 #include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define inf 1000000000000
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S second
#define F first
#define boost1 ios::sync_with_stdio(false);
#define boost2 cin.tie(0);
#define mem(a,val) memset(a,val,sizeof a)
#define endl "\n"
#define maxn 100001

int n,m,a[305][305],cnt[305],ban[305],ptr[305];

int ok(int limit)
{
	for(int i=1;i<=n;i++)
	ptr[i]=1;
	for(int i=1;i<=m;i++)
	{
		cnt[i]=0;
		ban[i]=0;
	}
	while(1)
	{
		for(int i=1;i<=m;i++)
		cnt[i]=0;
		int f=1;
		for(int i=1;i<=n;i++)
		{
			if(ban[a[i][ptr[i]]])
			{
				f=0;
				break;
			}
			cnt[a[i][ptr[i]]]++;
		}
		for(int i=1;i<=m;i++)
		{
			if(cnt[i]>limit)
			{
				f=0;
				break;
			}
		}
		if(f)
		return 1;
		for(int i=1;i<=n;i++)
		{
			if(cnt[a[i][ptr[i]]]>limit)
			{
				ban[a[i][ptr[i]]]=1;
				ptr[i]++;
			}
			else if(ban[a[i][ptr[i]]])
			ptr[i]++;
		}
		for(int i=1;i<=n;i++)
		{
			if(ptr[i]>m)
			return 0;
		}
	}
}
int main()
{
	boost1;boost2;
	int i,j,lo,mid,hi;
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		cin>>a[i][j];
	}
	lo=0;
	hi=n;
	while(hi-lo>1)
	{
		mid=(lo+hi)/2;
		if(ok(mid))
		hi=mid;
		else
		lo=mid;
	}
	cout<<hi;
	return 0;
}


Measured memory_bytes: 640
let readInt _ = stdin.ReadLine() |> int

let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

()
|> readInt
|> fun n ->
    let [| d; rest |] = readIntArray ()
    [| 1 .. n |]
    |> Array.map readInt
    |> Array.map (fun x -> if d % x = 0 then d / x else d / x + 1)
    |> Array.sum
    |> (+) rest
|> printfn "%d"


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

using namespace std;

int main()
{
    int N, K, X, Y;
    cin >> N;
    cin >> K;
    cin >> X;
    cin >> Y;

    long long ans = 0;

    for (int i = 0; i < N; ++i) {
        if (i < K) {
            ans += X;
        } else {
            ans += Y;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
  string S; cin >> S;
  int p=0;
  
  for(int i=0; i<S.size(); i++){
    if('p'==S[i]){p++;}
  }
  
  cout << (S.size()-2*p)/2;
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1100000000

struct unionfind{
	vector<int> data;
	vector<int> size;
	vector<long long> potential;
	unionfind(int n){
		for(int i=0;i<n;i++){
			data.push_back(i);
			size.push_back(1);
		}
		potential.resize(n,0);
	}
	
	unionfind(int n,vector<long long> p){
		for(int i=0;i<n;i++){
			data.push_back(i);
			size.push_back(1);
		}
		potential = p;
	}
	
	int find(int x){
		if(data[x]==x)return x;
		return data[x]=find(data[x]);
	}
	
	bool unite(int x,int y){
		x=find(x);y=find(y);
		if(x==y)return false;
		if(size[x]>size[y])swap(x,y);
		data[x]=y;
		size[y]+=size[x];
		potential[y] += potential[x];
		return true;
	}
	
	bool check(int x,int y){
		return (find(x)==find(y));
	}
	
	int get_size(int x){
		int X = find(x);
		return size[X];
	}
	
	long long get_potential(int x){
		return potential[find(x)];
	}
	
};

int main(){
	
	int N,M;
	cin>>N>>M;
	
	vector<long long> X(N);
	for(int i=0;i<N;i++)cin>>X[i];
	
	vector<pair<long long,pair<int,int>>> E;
	vector<vector<pair<int,long long>>> E2(N,vector<pair<int,long long>>());
	
	for(int i=0;i<M;i++){
		int A,B,Y;
		cin>>A>>B>>Y;
		
		A--;B--;
		E.emplace_back(Y,make_pair(A,B));
		E2[A].emplace_back(B,Y);
		E2[B].emplace_back(A,Y);
	}
	
	
	unionfind uf(N,X);
	sort(E.begin(),E.end());
	vector<long long> dis(N,-1);
	vector<bool> visited(N,false);
	
	priority_queue<pair<long long,int>> Q;
	for(int i=0;i<M;i++){
		int a = E[i].second.first;
		int b = E[i].second.second;
		uf.unite(a,b);
		if(uf.get_potential(a)>=E[i].first){
			Q.emplace(E[i].first,a);
			Q.emplace(E[i].first,b);
			dis[a] = E[i].first;
			dis[b] = E[i].first;
		}
	}
	
	while(Q.size()!=0){
		long long D = Q.top().first;
		int from = Q.top().second;
		Q.pop();
		if(visited[from])continue;
		visited[from] = true;
		for(int i=0;i<E2[from].size();i++){
			int to = E2[from][i].first;
			long long D2 = E2[from][i].second;
			if(D2>dis[from])continue;
			if(dis[from]>dis[to]){
				Q.emplace(dis[from],to);
				dis[to] = dis[from];
			}
		}
	}
	int ans = 0;
	for(int i=0;i<E.size();i++){
		if(dis[E[i].second.first]<E[i].first)ans++;
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 20464
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <fstream>
#include <queue>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <sstream>
#include <math.h>

#define For(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  For(i,0,n)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
#define SORT(c) sort((c).begin(),(c).end())
#define vi(m,a) vector<int> m(a)
#define vti(m,a,i) vector<vector<int>> m(a,vector<int>(i))
#define ALL(it,a) for(auto it = a.begin(); it!=a.end(); it++)
#define Fe(it,a) for(auto &it : a)
#define all(a) begin(a),end(a)

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
#define WARU 1000000007;

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

int main() {
	int a, b;
	cin >> a >> b;

	cout << max(a +b , max(a-b, a*b)) << endl;
}



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

int main() {
  ll x;
  cin >> x;
  double a = 100;
  ll ans = 0;
  for (;;) {
    ++ans;
    a += a * 0.01;
    a = floor(a);
    if (a >= x) {
      cout << ans << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 3624
#include <stdio.h>

int main() {
  int i, j, N, K;
  scanf("%d%d", &N, &K);
  for (i=j=0; i < N ;i++) {
    if (i % 2 == 0) j++;
  }
  if (j >= K) puts("YES");
  else puts("NO");
  return 0;
}


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

const long long int MOD = 1e9+7;
#define pb push_back
typedef long long ll;
const long long int N = 1e5;


long double dp[305][305][305];
int cnt=302;
int main(){
    int n;
    cin>>n;
    cout.precision(17);
    int a[n+5];
    int cnt1=0,cnt2=0,cnt3=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]==1) cnt1++;
        else if(a[i]==2) cnt2++;
        else cnt3++;
    }
    for(int k=0;k<=cnt;k++){
        for(int j=0;j+k<=cnt;j++){
            for(int i=0;k+i+j<=cnt;i++){
                if(i+j+k == 0 || i+j+k>n)continue;
                dp[i][j][k]= n;
                if(i)
                    dp[i][j][k]+=i*dp[i-1][j][k];
                if(j)
                    dp[i][j][k]+=j*dp[i+1][j-1][k];
                if(k)
                    dp[i][j][k]+=k*dp[i][j+1][k-1];

                dp[i][j][k] = dp[i][j][k]/(1.0*(i+j+k));
            }
        }
    }
    cout<<dp[cnt1][cnt2][cnt3];
    return 0;
}

Measured memory_bytes: 216072
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, M;
	cin >> N >> M;
	vector<vector<pair<int, ll>>> G(N);
	for (auto i = 0; i < M; ++i)
	{
		int L, R;
		ll D;
		cin >> L >> R >> D;
		--L;
		--R;
		G[L].push_back({ R, D });
		G[R].push_back({ L, -D });
	}

	auto ans = "Yes";
	vector<ll> d(N);
	vector<bool> used(N);
	for (auto i = 0; i < N; ++i)
	{
		if (used[i])
		{
			continue;
		}

		used[i] = true;
		d[i] = 0;
		queue<int> q;
		q.push(i);
		while (!q.empty())
		{
			auto u = q.front();
			q.pop();
			for (auto& p : G[u])
			{
				auto dist = p.second;
				auto v = p.first;
				if (used[v])
				{
					if (d[u] + dist != d[v])
					{
						ans = "No";
					}
				}
				else
				{
					used[v] = true;
					d[v] = d[u] + dist;
					q.push(v);
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 13824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

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

  vll x(n);
  for (ll i = 0; i < n; i++) cin >> x[i];

  ll ans = inf;
  for (ll i = 1; i <= 100; i++) {
    ll y = 0;
    for (ll j = 0; j < n; j++) y += (i - x[j]) * (i - x[j]);
    ans = min(ans, y);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int BinarySearch(int key,int n,int S[]){
  int l=0,r=n;
  while(r-l>1){
    int mid=(l+r)/2;
    if(S[mid]>key)r=mid;
    else l=mid;
  }
  return S[l]==(key?1:0);
}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8


int main(){
    string s;
    cin >> s;
    for (char i = 'a';i <= 'z';i++){
        if (s.find(i) == -1){
            cout << i << endl;
            return 0;
        }
    }
    cout << "None" << endl;
}

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

int main(void){
    int h, w;
    cin >> h >> w;
    map<int, int> cur2start;
    multiset<int> values;

    for (int i = 0; i < w; i++) {
        cur2start[i] = i;
        values.insert(0);
    }

    for (int i = 0; i < h; i++) {
        int left, right;
        cin >> left >> right;
        auto it = cur2start.lower_bound(left - 1);
        int right_bound_of_start = -1;
        while (it != cur2start.end() && it->first <= right) {
            right_bound_of_start = max(right_bound_of_start, it->second);
            values.erase(values.find(it->first - it->second));
            cur2start.erase(it++);
        }
        if (right_bound_of_start != -1 && right < w) {
            values.insert(right - right_bound_of_start);
            cur2start[right] = right_bound_of_start;
        }
        int ans = -1;
        if (values.size() > 0) {
            ans = *values.begin() + i + 1;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 22268
package main
import (
  "fmt"
  // "math"
)

func main() {
  var (
    S string
  )
  fmt.Scan(&S)
  ans := 0
  for i := 0; i < 3; i++ {
    if (string(S[i]) == "1") {
      ans++
    }
  }
  fmt.Println(ans)
  
}


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

using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,l,N;
    string s;
    string  s1 = "";
    cin>>n>>l;
   vector <string> vec(N);
    for(int i =0;i<n;i++){
        cin>>s;
        vec.push_back(s);
    }
    sort(vec.begin(),vec.end());
   for(int i =0;i<n;i++){
    s1+=vec.at(i);
   }
   cout<<s1;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  ll h;cin>>h;
  ll cnt = 0;
  while(h>0){
    ++cnt;
    h/=2;
  }
  cout << (ll)pow(2.0d, (double)cnt) - 1LL << endl; 
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int jungle[1280][1280];
int ocean[1280][1280];
int ice[1280][1280];

int main(void)
{
	int m, n, cnt;
	string str;

	cin >> m >> n >> cnt;
	for (int i = 0; i < m; i++){
		cin >> str;
		for (int j = 0; j < n; j++){
			if (str[j] == 'J') jungle[i + 1][j + 1] = 1;
			if (str[j] == 'O') ocean[i + 1][j + 1] = 1;
			if (str[j] == 'I') ice[i + 1][j + 1] = 1;
		}
	}
	for (int i = 1; i <= m; i++){
		for (int j = 1; j <= n; j++){
			jungle[i][j] += jungle[i][j - 1];
			ocean[i][j] += ocean[i][j - 1];
			ice[i][j] += ice[i][j - 1];
		}
	}
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			jungle[j][i] += jungle[j - 1][i];
			ocean[j][i] += ocean[j - 1][i];
			ice[j][i] += ice[j - 1][i];
		}
	}

	// for (int i = 0; i < m + 2; i++){
	// 	for (int j = 0; j < n + 2; j++){
	// 		cout << jungle[i][j] << " ";
	// 	}
	// 	puts("");
	// }

	// cin >> n;
	int a, b, c, d;
	while (cnt--){
		cin >> a >> b >> c >> d;
		swap(a, b); swap(c, d);
		int j = jungle[d][c] - jungle[b - 1][c] - jungle[d][a - 1] + jungle[b - 1][a - 1];
		// cout << jungle[d][c] << " " << jungle[b][c] << " " << jungle[d][a] << " " << jungle[b][a] << endl;
		int o = ocean[d][c] - ocean[b - 1][c] - ocean[d][a - 1] + ocean[b - 1][a - 1];
		int i = ice[d][c] - ice[b - 1][c] - ice[d][a - 1] + ice[b - 1][a - 1];
		printf("%d %d %d\n", j, o, i);
	}

	return 0;
}

Measured memory_bytes: 19628
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static ArrayList<String> list = new ArrayList<String>();
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];

        StringBuilder q = new StringBuilder();
        for(int i = 0; i < n; i++) {
        	x[i] = scan.nextInt();
        	y[i] = scan.nextInt();
        	q.append(i);
        }

        double sum = 0.0;
        permutation(q.toString(), "");

        for(int i = 0; i < list.size(); i++) {
        	String temp = list.get(i);
        	int tempX = x[Character.getNumericValue(temp.charAt(0))];
        	int tempY = y[Character.getNumericValue(temp.charAt(0))];
        	for(int j = 1; j < temp.length(); j++) {
        		sum += Math.pow(Math.pow(tempX - x[Character.getNumericValue(temp.charAt(j))], 2)
        				+ Math.pow(tempY - y[Character.getNumericValue(temp.charAt(j))], 2), 0.5);

        		tempX = x[Character.getNumericValue(temp.charAt(j))];
        		tempY = y[Character.getNumericValue(temp.charAt(j))];
        	}
        }
        System.out.println(sum / list.size());

    }
    public static void permutation(String q, String ans){
        if(q.length() <= 1) {
            list.add(ans + q);
        }
        else {
            for (int i = 0; i < q.length(); i++) {
                permutation(q.substring(0, i) + q.substring(i + 1),
                        ans + q.charAt(i));
            }
        }
    }

}

Measured memory_bytes: 52368
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>

using namespace std;

int main()
{
	
	while(1)
	{
		int n,m;
		vector<char> vSource,vDest;

		cin >> n;
		if(n == 0)
			break;

		for(int i = 0;i < n;i++)
		{
			char a,b;
			cin >> a >> b;
			vSource.push_back(a);
			vDest.push_back(b);
		}

		cin >> m;
		for(int i = 0;i < m;i++)
		{
			char a;
			cin >> a;

			for(int j = 0;j < vSource.size();j++)
			{
				if(a == vSource[j]){
					a = vDest[j];
					break;
				}
			}
			cout << a;
		}

		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
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; }
//#define int long long

void solve() {
    string s; cin>> s;
    int n = s.size();
    int dp[200200][2];
    rep(i, n + 1) {
        rep(j, 2) {
            dp[i][j] = 1;
        }
    }
    dp[0][0] = 0; dp[0][1] = 0;
    rep(i, n) {
        if(i - 2 >= 0)dp[i + 1][0] = max(dp[i + 1][0], dp[i][1] + 1);
        if(i - 1 >= 0 && s[i - 1] != s[i]) dp[i + 1][0] = max(dp[i + 1][0], dp[i][0] + 1);
        if(i - 2 >= 0) dp[i + 1][1] = max(dp[i + 1][1], dp[i - 1][0] + 1);
        if(i - 3 >= 0 && (s[i] != s[i - 2] || s[i - 1] != s[i - 3])) dp[i + 1][1] = max(dp[i + 1][1], dp[i - 1][1] + 1);
    }
    cout << max(dp[n][0], dp[n][1]) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 2196
#include<bits/stdc++.h>
//#include<unordered_map>
//#include<unordered_set>

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
/*
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
priority_queue<int, greater<int>, pairing_heap_tag> pq[1009];
#define fbo         find_by_order
#define ook         order_of_key
*/
typedef long long ll;
typedef unsigned long long ull;
typedef vector< vector<ll> >matrix;
#define gcd(A,B)        __gcd(A,B)
#define PQ              priority_queue
#define ii              int,int
#define pll             pair<ll,ll>
#define PI              2*acos(0.0)
#define all(v)          v.begin(),v.end()
#define pii             pair<ii>
#define pb              push_back
#define sf(x)           scanf("%I64d",&x)
#define sff(x,y)        scanf("%I64d %I64d",&x,&y)
#define sl(x)           scanf("%lld",&x)
#define sll(x,y)        scanf("%lld %lld",&x,&y)
#define ff              first
#define ss              second
#define segtree         lt=2*par,rg=2*par+1,mid=(st+en)/2
#define read            freopen("input.txt","r",stdin)
#define write           freopen("output.txt","w",stdout)
#define fast            ios_base::sync_with_stdio(0),cin.tie(0)
#define lead_zero(x)    __builtin_clzll(x)
#define trail_zero(x)   __builtin_ctz(x)
#define total_1s(x)     __builtin_popcount(x)
#define max_ull         18446744073709551615
#define max_ll          9223372036854775807;
#define set(N,cur)      N=(N|(1LL<<cur))
#define reset(N,cur)    N=(N&(~(1LL<<cur)))
#define check(N,cur)    ((N&(1LL<<cur))==0)
#define all(v)          v.begin(),v.end()
#define reunique(v)     v.resize(std::unique(all(v)) - v.begin())
#define loop            int test;scanf("%d",&test);for(int _T=1;_T<=test;_T++)
/* int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; */ // 4 Direction
/* int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; */ // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction

int main()
{
    int a,b;
    cin>>a>>b;
    if(a>8 or b>8)
        puts(":(");
    else
        puts("Yay!");
}






Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

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

constexpr double EPS = 1e-7;

template <typename T>
constexpr T INF = numeric_limits<T>::max();

template <class T>
constexpr T PI = static_cast<T>(3.14159265358979323846);

constexpr int MOD = 1e9 + 7;

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

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

template <typename T>
std::vector<T> table(int n, T v) { return std::vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
	auto val = table(args...);
	return std::vector<decltype(val)>(n, std::move(val));
}

int main(int argc, char const *argv[]) {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	string S, T, U;
	int A, B;
	cin >> S >> T >> A >> B >> U;
	if (S == U) {
		cout << A - 1 << " " << B << endl;
	} else if (T == U) {
		cout << A << " " << B - 1 << endl;
	} else {
		cout << A << " " << B << endl;
	}

	return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <ll, ll> pll;
const ll M=1e9+7;
ll inf=1e18;
int main()
{
    fast;
    ll n,k;
    cin>>n>>k;
    ll a=0,b=n,x=a,y=b;
    ll ans=0;
    for(int i=2;i<=k;i++){
        a++;
        b--;
        x+=a;
        y+=b;
    }
    for(int i=k;i<=n+1;i++){
        ans=(ans+(y-x+1)%mod)%mod;
        a++;
        b--;
        x+=a;
        y+=b;
    }
    cout<<ans;
}


Measured memory_bytes: 3640
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int n; cin >> n;
	int result = 1;
	int maxCount = 0;
	for (int i = 1; i <= n; i++) {
		int count = 0;
		int tmp = i;
		while (tmp % 2 == 0) {
			tmp /=2;
			count++;
		}
		if (count > maxCount) {
			maxCount = count;
			result = i;
		}
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 256
import copy
H, W, K = map(int, input().split())
c = [list(input()) for _ in range(H)]

hlst = [0] * H
wlst = [0] * W
looph = []
loopw = []
def dfs(cnt, lst, loop):
    if cnt == len(lst):
        loop.append(copy.deepcopy(lst))
        return
    for i in range(2):
        lst[cnt] = i
        cnt += 1
        dfs(cnt, lst, loop)
        cnt -= 1

dfs(0, hlst, looph)
dfs(0, wlst, loopw)

total = 0
for i in looph:
    for j in loopw:
        cnt = 0
        for k in range(H):
            for l in range(W):
                if i[k] == 1:
                    continue
                if j[l] == 1:
                    continue
                if c[k][l] == '#':
                    cnt += 1

        if cnt == K:
            total += 1

print(total)

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

//親を記録
vector<ll> par(50);
vector<ll> siz(50);

void init(int n){
    for(int i=0;i<n;i++) par[i]=i;
    fill(siz.begin(),siz.end(),1);
}

//親を求める
int root(int x){
    if(par[x]==x) return x;
    return par[x]=root(par[x]); //検索毎に根を親に組み替える
}

//X集合とY集合を統合
void unite(int x,int y){
    //Xの根とYの根を接続
    x=root(x);
    y=root(y);
    if(x==y) return;  //すでに統合済み
    if(siz[x]<siz[y]) swap(x,y); //大きい集合(X)に小さい集合(Y)を接続
    siz[x]+=siz[y]; //サイズ増加
    par[y]=x; //根の組み替え
    return;
}

int main(){
    ios::sync_with_stdio(false);
	int n,m,ans=0;
	cin>>n>>m;
	vector<int>a(m);
	vector<int>b(m);
	for(int i=0;i<m;i++){
		cin>>a[i]>>b[i];
		a[i]--;
		b[i]--;
	}
	for(int i=0;i<m;i++){
		init(n);
		for(int j=0;j<m;j++){
			if(i==j) continue;
			unite(a[j],b[j]);
		}
		for(int j=0;j<n;j++){
			if(j==0) continue;
			if(root(j)!=root(j-1)){
				ans++;
				break;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long   signed int LL;
typedef long long unsigned int LU;
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec(i, n)  decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
template<typename T> bool setmin  (T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmax  (T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
LL mo(LL a, LL b) { assert(b > 0); a %= b; if(a < 0) { a += b; } return a; }
LL fl(LL a, LL b) { assert(b > 0); return (a > 0 ? a / b : (a - b + 1) / b); }
LL ce(LL a, LL b) { assert(b > 0); return (a < 0 ? a / b : (a + b - 1) / b); }
#define bit(b, i) (((b) >> (i)) & 1)
#define BC __builtin_popcountll
#define SC(T, v) static_cast<T>(v)
#define SI(v) SC(int, v.size())
#define SL(v) SC( LL, v.size())
#define RF(e, v) for(auto & e: v)
#define ei else if
#define UR assert(false)

// ---- ----

int n, ans[100000];
vector<pair<int, int>> g[100000];

void dfs(int v, int p, int c) {
	ans[v] = c;
	RF(e, g[v]) {
		if(e.FI == p) { continue; }
		dfs(e.FI, v, (e.SE % 2 == 0 ? c : 1 - c));
	}
}

int main() {
	cin >> n;
	inc(i, n - 1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		g[a].EB(b, c);
		g[b].EB(a, c);
	}
	
	dfs(0, -1, 0);
	
	inc(i, n) { cout << ans[i] << "\n"; }
	
	return 0;
}


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

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

    for(int i = 0; i < S.size(); i++){
        if(S.at(i) != T.at(i)){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(0);
#define LLINF ((long long) 1e18)//1234567890987654321
#define INF 1234567890ll
#define pb emplace_back
#define ins insert
#define f first
#define s second	
#define db 0
#define EPS (1e-7)    //0.0000001 the value
#define PI (acos(-1))
#define MAXN (300006)
#define MAXK 26
#define MAXX 15000006
#define ll long long int 
#define ld long double
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
#define FOR(ii, ss, ee) for(ll ii = ss; ii < ee; ++ii)
#define space " "
#define cbr cerr << "hi\n"
#define mmst(x, v) memset((x), v, sizeof ((x)))
#define siz(x) ((ll)x.size())
#define ph emplace
#define btinpct(x) __builtin_popcountll(x)
#define p2(x) (1LL<<(x))
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
typedef pair <ll, ll> pi;
typedef pair <ll, pi> spi;
typedef pair <pi, pi> dpi;
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss
ll n,m;
ll X[MAXN],Y[MAXN],Z[MAXN];
vector<ll>v[MAXN];
bool vis[MAXN];
void dfs(ll x){
	if(vis[x])return;
	vis[x]=1;
	for(auto i:v[x]){
		dfs(i);
	}
}
int main()
{
	FAST
	cin>>n>>m;
	FOR(i,0,m){
		cin>>X[i]>>Y[i]>>Z[i];
		Z[i]%=2;
		ll a=X[i],b=Y[i];
		v[a].pb(b);
		v[b].pb(a);
	}
	ll ans=0;
	FOR(i,1,n+1){
		if(vis[i])continue;
		ans++;
		dfs(i);
	}
	cout<<ans;
}


Measured memory_bytes: 20608
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


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

    int n; cin>>n;
    vector<pair<int,int>> a(n);
    
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a));

    rep(i,n) cout << a[i].second+1 << " ";
    return 0;
}

Measured memory_bytes: 1664
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
D, N = M()
i = 100**D
if N < 100:
    print(N*i)
else:
    print(101*i)

Measured memory_bytes: 38640
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
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);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
    ll N; cin >> N;
    pr(N*(N-1)/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
#define vecmin(A) *min_element(A.begin(),A.end());
#define vecmax(A) *max_element(A.begin(),A.end());
typedef long long ll;

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

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

int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if ( C-(A-B) > 0 )
    {
        cout << C-(A-B) << endl;
    }
    else
    {
        cout << "0" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 int N,L;
  cin >> N >> L;
  vector<string> TJ(N);
  
  for(int i=0;i<N;i++)
    cin >> TJ.at(i);
  
 sort( TJ.begin() , TJ.end());  
  
  for(int j=0;j<N;j++)
    cout << TJ.at(j);
  
}   

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
typedef long long ll;

using namespace std;

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

    ll A;
    double B;
    cin >> A >> B;

    B *= 100;
    ll res = (ll)(A * (int)round(B));
    cout << (ll)(res / 100) << endl;

    return 0;
}


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

int main() {
	int n, i, map[100], max, min;
	cin >> n;

	for (i = 0; i < n; i++) {
		cin >> map[i];
	}

	max = map[0];
	min = map[0];
	for (i = 1; i < n ; i++) {
		if (max < map[i]) {
			max = map[i];
		}
		if (min > map[i]) {
			min = map[i];
		}
	}
	n = max - min;
	
	cout << n << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        string ans = "ABC" + Reader.ReadLine();
        Console.WriteLine(ans);
    
    }


    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


10
3
6
7
9


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int group[100001];
vector<int> graph[100001];
int fri[100001];
int block[100001];
int coun[100001];

void dfs(int now, int num){
	group[now] = num;
	for (int i = 0; i < graph[now].size(); i++){
		if (group[graph[now][i]] == 0){
			dfs(graph[now][i], num);
		}
	}
}

int main(){
	int n, m, k;
	cin >> n >> m >> k;
	for (int i = 0; i < m; i++){
		int a, b;
		cin >> a >> b;
		fri[a]++;
		fri[b]++;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	for (int i = 1; i <= n; i++){
		if (group[i] == 0){
			dfs(i, i);
		}
	}
	for (int i = 1; i <= n; i++){
		coun[group[i]]++;
	}
	for (int i = 0; i < k; i++){
		int c, d;
		cin >> c >> d;
		if (group[c] == group[d]){
			block[c]++;
			block[d]++;
		}
	}
	for (int i = 1; i <= n; i++){
		cout << max(0, coun[group[i]] - fri[i] - block[i] - 1) << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 8704
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Security.Cryptography;
using System.Security.Policy;

class Program
{
	static void Main()
	{
		var hw = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));
		var h = hw[0];
		var w = hw[1];

		var datass = new bool[h, w];
		for (var y = 0; y < h; ++y) {
			var a = Console.ReadLine();
			for (var x = 0; x < w; ++x) {
				datass[y, x] = a[x] == '#';
			}
		}

		var isImossible = false;
		var currentX = 0;
		for (var y = 0; y < h && isImossible == false; ++y) {
			//行けるだけ右へ
			var x = currentX;
			for (; x < w; ++x) {
				if (datass[y, x]) {
					datass[y, x] = false;
				} else {
					currentX = x - 1;
					break;
				}
			}

			currentX = x - 1;

			//ひとつ下に行けるか？
			if (y < h - 1 && datass[y + 1, currentX] == false) {
				isImossible = true;
			}
		}

		if (isImossible == false && currentX == w - 1) {
			for(var y = 0; y < h && isImossible == false; ++y) {
				for (var x = 0; x < w && isImossible == false; ++x) {
					if (datass[y, x]) {
						isImossible = true;
					}
				}
			}

			Console.WriteLine(isImossible ? "Impossible" : "Possible");
		} else {
			Console.WriteLine("Impossible");
		}

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 17644
defmodule Main do
  def main do
    k = 
    IO.gets("")
    |> String.trim()
    |> String.to_integer()
    
    [a, b] = 
    IO.gets("")
    |> String.trim()
    |> String.split()
    |> Enum.map(&String.to_integer/1)
    
    solve(0, k, a, b)
    |> IO.puts()
  end
  
  def solve(i, k, a, b) when i * k < a, do: solve(i + 1, k, a, b)
  def solve(i, k, a, b) when a <= i * k and i * k <= b, do: "OK"
  def solve(i, k, a, b) when b < i * k, do: "NG"
end


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

int main() {
    string s; cin >> s;
    int cnt[3] = {};
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'a') cnt[0]++;
        else if (s[i] == 'b') cnt[1]++;
        else cnt[2]++;
    }
    int flag = 1;
    if (abs(cnt[0] - cnt[1]) > 1) {
        flag = 0;
    }
    else if (abs(cnt[1] - cnt[2]) > 1) {
        flag = 0;
    }
    else if (abs(cnt[2] - cnt[0]) > 1) {
        flag = 0;
    }
    if (flag) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1001001001
#define LINF (1LL << 62)
using namespace std;
using ll = long long;
using P = pair<int, int>;

void solv() {
    int N, K;
    vector<bool> hateNumber(10);
    cin >> N >> K;
    rep(i, 10) hateNumber[i] = false;
    rep(i, K) {
        int buf;
        cin >> buf;
        hateNumber[buf] = true;
        //   cout << hateNumber[i];
    }
    // cout << endl;
    int ans = N;
    while (true) {
        bool flag = true;
        int buf = ans;
        while (buf != 0) {
            if (hateNumber[buf % 10] == true) {
                flag = false;
                break;
            }
            buf /= 10;
        }
        if (flag) {
            cout << ans << endl;
            return;
        }
        ans++;
    }
}

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

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

// #define REP(i, x) REPI(i, 0, x)
// #define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
// #define ALL(x) (x).begin(), (x).end()

// typedef long long ll;
// using namespace std;

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

//   int K;
//   cin >> K;
//   map<set<int>, int> memo;

//   ll ans = 0;

//   REPI(a, 1, K + 1) {
//     REPI(b, 1, K + 1) {
//       REPI(c, 1, K + 1) {
//         if (a == b && b == c) {
//           ans += a;
//           continue;
//         }

//         set<int> s = {a, b, c};
//         if (memo.find(s) != memo.end()) {
//           ans += memo.at(s);
//         } else {
//           int g = __gcd(__gcd(a, b), c);
//           memo.insert(make_pair(s, g));
//           ans += g;
//         }
//       }
//     }
//   }

//   cout << ans << endl;

//   return 0;
// }

#include <bits/stdc++.h>

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  int K;
  cin >> K;
  if (K == 1) {
    cout << 1 << endl;
    return 0;
  }

  map<pair<int, int>, int> memo;
  ll ans = 0;

  REPI(i, 1, K + 1) {
    REPI(j, 1, K + 1) { memo.insert(make_pair(make_pair(i, j), __gcd(i, j))); }
  }

  for (auto it : memo) {
    REPI(k, 1, K + 1) { ans += memo.at(make_pair(it.second, k)); }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6068
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
#define fin(ans) cout << (ans) << endl
const int INF = 1<<30;
const ll MOD = 1000000007;

int main() {
  string s,str;
  int a=1;
  cin >> s;
  
  str = s;
  reverse(str.begin(), str.end());
  if(s!=str){
    a=0;
  }

  str = s.substr(0, (s.length()-1)/2);
  reverse(str.begin(), str.end());
  //cout << s.substr(0, (s.length()-1)/2) << endl; 
  if(s.substr(0, (s.length()-1)/2)!=str){
    a=0;
  } 

  str = s.substr((s.length()+3)/2-1, s.length()-(s.length()+3)/2+1);
  reverse(str.begin(), str.end());
  //cout << s.substr((s.length()+3)/2-1, s.length()-(s.length()+3)/2+1) << endl; 
  if(s.substr((s.length()+3)/2-1, s.length()-(s.length()+3)/2+1)!=str){
    a=0;
  } 

  if(a==1) cout << "Yes" << endl; 
  else cout << "No" <<endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const ll MOD = 2019;
map<int, int> mp;

void solve(istream& cin, ostream& cout) {
  string s;
  cin >> s;
  REVERSE(s);
  mp.clear();
  int n = s.size();
  int mod = 0, p = 1;
  int ans = 0;
  mp[0]++;
  REP(i, n) {
    mod = (mod + (s[i] - '0') * p) % MOD;
    mp[mod]++;
    p = p * 10 % MOD;
  }
  ans = 0;
  REP(i, MOD) {
    // mp[i] combination 2
    if (mp[i] >= 2) ans += mp[i] * (mp[i] - 1) / 2;
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3748