akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1005;
const int maxm = 7005;

int a[N], b[N], c[N], d[N], e[N], f[N];
vector <int> vx, vy;
int dx[] = {0, 0, -1, 1}, dy[] = {-1, 1, 0, 0};
bool vis[maxm][maxm], ma[maxm][maxm];

int get_x(int val){
    return lower_bound(vx.begin(), vx.end(), val) - vx.begin();
}

int get_y(int val){
    return lower_bound(vy.begin(), vy.end(), val) - vy.begin();
}

int main(){
    int n, m; scanf("%d%d", &n, &m);
    /*
    vx.push_back(-1.1e9), vx.push_back(0);
    vy.push_back(-1.1e9), vy.push_back(0);
    */
    vx.push_back(0), vy.push_back(0);
    vx.push_back(-1.1e9), vy.push_back(-1.1e9);

    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i] >> c[i];
        vx.push_back(a[i]), vx.push_back(b[i]);
        vy.push_back(c[i]);
    }

    for(int i = 0; i < m; i++){
        cin >> d[i] >> e[i] >> f[i];
        vy.push_back(e[i]), vy.push_back(f[i]);
        vx.push_back(d[i]);
    }

    sort(vx.begin(), vx.end()), vx.erase(unique(vx.begin(), vx.end()), vx.end());

    sort(vy.begin(), vy.end()), vy.erase(unique(vy.begin(), vy.end()), vy.end());


    for(int i = 0; i < n; i++){
        a[i] = get_x(a[i]), b[i] = get_x(b[i]), c[i] = get_y(c[i]);
        for(int j = a[i]*2 - 1; j < 2 * b[i]; j++)
            ma[j][2*c[i] - 1] = true;
    }

    for(int i = 0; i < m; i++){
        d[i] = get_x(d[i]), e[i] = get_y(e[i]), f[i] = get_y(f[i]);
        for(int j = e[i]*2-1; j < f[i]*2; j++)
            ma[2*d[i]-1][j] = true;
    }

    int sx = get_x(0)*2 - 1, sy = get_y(0)*2 - 1;

    queue<pair<int, int>> qu;
    qu.push({sx, sy}), vis[sx][sy] = true;
    ll ans = 0;
    bool flag = false;
    while(!qu.empty()){
        int ux = qu.front().first, uy = qu.front().second; qu.pop();
        if(ux == maxm-1 || uy == maxm-1 || ux == 0 || uy == 0){
            flag = true;
            break;
        }
        if(ux % 2 == 0 && uy % 2 == 0){
            int x = ux / 2, y = uy / 2;
            ans += 1ll * (vx[x + 1] - vx[x]) * (vy[y + 1] - vy[y]);
        }
        for(int i = 0; i < 4; i++){
            int xx = ux + dx[i], yy = uy + dy[i];
            if(xx >= maxm || xx < 0 || yy >= maxm || yy < 0 || ma[xx][yy] || vis[xx][yy]) continue;
            qu.push({xx, yy});
            vis[xx][yy] = true;
        }
    }
    if(flag) printf("INF\n");
    else printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 89036
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// 入力受付
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int array[] = new int[n+1];
		for (int i = 1; i <= n; i++) {
			array[i] = scan.nextInt();
		}

		int result[] = new int[n+1];

		for (int i = 1; i <= n; i++) {
			result[array[i]] = i;

		}

		for (int i = 1; i <= n; i++) {
			if (i != n) {
				System.out.print(result[i] + " ");
			} else {
				System.out.print(result[i]);
			}
		}

	}
}

Measured memory_bytes: 62848
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int a,b;
    cin >> a >> b;
    if((a*b)%2)cout<<"Odd"<< endl;
    else cout << "Even" << endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::{fastout, input, marker::Chars};
#[allow(unused_mut)]
#[fastout]
fn main() {
    input! {
        _n: usize,
        s: Chars
    }
    let mut res = true;
    if s[..s.len() / 2] != s[s.len() / 2..] {
        res = false;
    }
    println!("{}", if res { "Yes" } else { "No" });
}


Measured memory_bytes: 2164
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;

int main(){
	ll x=0;
	int n,T;
	cin>>n>>T;
	ll *a=new ll[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=1;i<n;i++){
		if(abs(a[i-1]-a[i])<T){
			x+=abs(a[i-1]-a[i]);
		}
		else if(abs(a[i-1]-a[i])>=T){
			x+=T;
		}
	}
	x+=T;
	cout<<x<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

using namespace std::chrono;

int main(void)
{
    IOS
    const int A = 26;
    const int M = 1e3;
    const int TL = 1800;
    auto stime = system_clock::now();
    int D; cin >> D;
    vector<int> c(A);
    REP(i,A) cin >> c[i];
    vector<vector<int>> s(D,vector<int>(A));
    REP(i,D) REP(j,A) cin >> s[i][j];

    vector<int> last(A,-1);
    vector<int> ans(D);
    REP(i,D) {
        int mx = 0,a = -1;
        REP(j,A) {
            int tmp = (i-last[j])*c[j] + s[i][j];
            if (mx < tmp) {
                mx = tmp;
                a = j;
            }
        }
        ans[i]=a;
        last[a] = i;
    }
    auto calc = [&](const vector<int> &a){
        vector<int> l(A,-1);
        int score = 0;
        REP(i,D) {
            score += s[i][a[i]];
            l[a[i]] = i;
            REP(j,A) {
                score -= c[j]* (i-l[j]);
            }
        }
        return score;
    };

    int maxscore = calc(ans);

    random_device seed_gen;
    mt19937 engine(seed_gen());
    while(true) {
        auto time = system_clock::now();
        int t = duration_cast<milliseconds>(time-stime).count();
        if (t >= TL) break;

        REP(i,M) {
            vector<int> a(ans);
            if (i % 2 == 0) {
                int s1 = engine() % D;
                int s2 = engine() % D;
                swap(a[s1],a[s2]);
            } else {
                a[engine() % D] = a[engine() % A];
            }
            int tmp = calc(a);
            if (maxscore < tmp) {
                swap(ans,a);
                maxscore = tmp;
            }
        }
    }

    REP(i,D) OUT(ans[i]+1)

    return 0;
}

Measured memory_bytes: 3720
def solve():
    N = int(input())
    X = input()
    X_10 = int(X,2)

    r = X.count("1")
    r0 = r-1
    r1 = r+1
    ans = []
    
    s0 = X_10 % r0 if r != 1 else None
    s1 = X_10 % r1 

    for i in range(N):
        if X[i] == '0':
            ans.append(f((s1 + pow(2,N-1-i,r1)) % r1))
        else:
            if r0 == 0:
                ans.append(0)
            else:
                ans.append(f((s0 - pow(2,N-1-i,r0)) % r0))
    
    print(*ans, sep='\n')

def f(N):
    cnt = 1
    while N != 0:
        N = N % popcount(N)
        cnt += 1
    
    return cnt

def popcount(N):
    b = bin(N)
    cnt = 0
    for i in range(2,len(b)):
        if b[i] == '1':
            cnt += 1

    return cnt

if __name__ == '__main__':
    solve()

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

using weight = int;

struct edge {
    int to;
    weight cap;
    int rev;
    bool is_rev;
};

using edges = std::vector<edge>;
using graph = std::vector<edges>;

void add_edge(graph& g, int from, int to, weight cap) {
    g[from].push_back(edge{to, cap, static_cast<int>(g[to].size()), false});
    g[to].push_back(edge{from, 0, static_cast<int>(g[from].size()-1), true});
}

void bfs(graph& g, std::vector<int>& level, int s) {
    for(int i=0; i<level.size(); ++i) {
        level[i] = -1;
    }
    level[s] = 0;
    std::queue<weight> que;
    que.push(s);
    while(!que.empty()) {
        int v = que.front(); que.pop();
        for(int i=0; i<g[v].size(); ++i) {
            edge& e = g[v][i];
            if(e.cap > 0 && level[e.to] < 0) {
                level[e.to] = level[v] + 1;
                que.push(e.to);
            }
        }
    }
}

weight dfs(graph& g, std::vector<int>& level, std::vector<int>& iter, int v, int t, weight f) {
    if(v == t) {
        return f;
    }
    for(int& i=iter[v]; i<g[v].size(); ++i) {
        edge& e = g[v][i];
        if(e.cap > 0 && level[v] < level[e.to]) {
            int d = dfs(g, level, iter, e.to, t, std::min(f, e.cap));
            if(d > 0) {
                e.cap -= d;
                g[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

// verified
weight max_flow(graph& g, int s, int t) {
    weight flow = 0;
    std::vector<int> level(g.size(), -1);
    std::vector<int> iter(g.size(), 0);
    int INF = 1e9;
    while(true) {
        bfs(g, level, s);
        if(level[t] < 0) {
            return flow;
        }
        for(int i=0; i<iter.size(); ++i) {
            iter[i] = 0;
        }
        weight f;
        while((f = dfs(g, level, iter, s, t, INF)) > 0) {
            flow += f;
        }
    }
}

void dfs(graph& g, int v, vector<int>& vis, int type) {
    vis[v] = 1;
    for(auto& e : g[v]) {
        if(vis[e.to] == 1) {
            continue;
        }
        if(type == 1 && e.cap == 1 || type == 2 && e.cap == 0) {
            dfs(g, e.to, vis, type);
        }
    }
}

int main() {
    int N, M, S, T;
    while(cin >> N >> M >> S >> T, N) {
        S--; T--;
        graph g(N);
        for(int i = 0; i < M; ++i) {
            int a, b;
            cin >> a >> b;
            a--; b--;
            add_edge(g, a, b, 1);
        }
        int flow = max_flow(g, S, T);
        vector<int> v(N), w(N);
        dfs(g, S, v, 1);
        dfs(g, T, w, 2);
        int cnt = 0;
        for(int i = 0; i < N; ++i) {
            for(auto& e : g[i]) {
                if(!e.is_rev && e.cap == 1 && w[i] && v[e.to]) {
                    cnt++;
                }
            }
        }
        flow += cnt > 0;
        cout << flow << ' ' << cnt << endl;
    }
}


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

vector<int> biEdit(int num,vector<int> &swOnOff){
    int idx = 0;
    
    while(true){
        swOnOff.at(idx) = num % 2;
        num = num / 2;
        if(num == 0){
            break;
        }
        
        idx++;
    }
    
    return swOnOff;
}

int main(){
    int N,M,K,swNumber,cnt,sum;
    bool flg;
    cnt = 0;
    sum = 0;
    flg = true;
    
    cin >> N >> M;
    
    vector<vector<int>> swtch(M);
    vector<int> p(M,0);
    vector<int> swOnOff(N,0);
    vector<int> liFlg(M,false);
    //電球iのつながっているスイッチの個数を入力
    for(int i = 0; i < M; i++){
        cin >> K;
        for(int j = 0; j < K; j++){
            cin >> swNumber;
            --swNumber;
            swtch.at(i).push_back(swNumber);
        }
    }
    
    //Pを入力
     for(int i = 0; i < M; i++){
        cin >> p.at(i);
    }
    
    //全ての電球が点灯する組み合わせの個数を計算
    for(int bit = 0; bit < (1<<N); bit++){
        //10進→2進変換
        swOnOff = biEdit(bit,swOnOff);
        //電球ON/OFFを決める
        for(int i = 0; i < swtch.size(); i++){
            sum = 0;
            //スイッチがONの数を算出
            for(int j = 0; j < swtch.at(i).size(); j++){
                //if(bit>>swtch.at(i).at(j) & 1) sum++;
                sum += swOnOff.at(swtch.at(i).at(j));
            }
            //電球ON/OFF判定
            if(sum % 2 != p.at(i)){
               flg = false;
               break;
            }
        }
        //全ての電球がONならカウント変数+1する
        if(flg){
            cnt++;
        }
        
        flg = true;
    }
    
    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
using namespace std;
typedef long long ll;

int main(void) {
//	string s;
	int x;
	cin >> x;
	
	if (100 <= x && x <= 110) cout << "111" << endl;
	else if (112 <= x && x <= 221) cout << "222" << endl;
	else if (223 <= x && x <= 332) cout << "333" << endl;
	else if (334 <= x && x <= 443) cout << "444" << endl;
	else if (445 <= x && x <= 554) cout << "555" << endl;
	else if (556 <= x && x <= 665) cout << "666" << endl;
	else if (667 <= x && x <= 776) cout << "777" << endl;
	else if (778 <= x && x <= 887) cout << "888" << endl;
	else if (889 <= x && x <= 998) cout << "999" << endl;
	else
		cout << x << endl;
	return 0;
}



Measured memory_bytes: 256
/*input
4 2000
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k, x; cin >> k >> x;
    if(k * 500 >= x) cout << "Yes";
    else cout << "No";

    return 0;
}

Measured memory_bytes: 256
N = int(input())

P = [(0, 0, 0)]

for i in range(N):
    t, x, y = map(int, input().split())
    P.append((t, x, y))

for i in range(1, N+1):
    dt = P[i][0] - P[i-1][0]
    dx = P[i][1] - P[i-1][1]
    dy = P[i][2] - P[i-1][2]

    dist = abs(dx) + abs(dy)

    if dt < dist:
        print('No')
        exit()

    if (dt - dist) % 2:
        print('No')
        exit()

print('Yes')


Measured memory_bytes: 17308
#if loc||local
#define _GLIBCXX_DEBUG
#endif

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  vector<ll> sum(n+1);
  rep(i,n)sum[i+1] = sum[i]+a[i];

  ll ans = 0;
  for(int i=0;i+1<n;++i){
    ll tmp = sum[n]-sum[i+1];
    tmp %= MOD;
    ans += a[i]*tmp%MOD;
    ans %= MOD;
  }
  cout<<(ans)<<endl;

}


Measured memory_bytes: 6420
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

#define rep(i,n) for(int i=0;i<n;i++)
#define dup(x,y) (((x)+(y)-1)/(y)) // dup * y >= x なる最小のdup.
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int f(int n) {
  if( (n&1)==0) return n/2;
  else return 3*n + 1;
}


int main() {
  int N;
  cin >> N;
  int h[N];
  rep(i, N) cin >> h[i];

  int ans = 0;
  ans += h[0];
  rep(i, N-1) {
    ans += max(0, h[i+1]-h[i]);
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
/// 2:39 PM 12/05/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>

using namespace std;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define VARIABLE_ERROR(x) cout << #x << " = " << x << endl;
#define CONTAINER_ERROR(v) cout << "{";for (auto &x:v) { cout << x << ','; }cout << "}" << endl;
#define PI 3.14159265358979323846
#define M 1000000007
#define INF 1e15
typedef long long ll;

ll dfs(ll v, vector<vector<ll> > &G, vector<vector<ll> > &dp, ll colour, ll parent) {
    if (dp[v][colour] != -1) {
        return dp[v][colour];
    }
    ll ans = 1;
    for (auto x:G[v]) {
        ll temp = 0;
        if(x == parent) {
            continue;
        }
        if (colour == 1) {
            temp = (dfs(x, G, dp, 2, v)) % M;
        }
        if (colour == 2) {
            temp = ( dfs(x, G, dp, 2, v)) % M;
            temp = (temp + dfs(x, G, dp, 1, v)) % M;
        }
        ans = (ans * temp) % M;
    }
    return dp[v][colour] = ans;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin >> n;
    vector<vector<ll> > G(n);
    for (ll i = 1; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    vector<vector<ll> > dp(n, vector<ll>(3, -1));
    ll ans = dfs(0, G, dp, 1, -1);
    ans = (ans + dfs(0, G, dp, 2, -1));
    ans = (ans % M);
    cout << ans;
    return 0;
}

Measured memory_bytes: 20992
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations
n,m,r,*L=map(int,open(0).read().split())
f=floyd_warshall(csr_matrix((L[r+2::3],(L[r::3],L[r+1::3])),(n+1,n+1)),0)
print(int(min(sum(f[s,t]for s,t in zip(o,o[1:]))for o in permutations(L[:r]))))

Measured memory_bytes: 22224
#include <iostream>
using namespace std;
int fl(int a,int n){
    if(a>n/2) return -1;
    else return 1;
}
int main(){
    int n;
    cin >> n;
    long long a[n];
    for(int i = 0;i<n;i++) cin >> a[i];
    long long ans[n];
    ans[0] = a[n-1];
    int loc = n-1;
    for(int i = n-2;i>=0;i--){
        ans[loc] = a[i];
        loc+=(fl(loc,n)*i);
    }
    for(int i = 0;i<n;i++) cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 5248
#include<cmath>
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<cstdio>
#include<map>
#include<utility>
#include<list>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fori(i,k,n) for(int i=k;i<(int)n;i++)
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};


/*
(char)'1' - (int)48 = (int)1;


*/


int a[300000] = {};
int main()
{
	for (int i = 2; i < 300000; i++)a[i] = 1;
	for (int i = 2; i < 300000; i++)
	{
		if (a[i] == 1)
		{
			for (int l = i * 2; l < 300000; l += i)
			{
				a[l] = 0;
			}
		}
	}
	for (int i = 2; i < 300000; i++)a[i] += a[i - 1];

	int n;
	cin >> n;
	while (n != 0)
	{
		cout << a[2*n] - a[n] << endl;
		cin >> n;
	}
}

Measured memory_bytes: 2332
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <numeric>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int,int>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

	string S;
	cin >> S;

	int N = (int)S.size();
	int a = 0, b = 0;

	for (int i = 0; i < N; i++) {
		if(S[i]=='0'){
			a++;
		}else{
			b++;
		}
	}

	cout << 2 * min(a, b) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  string s[100];
  int t[100];
  for (int i = 0; i < N; i++) {
    cin >> s[i] >> t[i];
  }
  string X;
  cin >> X;

  int sum = 0;
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (flag) {
      sum += t[i];
    }
    if (s[i] == X) {
      flag = true;
    }
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
public class MainClass
{
	public const long Giri = 1000000007;
	public const long DpInf = 99999999999999;
	
	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		Console.WriteLine(s.Contains("AC")?"Yes":"No");
		
	}
	
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str, int offset = 0)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt() + offset;
		return r;
	}
}

Measured memory_bytes: 25744
#include<bits/stdc++.h>
#define forn(i,n) for(int i=1;i<=n;i++)
#define forRn(i,n) for(int i=n;i>=1;i--)
#define forz(i,n) for(int i=0;i<n;i++)
#define forRz(i,n) for(int i=n-1;i>=0;i--)
#define forab(i,a,b) for(int i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define magic ios::sync_with_stdio(false); cin.tie(nullptr)
using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pdd = pair<double, double>;
using vi = vector<int>;

const int KyaRyunHa = 7;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int dx[] = { -1, 0, 1, 0, -1, 1, 1, -1 };
const int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

int test,N,M,K;

int arr[300005];

int main(void)
{

    double T,X;
    scanf("%lf %lf",&T,&X);
    printf("%.5f",T/X);
}


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

int main(){
  int H,W;
  while(cin>>H>>W){
    if(H==0 && W==0){break;}
    cout << string(W,'#') <<"\n";
    REP(i,H-2){
      cout << "#" << string(W-2,'.') <<"#\n";
    }
    cout << string(W,'#') <<"\n";
    cout << "\n";
  }
}


Measured memory_bytes: 3004
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  string T;
  cin >> T;
  for (auto &c : T)
    cout << (c == '?' ? 'D' : c);
  cout << endl;
}

Measured memory_bytes: 3772
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
#define mxn 100000
int n,s,a[mxn|2];
int dist(int p0,int p1) {
	return abs(a[p0]-a[p1]);
}
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",a+i),s+=dist(i-1,i);
	s+=dist(0,n);
	for(int i=1;i<=n;i++) {
		bool l=0,r=0;
		if(a[i-1]>a[i])	l=1;
		if(a[i+1]>a[i])	r=1;
		if(l^r)	printf("%d\n",s);
		else	printf("%d\n",s-2*min(dist(i,i-1),dist(i,i+1)));
	}
	return 0;
}

Measured memory_bytes: 1664
mod=10**9+7
N=int(input())
Fact=[1 for i in range(N+1)]
Finv=[1 for i in range(N+1)]
for i in range(N):
    Fact[i+1]=(Fact[i]*(i+1))%mod
Finv[N]=pow(Fact[N],mod-2,mod)
for i in range(N-1,-1,-1):
    Finv[i]=((i+1)*Finv[i+1])%mod
ans=0
SGL=[0 for i in range(N)]
for K in range(N):
    if 2*K-N<0:
        continue
    SGL[K]=(((Fact[K]*Finv[2*K-N])%mod)*Fact[K-1])
for K in range(1,N):
    ans+=((SGL[K]-SGL[K-1])*K)%mod
    ans%=mod
print(ans)


Measured memory_bytes: 129656
# include "queue"
# include "cstdio"
# include "cstring" 

using namespace std; 

int k,ne,h[100004];

struct edge{
    int to,nt,w;
}e[500004];

queue<int>q;

int dis[100004];

void add(int u,int v,int w){
     e[++ne].to = v;e[ne].nt = h[u];
     e[ne].w=w;
     h[u]=ne;
}
int main(){
    scanf("%d",&k);
    for(int i=0;i<k;i++){
        add(i,(i+1)%k,1);
        add(i,(i*10)%k,0);
    }
    q.push(1);
    memset(dis,127/3,sizeof(dis));
    dis[1]=0;
    while(!q.empty()){
        int x=q.front();q.pop();
        for(int i=h[x];i;i=e[i].nt){
            if(dis[e[i].to]>dis[x]+e[i].w){
            	dis[e[i].to]=dis[x]+e[i].w;
            	q.push(e[i].to);
            }
        }
    }
    printf("%d\n",dis[0]+1);
    return 0;
} 

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

int main(){
	int n, m;
	cin >> n >> m;
	
	int maxl = 0;
	int minr = n;
	rep(i, m){
		int l, r;
		cin >> l >> r;
		maxl = max(maxl, l);
		minr = min(minr, r);
	}

	int ans = minr - maxl + 1;
	ans = max(ans, 0);

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 int u=1e5+5;
int main(){
	string s,p;
	cin>>s>>p;
	int n=s.length();
	int m=p.length();
	vector<vector<int>>dp(n+1,vector<int>(m+1,0));
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++)
	if(s[i-1]==p[j-1])
	dp[i][j]=dp[i-1][j-1]+1;
	else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
	int i=n,j=m,k=dp[n][m];
	string ans;
	while(k){
		if(s[i-1]==p[j-1])
		ans.push_back(s[i-1]),k--,i--,j--;
		else {
			if(dp[i-1][j]>dp[i][j-1])
			i--;
			else 
			j--;
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
 
}

Measured memory_bytes: 38532
#include <bits/stdc++.h>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <stack>
#define LL long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=1;i<=n;i++)
#define repp(i,x,y) for(int i=x;i<=y;i++)
#define INF INT_MAX
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a+b==15)cout<<'+'<<endl;
	else if(a*b==15)cout<<'*'<<endl;
	else cout<<'x'<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,s=0;
	for(i=0;i<3;i++)
	{
		cin>>n;
		s+=n;
		if(i!=2)
			s*=10;
	}
	if(s%4==0)
		cout<<"YES";
	else 
		cout<<"NO";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	int h[n];
	for (int i = 0; i < n; ++i)
	{
		scanf("%d",&h[i]);
	}
	int ans = 0;
	for (int i = 0; i < 100000; ++i)
	{
		int count = 0;
		for (int j = 0; j < n; ++j)
		{
			if(count>0&&h[j]==0){
				break;
			}
			if(h[j]>0){
				count++;
				h[j]=h[j]-1;
			}
		}
		if(count==0){
			break;
		}
		ans++;
	}
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 128
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>



using namespace std;

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

int main(){
  ll N,A,B;
  cin >> N >> A >> B;
  ll k = N/(A+B);
  N -= (A+B)*k;
  cout << k*A + min(A,N) << endl;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int dp[32];

void solve()
{
	dp[0] = 1;
	dp[1] = 2;
	dp[2] = 4;
	for(int i = 3; i < 30; ++i)
	{
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	}
	int n;
	while(cin >> n, n)
	{
		cout << dp[n - 1] / 3650 + 1 << endl;
	}
}

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

Measured memory_bytes: 0
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	string result;
	int Length;
	int place = 0;


	cin >> s;

	Length = (int)(s.length());

	for(int i = 0; i < Length; i++){
		if(s.at(i) == '1'){
			result += '1';
			place++;
		}else if(s.at(i) == '0'){
			result += '0';
			place++;
		}else if(s.at(i) == 'B'){
			if(place != 0){
				place--;
				result.erase(place);
			}
		}
	}

	cout << result << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

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

  if(n<=2){
    cout<<1<<endl;
    return 0;
  }

  llong c[n];
  REP(i,n){
    cin>>c[i];
  }
  vector<LP> interval;
  map<llong,llong> ma;//直前の番号
  llong zeroColor = c[0];
  REP(i,n){
    if(ma[c[i]]==0&&c[i]==zeroColor&&i>1){
      LP lp;
      lp.first = 0;
      lp.second = i;
      interval.pb(lp);
    }else if(ma[c[i]] != 0&&(i-ma[c[i]])>1){
      LP lp;
      lp.first = ma[c[i]];
      lp.second = i;
      interval.pb(lp);
    }
    ma[c[i]] = i;
  }
  VSORT(interval);

  REP(i,interval.size()){
    //cout<<interval[i].first<<"      "<<interval[i].second<<endl;
  }

  llong m = interval.size();//間の個数
  llong counter = m-1;

  if(m==0){
    cout<<1<<endl;
    return 0;
  }

  llong dp[n];
  dp[n-1] = 1;
  for(int i=n-2;i>=0;i--){
    if(i == interval[counter].first){
      dp[i] = dp[i+1] + dp[interval[counter].second];
      dp[i] = dp[i]%((llong)pow(10,9)+7);
      if(counter!=0)counter--;
    }else{
      dp[i] = dp[i+1];
    }
  }
  cout<<dp[0]<<endl;

 

  return 0;
}

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

vector<bool> seen;
vector<int> first;
vector<int> last;

void dfs(const vector<vector<int>> &g, int v, int &ptr){
  first[v] = ptr++;
  seen[v] = true;
  
  for(int i : g[v]){
    if(seen[i]) continue;
    dfs(g,i,ptr);
  }
  
  last[v] = ptr++;
}

int main() {
  int n;
  cin >> n;
  seen.assign(n,false);
  first.resize(n);
  last.resize(n);
  
  vector<vector<int>> g(n);
  
  rep(i,n){
    int u, k;
    cin >> u >> k;
    u--;
    vector<int> v(k);
    rep(j,k){
      cin >> v[j];
      v[j]--;
      g[u].push_back(v[j]);
    } 
  }
  int ptr = 1;
  rep(i,n){
    if(first[i] == 0){
      dfs(g,i,ptr);
    }
  }


  rep(i,n){
    cout << i + 1 << ' ' <<first[i] << ' ' << last[i] << endl;
  } 
}



Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <string>
#define ll long long
#define MOD 1000000007
using namespace std;

int main(){
  int n; cin >>n;
  vector<ll> a(n); 
  int res = 0; ll sum = 0;
  ll m = 10000000000;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i] <= 0){
      res++;
      sum -= a[i];
      m = min(m,-a[i]);
    }
    else{
      sum += a[i];
      m = min(m,a[i]);
    }
  }
  if(res % 2 == 0) cout << sum;
  else cout << sum - 2*m;
  return 0;
}



Measured memory_bytes: 1024
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,a,b;
    cin>>n>>a>>b;
    string s;
    cin>>s;

    int x=0,y=0;
    for(int i=0;i<n;i++){
        if(s[i]=='a'){
            if(x<a+b){
                cout<<"Yes\n";
                x++;
            }
            else    cout<<"No\n";
        }
        else if(s[i]=='b'){
            if(x<a+b && y<b){
                cout<<"Yes\n";
                x++,y++;
            }
            else    cout<<"No\n";
        }
        else    cout<<"No\n";
    }
    return 0;
}



Measured memory_bytes: 848
N = int(input())

flag = False
counter = 0
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        counter += 1
    else:
        counter = 0
    if counter >= 3:
        flag = True
        break
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

typedef string::iterator State;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
string S;

ll g(State &itr);
char f(State &itr, ll n) {
    auto itr2 = itr;
    //cerr << *itr << " "<< n << endl;
    if(*itr <= '9' && *itr >= '0') {
        ll num = 0;
        while(*itr <= '9' && *itr >= '0') {
            num *= 10;
            num += *itr - '0';
            itr++;
        }
        itr2 = itr;
        ll unit = g(itr);
        ll ret = num * unit;
        //cerr << *itr2 << " " << unit << " " << num << " "<< ret << endl;
        if(ret <= n) {
            return f(itr, n - ret);
        } else {
            n %= unit;
            if(*itr2 == '(') itr2++;
            return f(itr2, n);
        }
    }
    //assert(*itr <= 'Z' && *itr >= 'A');
    if(n == 0) return *itr;
    itr++;
    return f(itr, n - 1);
}

ll g(State &itr) {
    if(*itr == '(') {
        itr++;
        ll ret = 0;
        while(*itr != ')') {
            ret += g(itr);
        }
        itr++;
        return ret;
    }
    if(*itr <= 'Z' && *itr >= 'A') {
        itr++;
        return 1;
    }
    if(*itr <= '9' && *itr >= '0') {
        ll num = 0;
        while(*itr <= '9' && *itr >= '0') {
            num *= 10;
            num += *itr - '0';
            itr++;
        }
        ll ret = g(itr) * num;
        return min((ll)10000000, ret);
    }
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true) {
        cin >> S;
        if(S == "0") break;
        ll n;
        cin >> n;
        S = "(" + S + ")";
        auto itr = S.begin();
        //cout << g(itr) << endl;
        if(g(itr) <= n) {
            cout << "0" << endl;
            continue;
        }
        itr = S.begin();
        itr++;
        cout << f(itr, n) << endl;
    }
    return 0;
}


Measured memory_bytes: 3160
n = int(input())
dp = [0] * (10**6+5)
for i in range(1, n+1):
  dp[i] = float("inf")
  power = 1
  while True:
    if i - power < 0:
      break
    dp[i] = min(dp[i], dp[i-power] + 1)
    power *= 6
  power = 1
  while True:
    if i - power < 0:
      break
    dp[i] = min(dp[i], dp[i-power] + 1)
    power *= 9
print(dp[n])


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <stdint.h>
#include <string.h>

#include <unordered_set>

#define _USE_MATH_DEFINES
#include <math.h>


#include <vector>
#include <list>

#include <set>
#include <map>

#include <unordered_map>

#include <queue>
#include <stack>

#include <string>

#include <vector>

#define sqr(x) (x) * (x)

#include <algorithm>
#include <functional>

#include <bitset>

#include <functional>

#include <chrono>

typedef unsigned int u32;
typedef int i32;

typedef unsigned long long int u64;
typedef long long int i64;

typedef uint16_t u16;
typedef int16_t i16;

typedef uint8_t u8;
typedef int8_t i8;


using namespace std;
using namespace std::chrono;

struct less_key
{
    bool operator() (pair<i64, i64> p1, pair<i64, i64> p2)
    {
        return p1.first > p2.first || (p1.first == p2.first && p1.second < p2.second);
    }
};

struct pair_hash {
public:
    std::size_t operator()(const std::pair<u64, u64> &x) const
    {
        return std::hash<u64>()(x.first) ^ std::hash<u64>()(x.second);
    }
};
#include <random>

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 10000000000000007ll;

const double eps = 1e-10;

// del

const i64 MAXN = 300005;

i64 n;

vector<i64> e[MAXN];
i64 c[MAXN];
i64 a[MAXN];

i64 dfs(i64 cc, i64 p, i64& k) {
    a[cc] = c[k++];

    i64 R = 0;

    for (auto t : e[cc]) {
        if (t == p) {
            continue;
        }

        R += dfs(t, cc, k);
        R += min(a[cc], a[t]);
    }

    return R;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> n;

    for (i64 i = 0; i < n - 1; i++) {
        i64 v0, v1;
        cin >> v0 >> v1;

        e[v0].push_back(v1);
        e[v1].push_back(v0);
    }

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

    sort(c, c + n, greater<i64>());

    //map<i64, vector<i64>> q;
    //for (i64 i = 1; i <= n; i++) {
    //    q[e[i].size()].push_back(i);
    //}

    //i64 k = 0;
    //for (auto it = q.rbegin(); it != q.rend(); it++) {
    //    for (auto t : it->second) {
    //        a[t] = c[k++];
    //    }
    //}

    i64 k = 0;
    i64 R = dfs(1, 0, k);
    cout << R << endl;

    for (i64 i = 1; i <= n; i++) {
        cout << a[i] << " ";
    }


    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
#define lli long long int  
#define ll  long long 
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(),v.rend() //reverse
#define vl   vector<lli>
#define mii unordered_map<ll,ll>
#define pb push_back
double pi = 2*acos(0.0);
const int INF = 1e9 + 7;
//ull power(ull a,ull b){ ull res=1;while(b){if(b&1)res=res*a;b=b/2; a=(a*a); }return res;}
bool sortinrev(const pair<int,int> &a,   const pair<int,int> &b) {  if(a.second==b.second) return a.first>b.first;  return (a.second > b.second);} 






void WetPitch()
{
  lli n;
  cin>>n;
  lli arr[n];
  for(int i=0;i<n;i++)
  	cin>>arr[i];

  lli maxi=arr[0];
  lli ans=0;
  for(int i=1;i<n;i++)
  {
  	if(arr[i]<arr[i-1])
  	{
  		ans=ans+(arr[i-1]-arr[i]);
  		arr[i]=arr[i-1];
  	}
  }


cout<<ans<<endl;

}     
signed main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	lli tst;
    tst=1; 
    //cin>>tst;
    while(tst--)
    WetPitch();
    return 0;
 } 

Measured memory_bytes: 5184
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Minor Change
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N + 4], t[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  scanf("%s%s", s, t);
  int n = strlen(s);

  int c = 0;
  for (int i = 0; s[i]; i++)
    if (s[i] != t[i]) c++;

  printf("%d\n", c);
  return 0;
}


Measured memory_bytes: 3436
from math import sqrt
q = int(input())
while(q):
    a, b = map(int, input().split())
    c = a * b
    d = int(sqrt(c))
    if(a == b):
        print((d-1) * 2)
    elif(d*d == c):
        print((d-1)*2 - 1)
    elif(d * (d + 1) < c):
        print(d*2 - 1)
    else:
        print((d-1) * 2)
    q -= 1

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		int a,b,c;
      cin>>a>>b>>c;
      if((a==b&&b!=c)||(b==c&&a!=b)||(a==c&&a!=b))
        cout<<"Yes";
      else
        cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REP(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {

  ll H, W;
  cin >> H >> W;

  vector<string> S;
  string s_in;
  REP(i, 0, H) {
    cin >> s_in;
    S.push_back(s_in);
  }

  // input
  ll s[H][W];
  REP(i, 0, H) {
    REP(j, 0, W) {
      if (S[i].substr(j, 1) == "#")
        s[i][j] = 1;
      else
        s[i][j] = 0;
      // cout << s[i][j];
    }
    // cout << endl;
  }

  // main algorihm
  // ll ans = 0;
  // REP(i, 0, H) {
  //   REP(j, 0, W) {
  //     if(s[i][j] != 0)
  //       continue;
  //     // calc yoko
  //     ll count = 0;
  //     while((j+count < W) && (s[i][j+count] == 0)) {
  //       count++;
  //     }
  //     REP(ii, 0, count) {
  //       ll count_ = 0;
  //       while((i+count_ < H) && (s[i+count_][j+ii] == 0)) {
  //         count_++;
  //       }
  //       ll count__ = 0;
  //       while((i-count__ >= 0) && (s[i-count__][j+ii] == 0)) {
  //         count__++;
  //       }
  //       ans = max(ans, count + count_ + count__ - 2); // subtract light itself
  //     }
  //   }
  // }

  // cout << "===========" << endl;

  // main algorithm
  ll ans = 0;
  ll yoko[H][W];
  REP(i, 0, H) {
    REP(j, 0, W) {
      yoko[i][j] = -1;
    }
  }

  REP(i, 0, H) {
    REP(j, 0, W) {
      if (yoko[i][j] != -1) {
        continue;
      }
      if(s[i][j] != 0) {
        yoko[i][j] = 0;
        continue;
      }
      // calc yoko
      ll count = 0;
      while((j+count < W) && (s[i][j+count] == 0)) {
        count++;
      }
      ll count_ = 0;
      while((j-count_ >= 0) && (s[i][j-count_] == 0)) {
        count_++;
        // cout << "i, j: " << i << ", " << j << endl;
      }
      for(int k=-count_+1; k<=count-1; k++) {
        yoko[i][j+k] += count + count_;
      }
      // cout << "i, j: " << i << ", " << j << endl;
    }
  }

  // cout << "########" << endl;

  ll tate[H][W];
  REP(i, 0, H) {
    REP(j, 0, W) {
      tate[i][j] = -1;
    }
  }

  REP(i, 0, H) {
    REP(j, 0, W) {
      if (tate[i][j] != -1) {
        continue;
      }
      if(s[i][j] != 0) {
        tate[i][j] = 0;
        continue;
      }
      // calc tate
      ll count = 0;
      while((i+count < H) && (s[i+count][j] == 0)) {
        count++;
      }
      ll count_ = 0;
      while((i-count_ >= 0) && (s[i-count_][j] == 0)) {
        count_++;
      }
      for(int k=-count_+1; k<=count-1; k++) {
        tate[i+k][j] += count + count_;
      }
    }
  }

  REP(i, 0, H) {
    REP(j, 0, W) {
        // cout << "i, j: " << i << ", " << j << endl;
        // cout << "yoko: " << yoko[i][j] << ", tate: " << tate[i][j] << endl;
      ll now = yoko[i][j] + tate[i][j] - 1;
      if ( (yoko[i][j] == 0) && (tate[i][j] == 0) ) {
        now = 0;
      }
      ans = max(ans, now);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 98176
#include <stdio.h>
int main()
{
  int i,j,min,n,count=0,s;
  int array[100];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&array[i]);
  }
  for(i=0;i<n;i++){
    min=i;
    for(j=i;j<n;j++){
      if(array[j]<array[min]){
	min=j;
      }
    }
    s=array[i];
    array[i]=array[min];
    array[min]=s;
    if(array[i]!=array[min]){
    count++;
    }
  }

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

Measured memory_bytes: 600
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<P> ab(n); for (auto &e: ab) cin >> e.first >> e.second;
    vector<ll> a(n), b(n); rep (i, n) {a[i] = ab[i].first; b[i] = ab[i].second;}
    sort(all(a)); sort(all(b));
    if (n % 2 == 0) {
        ll ans = (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]);
        cout << ans + 1 << "\n";
    } else {
        ll ans = b[n / 2] - a[n / 2];
        cout << ans + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 7952
#include<stdio.h>

int main(){
  int S;
  int h,m,s;
  scanf("%d",&S);

  h = S / 3600;
  m = S % 3600 /60;
  s = S % 3600 % 60;

  printf("%d:%d:%d\n",h,m,s);

  return 0;
}

Measured memory_bytes: 592
import heapq

N,M =map(int,input().split())
A=[-int(i) for i in input().split()] # 逆転

heapq.heapify(A)

for i in range(M):
  v = heapq.heappop(A) # 最大値をpop
  heapq.heappush(A,-(-v//2)) # 最大値を切り捨て半額にしてpush
  
print(-sum(A)) # 正負を戻す

Measured memory_bytes: 14180
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n, d;
  vector<int> vec;
  
  scanf("%d",&n);

  for(int i=0;i<n;i++){
    scanf("%d",&d);
    vec.push_back(d);
  }

  sort(vec.begin(),vec.end());
  cout << unique(vec.begin(),vec.end()) - vec.begin() << endl;
  
  
  return 0;
}


Measured memory_bytes: 256