akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define SET(x, a) memset(x, a, sizeof x);
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second
#define pld pair<ld, ld>
const ll MOD = 1000000007;
const ll INF = 1000000000;
int cnt;
template <class T> T read(T &x) {
  char c;
  int flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-')
      flag *= -1;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9')
    x = x * 10 + c - '0';
  x *= flag;
  return x;
}
string s;
int n;
int tot;
vector<pii> adj;
bool vis[100005];
vector<int> radj[100005];
int sz[100005];
void dfs(int x, int chosen, int dep){
  // if(!vis[dep]) {
    // cout << -1 << endl;
    // exit(0);
  // }
  // cout << x << " " << chosen << " " << tot<< endl;
  if(chosen == -1) return;
  int remain = chosen - 1;
  int pre = 0;
  while(remain){
    if(pre == -1){
      remain--;
      if(!vis[n - 1]){
        cout << -1 << endl;
        exit(0);
      }
      ++tot;
      adj.pb(mp(x, tot));
      radj[x].pb(tot);
      radj[tot].pb(x);
      dfs(tot, -1, dep+1);
      continue;
    }
    int mx = -1;
    for(int i = remain; i >= 1 && mx == -1; --i)
      if(s[i] == '1' && vis[n - i]) mx = i;
    ++tot;
    adj.pb(mp(x, tot));
      radj[x].pb(tot);
      radj[tot].pb(x);
    if(mx != -1) s[mx] = '0';
    else s[1] = '0';
    dfs(tot, mx, dep + 1);
    remain -= (mx == -1 ? 1 : mx);
    pre = mx;
  }
}
bool vis2[100005];
inline void dfs2(int x, int fa){
  if(vis2[x]){
    cout << -1 << endl;
    exit(0);
  }
  vis2[x] = 1;
  cnt++;
  sz[x] = 1;
  for(auto v : radj[x]) {
    if(v == fa) continue;
    dfs2(v, x);
    sz[x] += sz[v];
    if(s[sz[v]] == '0'){
      cout << -1 << endl;
      exit(0);
    }
    if(sz[x] > n){
      cout << -1 << endl;
      exit(0);
    }
  }
  if(s[n - sz[x]] == '0') {
    cout << -1 << endl;
    exit(0);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  n = s.length();
  s = "1" + s;
  if(s[n] == '1' || s[1] == '0') return cout<< -1 << endl, 0;
  vis[0] =1;
  for(int i = 1; i <= n; ++i)
    vis[i] = s[i] - '0';
  string tmp = s;
  for(int i = n; i >= 1; --i){
    if(s[i] == '1'){
      s[i] = '0';
      dfs(++tot, i + 1, 1);
      break;
    }
  }
  while(tot < n){
    adj.pb(mp(++tot, 1));
    radj[tot].pb(1);
    radj[1].pb(tot);
  }
  s[0] = '0';
  bool ok = 1;
  for(int i = 1; i <= n; ++i)
    if(s[i] == '1') ok = 0;
  if(!ok) return cout << -1 << endl, 0;
  if(adj.size() != n - 1 || tot > n) return cout << -1 << endl, 0;
  for(auto i : adj)
    cout << i.fi << " " << i.se << endl;
}


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

int main() {
  int H, W;
  while (true) {
    cin >> H >> W;
    if (H == 0 && W == 0) break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << '\n';
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void){
    int n, k;
    cin >> n >> k;
    
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    // game[K]がtrueならばTaro win
    // game[K]がfalseならばJiro win
    vector<bool> game(k+2, false);
    
    for (int i = 1; i <= k; i++){
        
        for (int j = 0; j < n; j++){
            
            if (i - a[j] >= 0 && game[i] == false) game[i] = !game[i-a[j]]; 
        }
    }
    
    if (game[k]) cout << "First" << endl;
    else cout << "Second" << endl;
    
}

Measured memory_bytes: 384
#include<stdio.h>
#include <vector>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
    int N;
    scanf("%d",&N);
    vector<int> A(N);

    for(int i=0; i<N; i++){
        scanf("%d",&A.at(i));
    }

    vector<int>B(N);
        for(int i=0;i<N;i++){
            B.at(i) = A.at(i); 
        }
    

    std::sort(A.begin(),A.end(),std::greater<int>());

    int f = A.at(0);

    int s = A.at(1);

    for(int i=0;i<N;i++){
        if(B.at(i) == f){
            printf("%d\n",s);
        }else{
            printf("%d\n",f);
        }
    }

    return 0;
}







Measured memory_bytes: 3200
using System;
using System.Linq;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var b = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var a = new int[n];
        a[0] = b[0];
        for (int i = 1; i < n - 1; i++) a[i] = Math.Min(b[i], b[i - 1]);
        a[n - 1] = b[n - 2];
        Console.WriteLine(a.Sum());
    }
}

Measured memory_bytes: 13268
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>

using namespace std;

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

    map<int, int> a;
    vector<int> arrange;
    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        a[tmp]++;
    }

    int sum = 0;
    int shouldNum = 0;
    int zeroCount = 0;
    int numCount = 0;
    bool first = true;
    bool same = true;
    bool zero = false;
    bool zero2 = true;
    for(map<int, int >::iterator it = a.begin(); it != a.end(); it++){
        numCount++;
        pair<int, int> p = *it;
        sum = sum ^ p.first;
        if(p.first == 0){
            zero = true;
            zeroCount = p.second;
        }else{
            if(p.second != zeroCount*2){
                zero2 = false;
            }
        }
        if(first){
            shouldNum = p.second;
            first = false;
        }else{
            if(p.second != shouldNum){
                same = false;
            }
        }
    }

    if(same && sum == 0){
        printf("Yes\n");
    }else if(zero && zero2){
        printf("Yes\n");
    }else{
        printf("No\n");
    }


    return 0;
}

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

const int INF = 1001001001;
vector<int> dp(1<<12,INF);

int main(void){
    int N,M;
    cin >> N >> M;
    vector<pair<int,int>> key;
    for(int i=0;i<M;i++){
        int a,b;
        cin >> a >> b;
        int s = 0;  //鍵で開く宝箱の集合(nコを0or1で表現)
        for(int j=0;j<b;j++){
            int c;
            cin >> c;
            c--;
            s |= 1<<c;  //作用する宝箱の位置(bit)を1に
        }
        key.push_back({s,a});
    }

    dp[0] = 0;

    for(int s=0;s<1<<N;s++){
        //各状態について各鍵を使った時の状態遷移を考える
        //サイズが小さいほうから大きいほうへ遷移
        for(int i=0;i<M;i++){
            int t = s|key[i].first; //遷移先
            dp[t] = min(dp[t], dp[s] + key[i].second);
        }
    }

    int ans = dp[(1<<N)-1];
    if(ans==INF) cout << -1 << endl;
    else cout << ans << endl; 

}

Measured memory_bytes: 256
m,d=map(int,input().split())
count=0
for i in range(1,m+1):
    for j in range(1,d+1):
        d1=j%10
        d10=j//10
        if d1*d10==i and d1>=2 and d10>=2:
            #print(i,j)
            count+=1
print(count)

Measured memory_bytes: 39408
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Contest.B
{
	static class Program
	{
		public static void Main(string[] args)
		{
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);

			var cin = new Scanner();

			int a = cin.NextInt();
			int b = cin.NextInt();
			string s = cin.Next();
			bool ok = true;
            for (int i = 0; i < a + b + 1; i++)
            {
				if (i != a && s[i] == '-') ok = false;
				if (i == a && s[i] != '-') ok = false;
            }
            if (ok) Console.WriteLine("Yes");
            else Console.WriteLine("No");

			Console.Out.Flush();
		}
	}

	class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int NextInt()
		{
			return int.Parse(Next());
		}

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextInt() + add;
			}
			return Array;
		}

		public long NextLong()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextLong() + add;
			}
			return Array;
		}

		public double NextDouble()
		{
			return double.Parse(Next());
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++)
			{
				Array[i] = NextDouble() + add;
			}
			return Array;
		}
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <limits>
#include <iomanip>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
	int x, y, z;
	cin >> x >> y >> z;

	printf("%d %d %d", z, x, y);
	return 0;
}

Measured memory_bytes: 3748
using System;
using System.IO;

namespace AOJ.intro
{
    namespace ITP_1_5_C
    {
        static public class PrintAChessBoard
        {
            static public void Main(){
                var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };

                while (true)
                {
                    var input = Console.ReadLine().Split(' ');
                    var h = int.Parse(input[0]);
                    var w = int.Parse(input[1]);

                    if (h == 0) break;
                    for (var i = 1; i <= h; i++)
                    {
                        for (var j = 1; j <= w; j++)
                        {
                            sw.Write((i + j) % 2 == 0 ? '#' : '.');
                        }
                        sw.WriteLine();
                    }
                    sw.WriteLine();
                }
                sw.Flush();
            }
        }
    }
}



Measured memory_bytes: 9008
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<utility>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define MOD 1000000007;

int main(){
	int n;
	cin >> n;
	vector<tuple<int, int, int> > p;
	for(int i=0; i<n; i++){
		int x, y, h;
		cin >> x >> y >> h;
		p.emplace_back(x, y, h);
	}
	sort(p.begin(), p.end(), [](tuple<int, int, int> a, tuple<int, int, int> b){
		return get<2>(a) > get<2>(b);
	});
	int x, y, h;
	for(x=0; x<=100; x++){
		bool flag;
		for(y=0; y<=100; y++){
			flag=true;
			h = get<2>(p[0])+abs(x-get<0>(p[0]))+abs(y-get<1>(p[0]));
			for(int i=1; i<n; i++){
			if(max(h-abs(x-get<0>(p[i]))-abs(y-get<1>(p[i])), 0) != get<2>(p[i])){
					flag=false;
					break;
				}
			}
			if(flag)
				break;
		}
		if(flag)
			break;
	}
	cout << x << ' ' << y << ' ' << h << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll i = (m); i < (n); ++i)
#define REPN(i, m, n) for(ll i = (m); i <= (n); ++i)
#define REPR(i, m, n) for(ll i = (m)-1; i >= (n); --i)
#define REPNR(i, m, n) for(ll i = (m); i >= (n); --i)
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
// constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll n;
	cin >> n;
	Vec a(n);
	rep(i, n) cin >> a[i];

	sort(all(a));
	reverse(all(a));
	ll ans = 0, r = n - 1;
	rep(i, n - 1){
		if (r == 0) break;
		if(i == 0){
			ans += a[i];
			r--;
		}else{
			ans += a[i] * min(r, 2LL);
			r -= min(r, 2LL);
		}
	}
	co(ans);

	return 0;
}


Measured memory_bytes: 4840
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  for(int i=s.size()-1; i >=1; i--){
    if(i % 2==0){
      int mid = i / 2;
      string a = s.substr(0, mid);
      string b = s.substr(mid, mid);
      if(a==b){
        cout << i << endl;
        return 0;
      }

    }
  }
}

Measured memory_bytes: 256
e=enumerate
n,*a=map(int,open(0).read().split())
d=[0]
for j,(a,i)in e(sorted((a,i)for i,a in e(a))[::-1]):d=[d[0]+a*(~i-j+n)]+[max(d[k+1]+a*(n+k-i-j),d[k]+a*abs(i-k))for k in range(j)]+[d[j]+a*abs(i-j)]
print(max(d))

Measured memory_bytes: 9676
H,W=map(int,input().split())
N=int(input())
a=list(map(int,input().split()))
c=[[0 for i in range(0,W)] for i in range(0,H)]
grid=(0,0)
for i in range(0,N):
    color=i+1
    for j in range(0,a[i]):
        h,w=grid
        c[h][w]=color
        if W-1>w and h%2==0:
            grid=(h,w+1)
        if w>0 and h%2==1:
            grid=(h,w-1)
        if h%2==0 and w==W-1:
            grid=(h+1,W-1)
        if h%2==1 and w==0:
            grid=(h+1,0)

for i in range(0,H):
    print(*c[i])

Measured memory_bytes: 43248
#include <stdio.h>


int main(){
	int a,b,c,count;
	while(scanf("%d%d",&a,&b) != EOF){
		count = 1;
		c = a + b;
		while(c /10 > 0){
			count += 1;
			c /= 10;
		}
		printf("%d\n",count);
	}
	return 0;
}

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

long long sum;

int main() {
  int N, K;
  cin >> N >> K;
  sum += pow(((int)(N/K)), 3);
  if(K % 2 == 0 && N - K/2 >= 0) {
    sum += pow((int)((N - K/2) / K) + 1, 3);
  }
  cout << sum << endl;
  return 0;
}



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

bool student[31];
int main()
{
  for(int i = 0; i < 28; i++){
    int in;
    cin >> in;
    student[in] = true;
  }

  for(int i = 1; i <= 30; i++)
    if(!student[i])
      cout << i << endl;

  return 0;
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] strArray = br.readLine().split(" ");
		
		int[] input = new int [4];
		
		for(int i = 0; i < 4; i++){
			input[i] = Integer.parseInt(strArray[i]);
		}
		
		int on = Math.max(input[0], input[2]);
		int off = Math.min(input[1], input[3]);
//		System.out.println("on "+on+" off "+off);
		
		System.out.println(Math.max(off-on, 0));
	}

}


Measured memory_bytes: 22612
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

S = 0
for i in range(N):
	j = A[i]-1
	S += B[j]
	if i < N-1 and A[i+1] == A[i]+1:
		S += C[j]

print(S)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
int main(){
    ll n,k;cin>>n>>k;

    ll a,ans=0;

    for(a=1;a<=n;a++){
        ans+=(n/a)*max(a-k,0LL);
        ans+=max(n%a+1-k,0LL);
    }

    if(k==0){ans-=n;}//k==0のときは0をaにつき一回余分に数えている

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

	int n;
	cin>>n;
	string s;
	cin>>s;

	int cr=0,cw=0;
	for(int i=0;i<n;i++){
		if(s[i] == 'W')
			++cw;
		else
			++cr;
	}

	int cnt = 0;
	for(int i=0;i<cr;i++){
		if(s[i] != 'R')
			++cnt;
	}

	cout<<cnt<<"\n";
}

Measured memory_bytes: 3732
#include <stdio.h>
#include <stdlib.h>
#define int long long

int digit_sum(int N){
	if(N < 0){
		return 0;
	}
	int ans;
	for(ans = 0; N > 0; N /= 10){
		ans += N % 10;
	}
	return ans;
}

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, i, ans;
	scanf("%lld", &N);
	ans = digit_sum(N);
	for(i = 1; N > 0; i *= 10){
//		printf("i = %lld\n", i);
		while((N / i) % 10 != 9 && N > 0){
//			printf("N = %lld\n", N);
			N -= i;
		}
		ans = max(ans, digit_sum(N));
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int>l(n);
    for(int i=0;i<n;i++)
    {
        cin>>l[i];
    }
    int sum=0;
    for(int i=0;i<l.size();i++)
    {
        sum+=l[i];
    }
    bool no=false;
    for(int i=0;i<l.size();i++)
    {
        if(sum<=2*l[i]){
            no=true;
            break;
        }
    }
    if(no){
        cout<<"No\n";
    }
    else{
        cout<<"Yes\n";
    }
}

Measured memory_bytes: 3596
def get_yen(x, u):
    if u == 'BTC':
        return x * 380000.0
    else:
        #uがyenの場合
        return x

N = int(input())
X = [0] * N
U = [0] * N
for i in range(N):
    x, u = input().split()
    X[i] = float(x)
    U[i] = str(u)

sum = 0
for x, u in zip(X, U):
    sum = sum + get_yen(x, u)

print(sum)


Measured memory_bytes: 3060
/* 
   *********************************************************
    Code_Blooded Human == @{{ samrat_12   [  0_0  ^_^  ] }}
   *********************************************************
*/
#include <bits/stdc++.h>
#include<algorithm>
#include<queue>
#include<list>
#include<map>
#include <math.h>
#include<numeric>
using namespace std;
using i1=int;
#define E "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  ipfile    ifstream cin ("input.txt");std::cin.rdbuf(std::cin.rdbuf())
#define pb(x) push_back(x);
#define ll long long int
#define ull unsigned long long int
#define db long double
#define mod 1000000007
#define vll vector<ll>
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define REVVEC(v) reverse(v.begin(),v.end())
#define REVARR(a) reverse(a,a+n)
#define maxc(v) max_element(all(v))
#define minc(v) min_element(all(v))
#define inputarr(a,n) for(int xxx=0;xxx<n;++xxx) cin>>a[xxx]
#define outputarr(a,n) for(int xxx=0;xxx<n;xxx++) cout<<a[xxx]<<" "
#define rep(i,m, n)    for(int i = m; i < (n); ++i)
#define sp setprecison(10)
int main() {
    FAST
    int a;string b;
    cin>>a>>b;
    if(a<3200)
    cout<<"red\n";
    else
    cout<<b<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  map <string, int> mp;
  mp["MON"] = 1;
  mp["TUE"] = 2;
  mp["WED"] = 3;
  mp["THU"] = 4;
  mp["FRI"] = 5;
  mp["SAT"] = 6;
  mp["SUN"] = 7;
  string s;
  cin >> s;
  cout << 7 - (mp[s] == 7 ? 0 : mp[s]) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e5+5,INF = 1e18;

ll power(ll a,ll b)
{
    a = a%mod;
    ll result = 1;

    while(b)
    {
        if(b&1)
            result = (result*a)%mod;
        b >>= 1, a = (a*a)%mod;
    }
    return result;
} 

bool cmp(P(P(string,int),int) p1,P(P(string,int),int) p2)
{
    if(p1.fi.fi == p2.fi.fi)
        return p1.fi.se > p2.fi.se;
    return p1.fi.fi < p2.fi.fi;
}

int main() 
{ 
    BOOST

    int n;
    cin>>n;
    P(P(string,int),int) p[n];
    for(int i=0;i<n;i++)
    {
        cin>>p[i].fi.fi>>p[i].fi.se;
        p[i].se = i+1 ;
    }

    sort(p,p+n,cmp);

    for(auto i : p)
    {
        cout<<i.se<<"\n";
    }
    return 0;    
} 

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

int main() {
  string s;
  cin >> s;
  int r = 0,b = 0;
  for(int i = 00;i < s.size();i++){
    if(s[i] == '0') r++;
    else b++;
  }
  cout << min(r,b)*2 << endl;
}


Measured memory_bytes: 512
n = int(input())

dp = [n] * 110000
dp[0] = 0

for i in range(n):
    j = 0
    while i + 6 ** j <= n:
        dp[i+6**j] = min(dp[i+6**j], dp[i]+1)
        j += 1
    k = 0
    while i + 9 ** k <= n:
        dp[i+9**k] = min(dp[i+9**k], dp[i]+1)
        k += 1

print(dp[n])

Measured memory_bytes: 42604
#include<iostream>
#include<cstdio>
using namespace std;
const int N=2005;
const int MOD=1000000007;
long long n,k;
long long v[N][N];
int main()
{
    scanf("%lld%lld",&n,&k);
    v[0][0]=1;
    for(int i=1;i<=n;i++)
	{
        v[i][0]=1;
        for(int j=1;j<=i;j++)
            v[i][j]=(v[i-1][j-1]+v[i-1][j])%MOD;
    }
    for(int i=1;i<=k;i++)
        printf("%lld\n",v[n-k+1][i]*v[k-1][i-1]%MOD);
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pairInt;
#define FOR(i, n) for (int i = 0; i < int(n); i++)
#define FOR1(i, m, n) for (int i = int(m); i < int(n); i++)
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))

struct Node {
  Node* parent = nullptr;
  set<Node*> children;

  Node* get_root() {
    if (this->parent == nullptr) {
      return this;
    }

    return parent->get_root();
  }

  bool same(Node* node) {
    if (node == nullptr) {
      return false;
    }
    return this->get_root() == node->get_root();
  }

  void add_child(Node* child) {
    if (child == nullptr ||
        this->get_root() == child->get_root()) {
      return;
    }

    Node* root = child->get_root();
    this->children.insert(root);
    root->parent = this;
  }
};

int main(int argc, char *argv[])
{
  int n, q;
  vector<Node> nodes;

  cin >> n >> q;
  nodes.resize(n);

  FOR(i, q) {
    int c, x, y;

    cin >> c >> x >> y;

    if (c == 0) {
      nodes[x].get_root()->add_child(&nodes[y]);
    } else {
      if (nodes[x].same(&nodes[y]))
        cout << 1 << endl;
      else
        cout << 0 << endl;
    }
  }
  
  return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

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

  int a, b, c;
  while (cin >> a >> b >> c) {
    cout << ((a <= c && c <= b) ? "Yes" : "No") << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<stack>
#include<queue>
#include<vector>
using namespace std;
const int INF = 2000000005;
vector<bool> v;
vector<int> wtoe, etow;
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'W') v.push_back(true);
		else v.push_back(false);
	}
	wtoe.push_back(0);
	etow.push_back(0);
	for (int i = 0; i < n; i++) {
		int j = n - (i + 1);
		if (i > 0) {
			if (v[i - 1]) wtoe.push_back(wtoe[i - 1] + 1);
			else wtoe.push_back(wtoe[i - 1]);
		}
		if (j < n - 1) {
			if (v[j + 1]) etow.push_back(etow[i-1]);
			else etow.push_back(etow[i - 1] + 1);
		}
	}
	int ans = INF;
	for (int i = 0; i < n; i++) {
		//cout << wtoe[i] << " " << etow[n - (i + 1)] << endl;
		int kans = wtoe[i] + etow[n - (i + 1)];
		ans = min(kans, ans);
	}
	cout << ans << endl;
	return 0;
}

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

const int maxn = 1e5+5;
int N, a[maxn];
int dp[maxn];

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (int i = 1; i <= N; i++) cin >> a[i];
    for (int i = N - 1; i >= 1; i--) {
        if (i == N - 1) dp[i] = abs(a[i] - a[i+1]);
        else {
            dp[i] = min(abs(a[i]-a[i+1]) + dp[i+1],
                        abs(a[i]-a[i+2]) + dp[i+2]);
        }
    }
    cout << dp[1] << '\n';


    return 0;
}



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

long long prime_factorize(long long N) {
    long long ansa=1;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        ansa *= (ex + 1);
    }

    // 最後に残った数について
    if (N != 1) ansa *= 2;
    return ansa;
}

int main() {
  long long N;
  cin>>N;
  long long M=N;
  int ans;
  int ansans=0;
  rep(i,N-1){
    M -= 1;
    
    ans = prime_factorize(M);
    ansans += ans;
  }  
  cout<<ansans<<endl;
}

Measured memory_bytes: 3632
n = int(input())

ans = [0]*10001
a = [1,1,1]

while (a[0]+1)**2 <= n-2:
    a[1]=1
    while (a[1]+a[0])*(a[1]+1)+a[0]**2<=n-1:
        a[2]=1
        while a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0] <= n:
            ans[a[0]**2+a[1]**2+a[2]**2+a[0]*a[1]+a[1]*a[2]+a[2]*a[0]] += 1
            a[2] += 1
        a[1]+=1
    a[0]+=1
for i in range(1,n+1):
    print(ans[i])




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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> to(n);
    vector<vector<int>> weight(n);
    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >>c;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
        weight[a].push_back(c);
        weight[b].push_back(c);
    }
    int q,k;
    cin >> q >> k;
    k--;
    vector<ll> dist(n,0);
    vector<int> visited(n,0);

    queue<P> qu;
    P p(k,0);
    qu.push(p);

    while(!qu.empty()){
        P p;
        p = qu.front();
        qu.pop();
        visited[p.first]=1;
        dist[p.first]=p.second;
        rep(i,to[p.first].size()){
            if(visited[to[p.first][i]]==0){
                P q;
                q.first = to[p.first][i];
                q.second = p.second + weight[p.first][i];
                qu.push(q);
            }
        }
    }


    rep(i,q){
        int x,y;
        cin >> x >> y;
        x--; y--;
        cout << dist[x]+dist[y] << endl;
    }
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int n;
    cin >> n;
    vector<vector<int>> graph(n);
    rep(i,0,n-1){
        int a,b;
        cin >> a >> b;
        --a;
        --b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }                                                                                                                                                                                                                        

    function<int(int,int)> rec=[&](int u,int p){
        int count[32]={},mask=0;
        for(int v:graph[u]){
            if(v==p) continue;
            int tmp=rec(v,u);
            mask|=tmp;
            rep(i,0,32) if((tmp>>i)&1) ++count[i];
        }
        int low=0;
        for(int i=31; i>=0; --i) if(count[i]>=2){
            low=i+1;
            break;
        }
        rep(i,low,32) if(!count[i]) return ((mask>>(i+1))<<(i+1))|(1<<i);
    };

    int tmp=rec(0,-1);
    for(int i=31; i>=0; --i) if((tmp>>i)&1){
        cout << i << endl;
        return;
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 21760
#include <bits/stdc++.h>
using namespace std;
//
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mx 100010
#define pi acos(-1)
#define endl '\n'
#define Fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0)
//
int main()
{
    char ch[3][3];

    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> ch[i][j];
        }
    }
    cout << ch[0][0] << ch[1][1] << ch[2][2] << endl;
}


Measured memory_bytes: 3504
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define pb push_back
#define mp make_pair
#define ll long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
#define M 1000000007
#define MM 998244353
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
#define r2 1.41421356237
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  //testcase {
  int k;
  cin>>k;
  string s="ACL";
  while(k--) { cout<<s; }
  //}
  return 0;
}

Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
        private static int s_maxWater;
        private static int s_maxSugar;
        private static double s_maxDensity = double.MinValue;
        static void SolveA()
        {
            string s = Console.ReadLine();
            var sb = new StringBuilder(s.Length);
            for(int i=0;i<s.Length;i+=2)
            {
                sb.Append(s[i]);
            }
            Console.WriteLine(sb.ToString());
        }

        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 11744
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    vector<string> c(3);
    rep(i, 3) cin >> c[i];
    rep(i, 3) cout << c[i][i];
    cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    int X[N], Y[N];
    rep(i,N){
        cin>>X[i]>>Y[i];
        if(X[i]>Y[i]) swap(X[i],Y[i]);
    }
    
    // 全てのボールの最小値、最大値
    int all_min=*min_element(X,X+N);
    int all_max=*max_element(Y,Y+N);
    
    // 赤の最大値を最小に、青の最小値を最大に
    int Rmax=all_min, Bmin=all_max;
    rep(i,N){
        Rmax=max(Rmax,X[i]);
        Bmin=min(Bmin,Y[i]);
    }
    
    // 赤が全ボール最小値、青が全ボール最大値を取った時の最小値
    ll ret=1LL*(Rmax-all_min)*(all_max-Bmin);
    
    // 赤が全ボール最大値、最小値共に取った時、青の最大最小幅を最小にする
    vector<pii> vs(N);
    rep(i,N){
        vs[i].first=X[i];
        vs[i].second=Y[i];
    }
    
    sort(all(vs));
    int dif=all_max-all_min;
    int Bmax = vs.back().first; Bmin=all_max;
    
    rep(i,N){
        ret = min( ret, 1LL*dif*(Bmax-min(Bmin,vs[i].first)));
        if(Bmin>vs[i].second) Bmin=vs[i].second;
        if(Bmax<vs[i].second) Bmax=vs[i].second;
    }
    cout1(ret)
}

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

using namespace std;

#define MAX 1000001
using ull = unsigned long long;
using P = tuple<int, int, int>;

const ull b = 1000000007ULL;

vector<ull> rolling_hash(char* S, int N, vector<ull>& p)
{
    vector<ull> h(N + 1);
    for (int i = 0; i < N; i++) {
        h[i + 1] = h[i] * b + S[i];
        p[i + 1] = p[i] * b;
    }
    return h;
}

int main()
{
    char S[MAX];
    scanf("%s", S);
    
    int N = strlen(S);
    vector<ull> p(N + 1);
    p[0] = 1;
    
    bool found = 0;
    auto h = rolling_hash(S, N, p);    
    
    vector<P> v;
    for (int i = 0; i < N; i++) {
        int A = i + 1;
        int B = (N - 3 * A) / 2;

        if (B <= 0) continue;
        if ((N - 3 * A) % 2 != 0) continue;

        auto A1 = h[A] - h[0] * p[A];
        auto B1 = h[A + B] - h[A] * p[B];
        auto A2 = h[A * 2 + B] - h[A + B] * p[A];
        auto B2 = h[2 * (A + B)] - h[A * 2 + B] * p[B];
        auto A3 = h[N] - h[2 * (A + B)] * p[A];

        if (A1 == A2 && A2 == A3 && B1 == B2) {
            found = 1;
            v.emplace_back(A + B, A, B);
        }
    }

    sort(v.begin(), v.end());
    
    if (!found) {
        printf("mitomerarenaiWA\n");
    } else {
        printf("Love ");
        int size = get<0>(v[0]);
        for (int i = 0; i < size; i++) {
            printf("%c", S[i]);
        }
        printf("!\n");
    }        
    return 0;
}

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

int main(){
  int n;
  int ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++){
    string s = to_string(i);
    if(s.size() % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringJoiner;
import java.util.StringTokenizer;
import java.util.function.IntUnaryOperator;
import java.util.function.LongUnaryOperator;

class Main {
    static In in = new In();
    static Out out = new Out();
    static long mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int n = in.nextInt();
        long min = inf;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int p = in.nextInt();
            min = Math.min(min, p);
            if (min >= p) {
                count++;
            }
        }
        out.println(count);
    }

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

class In {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

    int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    int[] nextIntArray(int n, IntUnaryOperator op) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsInt(nextInt());
        }
        return a;
    }

    long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextLong();
        }
        return a;
    }

    long[] nextLongArray(int n, LongUnaryOperator op) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = op.applyAsLong(nextLong());
        }
        return a;
    }
}

class Out {
    private static PrintWriter out = new PrintWriter(System.out);

    void println(Object... a) {
        StringJoiner joiner = new StringJoiner(" ");
        for (Object obj : a) {
            joiner.add(String.valueOf(obj));
        }
        out.println(joiner);
    }

    void flush() {
        out.flush();
    }
}


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

using namespace std;


int main() {
    string s;
    cin >> s;
    int cnt = 0;
    
    for (int i=0; i<3; i++){
        if(s[i] == '1') {
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
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(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;

int main(){
    int n;
    string s,t;
    cin >> n>> s >>t;
    REP(i,n){
        cout << s[i];
        cout << t[i];
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	string a, b, c;
	cin >> a >> b >> c;
	int ans = 0;
	rep(i, n) {
		if (a[i] == b[i] && a[i] == c[i]) continue;
		else if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) ans++;
		else ans += 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 13:11:09 2020

@author: shinba
"""
from collections import deque

n = int(input())

reverse = False

B = deque([])

for i in map(int,input().split()):
    if not reverse:
        B.append(i)
        reverse = True
    else:
        B.appendleft(i)
        reverse = False
        
if not reverse:
    print(" ".join(map(str,B)))
else:
    B.reverse()
    print(" ".join(map(str,B)))


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

int a,b,c,d,gede;
int main(){
d=0;
cin>>a>>b>>c;
if(c>b){
	d =c-(a+b);
}else{
	d=b-(c+a);
}
if(d<=0){
	cout<<0<<endl;
}else{
	cout<<d<<endl;
}
}

Measured memory_bytes: 384
#include <stdio.h>
#include <math.h>

int main(void){
    double n, k;
    scanf("%lf %lf", &n, &k);
    int ans = (int)round(ceil(log(n)/log(k)));
    if(pow(k, ans)==n) ans++;
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int UF_MAX = 1000000;

class UF{
	int x[UF_MAX];
	int co;
	
public:
	
	UF(){
		fill(x,x+UF_MAX,-1);
		co = 0;
	}
	
	int boss(int a){
		int s = a;
		while(x[s] > -1) s = x[s];
		if(s != a) x[a] = s;
		return s;
	}
	
	void uni(int a , int b){
		int s = boss(a);
		int t = boss(b);
		if(s != t){
			++co;
			if(x[s] < x[t]){
				x[s] += x[t];
				x[t] = s;
			} else {
				x[t] += x[s];
				x[s] = t;
			}
		}
	}
	
	bool find(int a , int b){
		return boss(a) == boss(b);
	}
	
	int count(){
		return co;
	}
	
	int member(int a){
		return -x[boss(a)];
	}
}uf;

const int MC = 100010;
int N;
int x[MC],y[MC];
int a[MC],b[MC];
vector<P3> V;

int main(){
	scanf("%d" , &N);
	repp(i,0,N){
		scanf("%d%d" , x + i , y + i);
		a[i] = b[i] = i;
	}
	sort(a,a+N,[&](const int p , const int q){return x[p] < x[q];});
	sort(b,b+N,[&](const int p , const int q){return y[p] < y[q];});
	repp(i,1,N){
		V.PB(M3P(x[a[i]]-x[a[i-1]],a[i],a[i-1]));
		V.PB(M3P(y[b[i]]-y[b[i-1]],b[i],b[i-1]));
	}
	sort(V.begin(),V.end());
	LL ans = 0;
	for(auto z : V){
		if(uf.find(z.first.second,z.second)) continue;
		uf.uni(z.first.second,z.second);
		ans += z.first.first;
	}
	printf("%lld\n" , ans);
	return 0;
}


Measured memory_bytes: 10356
#include <iostream>
using namespace std;
int p[100005],par[100005];
int find(int x)
{
	if (par[x]!=x)
	par[x]=find(par[x]);
	return par[x];
}
void Union(int x,int y)
{
	x=find(x);
	y=find(y);
	if (x!=y)
	par[x]=y;
}
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++)
	scanf("%d",&p[i]),par[i]=i;
	while (m--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		Union(a,b);
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	ans+=(find(i)==find(p[i]));
	printf("%d",ans);
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;
    cin>>n;
    int arr[n];
    cin>>arr[0];
    int x=0;
    while (arr[0]%2==0){
        x++;
        arr[0]/=2;
    }int m=0;
    for (int i=1;i<n;i++){
        cin>>arr[i];
        m=0;
        while (arr[i]%2==0){
            m++;
            arr[i]/=2;
        }x=min(x,m);
    }cout<<x;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

int main(){
    vector<int> primes;
    bool isprime[200001];
    
    memset(isprime, true, sizeof(isprime));

    for(int i=2;i<200001;++i){
        if(isprime[i]){
            primes.push_back(i);
            for(int j=2;i*j<200001;++j){
                isprime[i*j] = false;
            }
        }
    }

    int N,P;
    while(cin >> N >> P){
        if(N == -1 && P == -1) break;
        vector<int> sums;
        vector<int>::iterator it,jt;
        it = upper_bound(primes.begin(), primes.end(), N);
        
        for(int i=0;i<100;++i){
            jt = it;
            for(int j=0;j<100;++j){
                sums.push_back((*it) + (*jt));
                ++jt;
            }
            ++it;
        }
        sort(sums.begin(), sums.end());
        cout << sums[P-1] << endl;
    }
}

Measured memory_bytes: 1304
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

int n, k;

int main()
{
	scanf("%d%d", &n, &k);
	
	int count = 0;
	if (n == 0)
		count++;
		
	while (n > 0) {
		count++;
		n = n / k;
	}
	
	printf("%d\n", count);
	
	
	return 0;
}

Measured memory_bytes: 128
A,B,C = map(int, input().split())

def all_even(a,b,c):
	if a%2 == 0 and b%2 == 0 and c%2 == 0:
		return True
	else:
		return False

cnt = 0

while all_even(A,B,C):
	if A == B == C:
		cnt = -1
		break
	cnt+=1
	A,B,C = (B+C)//2, (A+C)//2, (A+B)//2
	
print(cnt)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int X = sc.nextInt();
		int t= sc.nextInt();
		//計算
		
		int result = X - t*1;
		if (result>=0){
			 System.out.println(result);	
		}else if (result <0){
			 System.out.println(0);
		}
	
	    
		
		
	}
}

Measured memory_bytes: 21204
import sys
f = sys.stdin


index = [[0,1,2,3],
         [1,0,3,2],
         [2,3,0,1],
         [3,2,1,0]]
sign = [[1, 1, 1, 1],
        [1,-1, 1,-1],
        [1,-1,-1, 1],
        [1, 1,-1,-1]]
while True:    
    n = int(f.readline())
    if n == 0:
        break
    for _ in range(n):
        ab = list(map(int, f.readline().split()))
        ret = [0] * 4
        for i, a in enumerate(ab[:4]):
            for j, b in enumerate(ab[4:]):
                ret[index[i][j]] += sign[i][j] * a * b
        print(*ret)

Measured memory_bytes: 6732
N = int(input())
A = []
B = []
for n in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N%2==1:
    print (B[N//2]-A[N//2]+1)
else:
    b = B[N//2]+B[N//2-1]
    a = A[N//2]+A[N//2-1]
    print (b-a+1)

Measured memory_bytes: 98976