akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    bool isp = 1;
    for(int i = 0;i < n;i ++){
        cin >> h[i];
    }
    for(int i = 1;i < n;i ++){
        bool lp = 0;
        if(h[i-1]>h[i]) {isp=0;break;}
        if(h[i-1]<h[i]) lp = 1;
        if(lp) h[i] --;
    }
    if(isp) cout << "Yes" << endl;
    else    cout << "No"  << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
const double PI=3.141592653589;
const int INF=1000000007;
const ll LMAX=1000000000000001;
ll gcd(ll a,ll b){if(a<b)swap(a,b);ll c=a%b;while(c!=0){a=b;b=c;c=a%b;}return b;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

int main(){
  int n; cin>>n;
  vector<int> c(n-1);
  vector<int> s(n-1);
  vector<int> f(n-1);
  rep(i,n-1) cin>>c[i]>>s[i]>>f[i];

  rep(i,n-1){
    int t=0;
    for(int j=i;j<n-1;j++){
      if(t<s[j]) t=s[j]+c[j];
      else{
        if(t%f[j]) t=f[j]*(t/f[j]+1)+c[j];
        else t+=c[j];
      }
    }
    cout<<t<<endl;
  }
  cout<<0<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct unionfind{
	vector<int> p;
	unionfind(int N): p(vector<int>(N, -1)){
	};
	int root(int x){
		if (p[x] == -1){
			return x;
		} else {
			p[x] = root(p[x]);
			return p[x];
		}
	}
	bool same(int x, int y){
		return root(x) == root(y);
	}
	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if (x != y){
			p[x] = y;
		}
	}
};
long long kruskal(vector<vector<pair<int, int>>> &E){
	int N = E.size();
	vector<tuple<int, int, int>> edges;
	for (int i = 0; i < N; i++){
		for (auto P : E[i]){
			edges.push_back(make_tuple(P.first, i, P.second));
		}
	}
	sort(edges.begin(), edges.end());
	unionfind UF(N);
	long long ans = 0;
	for (auto e : edges){
		int c = get<0>(e);
		int v = get<1>(e);
		int w = get<2>(e);
		if (!UF.same(v, w)){
			UF.unite(v, w);
			ans += c;
		}
	}
	return ans;
}
int main(){
  int v, e;
  cin >> v >> e;
  vector<vector<pair<int, int>>> E(v);
  for (int i = 0; i < e; i++){
    int s, t, w;
    cin >> s >> t >> w;
    E[s].push_back(make_pair(w, t));
  }
  cout << kruskal(E) << endl;
}


Measured memory_bytes: 6172
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
  ll n,ans=1;
  cin>>n;
  for (ll i=2;i<=n;i++) {
    ans *= i;
    if (ans>=1000000007) ans%=1000000007;
  }
  cout << ans;
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#include "stdc++.h"
#endif
#ifdef __GNUC__
#include<bits/stdc++.h>
#endif
using namespace std;
 
using ll = long long;
 
//constant
const double EPS = 1e-10;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()
 
//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
 
// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }
 
// view vector
template<typename T> void view(T e) { cout << e << endl; }
template<typename T> void view(const vector<T>& v) { for (const auto& e : v) { cout << e << " "; } cout << endl; }
template<typename T> void view(const vector<vector<T> >& vv) { for (const auto& v : vv) { view(v); } }
 
// DP
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; }
 
 
 
 
// ***************************************
 
 
int main() {
 
    vector<vector<int>> idx(3);
    int N;
    cin >> N;
 
    vector<int> color = {0, 1, 2};
 
    map<char, int> cti;
    cti['R'] = 0;
    cti['G'] = 1;
    cti['B'] = 2;
 
    char c;
    REP(i, N) {
        cin >> c;
        idx[cti[c]].push_back(i);
    }
 
    ll ans = 0;
    do {
        for (auto& i : idx[color[0]]) {
            auto jj = upper_bound(ALL(idx[color[1]]), i);
            if (jj == idx[color[1]].end()) break;
            FOR(j, jj - idx[color[1]].begin(), idx[color[1]].size()) {
				auto kk = upper_bound(ALL(idx[color[2]]), idx[color[1]][j]);
				if (kk == idx[color[2]].end()) break;
                FOR(k, kk - idx[color[2]].begin(), idx[color[2]].size()) {
                    if (idx[color[1]][j]- i == idx[color[2]][k] - idx[color[1]][j]) continue;
                    ans++;
                }
            }
        }
    } while (next_permutation(ALL(color)));
 
    cout << ans << endl;
    
 
    return 0;
}

Measured memory_bytes: 3636
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = scan.nextInt();
        int[] l = new int[n];
        for(int i = 0; i < n; i++) l[i] = scan.nextInt();
        int p = 0;
        int c = 1;
        for(int i = 0; i < n; i++){
            p += l[i];
            if(p > x) break;
            c++;
        }
        System.out.println(c);
        scan.close();
    }
}

Measured memory_bytes: 27204
#include <stdio.h>

void fibo(int *);

int main(){

  int n;
  int a[45];

  scanf("%d", &n);

  fibo(a);

  printf("%d\n", a[n]);

  return 0;
}

void fibo(int *a){

  int i;

  a[0] = 1;
  a[1] = 1;

  for(i = 2; i < 45; i++){
    a[i] = a[i - 2] + a[i - 1];

  }

}

Measured memory_bytes: 596
#pragma GCC optimize(2)
#pragma GCC optimize("Ofast")
#include<iostream>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <cstring>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <sstream>
#include <map>
#include <unordered_map>
#include <vector> 
#include <bitset>
#include <cctype>
#include <set>
#include <stack>
#include <queue>
#include <fstream>
#include <numeric>
#include <random>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAXN = 100005;
const int MAXM = 50005;
const double EPS = 1e-8;
const int MOD = 1e9+7;

#define MP make_pair
#define INF 0x3f3f3f3f
#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mst(X,Y) memset(X,Y,sizeof(X)) 
#define rep(i, a, n) for (int i=(a); i<=(n); i++)
#define per(i, a, n) for (int i=(a); i>=(n); i--)
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template <typename T> inline T max(T a, T b, T c) { return max(max(a, b), c); }
template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) { cerr << " " << to_string(H);    debug_out(T...);}

void solve()
{
    int x;
    cin >> x;
    cout << (x == 1 ? 0 : 1)<<endl;
}


int main()
{closeSync;
#ifdef DEBUG
	//freopen("C:/Users/86159/Desktop/a2.in.txt", "r", stdin);
	//freopen("C:/Users/86159/Desktop/output.txt", "w", stdout);
#endif
	//clock_t c1 = clock();

    // int T;
    // cin >> T;
    // while (T--)
        solve();

    //cerr << "Time:" << clock() - c1 << "ms" <<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  ll ans = (N+K)%24;
  // bool ok = false;

  cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}









Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define ll long long
#define fr first
#define ii pair<int,int>
#define sc second
#define mp make_pair
#define All(v) v.begin(),v.end()
using namespace std;
int main()
{
 int a,b,c;
 cin>>a>>b>>c;
 for(int i=0;i<10000000;i++)
 {
     if(a%2==1 || b%2 == 1 || c%2 == 1)
     {
         cout<<i;
         return 0;
     }
     int aa , bb , cc;
     aa = b/2+c/2;
     bb = a/2+c/2;
     cc = a/2+b/2;
     a = aa;
     b = bb;
     c = cc;
 }
 cout<<-1;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    int ans = 0;
    for(int i = 0; i <= N; i++){
        bool is_in_X[26], is_in_Y[26];
        for(int j = 0; j < 26; j++){
            is_in_X[j] = false;
            is_in_Y[j] = false;
        }
        for(int j = 0; j < i; j++){
            is_in_X[S[j] - 'a'] = true;
        }
        for(int j = i; j < N; j++){
            is_in_Y[S[j] - 'a'] = true;
        }
        int this_ans = 0;
        for(int j = 0; j < 26; j++){
            this_ans += (is_in_X[j] && is_in_Y[j]);
        }
        ans = max(ans, this_ans);
    }
    cout << ans << endl;
}


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

int main()
{
	int n, k;
	cin >> n >> k;
	if (n % k == 0)
	{
		cout << "0";
	}
	else
	{
		/*cout << n - ((n / k) * k);*/
		cout << "1";
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

int cnt[200010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    rep(i, N - 1) {
        int A; cin >> A;
        cnt[A - 1]++;
    }
    rep(i, N) {
        cout << cnt[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 4424
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut buf_it = buf.split_whitespace();
    let A = buf_it.next().unwrap().chars().collect::<Vec<_>>();

    let N = A.len();
    let mut cnt = HashMap::new();
    let mut ans = 1;

    cnt.insert(A[0],1);
    for i in 1..N{
        let n = *cnt.get(&A[i]).unwrap_or(&0);
        ans += i - n;
        cnt.insert(A[i],n+1);
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair((first), (second)))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define reall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	ll S;
	cin >> S;
	ll a = 0, b = 0, c = 0, d = 0;
	a = sqrt(S);
	d = sqrt(S);
	while(a * d < S){
		a++;
		if(a * d >= S)break;
		d++;
	}
	ll bc = a * d - S;
	//cout << "bc = " << bc << endl;
	for(ll i = 1; i <= bc; i ++){
		if(bc%i == 0 && i <= 1000000000 && bc / i <= 1000000000){
			b = i;
			c = bc / i;
			break;
		}
	}
	cout << "0 0 " << a << SPACE << b << SPACE << c << SPACE << d << endl;


/*
ad-bc = S
0 <= a,b,c,d <= 10^9
ad = S + bc
bc = ad - S */

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e18;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  double avg = 1.0 * sum / n;
  vector<pair<double, int>> m(n);
  rep(i, n) { m[i] = make_pair((double)abs(avg - a[i]), i); }
  sort(all(m));
  cout << m[0].second << endl;
  return 0;
}


Measured memory_bytes: 256
#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 = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<60;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;


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

    int ans  = 0;
    rep(i, S.size()){
        if (S[i] != T[i]) ans++;
    }

    cout << ans << endl;
}

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

int main(int argc, char** argv){
  int N, K;
  cin >> N >> K;  
  ll comb[2005][2005];
  const ll mod = 1e9+7;
  
  comb[0][0] = 1;
  comb[1][0] = 1;
  comb[1][1] = 1;
  for(int i=1; i<=N; i++){
    comb[i+1][0] = 1;
    comb[i+1][i+1] = 1;
    for(int j=1; j<=i; j++){
      comb[i+1][j] = (comb[i][j-1] + comb[i][j])%mod;
    }
  }
  for(int i=1; i<=K; i++){
    cout << (comb[K-1][i-1]*comb[N-K+1][i])%mod << endl;
  }
  
  return 0;
  
}


Measured memory_bytes: 31232
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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








int main() {
    ll n;
    string s;
    cin >> n >> s;
    ll r = 0, b = 0;
    REP(i, n){
        if(s[i] == 'R')r++;
        else b++;
    }
    if(r > b) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, h, w;
    cin >> n >> h >> w;
    cout << (n - w + 1) * (n - h + 1) << endl;
    
    return 0;
}



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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
vector<ll> p, c;
ll result = MOD;
ll max;
ll g;
void saiki(ll sum, ll k, ll max, ll r){
  //cout << sum spa k spa max spa r << endl;
  if(k == 0){
    if(sum < g){
      ll z;
      for(z = 0; z < p[max - 1] && sum < g; z++){
        sum += max * 100;
        r++;
        //cout << sum spa z spa r spa g << endl;
      }
      if(z == p[max - 1])
        sum += c[max - 1];
    }
    if(sum >= g)
      chmin(result, r);
  }
  else{
    saiki(sum, k - 1, max, r);
    if(max == k)
      saiki(sum + 100 * p[k - 1] * k + c[k - 1], k - 1,max - 1, r + p[k - 1]);
    else
      saiki(sum + 100 * p[k - 1] * k + c[k - 1], k - 1, max, r + p[k - 1]);
  }
}
      
  
  
  
  


int main(){
  ll i, j;
  ll d;
  cin >> d >> g;
  ll a, b;
  for(i = 0; i < d; i++){
    cin >> a >> b;
    p.push_back(a);
    c.push_back(b);
  }
  saiki(0, d, d, 0);
  cout << result << endl;
    
        
  return 0;
}

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

using namespace std;

int main() {
    int n , k , r , s , p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    string played(n , 'n');

    auto opp = [](char c) {
        if (c == 'r') return 'p';
        if (c == 's') return 'r';
        return 's';
    };

    auto score = [&](char c) {
        if (c == 'r') return r;
        if (c == 's') return s;
        return p;
    };

    int ans = 0;
    for (int i = 0 ;i < n ;i++) {
        char want = opp(t[i]);
        if (i < k || played[i - k] != want) {
            ans += score(want);
            played[i] = want;
        }
    }

    cout << ans;
}


Measured memory_bytes: 3852
#include <iostream>
#define ll long long
#define the_flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

int main() 
{
    the_flash;
    ll a, b;
    cin >> a >> b;
    ll res = (a + b) / 2;

    if ((a - b) % 2 == 0)
        cout << res << "\n";
    
    else 
        cout << "IMPOSSIBLE" << "\n";
    return 0;
}

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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;
typedef unsigned long long ll;
const long long MOD = 1000000000 + 7;

struct Edge{
    int to;     //辺の行先
    int fr; //辺の重み
    Edge(int t, int w) : fr(t), to(w) {}
};

using Graph = vector<vector<int>>;

int main(){
    int n,m;
    cin >> n >> m;
    Graph G(n+1);
    rep(i,m){
        int from ,to;
        cin >> from >> to;
        G[from].push_back(to);
        G[to].push_back(from);
    }
    int res[n+1];
    rep(i,n+1) res[i] = -1;
    res[1] = 0;
    queue<int> que;
    que.push(1);
    while(!que.empty()){
        int now = que.front();
        que.pop();
        for(int i = 0; i< G[now].size(); i++){
            if(res[G[now][i]] != -1) continue;
            int next = G[now][i];
            res[next] = now;
            que.push(next);
        }
    }
    bool comp = true;
    rep(i,n){
        if(res[i+1]==-1) comp = false;
    }
    if(!comp){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    for(int i = 2; i < n+1; i++){
        cout << res[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 10228
#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a,const void *b){
  return *(int*)a-*(int*)b;
}

int main(){

  int num[5];
  int a,b,c,d,e,i;

  scanf("%d %d %d %d %d",&a,&b,&c,&d,&e);
  num[0]=a; num[1]=b; num[2]=c; num[3]=d; num[4]=e;
  qsort(num,5,sizeof(int),cmp);

  for(i=4;i>=0;i--){
    if(i!=4) printf(" ");
    printf("%d",num[i]);
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 604
#ABC068C
N, M=map(int, input().split())
ab = []
for i in range(M):
    ab.append(list(map(int, input().split())))
#島リストを作る（N個）
island_score=[0]*N
#船の出発元aを調べる。（M回） aが1なら、島リストのb番目を+1
for i in range(M):
    if ab[i][0]==1:
        island_score[ab[i][1]]+=1
#船の行き先bを調べる。（M回)  bがNなら、島リストのa番目を調べる
for i in range(M):
    if ab[i][1]==N:
        # 島リストのがすでに1になっているならそれが経路の候補。
        if island_score[ab[i][0]]==1:
            print('POSSIBLE')
            exit()
print('IMPOSSIBLE')

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

signed main() {
    int n;
    cin >> n;
    int f[100][10] = {};
    rep(i, n) {
        rep(j, 10) cin >> f[i][j];
    }
    int p[100][11] = {};
    rep(i, n) {
        rep(j, 11) cin >> p[i][j];
    }

    int ans = -1e10;
    for(int bit = 1; bit < (1 << 10); bit++) {
        int sum = 0, cnt = 0;
        rep(i, n) {
            cnt = 0;
            rep(b, 10) if((bit >> b & 1) && f[i][b]) cnt++;
            sum += p[i][cnt];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
const int maxn = 1e5+15;
int n,a[maxn];
int main(){
    cin >> n;
    for(int i = 0;i < n; ++i) cin >> a[i];
    sort(a,a+n);
    int l = n/2-1,r = n/2;
    cout << a[r] - a[l] << endl;
    return 0;
}

Measured memory_bytes: 640
K,N=map(int,input().split())
alist=list(map(int,input().split()))

alist.sort()
#print(alist)

answer=K
for i in range(N):
  dist=(alist[(N-1+i)%N]-alist[i])%K
  #print(dist)
  answer=min(answer,dist)
  
print(answer)

Measured memory_bytes: 26436
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int X = scan.nextInt();

		if(X == 3 || X == 5 || X == 7){
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int n;
  cin >> n;
  double b2y = 380000.0;
  double ans = 0;
  rep (i, n) {
    double val;
    string s;
    cin >> val >> s;
    if (s[0] == 'J') {
      ans += val;
    } else {
      ans += val * b2y;
    }
  }
  printf("%.6f\n", ans);
  return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {
    int n; cin >> n;
    int ans = 0;
    vector<int> L(n);
    rep(i,n) cin >> L[i];
    sort(L.begin(),L.end());
    for(int a = 0; a < n; a ++)
    {   for(int b = a+1; b < n; b ++) {
            int ab = L[a] + L[b];
            int r = lower_bound(L.begin(), L.end(), ab) - L.begin();
            int l = b + 1;
            ans += max(0, r - l);
        }
    }

    cout << ans;


    return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0; i<n; i++)cin>>a.at(i);

  int ans=0;
  bool flg=true;
  while(flg){
    for(int i=0; i<n; i++){
      if(a.at(i)%2==0){
        a.at(i)/=2;
      }else{
        flg=false;
        break;
      }
    }
    ans++;
  }
  
  cout<<ans-1<<endl;  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef deque<int> di;
typedef pair<int,int> pi;
#define pb push_back
#define mp make_pair
#define mh make_heap
#define s second
#define f first
#define pf push_front
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 1000000000
#define FOR(i,a,b) for(ll i=a;i<b;i++)

int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    IOS
    int n;
    cin>>n;
    if(n%1000==0)
        cout<<0<<endl;
    else
        cout<<1000-(n%1000)<<endl;

    return 0;
}


Measured memory_bytes: 3616
# coding: utf-8
import itertools

N, M, Q = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(Q)]
l = [i for i in range(1, M + 1)]
A = list(itertools.combinations_with_replacement(l, N))

maxans = 0

for j in A:
    ans = 0
    for i in lst:
        if j[i[1]-1] - j[i[0]-1] == i[2]:
            ans = ans + i[3]
    maxans = max(maxans, ans)

print(maxans)

Measured memory_bytes: 21500
#include<stdio.h>
#define M 251

int main()
{
  int i,H,T[M];
  
  scanf("%d",&H);

  for(i=1; i<=H; i++){
    scanf("%d",&T[i]);
  }	     
    
  for(i=1; i<=H; i++){

    printf("node %d: key = %d, ",i,T[i]);
    if((i-i%2) > 0)
      printf("parent key = %d, ",T[(i-i%2)/2]);
    if(i*2 <= H)
      printf("left key = %d, ",T[i*2]);
    if(i*2+1 <= H)
      printf("right key = %d, ",T[i*2+1]);
    printf("\n");
  }
  return 0;
}
    
    
  



Measured memory_bytes: 2052
import math
def get_prime(n):
    if n <= 1:
        return []
    prime = [2]
    if n > 2:
        limit = int(math.sqrt(n))
        odd = [i for i in range(3, n + 1, 2)]
        while limit >= odd[0]:
            prime.append(odd[0])
            odd = [j for j in odd if j % odd[0] != 0]
        prime += odd
    return prime

from collections import defaultdict
def prime_factorization(n):
    if n <= 1:
        return {}
    else:
        # print(int(math.sqrt(n)))
        prime = get_prime(int(math.sqrt(n)))
        dct = defaultdict(int)
        for p in prime:
            while n % p == 0:
                dct[p] += 1
                n //= p
        if n != 1:
            dct[n] += 1
        dct = dict(dct)
        return dct

n = int(input())
pf = prime_factorization(n)

Z = []
for k, v in pf.items():
    for i in range(1, v + 1):
        Z.append(k ** i)
Z.sort()
count = 0
for z in Z:
    if n % z == 0:
        count += 1
        n //= z
    if n == 1:
        break

print(count)

Measured memory_bytes: 31656
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n, k;
int a[100000];

int ra[100001];
int rs[100001];

signed main() {
	int i;
	
	cin >> n >> k;
	for (i = 0; i < n; i++) cin >> a[i];
	
	for (i = 0; i < n; i++) ra[i + 1] = ra[i] + a[i];
	for (i = 0; i < n; i++) rs[i + 1] = rs[i] + a[i] * (a[i] > 0);
	
	int ans = 0;
	for (i = 0; i <= n - k; i++) {
		//最後、[i, i + k)を塗る
		int score = rs[i] + max(0LL, ra[i + k] - ra[i]) + rs[n] - rs[i + k];
		ans = max(ans, score);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define fl float
#define db double
#define ii pair<ll,ll>
#define pii pair<ii,ii>
#define ford(i,a,b) for(int i=a;i<=b;i++)
#define foru(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,a,b) for(int i=a;i<b;i++)
#define oo 10000000000001
#define ooo -1000000000001
int a,x;
int main()
{
    cin>>x>>a;
    if(x<a) cout<<0;
    else cout<<10;
    return 0;
}


Measured memory_bytes: 256
n,k,*a=map(int,open(0).read().split())
mod=10**9+7
x=0
y=0
for i in range(n-1):
  for j in range(i+1,n):
    if a[i]>a[j]:
      x+=1
for i in range(n):
  for j in range(n):
    if a[i]<a[j]:
      y+=1
print((x*k+y*k*(k-1)//2)%mod)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
if(n%10==2||n%10==4||n%10==5||n%10==7||n%10==9)
cout<<"hon";
else if(n%10==3)
cout<<"bon";
else
cout<<"pon";
}


Measured memory_bytes: 3636
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <map>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

class Block
{
	
public:
	ll a, b;
	Block(ll a, ll b){this->a = a; this->b = b;};
};

bool compare(Block &a, Block &b)
{
	return a.b < b.b;
}

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

	ll n, m;
	
	cin >> n >> m;

	//ll a[m], b[m];
	/*
	map<ll, std::vector<ll> v > mapping;

	rep(i, m)
	{
		ll a, b;
		cin >> a >> b;
		mapping[a].pb(b);
	}
	*/
	std::vector<Block> v;
	rep(i, m)
	{
		ll a, b;
		cin >> a >> b;
		Block tmp(a,b);
		v.pb(tmp);
	}

	sort(v.begin(), v.end(), compare);

	/*
	for(int i = 0; i < m; i++)
	{
		cout << v[i].a << "; " << v[i].b << endl;
	}
	*/

	ll ans = 0;
	ll cur = 0;

	for(int i = 0; i < m; i++)
	{
		if ((v[i].a - cur < 0) && (v[i].b - cur >= 0))
		{
			continue;
		}

		cur = v[i].b;
		ans++;

	}

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


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define ppl pair<ll,ll>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b==0)return 1%c; if(b==1)return a%c; ll ret=fp(a,b/2,c); ret=(ret*ret)%c; if(b&1)ret=(ret*a)%c; return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=100000;
const long double PI = acos(-1);

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


int main()
{
  finp;
  string s;
  cin>>s;
  int n = s.length();
  int ans = infs;
  afor(j,0,25)
  {
    string ss = s;
    int curr = 0;
    int sz = n;

    while(1)
    {
      bool f= true;
      afor(i,0,sz-1)
      {
        if(ss[i] != (j+'a'))f = false;
      }
      if(f)break;
      curr++;
      afor(i,0,sz-2)
      {
        if(ss[i]==(j+'a') || ss[i+1]==(j+'a'))ss[i] = j + 'a';
      }
      ss.pop_back();
      sz--;
    }
    ans = min(ans,curr);
  }
  assert(ans != infs);
  cout<<ans;
return 0;
}

Measured memory_bytes: 256
import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

n=i()
t=[0]*n
a=[0]*n
for j in range(n):
    t[j],a[j]=ii()

tt,aa=1,1
for j in range(n):
    if t[j]>=tt and a[j]>=aa:
        tt,aa=t[j],a[j]
    else:
        k=max(tt/t[j]+int(tt%t[j]!=0),aa/a[j]+int(aa%a[j]!=0))
        tt,aa=t[j]*k,a[j]*k

print tt+aa


Measured memory_bytes: 2944
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn=4100;
int n;
char t[maxn];
int a[maxn];
int s[5][maxn];
int u[5];
int main(){
    cin>>n>>t;
    for(int i=1;i<=n;i++){
        if(t[i-1]=='R') a[i]=0;
        if(t[i-1]=='G') a[i]=1;
        if(t[i-1]=='B') a[i]=2;
    }
    for(int i=n;i>=1;i--){
        for(int j=0;j<3;j++) s[j][i]=s[j][i+1];
        s[a[i]][i]=s[a[i]][i+1]+1;
    }
    ll ans=0;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++){
            if(a[i]==a[j]) continue;
            memset(u,0,sizeof u);
            u[a[j]]=1;u[a[i]]=1;
            int x;
            for(int k=0;k<3;k++)
                if(!u[k]) x=k;
            ans+=s[x][j+1];
            if(j+j-i<=n&&a[j+j-i]==x) ans--;
        }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3640
m,k = map(int, input().split())
if 2**m <= k:
  print(-1) 
elif (m,k) == (1,0):
  print("0 0 1 1")
elif (m,k) == (1,1):
  print(-1)
else:
  l = [x for x in range(2**m) if x != k]
  ans = l+[k]+l[::-1]+[k]
  print(" ".join(map(str,ans)))

Measured memory_bytes: 28428
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
template<class T> inline void chmax(T &a,T b){if(a<b)a=b;}
template<class T> inline void chmin(T &a,T b){if(a>b)a=b;}

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n,a,b; cin >> n >> a >> b;
    cout << min(n*a,b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
int main(){
  vector<ll> A(3);
  rep(i,3) cin>>A[i];
  sort(all(A));
  ll ans=0;
  if((A[0]%2)*(A[1]%2)*(A[2]%2)) ans=A[0]*A[1];
  cout<<ans<<endl;
}

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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
}*/

signed main()
{
  int n, k;
  string s;
  cin >> n >> k >> s;

  int cnt = 0, t = 1;
  vi a;
  rep(i, 0, n){
    if(s[i]-'0' == t%2){
      cnt++;
    }else{
      a.pb(cnt);
      t++;
      cnt = 1;
    }
  }
  a.pb(cnt);
  if(a.size()%2 == 0) a.pb(0);
  int m = a.size();

  multiset<int> ms;
  int sum = 0;
  int K = 2*k+1;

  if(K >= m){
    cout << n << endl;
    return 0;
  }

  rep(i, 0, K){
    ms.insert(a[i]);
    sum += a[i];
  }

  int ans = sum;
  for(int i = K; i < m; i += 2){
    ms.erase(ms.find(a[i-K]));
    sum -= a[i-K];
    ms.erase(ms.find(a[i-K+1]));
    sum -= a[i-K+1];

    ms.insert(a[i]);
    sum += a[i];
    ms.insert(a[i+1]);
    sum += a[i+1];
    chmax(ans, sum);
//    cout << i << " : " << ans << endl;
  }

  cout << ans << endl;

//  rep(i, 0, m) cout << a[i] << endl;

  return 0;
}


Measured memory_bytes: 3700
def main():
    n, m = map(int, input().split())
    dp = [0] * (n + 1)
    dp[0] = 1
    for _ in range(m):
        a = int(input())
        dp[a] = -1
    mod = 10 ** 9 + 7

    for i in range(n + 1):
        if dp[i] == 0:
            if i - 1 >= 0 and dp[i - 1] != -1:
                dp[i] += dp[i - 1]
            if i - 2 >= 0 and dp[i - 2] != -1:
                dp[i] += dp[i - 2]

    print(dp[-1] % mod)


if __name__ == "__main__":
    main()


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
#define print(x) cout<<'>'<<#x<<':'<<x<<endl;
#define mod 1000000007

void solve(){
    string s;
    cin>>s;
    cout<<s.substr(0,3)<<'8'<<s.substr(4,s.size()-4);

}

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

    solve();

    return 0;
}


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

#define ED return 0;
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) int(pow(x,y))
#define FI first
#define SE second
const long mod = 1000000007;

int main(){
    string s;
    string t;
    cin >> s >> t;
    REV(s);
    REV(t);
    bool test = false;
    int at;
    for(int i = 0;i < s.size()-t.size()+1 && test == false;i++){
        test = true;
        for(int j = 0;j < t.size();j++){
            if(s.at(i+j) != t.at(j) && s.at(i+j) != '?'){
                test = false;
                break;
            }
        }
        if(test){
            at = i;
        }
    }
    if(test == false){
        cout << "UNRESTORABLE" << endl;
        ED
    }
    for(int i = at;i-at < t.size();i++){
        s.at(i) = t.at(i-at);
    }
    REV(s);
    for(int i = 0;i < s.size();i++){
        if(s.at(i) == '?'){
            cout << 'a';
        }
        else{
            cout << s.at(i);
        }
    }
    cout << endl;
}

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

int main()
{
	int N, D;
	cin >> N >> D;

	int X[10][10];
	for (int i = 0; i < N; ++i)
		for (int j = 0; j < D; ++j)
			cin >> X[i][j];

	int ans = 0;
	for (int i = 0; i < N - 1; ++i)
		for (int j = i + 1; j < N; ++j)
		{
			double sq = 0;
			for (int k = 0; k < D; ++k)
			{
				sq += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]);
			}
			sq = sqrt(sq);

			if (sq - floor(sq) == 0.0)
				++ans;
		}

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


Measured memory_bytes: 256
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;

int main()
{
	sync;
	ll a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c&&c==a)
	cout<<"Yes";
	else
	cout<<"No";
}

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


int main()
{
    string s;
    cin>>s;
    int l=s.size();
    int j=l,c=0;
    for(int i=0;i<(l+1)/2;i++)
    {
        if(s[i]!=s[j-1])c++;
        j--;
    }
    cout<<c;
}

Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let (r, w, e) = (stdin(), stdout(), stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    // =============================================== //

    let n: usize = io.read();
    let mut dp = vec![vec![0; 3]; n + 3];
    for i in 1..n + 1 {
        let (a, b, c): (usize, usize, usize) = (io.read(), io.read(), io.read());
        dp[i][0] = max(dp[i][0], max(dp[i - 1][1] + a, dp[i - 1][2] + a));
        dp[i][1] = max(dp[i][1], max(dp[i - 1][0] + b, dp[i - 1][2] + b));
        dp[i][2] = max(dp[i][2], max(dp[i - 1][0] + c, dp[i - 1][1] + c));
    }
    io.writeln(max(dp[n][0], max(dp[n][1], dp[n][2])));
}

// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug ) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug>(&mut self, val1: S, val2: S) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
}


Measured memory_bytes: 10492
#include<bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define elif else if
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}

const int N = 3e5, M = N;
//=======================
void solve() {
 string s,t;
  cin >> s >> t;
  int ans = 0;
  for(int i=0; i<s.size(); i++){
    if(s[i]!=t[i])	ans++;
  }
  cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    // cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}




Measured memory_bytes: 3824