akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define br cout<<endl;
#define pb push_back
#define left(x) x.begin(), x.end()
#define right(x) x.begin(), x.end(), greater<ll>()
#define mp make_pair
bool compare(const ll x,const ll y){
    return abs(x)>abs(y);
}

void solve(){   
    float n;
    cin>>n;
    if(int(n)==n ){
        if(n==0)cout<<1;
        else cout<<0;
    }
}
int main(){
    fast;
    ll q=1;
    // cin>>q;
    while(q--){
        solve();br;
    }    
}

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

#pragma once

ll euclid(ll a, ll b, ll &x, ll &y) {
	if (b) { ll d = euclid(b, a % b, y, x);
		return y -= a/b * x, d; }
	return x = 1, y = 0, a;
}

const ll mod = 1e9 + 7;
struct Mod {
	ll x;
	Mod(ll xx) : x(xx) {}
	Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
	Mod operator-(Mod b) { return Mod((x - b.x + mod) % mod); }
	Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
	Mod operator/(Mod b) { return *this * invert(b); }
	Mod invert(Mod a) {
		ll x, y, g = euclid(a.x, mod, x, y);
		assert(g == 1); return Mod((x + mod) % mod);
	}
	Mod operator^(ll e) {
		if (!e) return Mod(1);
		Mod r = *this ^ (e / 2); r = r * r;
		return e&1 ? *this * r : r;
	}
};

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);

  ll K;
  string S;
  cin >> K >> S;
  int n = sz(S);

  Mod prod = Mod(26)^K;
//  cout << prod.x << endl;
  Mod total = prod;

  rep(y, 1, K+1){
    prod = prod / Mod(26);
    prod = prod * Mod(25);
    prod = prod * Mod(y + n - 1);
    prod = prod / Mod(y);
    total = total + prod;
  }
  cout << total.x << endl;
}


Measured memory_bytes: 4260
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 100000000;
#define rep1(i, n) for (ll i=0; i<(n); i++) 
#define rep2(i, k, n) for (ll i=k; i<(n); 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; }


int main() {
    ll H, W, h, w;
    cin >> H >> W >> h >> w;
    ll ans = (H-h)*(W-w); 
    cout << ans << endl;
}

Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
//max_element



signed main()
{
	string s, t;
	cin >> s;
	cin >> t;
	int ans = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] != t[i])ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3856
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
	long long a,c;
	double b;
	cin>>a>>b;
//	b=floor(b);
	c=b*100+0.3;
	cout<<(long long)(a*c)/100<<endl;
	return 0;
}


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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n; cin >> n;
	unordered_map<string, ll> m;
	rep(i,n){
		string s; cin >> s;
		sort(s.begin(), s.end());
		m[s]++;
	}
	ll ans = 0;
	for(auto it = m.begin(); it != m.end(); it++){
		ll num = (it->second)*(it->second - 1)/2;
		ans += num;
	}
	cout << ans << endl;
} 

Measured memory_bytes: 10660
#include <bits/stdc++.h>
#define sz(c)      int(c.size())
#define rep(i,a,b) for (int i=a; i<(b); ++i)
#define per(i,a,b) for (int i=(b)-1; i>=(a); --i)
using namespace std;
using ll = long long;

int const MAXN=220000;
int N;
ll K;
int a[MAXN],pr[MAXN],nx[MAXN],len[MAXN];
ll last[MAXN];

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

	cin>>N>>K;
	rep(i,0,N) cin>>a[i];
	
	rep(i,0,N) pr[a[i]]=-1;
	rep(i,0,2*N) {
		int cur=a[i%N];
		if (pr[cur]!=-1 && pr[cur]<N) {
			nx[pr[cur]]=(i+1)%N;
			len[pr[cur]]=i+1-pr[cur];
		}
		pr[cur]=i;
	}
	
	K*=N;
	rep(i,0,N) last[i]=-1;
	int cur=0;
	while (K>len[cur]) {
		if (last[cur]!=-1) {
			K%=last[cur]-K;
			if (K<len[cur]) break;
		}
		
		last[cur]=K;
		K-=len[cur];
		cur=nx[cur];
	}
	
	map<int,int> pos;
	vector<int> s;
	while (K>0) {
		int p=pos[a[cur]];
		if (p<sz(s) && s[p]==a[cur]) {
			s.erase(begin(s)+p,end(s));
		} else {
			s.push_back(a[cur]);
			pos[a[cur]]=sz(s)-1;
		}
		cur=(cur+1)%N;
		K--;
	}
	
	rep(i,0,sz(s)) cout<<s[i]<<" \n"[i+1==sz(s)];
}


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


int main(){
	int a,b,c;
	cin >> a >> b >> c;
	
	for(int i=min(a,b);i<=max(a,b);i++){
		if(i==c){
			cout << "Yes" << endl;
			return 0;
		}
		
	}
	cout << "No"<< endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void extend(int h, int w, char **c,char **ex_c)
{
  int i;

  w++;
  for (i = 0; i < h * 2; i++) {
    memcpy(ex_c[i], c[i / 2], sizeof(char)*w);
  }

  return;
}

char **c_malloc(int h, int w)
{
  int i;
  char **ans;

  w++;

  ans = malloc(sizeof(char*)*h);
  for (i = 0; i < h; i++)ans[i] = malloc(sizeof(char)*w);

  return(ans);
}

void c_free(int h, int w, char **c)
{
  int i;
  for (i = 0; i < h; i++)free(c[i]);
  free(c);

  return;
}

int main(void)
{
  int i;
  int h, w;
  char **c, **ex_c;

  scanf("%d %d", &h, &w);

  c = c_malloc(h, w);
  ex_c = c_malloc(h * 2, w);

  for (i = 0; i < h; i++)scanf("%s", c[i]);

  extend(h, w, c, ex_c);

  for (i = 0; i < h * 2; i++)printf("%s\n", ex_c[i]);

  c_free(h, w, c);
  c_free(h, w, ex_c);

  return(0);
}


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

int main (){
    string S, T, U;
    cin>>S>>T>>U;
    char s=S.at(0);
    char t=T.at(0);
    char u=U.at(0);
    s -= 0x20;
    t -= 0x20;
    u -= 0x20;
    cout<<s<<t<<u<<endl;

}

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

using namespace std;
int main() {
	string s;
	cin >> s;
	vector<string> b;
	b.resize(100);
	int c = 0;
	for (int i = 0; i < s.length() -1; ++i) {
		b[i] = s[i];
		b[i] += s[i + 1];
		b[i] += s[i + 2];
		++c;
	}
	int min = 999;
	for (int i = 0; i < c; ++i) {
		if (abs(stoi(b[i]) - 753) < min) {
			min = abs(stoi(b[i]) - 753);
		}
	}

	cout << min << endl;
	system("pause");

	return 0;
}

Measured memory_bytes: 1008
#include <bits/stdc++.h>
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define set_zero(a) memset(a,0,sizeof(a));
#define ll long long
#define PI 2 * acos(0.0)
#define MAX 1000000000
#define INF 1000000 
#define M 1000000007
using namespace std;
int main(){
   fast_io
   ll n,k;
   cin>>n>>k;
   ll r,s,p;
   cin>>r>>s>>p;
   ll ans = 0;
   string s1;
   cin>>s1;
    string g;
   for(ll i = 0;i<s1.length();i++){
       if(i < k){
          if(s1[i] == 'r'){
             ans+=p;
             g.push_back('p');
          }
          if(s1[i] == 'p'){
             ans +=s;
              g.push_back('s');
          }
          if(s1[i] == 's'){
             ans += r;
              g.push_back('r');
          }
       }
       else{
         if(s1[i] == 's'){
            if(g[i-k] == 'r'){
               if(s1[i+k] == 'p' && i+k < (s1.length())){
                  g.push_back('p');
               }
               else{
                  g.push_back('s');
               }
            }
            else{
               ans += r;
                g.push_back('r');
            }
         }
         if(s1[i] == 'p'){
            if(g[i-k] == 's'){
               if(s1[i+k] == 's' && i+k < (s1.length())){
                  g.push_back('p');
               }
               else{
                  g.push_back('r');
               }
            }
            else{
               ans += s;
                g.push_back('s');
            }
         }
         if(s1[i] == 'r'){
            if(g[i-k] == 'p'){
               if(s1[i+k] == 'p' && i+k < (s1.length())){
                  g.push_back('r');
               }
               else{
                  g.push_back('s');
               }
            }
            else{
               ans += p;
                g.push_back('p');
            }
         }
       }
   }
   cout<<ans<<endl;
   return 0;
}

Measured memory_bytes: 3740
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;

int main(){
  int n;
  bool bprime[10001];
  fill(bprime, bprime + 10001, true);
  vector<int> prime;
  FOR(i,2,10001){
    if(bprime[i]){
      for(int j = i * i; j < 10001; j+=i) bprime[j] = false;
      prime.push_back(i);
    }
  }
  int count[10001] = {};
  FORIT(it, prime){
    int t = 0;
    for(vector<int>::iterator it2 = it; it2 != prime.end(); it2++){
      t += *it2;
      if(t > 10000) break;
      count[t]++;
    }
  }
  while(cin>>n,n){
    cout<<count[n]<<endl;
  }

  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  ll N, K;
  cin >> N >> K;
  ll res = 0;
  for (ll b = 1; b <= N; b++) {
    // a < b
    res += max(0ll, b - max(K, 1ll));
    // a >= b
    if (K <= b - 1) {
      ll rem = (N - b + 1);
      res += rem / b * (b - 1 - K + 1);
      if (rem % b != 0 && K <= N % b) {
        res += N % b - K + 1;
      }
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		String ss = sc.next();
		char[] ch = new char[N];
		for( int i=0; i<N; i++ ){
			ch[i] = ss.charAt(i);
		}
		int count = 0;
		for( int i=0; i<N-1; i++ ){
			if( ch[i]==ch[i+1] ){
				ch[i]=0;
				count++;
			}
		}
		System.out.println(N-count);
	}
}


Measured memory_bytes: 27236
#include <cstdio>
#include <cstring>
using namespace std;
int H;
int A[2000001];

const int INFTY = 2000000001;

void maxHeapify(int i) {
	int l = 2 * i;
	int r = 2 * i + 1;

	int largest = i;
	if (l <= H && A[l] > A[i])
		largest = l;

	if (r <= H && A[r] > A[largest])
		largest = r;

	if (largest != i) {
		int t = A[i];
		A[i] = A[largest];
		A[largest] = t;
		maxHeapify(largest);
	}
}

void heapIncreaseKey(int i, int key)
{
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		int t = A[i];
		A[i] = A[i / 2];
		A[i / 2] = t;
		i = i / 2;
	}
}

void insert(int key) {
	H++;
	A[H] = - INFTY;
	heapIncreaseKey(H, key);
}

int heapExtractMax() {
	if (H < 1) return -1;
	int max = A[1];
	A[1] = A[H];
	H--;
	maxHeapify(1);
	return max;
}

int main()
{
	H = 0;
	char cmd[16];
	bool go = true;
	while(go) {
		int v;
		scanf("%s", cmd);
		if (strcmp(cmd, "insert") == 0) {
			scanf("%d", &v);
			insert(v);
		} else if (strcmp(cmd, "extract") == 0)
			printf("%d\n", heapExtractMax());
		else if (strcmp(cmd, "end") == 0)
			go = false;
	}
	return 0;
}

Measured memory_bytes: 5128
$ans = 0

def dfs(l,i)
    if l >= $N
        sum = 0
        for k in 0...$Q
            sum += $d[k] if $x[$b[k]] - $x[$a[k]] == $c[k]
        end
        $ans = sum if $ans < sum
    else
        for k in i..$M
            $x[l+1] = k
            dfs(l+1, k)
        end
    end
end

$N, $M, $Q = gets.split.map(&:to_i)

$x = Array.new($N)

$a = Array.new($Q)
$b = Array.new($Q)
$c = Array.new($Q)
$d = Array.new($Q)

for i in 0...$Q do
    $a[i],$b[i],$c[i],$d[i] = gets.split.map(&:to_i)
end

$x[0] = 1
dfs(0,1)

puts $ans


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

int main() {
        int N, i;
        string S;
        string X = "Three";

        cin >> N;

        for (i = 0; i < N; i++) {
                cin >> S;
                if (S == "Y") {
                        X = "Four";
                }
        }

        cout << X << endl;
}


Measured memory_bytes: 256
import numpy as np

n, m = map(int, input().strip().split())
data = [map(int, input().strip().split()) for _ in range(m)]

left = np.zeros(n + 1, dtype=np.int32)
right = np.zeros(n + 1, dtype=np.int32)

for l, r in data:
    left[l] += 1
    right[r] += 1

card = 0
count = 0
for i in range(n + 1):
    count += left[i]
    if count == m:
        card += 1
    count -= right[i]

print(card)


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

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
const int  p=31,po=1,N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7 ;
ll s;
vl compute(string s){
        vl has(s.length());
        ll i;

        for(i=0;i<s.length();i++){
            if(i==0){
                has[i]=((s[i]-'a'+1))%mod;
            }
            else
                has[i]=(has[i-1]*p + (s[i]-'a'+1))%mod;
        }
        return has;
}
// vl ed[N],g[N],in(N),vis(N,0),cost(N,0);
vl g[N],vis(N,0);

// vl vis(N,0);
// bool check(ll x){
//   ll i,j,k;
//   for(i=0;i<N;i++)  g[i].clear();
//   memset(in,0,sizeof(in));
//   ll tar=ed[x][0];
//   for(i=1;i<=m;i++){
//     if(ed[i][0]>tar){
//       g[ed[i][1]].pb(g[ed[i][2]]);
//       ++in[ed[i][1]];
//     }
//   }

// }
// ll dp[101][(ll)1e9+1];
vl ans(N,-1);
ll result=0;
ll dp(ll x){
  // vis[x]=1;
  if(ans[x]!=-1)
    return ans[x];
  ll m=0;
  for(auto &it:g[x]){
    m=max(m,ans[it]+1);
  }
  ans[x]=m;
  result=max(result,ans[x]);
  return ans[x];
}
// vl cr(N);
// ll vis[5][5],actual[5][5];
// ll vis[1010][1010];

int main(){
 ios_base::sync_with_stdio(0);
  ll n,k;
  cin >> n >> k;
  map<ll,ll> m;
  ll i;
  for(i=1;i<=n;i++){
      m[i%k]++;
  }
  ll ans=0;
 // for(i=0;i<min(n,k);i++){
  //    ans+=m[i]*m[i]*m[(k-i)%k];
  //}
  ans+=m[0]*m[0]*m[0];
  if(!(k&1))
    	ans+=m[k/2]*m[k/2]*m[k/2];
  cout << ans;
  return 0;
}

Measured memory_bytes: 10368
# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };



int main()
{
	int n;
	while (cin >> n&&n)
	{
		vector<piii> a;
		vector<double> d[1001];
		FOR(i, n)
		{
			piii x; cin >> x.first >> x.second.first >> x.second.second;
			a.push_back(x);
		}
		FOR(i, n)
		{
			FOR(j, n)
			{
				pii x = a[i].second;
				pii y = a[j].second;
				d[i].push_back(sqrt((x.first - y.first)*(x.first - y.first) + (x.second - y.second)*(x.second - y.second)));
			}
		}
		INT(m);
		while (m--)
		{
			typedef pair<double, vi> P;
			INT(start); INT(goal);
			priority_queue< P,vector<P>,greater<P> > que;
			double memo[1001];
			fill(begin(memo), end(memo), 9999999999999.0);
			
			int f;
			for (int i = 0; i < n; i++)
			{
				if (a[i].first == start)f = i;
			}
			memo[f] = 0.0;
			que.push(P(0.0, {f}));
			bool ok = false;
			while (!que.empty())
			{
				P now = que.top(); que.pop();
				int p = now.second.back();
				double k = now.first;
				if(a[p].first==goal)
				{
					ok = true;
					for (int i = 0; i < now.second.size();i++)
					{
						if (i)cout << " ";
						cout << a[now.second[i]].first;
					}
					break;
				}
				for (int i = 0; i < n; i++)
				{
					if (i == p||d[p][i]>50.0)continue;
					if (memo[i] > k + d[p][i])
					{
						memo[i] = k + d[p][i];
						P next = now;
						next.first += d[p][i];
						next.second.push_back(i);
						que.push(next);
					}
				}
			}
			if (!ok)cout << "NA";
			cout << endl;
		}
	}
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(x--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__);
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif

const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const ld PI = acos(-1.0);
const int MOD = 1000000007;
const int INF = 1e18;
const int N = 1e6+5;


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
  
    int n,ans=0;
    cin>>n;
    for(int i = 1;i<n;i++){
        ans+=(n-1)/i;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define FOR(i, l, r) for(int i = (int)l; i <= (int)r; ++i)

using namespace std;
const int Nmax = 112;
const int Kmax = 1e5 + 11;

int n, a[Nmax], f[Kmax][3], K;

int dp(int x, int t) {
    if (f[x][t] != -1) return f[x][t];
    bool res = false;
    FOR(i, 1, n) {
        if (x - a[i] >= 0) {
            res = res || (dp(x - a[i], 1 - t) == false);
        }
    }
    return f[x][t] = res;
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> K;
    FOR(i, 1, n) {
        cin >> a[i];
    }
    memset(f, -1, sizeof(f));
    if (dp(K, 0)) cout << "First";
    else cout << "Second";
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
int main() {
  ll n,ans=0;
  cin >> n;
  vector<ll>a(n);
  vector<ll>b(n);
  vector<ll>c(n);
  for(ll i=0;i<n;i++) {
  	cin >> a.at(i);
		a.at(i)--;
  }
  for(ll i=0;i<n;i++) cin >> b.at(i);
  for(ll i=0;i<n;i++) cin >> c.at(i);
  for(ll i=0;i<n;i++) ans+=b.at(i);
  for(ll i=1;i<n;i++){
		if(a.at(i)==a.at(i-1)+1){
			ans+=c.at(a.at(i)-1);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
// Problem : C - Many Requirements
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/**
 * @author dwij
 */

#include <bits/stdc++.h>

#include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>

using namespace std;

//******* Debugging Class Template *******/
#define sim template <class c
#define ris return *this
#define dor > deb& operator<<
#define eni(x) \
    sim > typename enable_if<sizeof dud<c>(0) x 1, deb&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct deb {
#ifdef LOCAL
    ~deb() { cerr << endl; }
    eni(!=) cerr << boolalpha << i;
    ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d) {
    ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
}
#else
    sim dor(const c&) { ris; }
#endif
}
;
#define log(...) "[" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// End of weird debugging stuff.

typedef long long ll;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;

#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define pii pair<int, int>
#define pll pair<ll, ll>

#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(), c.end()
#define mem(a, val) memset(a, val, sizeof(a))
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define endl "\n"

vector<tuple<int, int, int, int>> v;
int ans = 0;
int n, m;
void dfs(vi s) {
    if (s.size() == n+1) {
        //deb() << log(s);
        int a, b, c, d;
        int res = 0;
        for (auto val : v) {
            tie(a, b, c, d) = val;
            if (s[b-1] - s[a-1] == c) res += d;
        }

        ans = max(res, ans);
        return;
    }

    while (s.back() <= m) {
        s.pb(s.back());
        dfs(s);
        s.pop_back();
        s.back()++;
    }
}

void solution() {
    // deb() << log();
    int q;
    cin >> n >> m >> q;

    v.resize(q);

    for (int i = 0; i < q; i++) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        v[i] = tie(a, b, c, d);
    }

    vi s;
    s.pb(1);
    dfs(s);
    cout << ans << endl;
}

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

    int T = 1;
    // cin >> T;
    // cin.ignore(); must be there when using getline(cin, s)
    for (int tt = 1; tt <= T; tt++) {
        // cout << "Case #" << tt << ": ";
        solution();
    }

    return 0;
}


Measured memory_bytes: 3660
import java.util.*;

public class Main{
      public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            String str1 = sc.next();
            if("a".equals(str1) || "i".equals(str1) || "u".equals(str1) || "e".equals(str1) || "o".equals(str1)){
              System.out.println("vowel");
            } else {
              System.out.println("consonant");
            }
            }
}

Measured memory_bytes: 21844
from collections import deque
n = int(input())
data = [None]*n
unvisited = [1]*n
for _ in range(n):
    a,*b = map(int,input().split())
    a -= 1
    data[a] = deque([i-1 for i in b[1:]])

d = [-1]*n
f = [-1]*n
t = 0

dq = deque([])
for u in range(n):
    if unvisited[u]:
        dq.append(u)
        unvisited[u] = 0
        t += 1
        d[u] = t
        while dq:
            k = dq[-1]
            if data[k]:
                v = data[k].popleft()
                if unvisited[v]:
                    unvisited[v] = 0
                    t += 1
                    d[v] = t
                    dq.append(v)
            else:
                dq.pop()
                t += 1
                f[k] = t

for i in range(n):
    print(i+1,d[i],f[i])


Measured memory_bytes: 6088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var str = IO.GetIntList();
            var ans = str.Sum() - str.Max();


            Console.Write(ans);
        }
    }


    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 13396
from math import ceil
A = [input() for i in range(5)]
A = sorted(A,key = lambda x:x[-1])
A = [int(a) for a in A]
time = 0
for a in A:
	time += ceil(a/10)*10
for a in A:
	if a%10 != 0:
		time -= 10-(a%10)
		break
print(time)	

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define io_optimized ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

int main(){
#define int int_fast32_t
	io_optimized
	int n;
	while(cin>>n)
	{
		int a[n];
		int minn=0,maxx=101;
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
			minn=min(minn,a[i]);
			maxx=max(maxx,a[i]);
		}
		int ans=2147483647;
		for(int i=minn;i<=maxx;i++)
		{
			int sum=0;
			for(int j=0;j<n;j++)
			{
				sum+=(a[j]-i)*(a[j]-i);
			}
			ans=min(ans,sum);
		}
		cout<<ans<<"\n";
	}

	return 0;
}


Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,k = readInts()
P = list(map(lambda x:int(x)+1, input().split()))
# accumulate
A = [0] + list(accumulate(P))
#print(A)
res = 0
for i in range(n-k+1):
    res = max(res, A[i+k] - A[i])
print(res/2.0)


Measured memory_bytes: 34452
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
int ne[N*2],num,fi[N],zz[N*2],tot,n,m,x[N],y[N];
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
void dfs(int x,int y,int z){
	if (z>m/2)return;
	num++;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)dfs(zz[i],x,z+1);
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<n;i++){
		scanf("%d%d",&x[i],&y[i]);
		jb(x[i],y[i]);jb(y[i],x[i]);
	}
	if (m%2==0){
		int ans=0;
		for (int i=1;i<=n;i++){
			num=0;
			dfs(i,0,0);
			ans=max(num,ans);
		}
		printf("%d\n",n-ans);
	}
	else {
		int ans=0;
		for (int i=1;i<n;i++){
			num=0;
			dfs(x[i],y[i],0);
			dfs(y[i],x[i],0);
			ans=max(ans,num);
		}
		printf("%d\n",n-ans);
	}
}

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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
typedef long double ld;
typedef long long ll;
const int MOD =  1000000007;
const int IINF = INT_MAX;
const ll INF = 1LL << 60;


int main() {
    int n; cin >> n;
    V<P<ll, ll> > even(100010), odd(100010);
    for(int i = 0; i < n; i++){
        ll v; cin >> v;
        if(i & 1){
            odd[v].first++;
            odd[v].second = v;
        }else{
            even[v].first++;
            even[v].second = v;
        }
    }

    sort(ALL(odd), greater<P<ll, ll>>());
    sort(ALL(even), greater<P<ll, ll>>());

    ll t = 0;
    if(odd[0].second == even[0].second){
        t = max(odd[0].first + even[1].first, odd[1].first + even[0].first);
    }else{
        t = odd[0].first + even[0].first;
    }
    cout << n - t << endl;

    return 0;
}


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

#define FAST        ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ll          long long
#define ull         unsigned long long
#define all(a)      a.begin(), a.end()
#define rall(a)     a.rbegin(), a.rend()
#define pii         pair<int, int>
#define mod         1000000007
#define PI          acos(-1)

using namespace std;



int main (){
    FAST;
    //freopen("input.txt", "r", stdin);

    int t;
    cin>>t;
    if(t>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define pb          push_back
#define ll			long long
#define endl        '\n'
#define pll         pair<int,int>
#define vll          vector<int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    ((a)*(b)) / gcd((a),(b))
#define int	    int64_t
#define ios     ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); 
int n,a[55][55],ans[55][55],res[55][55];
void multiplyAnsBase(){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int temp = 0;
			for(int k=0;k<n;k++){
				temp = (temp+ ans[i][k]*a[k][j])%hell;
			}
			res[i][j]=temp;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			ans[i][j]=res[i][j];
		}
	}
}
void multiplyBaseBase(){
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			int temp = 0;
			for(int k=0;k<n;k++){
				temp = (temp+ a[i][k]*a[k][j])%hell;
			}
			res[i][j]=temp;
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			a[i][j]=res[i][j];
		}
	}
}
void solve(){
	int k;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>a[i][j];
			ans[i][j] = (i==j);
		}
	}
	while(k!=0){
		if(k&1) multiplyAnsBase();
		multiplyBaseBase();
		k/=2;
	}
	int temp = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			temp=(temp+ans[i][j])%hell;
		}
	}
	cout<<temp<<endl;
}
signed main()
{
   // ios
    int test = 1;
    //cin>>test;
    while(test--){
    	solve();
    }
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N=(int)2e5+99;
int n, a[N], poz[N], Time;
bool pos[N];
ll k;
vector<int> v;
int main() {
    IOS; cin >> n >> k;
    for(int i=1; i<=n; ++i) cin >> a[i];
    Time=0;
    for(int i=1;; i=a[i]) {
        if(pos[i]) {
            int poc=poz[i];
            int kraj=Time-1;
            int pref=poc;
            if((ll)(pref-1)>=k) {
                cout << v[k];
                return 0;
            }
            k-=(ll)(pref);
            k%=(ll)(kraj-poc+1);
            cout << v[k+(ll)pref];
            return 0;
        }
        pos[i]=true;
        poz[i]=Time++;
        v.push_back(i);

    }
}


Measured memory_bytes: 6028
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
struct poi{
	int X;int Y;int Z;
	bool operator<(const poi&R)const{
		return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
	}
};
/*
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(){
	int D,N;
	int ans=1;
  cin>>D>>N;
	FOR(i,0,D){
		ans*=100;
	}
	if(N!=100){
      cout<<ans*N<<endl;
    }else{
      cout<<ans*(N+1)<<endl;
    }
	return 0;
}

Measured memory_bytes: 256
//12-1 ?????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    int ans = -50;
    int min = 2001;
    for(int i=0; i<3; i++){
        int tmp;
        cin >> tmp;
        if(tmp<min) min=tmp;
    }
    ans += min;
    min = 2001;
    for(int i=0; i<2; i++){
        int tmp;
        cin >> tmp;
        if(tmp<min) min=tmp;
    }
    ans += min;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

vector < vector <int> > adj;
int dp[100005];

int dfs(int node)
{
  if(dp[node] != -1)return dp[node];
  int val = 0;
  for(auto x : adj[node])val = max(val, dfs(x) + 1);
  return dp[node] = val;
}
int main()
{
  int n, m, ans = 0;
  cin >> n >> m;
  memset(dp, -1, sizeof dp);
  adj.assign(n + 1, vector<int>());
  for(int i = 0;i < m ;i++)
  {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
  }
  for(int i =1;i <= n;i++)
  {
    if(dp[i] == -1)dfs(i);
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 8192
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl
#define debug2(x, y) debug(x), debug(y)
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int k;
	cin >> k;
	int num = 0;
	rep(i, 1e7){
		num = ((num * 10) + 7) % k;
		if(!num){
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << "-1" << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 3636
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()


def main():
    print(''.join('1' if c == '9' else '9' for c in input()))

main()


Measured memory_bytes: 65516
N, W = gets.split.map(&:to_i)

dp_old = [0] * (W + 1)

1.upto(N) do |i|
  w, v = gets.split.map(&:to_i)

  dp = dp_old.clone

  w.upto(W) do |w_max|
    res = dp_old[w_max - w] + v
    dp[w_max] = res if dp_old[w_max] < res
  end

  dp_old = dp
end

puts dp_old.last


Measured memory_bytes: 69004
use std::cmp;

fn main(){
    let mut aa:Vec<i32> = getline().trim().split(' ').map(|e| e.parse().unwrap()).collect();
    
    println!("{}", cmp::max(aa[0] - aa[1], cmp::max(aa[0] + aa[1], aa[0] * aa[1])));
}

fn getline() -> String{
    let mut r = String::new();
    std::io::stdin().read_line(&mut r).ok();
    return r;
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define dbg(a,n) for(int i=1;i<=n;i++)printf("%d ",a[i]);printf("\n")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn=1e5+10,mod=1e9+7,inf=0x3f3f3f3f;
int n,m,k,t;
int main()
{
    int i,j;
    //freopen("in.txt","r",stdin);
    scanf("%d",&n);
    for(i=1,j=0;j<n;j+=i,i++);
    if(j>n)return 0*puts("No");
    puts("Yes");
    printf("%d\n",i);
    int s=1;
    vector<vector<int> >ret(i+1);
    for(j=1;j<i;j++)
    {
        for(k=1;k<=i-j;k++)
        {
            ret[j].push_back(s);
            ret[j+k].push_back(s++);
        }
    }
    assert(s==n+1);
    for(j=1;j<=i;j++)
    {
        printf("%d",2*n/i);
        for(k=0;k<2*n/i;k++)
        {
            printf(" %d",ret[j][k]);
        }
        puts("");
    }
    return 0;
}


Measured memory_bytes: 2304
N = int(input())
As = list(map(int, input().split()))

cnt = 0
can_div = True
while can_div:
    for i in range(len(As)):
        if (As[i] % 2) == 1:
            can_div = False
        As[i] /= 2
    if can_div == True:
        cnt += 1

print(cnt)

Measured memory_bytes: 3060
import java.util.*;
 
public class Main {

    private static final int MOD = 1_000_000_007;
    private static final int MAX = 1000000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int Y = sc.nextInt();

        int A = -1, B = -1;
        for (int a = 0; a <= X; a++) {
            int b = X - 2*a;
            if (a+2*b == Y) {
                A = a;
                B = b;
                break;
            }
        }
        if (A == -1) {
            System.out.println(0);
        } else {
            System.out.println(combMod(A+B, A));
        }
    }
  private static long combMod(int n, int k) {
    if (n < k) {
      return 0;
    }
    if (n < 0 || k < 0) {
      return 0;
    }
    
    long[] fac = new long[n+1];
    fac[0] = 1;
    for (int i = 1; i <= n; i++) {
      fac[i] = fac[i-1]*i % MOD;
    }
    return ((fac[n]*power(fac[k], MOD-2))%MOD)*power(fac[n-k], MOD-2)%MOD;
  }
  private static long power(long a, int n) {
    if (n == 0) {
      return 1;
    }
    if (n%2 == 1) {
      return power(a, n-1)*a%MOD;
    }
    long half = power(a, n/2);
    return half*half%MOD;
  }
}


Measured memory_bytes: 27988
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  string s, t; cin >> s >> t;
  string ans = s+t;
  rep(i, n) {
    bool ok = true;
    rep(j, n-i) {
      if(s[i+j] != t[j]) ok = false;
    }
    if(ok) {
      ans = s.substr(0, i) + t;
      break;
    }
  }
  cout << ans.size() << endk;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int a,b;
  char ao;
  cin>>a>>ao>>b;
  if(ao=='+'){
  cout<<a+b<<endl;
  }
  else{
    cout<<a-b;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define db double
#define lowbit(p) (p&(-p))
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define A first
#define B second
using namespace std;
void read(int &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void read(ll &x){
	x=0; char c=getchar(); int p=1;
	for (;c<48;c=getchar())if (c=='-')p=-1;
	for (;c>47;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	x*=p;
}
void Min(int &x,int y){
	if (x>y)x=y;
}
void Max(int &x,int y){
	if (x<y)x=y;
}
void Min(ll &x,ll y){
	if (x>y)x=y;
}
void Max(ll &x,ll y){
	if (x<y)x=y;
}
/*
给定一个黑白的,数字序列
要求交换次数最少
使得
黑色升序
白色升序

*/
#define M 4005
#define inf 100000000
int a[M],c[M],pos[2][M],n,m;
int cost0[M][M],cost1[M][M],dp[2005][2005];
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	freopen("1.in","r",stdin);
	read(n);
	m=2*n;
	int i,j;
	char s[5];
	for (i=1;i<=m;i++){
		scanf("%s%d",s,&a[i]);
		c[i]=(s[0]=='B');
		pos[c[i]][a[i]]=i;
	}
	for (i=1;i<=m;i++){
		for (j=0;j<n;j++){
	        cost0[i][j]=cost0[i-1][j]+(a[i-1]>j&&c[i-1]==0);
            cost1[i][j]=cost1[i-1][j]+(a[i-1]>j&&c[i-1]==1);
        }
   	}
   	for (i=0;i<=n;i++){
   		for (j=0;j<=n;j++)if (i||j){
            dp[i][j]=inf;
            if(i)Min(dp[i][j],dp[i-1][j]+cost0[pos[0][i]][i-1]+cost1[pos[0][i]][j]);
            if(j)Min(dp[i][j],dp[i][j-1]+cost1[pos[1][j]][j-1]+cost0[pos[1][j]][i]);
        }
    }
    printf("%d\n",dp[n][n]);
	return 0;
}

Measured memory_bytes: 140800
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>
 
#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif
 
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define PER(i, N) for(int (i) = (N)-1; (i) >= 0; (i)--)
#define REP(i, N) for(int (i) = 0; (i) < (int)(N); (i)++)
 
using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

int n,m;

void solve(istream& cin, ostream& cout) {
	int a, b,c,d;
	cin >>a>>b>>c>>d;
	int turn = 0;
	while(c > 0 &&a >0) {
		if(turn == 0) c -= b;
		else a -= d;
		turn = !turn;
	}
	if(c <= 0) cout << "Yes";
	else cout <<"No";
}


int main() {
    ios_base::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	solve(cin, cout);
	/*
	{
		istringstream instr("2\n2\n14");
		solve(instr, cout);
	}
 */
	return 0;
}


Measured memory_bytes: 3128
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
v = sum(a)

# for i in range(1,m+1):
#     if a[i-1] < v/(4*i):
#         print("No")
#         exit(0)

if a[m-1] < v/(4*m):
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9168
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		final Scanner sc=new Scanner(System.in);
		int A=0;
		int B=0;
		int count=0;
		while(true){
			int n=sc.nextInt();
			if (n==0) break;
			count++;
			A=0;
			B=0;
			for(int i=0;i<n;i++){
				int Lcard=sc.nextInt();
				int Rcard=sc.nextInt();
				if(Lcard<Rcard&&count%2==1||Lcard>Rcard&&count%2==0) B+=Lcard+Rcard;
				else if(Lcard==Rcard) {
					A+=Lcard;
					B+=Rcard;
				
				}
				else A+=Lcard+Rcard;

			}
			if(count%2==1) System.out.println(A+" "+B);
			else System.out.println(B+" "+A);
		}
		sc.close();
	}
}

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

#define reg register
typedef long long ll;
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)

char IO;
int rd(){
	int s=0,f=0;
	while(!isdigit(IO=getchar())) if(IO=='-') f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(isdigit(IO=getchar()));
	return f?-s:s;
}

const int N=1e5+10,P=1e9+7;

char s[4],p[4];



int n;
int a[N];


int main(){
	n=rd();
	rep(i,1,n) a[i]=rd();
	int c=0,ans=0;
	drep(i,n,1) if(a[i]>=a[i+1]){
		c++;
		ans=max(ans,c);
	} else c=1;
	printf("%d\n",ans-1);
}








Measured memory_bytes: 640
// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
vector <int> a[14];
int n ,ans=0, d ;
bool ok (int i , int j)
{
  float di = 0 ;
  for (int x =0 ; x < d ; x++)
  {
    di += pow (a[i][x] - a[j][x] , 2 );
  }
  if ((int)sqrt(di) * (int)sqrt (di) == (int)di )return 1 ;
  return 0 ;
}
int main ()
{
  scanf ("%d%d" , &n , &d);
  for (int i =0; i < n ;i++)
  {
    for (int j =0 ; j < d ;j++)
    {
      int p ;
      scanf ("%d" , &p );
      a[i].pb(p);
    }
  }
  for (int i =0;i< n;i++)
  {
    for (int j= i+1 ; j < n ;j++)
    {
      ans += ok(i,j);
    }
  }
  cout << ans <<"\n";
  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b, c = MAP()

print(c, a, b)

Measured memory_bytes: 5784