akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
 using namespace std;

#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX / 2 + 2], R[MAX / 2 + 2];

llong merge(int A[], int n, int left, int mid, int right) {
    int i, j, k;
     llong cnt = 0;
     int n1 = mid - left;
     int n2 = right - mid;
    
     for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
     for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
    
     L[n1] = R[n2] = SENTINEL;
      i = j = 0;
    
      for ( k = left; k < right; k++ ) {
        if ( L[i] <= R[j] ){
             A[k] = L[i++];
        }else {
                 A[k] = R[j++];
                 cnt += n1 - i;
            
                  }
      }
     return cnt;
 }

llong mergeSort(int A[], int n, int left, int right) {
     int mid;
   llong v1, v2, v3;
     if ( left + 1 < right ) {
         mid =(left + right)/2;
         v1 = mergeSort(A, n, left, mid);
         v2 = mergeSort(A, n, mid, right);
         v3 = merge(A, n, left, mid, right);
         return v1 + v2 + v3;
     }   else return 0;
}

int main(){
    int A[MAX], n, i;
    cin >> n;
    for ( i = 0; i < n; i++ ) {
         cin >> A[i];
    }
    llong ans = mergeSort( A, n, 0, n );
     cout << ans << endl;
    
    return 0;
}
         


Measured memory_bytes: 4672
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String str = sc.next();
        sc.close();
        int count = 1;

        if (N == 1) {
        	System.out.println(1);
        	return;
        }
        for (int i = 0; i < N -1 ; i++) {
        	if (str.charAt(i) != str.charAt(i+1)) {
        		count++;
        	}
        }
    	System.out.println(count);
    }
}


Measured memory_bytes: 24996
import math

def calculate_variance(data):
  s_avg = sum(data) / len(data)
  sum_tmp=0
  for i in range(len(data)):
    sum_tmp += (s_avg-data[i])**2
  return math.sqrt(sum_tmp/len(data))

while True:
  input_sn=int(input())
  if input_sn == 0:
    break
  else:
    students = list(map(int,input().split()))
    s_variance = calculate_variance(students)
    print(s_variance)



Measured memory_bytes: 5704
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const int N = 100010;
int n, par[N], ok[N];
VI e[N];

void dfs(int now, int past, VI &d){
    for (int next : e[now]){
        if (next == past) continue;
        d[next] = d[now] + 1;
        par[next] = now;
        dfs(next, now, d);
    }
}

void dfs1(int now, int past){
    ok[now] = 1;
    for(int next : e[now]){
        if (next == past) continue;
        dfs1(next, now);
    }
}

VI calc(int r){
    VI d(n, -1);
    d[r] = 0;
    par[r] = r;
    dfs(r, -1, d);
    return d;
}

int main() {
    int u, v;
    cin >> n >> u >> v;
    u--;
    v--;
    REP(i,n-1){
        int a = in() - 1, b = in() - 1;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    VI du = calc(u);
    VI dv = calc(v);
    int x = u;
    while (true){
        int p = par[x];
        if (du[p] >= dv[p]) break;
        x = p;
    }
    dfs1(x, par[x]);

    int ans = 0;
    REP(i,n){
        if (!ok[i]) continue;
        chmax(ans, dv[i] - 1);
    }
    cout << ans << endl;

    return 0;
}


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

using namespace std;

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

    vector<int> vt(n);
    for (int i = 0; i < n; ++i) {
        int t;
        cin >> t;
        t--;
        vt[t]++;
    }
    sort(vt.begin(), vt.end(), greater<>());

    int ans = n - accumulate(vt.begin(), vt.begin() + k, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin>>n;
    int ans=0;
    FOR(i,1,n) {
        int j=n-i;
        if(i<j) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ar array

void solve()
{
    int N;
    cin>>N;

    vector<pair<pair<string,int>,int>>V;

    for(int i = 0 ; i < N; i++)
    {
        string str;
        int inp;
        cin>>str>>inp;

        V.pb(make_pair(make_pair(str,-inp),i));
    }

    sort(V.begin(),V.end());

    for(int i = 0; i < N; i++)
        cout<<V[i].second + 1<<endl;
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3620
# union-find

n, m = map(int, input().split())

def find_root(x):
    if par[x] == x:
        return x
    else:
        par[x] = find_root(par[x])
        return par[x]

def unite(x, y):
    x = find_root(x)
    y = find_root(y)
    if(x == y):
        return 0

    if rank[x] < rank[y]:
        par[x] = y

        temp = size[x] * size[y]
        size[y] = size[x] + size[y]
    else:
        par[y] = x
        if (rank[x] == rank[y]):
            rank[x] += 11

        temp = size[x] * size[y]
        size[x] = size[x] + size[y]
    return temp

def is_same(x,y):
    return find_root(x) == find_root(y)

# par = [0]*n
par = list(range(n))
rank = [0]*n
size = [1]*n

init_nums = list(map(int, input().split()))

edges = [list(map(int, input().split())) for _ in range(m)]
edges = [[b[0]-1, b[1]-1] for b in edges] #1-idx -> 0-idx

for b in range(m):
    unite(edges[b][0] , edges[b][1])

# print(par)
# print(len(set(par)))

ans = 0
for i in range(n):
    num = init_nums[i]
    # i+1 が init_numの中でi+1と同じグループだったら
    if is_same(i, num - 1):
        ans += 1

arr = [0] * n
for i in range(n):
    arr[i] = find_root(i)

print(ans)


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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

set<ll> st;
ll maxn=400000000;

void rep(ll x)
{
    if(st.find(x)!=st.end())
    return;

    st.insert(x);

    if(x>=maxn)
    return;

    if(x==0)
    {
        for(ll i=1;i<=9;i++)
        rep(i);
    }
    else
    {
        ll lt=x%10;
        if(lt>0)
        rep(x*10+lt-1);
        
        rep(x*10+lt);

        if(lt<9)
        rep(x*10+lt+1);
    }
    
}

int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll k;
        cin>>k;

        rep(0);

        while(k--)
        {
            st.erase(st.begin());
        }

        // cout<<st.size();

        cout<<*st.begin();
    }
}

Measured memory_bytes: 5504
from collections import defaultdict

N = int(input())
dic = defaultdict(int)
for i in range(N):
  temp = str(input())
  dic[temp] += 1

M = int(input())
for i in range(M):
  temp = str(input())
  dic[temp] -= 1

ans = max(dic.values())
if ans < 0:
  print("0")
else:
  print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    ll a;
    string b;
    cin >> a;
    cin >> b;
    ll b0 = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
    ll ans = a * b0 / 100;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
 
#define INF 1234567890
#define ll long long
#define MOD 998244353

int N, S;
int A[3030];
ll dp[3030][3030];

int main()
{
	scanf("%d %d", &N, &S);
	for(int i=1; i<=N; i++)
		scanf("%d", &A[i]);
	dp[0][0] = 1;
	for(int i=1; i<=N; i++)
	{
		for(int j=0; j<=S; j++)
		{
			if (j-A[i] >= 0) dp[i][j] += dp[i-1][j-A[i]];
			dp[i][j] += dp[i-1][j]*2;
			dp[i][j] %= MOD;
			//printf("%d %d : %lld\n", i, j, dp[i][j]);
		}
	}
	printf("%lld", dp[N][S]);
	return 0;
}

Measured memory_bytes: 74824
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;


long long x[1002], y[1002], r[1002];
double edge[1002][1002];
double d[1002];
int checked_count = 0;
bool checked[1002];
int N;

int main(){
    cin >> x[0] >> y[0] >> x[1] >> y[1];
    cin >> N;
    for(int i = 2; i < N + 2; i++){
        cin >> x[i] >> y[i] >> r[i];
    }

    for(int i = 0; i < N+2; i++){
        for(int j = 0; j < N+2; j++){
            edge[i][j] = edge[j][i] = max(0.0, sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j])) - (r[i] + r[j]));
        }
    }

    for(int i = 0; i < N+2; i++){
        d[i] = 4000000000;
    }

    d[0] = 0;
    checked_count = 1;
    checked[0] = true;
    int prev_node = 0;
    while(checked_count < N+2){
        double min_dist = 4000000000;
        int next_node;
        for(int i = 0; i < N+2; i++){
            d[i] = min(d[i], d[prev_node] + edge[prev_node][i]);
            if((!checked[i]) && d[i] < min_dist){
                next_node = i;
                min_dist = d[i];
            }
        }
        checked[next_node] = true;
        checked_count++;
        prev_node = next_node;
    }
    printf("%.12lf\n", d[1]);
}

    
    

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
const int Max_N=1e5;
int N,A[Max_N*2+10]={},B[Max_N*2+10]={};
inline int Chck(int x){
	if(B[N-1]==B[N]||B[N]==B[N+1]) return B[N];
	int L=N-2,R=N+2;
	for(;L>=1&&R<=2*N-1;){
		if(B[L]==B[L+1]) return B[L];
		if(B[R]==B[R-1]) return B[R];
		--L; ++R;
	} 
	return B[1];
}
int main(){
	scanf("%d",&N);
	for(int i=1;i<=2*N-1;i++) scanf("%d",&A[i]);
	int l=1,r=2*N-1;
	for(;l+1<r;){
		int mid=(l+r)/2;
		for(int i=1;i<=2*N-1;i++) 
		 if(A[i]<=mid) B[i]=0;
		 else B[i]=1;
		if(Chck(mid)==0) r=mid;
		else l=mid;
	}
	for(int i=1;i<=2*N-1;i++) 
	 if(A[i]<=r) B[i]=0;
	 else B[i]=1;
	if(Chck(r)==0) printf("%d\n",r);
	else printf("%d\n",l);
	return 0;
}

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

int main(void){
    int n,W;
    cin >> n >> W;
    
    int v[n],w[n];
    for(int i = 0;i < n;i++)cin >> v[i] >> w[i];
    
    int dp[n+1][W+1];
    memset(dp,0,sizeof(dp));
    
    for(int i = 0;i < n;i++){
        for(int j = 0;j <= W;j++){
            if(j >= w[i]){
                dp[i+1][j] = max(dp[i][j],dp[i][j-w[i]]+v[i]);
            } else dp[i+1][j] = dp[i][j];
        }
    }
    
    cout << dp[n][W] << endl;
}


Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 int N;
  cin >> N;
  
  int sum = 0;
  
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    sum += r+ 1 - l;
  }
  cout << sum << endl;
}

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

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> strVec(n);
  for (int i = 0; i < n; i++) {
    cin >> setw(l) >> strVec[i];
  }
  sort(strVec.begin(), strVec.end());
  for (int i = 0; i < n; i++) {
    cout << strVec[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
// g++ macro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) for(ll i=0;i<(n);++i)
#define REPR(i,n) for(ll i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair

int main(){
	CIN(q);
	REP(cc,q){
		LCIN(a,b);
		if(a==b){
			COUT(2*a-2);
			continue;
		}
		if(a>b)
			swap(a,b);
		ll val = a * b;
		// a位までの人員は全て入るのでa-1位が勝てる順位の最大値を求める
		// この順位はbより大きくなるはずなので、それ以降に全て詰め込める
		
		// aで負けていてbで勝っている人類を詰め込める限界値を求める
		// [0,b)を初期値にした二分探索で、(a+1)*num < valになるような最大の順位numを求める それ以降は足してよい
		
		// 


		ll st = 0;ll en = 2*b;
		while(en-st>1){
			ll num = (st + en) / 2;
			(((num + 1) / 2 * (num / 2 + 1) < val) ? st : en) = num;
		}
		COUT(st - 1);
	}

}


Measured memory_bytes: 256
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))

S = input()
flag = False
for i in range(len(S)-1):
    if(S[i]+S[i+1] == "AC"): flag = True

if(flag): print("Yes")
else: print("No")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>

using namespace std;
vector <int> edges[10000];
int c[10000];
int allocations[10000];
int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N - 1; i++){
        int a;
        int b;
        cin >> a >> b;
        edges[a - 1].push_back(b - 1);
        edges[b - 1].push_back(a - 1);
    }

    for(int i = 0; i < N; i++){
        cin >> c[i];
    }

    sort(c, c + N);
    int ans = 0;
    for(int i = 0; i < N - 1; i++){
        ans += c[i];
    }
    queue <int> q;
    q.push(0);
    for(int i = N - 1; i >= 0; i--){
        int cur = q.front();
        q.pop();
        allocations[cur] = c[i];
        for(int j = 0; j < edges[cur].size(); j++){
            if(allocations[edges[cur][j]] == 0){
                q.push(edges[cur][j]);
            }
        }
    }
    cout << ans << endl;
    for(int i = 0; i < N; i++){
        if(i != N - 1){
            cout << allocations[i] << " ";
        } else {
            cout << allocations[i] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 1024
# input here
_INPUT = """\

"""
"""
K = int(input())
H, W, K = map(int, input().split())
a = list(map(int, input().split()))
xy = [list(map(int, input().split())) for i in range(N)]
p = tuple(map(int,input().split()))
"""
def main():
    x = int(input())
    if x == 0:
        print(1)
    else :
        print(0)

            
if __name__ == '__main__':
    import io
    import sys
    import math
    import itertools
    from collections import deque

    # sys.stdin = io.StringIO(_INPUT)
    main()

Measured memory_bytes: 65484
Option Strict On

Module Module1
    Dim A, B, C, D As Long

    Sub Main()
        Dim tmp() As Long = Array.ConvertAll(Of String, Long) _
            (Console.ReadLine.Split(), AddressOf Long.Parse)

        'let'
        A = tmp(0) : B = tmp(1) : C = tmp(2) : D = tmp(3)

        Console.WriteLine(
            New String() {"Left", "Balanced", "Right"}(
            1 - Math.Sign(A + B - C - D)
            )
        )

    End Sub
End Module

Measured memory_bytes: 13140
#include <iostream>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

typedef long long ll;

using namespace std;

int main() {
  ll k,n,sum=0,A[200000],dif,difprev,m;
  cin >>k>>n;
  for(ll i=0;i<n;i++){
    scanf("%lld",&A[i]);
  }
  for(ll i=0;i<n;i++){
    if(i==0){
      m=A[i]+k-A[n-1];
    }else{
      m=max(m,A[i]-A[i-1]);
    }
  }

  cout<<k-m<<endl;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

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

		int[] n = new int[str.length()];
		int sum = 0;
		for(int i=0; i<n.length; i++){
			n[i] = str.charAt(i)  - '0';
			sum += n[i];
		}

		if(s%sum == 0){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 21972
#include <iostream>
using namespace std;
typedef long long ll;

const ll mod = 1000000007;

ll powmod(ll x, ll y){
  ll result = 1;
  for(ll i=0; i<y; i++){
    result = result*x%mod;
  }
  return result;
}

int main(void){
  ll N, A;
  cin >> N;
  A = powmod(9, N);
  ll ans = (powmod(10, N) - A - A + powmod(8, N)) % mod;
  cout << (ans + mod) % mod << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>

#define rep_ui(k,n)      for(ui  i = (k); i < (n); ++i)
#define rep_si(k,n)      for(int i = (k); i < (n); ++i)
#define rep_ul(k,n)      for(ul  i = (k); i < (n); ++i)
#define rep_sl(k,n)      for(ll  i = (k); i < (n); ++i)
#define rep_ui_down(k,n) for(ui  i = (k); i > (n); --i)
#define rep_si_down(k,n) for(int i = (k); i > (n); --i)
#define rep_ul_down(k,n) for(ul  i = (k); i > (n); --i)
#define rep_sl_down(k,n) for(ll  i = (k); i > (n); --i)

#define rep_uj(k,n)      for(ui  j = (k); j < (n); ++j)
#define rep_sj(k,n)      for(int j = (k); j < (n); ++j)
#define rep_uj_down(k,n) for(ui  j = (k); j > (n); --j)
#define rep_sj_down(k,n) for(int j = (k); j > (n); --j)

#define rep(k,n)         rep_ui(k,n)

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

template<class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vc)
{
  for (auto it = vc.begin(); it != vc.end(); ++it)
  {
    if (std::next(it) == vc.end())
      os << *it;
    else
      os << *it << ' ';
  }
  return os;
}

template<class T1, class T2>
inline
std::ostream & operator<<(std::ostream & os, const std::pair<T1, T2> & p)
{
  return os << p.first << ' ' << p.second;
}

void solve(void)
{
  using std::string;
  using std::vector;
  using std::map;
  using std::unordered_map;
  using std::pair;
  using std::cin;
  using std::cout;
  string S{}; std::cin >> S;

  vector<string> vs{}; vs.reserve(S.size());
  vs.push_back(S.substr(0, 1));
  for(ui i = 1; i < S.size();)
  {
    if(vs.back().size() != 1)
    {
      vs.push_back(S.substr(i, 1));
      ++i;
    }
    else
    {
      string s{}; s += S[i];
      while(s == vs.back())
      {
        ++i;
        if(i == S.size()) break;
        s += S[i];
      }
      if(s != vs.back())
      {
        vs.push_back(std::move(s));
        ++i;
      }
      else break;
    }
  }

  auto ans = vs.size();
  cout << ans << '\n';
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 11028
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N ;
  vector<int> A(N-1);
  for(int i=0; i<N-1;i++){
  cin >> A.at(i);
  }
  
  vector<int> ans(N);
  for(int i=0; i<N;i++){
  ans.at(i)=0;
  }
  for(int i=0; i<N-1;i++){
  ans.at(A.at(i)-1)=ans.at(A.at(i)-1)+1;
  }
  for(int i=0;i<N;i++){
  cout<< ans.at(i) << endl;
  }
 return 0; 
}

Measured memory_bytes: 4840
N = int(input())
A = []
for _ in range(N):
    A.append(input())

from collections import Counter

c = Counter(A)

judge = ["AC", "WA", "TLE", "RE"]
for j in judge:
    if j in c:
        k = c[j]
    else:
        k = 0

    print(f"{j} x {k}")

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    string S[3];
    rep(i,3)cin>>S[i];
    int t[3]={};
    int i=0;
    while(t[i]!=S[i].size()){
        int j=S[i][t[i]]-'a';
        t[i]++;
        i=j;
    }
    cout<<(char)('A'+i)<<endl;
}


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

Measured memory_bytes: 256
import bisect

n = int(input())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort()
c_list.sort()
ans = 0
for b in b_list:
    a = bisect.bisect_left(a_list, b)
    c = bisect.bisect_right(c_list, b)
    ans += a*(n-c)
print(ans)


Measured memory_bytes: 23360
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
int main(void){
   int N,M;
   cin>>N>>M;
   int K[N];
   int A[M+1];
   for(int i=0;i<M+1;i++){
       A[i]=0;
   }
   for(int i=0;i<N;i++){
       cin>>K[i];
       for(int j=0;j<K[i];j++){
           int check;
           cin>>check;
           A[check]++;
       }
   }
   int count=0;
   for(int i=0;i<=M;i++){
       if(A[i]==N){count++;}
   }
   cout<<count;
   return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(a>=b) cout<<"delicious"<<endl;
  else if(b-a<=x) cout<<"safe"<<endl;
  else cout<<"dangerous"<<endl;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int number;
    std::cin >> number;

    int list[number];
    for (int i = 0; i < number; i++) {
        std::cin >> list[i];
    }
    int count = 0;
    while (1) {
        bool bubbled = false;
        for (int i = 0; i < number - 1; i++) {
            if (list[i] > list[i + 1]) {
                int tmp = list[i];
                list[i] = list[i + 1];
                list[i + 1] = tmp;
                count++;
                bubbled = true;
            }
        }
        if (!bubbled) {
            break;
        }
    }
    for (int i = 0; i < number; i++) {
        std::cout << list[i];
        if (i != number - 1) {
            std::cout << " ";
        } else {
            std::cout << std::endl;
        }
    }

    std::cout << count << std::endl;
}


Measured memory_bytes: 3104
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, M; std::cin >> N >> M;
  std::set<int> ac;
  std::map<int, int> wa;

  for (int m = 0; m < M; ++m) {
    int p; std::cin >> p;
    std::string s; std::cin >> s;

    if (ac.count(p)) continue;

    if (s == "AC") {
      ac.insert(p);
    } else {
      ++wa[p];
    }
  }

  int num_ac = ac.size();
  int num_wa = 0;
  for (int i : ac) {
    num_wa += wa[i];
  }
  std::cout << num_ac << " " << num_wa << std::endl;
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n, m;
    cin >> n >> m;
    vector<PII> p(n);
    REP(i, n) cin >> p[i].first >> p[i].second;
    sort(ALL(p));

    ll ans = 0;
    REP(i, n) {
        if(m <= p[i].second) {
            ans += p[i].first * m;
            m = 0;
        } else {
            ans += p[i].first * p[i].second;
            m -= p[i].second;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
import numpy as np
N = int(input())
A = np.array(input().split()).astype(int)
B = np.array(input().split()).astype(int)
C = np.array(input().split()).astype(int)
r = sum(B)
r += C[A[np.append(np.diff(A)==1, False)]-1].sum()
print(r)

Measured memory_bytes: 17464
#include <bits/stdc++.h>
using namespace std;
int N,M,Q;
int sum[510][510];
vector<int> L(200009),R(200009),p(200009),q(200009);

int main() {
  cin >> N >> M >> Q;
  for(int i=0;i<M;i++)cin >> L[i] >> R[i];
  for(int i=0;i<Q;i++)cin >> p[i] >> q[i];
  for(int i=0;i<M;i++){sum[L[i]][R[i]]++;}
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){sum[i][j]=sum[i][j]+sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1];}
  }
  for(int i=0;i<Q;i++){
    cout << sum[q[i]][q[i]]-sum[q[i]][p[i]-1]-sum[p[i]-1][q[i]]+sum[p[i]-1][p[i]-1] << endl;
  }
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=1000000007;
const int nmax=101234;

int n,m,f[nmax];
char s[nmax];
vector<int> v2;

int F(int i){
    if(s[f[i]]=='0')
        return f[i];
    else
        return f[i]=F(f[i]+1);
}

int main()
{
    scanf("%d%d",&n,&m,s);
    scanf("%s",s);
    if(s[0]=='1' || s[n]=='1')
        return !puts("-1");
    for(int i=1;i<=n;++i)
        f[i]=i;
    for(int i=n;i;){
        if(i<=m){
            v2.pb(i);
            break;
        }
        int pos=F(i-m);
        if(pos==i)
            return !puts("-1");
        v2.pb(i-pos);
        i=pos;
    }
    for(int i=(int)v2.size()-1;i>=0;--i)
        printf("%d%c",v2[i],i==0?'\n':' ');
    return 0;
}


Measured memory_bytes: 1404
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]
n=int(input())
print(l[n-1])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);
    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

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

    map<int, ll> mp;
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) { cin >> a[i]; mp[a[i]]++; }

    ll ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); ++itr) ans += itr->second*(itr->second-1) / 2;
    rep(i, n) {
        ll res = ans;
        res -= mp[a[i]]*(mp[a[i]]-1)/2;
        mp[a[i]]--;
        res += mp[a[i]]*(mp[a[i]]-1)/2;
        mp[a[i]]++;
        cout << res << endl;
    }
}

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

using namespace std;


#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define int long long

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

template <typename T>

void print(T x)
{
	std::cout << x << '\n';
}

int euclid(int a, int b)
{
	int temp;

	if (a < b) { temp = a; a = b; b = temp; }
	if (b < 1) return -1;

	if (a % b == 0) return b;
	return euclid(b, a % b);
}

signed main(void) {
	int A,B,C,D;
	cin >> A >> B >> C >> D;
	int cd = C*D/euclid(C, D);
	A = A - 1;
		cout << B-A-(B/C + B/D - B/cd)+ (A / C + A / D - A / cd)<< endl;
	
}

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

using namespace std;

int main() {

    int N; cin >> N;
    string S[N];
    for(int i = 0; i < N; i++) cin >> S[i];

    int c0 = 0, c1 = 0, c2 = 0, c3 = 0;

    for(int i = 0; i < N; i++) {
        if(S[i] =="AC") c0++;
        else if(S[i]=="WA") c1++;
        else if(S[i]=="TLE") c2++;
        else if(S[i]=="RE") c3++;
    }

    cout << "AC x " << c0 << "\nWA x " << c1 <<"\nTLE x " << c2 << "\nRE x " << c3 << endl;

    return 0;
}

Measured memory_bytes: 6744
//なにもわからない
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
inline ll getll() {
	ll A = 0;
	if (ci - cn + 24 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

int tmp[200001];
void pakuri_sort(int N, vector<int> &A) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}
void pakuri_sort2(int N, vector<int> &A) {
	const int b = 8;
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		for (int i = (1 << b) - 2; i >= 0; i--) kazu[i] += kazu[i + 1];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		for (int i = (1 << b) - 2; i >= 0; i--) kazu2[i] += kazu2[i + 1];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	ll N = getint(), K = getll();
	vector<int> A(N), F(N);
	rep(i, N) A[i] = getint();
	rep(i, N) F[i] = getint();
	pakuri_sort(N, A);
	pakuri_sort2(N, F);

	ll L = -1, R = 1e12;
	while (L + 1 < R) {
		ll M = (L + R) / 2;

		ll kazu = 0;
		rep(i, N) {
			if ((ll)A[i] * F[i] > M) {
				kazu += A[i] - M / F[i];
				if (kazu > K) break;
			}
		}
		if (kazu > K) L = M;
		else R = M;
	}

	printf("%lld", R);


	Would you please return 0;
}

Measured memory_bytes: 2688
#include<iostream>
using namespace std;
int main(){
	int n;
	char ca[3][105];
	int s=0;
	cin>>n;
	cin>>ca[0]>>ca[1]>>ca[2];
	for(int i=0;i<n;i++){
		if(ca[0][i]==ca[1][i] && ca[1][i]==ca[2][i])continue;
		if(ca[0][i]==ca[1][i] || ca[2][i]==ca[1][i] || ca[0][i]==ca[2][i]){
			s++;
		}else s+=2;
	}
	cout<<s<<endl;
	return 0;
}
		


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll res;
    if(a<b){
        if(n==1){
            res = 0;
        }else{
            res = (b-a)*(n-2)+1;
        }
    }else if(a==b){
        res = 1;
    }else{
        res = 0;
    }
    put(res);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::vector<int>> vvi;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int A, B; std::cin >> A >> B;
  for(int i=1; i<=2000; i++) {
    int a = std::floor( (double)i * 0.08 );
    int b = std::floor( (double)i * 0.10 );
    if ( a == A && b == B ) {
      std::cout << i << std::endl;
      return 0;
    }
  }
  std::cout << -1 << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H, R;
	cin >> H >> R;

	if (abs(H) == R && 0>H) {
		cout << 0 << endl;
	}
	else if(H>=-R){
		cout << 1 << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}




Measured memory_bytes: 3176
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> a(N),b(N);
    rep(i,N)cin >> a[i];
    rep(i,N)cin >> b[i];
    ll res = 0;
    for(int k=0;k<30;k++){
        vector<int> am(N),bm(N);
        rep(i,N){
            am[i]=a[i]%(1<<(k+1));
            bm[i]=b[i]%(1<<(k+1));
        }
        sort(All(bm));

        ll is_one = 0;
        rep(i,N){
            int add = 0;
            if(am[i]<=(1<<k)){
                add += lower_bound(All(bm),(1<<(k+1))-am[i])-lower_bound(All(bm),(1<<k)-am[i]);
            }else{
                //add += lower_bound(All(bm),(1<<(k+1)))-bm.begin();
                //add -= lower_bound(All(bm),(3*(1<<k))-a[i])-lower_bound(All(bm),(1<<(k+1))-a[i]);
                add+=lower_bound(All(bm),(1<<(k+1))-am[i])-bm.begin();
                add+=lower_bound(All(bm),(1<<(k+1)))-lower_bound(All(bm),(3*(1<<k))-am[i]);
            }
            is_one+=add;
        }
        if(is_one&1)res+=(1<<k);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3476
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>; // グラフ型
typedef long long ll;
#define _GLIBCXX_DEBUG




int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> p(N);
  //vector<vector<int>> data(3, vector<int>(4));
  
  for (ll i=0; i< N; i++){
    cin >> p.at(i);
  }
  sort(p.begin(),p.end());

  ll ans=0;

  for (ll i=0; i< K; i++){
    ans += p.at(i);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    string ans;
    REP(i, s.size()) {
        if(s[i] == 'B') {
            if(!ans.empty()) ans.pop_back();
        } else {
            ans += s[i];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath> 
using namespace std;
int n,t,a;
float h[1010];
float m=100000000;
int main() {
    int tmp;
    int ans;
    float dif;
    cin>>n;
    cin>>t;
    cin>>a;
    for(int i=0;i<n;i++){
        cin>>tmp;
        dif=fabs((t-0.006*tmp)-a);
        if(m>dif){
            m=dif;
            ans=i;
        }
    }
    cout<<ans+1<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    ll a, b;
    cin >> a >> b;
    ll d = __gcd(a, b);
    cout << a * b / d << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  ios::sync_with_stdio(false);
  int A, B, C;
  cin >> A >> B >> C;
  cout << (C >= A && C <= B ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256