akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, a, b;

  long long K;

  std::cin >> N >> K;

  std::map<int, long> map;

  for (int i = 0; i < N; i ++) {
    std::cin >> a >> b;

    map[a] += b;
  }

  for (const auto& kv : map) {
    if (K <= kv.second) {
      std::cout << kv.first << ' ' << std::endl;

      break;
    }

    K -= kv.second;
  }

  return 0;
}


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

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

  int ans=1;
  for (int i = 1; i < n; i++)
  {
    if(i*i>n){
      ans = (i-1)*(i-1);
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001;
#define MOD 1000000007;
#define INF64 1000000000000000001;

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	SINT64 ans1 = 0;

	ans = stoi(N+M);
	ans1 = sqrt(ans);
	if (ans == ans1*ans1) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/

/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define Time srand(chrono::high_resolution_clock::now().time_since_epoch().count());
#define OJ                            \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout);
void solve()
{
    float d,t,s;
    cin>>d>>t>>s;
    if(d/s<=t)
        cout<<"Yes\n";
    else
    {
        cout<<"No\n";
    }
}
int main()
{
    // OJ;
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  vector<P> A;
  rep(i, 9) {
    ll a;
    cin >> a;
    A.pb({a, 0});
  }

  ll N;
  cin >> N;
  rep(i, N) {
    ll b;
    cin >> b;
    rep(i, 9) {
      if (A[i].first == b) {
        A[i].second = 1;
        break;
      }
    }
  }

  if (A[0].second && A[1].second && A[2].second) {
    COUT("Yes");
    return 0;
  }
  if (A[3].second && A[4].second && A[5].second) {
    COUT("Yes");
    return 0;
  }
  if (A[6].second && A[7].second && A[8].second) {
    COUT("Yes");
    return 0;
  }

  if (A[0].second && A[3].second && A[6].second) {
    COUT("Yes");
    return 0;
  }
  if (A[1].second && A[4].second && A[7].second) {
    COUT("Yes");
    return 0;
  }
  if (A[2].second && A[5].second && A[8].second) {
    COUT("Yes");
    return 0;
  }

  if (A[0].second && A[4].second && A[8].second) {
    COUT("Yes");
    return 0;
  }
  if (A[2].second && A[4].second && A[6].second) {
    COUT("Yes");
    return 0;
  }
  COUT("No");

  return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    long long int n;
    long long int sum=0;
    cin >> n;
    //for (int i=0; i<=n; i++){
    //    if ( i % 3 != 0 && i % 5 != 0) sum += i;
    //}

    sum = (n+1) * n / 2 + (n/15+1) * (n/15) * 15 / 2 - (n/3+1) * (n/3) * 3 / 2 - (n/5+1) * (n/5) * 5 / 2;
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    long long x;
    cin>>x;
    long long curr=100,t=0,a,b;
    while(curr<x){
        a=curr/100;b=curr%100;
        t++;
        curr=a*101ll+(b*101ll/100ll);
    }
    cout<<t<<"\n";
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,h[100100],dp[100100];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();
	rep(i,1,n) h[i]=read();dp[0]=maxd;
	rep(i,2,n) dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i]-h[i-2]));
	printf("%d",dp[n]);
	return 0;
}


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

using namespace std;

int main()
{
 //   freopen("input", "r", stdin);
    cin.sync_with_stdio(false); cin.tie(0);

    string s;
    cin >> s;

    int n = s.size(), a = 0, b = 0, c = 0;

    for(auto it : s)
        if(it == 'a') ++a;
            else if(it == 'b') ++b;
                else ++c;

    if(a > b) swap(a, b);
    if(a > c) swap(a, c);
    if(b > c) swap(b, c);

    if(a != n/3)
    {
        cout << "NO\n";
        return 0;
    }

    if((n%3 && c != n/3+1))
        cout << "NO\n";
    else cout << "YES\n";


    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

typedef struct {
	vector <int> to;
	int cost;
} edge;
typedef struct {
	bool a;
	bool b;
} P;
int main( void ){
	string S; cin >> S;
	string K = "keyence";
	int cnt = 0;
	rep(i,0,7){
		if (S[i] != K[i]){
			break;
		}
		cnt++;
	}
	int N = S.size();
	bool can = true;
	rep(i,N-7+cnt, N){
		if (S[i] != K[cnt])
			can = false;
		cnt++;
	}
	if (can)
		cout << "YES\n";
	else
		cout << "NO\n";

}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
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;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,a,b,c;
    cin>>n;
    a=n%10;
    b=n/10%10;
    c=n/100;
    if(a==7||b==7||c==7)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, A, B, i, X[100001], ans=0;
    
    cin >> N >> A >> B;

    for(i=1; i<=N; i++){
        cin >> X[i];

        if(i>=2){
            ans += min(A*(X[i]-X[i-1]), B);
        }
    }

    cout << ans << endl;

    return 0;
}

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

typedef long long LL;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;

const int INF = 1000000007;
const LL INFLL = 1000000000000000007;

#define st first
#define nd second
#define pb push_back
#define _boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

// ***************************** CODE ***************************** //

const int MAX = 1e5 + 7;
int tab[MAX], dp[MAX];

int main() {
    _boost;

    int n;  cin >> n;
    for(int i = 0; i < n; i++)
        cin >> tab[i];

    dp[1] = abs(tab[0]-tab[1]);
    for(int i = 2; i < n; i++)
        dp[i] = min(dp[i-1]+abs(tab[i-1]-tab[i]),
                    dp[i-2]+abs(tab[i-2]-tab[i]));

    cout << dp[n-1];

    return 0;
}


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

int main(){
	int a,b;
	cin >> a;
	cin >> b;
	
	if(a>b){
		cout << "a > b" << endl;
	}else if(a<b){
		cout << "a < b" << endl;
	}else{
		cout << "a == b" << endl;
	}
}

Measured memory_bytes: 3040
//AtCoder ABC089 C - March
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

void recursive_comb(int *indexes, int s, int rest, std::function<void(int *)> f) {
	if(rest == 0) {
		f(indexes);
	} else {
		if(s < 0)
			return;
		recursive_comb(indexes, s - 1, rest, f);
		indexes[rest - 1] = s;
		recursive_comb(indexes, s - 1, rest - 1, f);
	}
}

// nCkの組み合わせに対して処理を実行する
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}

int main() {
    ll N;
    cin>>N;
	unordered_map<char, ll> march = {
		{'M', 0}, {'A', 1}, {'R', 2}, {'C', 3}, {'H', 4},
	};
	unordered_map<int,ll> ntbl;
    for(ll i=0;i<N;++i){
        string s;
        cin>>s;
        auto it=march.find(s[0]);
        if(it!=march.end()){
            ++ntbl[it->second];
        }
    }
    ll ans=0;
	foreach_comb(5, 3, [&](int *indexes) {
		//std::cout << indexes[0] << ',' << indexes[1] << ',' << indexes[2] << std::endl;
        ans += ntbl[indexes[0]] * ntbl[indexes[1]] * ntbl[indexes[2]];
	});
    cout<<ans<<endl;
	return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

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

    int N, M;
    cin >> N >> M;

    bitset<30> s;
    s.set();

    REP(i, N) {
        int k;
        cin >> k;
        bitset<30> t(0);
        REP(j, k) {
            int a;
            cin >> a;
            t[--a] = 1;
        }

        s &= t;
    }

    cout << s.count() << endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

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

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  i = 2;
  ll ma= 1;
  while(1){
    if(i*i>n) {
      break;
    }else {
      ll p = i;
      while(p<n){
        p = p * i;
        if(p>n) break;
        if(p>ma) ma = p;
      }
    }
    i++;
  }
  cout<<ma<<endl;

}

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


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  s=list(S())

  _a=''
  ans=[]

  while len(s)>0:
    if _a==s[-1]:
      s.pop()
    else:
      _a=s.pop()
      ans.append(_a)

  return len(ans)

# main()
print(main())


Measured memory_bytes: 7344
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int N;
	cin >> N;
	vector<int> C(N), V(N);
	REP(i, N) cin >> V[i];
	REP(i, N) cin >> C[i];
	int res = 0;
	for (int bit = 0;bit < (1 << N);bit++) {
		int tmp = 0;
		REP(i, N) {
			if (bit&(1 << i)) tmp += V[i] - C[i];
		}
		res = max(res, tmp);
	}
	cout << res << "\n";
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

const int maxn = 105;
int n;
char s[maxn], t[maxn];
//char out[maxn * 2];

int main() {
    scanf("%d", &n);
    scanf("%s%s", s, t);
    //printf("%s %s\n", s, t);
    int p1 = 0, p2 = 0;
    // for (int i = 0; i < n; i++) out[i] = s[i];
    for (int i = 0; i < n; i++) {
        int j = 0;
        for (j = 0; i + j < n; j++) {
            if (s[i + j] != t[j]) {
                j = 0;
                break;
            }
        }
        if (i + j == n) {
            p1 = j;
            break;
        }
    }
    // p2 = n;
    // for (int i = p1; i < n; i++) out[p2++] = t[i];
    // out[p2] = 0;
    printf("%d\n", n + n - p1);
    return 0;
}


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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  long long T;
  scanf("%lld", &T);
  std::vector<long long> t(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &t[i]);
  }

  ll ans = T;
  rep(i, 1, N) {
    ll duration = t[i] - t[i - 1];
    ans += (duration <= T) ? duration : T;
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	string s;
	cin>>s;
	if(s[2]==s[3] && s[4]==s[5])
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define inf 1000000001

int c = 0;

void merge(int A[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;

    int L[n1+1], R[n2+1];
    for (int i = 0; i < n1; i++)
        L[i] = A[left + i];
    for (int i = 0; i < n2; i++)
        R[i] = A[mid + i];

    L[n1] = R[n2] = inf;
    int i = 0, j = 0;
    for (int k = left; k < right; k++)
    {
        if (L[i] <= R[j])
            A[k] = L[i++];
        else
            A[k] = R[j++];
        c++;
    }
}

void mergeSort(int A[], int left, int right)
{
    if (left + 1 < right)
    {
        int mid = (left + right) / 2;
        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    int n;
    cin >> n;
    int S[n];

    for (int i = 0; i < n; i++)
        cin >> S[i];
    mergeSort(S, 0, n);

    for (int i = 0; i < n; i++)
    {
        if(i!=0)
            cout << " "; 
        cout << S[i];
    }
    cout << "\n"
         << c << "\n";
    return 0;
}


Measured memory_bytes: 6880
acount = 0
bcount = 0



n = int(input())
 
for i in range(n) :
  A = []
  a,b = map(str,input().split())
  A.append(a)
  A.append(b)
  A .sort()
  
    
  if A[1] == a and A[0] != a   :
    acount += 3
   
  elif A[1] == b and A[0] != b:
    bcount += 3
  elif A[0] == A[1]:
    acount += 1 
    bcount += 1
    

print(acount , bcount)



Measured memory_bytes: 5600
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int N;
	long A, B;
	long[] h;
	long max, min;

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		N = Integer.parseInt(tokens[0]);
		A = Long.parseLong(tokens[1]);
		B = Long.parseLong(tokens[2]);
		h = new long[N];
		for (int i = 0; i < N; ++i) {
			h[i] = Long.parseLong(in.readLine());
		}
		Arrays.sort(h);
		// 最大の回数 = h_max / B，この回数なら確実にできる
		max = h[N - 1] / B + 1;
		// 最小の回数 = h_max / A，個の回数ではできない
		min = h[N - 1] / A;
	}

	boolean isEnable(long times) {
		List<Long> list = new ArrayList<>();
		for (int i = 0; i < N; ++i) {
			long val = B * times;
			if (h[i] > val) {
				list.add(h[i] - val);
			}
		}
		long t = 0L;
		for (Long v : list) {
			if (v % (A - B) == 0) {
				t += v / (A - B);
			} else {
				t += v / (A - B) + 1L;
			}
		}
		if (times >= t) {
			return true;
		} else {
			return false;
		}
	}

	void calc() {
		long result = -1L;
		while (true) {
			// System.out.println(min + " " + max);
			if (max == min) {
				result = min;
				break;
			} else if (max - min == 1L) {
				if (isEnable(min)) {
					result = min;
				} else {
					result = max;
				}
				break;
			} else {
				long middle = (max + min) / 2L;
				if (isEnable(middle)) {
					max = middle;
				} else {
					min = middle;
				}
			}
		}
		System.out.println(result);
	}

	void showResult() {

	}
}

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

bool digit(long long n){
  long long sum = 0;
  long long t = n;
  while(t > 0){
    sum += t % 10;
    t /= 10;
  }
  if(sum == 0) return false;
  else return (n % sum == 0);
}

signed main(){
  long long n;
  cin >> n;
  cout << (digit(n) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N,M;
  vector<int> Ldata(100010);
  vector<int> Rdata(100010);
  int Nmax = 0;
  int Mmin = 200000;
  int judge;
  
    cin >> N;
    cin >> M;
    
    for(int g = 0; g<M ; g++){
      
    cin>>Ldata.at(g);
    cin>>Rdata.at(g);
    
    }
  
 
  
  for (int i = 0; i <M; i++) {
     if(Ldata.at(i) > Nmax){
       Nmax = Ldata.at(i);
     }
     
     if(Rdata.at(i) < Mmin){
       Mmin = Rdata.at(i);
     }
     
     
  }
  
  judge = Mmin - Nmax + 1;
  if(judge<=0){
    judge = 0;
  }
  
cout << judge << endl;
  
}
  
 

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

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <int, ii> iii;
typedef pair<ll, ll> pll;
typedef pair<double, int> pdi;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
#ifdef VC
#define scanf scanf_s
#endif
#define iINF (1<<30)
#define INF (1LL<<59)
#define forn(i) for(int i = 0;i < n; ++i)
#define form(i,n) for(int i = 0 ;i < n; ++i)
#define NIL -1

const int mod = 1e9 + 7;
int n;
int m;
string s;
string as[5];

int main() {
	cin >> s;
	int k;
	cin >> k;
	form(i, k) {
		as[i] = "}";
	}
	for (int i = 0; i < s.length(); i++) {
		for (int j = i; j < min((int)s.length(), i+5); j++) {
			form(l, k) {
				string temp;
				temp = s.substr(i, j - i + 1);
				if (temp < as[l]) {
					for (int p = k - 1; p > l; p--) {
						as[p] = as[p - 1];
					}
					as[l] = temp;
					break;
				}
				else if (temp == as[l])break;
			}
		}
	}
	cout << as[k - 1] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;


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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
AC;
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
swap(a,b);
swap(a,c);
printf("%d %d %d",a,b,c);





    return 0;
}


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


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n;
    cin>>n;
    double x[n],y[n];
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        v[i] = i;
    }
    double ans = 0;
    do{
        for(int i=0;i<n-1;i++){
            ans += sqrt((x[v[i]] - x[v[i+1]])*(x[v[i]] - x[v[i+1]]) + (y[v[i]]-y[v[i+1]])*(y[v[i]]-y[v[i+1]]));
        }
    }while(next_permutation(v.begin(),v.end()));
    for(int i=1;i<=n;i++){
        ans =(double) ans / i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int m = stdIn.nextInt();
		int[][] A = new int[n][m];
		int[] ans = new int[n];
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				A[i][j] = stdIn.nextInt();
			}
		}
		for (int i=0; i<m; i++) {
			int b = stdIn.nextInt();
			for (int j=0; j<n; j++) {
				ans[j] += A[j][i]*b;
			}
		}
		for (int ret : ans) {
			System.out.println(ret);
		}
	}
}

Measured memory_bytes: 31872
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define MOD 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define M 1e6+9
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
#define int long long
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};  
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}
ll lcm(ll a, ll b) { return (a*b)/ gcd(a,b);}

// ll n,k,a,b,c,d,x,y,z,m,l;
// ll ans;
// vecl arr(N);
// ll dp[509][509];
// ll pre[N];

unordered_map<int,int> mp;

int fun(int h) {
    if(h == 1) {
        return 1;
    }
    if(mp.find(h) != mp.end()) {
        return mp[h];
    }

    int x = fun(h/2);
    int y = fun(h/2);


    mp[h] = x+y+1;
    return mp[h];
}


void test_case() {
	
    int h;
    cin>>h;

    int ans = fun(h);

    cout<<ans<<endl;



}


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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


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

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

ll dp[1010];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  // 1! = 1
  //    => 1 
  //
  // 2! = 1! x 2
  //    2: 1
  //    => (1 + 1) = 2
  //
  // 3! = 2! x 3
  //    2: 1
  //    3: 1
  //    => (1 + 1) x (1 + 1) = 4
  //
  // 4! = 3! x 4
  //    2: 3
  //    3: 1
  //    => (3 + 1) x (1 + 1) = 8
  //
  // 5! = 4! x 5
  //    2: 3
  //    3: 1
  //    5: 1
  //    => (3 + 1) x (1 + 1) x (1 + 1) = 16
  ll ans = 1;
  ll n;
  cin >> n;

  if(n == 1) {
    cout << "1\n";
    return 0;
  }

  fi(2, n + 1) {
    int x = i;
    while(x % 2 == 0) {
      (dp[2] += 1) %= MOD;
      x /= 2;
    }
    for(int j = 3; j <= sqrt(x); j += 2) {
      while(x % j == 0) {
        (dp[j] += 1) %= MOD;
        x /= j;
      }
    }
    if(x > 2)
      dp[x]++;
  }

  fi(0, 1010) {
    if(dp[i]) {
      // cout << i << ":" << dp[i] << endl;
      (ans *= (dp[i] + 1)) %= MOD;
    }
  }
  
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
using System;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var r = Convert.ToDouble(Console.ReadLine());

            var s = r * r * Math.PI;
            var l = 2 * Math.PI * r;

            Console.WriteLine(s.ToString("F6") + " " + l.ToString("F6"));
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9308
#include <bits/stdc++.h>
#define MOD 1000000007
typedef long long int ll;
using namespace std;

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

Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;

#define INF (1e9)

int H, W, K;

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

    vvi s(H, vi(W));
    vb hasS(H);
    for (int i = 0; i < H; i++) {
        int ns = 0;
        for (int j = 0; j < W; j++) {
            char c;
            cin >> c;
            s[i][j] = c == '#' ? 1 : 0;
            if (s[i][j]) {
                hasS[i] = true;
            }
        }
    }

    int id = 0;
    for (int i = 0; i < H; i++) {
        int last = 0;
        for (int j = 0; j < W; j++) {
            if (s[i][j] > 0) {
                last = id + 1;
                id++;
            }
            s[i][j] = last;
        }
    }

    for (int i = H - 1; i >= 0; i--) {
        int tmp = 0;
        for (int j = W - 1; j >= 0; j--) {
            if (s[i][j] != 0)
                tmp = s[i][j];
            else
                s[i][j] = tmp;
        }
    }

    for (int j = W - 1; j >= 0; j--) {
        int tmp = 0;
        for (int i = H - 1; i >= 0; i--) {
            if (s[i][j] != 0)
                tmp = s[i][j];
            else
                s[i][j] = tmp;
        }
    }
    for (int j = W - 1; j >= 0; j--) {
        int tmp = 0;
        for (int i = 0; i < H; i++) {
            if (s[i][j] != 0)
                tmp = s[i][j];
            else
                s[i][j] = tmp;
        }
    }

    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << s[i][j] << ' ';
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1152
abc = list(map(int,input().split()))
abc.sort()
answer = 0


while len(set(abc))!=1:
  if abc[2]-abc[1] > 0 and abc[2]-abc[0] > 0:
    abc[0] += 1
    abc[1]+=1
  elif abc[2]-abc[1] > 0:
    abc[1] += 2
  else:
    abc[0] += 2
  answer+=1
  abc.sort()

print(answer)

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>	
#include <cmath>
#include <string>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define Cout(s) cout<<s<<endl
using namespace std;
typedef long long ll;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================
int ketawa(int a) {
	if (a < 10)return a;
	else return a % 10 + ketawa(a / 10);
}

int a = 1, b = 0, c, d, n, k = 0, ans = 0;
string s, t;

int main()
{
	int n, k; cin >> n >> k;
	vector<int> x(n); rep(i, n)cin >> x[i];
	int sum = 0;
	rep(i, n) {
		sum += min(x[i], abs(k - x[i]));
	}
	cout << sum * 2 << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    map<string,int> ma;
    rep(i,n) {
        string s;
        cin >> s;
        ma[s]++;
    }
    int m;
    cin >> m;
    rep(i,m) {
        string s;
        cin >> s;
        ma[s]--;
    }
    int ans = 0;
    for(auto p : ma) {
        ans = max(ans,p.second);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
// #define INF
// #define mp
// #define pb

// #define fi
// #define se

// #define each

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

typedef long long ll;

int main(){
	while(1){
		int n; cin>>n;
		if(n==0) break;

		vector<bool> P(n*2+1,true);
		P[0] = P[1] = false;
		for(int i=2;i*i<=2*n;i++) if(P[i]){
			for(int j=2;j*i<=2*n;j++) P[i*j] = false;
		}

		int ans = 0;
		REP(i,n+1,2*n+1) if(P[i]) ans++;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3088
O = list(str(input()))
E = list(str(input()))
lists = []
if (len(O) - len(E)) == 0:
    for i in range(len(O)):
        lists.append(O[i])
        lists.append(E[i])
else:
    E.append(";")
    for i in range(len(O)):
        lists.append(O[i])
        lists.append(E[i])
    del lists[-1]
print("".join(lists))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,L,R,MIN=1e9,MAX=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>L>>R;
        MAX=max(MAX,L);
        MIN=min(MIN,R);
    }
    cout<<max(0,MIN-MAX+1)<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
long long a[100005];
int n;
int main()
{
	for(int i=1;i<=100000;i++)
		a[i]=i*i;
	cin>>n;
	for(int i=1;;i++)
	{
		if(a[i]>n)
		{
			cout<<a[i-1]<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define MAX 5 * 10000 + 1
#define INF 10000000000
const int MAX_LEN = 3001;
string s, t;
vector<vector<int>> dp(MAX_LEN, vector<int>(MAX_LEN, 0));

vector<char> ans;

void reconstruct(int r, int c)
{
    //cout << r << " " << c << endl;
    if (r == 0 || c == 0) return;
    if (s[r-1] == t[c-1])
    {
        reconstruct(r-1, c-1);
        ans.push_back(s[r-1]);
    }
    else if (dp[r][c] == dp[r-1][c]) // JUEPUTA VIDA JAJAJAJA
        reconstruct(r-1, c);
    else
        reconstruct(r, c-1);
}


int main()
{
    cin >> s >> t;
    int len_s = s.length();
    int len_t = t.length();
    
    for (int i = 1; i <= len_s; ++i)
        for (int j = 1; j <= len_t; ++j)
            if (s[i-1] == t[j-1])
                dp[i][j] = 1 + dp[i-1][j-1];
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
    
    /* for(int r = 1; r <= len_s; ++r)
        for (int c = 1; c <= len_t; ++c)
            cout << dp[r][c] << " ";
        cout << endl; */
    //cout << dp[len_s][len_t] << endl;
    reconstruct(len_s, len_t);
    for (char elem: ans)
        cout << elem;
    cout << endl;
    return 0;

}

Measured memory_bytes: 35840
n = int(input())
a = [int(item) for item in input().split()]

double1 = 0
for i, val in enumerate(a):
    if i % 2 == 0:
        double1 += val 
    else:
        double1 -= val

ans = []
ans.append(double1)
prev = double1
for i in range(n-1):
    val = a[i] * 2 - prev
    ans.append(val)
    prev = val
print(" ".join([str(item) for item in ans]))


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

signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    #ifdef _DEBUG
    freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    #endif
    
    int n, i;
    cin>>n;
    std::vector<int> v;
    int a[n+1], ans[n+1]={0};
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    for(i=n;i>=1;i--){
        int sum=0;
        for(int j=i;j<=n;j+=i){
            sum+=ans[j];
        }
        if(sum%2!=a[i]){
            ans[i]=1;
            v.push_back(i);
        }
    }
    cout<<v.size()<<endl;
    for(i=0;i<v.size();i++)
        cout<<v[i]<<" ";

    
}

Measured memory_bytes: 5108
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;



int main()
{
    int a,b,c,k;
    cin >> a>>b>>c;
    cin >> k;
    int count = 0;
    bool bo = false;

    while (a >= b) {
        b = b * 2;
        count++;
        if (count > k) {
            bo = true;
            break;
        }
    }
    while (b >= c) {
        c = c * 2;
        count++;
        if (count > k) {
            bo = true;
            break;
        }
    }

    if (bo == false) {
        cout << "Yes";
    }
    else {
        cout << "No";

    }

    return 0;
}



Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, q; cin >> n >> q;
  vll s(n), t(n), x(n);
  REP(i, n) {
    ll _s, _t, _x; cin >> _s >> _t >> _x;
    s.at(i) = _s-_x; t.at(i) = _t-_x; x.at(i) = _x;
  }
  vll ord(n); iota(ord.begin(), ord.end(), 0);
  sort(ord.begin(), ord.end(), [&](ll i, ll j) {
    if (x.at(i) == x.at(j) && s.at(i) == s.at(j)) return t.at(i) < t.at(j);
    else if (x.at(i) == x.at(j)) return s.at(i) < s.at(j);
    else return x.at(i) < x.at(j);
  });
  set<P<ll, ll>> d;
  REP(i, q) {ll tmpq; cin >> tmpq; d.insert({tmpq, i});}
  vll ans(q, -1);
  REP(i, n) {
    auto first = d.lower_bound({s.at(ord.at(i)), 0});
    auto end = d.upper_bound({t.at(ord.at(i))-1, q});
    for(auto it=first; it!=end; it++) {
      ans[it->second] = x.at(ord.at(i));
    }
    d.erase(first, end);
  }
  REP(i, q) cout << ans.at(i) << endl;
  return 0;
}


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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

signed main() {
    ll N;
    string s1,s2;
    cin>>N>>s1>>s2;
    vector<ll> v;
    ll i = 0;
    while(i<N){
        if (i+1 < N && s1[i]==s1[i+1]){
            v.push_back(2);
            i+=2;
        }else {
            v.push_back(1);
            i++;
        }
    }
    ll ans = (v[0]==2)?6:3;
    rep(i,1,v.size()){
        if (v[i] == 1 && v[i-1] == 1){
            ans *= 2;
        } else if (v[i]==1 && v[i-1] == 2){
            ans *= 1;
        } else if (v[i]==2 && v[i-1] == 1){
            ans *= 2;
        } else if (v[i]==2 && v[i-1] == 2){
            ans *= 3;
        }
        ans %= 1000000007;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256