akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(){
  int n,a,b,r=0,i,j;
  scanf("%d%d%d",&n,&a,&b);
  for(i=1;i<=n;i++){
    int s = 0;
    j = i;
    for(;j;j/=10)s+=j%10;
    if(a<=s&&s<=b)r+=i;
  }
  printf("%d\n",r);
  return 0;
}


Measured memory_bytes: 128
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,b,a[li],k,flag,cev;
string s;
vector<int> v;

int main(void){
	scanf("%d %d",&n,&m);
	printf("%d\n",n+m/2);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;

inline bool query(ll x) {
	cout << "? " << x << endl;
	char c; cin >> c; return c == 'Y';
}

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	
	ll b = 1;
	while (b < 1e9 && query(10*b)) b *= 10;

	if (b == 1e9) {
		while (b > 1 && query(b - 1)) b /= 10;
	}

	ll l = b, h = 10*b - 1;
	while (l <= h) {
		ll m = (l + h) >> 1;
		query(10*m) ? h = m-1 : l = m+1;
	}
	cout << "! " << l << endl;
}

Measured memory_bytes: 3724
import java.util.*;
import java.lang.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());

        if((A+B)%3==0) System.out.print("Possible");
        else if(A%3==0) System.out.print("Possible");
        else if(B%3==0) System.out.print("Possible");
        else System.out.print("Impossible");

        System.out.println();
    }

}

Measured memory_bytes: 23764
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
s  = input()
n = len(s)
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

def is_kaibun(s):
    l = len(s)
    s1 = s[:(l-1)//2]
    s2 = s[(l+3)//2-1:]

    return (s == s[::-1]), s1, s2

is_kaibun_, s1, s2 = is_kaibun(s)

if is_kaibun_:
    q1 = s[:(n-1)//2]
    is_kaibun1, s1, s2 = is_kaibun(q1)
    #print(is_kaibun(q1))
    q2 = s[(n+3)//2-1:]
    is_kaibun2, s1, s2 = is_kaibun(q2)
    #print(is_kaibun(q2))
    print('Yes' if is_kaibun1 * is_kaibun2 else 'No')
else:
    print('No')


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

int N, X, Y, Z;
const long long MOD = 1000000007;

long long dp[50][(1<<17)+10][2];
long long solve() {
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 0; i < N; ++i) {
    for (int bit = 0; bit < (1<<17); ++bit) {
      //if (dp[i][bit][0] > 0) cout << i << ", " << bitset<17>(bit) << "(0): " << dp[i][bit][0] << endl;
      //if (dp[i][bit][1] > 0) cout << i << ", " << bitset<17>(bit) << "(1): " << dp[i][bit][1] << endl;

      for (int j = 1; j <= 10; ++j) {
	int nbit = bit;
	nbit <<= 1;
	nbit |= 1; 
	for (int k = 0; k < j-1; ++k) {
	  nbit <<= 1;
	  nbit &= ~(1<<17);
	}
	nbit %= (1<<17);
	//cout << bitset<17>(bit) << ", " << j << " -> " << bitset<17>(nbit) << endl;
   
	dp[i+1][nbit][1] += dp[i][bit][1]; dp[i+1][nbit][1] %= MOD;
	bool goal = true;
	if (!(nbit & (1 << (Z-1)))) goal = false;
	if (!(nbit & (1 << (Y+Z-1)))) goal = false;
	if (!(nbit & (1 << (X+Y+Z-1)))) goal = false;
	if (goal) {
	  dp[i+1][nbit][1] += dp[i][bit][0]; dp[i+1][nbit][1] %= MOD;
	}
	else {
	  dp[i+1][nbit][0] += dp[i][bit][0]; dp[i+1][nbit][0] %= MOD;
	}
      }
    }
  }

  long long res = 0;
  for (int bit = 0; bit < (1<<17); ++bit) {
    res += dp[N][bit][1];
    res %= MOD;
  }

  return res;
}

int main() {
  while (cin >> N >> X >> Y >> Z) {
    cout << solve() << endl;
  }
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
template <class T1, class T2>
void printp(const string& name, const pair<T1, T2> *p,const int n){
  rep(i,n){
    cout<<name <<":("<< p[i].first <<","<<p[i].second << ")" << endl;
  }
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  pair<int,int> itv[n];
  ll X[n],L[n];
  rep(i,n){
    cin>>X[i]>>L[i];
    itv[i].first=X[i]+L[i];
    itv[i].second=X[i]-L[i];
  }
  //printp("itv",itv,n);
  sort(itv,itv+n);
  ll ans=0,cur=-1100000000;;
  rep(i,n){
    if(cur<=itv[i].second){
      ans++;
      cur=itv[i].first;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2560
n=gets.split.map(&:to_i)
n.sort!
ans=0
a=n[2]-n[0]
b=n[2]-n[1]
ans+=a.div(2)
ans+=b.div(2)
a%=2
b%=2
if a==1 && b==1 then
  ans+=1
else
  ans+=2 if a==1
  ans+=2 if b==1
end
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int g = 2;
const int MOD = 200003;

int lg[222222];

typedef complex<double> base;
const double PI = 3.14159265359;

void fft(vector<base>& a, bool inv)
{
	int n = int(a.size());
	if(n == 1) return ;
	vector<base> l(n/2), r(n/2);
	for(int i = 0, j = 0; i < n; i += 2, ++j)
	{
		l[j] = a[i];
		r[j] = a[i + 1];
	}
	//l contains the even polynomial, r contains the odd polynomial
	fft(l, inv); fft(r, inv);
	double ang = 2*PI/n;
	if(inv) ang*=-1;
	base w(1); 
	base rt(cos(ang), sin(ang));
	for(int i = 0; i < n/2; i++)
	{
		a[i] = l[i] + w*r[i];
		a[i+n/2] = l[i] - w*r[i];
		if(inv)
		{
			a[i] /= 2; a[i+n/2] /= 2;
		}
		w *= rt;
	}
}

void mult(vi &a, vi &b, vi &r)
{
	int n = 1;
	while(n < max(a.size(), b.size())) n <<= 1;
	n <<= 1;
	vector<base> ffa; vector<base> ffb;
	base zero(0);
	ffa.assign(n, zero); ffb.assign(n, zero);
	for(int i=0;i<a.size();i++) ffa[i]=a[i];
	for(int i=0;i<b.size();i++) ffb[i]=b[i];
	fft(ffa, 0); fft(ffb, 0); //fft
	for(int i = 0; i < n; i++)
	{
		ffa[i] *= ffb[i]; //convolution
	}
	fft(ffa, 1); //inverse fft
	r.resize(n);
	for(int i = 0; i < n; i++)
	{
		r[i] = ll(ffa[i].real() + 0.5);
	}
}

int p[555555];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	int v = 1;
	for(int i=0;i<MOD+100;i++)
	{
		lg[v] = i;
		v=(v*2)%MOD;
		if(v==1) break;
	}
	p[0]=1;
	for(int i=1;i<=500000;i++) p[i]=(p[i-1]*2)%MOD;
	vi c(MOD+11,0);
	for(int i=0;i<n;i++)
	{
		int x; cin>>x;
		if(x>0) c[lg[x]]++;
	}
	vi r(MOD+11,0);
	vi b = c;
	mult(c,b,r);
	ll ans = 0;
	for(int i=0;i<=MOD;i++)
	{
		r[2*i]-=c[i];
	}
	for(int i=0;i<r.size();i++)
	{
		ans+=r[i]*1LL*p[i];
	}
	cout<<ans/2<<'\n';
}


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

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

    int A;
    vector<vector<vector<int>>> xy(n, vector<vector<int>>(n-1, vector<int>(2)));

    rep(i, n) {
        cin >> A;
        xy.at(i).resize(A);
        rep(j, A) {
            cin >> xy.at(i).at(j).at(0);
            cin >> xy.at(i).at(j).at(1);
            --xy.at(i).at(j).at(0);
        }
    }

    bool judge;
    int ans = 0, ans_tmp = 0;

    for (int tmp = ((1<<n) - 1); tmp >= 0; tmp--) {
        bitset<15> bit(tmp);
        judge = false;

        rep(i, n) {
            if (bit.test(i)) {
                if (xy.at(i).size() == 0) judge = true;
                rep(j, xy.at(i).size()) {
                    if (xy.at(i).at(j).at(1) == 1) {
                        if (bit.test(xy.at(i).at(j).at(0))) {
                            judge = true;
                            continue;
                        } else {
                            judge = false;
                            break;
                        }
                    } else {
                        if (bit.test(xy.at(i).at(j).at(0))) {
                            judge = false;
                            break;
                        } else {
                            judge = true;
                            continue;
                        }
                    }
                }
                if (judge == false) {
                    break;
                }
            } else {
                continue;
            }
        }

        if (judge) {
            ans_tmp = bit.count();
            ans = max(ans, ans_tmp);
        }
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
/* ****GT_18**** */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define INF			1000000000000000
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
using namespace __gnu_pbds;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		int x;
		cin>>x;
		cout<<1-x<<endl;
	}
	return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAXN = 10 + 5;

int n;
char s[MAXN];

void dfs(int l,char mx)
{
	if(l>n){ printf("%s\n",s+1); return;}
	
	for(s[l]='a'; s[l]<=mx; ++s[l])
		dfs(l+1,mx);
	if(mx<'z') dfs(l+1,mx+1);
}

int main(void)
{
	scanf("%d",&n);
	
	dfs(1,'a'-1);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

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



map<int,int> mp; // 一回実行した結果を格納

int rec(map<int,int> &m,int val) {
    int pc = __builtin_popcount(val);
    if((val%pc) == 0) {
        return 1;
    }
    m[val] = rec(m,val%pc) +1;
    return m[val];
}

void solve() {
    mp = map<int,int>();
    int maxi = 2*1e5+10;
    int N;
    string X;
    cin >> N;
    cin >> X;
    int rawcount = 0;
    for(const auto &c: X) if(c == '1') rawcount++;

    // mods[i] = 2^(i) mod n
    // nは2種類しかない→popcountはx+1,x-1
    vector<int> minus_mods(maxi,0);
    vector<int> plus_mods(maxi,0);
    minus_mods[0] = 1;
    plus_mods[0] = 1;

    // 1 -> 0
    int minus_pc = max(1,rawcount-1);
    bool care = (rawcount-1) == 0;
    // 0 -> 1
    int plus_pc = rawcount+1;


    FOR(i,1,maxi) {
        minus_mods[i] = (minus_mods[i-1] * 2) % minus_pc;
        plus_mods[i] = (plus_mods[i-1] * 2) % plus_pc;
    }

    int sm_minus_mods = 0;
    int sm_plus_mods = 0;

    REP(i,X.size()) {
        int ketame = X.size()-i-1;
        if(X[i]-'0') sm_minus_mods += minus_mods[ketame];
        if(X[i]-'0')sm_plus_mods += plus_mods[ketame];
        sm_minus_mods %= minus_pc;
        sm_plus_mods %= plus_pc;
    }


    vector<int> v(X.size());
    mp[1] = 1;
    mp[0] = 0;
    REP(i,X.size()) {
        int ketame = X.size()-i-1;
        // どっちのポップカウントを使うか
        if(X[i]-'0') {
            if(care) {
                v[i] = -1;
                continue;
            }
            int csmm = sm_minus_mods;
            // 1 -> 0
            csmm -= minus_mods[ketame];
            if(csmm < 0) csmm+=minus_pc;
            v[i] = csmm;
        } else {
            int cspm = sm_plus_mods;
            // 0 -> 1
            cspm += plus_mods[ketame];
            cspm %= plus_pc;
            v[i] = cspm;
        }
    }

    // 一回やればmaxi以下になるので一回だけやる　
    for(const auto &it: v) {
        //取り出す
        int state = it;
        bool end = false;
        if(state == 0) {
            cout << 1 << endl;
            continue;
        }
        if(state < 0) {
            cout << 0 << endl;
            continue;
        }
        while(!end) {
            int pc = __builtin_popcount(state);
            if(mp.count(state%pc)) {
                mp[state] = mp[state%pc]+1;
                end = true;
                break;
            } else {
                rec(mp,state);
                end = true;
            }
        }
        cout << mp[state]+1 << endl;
    }


}

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

Measured memory_bytes: 6660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

ll pow_mod(ll n,ll p,ll m){
    ll res = 1;
    while(p>0){
        if(p%2==1) res = (res * n) % m;
        n = (n * n) % m;
        p /= 2;
    }
    return res;
}

int main(){
    int n,k;cin >> n >> k;
    vl dp(k+1);
    for(int i=k;i>=1;--i){
        int cur = pow_mod(k/i, n, MOD);
        for(int j=2;j*i<=k;++j){
            cur -= dp[j*i];
            if(cur<0) cur += MOD;
        }
        dp[i] = cur;
    }
    ll ans = 0;
    for(int i=1;i<=k;++i){
        ans += (i * dp[i]) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4060
#include<iostream>
#include<cmath>
using namespace std;
int le(int a)
{
	if(a==0)
		return 1;
	int s=0;
	while(a)
	{
		s++;
		a/=10;
	}
	return s;
}
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n,i,a[1010],l,j;
	cin>>n;
	bool b;
	for(i=0;i<n;i++)
		cin>>a[i];
	for(i=0;1;i++)
	{
		b=false;
		for(j=0;j<n-le(i)+1;j++)
		{
			switch(le(i))
			{
				case 1:{
					if(i==a[j])
						b=true;
					break;
				} 
				case 2:{
					if(i==a[j]*10+a[j+1])
						b=true;
					break;
				} 
				case 3:{
					if(i==a[j]*100+a[j+1]*10+a[j+2])
						b=true;
					break;
				} 
			}
			if(b)
			break;
		}
		if(!b)
		{
			cout<<i<<endl;
			break;
		}
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}

Measured memory_bytes: 3100
#include <stdio.h>
int main(void)
{
  int N;
  int i;
  long int sum=0;
  scanf("%d", &N);
  for(i=1;i<=N;i++){
    if((i%3)!=0 && (i%5)!=0)
      sum=sum+i;
  }
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 1684
S = input()
s0=S.count(S[0])
s1=S.count(S[1])
s2=S.count(S[2])
s3=S.count(S[3])
if s0 == 2 and s1 == 2 and s2 == 2 and s3 == 2:
    print("Yes")
else:
    print("No")

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=0;i<=(n);i++)

int main(){
	int a, b, c, ans = 3;
	cin >> a >> b >> c;

	if(abs(a - b) == 0)
		ans--;
	if(abs(a - c) == 0)
		ans--;
	if(abs(b - c) == 0)
		ans--;
	if(abs(a - b) == 0 && abs(a - c) == 0 && abs(b - c) == 0)
		ans++;

	cout << ans << endl;

	return 0;
}


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

using namespace std;

int main() {
    int n, w;
    cin>>n;
    cin>>w;
    int ww[n];
    long long int vv[n]; 
    for (int i = 0; i < n; i++) {
        cin>>ww[i];
        cin>>vv[i];
    }
    long long int d[w+1];
    for (int i = 0; i < ww[0]; i++) d[i] = 0;
    for (int i = ww[0]; i <= w; i++) d[i] = vv[0];
    for (int i = 1; i < n; i++) {
        long long int dd[w+1];
        for (int j = 0; j <= w; j++) {
            if (ww[i] > j) dd[j] = d[j];
            else dd[j] = max(vv[i]+d[j-ww[i]], d[j]);
        }
        for (int j = 0; j <= w; j++) {
            d[j] = dd[j];
        }
    }
    cout<<d[w]<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <queue>
#include <cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

using namespace std;

template<class T>
inline T dbl(T x){ return x * x; }

double dist(int x1, int y1, int x2, int y2){
  return sqrt(dbl(x1 - x2) + dbl(y1 - y2));
}

class Matching{
  typedef vector<vector<int> > G;

  vector<bool> visited;

  const G &g; //g[i][j] = k <==> i is connected to k
  int n; //number of node
  int m; //number of left node

  bool augment(int left) {
    if (left < 0)
      return true;
    if (visited[left])
      return false;
    visited[left] = true;
    REP(i, g[left].size()) {
      int right = g[left][i];
      if (augment(matching[right])) {
        matching[right] = left;
        return true;
      }
    }
    return false;
  }

public:
  vector<int> matching;

  explicit Matching(const G &graph, int mm)
    : g(graph), m(mm){
    n = graph.size();
  }

  int solve() {
    int matches = 0;
    matching = vector<int>(n,-1);
    visited = vector<bool>(n);
    REP(left, m) {
      visited.assign(n, false);
      if (augment(left))
        matches++;
    }
    return matches;
  }
};

int main(){
  while(true){
    int n = getInt();
    int m = getInt();

    if(n + m == 0) break;

    vector<int> x(n);
    vector<int> y(n);
    vector<int> v(n);

    vector<int> xb(n);
    vector<int> yb(n);

    REP(i,n){
      x[i] = getInt();
      y[i] = getInt();
      v[i] = getInt();
    }
    REP(i,m){
      xb[i] = getInt();
      yb[i] = getInt();
    }

    double low  = 0.0;
    double high = 20000.0; 

    REP(k, 100){
      double mid = (low + high) / 2;
      vector<vector<int> > g(n + m);
      REP(i,n) REP(j,m){
	if(dist(x[i], y[i], xb[j], yb[j]) / (double)v[i] < mid + 1e-10){
	  g[i].push_back(j + n);
	  g[j + n].push_back(i);
	}
      }

      int match = Matching(g, n).solve();

      if(match == m){
	high = mid;
      }else{
	low  = mid;
      }
    }

    printf("%.8f\n", (low + high) / 2);
  }
  return 0;
}

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

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

    string x = "Yes";
    int N = S.size();

    for(int i = 0; i < N / 2; i++){
        if(S[i] != S[(N-1)/2 - 1 - i]) x = "No";
    }


    for(int i = 0; i < N / 2; i++){
        if(S[(N-1)/2 + 1 + i] != S[N - 1 - i]) x = "No";
    }

    for(int i = 0; i < N; i++){
        if(S[i] != S[N - 1 - i]) x = "No";
    }

    cout << x << endl;


}

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

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define START cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n))+1 : 1)
#define mem(x, val)    memset(x, val, sizeof(x)) //be careful
#define var auto
#define MOD 1000000007


typedef long long ll;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;


int main()
{
    START
    //freopen("test cases\\in.txt", "r", stdin) ;
    int n; cin>>n;
    map<string, bool> mp;
    while(n--){
        string s; cin>>s;
        mp[s]  = 1;
    }
    cout<<mp.size();
	return 0;
}


Measured memory_bytes: 19140
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
using namespace std;

int main(){
  int n, a, b;
  char s[100001];
  int count = 0;
  int count2 = 0;
  cin >> n >> a >> b;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(s[i] == 'a' && count < a+b){
      count++;
      cout << "Yes" << endl;
    }else if(s[i] == 'b' && count < a+b && count2 < b){
      count2++;
      count++;
      cout << "Yes" << endl;
    }else{
      cout << "No" << endl;
    }
  }

  return 0;
}


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


int main()
{
    int n;
    cin >> n;
    int a[100000] = {0};
    int b[100000] = {0};
    for(int i = 0; i < n / 2; i++){
        int x,y;
        cin >> x >> y;
        a[x-1]++; b[y-1]++;
    }
    int s1 = 0, s2 = 0, t1 = 0, t2 = 0;
    int num1 = 0, num2 = 0;
    for(int i = 0; i < 100000; i++){
        if(s1 < a[i]){
            s2 = s1;
            s1 = a[i];
            num1 = i;
        }else if(s2 < a[i]){
            s2 = a[i];
        }
        
        if(t1 < b[i]){
            t2 = t1;
            t1 = b[i];
            num2 = i;
        }else if(t2 < b[i]){
            t2 = b[i];
        }
    }
    if(num1 == num2 && s1 == t1){
        cout << n - s1 - max(s2,t2) << endl;
    }else{
        cout << n - s1 - t1 << endl;
    }
}

Measured memory_bytes: 1024
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define ALL(v) (v).begin(), (v).end()
#define SP cout << fixed << setprecision(10)
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int n, C;
int s[100000], t[100000], c[100000];
int sm[200002];
int tt[200002];

int main(void) {
    // code

    cin >> n >> C;
    rep(i, n) cin >> s[i] >> t[i] >> c[i];

    for (int i = 1; i <= C; i++) {
        rep(j, 200002) tt[j] = 0;
        rep(j, n) {
            if (c[j] == i) {
                tt[s[j] * 2 - 1]++, tt[t[j] * 2]--;
            }
        }
        FOR(j, 1, 200002) tt[j] += tt[j - 1];
        rep(j, 200002) {
            if (tt[j] > 0) {
                sm[j]++;
            }
        }
    }
    int mx = 0;
    rep(j, 200002) {
        if (mx < sm[j]) {
            mx = sm[j];
        }
    }

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

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "/home/o_o/MyCodes/pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  


void solve(){
	string s , t ;
	re(s,t);
	int cnt = 0 ; 
	rep(i,0,sz(s)) cnt+=(s[i]!=t[i]);
	cout << cnt << endl; 
}


signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3892
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define COUT(x) cout << (x) << endl;
#define _GLIBCXX_DEBUG

int main(){
  
  int a, b, c;
  cin >> a >> b >> c;
  if(b-a == c-b)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
//by NeighThorn
#define int long long
using namespace std;
const int MOD=1e9+7;
int n,m;
inline int power(int a,int b){
	int ans=1;
	while(b){
		if(b&1)
			(ans*=a)%=MOD;
		(a*=a)%=MOD;b>>=1;
	}
	return ans;
}
signed main(void){
	scanf("%lld%lld",&n,&m);
	cout<<power(n,m)<<endl;
	return 0;
}

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

using namespace std;

int main(){
int n, a[1000001];
cin >> n;
for(int i = 1; i <= n; i++){
    cin >> a[i];
}
sort(a + 1, a + n + 1);
for(int i = 1; i <= n; i++){
    return cout << a[n] - a[1], 0;
}
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll n,m;
Vi a,b;
matrix dp;
using ld = long double;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	std::cout<<std::fixed<<std::setprecision(30);
	cin>>n>>m;
	a.resize(n);
	b.resize(n);
	priority_queue< pair<ld,ll> > pq;
	rep(i,n){
		cin>>a[i]>>b[i];
		pq.push(mp((ld)b[i],i));
	}
	ll sum = 0;
	ll ans = 0;
	set<ll> st;
	rep(i,m){
		st.insert(i);
	}
	while(!pq.empty()){
		pair<ld,ll> p = pq.top();
		pq.pop();
		if(st.upper_bound(m-a[p.second])==st.begin()){
			continue;
		}
		auto it = st.upper_bound(m-a[p.second]);
		it--;
		ans += b[p.second];
		st.erase(it);
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 9964
#include<iostream>
#include<math.h>
using namespace std;
int main() {
	int h, w;
	cin >> h >> w;
	char s[52][52];
	for (int i = 0;i < h+2;i++) {
		for (int j = 0;j < w+2;j++) {
			if (i == 0 || j == 0||i==h+1||j==w+1) {
				s[i][j] == '.';
			}else{
			cin >> s[i][j];
			}
		}
	}
	

	for (int i = 1;i < h+1;i++) {
		for (int j = 1;j < w+1;j++) {
			if (s[i][j] == '#' && !(s[i - 1][j] == '#' || s[i + 1][j] == '#' || s[i][j - 1] == '#' || s[i][j + 1] == '#')) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;

	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    int sx, sy, tx, ty;
    std::cin >> sx >> sy >> tx >> ty;

    int ver = ty - sy, hor = tx - sx;
    std::string ans = "";
    ans += std::string(ver, 'U');
    ans += std::string(hor, 'R');
    ans += std::string(ver, 'D');
    ans += std::string(hor, 'L');
    ans += "L";
    ans += std::string(ver + 1, 'U');
    ans += std::string(hor + 1, 'R');
    ans += "DR";
    ans += std::string(ver + 1, 'D');
    ans += std::string(hor + 1, 'L');
    ans += "U";

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 888
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int X,Y;
	scan(X>>Y);
	if(Y%2==1){
		prin("No");
	}
	else{
		if(Y/2-X<0||2*X-Y/2<0){
			prin("No");
		}
		else prin("Yes");
	}
	
	return 0;
}


Measured memory_bytes: 3668
#include <iostream>
using namespace std;
int d[4];
int main (){
      while(cin>>d[0]){
            int tmp,x=0,y=0;
            for(int j=1;j<4;j++)cin>>d[j];
            for(int j=0;j<4;j++){
                  cin>>tmp;
                  if(d[j]==tmp){x++;continue;}
                  for(int k=0;k<4;k++)if(d[k]==tmp){y++;break;}
            }
            cout<<x<<' '<<y<<endl;
      }
}

Measured memory_bytes: 1160
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

// {{{
#define MAX_P 200005
struct ModComb {
  ll fact[MAX_P]; // fact[n]: n!
  ll inv[MAX_P];  // inv[n]: n^(-1)
  ll finv[MAX_P]; // finv[n]: (n!)^(-1)
  ll mod;

  ModComb(ll mod){  // 階乗関連テーブルの初期化 O(n)
    this->mod = mod;
    fact[0]=1;
    for(ll i=1;i<MAX_P;i++)
      fact[i]=(fact[i-1]*i)%mod;

    inv[1]=1;
    for(ll i=2;i<MAX_P;i++)
      inv[i]=inv[mod%i]*(mod-mod/i)%mod;

    finv[0]=1;  //　高速(10倍程度)な逆元階乗テーブルの作成。
    for(ll i=1;i<MAX_P;i++)
      finv[i]=finv[i-1]*inv[i]%mod;
  }

  ll mod_comb(ll n, ll k){  // テーブルがあればO(1)
    if(k<0||k>n)
      return 0;
    else {
      return fact[n]*finv[k]%mod*finv[n-k]%mod;
    }
  }
};
// }}}

int solve(){
  int n;cin>>n;
  int a[n+1];
  vi c(n+1, -1);
  pii p;
  rep(i, n+1) {
    cin>>a[i];
    if (c[a[i]]==-1){
      c[a[i]]=i;
    }
    else{
      p = mp(c[a[i]], i);
    }
  }
  // dump_1d(a, n+1);
  // dump(p);

  ModComb mc(1000000007LL);
  // assert(mc.mod_comb(5, 2) == 10);

  rep(i, 1, n+2){
    int res = 0;
    // 0
    res += mc.mod_comb(n-1, i);
    // 1
    res += 2*mc.mod_comb(n-1, i-1);
    res -=   mc.mod_comb(p.first+n-p.second, i-1);

    // 2
    res += mc.mod_comb(n-1, i-2);

    cout << (res%MOD>=0?res%MOD:res%MOD+MOD) << endl;
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<int>> c(10, vector<int>(10)), d(10, vector<int>(10, INT_MAX));
    REP(i, 10) REP(j, 10) { cin >> c[i][j]; }
    d = c;
    REP(i, 10) REP(j, 10) REP(k, 10) {
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
    }
    int res = 0;
    REP(i, H) REP(j, W) {
        int A;
        cin >> A;
        if (A == -1) continue;
        res += d[A][1];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstdlib>
#include <vector>
#include <iomanip>
#include <utility>
using namespace std;
#define ll long long
 
int main(void){
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k; i <= n; i++){
        if(i > 0)
        ans+=(n-i);
    }
    for(ll i = k+1; i <= n; i++){
        ans+=(n/i-1)*(i-k);
        if(n%i >= k)
            ans+=(n%i-k+1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n,k;
        cin >> n >> k;
        bool pos[10] = {};
        rep(i,0,k){
            int t;
            cin >> t;
            pos[t] = 1;
        }
        rep(i,n,N){
            int temp = i;
            bool f = 1;
            while(temp){
                if(pos[temp%10]) f = 0;
                temp /= 10;
            }
            if(f){
                cout << i << endl;
                r0;
            }
        }
    }
}

Measured memory_bytes: 3596
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    set<lli> s;
    vector<vi> e,b;
    vi vis,ans;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

void dfs(lli u)
{
    if(vis[u])
        return;
    vis[u]=true;
    s.insert(u);
    for(auto x:e[u])
        dfs(x);
}

void solve()
{
    for(auto u:s)
    {
        lli cnt=sz(s);
        cnt-=sz(e[u]);
        cnt--;
        for(auto x:b[u])
            cnt-=(s.find(x)!=s.end());
        ans[u]=cnt;
    }
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m>>k;
    e.resize(n+1);
    b.resize(n+1);
    vis.resize(n+1,false);
    ans.resize(n+1,0);
    
    while(m--)
    {
        cin>>u>>v;
        e[u].pb(v);
        e[v].pb(u);
    }

    while(k--)
    {
        cin>>u>>v;
        b[u].pb(v);
        b[v].pb(u);
    }

    repA(i,1,n)
    {
        if(vis[i])
            continue;
        s.clear();
        dfs(i);
        solve();
    }

    repA(i,1,n)
        cout<<ans[i]<<endl;

}   aryanc403();
    return 0;
}


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

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

typedef long long LL;

int main(){
  int n,m,R;
  cin >> n >> m >> R;
  vector<int> r(R);
  for(int i=0;i<R;i++){
    cin >> r[i];
    r[i]--;
  }
  vector<vector<LL>> c(n,vector<LL>(n,1000000000));
  for(int i=0;i<n;i++){
    c[i][i]=0;
  }
  int a,b,d;
  for(int i=0;i<m;i++){
    cin >> a >> b >> d;
    a--;
    b--;
    c[a][b]=d;
    c[b][a]=d;
  }
  for(int k=0;k<n;k++){
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
        c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
      }
    }
  }
  LL ans=100000000000000,tmp=0;
  sort(r.begin(),r.end());
  do{
    tmp=0;
    for(int i=1;i<R;i++){
      tmp+=c[r[i-1]][r[i]];
    }
    ans=min(ans,tmp);
  }while(next_permutation(r.begin(),r.end()));
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>

using namespace std;

int main(void) {
  char str[102];
  int len;
  
  scanf("%s", str);
  len = strlen(str);
  printf("%c%d%c\n", str[0], len-2, str[len-1]);
  
  return 0;
}

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

int main() {
  int n;cin >> n;
  string s; cin >> s;
  
  int x = 0;
  int xmx = x;
  for(int i=0; i<n; i++){
    if(s[i]=='I') x++;
    if(s[i]=='D') x--;
    
    if(x>xmx) xmx = x;
  }
  
  cout << xmx << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

//GCD
ll mygcd(ll x, ll y){
	if( y == 0 ) return x;
	return mygcd(y, x % y);
}

int main() {
    // your code goes here
    ll x,g;
    cin >> x;
    g=mygcd(360ll,x);
    cout << 360/g << endl;
    return 0;
}

Measured memory_bytes: 3532
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<limits.h>

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

int cmpDsc(const void* a, const void* b){
    lld x = *(lld*)a, y = *(lld*)b;
    if(x < y){
        return 1;
    }
    if(x > y){
        return -1;
    }
    return 0;
}

int main(){
    int n;
    scanf("%d", &n);
    lld a[n];
    rep(i, 0, n){
        scanf("%lld", &a[i]);
    }
    qsort(a, n, sizeof(lld), cmpDsc);
    lld x = 0, y = 0;
    int f = 0;
    rep(i, 0, n-1){
        if(a[i] == a[i+1]){
            if(f){
                y = a[i];
                break;
            }else{
                f = 1;
                x = a[i];
                i++;
            }
        }
    }
    printf("%lld", x*y);

    return 0;
}

Measured memory_bytes: 1788
///in the name of Allah the most beneficent the most merciful.
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 1e18
#define MIN -1e18
#define MOD 1000000007
//#define mod2 20071027
//#define MOD 998244353
#define base 139
//#define mod 1000074259
#define base2 31
#define memz(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define in1(a) scanf("%lld", &a)
#define in2(a, b) scanf("%lld%lld", &a, &b)
#define TC(c) printf("Case #%lld: ", ++c)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FILE   freopen("input.txt", "r", stdin);  freopen("out.txt", "w", stdout);
#define out(x) cout << #x << " -> " << x << endl;
using namespace std;
const ll N = 200010, M = 2000005;
string a, b;
ll res;
int solve()
{
    cin>>a>>b;
    ll n=a.length();
    for(int i=0;i<n;i++)
    {
        if(a[i]!=b[i]) res++;
    }
    cout<<res<<endl;
     return 0;
}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int ret = solve();
    return 0;
}
/*

*/


Measured memory_bytes: 3888
import itertools

H, W, K = map(int, input().split())
S = []
for _ in range(H):
    S.append([int(s) for s in input()])
    #行ごと指定できるのが良い

ans = 2000
for t in itertools.product([0, 1], repeat=H - 1):
    cnt = t.count(1)
    #print(cnt)
    lst = [[s for s in S[0]]]
    for h in range(H - 1):
        #(H-1)にしたのはｔにあわせるため
        #print(lst
        #th=1:切ってる、th=0、切ってない
        if t[h]:
            lst.append(S[h + 1])
            #一つしたの段の要素をリストごと足していることで後で網羅
        else:
            lst[-1] = [lst[-1][i] + S[h + 1][i] for i in range(W)]
            #既存の最後の要素に一つ下の段の要素を足している
        #print(lst)
    L = len(lst)
    #print(L)
    sum_lst = [0] * L
    #とりあえずゼロ配列作るプラス要素数を可変にする
    for w in range(W):
        if max(lst[i][w] for i in range(L)) > K:
            break
            #どれか一行でも超えたらあうと
        tmp = [sum_lst[i] + lst[i][w] for i in range(L)]
        if max(tmp) > K:
            cnt += 1 #前と一緒で合計超えてた場合は切る、切った回数を１足す
            sum_lst = [lst[i][w] for i in range(L)]
        else:
            sum_lst = tmp #合計リストをW回使いまわす#前から切ってない場合の分も足し合わせる
    else:
        ans = min(ans, cnt)
        #アンサーを最小化したら更新する
print(ans)


Measured memory_bytes: 3188
a, b, c = [int(x) for x in input().split()]
sum1 = a+(b*10+c)
sum2 = a+(c*10+b)
sum3 = b+(a*10+c)
sum4 = b+(c*10+a)
sum5 = c+(a*10+b)
sum6 = c+(b*10+a)
print(max(sum1, sum2, sum3, sum4, sum5, sum6))

Measured memory_bytes: 3064
#include<stdio.h>

int color[101], n, d[101], f[101], v[101][101], time;

 void visit(int u){
  int i;

  color[u] = 1;
  d[u] = ++time;
  for(i=1;i<=n;i++){


   if(color[i] == 0&&v[u][i]==1)visit(i);
   }
  color[u]=2;
  f[u] = ++time;
}

  void dfs(){
  int i;

  for(i=1;i<=n;i++){

   color[i]=0;
   }
  time=0;
  for(i=1;i<=n;i++){
    if(color[i]==0)visit(i);
   }
}

 int main(){


   int i,j,k[101],u[101],l;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      v[i][j]=0;
    }
  }

  for(i=1;i<=n;i++){
    scanf("%d %d",&u[i],&k[i]);
    for(j=1;j<=k[i];j++){
     scanf("%d",&l);
      v[i][l] = 1;
   }
}
   dfs();


    for(i=1;i<=n;i++){
      printf("%d %d %d\n",u[i],d[i],f[i]);
   }
    return 0;
}

Measured memory_bytes: 1844