akhauriyash/Code-Regression huggingface dataset:
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    int N = 0;
    cin(N);

    vint L(N);
    REP(i,N) cin(L[i]);


    //本文
    ll ans = 0;
    for(int i = 0;i < N; i++){
        for(int j = i+1; j < N; j++){
            for(int k = j+1; k < N; k++){
                if(L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i]){
                    int len = L[i] + L[j] + L[k];
                    int ma  = max(L[i], max(L[j],L[k]));
                    int rest = len -ma;
                    if(ma < rest) ans++;
                }
            }
        }
    }
    //出力
    cout << ans << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3664
def is_prime(n):

    if n == 2:
        return True
    elif n < 2 or n & 1 == 0:
        return False
    for i in range(3, int(n**0.5) + 1, 2):
        if n % i == 0:
            return False
    return True

N = int(input())
cnt = 0
for i in range(N):
    e = int(input())
    if is_prime(e):
        cnt += 1
print(cnt)



Measured memory_bytes: 5672
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] dp = new int[n];
		int[] h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		dp[0] = 0;
		dp[1] = Math.abs(h[0]-h[1]);
		for(int i = 2; i < n; i++) {
			dp[i] =
			Math.min(dp[i-1]+Math.abs(h[i]-h[i-1]), dp[i-2]+Math.abs(h[i]-h[i-2]));
		}
		System.out.println(dp[n-1]);
		sc.close();
	}
}

Measured memory_bytes: 61016
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<utility>
#include<list>
#include<algorithm>
#include <ctype.h>
#include<deque>
using namespace std;
using ll = long long int;

int n, m;
vector<pair<int, int>> req;

bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
	return a.second < b.second;
}

int main(void) {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int ai, bi;
		cin >> ai >> bi;
		req.emplace_back(ai, bi);
	}
	sort(req.begin(), req.end(), cmp);
	int ret = 1;
	int tmp = req[0].second - 1;
	for (int i = 1; i < m; i++) {
		int ai = req[i].first, bi = req[i].second;
		if (ai <= tmp && tmp < bi) {
			continue;
		}
		tmp = bi - 1;
		ret++;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

int a,b,c,d;

int main(){
	cin >> a >> b >> c >> d;
	cout << min(a,b) + min(c,d) << endl;
}

Measured memory_bytes: 256
import math
from decimal import Decimal
a, b, c = map(int, input().split())
A = Decimal(str(a))**Decimal('0.5')
B = Decimal(str(b))**Decimal('0.5')
C = Decimal(str(c))**Decimal('0.5')
if A + B < C:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 5076
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 1e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int n;
vector <int> G[N];
int dp[N][2]; // 0 : black 1 : white
inline void add(int &x, int y) { x += y; if(x>=mod) x -= mod; }
inline int mul(int x, int y) { return 1ll*x*y%mod; }
void dfs(int u, int fa)
{
	dp[u][0] = dp[u][1] = 1;
	for(int v : G[u])
	{
		if(v==fa) continue;
		dfs(v, u);
		dp[u][0] = 1ll*dp[u][0]*dp[v][1]%mod;
		dp[u][1] = 1ll*dp[u][1]*((dp[v][0]+dp[v][1])%mod)%mod;
	}
}
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> n;
 	for(int i=1; i<n; i++)
 	{
 		int u, v;
 		cin >> u >> v;
 		G[u].pb(v);
 		G[v].pb(u);
 	}
 	dfs(1, 0);
 	int ans = 0;
 	add(ans, dp[1][0]); add(ans, dp[1][1]);
 	cout << ans;
	return 0;
}


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

using namespace std;

string str;
int pos;
int P, Q, R;

int formula() {
  pos ++;
  if(str[pos] == '(') {
    int f = formula();
    pos ++;
    if(str[pos] == '+') f = max(f, formula());
    if(str[pos] == '*') f = min(f, formula());
    pos ++;
    return f;
  }
  
  if(str[pos] == '-') return 2-formula();
  if(str[pos] == '0') return 0;
  if(str[pos] == '1') return 1;
  if(str[pos] == '2') return 2;
  if(str[pos] == 'P') return P;
  if(str[pos] == 'Q') return Q;
  if(str[pos] == 'R') return R;
  
}

int main() {
  
  while(cin >> str) {
    if(str == ".") break;
    int cnt = 0;
    for(P = 0; P<=2; P++)
      for(Q = 0; Q<=2; Q++)
	for(R = 0; R<=2; R++) {
	  pos = -1;
	  cnt += formula() == 2;
	}
    cout << cnt << endl;
  }
  

  return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct mint {
    ll x;
    mint(ll x=0):x((x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    bool operator==(const mint a){
        return (x == a.x);
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
mint pow2(mint x, ll t) {return x.pow(t);}
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// 2項係数を求める
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < MOD);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};

//nが非常に大きく、aが小さい場合
mint choose(int n, int a){
    mint x = 1, y = 1;
    rep(i,a){
        x *= n-i;
        y *= i+1;
    }
    return x/y;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;

    mint ans = pow2(10,N);
    ans -= pow2(9,N)*2;
    ans += pow2(8,N);
    cout << ans << endl;    
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    int n, k; cin >> n >> k;
    VI a(n); rep(i, n) cin >> a[i];
    rep(i, n-k){
        bool f = (a[i] < a[k+i]);
        cout << (f?"Yes":"No") << endl;
    }
    return 0;
}

Measured memory_bytes: 4780
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K = map(int, readline().split())

    ans = pow(N // K, 3)
    if K % 2 == 0:
        ans += pow((N + K // 2) // K, 3)

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61868
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m, k;
    cin >> n >> m >> k;
    bool can = false;
    for(int x = 0; x <= n && !can; x++) {
        for(int y = 0; y <= m && !can; y++) {
            can |= m * x + n * y - 2 * x * y == k;
        }
    }
    cout << (can ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#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 all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

const ll MAX_V = 210;

class MaxFlow {
public:

    struct edge {
        ll to;
        ll cap, rev;
    };

    vector<edge> G[MAX_V];
    bool used[MAX_V];

    void add_edge(ll from, ll to, ll cap) {
        G[from].push_back((edge){to, cap, (ll) G[to].size()});
        G[to].push_back((edge){from, 0, (ll) G[from].size() - 1});
    }

    ll dfs(ll v, ll t, ll f) {
        if (v == t) return f;
        used[v] = true;
        for (auto&& e : G[v]) {
            if (!used[e.to] && e.cap > 0) {
                ll d = dfs(e.to, t, min(f, e.cap));
                if (d > 0) {
                    e.cap -= d;
                    G[e.to][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    ll max_flow(ll s, ll t) { //sからtへの最大流
        ll flow = 0;
        while (1) {
            rep(i, MAX_V) used[i] = false;
            ll f = dfs(s, t, INF);
            if (f == 0) return flow;
            flow += f;
        }
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);

    int n;
    cin >> n;
    int a[100], b[100], c[100], d[100];
    rep(i, n) cin >> a[i] >> b[i];
    rep(i, n) cin >> c[i] >> d[i];

    MaxFlow mf;

    rep(i, n) rep(j, n) {
        if (a[i] < c[j] && b[i] < d[j]) mf.add_edge(i, j + 100, 1);
    }

    rep(i, n) {
        mf.add_edge(201, i, 1);
        mf.add_edge(i + 100, 202, 1);
    }

    cout << mf.max_flow(201, 202) << endl;
    return 0;
}


Measured memory_bytes: 892
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>
using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> P1;
typedef long long int ll;

//define
#define INF 1e9
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))

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

	VI h(n);
	rep(i, n) cin >> h[i];
	sort(all(h));

	int sa,minv=INF;
	for (int i = 0; i <= n - k; i++) {
		sa = h[i + k-1] - h[i];
		
		chmin(minv, sa);
	}
	cout << minv << endl;


}

Measured memory_bytes: 640
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input_text = scanner.nextLine();
        String[] data = input_text.split(" ");
        if(data[0].equals(data[1]) && data[0].equals(data[2])) {
            System.out.println("No");
        } else if (data[0].equals(data[1]) && !data[0].equals(data[2])) {
            System.out.println("Yes");
        } else if (data[0].equals(data[2]) && !data[0].equals(data[1])) {
            System.out.println("Yes");
        } else if (data[1].equals(data[2]) && !data[0].equals(data[1])) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        scanner.close();
    }

}

Measured memory_bytes: 21972
// -*- mode: cpp; coding=utf-8-unix; -*-
// vim: filetype=cpp fileencoding=utf-8 fileformat=unix
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <list>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <sstream>
#include <string.h>
// #include <limits.h>

#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define INTMAX  99999999

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

int N;
int A[100000];

int gcd(int a, int b)
{
	if (a>b) {
		int tmp = b;
		b = a;
		a = tmp;
	}
	if (a==0) {
		return b;
	}
	int res = 1;
	while(true) {
		int r = b%a;
		// int q = b/a;
		if (r==0) {
			res = a;
			break;
		}
		b = a;
		a = r;
	}
	return res;
}

#define MAXN 100000

int L[MAXN+2];
int R[MAXN+2];

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);
	cin >> N;
	for (int n=0; n<N; n++) {
		cin >> A[n];
	}
	L[0] = A[0];
	R[N-1] = A[N-1];
	// L[1] = A[0];
	for (int n=1; n<N; n++) {
		L[n] = gcd(L[n-1],A[n]);
	}
	// R[N-1] = A[N-1];
	for (int n=N-2; n>=0; n--) {
		R[n] = gcd(R[n+1], A[n]);
		// cout << "R["<<n+1<<"]="<<R[n+1]<<",A["<<n<<"]="<<A[n]<<" => R["<<n<<"]="<<R[n]<< endl;
	}
	int res = 0;

	for(int n=0; n<N; n++) {
		int c = 0;
		if(n==0) {
			c = R[n+1];
		}
		else if(n==N-1) {
			c = L[n-1];
		}
		else {
			c = gcd(L[n-1],R[n+1]);
		}
		if (c>res) {
			res = c;
		}
	}
	cout << res << endl;
	return 0;
}



Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>

using namespace std;

template <class T>
struct BIT {
  std::vector<T> bit;
  BIT(int n) : bit(n+1, 0) {}
  void add(int x, const T &w) {
    for (int i = x; i < bit.size()-1; i |= (i+1)) {
      bit[i] += w;
    }
  }
  T sum(int r) {
    T ret = 0;
    for (int i = r-1; i >= 0; i = (i & (i+1)) - 1) {
      ret += bit[i];
    }
    return ret;
  }
  T sum(int l, int r) { return sum(r) - sum(l); }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;

  int n, k; cin >> n >> k;
  BIT<double> tree(n);
  for (int i = 0; i < n; i++) {
    int p; cin >> p;
    tree.add(i, (1 + p) / 2.0);
  }
  double ans = 0.0;
  for (int i = 0; i + k <= n; i++) {
    ans = max(ans, tree.sum(i, i+k));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
from heapq import *

class UnionFind:
    def __init__(self, n):
        '木の初期化をする'
        self.p = [-1] * n
        self.rank = [1]*n
    def find(self, x):
        'x の親を返す'
        if self.p[x] == -1:
            return x
        else:
            self.p[x] = self.find(self.p[x])
            return self.p[x]

    def unite(self, x, y):
        'rankの低い親を高い方のの親にする'
        if not self.same(x,y):
            x = self.find(x)
            y = self.find(y)
            if self.rank[x] > self.rank[y]:
                x,y = y,x
            elif self.rank[x] == self.rank[y]:
                self.rank[y] += 1
            self.p[x] = y
            return True
        else:
            return False

    def same(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int,input().split())
a = list(map(int,input().split()))
uf = UnionFind(n)
ans = 0
for i in range(m):
    x,y = map(int,input().split())
    uf.unite(x, y)
if n < 2*(n-m-1):
    print('Impossible')
    exit(0)
if m == n-1:
    print(0)
    exit(0)
tree = {}
pq = []
heapify(pq)
for i in range(n):
    p = uf.find(i)
    if not p in tree.keys():
        ans += a[i]
        tree[p] = a[i]
    else:
        if tree[p] <= a[i]:
            heappush(pq, a[i])
        else:
            ans += a[i] - tree[p]
            heappush(pq, tree[p])
            tree[p] = a[i]
l = len(tree)

for _ in range(2*(n-m-1) - l):
    ans += heappop(pq)
print(ans)


Measured memory_bytes: 16788
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int x, a;
	cin >> x >> a;
	if (x < a)
		cout << "0\n";
	else
		cout << "10\n";
	return 0;
}


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

int main()
{
    string S;
    cin>>S;
    list<char> L(S.begin(), S.end());
    int Q;
    cin>>Q;
    bool f = false;
    for (int q=0; q<Q; q++)
    {
        int T;
        cin>>T;
        if (T==1)
            f = !f;
        else
        {
            int F;
            char C;
            cin>>F>>C;
            if (!f && F==1 || f && F==2)
                L.push_front(C);
            else
                L.push_back(C);
        }
    }
    string ans(L.begin(), L.end());
    if (f)
        reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
}


Measured memory_bytes: 10304
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;


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



int main() {
    ll n;
    cin >> n;
    vector<string> s(n);
    REP(i, n) {
        cin >> s[i];
    }
    sort(s.begin(),s.end());
    ll ans = 0;
    string tmp = "";
    REP(i, n) {
        if(tmp != s[i]) {
            ans += 1;
            tmp = s[i];
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 9600
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100001;

vector<pair<int,int> > adj[N];

int memo[N];

struct State {
    int p;
    int cost;
    bool operator<(const State& st) const {
        return cost > st.cost;
    }
};

int main()
{
    int v, e, r;
    cin >> v >> e >> r;
    for (int i=0; i < e; ++i) {
        int s, t, d;
        cin >> s >> t >> d;
        adj[s].push_back(pair<int,int>(t, d));
    }

    fill(memo, memo+N, -1);

    priority_queue<State> q;
    State st;
    st.p = r;
    st.cost = 0;
    q.push(st);
    while (q.empty() == false) {
        State cur = q.top();
        q.pop();
        if (memo[cur.p] != -1) continue;
        memo[cur.p] = cur.cost;
        for (int i=0; i < adj[cur.p].size(); ++i) {
            State nx;
            nx.p = adj[cur.p][i].first;
            nx.cost = cur.cost + adj[cur.p][i].second;
            q.push(nx);
        }
    }

    for (int i=0; i < v; ++i) {
        if (memo[i] == -1) cout << "INF" << endl;
        else cout << memo[i] << endl;
    }

    return 0;
}

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

int main()
{
  int n;
  cin>>n;
  int alice =0;
  int bob = 0;
  vector<int> vec(n);
  for (int i =0; i< n; i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i<n; i++){
    if(n % 2 == 0){
      if (i % 2 == 1){
        alice += vec.at(i);
      } if (i % 2 == 0){
        bob += vec.at(i);
      }
    } if (n % 2 == 1){
      if (i % 2 == 1){
        bob += vec.at(i);
      } if (i % 2 == 0){
        alice += vec.at(i);
      }
    }
  }
  cout << alice - bob <<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
const int num = 1001;
int lg[num + 1][num + 1];
int main() {
	int w;
	string s, t;
	cin >> w;
	for (int i = 0; i < w; i++) {
		cin >> s;
		cin >> t;
		int n = s.size();
		int m = t.size();
		for (int i = 0; i < n; i++) lg[i][0] = 0;
		for (int i = 0; i < m; i++) lg[0][i] = 0;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++) {
				if (s[i] == t[j]) lg[i + 1][j + 1] = lg[i][j] + 1;
				else lg[i + 1][j + 1] = max(lg[i][j + 1], lg[i + 1][j]);
			}
		cout << lg[n][m] << endl;
	}
	return 0;
	/*int n, m;
	char s[num], t[num];
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> s[i];
	for (int i = 0; i < m; i++) cin >> t[i];
	for (int i = 0; i < n; i++) lg[i][0] = 0;
	for (int i = 0; i < m; i++) lg[0][i] = 0;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++) {
			if (s[i] == t[j]) lg[i + 1][j + 1] = lg[i][j] + 1;
			else lg[i + 1][j + 1] = max(lg[i][j + 1], lg[i + 1][j]);
		}
	cout << lg[n][m] << endl;
	return 0;*/
}

Measured memory_bytes: 7072
open System


[<EntryPoint>]
let main argv =
    let N =stdin.ReadLine()|>int
    [|for i in [0..25] do for j in [0..20] do yield (4*i+7*j)|]
    |>Seq.sumBy(fun c -> (if c=N then 1 else 0))
    |>fun c -> (if c>=1 then "Yes" else "No")
    |>stdout.WriteLine
    0

Measured memory_bytes: 13396
A,B,C = (int(x) for x in input().split())

if A % B == C:
    print("YES")
else:
    x = A % B
    i = 2
    word = "NO"
    while A*i % B != x:
        if  A*i % B == C:
            word = "YES"
            break
        i += 1
    print(word)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

int get_depth(long long a, long long n) {
        int d = 0;
        long long mul = 1, sum = 0;
        while (true) {
                sum += mul;
                if (a < sum) break;
                mul *= n;
                d ++;
        }
        return d;
}

int main() {
        long long n;
        int q;
        scanf("%lld%d", &n, &q);
        while (q --) {
                long long u, v;
                scanf("%lld%lld", &u, &v);
                u --, v --;
                if (n == 1) {
                        printf("%lld\n", min(u + 1, v + 1));
                        continue;
                }
                int ud = get_depth(u, n);
                int vd = get_depth(v, n);
                if (ud > vd) {
                        swap(u, v);
                        swap(ud, vd);
                }
                while (ud != vd) {
                        v = (v - 1) / n;
                        vd --;
                }
                while (u != v) {
                        u = (u - 1) / n;
                        v = (v - 1) / n;
                }                 
                printf("%lld\n", u + 1);
        }
        return 0;
}



Measured memory_bytes: 1280
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()


long long a, b, c, d, ans;

long long f(long long n, long long x){
	return n / x;
}

long long gcd(long long a, long long b){
	if(b == 0) return a;
	else return gcd(b, a%b);
}

long long lcm(long long a, long long b){
	return a*b/gcd(a,b);
}

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

	cin >> a >> b >> c >> d;
	ans = (b-a+1)- f(b,c) + f(a-1,c) - f(b,d) + f(a-1,d) + f(b,lcm(c,d))- f(a-1,lcm(c,d));
	cout << ans << endl;

  return 0;
}


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

int main() {
	
	int a, b;
	char op;


	for (int i = 1;; i++) {

		cin >> a >> op >> b;

		if (op == '?')break;

		switch (op) {

		case '+':
			cout << a + b << "\n";
			break;

		case '-':
			cout << a - b << "\n";
			break;

		case'*':
			cout << a*b << "\n";
			break;

		case '/':
			cout << a / b << "\n";
			break;

		default:
			cout << "Error\n";

		}
	}

	return 0;
}

Measured memory_bytes: 1164
N,L = map(int,input().split())
A=[L+i for i in range(N)]
sum = N*(L-1)+(int)(N*(N+1)/2)

eat = 0
tmpabs =101
for i in range(N):
    if abs(A[i])<tmpabs:
        tmpabs =abs(A[i])
        eat = i

print(sum-A[eat])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include<cstring>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int           long long
#define umapii        unordered_map<int,int>
#define ps(x,y)       fixed<<setprecision(y)<<x // sets precision upto required digits
#define arr(a,n)      int n;cin>>n;int a[n];for(int i=0;i<n;i++){cin>>a[i];}
#define outarr(a,n)   for(int i=0;i<n;i++){cout<<a[i]<<" ";}
#define mod           1000000007
#define ff            first
#define big           1e15
#define ss            second
#define add           push_back
#define remove        pop_back
#define mapii         map<int,int>
#define large         *max_element
#define small         *min_element
#define float         double
#define pqi           priority_queue<int>
#define mpqi          priority_queue<int,vector<int>,greater<int>>
#define in(n)         int n;cin>>n;
#define w(t)          int t;cin>>t;while(t--)
#define vi            vector<int>
#define vivi          vector<vector<int>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>pbds;




int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output3.txt", "w", stdout);
#endif

    unordered_map<string, int>m;
    w(t) {
        string s;
        cin >> s;
        m[s]++;
    }
    cout << "AC x " << m["AC"] << endl;
    cout << "WA x " << m["WA"] << endl;
    cout << "TLE x " << m["TLE"] << endl;
    cout << "RE x " << m["RE"] << endl;


}


Measured memory_bytes: 3632
/*input
1 0
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}


int main(){
	IOS;
	int n,k;
	cin>>n>>k;
	if(k>=(1<<n)){
		cout<<"-1\n";
		return 0;
	}
	if(n==1&&k==1){
		cout<<"-1\n";
		return 0;
	}
	if(n==1&&k==0){
		cout<<"0 0 1 1\n";
		return 0;
	}
	cout<<k<<' ';
	REP(i,1<<n) if(i!=k) cout<<i<<' ';
	cout<<k<<' ';
	for(int i=(1<<n)-1;i>=0;i--) if(i!=k) cout<<i<<' ';
	cout<<'\n';
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;

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

ll N, M;
string s;


void solve() {
    cin >> N;
    ll ans = 0;
    rep(i,N) {
        ll a;
        cin >> a;
        ll cnt = 0;
        while (a % 2 == 0) {
            a /= 2;
            cnt++;
        }
        ans += cnt;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 256
using System;

class ABC_124_B
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());

        int[] H = new int[N];

        string[] input = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++)
        {
            H[i] = int.Parse(input[i]);
        }

        int count = 0;
        for (int i = 0; i < N; i++)
        {
            bool b = true;
            for (int j = 0; j < i; j++)
            {
                if(H[i]<H[j])
                {
                    b = false;
                    break;
                }
            }
            if (b) count++;
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N, M;
    cin >> N >> M;
    int A[M], B[M], H[N];

    for (int i = 0; i < N; i++) {
        cin >> H[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    bool flag[N];
    fill(flag, flag + N, true);
    for (int i = 0; i < M; i++) {
        if (H[A[i]] == H[B[i]]) {
            flag[A[i]] = false;
            flag[B[i]] = false;
        } else if (H[A[i]] < H[B[i]]) {
            flag[A[i]] = false;
        } else {
            flag[B[i]] = false;
        }
    }
    int cnt = 0;
    for (bool b : flag) {
        if (b) cnt++;
    }
    cout << cnt << "\n";
    return 0;
}

Measured memory_bytes: 4888
#include<iostream>
#include<algorithm>
#include<cmath>
int main()
{
	int a = 0, b = 0, c = 0, ans = 1, rate[100] = {},last=0;
	std::cin >> a;
	
	bool okada=true;
	if (a >= 4) {
		for (int i = 2; i <= 32; i++) {
			ans = i;
			okada = true;
			if (okada) {
				for (int j = 2; j <= 10; j++) {

					if (ans*i <= a) {

						ans *= i;
						if (ans > last){
							last = ans;
					}
					}
					else {

						okada = false;
					}

				}
			}
		}
		std::cout << last << std::endl;
	}
	else {
		std::cout << 1 << std::endl;
	}
	
		
}







Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main()
{
	int n;
	cin >> n;
	ll a, b, pr;
	ll ans;
	for(int i = 1;i <= n; i++)
	{
		cin >> a >> b;
		pr = a * b;
		ll t = sqrt(pr);
		if(t * (t + 1) < pr)
			ans = t * 2 - 1;
		else if(t * t == pr)
		{
			if(a == b)
				ans = (t - 1) * 2;
			else
				ans = (t - 1) * 2 - 1;
		}
		else
			ans = (t - 1) * 2;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;

// N枚のカードがあり、2人のプレイヤーAlice,Bobがいる。
// 交互に一番大きい数のカードを取っていたとき、2人の点数差を出力する。
// >> 3
// >> 2 7 4
// 5
int main() {
    int AliceScore = 0;
    int BobScore = 0;
    int cardNum;
    cin >> cardNum;

    vector<int> cardValues(cardNum);

    for (int i = 0; i < cardNum; i++)
    {
        cin >> cardValues.at(i);
    }
    sort(cardValues.begin(),cardValues.end());
    reverse(cardValues.begin(),cardValues.end());

    for (int i = 0; i < cardNum; i++)
    {
        if(i % 2 == 0)
            AliceScore += cardValues.at(i);
        else
            BobScore += cardValues.at(i);
    }

    cout << AliceScore - BobScore << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner vd = new Scanner(System.in);
		int a = vd.nextInt();
		int b = vd.nextInt();
		int x = vd.nextInt();
		
		if((a+b)>=x) System.out.println("Yes");
		else System.out.println("No");
	}

}


Measured memory_bytes: 21844
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include <unordered_map>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n; ++i)
#define ALL(a) (a).begin(),(a).end()
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)

int main(){
    int sx, sy, tx, ty; 
    cin >> sx >> sy >> tx >> ty;
    rep(i, ty-sy)cout << "U";
    rep(i, tx-sx)cout << "R";
    rep(i, ty-sy)cout << "D";   
    rep(i, tx-sx+1)cout << "L";
    rep(i, ty-sy+1)cout << "U";
    rep(i, tx-sx+1)cout << "R";
    cout << "DR";
    rep(i, ty-sy+1)cout << "D";  
    rep(i, tx-sx+1)cout << "L";
    cout << "U";
}

Measured memory_bytes: 256
mod = 10**9 + 7
n, m, k = map(int, input().split())
nm = n * m
fact = [1] * (nm-1)
inv = [1] * (nm-1)
inv_fact = [1] * (nm-1)
for i in range(2, nm-1):
  fact[i] = fact[i-1] * i % mod
  inv[i] = -(mod // i) * inv[mod % i] % mod
  inv_fact[i] = inv_fact[i-1] * inv[i] % mod
comb = fact[nm-2] * inv_fact[k-2] * inv_fact[nm-k] % mod
cost_x = (n-1) * nm * (n+1) // 6 * m % mod
cost_y = (m-1) * nm * (m+1) // 6 * n % mod
print(comb * (cost_x + cost_y) % mod)

Measured memory_bytes: 26740
#include<iostream>
using namespace std;
int main() {
    int n, m, l;
    int x[100][100];
    int y[100][100];
    long long z[100][100];
    cin >> n >> m >> l;
    for (int prime1 = 0; prime1 < n; prime1++) {
        for (int prime2 = 0; prime2 < m; prime2++) {
            cin >> x[prime1][prime2];
        }
    }
    for (int prime2 = 0; prime2 < m; prime2++) {
        for (int prime3 = 0; prime3 < l; prime3++) {
            cin >> y[prime2][prime3];
        }
    }
    for (int prime1 = 0; prime1 < n; prime1++) {
        for (int prime3 = 0; prime3 < l; prime3++) {
            z[prime1][prime3] = 0;
            for (int prime2 = 0; prime2 < m; prime2++) {
                z[prime1][prime3] += x[prime1][prime2] * y[prime2][prime3];
            }
        }
    }
    for (int prime1 = 0; prime1 < n; prime1++) {
        for (int prime3 = 0; prime3 < l; prime3++) {
            if(prime3<l-1){
                cout << z[prime1][prime3] << " ";
            }else{
                cout << z[prime1][prime3];
            }
        }
        cout << endl;
    }
    return 0;
}
 

Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 1000000000000000007 //1e18+7
#define mk  make_pair
#define lb(v,x) lower_bound(all(v),x)
#define ub(v,x)  upper_bound(all(v),x)
#define ff  first
#define ss  second
#define rev reverse
#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define minpq  priority_queue <ll,vector<ll>,greater<ll> > 
#define coud(a,b) cout<<fixed << setprecision((b)) << (a)
#define fill(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end())
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x) 	  for(auto &a : x)
#define re(i,n)       for(ll i=0;i<n;++i) 
const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int dx[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int dy[8]={+1, 0, -1, +1, -1, +1, 0, -1};
ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
ll sqr(ll x) { return x * x;} 
template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0){ if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<ll,ll>  pii;
typedef vector<pii>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}
const int mod = 998244353;	
const int N = 1005;
void prec(){
	
}
void run(){
	string s,t;cin>>s>>t;
	int cnt=0;
	for(int i=0; i<sz(s); ++i)
		if(s[i]!=t[i]) cnt++;
	cout<<cnt;		
}	
int main()
{
    cin.sync_with_stdio(0);cin.tie(0);
	cin.exceptions(cin.failbit);
    int tc=1;
    //cin>>tc;
    prec();
    re(i,tc)
    	run();
    return 0; 
}


Measured memory_bytes: 3800
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ");

struct UnionFind {
    vi par;
    vi size;
    UnionFind(int n) : par(n), size(n) {
        REP(i, n) par[i] = i;
        REP(i, n) size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx != ry) {
            size[rx] += size[ry];
            size[ry] = size[rx];
        }
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int get_size(int x) {
        return size[root(x)];
    }
};

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 int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 1e5;
int n, m;
vi a(maxn), b(maxn), inconv(maxn);

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

    cin >> n >> m;
    REP(i, m) cin >> a[m-i-1] >> b[m-i-1];
    REP(i, m) {a[i]--; b[i]--;}

    UnionFind tree(n);
    inconv[0] = n*(n-1)/2;
    REP(i, m-1) {
        inconv[i+1] = inconv[i];
        if (!tree.same(a[i], b[i])) {
            inconv[i+1] -= tree.get_size(a[i]) * tree.get_size(b[i]);
            tree.unite(a[i], b[i]);
        }
    }
    REP(i, m) {
        cout << inconv[m-i-1] << "\n";
    }
}

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

ans = 0
if (int(n / 100)) == 9:
  ans = 100
else:
  ans = 900

if int((n % 100) / 10) == 9:
  ans = ans + 10
else:
  ans = ans + 90

if (n % 10) == 9:
  ans = ans + 1
else:
  ans = ans + 9

print(str(ans))



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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,29)-1;


int main() {
  int N; cin >> N;
  ll A[max(100,N)]={}; rep(i,N) cin >> A[i];
  ll sum = 0; rep(i,N) sum ^= A[i];

  int count = 0;
  for (int i=60; i>=0; i--) {
    if (count==N) break;
    if (sum&(1ull<<i)) continue;
    int m = 0, pos = -1;
    for (int j=count; j<N; j++) {
      if (A[j]&(1ull<<i) && A[j]>m) {
        m = A[j];
        pos = j;
      }
    }
    if (pos==-1) continue;
    swap(A[count],A[pos]);
    rep(j,N) if (A[j]&(1ull<<i) && j!=count) A[j] ^= A[count];
    count++;
    // cout << i << ": " << m << endl;
    // rep(i,N) cout << A[i] << " "; cout << endl;
  }
  ll r = 0; rep(i,N) r ^= A[i];
  ll result = (r&~sum)*2 + sum;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll a, b, c, k;
	cin>>a>>b>>c>>k;
	if (k%2)
	{
		printf("%lld\n", (b-a));
	}
	else
		printf("%lld\n", (a-b));


	return 0;
}

Measured memory_bytes: 256
//In The Name Of The God

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define X first.first
#define Y first .second
#define A second.first
#define B second.second
#define mp make_pair
#define pb push_back
#define pf push_front
#define P push
#define pob pop_back
#define pof pop_front
#define PO pop
#define rep(i,j,k) for(int i = j ; i <= k ; ++ i)
#define rrep(i,j,k) for(int i = j ; i>=k ; --i)
#define FR(i,j,k) for(int i = j ; i < k ; ++ i )
#define rFR(i,j,k) for(int i = j ; i > k ; -- i )
#define lb(x) x&-x
#define p2(x) (1LL<<x)
#define SZ size()
#define LB lower_bound
#define UB upper_bound
#define IT iterator
#define RIT reverse_iterator
#define E end()
#define BE begin()
#define RE rend()
#define RBE rbegin()
#define UN unsigned

typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll ;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<int,pll> pipl;
typedef pair<pll,int> ppli ;
typedef pair<pll,pll> plpl ;
typedef pair<ll,pii> lpip;
typedef pair<pii,ll> lppi;
typedef pair<pii,pii> lppp;
typedef pair<ll,pll> lpipl;
typedef pair<pll,ll> lppli ;
typedef pair<pll,pll> lplpl ;
typedef vector<int> vi ;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii > stpi;
typedef set<pll> stpl;
typedef vi::IT vit;
typedef vl::IT vlt;
typedef vpi::IT vpit;
typedef vpl::IT vplt;
typedef sti::IT stit;
typedef stl::IT stlt;
typedef stpi::IT stpit;
typedef stpl::IT stplt;
typedef vpi::RIT rvpit;
typedef vpl::RIT rvplt;
typedef sti::RIT rstit;
typedef stl::RIT rstlt;
typedef stpi::RIT rstpit;
typedef stpl::RIT rstplt;

const int MAXN = 500000;
const int SUPERN = 5000000;
const int MAXS = 325;
const int SUPERS = 1000;
const int MD = 1e9+7;
//......Structures.......

//......Variables........
int n;
//......Funcs............
ll sum(ll a,ll b)
{
    return (a+b)%MD;
}
ll mu(ll a,ll b)
{
    return (a*b)%MD;
}
ll mn(ll a,ll b)
{
    return(a-b+MD)%MD;
}
//......Code.............
int main()
{
    cin>>n;
    rep(i,1,3500)rep(j,1,3500)
    {
        ld a=1.0*(1.0*n*i*j)/(-1.0*n*(i+j)+4.0*i*j);
        if(a-(int)a==0&&a>0&&a<=3500)
        {
            cout<<i<<' '<<j<<' '<<(ll)a;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
R = lambda: map(int, input().split())
n, m = R()
h = [None, *R()]
g = [0] + [1] * n
for _ in range(m):
  a, b = R()
  g[a] &= h[a] > h[b]
  g[b] &= h[b] > h[a]
print(sum(g))    


Measured memory_bytes: 20096
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
 
#define mt make_tuple
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(a) begin(a), end(a)
#define SZ(a) ((int)(a).size())
 
#ifdef __DEBUG
#define debug if (true)
#else
#define debug if (false)
#endif
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  string word;
  cin >> word;
  string ans;

  for(int i = 0; i < word.length(); ++i) {
    if(i % 2 == 0) {
      ans.append(word.substr(i, 1));
    }
  }

  cout << ans << endl;
 
  return 0;
}

Measured memory_bytes: 592
#include <cstdio>
#include <algorithm>
using namespace std;

int N;
const int MAX_N = 111;
int a[MAX_N];

int main(){
    scanf("%d",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&a[i]);
    }

    int ans = 0;
    for(int i=0,j=0;i<N;i=j++){
        while(j<N&&a[i]==a[j])j++;
        ans += (j-i)/2;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128