akhauriyash/Code-Regression huggingface dataset:
/*
मनस्वी म्रियते कामं कार्पण्यं न तु गच्छति ।
अपि निर्वाणमायाति नानलो याति शीतताम् ॥
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define p2d(v) for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v) for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v) for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

        
    string s,t;
    cin>>s>>t;

    ll count = 0;

    forn(i,0,s.sze)
    {
        if(s[i] != t[i]) count++;
    }        

    cout<<count;










    return 0;
}

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

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

    ll x;
    cin>>x;
    ll i,y=0;
    for(i=1; y<x; i++) y += i;
    cout<<i-1;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int n;

  while(cin>>n,n){
    int cnt=0;
    for(int i=1;i<n;++i){
      bool flag=false;
      int total=i;
      for(int j=i+1;j<n;++j){
	total+=j;
	if(total==n){
	  cnt++;
	  if(j==i+1){
	    flag=true;
	    break;
	  }
	}
	else if(total>n){
	  break;
	}
      }
      if(flag==true)
	break;
    }
    cout<<cnt<<endl;
  }
}

Measured memory_bytes: 2984
unittest
{
	assert( [ "2 900" ].parse.expand.solve == "Yes" );
	assert( [ "1 501" ].parse.expand.solve == "No" );
	assert( [ "4 2000" ].parse.expand.solve == "Yes" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto kx = input.front.split.to!( long[] );
	return tuple( kx[ 0 ], kx[ 1 ] );
}

auto solve( long k, long x )
{
	return ( x <= 500 * k ) ? "Yes" : "No";
}


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

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

  vector<int> D(N);
  rep(i,0,N-1) cin >> D[i];

  int M;
  cin >> M;

  vector<int> T(M);
  rep(i,0,M-1) cin >> T[i];

  sort(D.begin(), D.end());
  sort(T.begin(), T.end());

  int i = 0, j = 0;
  bool ok = true;
  while (i < N && j < M) {
    int d = D[i];
    int t = T[j];
    if (d == t) i++, j++;
    else if (t < d) {
      ok = false;
      break;
    } else i++;
  }

  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


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

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

const int MAXN = (int)1e5 + 5;


inline void boost () {
	ios_base::sync_with_stdio (0);
	cin.tie (0), cout.tie (0);
}


bool comp(ll a, ll b){
	return a >= b;
}

void solve(){
	int n, m, cnt = 0;
	char a[15][15];
	cin >> n >> m;
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin >> a[i][j];
			if(a[i][j] == '#'){
				cnt++;
			}
		}
	}
	
	if(cnt != n + m - 1){
		cout << "Impossible";
		return;
	}
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(a[i + 1][j] == '#' && a[i][j + 1] == '#'){
				cout << "Impossible";
				return;
			}
		}
	}
		cout << "Possible";
}


int main() {    
 boost();
    int tt = 1;

    while (tt--) {
        solve();
    }

    return 0;
}


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

int main()
{
    int n,k;

    cin >> n >> k;

    int ans = 1;
    for (int i = 0; i < n; i++)
    {
        if(ans * 2 > ans + k)ans += k;
        else ans *= 2;
    }
    
    cout << ans << endl;
}

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

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    int h, w;
    cin >> h >> w;

    char a;
    vector <vector <int> > grid(h, vector <int> (w, 0));
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a;
            if (a == '#')
                grid[i][j] = -1;
        }
    }

    grid[0][0] = 1;
    for (int i = 1; i < w; i++) {
        if (grid[0][i] == -1)
            break;
        grid[0][i] = grid[0][i - 1];
    }

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

        if (grid[i - 1][0] == -1)
            grid[i][0] = -1;
        else if (grid[i][0] != -1)
            grid[i][0] = grid[i - 1][0];
        for (int j = 1; j < w; j++) {
            if (grid[i][j] == -1 || (grid[i - 1][j] == - 1 && grid[i][j - 1] == -1))
                continue;
            if (grid[i - 1][j] == -1)
                grid[i][j] = grid[i][j - 1];
            else if (grid[i][j - 1] == -1)
                grid[i][j] = grid[i - 1][j];
            else
                grid[i][j] = (grid[i - 1][j] + grid[i][j - 1]) % MOD;
        }
    }
   
    cout << grid[h - 1][w - 1];
    return 0;
}

Measured memory_bytes: 4224
#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;

int main() {
	int N, K, X, Y;
	cin >> N >> K >> X >> Y;
	
	int num, ans;
	num = N - K;

	if (num > 0) {
		ans = X * K + Y * num;
	}

	else {
		ans = X * N;
	}

	cout << ans << endl;

	return 0;
}

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

i = 0
while i < n-1:
    x = a[i+1] % a[i]
    a[i+1] = a[i]
    a[i] = x
    if a[i] == 0:
        i += 1
print(a[i])


Measured memory_bytes: 20056
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return 1;
    }
    return 0;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return 1;
    }
    return 0;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

struct edge{
    int cost, to;

    edge(int in_cost, int in_to){
        cost=in_cost;
        to=in_to;
    }
    bool operator<(const edge &a) const
    {
        return cost > a.cost;
    }
};

map<char,int>mp;
int main() {
    int H, W, X2 = 0, X1 = 0;
    string A;
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        cin >> A;
        for (int j = 0; j < W; j++) {
            mp[A[j]]++;
        }
    }
    for (auto x: mp) {
        if (x.second % 2 == 1) X1++;
        else if (x.second % 4 == 2) X2++;
    }
    if (H % 2 == 0 && W % 2 == 0) {
        if (X2 == 0 && X1 == 0) cout << "Yes";
        else cout << "No";
    }
    if (H % 2 == 0 && W % 2 == 1) {
        if (X2 <= H / 2 && X1 == 0) cout << "Yes";
        else cout << "No";
    }
    if (H % 2 == 1 && W % 2 == 0) {
        if (X2 <= W / 2 && X1 == 0) cout << "Yes";
        else cout << "No";
    }
    if (H % 2 == 1 && W % 2 == 1) {
        if (X2 < (H + W) / 2 && X1 == 1) cout << "Yes";
        else cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c=0;cin>>n;vector<int>a(n);
  for(int i=0;i<n;i++)cin>>a.at(i);
  sort(a.begin(),a.end());
  if(n>1){
    for(int i=0;i<n-1;i++){
      if(a.at(i)==a.at(i+1)){c++;break;}
    }  
  }
  if(c>0)cout<<"NO"<<endl;
  else cout<<"YES"<<endl;
}





Measured memory_bytes: 1024
#include<stdio.h>
int main(){
int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
 int K;
  scanf("%d",&K);
  printf("%d",a[K-1]);
return 0;
}

Measured memory_bytes: 128
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

struct Edge{
  int from, to, distance;
};

int
main(void){  
  ios_base::sync_with_stdio(false);

  int l;
  cin >> l;

  std::vector<Edge> edges;

  int n;
  for(int i=0; (1 << (i+1)) <= l; i++){
    edges.push_back((Edge){i, i+1, 0});
    edges.push_back((Edge){i, i+1, 1<<i});
    n = i + 1;
  }

  
  for(int i=0; (1 << (i+1)) <= l; i++){
    if( !((1 << i) & l) ) continue;
    edges.push_back((Edge){i, n, (l & ~((1 << i) - 1) - (1 << i))});    
  }
  
  
  /*
  edges.push_back((Edge){n-2, n, (1 << n)});
  int itmp = 1 << n;
  for(int i=n+2; i >= 0; i=i-2){
    //itmp += edges[i].distance;
    //cout << "::" << edges[i].from << " " << edges[i].to << " " << edges[i].distance << endl;
    if(itmp + edges[i].distance >= l) break;
    itmp += edges[i].distance;
    edges.push_back((Edge){edges[i].from, n, itmp});
  }
  */
  
  cout << n+1 << " " << edges.size() << endl;

  for(auto &e : edges){
    cout << e.from + 1 << " " << e.to + 1 << " " << e.distance << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int,int>
using namespace std;
const int MAXN = 100000;
const int INF = 1e9 + 5;

int a[MAXN+5], uni[MAXN+5], dp[2*MAXN+5], N;
LL cnt;

bool check(int x) {
	int ofs = N;
	LL res = 0, sum = 0;
	fill(dp, dp + 2 * N + 1, 0);
	for (int i = 0; i < N; i++) {
		dp[0 + ofs]++;
		if (a[i] <= x) {
			sum += dp[0 + ofs];
			ofs--;
		}
		else {
			ofs++;
			sum -= dp[0 + ofs];
		}
		res += sum;
//		cout << "Loop " << i << " " << sum << "\n";
		assert(sum <= i + 1);
	}
	
//	cout << "At " << x << " " << res << "\n";
	assert(res <= cnt);
	return res >= cnt / 2 + 1;
}

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N;
	cnt = (LL)N * (N - 1) / 2 + N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		uni[i] = a[i];
	}
	
	sort(uni, uni + N);
	int M = unique(uni, uni + N) - uni, l = 0, r = M - 1, ans = -1;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(uni[m])) {
			ans = m;
			r = m - 1;
		}
		else {
			l = m + 1;
		}
	}
	
	assert(ans != -1);
	cout << uni[ans] << "\n";
	/**** Note MAXN ****/
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	vector<int> A;
	int ans = 0;
	
	cin>>N;
	
	A.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
		if(i && A[i-1] < A[i]) ans++;
	}
	
	cout<<ans<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 3560
import java.util.*;
public class Main{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=0;
		if(a>b)
			c=a+(a-1);
		else if(a<b)
			c=b+(b-1);
		else c=a+b;
		System.out.println(c);
	}
}

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

using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define debug(a) cout << #a << ": " << a << endl;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int maxNum = 0;
  rep(i, N) {
    cin >> A[i];
    maxNum = max(A[i], maxNum);
  }

  int countMax = count(A.begin(), A.end(), maxNum);
  if (countMax != 1) {
    rep(i, N) { cout << maxNum << endl; }
    return 0;
  }

  int nextNum = 0;
  rep(i, N) {
    if (A[i] != maxNum)
      nextNum = max(A[i], nextNum);
  }
  rep(i, N) {
    if (A[i] == maxNum)
      cout << nextNum << endl;
    else
      cout << maxNum << endl;
  }
}


Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <vector>
#include <sstream>

template <typename T>
void quicksort(T* a, int begin, int end) {
    if (begin < end) {
        int mid = (begin + end) / 2;
        auto pivot = a[mid];

        int left = begin;
        int right = end;

        while (true) {
            while (a[left] < pivot) {
                left++;
            }
            while (pivot < a[right]) {
                right--;
            }
            if (left >= right) {
                break;
            }

            int tmp = a[left];
            a[left] = a[right];
            a[right] = tmp;

            left++;
            right--;
        }

        quicksort(a, begin, left - 1);
        quicksort(a, right + 1, end);
    }
}

int main()
{
    int num;
    std::cin >> num;

    std::vector<int> a(num);

    for (int i = 0; i < num; i++) {
        std::cin >> a[i];
    }

    quicksort(&a[0], 0, num - 1);

    int prev = 0;
    for (auto it = a.cbegin(); it != a.cend();) {
        int n = *it;
        if (n == prev) {
            it = a.erase(it);
        }
        else {
            it++;
        }
        prev = n;
    }

    int result = (int)a.size();

    std::cout << result << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
//#define ls x<<1
//#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-10;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=1e3+100;

void solve(){
	int ans=0;
	int n;scd(n);
	rep1(i,n){
		int x;scd(x);
		if(i&1)if(x&1)ans++;
	}ac;
}
int main(){
    //IOS;
    //freopen("D:\\data.txt","r",stdin);
    //freopen("D:\\out.txt","w",stdout);
    solve();
 
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;                                             ;;
    ;;         ;;            ;;;;;;;;;       ;;    ;;
    ;;        ;; ;;        ;;                ;;    ;;
    ;;       ;;   ;;       ;;                ;;    ;;
    ;;      ;;;;;;;;;      ;;                ;;    ;;
    ;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
    return 0;
}

Measured memory_bytes: 3260
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
// const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1},
//           dx[] = {0, -1, -1, -1, 0, 1, 1, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
vector<long long> comp;

long long calc(int x, int y) {
  if (x < y) return comp[y] - comp[x];
  return 0;
}

int main() {
  int n, k; cin >> n >> k;
  vector<int> h(n);
  REP(i, n) {
    cin >> h[i];
    comp.emplace_back(h[i]);
  }
  comp.emplace_back(0);
  sort(ALL(comp));
  comp.erase(unique(ALL(comp)), comp.end());
  int m = comp.size();
  REP(i, n) h[i] = lower_bound(ALL(comp), h[i]) - comp.begin();
  vector<vector<vector<long long> > > dp(n + 1, vector<vector<long long> >(m, vector<long long>(k + 1, LINF)));
  dp[0][0][0] = 0;
  REP(x, n) REP(y, m) REP(z, k + 1) {
    dp[x + 1][h[x]][z] = min(dp[x + 1][h[x]][z], dp[x][y][z] + calc(y, h[x]));
    if (z < k) {
      dp[x + 1][y][z + 1] = min(dp[x + 1][y][z + 1], dp[x][y][z]);
      if (x + 1 < n) dp[x + 1][h[x + 1]][z + 1] = min(dp[x + 1][h[x + 1]][z + 1], dp[x][y][z] + calc(y, h[x + 1]));
    }
  }
  long long ans = LINF;
  REP(y, m) REP(z, k + 1) ans = min(ans, dp[n][y][z]);
  cout << ans << '\n';
  return 0;
}


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

#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;

using namespace std;






void one_case() {
    int a, b;
    cin >> a >> b;

    string s;
    cin >> s;
    if (s[a] != '-') {
        cout << "No\n";
        return;
    }
    for (int i = 0; i < a + b + 1; ++i) {
        if (i == a) {
            continue;
        }
        if (int(s[i]) < 48 || int(s[i]) > 57) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
    return;
}


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


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

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <functional>
#include <cmath>
#include <array>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI;
typedef pair<int,int> pii;
const int mod = (int)1e9+7;


int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, res=0;
	cin >> n;
	VI a(n);
	rep(i,n) cin >>a[i];
	
	ll ans=1LL<<50;
	
	rep2(i,-100,101){
		ll sm=0;
		rep(j,n){
			sm += (i - a[j]) * (i - a[j]);
		}
		ans = min(ans, sm);
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
/*
 * AGC024_C.cpp
 *
 *  Created on: May 20, 2018
 *      Author: 13743
 */
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}

int a[200001];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	REP(i, N) {
		cin >> a[i];
	}

	lng ans = 0;
	if(a[0] >0) {
		cout << -1 << endl;
		return 0;
	}
	FOR(i, 1, N-1) {
		if(a[i] > a[i-1]+1) {
			cout << -1 << endl;
			return 0;
		}
		if(a[i] == a[i-1]+1) {
			++ans;
		}
		else {
			ans += a[i];
		}
	}
	cout << ans << endl;
}






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

typedef long long ll;
typedef pair<int,int> P;
int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};

 
int main(){
  int n;
  cin >> n;
  int ans = 0, ma = 0;
  for(int i=0; i<n; i++){
    int p;
    cin >> p;
    ma = max(ma, p);
    ans += p;
  }
  ans -= ma/2;
  cout << ans << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());

    bool ans = true;
    for(int i = 0; i < n - 1; i++){
        if(a[i] == a[i+1]) ans = false;
    }

    cout << (ans ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int, input().split()))
import sys
limit = 10 ** 18
if 0 in a:
    print(0)
    sys.exit()
else:
    ans = 1
    for i in range(n):
        ans *= a[i]
        if ans > limit:
            print(-1)
            sys.exit()
    print(ans)


Measured memory_bytes: 21592
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main() {

	string S;
	int Q;
	cin >> S;
	cin >> Q;

	bool flag = true;
	
	vector<vector<string>> Query(Q, vector<string>(3, "0"));

	for (int i = 0; i < Q; ++i)
	{
		cin >> Query[i][0];
		if (Query[i][0] != "1") cin >> Query[i][1] >> Query[i][2];
	}

	for (int i = 0; i < Q;++i)
	{
		if (Query[i][0] == "1") {
			if (flag) flag = false;
			else flag = true;
		}
		else if ((Query[i][0] == "2" && Query[i][1] == "1" && flag) || (Query[i][0] == "2" && Query[i][1] == "2" && !flag)) {
			S.insert(0, Query[i][2]);
		}
		else if ((Query[i][0] == "2" && Query[i][1] == "2" && flag) || (Query[i][0] == "2" && Query[i][1] == "1" && !flag)) {
			S.append(Query[i][2]);
		}
	}

	if (!flag) reverse(S.begin(), S.end());

	cout << S;

	return 0;
}

Measured memory_bytes: 41728
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    string s;
    cin>>s;
    vector<vector<bool>> dp(s.size()+1,vector<bool>(s.size()+1,false));
    for(int i=0;i<=s.size();i++){
        dp[i][i]=true;
    }
    for(int i=3;i<=s.size();i+=3){
        for(int t=0;t+i<=s.size();t++){
            if(s[t]!='m' || s[t+i-1]!='w'){continue;}
            for(int h=1;h+1<i;h++){
                if(s[t+h]=='e' && dp[t+1][t+h] && dp[t+h+1][t+i-1]){dp[t][t+i]=true; break;}
            }
        }
    }
    cout<<(dp[0][s.size()]?"Cat":"Rabbit")<<endl;
    
    return 0;
}



Measured memory_bytes: 3280
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define xx first
#define yy second
 
#define pii pair <int, int >
#define pll pair < ll, ll >
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii >
 
#define inf  100000000
 
#define f(i, c, n) for(int i = c; i < n; i++)
#define fe(i, c, n) for(int i = c; i <= n; i++)
#define fr(i, n, c) for(int i = n - 1; i >= c; i--)
 
#define be(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())
#define S " "
#define N "\n"

//cout << "Case " << ++cs << ": " <<
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


void solve() {
	int x;
	cin >> x;
	cout << x / 3 << N;
}

int main() {
    // FILE;
    fast;
    // int t; cin >> t; while(t--)
    solve();
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)

int main()
{
    string S;
    cin >> S;
    int win = 0;
    for(auto x : S){
        if(x=='o'){
            ++win;
        }
    }

    if (15 - S.size() >= 8 - win)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

int main() {
    int n;
    cin >> n;
    long a;
    unordered_map<long, long> m;
    REP(i,n) {
        cin >> a;
        m[a]++;
    }
    int cnt = 0;
    for (auto i = m.begin(); i != m.end(); i++) {
        if (i->second - i->first < 0) {
            cnt += i->second;
        } else {
            cnt += (i->second - i->first);
        }
    }
    cout << cnt << endl;
}


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

int main() {
    string s;
    int k;
    int tmp;
    cin >> s >> tmp;
    k = tmp - 1;
    int point = 0;
    char def;
    bool getsuccess = false;
    for (int i = 0; i < s.length() - 1; ++i){
        if (s[i] != '1') {
            point = i;
            def = s[i];
            getsuccess = true;
            break;
        }
    }
    if (!getsuccess && s[s.length() - 1] == '1') {
        point = s.length();
    } 
    else if (!getsuccess && s[s.length() - 1] != '1') {
        point = s.length() - 1;
        def = s[s.length() - 1];
    }
    if (point <= k) {
        cout << def;
    }
    else {
        cout << 1;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}

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

    int n, m;
    cin >> n >> m;
    cout << ((n <= m) ? "unsafe" : "safe") << endl;

    return 0;
}


Measured memory_bytes: 3652
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            
            if(m == -1 && f == -1 && r == -1)
                break;
            
            if(m == -1 || f == -1){
                System.out.println("F");
            }
            else if(m + f >= 80){
                System.out.println("A");
            }
            else if(m + f >= 65){
                System.out.println("B");
            }
            else if(m + f >= 50){
                System.out.println("C");
            }
            
            else if(r >= 50){
                System.out.println("C");
            }
            else if(m + f >= 30){
                System.out.println("D");
            }
            else if(m + f < 30){
                System.out.println("F");
            }   
        }
    }
}



Measured memory_bytes: 26532
#include <iostream>

using namespace std;

int main()
{
    int a, b, t, i;
    for(i=1; i<=3000; i++)
    {
       cin >> a >> b;
       if (a > b)
       {
           t = a;
           a = b;
           b = t;
       }
        if(a == 0 && b == 0)
          break;
 
    
       cout << a << " " << b << endl;
    }
}


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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

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

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;


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

	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>

int main()
{
  int sx, sy, tx, ty;
  std::cin >> sx >> sy >> tx >> ty;
  for (int i = 0; i < tx - sx; ++i)
  {
    std::cout << 'R';
  }
  for (int i = 0; i < ty - sy; ++i)
  {
    std::cout << 'U';
  }
  for (int i = 0; i < tx - sx; ++i)
  {
    std::cout << 'L';
  }
  for (int i = 0; i < ty - sy; ++i)
  {
    std::cout << 'D';
  }
  std::cout << 'D';
  for (int i = 0; i < tx - sx + 1; ++i)
  {
    std::cout << 'R';
  }
  for (int i = 0; i < ty - sy + 1; ++i)
  {
    std::cout << 'U';
  }
  std::cout << 'L';
  std::cout << 'U';
  for (int i = 0; i < tx - sx + 1; ++i)
  {
    std::cout << 'L';
  }
  for (int i = 0; i < ty - sy + 1; ++i)
  {
    std::cout << 'D';
  }
  std::cout << 'R' << std::endl;
  return 0;
}

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

int main() {
 
  int n;
  cin >> n;
  
  int ans,a = 1;
  
  while(true){
    ans = a * a;
    if ( ans <= n ){
      a++;
    }else{
      cout << ( a - 1 ) * ( a - 1) << endl;
      return 0;
    }
  }
    
}



Measured memory_bytes: 256
s=input()
a=int(s[0])
b=int(s[1])
c=int(s[2])
d=int(s[3])
if a+b+c+d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a-b+c+d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"+"+str(d)+"=7")
elif a+b-c+d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b+c-d==7:
  print(str(a)+"+"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c+d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"+"+str(d)+"=7")
elif a+b-c-d==7:
  print(str(a)+"+"+str(b)+"-"+str(c)+"-"+str(d)+"=7")
elif a-b+c-d==7:
  print(str(a)+"-"+str(b)+"+"+str(c)+"-"+str(d)+"=7")
elif a-b-c-d==7:
  print(str(a)+"-"+str(b)+"-"+str(c)+"-"+str(d)+"=7")

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

int main() {
 int N,K,Q;
 cin>>N>>K>>Q;

vector <int> point(N,0);
vector <int> A(Q);

for (size_t i = 0; i < Q; i++)
{
  //正解者
  cin>>A.at(i);
  A.at(i)--;
}
  //得点計算
for (size_t i = 0; i < Q; i++)
{
  point.at(A.at(i)) = point.at(A.at(i))+1;
}

for (size_t i = 0; i < N; i++)
{
  point.at(i) = point.at(i)+K-Q;
}

for (size_t i = 0; i < N; i++)
{
  if(point.at(i) <= 0){cout<<"No"<<endl;}else{cout<<"Yes"<<endl;}
}

return 0;

}

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

int main() {
  //入力
  int H, W;
  cin >> H >> W;
  vector<vector<char>> a(H,vector<char>(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      cin >> a.at(i).at(j);
    }
  }
  //判定i
  vector<int> counti(H);
  
  for(int i=0; i<H; i++){
    int count = 0;
    for(int j=0; j<W; j++){
      if(a.at(i).at(j) == '.'){
        count++;
      }
    }
    if(count == W){
      counti.at(i) = 1;
    }
  }
  //判定j
  vector<int> countj(W);
  for(int j=0; j<W; j++){
    int count = 0;
    for(int i=0; i<H; i++){
      if(a.at(i).at(j) == '.'){
        count++;
      }
    }
    if(count == H){
      countj.at(j) = 1;
    }
  }
  //出力
  for(int i=0; i<a.size(); i++){
    if(counti.at(i) == 0){
      for(int j=0; j<a.at(0).size(); j++){
        if(countj.at(j) == 0){
          cout << a.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
int main(){
    int n;
    cin>>n;
    int cnt=1;
    rep(i,0,n){
        int a;
        cin>>a;
        cnt*=(a%2==0 ? 2 : 1);
    }
    cout<<pow(3,n)-cnt<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

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

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll x = nxt(), y = nxt(), a = nxt(), b = nxt(), c = nxt();

    vector <pll> p;

    for(ll i=0; i<a; i++)
    {
        ll temp = nxt();

        p.pb(mp(temp, 3));
    }

    for(ll i=0; i<b; i++)
    {
        ll temp = nxt();

        p.pb(mp(temp, 2));
    }

    for(ll i=0; i<c; i++)
    {
        ll temp = nxt();

        p.pb(mp(temp, 1));
    }

    sort(all(p));
    reverse(all(p));

    ll ans = 0;

    ll taken = 0;
    ll cl = 0;

    ll ox = x, oy = y;

    for(ll i=0; i<a+b+c; i++)
    {
        if(p[i].ss == 3 && x > 0)
        {
            ans += p[i].ff;
            taken++;
            x--;
        }

        else if(p[i].ss == 2 && y > 0)
        {
            ans += p[i].ff;
            taken++;
            y--;
        }

        else if(p[i].ss == 1 && cl < x + y)
        {
            ans += p[i].ff;
            cl++;
            taken++;
        }

        if(taken == ox+oy)
        {
            break; 
        }
    }

    cout << ans << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 10476
//BUGSBUNNY
//IIT ROORKEE
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vl vector<long long>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vb vector<bool>
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }


void solve();
signed main()
{
    //-------------------------------------------------------------------------------   
        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        clock_t clk = clock();
    //-------------------------------------------------------------------------------   
        
    //-------------------------------------------------------------------------------
        int t = 1;
        // cin >> t;       
        rep(i,t)
        {
            // cout << "Case #" << i+1 << ": ";
            solve();
        }
    //-------------------------------------------------------------------------------
        clk = clock() - clk;
        cerr << fixed << setprecision(12) << "Time: " << ((double)clk)/CLOCKS_PER_SEC;
    //-------------------------------------------------------------------------------
}

void solve()
{
    string s , t ;
    cin >> s >> t;
    if(s==t.substr(0,s.length()))
        cout << "Yes";
    else
        cout << "No";
}

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

int solve(const string &n, int k) {
    int m = n.length();

    vector<vector<vector<int>>> dp(m + 1, vector<vector<int>>(2, vector<int>(k + 1, 0)));
    dp[0][0][0] = 1;
    rep(i, 0, m) {
        int d = n[i] - '0';
        rep(flag, 0, 2) rep(j, 0, k + 1) rep(l, 0, (flag ? 10 : d + 1)) {
            dp[i + 1][flag || (l < d)][(l != 0 ? j + 1 : j)] += dp[i][flag][j];
        }
    }

    return dp[m][0][k] + dp[m][1][k];
}

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

    int k;
    cin >> k;

    cout << solve(n, k) << endl;
    
    return 0;
}

Measured memory_bytes: 256
def tag(a,b,v,w,t):
    res = (v*t)-(abs(b-a)+(w*t))
    if res>=0:
        return "YES"
    return "NO"

if __name__ == "__main__":
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())
    print(tag(a,b,v,w,t))

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, m, x;
    cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll>> a(n, vector<ll>(m));
    REP(i, n) {
        cin >> c[i];
        REP(j, m) cin >> a[i][j];
    }

    ll ret = INF;
    REP(i, 1LL<<n) {
        ll cost = 0;
        vector<ll> num(m);
        REP(j, n) {
            if(i&1LL<<j) {
                cost += c[j];
                REP(k, m) num[k] += a[j][k];
            }
        }
        bool flag = true;
        REP(j, m) if(num[j] < x) flag = false;
        if(flag) chmin(ret, cost);
    }
    if(ret == INF) ret = -1;
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3664
A=input()
S=[int(A[i:i+2]) for i in range(0,len(A),2)]
if 1<=S[0] and S[0]<=12:
    if 1<=S[1] and S[1]<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=S[1] and S[1]<=12:
        print('YYMM')
    else:
        print('NA')


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    string S;
    cin >> S;
    // O(26 * N) solution instead of naive O(N^2)
    vector <vector<int>> count(26, vector <int>(N + 1, 0));
    for(int i = 1 ; i <= N ; ++i){
        ++count[S[i - 1] - 'a'][i];
        for(int j = 0 ; j < 26 ; ++j){
            count[j][i] += count[j][i - 1];
        }
    }
    int maximum = 0;
    for(int i = 1 ; i < N ; ++i){
        // cut at position i
        // X - [1...i], Y - [i + 1...N]
        int counter = 0;
        for(int j = 0; j < 26 ; ++j){
            int left = count[j][i];
            int right = count[j][N] - left;
            if(left > 0 && right > 0){
                ++counter;
            }
        }
        maximum = max(maximum, counter);
    }
    cout << maximum << '\n';
    return 0;
}


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

void solve() {
    // n f(n)
    // 0  1
    // 1  1
    // 2  2
    // 3  3
    // 4  8
    // 5  15

    ll n;
    cin >> n;
    if (n & 1) {
        cout << 0 << endl;
        return;
    }

    n /= 2;
    ll k = 5;
    ll ans = 0;
    while (k <= n) {
        ans += n / k;
        k *= 5;
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;

/*

*/

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

ll a,b,c,d,ans=0;

ll f(ll x,ll y){
	return x/y;
}

void init(){
	cin>>a>>b>>c>>d;
}

int main(void){
	init();
	ll g=c*d/gcd(c,d);
	ans = b-a+1 - (f(b,c)-f(a-1,c)) - (f(b,d)-f(a-1,d)) + (f(b,g)-f(a-1,g));
	cout<<ans<<endl;
	return 0;
}

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

int f(int n){
   if(n == 1)return 1;
   if(n == 2)return 2;
   if(n == 3)return 4;
   return f(n-1) + f(n-2) +f(n-3);
}

int main(void){
   while(true){
       int n;
       cin >> n;
       if(n==0)break;
       cout << (f(n) / 3650)+1 << endl;
   }
}


Measured memory_bytes: 3096
import bisect
def solve(n, l):
    l = sorted(l)
    res = 0
    for i in range(n):
        for j in range(i+1, n-1):
            a, b = l[i], l[j]
            k = bisect.bisect_left(l, a+b) - 1
            res += max(0, k-j)
    return res

n = int(input())
l = list(map(int, input().split()))
print(solve(n, l))

Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A,B,C;
    cin>>A>>B>>C;
    if(A==5&&B==7&&C==5){
        cout<<"YES"<<endl;
    }
    else if( A==5&&B==5&&C==7){
        cout<<"YES"<<endl;
    }
    else if(A==7&&B==5&&C==5){
        cout<<"YES"<<endl;
    }
    else {
        cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256