akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

#define INF 1

int dp[3][3][101];

int main() {
    int i;
    int n, k;
    int d[3][2] = {{1,2}, {2,0}, {0,1}};
    int sum = 0;

    scanf("%d %d", &n, &k);

    for (i=0;i<=n;i++) {
        int j;
        for (j=0;j<3;j++) {
            dp[0][j][i] = 0;
            dp[1][j][i] = 0;
            dp[2][j][i] = 0;
        }
    }
    dp[0][0][1] = 1;
    dp[1][0][1] = 1;
    dp[2][0][1] = 1;

    for (i=0;i<k;i++) {
       int j;
       int a, b;

       scanf("%d %d", &a, &b);

       for (j=0;j<3;j++) {
           dp[d[b-1][0]][j][a] = -INF;
           dp[d[b-1][1]][j][a] = -INF;
       }
    }


    for (i=1;i<=n;i++) {
       int j;
       for (j=0;j<3;j++) {
          if (dp[j][0][i] == -INF || ((dp[d[j][0]][0][i-1] < 0) && (dp[d[j][0]][1][i-1] < 0) && (dp[d[j][1]][0][i-1] < 0) && (dp[d[j][1]][1][i-1] < 0))) {
              dp[j][0][i] = -INF;
          } else {
              if (dp[d[j][0]][0][i-1] >= 0) dp[j][0][i] += dp[d[j][0]][0][i-1];
              if (dp[d[j][0]][1][i-1] >= 0) dp[j][0][i] += dp[d[j][0]][1][i-1];
              if (dp[d[j][1]][0][i-1] >= 0) dp[j][0][i] += dp[d[j][1]][0][i-1];
              if (dp[d[j][1]][1][i-1] >= 0) dp[j][0][i] += dp[d[j][1]][1][i-1];
          }
          if (dp[j][0][i] != -INF) dp[j][0][i] %= 10000;
          
          if (dp[j][1][i] == -INF || dp[j][0][i-1] < 0) {
              dp[j][1][i] = -INF;
          } else {
              dp[j][1][i] += dp[j][0][i-1];
          }

          if (dp[j][1][i] != -INF) dp[j][1][i] %= 10000;
       }
    }

    for (i=0;i<3;i++) {
        int j;
        for (j=0;j<3;j++) {
            if (dp[i][j][n] > 0) sum += dp[i][j][n];
            sum %= 10000;
        }
    }

    printf("%d\n", sum);
}

Measured memory_bytes: 1028
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e16;
#define int long long

const int MAX_N = 1010;
const int MAX_V = 110;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);	
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	map<int, int>mp;
	rep(i, n)mp[a[i]]++;
	if (n % 2 == 0) {
		for (int i = 1; i < n; i += 2) {
			if (mp[i] != 2) {
				cout << 0 << endl; return 0;
			}
		}
		int ans = 1;
		for (int i = 0; i < n / 2; i++) {
			ans *= 2; ans %= MOD;
		}
		cout << ans << endl;
	}
	else {
		if (mp[0] != 1) {
			cout << 0 << endl; return 0;
		}
		for (int i = 2; i < n; i += 2) {
			if (mp[i] != 2) {
				cout << 0 << endl; return 0;
			}
		}
		int ans = 1;
		for (int i = 0; i < n / 2; i++) {
			ans *= 2; ans %= MOD;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 4992
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N,M,K;
    cin >> N >> M >> K;
    vector<int> A(N),B(M);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<M; i++) cin >> B[i];
    vector<ll> S(M+1,0);
    for(int i=0; i<M; i++){
        S[i+1] = S[i] + B[i];
    }
    ll sum = 0;
    int mx = 0;
    for(int i=0; i<=N; i++){
        int now = i;
        now += upper_bound(S.begin(),S.end(),K-sum) - S.begin();
        chmax(mx,now-1);
        if(i == N) break;
        sum += A[i];
        if(sum > K) break;
    }
    cout << mx << "\n";
    return 0;
}

Measured memory_bytes: 6368
#include <iostream>
#include <vector>
#include <functional>
using namespace std;

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

    vector<vector<int>> E(N);
    for (int i=0; i<M; i++)
    {
        int A, B;
        cin>>A>>B;
        E[A-1].push_back(B-1);
    }

    vector<int> C;
    vector<bool> F(N);
    bool f = false;

    function<void(int, int)> BT = [&](int c, int s)
    {
        if (F[c])
        {
            if (c==s)
                f = true;
            return;
        }

        C.push_back(c);
        F[c] = true;

        for (int e: E[c])
        {
            BT(e, s);
            if (f)
                break;
        }

        if (!f)
            C.pop_back();
    };

    for (int s=0; s<N && !f; s++)
    {
        for (int i=0; i<N; i++)
            F[i] = false;
        BT(s, s);
    }

    if (C.size()<=1)
    {
        cout<<-1<<endl;
        return 0;
    }

    vector<bool> F2(N);
    vector<int> C2;

    while (true)
    {
        for (int i=0; i<N; i++)
            F2[i] = false;
        for (int c: C)
            F2[c] = true;

        int ef = -1;
        int et = -1;
        for (int i=0; i<(int)C.size() && ef==-1; i++)
            for (int e: E[C[i]])
                if (F2[e] &&
                    e!=C[(i+1)%C.size()])
                {
                    ef = C[i];
                    et = e;
                    break;
                }

        if (ef==-1)
            break;

        C2.clear();
        for (int c: C)
        {
            if (c==ef)
            {
                int s = 0;
                for (int c: C)
                {
                    if (s==0)
                        C2.push_back(c);
                    if (c==ef)
                        s=1;
                    if (c==et)
                        s=2;
                    if (s==2)
                        C2.push_back(c);
                }
                break;
            }
            else if (c==et)
            {
                int s = 0;
                for (int c: C)
                {
                    if (c==et)
                        s = 1;
                    if (s==1)
                        C2.push_back(c);
                    if (c==ef)
                        s = 2;
                }
                break;
            }
        }
        C.swap(C2);
    }

    /*
    if (C.size()<=1)
    {
        return -1;
    }
    for (int i=0; i<(int)C.size(); i++)
    {
        bool ok = false;
        for (int e: E[C[i]])
            if (e==C[(i+1)%C.size()])
                ok = true;
        if (!ok)
            return -1;
    }
    */

    cout<<C.size()<<endl;
    for (int c: C)
        cout<<c+1<<endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include<string.h>

int main(void)
{
	char s[99];
	int N,i,d=0,r;
	scanf("%s",s);
	N=strlen(s);
	for(i=0;i<(N-1)/2;i++){
		if(s[i]!=s[N-i-1]){
			d++;
			break;
		}
	}
	r=(N+1)/2;
	for(i=0;i<r/2&&d==0;i++){
		if(s[i]!=s[r-i-2]&&s[r+i]!=s[N-i-1]){
			d++;
		}
	}
	if(d==0)printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 128
str = gets.chomp
gets.chomp.to_i.times do
  command, s, e, replace_str = gets.chomp.split
  s, e = s.to_i, e.to_i
  if command == "replace"
    str[s..e] = replace_str
  elsif command == "reverse"
    str[s..e] = str[s..e].reverse
  else
    puts str[s..e]
  end
end


Measured memory_bytes: 6928
/*
 * main.c
 *
 *  Created on: 2019/03/06
 *      Author: family
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
    int x;
    int i = 0;
    int j= 0;
    int ans = 0;
    int temp = 0;
    scanf("%d", &x);

    for(i = 1; i <= 31; i++) {
    	for( j = 2; j <= 10; j++) {
    		temp = pow(i,j);
    		if ((temp <= x) && (temp >= ans)) {
    			ans = temp;
    		}
    	}
    }
    printf("%d",ans);
	return 0;
}



Measured memory_bytes: 384
import bisect

N, x = map(int, input().split())
A = list(map(int, input().split()))
S = [0] * (N + 1)
A.sort()

for i, a in enumerate(A):
    S[i + 1] = S[i] + a

res = bisect.bisect_right(S, x) - 1
if res == N and S[-1] != x:
    print(res - 1)
else:
    print(res)


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

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

    for (int i = x; i < 110000; i++) {
        
        if (i != 2 && i % 2 == 0) {
            continue;
        }
        if (i != 3 && i % 3 == 0) {
            continue;
        }
        bool f = true;
        for (int j = 2; j < i; j++) {
            if (i % j == 0) {
                f = false;
            }

        }
        if (f) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
unordered_map<int,int> id;
vector<int> v;
int ct = 1;
int a[100005], b[100005];
int p[100005], sz[100005];
int xa[100005], xb[100005];
int num;
int n;
int N;
void init(int n){
    num = n;
    for (int i = 1; i <= n; i++) p[i] = i;
}
int find(int x){
    return p[x] == x ? x : p[x] = find(p[x]);
}
void unionset(int x, int y){
    x = find(x), y=  find(y);
    if (x == y) return;
    num--;
    p[x] = y;
    sz[y] += sz[x];
}
int main(){
    scanf("%d",&n);
    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        a[n] ^= a[i];
    }
    for (int i = 0; i < n; i++){
        scanf("%d",&b[i]);
        b[n] ^= b[i];
    }
    for (int i = 0; i <= n; i++){
        xa[i] = a[i], xb[i] = b[i];
    }
    sort(xa,xa+n+1);
    sort(xb,xb+n+1);
    for (int i = 0; i <= n; i++){
        if (xa[i] != xb[i]){
            printf("-1");
            return 0;
        }
    }
    for (int i = 0; i <= n; i++){
        if (a[i] != b[i] || i == n){
            N++;
            v.push_back(a[i]);
        }
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    for (auto x : v){
        id[x] = ct++;
    }
    ct--;
    init(ct);
    for (int i = 0; i <= n; i++){
        if (a[i] != b[i] || i == n){
            //printf("%d\n",a[i]);
            sz[id[a[i]]]++;
        }
    }
    for (int i = 0; i <= n; i++){
        if (a[i] != b[i] || i == n){
            unionset(id[a[i]],id[b[i]]);
        }
    }
    int ans = N+num-2;
    printf("%d",ans);
}


Measured memory_bytes: 8592
from sys import stdin
input = stdin.readline

N, M, K = map(int, input().split())
mod = 998244353


C = [-1] * (N + 1)


def comb(n, r):
    if r > n - r:
        C[r] = C[n - r]

    if r == 0:
        C[0] = 1

    if C[r] != -1:
        return C[r]
    else:
        C[r] = comb(n, r - 1) * (n + 1 - r) * pow(r, mod - 2, mod)
        C[r] %= mod
        return C[r]


ans = 0

for i in range(K + 1):
    ans += M * pow(M - 1, N - 1 - i, mod) * comb(N - 1, i)
    ans %= mod

print(ans)
# print(C)


Measured memory_bytes: 13544
#include <iostream>
#include <stdio.h>
#include <stack>
#include <stdlib.h>
using namespace std;
int main(){
    int x,y;
    stack<int>c;
    char s[100];
    while(cin>>s){
        if ( s[0] == '+' ){
            x=c.top();
            c.pop();
            y=c.top();
            c.pop();
            c.push(y+x);
            
        } else if ( s[0] == '-' ){
            x=c.top();
            c.pop();
            y=c.top();
            c.pop();
            c.push(y-x);
            
        } else if ( s[0] == '*' ){
            x=c.top();
            c.pop();
            y=c.top();
            c.pop();
            c.push(y*x);
            
        } else {
            c.push(atoi(s));
        }
    }
    cout<<c.top()<<endl;

  return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
template<class T>bool chmax(T &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

vvll dp(100010, vll(3, 0));

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin >> n;
    vvll h(n, vll(3, 0));
    rep(i, n){
        cin >> h[i][0] >> h[i][1] >> h[i][2];
    }
    rep(i, 3) dp[0][i] = h[0][i];
    repr(i, 1, n){
        rep(j, 3){
            rep(k, 3){
                if(j == k) continue;
                chmax(dp[i][j], dp[i-1][k]+h[i][j]);
            }
        }
    }
    cout << *max_element(ALL(dp[n-1])) << endl;
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

using namespace std;

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

  uint64_t N = S.size();
  int64_t k = 0;
  N_TIMES(i, N) {
    if (S[i] == 'g') {
      if ((i % 2) == 0) { // T[i] == 'g'
        
      } else { // T[i] == 'p'
        ++k;
      }
    } else { // S[i] == 'p'
      if ((i % 2) == 0) { // T[i] == 'g'
        --k;
      } else { // T[i] == 'p'
        
      }
    }
  }
  cout << k << endl;

  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#define NUM 200000

int main(){
  int i,n,R_t,mx,mi;
  int a[NUM];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  mi=a[0];
  mx=a[1]-a[0];
  for(i=1;i<n;i++){
    if(a[i-1]<mi){
      mi=a[i-1];
    }
    R_t=a[i]-mi;
    if(R_t>mx){
      mx=R_t;
    }
    
   
  }

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



Measured memory_bytes: 2632
from sys  import stdin,stdout

st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")

mod=1000000007
INF=float('inf')

n=inp()
l=li()
dp=[0 for i in range(n)]
dp[1]=abs(l[1]-l[0])

for i in range(2,n):
    dp[i]=min(dp[i-2]+abs(l[i]-l[i-2]),abs(l[i]-l[i-1])+dp[i-1])
print(dp[-1])


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

using std::cin;
using std::cout;
using std::endl;

using std::vector;
using std::min;
using std::max;

int eval(const vector<int>& t) {
    int ans = 24;
    for (size_t i = 0; i < t.size(); i++) {
        for (size_t j = i + 1; j < t.size(); j++) {
            int diff = max(t[i], t[j]) - min(t[i], t[j]);
            ans = min(ans, min(diff, 24 - diff));
        }
    }
    return ans;
}

int backtrack(const vector<int>& choice, vector<int>& time, size_t depth,
              int best) {
    if (depth == choice.size()) {
        return max(best, eval(time));
    }
    time.push_back(choice[depth]);
    best = max(best, backtrack(choice, time, depth + 1, best));
    time.pop_back();

    time.push_back(24 - choice[depth]);
    best = max(best, backtrack(choice, time, depth + 1, best));
    time.pop_back();

    return best;
}

int solve(const vector<int>& d) {
    if (d[0] >= 2) {
        return 0;
    }
    if (d[12] >= 2) {
        return 0;
    }
    for (int i = 1; i < 12; i++) {
        if (d[i] >= 3) {
            return 0;
        }
    }

    vector<int> time;
    time.push_back(0);  // takahashi kun
    if (d[12] == 1) {
        time.push_back(12);
    }
    for (int i = 1; i < 12; i++) {
        if (d[i] == 2) {
            time.push_back(i);
            time.push_back(24 - i);
        }
    }

    vector<int> choice;
    for (int i = 1; i < 12; i++) {
        if (d[i] == 1) {
            choice.push_back(i);
        }
    }

    return backtrack(choice, time, 0, 0);
}

int main() {
    int n;
    cin >> n;
    vector<int> d(12 + 1, 0);

    d[0] += 1;
    for (int i = 0; i < n; i++) {
        int tmp;
        cin >> tmp;
        d[tmp] += 1;
    }

    cout << solve(d) << endl;

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    int max = 0;
    for (int i = 0; i < n - 1; i++)
    {
        if (h[i] <= h[i - 1])
            continue;
        int cnt = 0;
        for (int j = i; j < n - 1; j++)
        {
            if (h[j] >= h[j + 1])
            {
                cnt += 1;
            }
            else
            {
                break;
            }
        }
        if (cnt > max)
        {
            max = cnt;
        }
    }
    cout << max << endl;

    return 0;
}


Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let d = read::<usize>();
    let n = read::<usize>();
    let mut ans = if n == 100 { 101 } else { n };
    for _ in 0..d {
        ans *= 100;
    }
    println!("{}", ans);
}


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

Measured memory_bytes: 256
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N, M = read_ints()
S = read()[:-1]
S = S[::-1]
ans = []
cur_i = 0
while True:
    dice = M
    cur_i += dice
    if cur_i > N:
        if N - (cur_i - M) == 0:
            pass
        else:
            ans.append(N - (cur_i - M))
        break
    # if cur_i == N + 1:
    #     ans.append(cur_i - N)
    #     break
    while S[cur_i] == '1':
        cur_i -= 1
        dice -= 1
        if dice == 0:
            print(-1)
            exit()
    ans.append(dice)
print(*ans[::-1])


Measured memory_bytes: 6408
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::cout.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
/*-*/

lnt modpow(lnt v,lnt k,lnt MOD) { lnt r(1),t(v); while(k){ if(k&1) r=r*t%MOD; t=t*t%MOD; k>>=1; } return r%MOD; }

int modull(const std::string& s, const int rhs) {
	int r=0;
	for(int i=s.size()-1;i>=0;i--) {
		r<<=1;
		r|=(int)(s[s.size()-i-1]=='1');
		if(r>=rhs) r-=rhs;
	}
	return r;
}

int f(int x) {
	if(x==0) return 0;
	else return f(x%__builtin_popcount(x))+1;
}

int main() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	lnt pcount=0;
	for(auto c:s) if(c=='1') pcount++;
	if(pcount==0) { // check later
		rep(i,n) print(1);
		return 0;
	}
	if(pcount==1) {
		lnt m = modull(s,pcount+1);
		rep(i,n) {
			if(s[i]=='1') print(0);
			else {
				lnt x=m;
				x+=modpow(2,n-i-1,pcount+1);
				x%=pcount+1;
				print(f(x)+1);
			}
		}
		return 0;
	}
	lnt plus = modull(s,pcount+1);
	lnt minus = modull(s,pcount-1);
	{
		rep(i,n) {
			if(s[i]=='1') {
				lnt x=minus;
				x-=modpow(2,n-i-1,pcount-1);
				x+=pcount-1;
				x%=pcount-1;
				print(f(x)+1);
			} else {
				lnt x=plus;
				x+=modpow(2,n-i-1,pcount+1);
				x%=pcount+1;
				print(f(x)+1);
			}
		}
	}
}


Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


const int maxN = 500001;
ll fac[maxN], inv[maxN], finv[maxN];

// O(N) precomputation
void modnCk_init(){
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i=2; i<maxN; i++){
    fac[i] = fac[i-1] * i % MOD;
    //    inv[i] = modinv(i, MOD); // NlogN
    inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
    finv[i] = finv[i-1] * inv[i] % MOD;
  }
}

// O(1) with O(N) precomputation
ll modnCk(int n, int k){
  if (n < k) return 0;
  return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


int main(int argc, const char * argv[]) {
  int N, M, K;
  cin >> N >> M >> K;
  
  modnCk_init();
  ll c = modnCk(N*M-2, K-2);
  ll ans = 0;
  for (int d=1; d<N; d++)
    ans = (ans + ((c * d % MOD) * (M * M % MOD) % MOD) * (N-d) % MOD) % MOD;
  
  for (int d=1; d<M; d++)
    ans = (ans + ((c * d % MOD) * (N * N % MOD) % MOD) * (M-d) % MOD) % MOD;
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 12032
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()
    T = SS()

    ans = 0
    for i in range(len(S)):
        if S[i] != T[i]:
            ans += 1

    print(ans)

if __name__ == '__main__':
    resolve()


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

int main(){
    int n;
    cin >> n;
    vector <int> b(n-1);
    rep(i,n-1) cin >> b[i];

    vector <int> ans(n);
    ans[0] = b[0];
    ans[n-1] = b[n-2];
    for(int i=1; i<n-1; i++){
        ans[i] = min(b[i-1], b[i]);
    }

    int sum=0;
    rep(i,n) sum += ans[i];
    cout << sum << endl;

}


Measured memory_bytes: 3552
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

/* I'm too stupid to solve this problem */

using namespace std;
#define PI 3.14159265359
#define eps 1e-7
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORN(i,a,b) for(int i=a;i<=b;i++)
const int INF = 1<<29;
typedef unsigned long long ull;
typedef long long ll;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int n;

int main(){
	ios_base::sync_with_stdio(false); //Fast I/O
	cin.tie(NULL);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);	

    cin >> n;
    vector<ll> A(n);
    FOR(i,0,n)
        cin >> A[i];

    int b1=0,b2=0,b3=0;

    for(auto x: A){
        if(x%4==0)
            b2++;
        else if(x%2==0)
            b1++;
        else
            b3++;
    }

    if(b1==0){
        if(b3<=b2+1){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }else if(b1>0){
        if(b3<=b2){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }

    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,j,n) for(ll i=j;i<n;i++ )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
ll i;

int main(){
    ll a,b,x;
    cin>>a>>b>>x;

    if(2*x<=a*a*b){
        cout<<fixed<<setprecision(15)<<360.0/(2.0*M_PI)*atan(a*b*b*1.0/(2.0*x));
    }
    else{
        cout<<fixed<<setprecision(15)<<360.0/(2.0*M_PI)*atan(2.0*b/a-2.0*x/a/a/a);
    }
    cout<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int p = (1 << M);
    int t = 1900 * M + 100 * (N - M);
    int ans = p * t;
    cout << ans << endl;

    return 0;
}


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


int main() {
  int n,m;
  cin >> n >> m;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  vector<P> v(m);
  rep(i,m){
    ll b1,c1;
    cin>>b1>>c1;
    v[i].first=c1;
    v[i].second=b1;
  }
  sort(a.begin(),a.end());
  sort(v.rbegin(),v.rend());

  vector<ll> s(n);
  ll now=0;
  rep(i,m){
    if (now>=n)break;
    for(ll j=now;j<now+v[i].second;j++){
      if (j>=n)break;
      s[j]=v[i].first;
    }
    now+=+v[i].second;
  }
  ll ans=0;
  rep(i,n){
    if (s[i]>a[i])ans+=s[i];
    else ans+=a[i];
  }
  cout<<ans;
}


Measured memory_bytes: 6416
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<functional>
#include<algorithm>
#include<bitset>
#include<utility>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
ll a[105][105];
ll b[105][105];
ll d[105];
int main()
{
    ll n;
    scanf("%lld",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=10;j++)
            scanf("%lld",&a[i][j]);
    for(int i=1;i<=n;i++)
        for(int j=0;j<=10;j++)
            scanf("%lld",&b[i][j]);
    ll maxn=-1*inf;
    for(int s=1;s<(1<<10);s++)
    {
        for(int i=1;i<=n;i++)
        {
            d[i]=0;
            for(int j=1;j<=10;j++)
                if((a[i][j]<<(j-1))&s)
					d[i]++;
        }
        ll ans=0;
        for(int i=1;i<=n;i++)
            ans+=b[i][d[i]];
        maxn=max(maxn,ans);
    }
    cout<<maxn;
}

Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) throws IOException {
        process();
    }
    public static void process() throws IOException{
        BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(in.readLine());
        int n=Integer.parseInt(st.nextToken());
        int k=Integer.parseInt(st.nextToken());
        int arr[]=new int[n];
        int dp[]=new int[n];
        st=new StringTokenizer(in.readLine()," ");
        for(int i=0;i<n;i++)
            arr[i]=Integer.parseInt(st.nextToken());
        Arrays.fill(dp,Integer.MAX_VALUE);
        dp[0]=0;
        dp[1]=Math.abs(arr[1]-arr[0]);
        for(int i=2;i<n;i++) {
            int jump=0;
            for (int j = i - 1; j >= 0 && jump < k; jump++, j--){
                dp[i] = Math.min(dp[i], dp[j] + Math.abs(arr[i] - arr[j]));
            }
        }
        System.out.println(dp[n-1]);
    }
}


Measured memory_bytes: 33784
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();
		int l = scan.nextInt();
		int[][] A = new int[n][m];
		int[][] B = new int[m][l];
		long[][] C = new long[n][l];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				A[i][j] = scan.nextInt();
			}
		}
		for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			B[i][j] = scan.nextInt();
		}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				for (int k = 0; k < m; k++) {
					C[i][j] += A[i][k] * B[k][j];
				}
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < l; j++) {
				System.out.print(C[i][j]);
				if (j != l - 1) {
					System.out.print(" ");
				} else {
					System.out.println();
				}
			}
		}
	}

}

Measured memory_bytes: 53468
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N,A,B = LI()
    v = LI()
    d = {}
    for x in v:
        if x in d: d[x] += 1
        else: d[x] = 1

    dx = sorted(d.items(),reverse=True)

    ans = 0.0
    cnt = 0
    for k in range(A,B+1):
        c = 0
        i = 0
        x = 0
        while c < k:
            c += dx[i][1]
            if c >= k:
                x += dx[i][0] * (dx[i][1] - (c-k))
                cnt_i = math.factorial(dx[i][1]) // math.factorial(c-k) // math.factorial(dx[i][1] - (c-k))
                av = round(x/k,7)
                if av > ans:
                    ans = av
                    cnt = cnt_i
                elif av == ans:
                    cnt += cnt_i
            else:
                x += dx[i][0] * dx[i][1]
            i += 1
    print(ans)
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 39020
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);
//桁数に注意 long long　にする

int main() {
  int n;
  cin >> n;
  int ans = 0;
  
  vector<int> v(n);
  vector<int> c(n);
  
  rep(i,n) {
  cin >> v[i];
  }
  rep(i,n) {
  cin >> c[i];
    if(v[i]-c[i]>0) ans+=v[i]-c[i];
  }
  
  cout << ans << endl;
  
}


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

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

// 普通のKnapsack問題ではなかった
int main() {
	int A, B;
	cin >> A >> B;

	int ans = dup(B-1, A-1);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,a,b) for(int i=(a),_end_=(b);i<=_end_;i++)
#define DREP(i,a,b) for(int i=(a),_end_=(b);i>=_end_;i--)
#define EREP(i,a) for(int i=start[(a)];i;i=e[i].next)
template<class T>inline void chkmax(T &a,T b){ if(a<b)a=b;}
template<class T>inline void chkmin(T &a,T b){ if(a>b)a=b;}
#define fi first
#define se second
#define mkr(a,b) make_pair(a,b)
inline int read()
{
	int sum=0,p=1;char ch=getchar();
	while(!(('0'<=ch && ch<='9') || ch=='-'))ch=getchar();
	if(ch=='-')p=-1,ch=getchar();
	while('0'<=ch && ch<='9')sum=sum*10+ch-48,ch=getchar();
	return sum*p;
}

const int maxn=2e5+20;
const int inf=0x3f3f3f3f;
const ll Inf=1ll<<60;

struct node {
	int v,next,w;
};
node e[maxn<<1];
int cnt,start[maxn];
inline void addedge(int u,int v,int w){ e[++cnt]=(node){v,start[u],w};start[u]=cnt;}

int n,w[maxn];

inline void init()
{
	n=read();
	REP(i,1,n)w[i]=read();
	REP(i,1,n-1)
	{
		int u=read(),v=read(),w=read();
		addedge(u,v,w);
		addedge(v,u,w);
	}
}

int mn,rt,sz[maxn],sum;

struct Edge {
	int u,v;ll w;	
};
Edge E[maxn<<5];
int m;

int vis[maxn];
ll MN;int MNID;
int st[maxn],top;
ll stw[maxn];

void findroot(int u,int fa)
{
	sz[u]=1; int mx=0;
	EREP(i,u)
	{
		int v=e[i].v;
		if(v==fa || vis[v])continue;
		findroot(v,u);
		sz[u]+=sz[v];
		chkmax(mx,sz[v]);
	}
	chkmax(mx,sum-sz[u]);
	if(mx<mn)mn=mx,rt=u;
}

void Calc(int u,int fa,ll dis)
{
	st[++top]=u; stw[top]=dis+w[u];
	if(MN>dis+w[u])MN=dis+w[u],MNID=u;
	EREP(i,u)
	{
		int v=e[i].v;
		if(vis[v] || v==fa)continue;
		Calc(v,u,dis+e[i].w);
	}
}

void solve(int u)
{
	vis[u]=1; int Sum=sum;
	MN=1ll<<60; top=0;
	Calc(u,0,0);
	REP(i,1,top)E[++m]=(Edge){MNID,st[i],stw[i]+MN};
	
	EREP(i,u)
	{
		int v=e[i].v;
		if(vis[v])continue;
		sum=sz[v]<sz[u]?sz[v]:Sum-sz[u];
		mn=inf; findroot(v,u);
		solve(rt);
	}
}

inline bool cmp(Edge a,Edge b){ return a.w<b.w;}
int fa[maxn];
int fin(int x){ return x==fa[x]?x:fa[x]=fin(fa[x]);}
inline void merge(int x,int y){ x=fin(x); y=fin(y); fa[y]=x;}

inline void doing()
{
	sum=n; mn=inf;
	findroot(1,0);
	solve(rt);

	sort(E+1,E+m+1,cmp);
	REP(i,1,n)fa[i]=i;
	ll ans=0;
	REP(i,1,m)
	{
		int u=E[i].u,v=E[i].v;
		if(fin(u)==fin(v))continue;
		merge(u,v);
		ans+=E[i].w;
	}
	printf("%lld\n",ans);
}

int main()
{
	init();
	doing();
	return 0;
}



Measured memory_bytes: 78592
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <string>
using namespace std;




int main()
{
	int a, b;
	cin >> a >> b;
	
	if ((a*b) % 2 == 0)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mk make_pair
#define fi first
#define lb lower_bound
#define test ll int t;cin>>t;while(t)
#define se second
using namespace std;

int main(){
    string s;
    cin>>s;
    int x=0;
    for(int i=0;i<s.size();i++)x+=s[i]-'0';
    if(x%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

int main() {
  string s,t;
  cin>> s >> t;
  
  int z=0;
  for (int i=0; i<3; i++) {
    if (s.at(i) == t.at(i))
      z++;
  }
  
  cout<< z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define oo 0x3f3f3f3f
#define ooLL 0x3f3f3f3f3f3f3f3f
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int mod = 1e9+7;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
 
int main(){
    string a, b;
    cin >> a;
    cin >> b;
    if(a == b.substr(0,b.size()-1)) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

int main(void) {
    int N;
    string A, B, C;
    cin >> N >> A >> B >> C;
    int ans = 0;
    REP(i, N) {
        char a = A[i], b = B[i], c = C[i];
        set<char> se;
        se.emplace(a);
        se.emplace(b);
        se.emplace(c);
        ans += (int)se.size() - 1;
    }
    cout << ans << endl;
}


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

int main() {
	int h1, h2, m1, m2, k;
	cin >> h1>> m1>> h2>> m2>> k;
	int a = h1 * 60 + m1;
	int b = h2 * 60 + m2;
	
	cout << b-a-k << endl;
	return 0;
}

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

typedef pair<int,int> P;

int main(){
	int n,m,p,q,r;
	while(cin >> n,n){
		vector<P> now;
		cin >> m >> p >> q >> r;
		now.push_back(P(r,0));
		now.push_back(P(n - r,1));
		for(int i = 0;i < m;i++){
			int x,y,sum = 0,a = -1,b = -1;
			vector<P> nxt;
			cin >> x >> y;
			for(int j = 0;j < now.size();j++){
				sum += now[j].first;
				if(sum > x && a == -1){
					a = j + 1;
					now.insert(now.begin() + j + 1,P(sum - x,now[j].second));
					now[j].first -= sum - x;
					sum = x;
				}else if(sum > y && b == -1){
					b = j + 1;
					now.insert(now.begin() + j + 1,P(sum - y,now[j].second));
					now[j].first -= sum - y;
					sum = y;
				}else if(sum == x) a = j + 1;
				else if(sum == y) b = j + 1;
			}
			for(int j = b;j < now.size();j++) nxt.push_back(now[j]);
			for(int j = a;j < b;j++) nxt.push_back(now[j]);
			for(int j = 0;j < a;j++) nxt.push_back(now[j]);
			now = nxt;
		}
		int sum = 0,ans = 0;
		for(P pp : now){
			if(!pp.second) ans += max(0,min(sum + pp.first,q) - max(sum,p - 1));
			sum += pp.first;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iostream> 
#include <cmath>
 
using namespace std;
typedef long long ll;
typedef long double ld;

const ll MOD=ll(1e9+7);

//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)

ll P_POW(ll i, ll n) {
  if(n==0) return 1;

  n--;
  ll rep = i;

  while(n) {
    rep = rep * i;
    n--;
  }
  return rep;
} 

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}

ll n;


long long solve2(long long N) {
    if (N % 2 == 1) return 0;

    long long res = 0;
    N /= 2;
    while (N) {
        res += N / 5;
        cout << "N/5: " << N/5 <<  endl;
        cout << "res1: " << res <<  endl;
        N /= 5;
    }
    return res;
}


ll solve(ll n) {
    if (n % 2 == 1) return 0;

    ll res = 0;
    n /= 2;
    int c = 1;

    while ((ll) n/((ll)pow(5,c))) {
      res += n/P_POW(5,c);
      c++;
    }
    return res;
}

void f(int rest, string s) {
  char abc[] = "abc";
  if(rest == 0) {
    cout << s << endl;
  } else {
    for(int i=0; i < 3; i++) {
      f(rest - 1, s+abc[i]);
    }
  }
}

int main() {
  ll n, q;
  cin >> n >> q;
  // 2次元vector
  //vector<vector<ll>> a(n ,vector<ll>{2,0});
  vector<ll> s(n,0);

  bool isA = false;

  REP(i, n) {
    char c;
    cin >> c;

    if(i == 0) {
      s[i] = 0;
    } else {
      if (c == 'C' && isA) {
        s[i] = s[i-1] + 1;
      } else {
        s[i] = s[i-1];
      }
    }

    if(c == 'A') isA = true;
    else isA = false;
  }


  REP(i, q) {
    ll l,r;
    cin >> l >> r;

    if (l == 1) {
      cout << s[r-1] << endl;
    } else {
      cout << s[r-1] - s[l-1] << endl;
    }
  }

}


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

int main() {
  int H, W;
  cin >> H >> W;
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;
  
  for (int i = 0; i < H; i++) {
    vector<char> a(W);
    
    for (int j = 0; j < W; j++) {
      cin >> a.at(j);
    }
    cout << "#" ;
    
    for (int j = 0; j < W; j++) {
      cout << a.at(j);
    }
    cout << "#" << endl;
  }
  
  for (int i = 0; i < W + 2; i++) {
    cout << "#";
  }
  cout << endl;

}


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

#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

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

int main() {
    lli n;
    cin >> n;
    lli w[n];
    lli total = 0;
    REP(i, 0, n) {
        lli wi;
        cin >> wi;
        w[i] = wi;
        total += wi;
    }
    lli total2 = 0;
    lli total3 = 0;
    double ave = total / 2;
    lli diff = 0;
    REP(i, 0, n) {
        total2 += w[i];
        if (total2 > ave) {
            total3 = total2 - w[i];
            break;
        }
    }
    //cout << total2 << endl;
    //cout << total3 << endl;
    if (total2 - ave > ave - total3)
        cout << total - total3 - total3 << endl;
    else
        cout << total2 - total + total2 << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cmath>
#include<algorithm>
#include<cstring>
long long a[99999999];
using namespace std;
int main(){
	memset(a,0,sizeof(a));
	long long n,t;
	cin >> n >> t ;
	getchar();
	long long i=0;
	long long y=n;
    while(y--){
    	cin >> a[i];
    	i++;
	}

	long long s=0;
	for(;t<n;t++){
		if (a[s]>=a[t]){
			printf("No\n");
		}
		else printf("Yes\n");
		s++;
	}
} 

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

int main() {
  int n, k; cin >> n >> k;
  int p[n];
  for(int i=0; i<n; i++) cin >> p[i];
  sort(p, p+n);
  int ans=0;
  for(int i=0; i<k; i++){
    ans+=p[i];
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	string s;
	cin >> n >> s;

	Matrix dp(n + 1, Array(n + 1, 0));
	ll ans = 0;
	REP(i, n) {
		REP(j, n) {
			if (s[i] == s[j] && dp[i][j] + 1 <= j - i) {
				chmax(dp[i + 1][j + 1], dp[i][j] + 1);
				chmax(ans, dp[i][j] + 1);
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 195840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int a, b, c;
	cin >> a >> b >> c;
	cout << min({ a,b,c }) << " " << max({ a,b,c }) << endl;
	return 0;
}


Measured memory_bytes: 3076