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

using DD = double;
const DD INF = 1LL<<60;      // to be set appropriately
const DD EPS = 1e-10;        // to be set appropriately
const DD PI = acos(-1.0);
DD torad(int deg) {return (DD)(deg) * PI / 180;}
DD todeg(DD ang) {return ang * 180 / PI;}

/* Point */
struct Point {
    DD x, y;
    Point(DD x = 0.0, DD y = 0.0) : x(x), y(y) {}
    friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};
inline Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
inline Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
inline Point operator * (const Point &p, DD a) {return Point(p.x * a, p.y * a);}
inline Point operator * (DD a, const Point &p) {return Point(a * p.x, a * p.y);}
inline Point operator * (const Point &p, const Point &q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
inline Point operator / (const Point &p, DD a) {return Point(p.x / a, p.y / a);}
inline Point conj(const Point &p) {return Point(p.x, -p.y);}
inline Point rot(const Point &p, DD ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
inline Point rot90(const Point &p) {return Point(-p.y, p.x);}
inline DD cross(const Point &p, const Point &q) {return p.x * q.y - p.y * q.x;}
inline DD dot(const Point &p, const Point &q) {return p.x * q.x + p.y * q.y;}
inline DD norm(const Point &p) {return dot(p, p);}
inline DD abs(const Point &p) {return sqrt(dot(p, p));}
inline DD amp(const Point &p) {DD res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;}
inline bool eq(const Point &p, const Point &q) {return abs(p - q) < EPS;}
inline bool operator < (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x < q.x : p.y < q.y);}
inline bool operator > (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x > q.x : p.y > q.y);}
inline Point operator / (const Point &p, const Point &q) {return p * conj(q) / norm(q);}

void solve(const vector<Point> &vp) {
    int N = (int)vp.size();
    if (N & 1) { cout << "NA" << endl; return; }
    auto res = (vp[0] + vp[N/2]) / 2;
    for (int i = 0; i < N/2; ++i) {
        if (abs(abs(res - vp[i]) - abs(res - vp[i+N/2])) > EPS) {
            cout << "NA" << endl;
            return;
        }
    }
    cout << fixed << setprecision(10) << res.x << " " << res.y << endl;
    return;
}

int main() {
    int N; cin >> N;
    vector<Point> vp(N);
    for (int i = 0; i < N; ++i) cin >> vp[i].x >> vp[i].y;
    solve(vp);
}


Measured memory_bytes: 3288
#include<iostream>
#include<vector>

using namespace std;

int main() {
	int *up, *down, n, ame, sum_ame, i;

	cin >> n;

	up = new int[n];
	down = new int[n];

	cin >> ame;
	up[0] = ame;

	for (i = 1; i < n; i++) {
		cin >> ame;
		up[i] = ame + up[i - 1];
	}

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

	for (i = n - 2; i >= 0; i--) {
		down[i] += down[i + 1];
	}

	sum_ame = up[0] + down[0];

	for (i = 1; i < n; i++) 
		sum_ame = sum_ame < (up[i] + down[i]) ? (up[i] + down[i]) : sum_ame;
	
	cout << sum_ame;

	return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        Arrays.sort(a);
        long r = 0;
        for (int i = 0; i < n; i++) {
            if (Math.abs(a[i] - (double) a[n - 1] / 2) < Math.abs(r - (double) a[n - 1] / 2)) {
                r = a[i];
            }
        }
        System.out.println(a[n - 1] + " " + r);
    }

}


Measured memory_bytes: 50720
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
#define diup(a, b) (a % b == 0 ? a / b : a / b + 1)
#define exist_in(list, value) (list.end() != std::find(all(list),value))
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
//template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
//template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
//template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
//template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
//template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }
//template<class T1, class T2> bool exist_in(const T1& list, const T2& v) { return (list.end() != std::find(list.begin(), list.end(), v)); }
//template<class T> bool exist_in(const T& c, const typename T::value_type& v) {	return (c.end() != std::find(c.begin(), c.end(), v));}

/*****/

void Main()
{
	int n;
	cin >> n;
	cout << "ABC" << n;
}

/*****/

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

	std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second

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


	ll n,m,k;
	cin>>n>>m>>k;
	ll x=max(n,m);
	cout<<ceil(1.0*k/x)<<'\n';
}


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

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  ll a = abs(x) / d;
  ll r = k - a;

  if (x >= 0) {
    if (a >= k) {
      x -= k * d;
      r = 0;
    } else {
      x -= a * d;
    }
  } else {
    if (a >= k) {
      x += k * d;
      r = 0;       
    } else  {
      x += a * d;
    }
  }

  if (r%2 == 0) {
    cout << abs(x) << endl;
  } else {
    if (x >= 0) {
     x -= d;
    } else {
     x += d;
    }
    cout << abs(x) << endl;
  }
  // while (k != 0) {
  //   if (x <= 0) x += d;
  //   else x -= d;
  //   k--;
  // }
  
  // cout << abs(x) << endl;
  return 0;
}

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

int main() {
    vector<vector<string> > lunlun(1, vector<string>(9));
    int k;
    cin >> k;
    
    rep(i, 9) {
        lunlun[0][i] = to_string(i+1);
    }

    
    ll num = 100;
    rep(keta_, 9) {
        lunlun.push_back(vector<string>(0));
        int cou = 0;
        int keta = keta_ + 1;
        string s = to_string(num-1);
        string nh = lunlun[keta_][0] + '0';
        while(nh != s) {
            //c
            if(abs(*(nh.end()-1) - *(nh.end()-2)) < 2) {
                lunlun[keta].push_back(nh);
                int hh = *(nh.end()-1);
                //cout << nh << endl;
                if(hh == '9') {
                    cou++;
                    nh = lunlun[keta_][cou] + '0';
                }
                else {
                    nh.pop_back();
                    nh.push_back(hh+1);
                }
            } else if(*(nh.end()-1) < *(nh.end()-2)) {
                int hh = *(nh.end()-1);
                nh.pop_back();
                nh.push_back(hh+1);
            } else {
                cou++;
                nh = lunlun[keta_][cou] + '0';
            }
            
        }
        lunlun[keta].push_back(to_string(num-1));

        num *= 10;
    }
    int a=0;
    while(1) {
        if(k > lunlun[a].size()) {
            k -= lunlun[a].size();
        } else {
            cout << lunlun[a][k-1] << endl;
            return 0;
        } 
        ++a;
    }
}

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

int main() {
    int n;
    int min_ = 1e6;
    int max_ = -1e6;
    long int sum_ = 0;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        min_ = min(min_, a);
        max_ = max(max_, a);
        sum_ += a;
    }
    

    cout << min_ << " " << max_ << " " << sum_ << endl;

    return 0;
}


Measured memory_bytes: 3112
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <complex>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x)end()
#define sz(x) (int)(x).size
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int main ()
{
	int n,m;
	scanf("%d%d",&n,&m);
	printf("%d\n",(n-1)*(m-1));

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const ld pi = 3.14159265358;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    while(true){
        cin >> N >> M;
        if(N == 0 && M == 0)break;
        ll cnt = 0;
        rep(i,N - 2){
            for(ll j = i + 1;j < N - 1;j++){
                for(ll k = j + 1;k < N;k++){
                    if(i + j + k + 3 == M)cnt++;
                }
            }
        }
        cout << cnt << "\n";
    }
}


Measured memory_bytes: 3184
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()

int main() {
  //
  int n;
  cin >> n;
  int cnt4 = 0, cnt2 = 0, cnt1 = 0;
  rep(i, n) {
    int a;
    cin >> a;
    if (a % 4 == 0) {
      cnt4++;
    } else if (a & 1) {
      cnt1++;
    } else {
      cnt2++;
    }
  }
  // cout << cnt4 << cnt1 << endl;
  if (cnt4 == cnt1 - 1) {
    if (cnt2 == 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  } else if (cnt4 == cnt1) {
    cout << "Yes" << endl;
  } else if (cnt1 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

bool isInRec(const int W, const int x, const int r)
{
	int p = x - r, q = x + r;
	if(p >= 0 && q <= W){
		return true;
	} else {
		return false;
	}
}

int main()
{
	int W, H, x, y, r;
	std::cin >> W >> H >> x >> y >> r;
	if(isInRec(W, x, r) && isInRec(H, y, r)){
		std::cout << "Yes\n";
	} else {
		std::cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 1128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
#define tl 1'000'000'007
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REREP(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, a, n) for (ll i = a; i < n; i++)
#define REFOR(i, n, a) for (ll i = n; i >= a; i--)
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false); 
    ll n,r;
    cin >> n >> r;
    if(n>=10) cout << r << endl;
    else cout << r+100*(10-n) << endl;
    
}


Measured memory_bytes: 256
def check(x, y)
  2.times do |z|
    4.times do
      return true if x == y
      a, b, c, d, e, f  = x
      x = z.zero? ? [e, a, c, d, f, b] : [d, b, a, f, e, c]
      c = x
      4.times do
        i, j, k, l, m, n = c
        c = [i, k, m, j, l, n]
        return true if c == y
      end
    end
  end
  false
end

g = $<.map{|h| h.chomp.split}.drop(1)
g.size.times do |x|
  (x+1).upto(g.size - 1) do |y|
    (puts 'No')^exit if check(g[x], g[y])
  end
end
puts 'Yes'

Measured memory_bytes: 10000
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main() {
    int K;
    cin >> K;

    vector<int> v = {0};
    int sz = 1;

    for(int k = 0; k < K; k++) {
        //step1 1プラスする桁を見つける
        int ind = -1;
        for(int i = 0; i < sz; i++) {
            if(i == sz - 1) {
                if(v[i] == 9) {
                    ind = i + 1;
                    v.push_back(1);
                    sz++;
                }
                else {
                    ind = i;
                    v[i]++;
                }
                break;
            }
            else if(v[i] != v[i + 1] + 1 && v[i] != 9) {
                ind = i;
                v[i]++;
                break;
            }
        }

        //下の桁をできるだけ小さく設定する
        for(int i = ind - 1; i >= 0; i--) {
            v[i] = max(v[i + 1] - 1, 0);
        }

        //print
        //for(int i = sz - 1; i >= 0; i--) {
        //    cout << v[i];
        //}
        //cout << endl;
    }

    for(int i = sz - 1; i >= 0; i--) {
        cout << v[i];
    }

    cout << endl;
    return 0;
}

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

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

    int h, w;
    cin >> h >> w;
    char C[h][w];
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> C[i][j];
        }
    }

    for(int i = 0; i < h + 2; i++){
        for(int j = 0; j < w + 2; j++){
            if(i == 0 or j == 0 or i == h + 1 or j == w + 1){
                cout << '#';
            }else{
                cout << C[i - 1][j - 1];
            }
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	static int n,m,p,a,b,bit;
	static int[] ticket;
	static int[][] edge;
	static double[][] dp;
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		for(;;){
			n=cin.nextInt();
			m=cin.nextInt();
			p=cin.nextInt();
			a=cin.nextInt();
			b=cin.nextInt();

			if(n+m+p+a+b==0)break;
			dp=new double[m+1][1<<8];
			for(int i=0;i<=m;i++){
				Arrays.fill(dp[i],Double.MAX_VALUE);
			}
			dp[a][0]=0.0;
			bit=0;
			ticket=new int[n];
			for(int i=0;i<n;i++){
				ticket[i]=cin.nextInt();
			}
			edge=new int[31][31];
			for(int i=0;i<31;i++){
				Arrays.fill(edge[i],1<<30);
			}
			for(int i=0;i<p;i++){
				int a=cin.nextInt();
				int b=cin.nextInt();
				edge[a][b]=edge[b][a]=cin.nextInt();
				
			}

			PriorityQueue<int[]> q = new PriorityQueue<int[]>(m+1,
					new Comparator<int[]>(){
						public int compare(int[] a,int[] b){
							return Double.compare(
									dp[a[0]][a[1]],
									dp[b[0]][b[1]]);
//							return Double.compare(a[2], b[2]);
						}
					});
			q.add(new int[]{a,bit});
			
			while(!q.isEmpty()){
				int[] array=q.poll();
				int city=(int)array[0];
				int used=(int)array[1];
				double cost=dp[city][used];
				if(city==b)break;
//				System.out.println(city+" "+Integer.toBinaryString(used)+" "+cost);
				for(int i=0;i<=m;i++){
					if(edge[city][i]!=1<<30){
						for(int j=0;j<ticket.length;j++){
							if(((1<<j)&used)==0){
								int uu=(used | 1<<j);
								double cc=cost+(double)edge[city][i]/(double)ticket[j];
//								System.out.println("  "+dp[i][uu]+" "+cc);
								if(Double.compare(dp[i][uu],cc)<=0){
									continue;
								}
								dp[i][uu]=cc;
								q.add(new int[]{i,uu});
							}
						}
					}
				}
			}
			/*
			while(!q.isEmpty()){
				int[] v = q.poll();
				System.out.println(v[0]+" "+Integer.toBinaryString(v[1])+" "+dp[v[0]][v[1]]);
				if(v[0]==b)break;
				for(int j=0;j<n;j++){
					if((v[1]&(1<<j))==1)continue;
					for(int t=1;t<=m;t++){
						if(edge[v[0]][t]==1<<30)continue;
						double w = dp[v[0]][v[1]] + edge[v[0]][t]*1.0/ticket[j];
						if(w < dp[t][v[1]+(1<<j)]){
							dp[t][v[1]+(1<<j)] = w;
							q.add(new int[]{t, v[1]+(1<<j)});
						}
					}
				}
			}
			*/
			double min=Double.MAX_VALUE;
			for(int i=0;i<1<<8;i++)
				if(Double.compare(Double.MAX_VALUE, dp[b][i])!=0)
					min=Math.min(min,dp[b][i]);
			
			if(Double.compare(min,Double.MAX_VALUE)==0){
				System.out.println("Impossible");
			}
			else
				System.out.printf("%.3f\n",min);
		}
	}

}

Measured memory_bytes: 41128
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    input!(
        n: usize,
        h: [usize; n],
    );

    let mut ans = 1;
    let mut mx = h[0];

    for i in 1..n {
        if h[i] >= mx {
            ans += 1;
        }
        mx = max(mx, h[i]);
    }
    println!("{}", ans);
}

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

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

    int l, r, d, sum = 0;
    cin >> l >> r >> d;

    for (int i = l; i <= r; ++i) {
        if (i % d == 0)
            sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,d,x;
    cin>>n>>d>>x;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin>>a.at(i);
    }
    int ans=0;
    for(int i=0; i<n; i++){
        int j=0,cnt=0;
        while(cnt<d){
            cnt=j*a.at(i)+1;
            if(cnt>d) break;
            if(cnt==d){
                ans++;
                break;
            }
            j++;
            ans++;
        }
    }
    ans=ans+x;
    cout<<ans<<endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<"\n";

vector<int>dp(1e5+1,-1);
vector<int>v;
int n;
int cal(int idx){
    if(idx >= n)
        return 1e9;
    if(idx==n-1)
        return 0;

    if(dp[idx]!=-1)
        return dp[idx];

    int ans1 = abs(v[idx] - v[idx+1]) + cal(idx+1),ans2=1e9;
    if(idx+2<n)
        ans2 = abs(v[idx] - v[idx+2]) + cal(idx+2);
    return  dp[idx] = min ( ans1,ans2);






}
int main()
{
    cin >> n;
    v.resize(n);
    for(auto &f : v)
        cin >> f;

    cout <<cal (0);

    return 0;
}


Measured memory_bytes: 5760
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int d,r;
        double f;
        d=a/b;
        String str1 = String.format("%d",d);
        System.out.print(str1+" ");
        r=a%b;
        String str2 = String.format("%d",r);
        System.out.print(str2+" ");
        f=(double)a/b;
        String str3 = String.format("%f",f);
        System.out.print(str3+" ");
    }
}



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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n,a;
    deque<int> ans;

    Scd(n);
    Rep(i,n){
        Scd(a);
        if( i%2 == 0 ){
            ans.push_back(a);
        }else{
            ans.push_front(a);
        }
    }
    if( n%2 == 0)
    Rep(i,n){
        printf ( n == i-1 ? "%d\n" : "%d ", ans[i]);
    }
    else
    Rep(i,n){
        printf ( n == i-1 ? "%d\n" : "%d ", ans[n-i-1]);
    }

    return 0;
}



Measured memory_bytes: 2944
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0

for i in range(n):
	if a[i] + a[i+1] >= b[i]:
		ans += b[i]
	else:
		ans += a[i] + a[i+1]
	if a[i] < b[i]:
		a[i+1] = a[i+1] - (b[i] - a[i])
		if a[i+1] < 0:
			a[i+1] = 0


print(ans)


Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int a,b,c; cin>>a>>b>>c;
	if(c>=a && c<=b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	return 0;
}

Measured memory_bytes: 3604
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010];//,ac[101000][101000];
bool r=false,ra,rb,rc;
string s,sa,sb,sc[100];
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;
set<ll> sta;
map<ll,ll> mpa;

vector<ll> digit(ll target,short dec=10,int kts=0){
    ll cri=dec;vector<ll> result;
    while(target){
        //r=(target%cri==2) and r;
        result.push_back(target%cri);
        target/=cri;
    }
    
    if(kts){
        //r=false;
        while(result.size()<kts)result.push_back(0);
    }
    if(result.size()>kts)r=true;
    
    return result;
}

template<typename MAIN> ostream & operator<<(ostream & osys,const vector<MAIN> target){ for(MAIN it:target)osys<<it<<" "; return osys; }

int main(){
    cin>>n>>a>>b>>c;
    ll ac[]={a,b,c};
    x=0;
    z=10000007;
    for(int i=0;i<n;i++){
        cin>>aa[i];
    }
    while(true){
        va=digit(x,4,n);
        if(r)break;
        //C va E;
        ab[0]=0;ab[1]=0;ab[2]=0;m=0;
        for(int i=0;i<n;i++){
            if(va[i]==3)continue;
            if(ab[va[i]])m+=10;
            ab[va[i]]+=aa[i];
        }
        ra=1;
        for(int i=0;i<3;i++){
            ra=ra and ab[i]!=0;
            m+=abs(ac[i]-ab[i]);
        }
        if(ra)z=min(m,z);
        x++;
    }

    C z E;

}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#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 REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    ll m = -1;
    ll ans = 0;
    ll a;
    REP(i, n) {
        cin >> a;
        if (m > a) {
            ans += m - a;
        } else {
            m = a;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
from itertools import accumulate
from collections import Counter
N,K,*A = map(int, open(0).read().split())
A = [a-1 for a in A]
B = [b%K for b in accumulate(A)]
if K>N:
  Cnt = Counter(B)
  ans = Cnt[0]+sum(v*(v-1)//2 for v in Cnt.values())
else:
  Cnt = Counter(B[:K])
  ans = Cnt[0]+sum(v*(v-1)//2 for v in Cnt.values())
  if B[K-1]==0:
    ans -= 1
  for i in range(N-K):
    Cnt[B[i]] -= 1
    ans += Cnt[B[i+K]]
    Cnt[B[i+K]] += 1
print(ans)

Measured memory_bytes: 40792
a,b,k=map(int,input().split())
if k<=(b-a+1)//2:
    A=set()
    for i in range(k):
        A.add(a+i)
        A.add(b-i)
    print(*sorted(A),sep="\n")
else:
    for i in range(a,b+1):
        print(i)

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

using namespace std;

#define ll long long
#define ull unsigned long long
#define re register
#define il inline
#define inf 0x3f3f3f

const ll maxn = 2e5 + 5;
ll n, E, T, x[maxn], f[maxn], ans, ok = 1e18;
ll l = 1, r = 1, q[maxn];
ll read() {
  ll x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-')
      f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return f * x;
}
int main() {
  memset(f, 0x3f, sizeof f);
  n = read(), E = read(), T = read();
  for (int i = 1; i <= n; ++i)
    x[i] = read();
  f[0] = 0;
  for (int i = 1; i <= n; ++i) {
    while (l <= r && 2 * (x[i] - x[q[l] + 1]) > T) {
      ok = min(ok, f[q[l]] - 2 * x[q[l] + 1]);
      l++;
    }
    f[i] = min(f[i], f[q[l]] + T);
    f[i] = min(f[i], ok + 2 * x[i]);
    q[++r] = i;
  }
  ans = f[n] + E;
  printf("%lld\n", ans);
  return 0;
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;
const long long MOD = (long long)1e9 + 7;

int main(){
    ll h, w;
    cin >> h >> w;
    if(h == 1 || w == 1){
        cout << 1 << endl;
        return 0;
    }
    ll ans = ((w + 1) / 2) * ((h + 1) / 2) + (w / 2) * (h / 2);
    cout << ans << endl;
    return 0;
}


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

int main()
{
	string s[110];
	int n, l;

	cin >> n >> l;

	for (int i = 0; i < n; i++){
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; i++){
		cout << s[i];
	}
	cout << endl;
	return (0);
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.append(0)
a.insert(0,0)
e=0
for i in range(1,n+2):
    e+=abs(a[i]-a[i-1])
for i in range(1,n+1):
    print(e-abs(a[i]-a[i-1])-abs(a[i+1]-a[i])+abs(a[i+1]-a[i-1]))

Measured memory_bytes: 14048
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define int long long
#define F first
#define S second
#define endl "\n"
using namespace std;

const int nax = 3e5+5;
const int inf = 1e18+7;
const int mod = 1e9+7;

int n,m;
int a[nax][3], b[nax][3];
vector<int>adj[nax];

/*
 * DO SOMETHING RATHER THAN DOING NOTHING
 * */

signed main(){
    fast;

    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j];
        }
    }
    b[0][0] = a[0][0];
    b[0][1] = a[0][1];
    b[0][2] = a[0][2];

    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            if(j == 0){
                b[i][j] = max(a[i][j] + b[i-1][1], a[i][j] + b[i-1][2]);
            }
            if(j == 1){
                b[i][j] = max(a[i][j] + b[i-1][0], a[i][j] +b[i-1][2]);
            }
            if(j == 2){
                b[i][j] = max(a[i][j]+b[i-1][0], a[i][j] +b[i-1][1]);
            }
        }
    }
    cout<<max(b[n-1][0],max(b[n-1][2], b[n-1][1]))<<endl;
    return 0;
}



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

int main() {
    long k, n, ans;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    ans = a.at(n - 1) - a.at(0);
    rep(i, n - 1) ans = min(ans, a.at(i) + k - a.at(i + 1));
    cout << ans << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX_N 100
 
int N,arr[MAX_N];
int dp[MAX_N][MAX_N];
 
int rec(int L,int R){
    if(L == R) return dp[L][R] = 0;
    if(dp[L][R] >= 0) return dp[L][R];
    int res = 0;
    int i = L;
    while(i != R){
	int j = i%N,k = (i+1)%N;
	res = max(res,rec(L,j)+rec(k,R)+abs(arr[L]-arr[k]));
	i++; i %= N;
    }
    return dp[L][R] = res;
}
 
int main(){
    int Tc;
    cin >> Tc;
    while(Tc--){
	cin >> N;
	for(int i = 0 ; i < N ; i++){
	    cin >> arr[i];
	}
	memset(dp,-1,sizeof(dp));
	int res = 0;
	for(int i = 0 ; i < N ; i++){
	    int j = (i+N-1)%N;
	    res = max(res,rec(i,j));
	}
	cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
const int MAX_Q=51;

int N,M,Q,ans=0;
int a[MAX_Q],b[MAX_Q],c[MAX_Q],d[MAX_Q];

void dfs(vector<int> v,int x){
    if (v.size()==N){
        int cnt=0;
        for (int i=0;i<Q;++i)
            if (v[b[i]]-v[a[i]]==c[i])
                cnt+=d[i];
        ans=max(ans,cnt);
        return;
    }
    for (int i=x;i<=M;++i){
        v.emplace_back(i);
        dfs(v,i);
        v.pop_back();
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> M >> Q;
    for (int i=0;i<Q;++i) cin >> a[i] >> b[i] >> c[i] >> d[i],--a[i],--b[i];
    vector<int> s;
    dfs(s,1);
    cout << ans << '\n';
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;

const string YES = "Yes";
const string NO = "No";

void solve()
{
  ll N;
  scanf("%lld",&N);
  ll f=0;
  ll t=N;
  while(t>0) {
    f+=t%10;
    t/=10;
  }
  if (N%f==0) cout << YES << endl;
  else cout << NO << endl;
}

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


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

const double pi = acos(-1LL);

double calc_dist(double x1,double y1,double x2,double y2) {
    return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int main() {
    int n;
    cin >> n;
    vector<int> x(n),y(n);
    for (int i = 0;i < n;++i) cin >> x[i] >> y[i];
    double ans = 4000;
    for (int i = 0;i < n;++i) for (int j = i+1;j < n;++j) {
        double cx = (x[i]+x[j])/2.0,
               cy = (y[i]+y[j])/2.0,
               r = calc_dist(x[i],y[i],cx,cy);
        bool f = true;
        for (int k = 0;k < n;++k) if (calc_dist(x[k],y[k],cx,cy) > r+1e-12) {
            f = false;
            break;
        }
        if (f) ans = min(ans,r);
    }
    for (int i = 0;i < n;++i) for (int j = i+1;j < n;++j) for (int k = j+1;k < n;++k) {
        if ((y[j]-y[i])*(x[k]-x[i]) == (y[k]-y[i])*(x[j]-x[i])) continue;
        double a = calc_dist(x[j],y[j],x[k],y[k]),
               b = calc_dist(x[i],y[i],x[k],y[k]),
               c = calc_dist(x[i],y[i],x[j],y[j]);
        a *= a;b *= b;c *= c;
        double cx = (a*(b+c-a)*x[i]+b*(c+a-b)*x[j]+c*(a+b-c)*x[k])/(a*(b+c-a)+b*(c+a-b)+c*(a+b-c)),
               cy = (a*(b+c-a)*y[i]+b*(c+a-b)*y[j]+c*(a+b-c)*y[k])/(a*(b+c-a)+b*(c+a-b)+c*(a+b-c)),
               r = calc_dist(x[i],y[i],cx,cy);
        bool ok = true;
        for (int l = 0;l < n;++l) if (calc_dist(x[l],y[l],cx,cy) > r+1e-12) {
            ok = false;
            break;
        }
        if (ok) ans = min(ans,r);
    }
    cout << fixed << setprecision(12) << ans << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cmath>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}
int to_num(char c) {
	if (c >= '0' && c <= '9')return (c - '0');
	else return -1;
}

int main() {
	IOS;
	string a, b, c;
	cin >> a >> b >> c;	
	int x, y, z;
	x = y = z = 0;
	char next = a[0];
	while (1) {
		if (next == 'a') {
			if (x == a.size()) {
				cout << 'A' << endl;
				break;
			}
			next = a[x];
			x++;
		}
		if (next == 'b') {
			if (y == b.size()) {
				cout << 'B' << endl;
				break;
			}
			next = b[y];
			y++;
		}
		if (next == 'c'){
			if (z == c.size()) {
				cout << 'C' << endl;
				break;
			}
			next = c[z];
			z++;
		}
	}
}



Measured memory_bytes: 256
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = []
for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[j])

AB.sort(reverse = True)
AB = AB[:K+1]
ABC = []
for i in range(len(AB)):
    for j in range(Z):
        ABC.append(AB[i]+C[j])
ABC.sort(reverse = True)
for i in range(K):
    print(ABC[i])


Measured memory_bytes: 147904
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
int main()
{
    int h,w;
    cin >> h >> w;
    vector<vector<char> > s(h,vector<char>(w));
    for(int i = 0;i < h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            cin >> s[i][j];
        }
    }
    int ans = 0;
    for(int i = 0;i < h;i++)
    {
        for(int j = 0;j < w;j++)
        {
            if(s[i][j] != '#')
            {
                vector<vector<int> > dist(h,vector<int>(w,-1));
                dist[i][j] = 0;
                queue<pair<int,int> > que;
                que.push(make_pair(i,j));
                while(!que.empty())
                {
                    pair<int,int> current_pos = que.front();
                    int x = current_pos.first;
                    int y = current_pos.second;
                    que.pop();
                    for(int direction = 0;direction < 4;direction++)
                    {
                        int next_x = x + dx[direction];
                        int next_y = y + dy[direction];
                        if(next_x < 0 || next_x >= h || next_y < 0 || next_y >= w)
                        {
                            continue;
                        }
                        if(s[next_x][next_y] == '#')
                        {
                            continue;
                        }
                        if(dist[next_x][next_y] == -1)
                        {
                            que.push(make_pair(next_x,next_y));
                            dist[next_x][next_y] = dist[x][y] + 1;
                        }
                    }
                }
                for(int k = 0;k < h;k++)
                {
                    for(int l = 0;l < w;l++)
                    {
                        if(dist[k][l] > ans)
                        {
                            ans = dist[k][l];
                        }
                    }
                }
            }
        }
    }
    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int main()
{
    int N;
    cin >> N;
    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a[i];
    }
    ll ans = 0;
    rep(i, N)
    {
        ans += a[i] - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(int argc, char* argv[]) {
  long long N, K;
  cin >> N >> K;

  long long a[N];
  for (int i = 0; i < N; ++i)
    cin >> a[i];

  long long inv = modinv(2, 1000000007);

  long long ret = 0;
  for (int i = 0; i < N; ++i) {
    long long after = 0;
    long long total = 0;
    for (int j = 0; j < N; ++j) {
      if (j > i && a[i] > a[j])
        ++after;
      if (a[i] > a[j])
        ++total;
    }
    ret += after * K;
    long long tmp = K;
    tmp *= ((2 * total * (K - 1) - (K - 1) * total)) % 1000000007;
    tmp %= 1000000007;
    tmp *= inv;
    tmp %= 1000000007;
    ret += tmp;
    ret %= 1000000007;
  }

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
using namespace std;
inline void Yeah(){puts("Yes");exit(0);}
int main(){
	int n,m,k;
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1;i<=n;++i){
        int kk=(k-i*m),a=n-i-i;
        if(!kk || a && (kk>>31&1)==(a>>31&1) && kk%a==0 && kk/a<=m)Yeah();
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")

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

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

#define watch(x) cout << (#x) << " is : " << (x) << "\n"
#define watch2(x, y) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\n"

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int main()
{
    b_v_r();
    ll n,d,xcor,ycor;
    double temp;
    ll cnt =0;

    cin >> n >> d;
    while(n--)
    {
        cin >> xcor >> ycor;
        temp = (1.0)*((xcor*xcor) + (ycor*ycor));
        if(sqrt(temp) <= (d*(1.0)))
        {
            cnt++;
        }
    }
    cout << cnt << endl;

    
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll a;
    cin >> a;
    putout(a + a * a + a * a * a);
    return 0;
}


Measured memory_bytes: 3616
Ss=input()
Ts=input()
s=[_ for _ in Ss]
t=[_ for _ in Ts]
l=len(Ss)
for i in range(l):
  temp=s[l-1]
  for j in range(l-1,-1,-1):
    s[j]=s[j-1]
  else:
    s[0]=temp
  if s==t:
    res='Yes'
    break
else:
  res='No'
print(res)


Measured memory_bytes: 3060