akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(int argc, char *argv[]){

    int n, k;
    int ret = 1;

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

    int i;
    
    for(i=0;i<n;i++){
        ret = ret * 2 < ret + k ? ret * 2 : ret + k;
    }

    printf("%d\n", ret);

    return 0;
}


Measured memory_bytes: 128
import sys

input = sys.stdin.readline

from math import log2, ceil


def main():
  n, k = map(int, input().strip().split())
  
  p = 0
  for i in range(1, n+1):
    s = k / i  # 10 / 3
    t = max(ceil(log2(s)), 0)
    p += 1/n * (0.5 ** t)
 
  print(p)



if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#define rep(i,j,k) for(int i=j;i<k;i++)
int main(void){
    while(1){
    int n,p,index=0,wan;
    cin>>n>>p;
    if(n==0 && p==0)break;
    vector<int> v(n,0);
    wan=p;
    
    while(1){
       index++;
       if(index>n-1)index=0;
       
       if(wan!=0){
           v[index]++;
           wan--;
           if(wan==0){
               bool judge=true;
               rep(i,0,n){
                   if(v[i]!=0 && i!=index){
                       judge=false;
                       break;
                   }
               }
               if(judge){
                   cout<<(((index-1)>=0)?(index-1):(n-1))<<endl;
                   break;
               }
           }
       }else {
           wan=v[index];
           v[index]=0;
       }
    }
    }
    
    return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
const long long INF = 1LL<<60;
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0;
  std::cin >> x>>y>>z;
  std::cout << z<<" "<<x<<" "<<y << '\n';
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
   int x,y,i,j;
   for(;;){
      scanf("%d %d",&y,&x);
      if(x+y==0) break;
      for(i=0;i<y;i++){
         for(j=0;j<x;j++)
            if((i+j)%2==0)
               printf("#");
            else
               printf(".");
         printf("\n");
      }
   printf("\n");
   }
   return 0;
}

Measured memory_bytes: 572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;
// const ll MOD=998244353;

const int MAX_V=101010;

int par[MAX_V];
int rnk[MAX_V];
int num[MAX_V];

void init(){
  for(int i=0;i<MAX_V;i++){
    par[i]=i;
    rnk[i]=0;
    num[i]=1;
  }
}

int find(int x){
  if (par[x] == x){
    return x;
  }else{
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if (x == y) return;

  if (rnk[x] < rnk[y]){
    par[x] = y;
    num[y] += num[x];
  }else{
    par[y] = x;
    num[x] += num[y];
    if (rnk[x] == rnk[y]) rnk[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

int used[101010];

int main(){
  int N,M; cin>>N>>M;
  init();
  rep(i,M){
    int X,Y,Z; cin>>X>>Y>>Z; X--,Y--;
    unite(X,Y);
  }
  int ans=0;
  rep(i,N){
    if(used[find(i)]) continue;
    ans++;
    used[find(i)]=1;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
int main(){
	int a[30],b[30],n,i;

	/* 出席番号の入力 */
	for(i=0; i<28; i++){
		scanf("%d",&a[i]);
	}
	for(i=1; i<=30; i++){
		b[i] = i;
	}
	/* 未提出者の検索？ */
	for(i=0; i<28; i++){
		for(n=1; n<=30; n++){
			if(b[n] == a[i]){
				b[n] = 0;
			}
		}
	}

	for(i=1; i<=30; i++){
		if(b[i] != 0){
			printf("%d\n",b[i]);
		}
	}

	return 0;
}

Measured memory_bytes: 596
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    int N;
    cin >> N;
    vint A(N + 1), B(N);
    rep(i, N + 1)cin >> A[i];
    rep(i, N) cin >> B[i];
    ll ans = 0;
    for (int i = N - 1; i >= 0; i--) {
        ans += min(B[i], A[i + 1]);
        B[i] = max(0, B[i] - A[i + 1]);
        ans += min(B[i], A[i]);
        A[i] = max(0, A[i] - B[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

fn main() {
   input! {
      mut n: i64
   }

   let mut s = vec![];
   if n == 0 {
      println!("0");
      return;
   }
   while n != 0 {
      s.push(n.rem_euclid(-2));
      n = n.div_euclid(-2);
   }

   for s in s.iter().rev() {
      print!("{}", s);
   }
   println!("");
}


Measured memory_bytes: 2140
x,k,d = map(int,input().split())

if abs(x) > k*d:
    print(abs(x)-k*d)
    exit()

move = abs(x)//d
amari = abs(x)%d 

if (k-move) % 2 == 0:
    print(amari)
else:
    print(d-amari)

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

priority_queue<P>q;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  vector<int>b(m),c(m);
  rep(i,m) cin >> b[i] >> c[i];
  rep(i,n) {
    q.push(P(a[i],1));
  }
  rep(i,m){
    q.push(P(c[i],b[i]));
  }
  ll ans = 0;
  rep(i,n){
    auto p = q.top();q.pop();
    ans += p.first;
    if(p.second > 1){
      p.second--;
      q.push(p);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3572
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String line = sc.nextLine();
    String[] ab = line.split(" ");
    int a = Integer.parseInt(ab[0]);
    int b = Integer.parseInt(ab[1]);
    System.out.println((a * b) + " " + (a * 2 + b * 2));
  }
}



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

using namespace std;
char a[30];

int main() {
    long long x;
    scanf("%lld", &x);
    if (x == 0)puts("0");
    else {
        int len = 0;
        for (; x; len++) {
            a[len] = x % -2, x /= -2;
            if (a[len] == -1)
                x += a[len] = 1;
            a[len] += '0';
        }
        reverse(a, a + len);
        puts(a);
    }
    return 0;
}

Measured memory_bytes: 256
// Problem : C - Lining Up
// Contest : AtCoder - AtCoder Beginner Contest 050
// URL : https://atcoder.jp/contests/abc050/tasks/arc066_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

#define spc ' '
#define endl '\n'

using namespace std;

int MOD = 10e8+7; 

long long step(long long n){
    long long ans = 1;
    for(int i = 0; i < n; i ++){
        ans*=2;
        ans%=MOD;
    }
    return ans;
}

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	long long n, x;
	cin >> n;
	vector<int> f(n);
	for(int i = 0; i<n; i ++){
	    cin >> x;
	    f[x]++;
	}
	if(n&1){
	    for(int i = 0; i<n; i++){
	        if(i==0 && f[i]!=1 || i&1 && f[i]!=0 || (i&1==0 && f[i]!=2)){
	            cout << 0;
	            return 0;
	        }
	    }
	    cout << step(n/2);
	}
	else{
	   for(int i = 0; i<n; i++){
	        if(i&1==0 && f[i]!=0 || (i&1 && f[i]!=2)){
	            cout << 0;
	            return 0;
	        }
	    }
	    cout << step(n/2); 
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int d[100005];

  cin >> n;

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

  sort(d, d + n);

  cout << d[n / 2] - d[n / 2 - 1] << endl;
  return 0;
}



Measured memory_bytes: 640
import           Data.List

main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- map read . words <$> getLine :: IO [Int]
    print $ solve $ sortBy (flip compare) as

solve ns = let ns' = zip [1..] ns
               as = map snd
                   $ filter ((== 1) . (`mod` 2). fst) ns'
               bs = map snd
                   $ filter ((== 0) . (`mod` 2) . fst) ns' in
               sum as - sum bs


Measured memory_bytes: 1020
N = int(input())
A = []

maxN = 0 
secmax = 0

for i in range(N):
  x = int(input())
  A.append(x)
  if maxN <= x:
    secmax = maxN
    maxN = x
  elif secmax <= x:
    secmax = x
  
for a in A:
  print(secmax if maxN == a else maxN)

Measured memory_bytes: 12520
N = int(input().strip())

ary = list(map(int, input().split()))

i_min = ary[0]
i_max = ary[0]
count = 1
for i in range(1, len(ary)):
    p_i = ary[i]
    if p_i <= i_min:
        i_min = p_i
    if p_i > i_max:
        i_max = p_i
    if p_i <= i_min and p_i <= i_max:
        count += 1
print(count)

Measured memory_bytes: 24744
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int INF = 2 * 1e9;
int n;
int h[100009], dp[100009];

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

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

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

    cout << dp[n] << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}




int main()
{
    ll A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;

    ll PA = 0;
    ll PB = 0;
    ll PC = 0;

    //A A、Bのみ
    PA = A * X + B * Y;

    //B Cのみ
    ll Z = max(X,Y);
    PB = C * 2 * Z;

    //C　組み合わせ
    ll ZZ = min(X,Y);
    if(X > Y) PC = C * 2 * ZZ + A * (X - Y);
    else PC = C * 2 * ZZ + B * (Y - X);

    ll P = 0;
    P = min(PA,min(PB,PC));
    cout << P << endl;

    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////
bool flag[100005] = {};
int num[100005] = {};
int main(){

    for(int i = 2; i < sqrt(100005); i++){
		if(flag[i] == 0){
			for(int j = i*2; j < 100005; j+=i){
				flag[j] = 1;
			}
		}
	}
	flag[0] = 1;
	flag[1] = 1;
	
	rep(i,1,100005){
        if(flag[i] == 0 && flag[(i+1)/2] == 0)num[i] = num[i-1] + 1;
        else num[i] = num[i-1];
	}
	
    int n;
    cin >> n;

	rep(i,0,n){
        int l,r;
        cin >> l >> r;

       /* ll ans = 0;
        rep(j,l,r+1){
            if(flag[j] == 0 && flag[(j+1)/2] == 0)ans++;
            j++;
        }
        P(ans);*/
       // cout << num[l] << " " << num[r] << endl;
        P(num[r] - num[l-1]);
	}
	return  0;
}

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

void traceArray(int A[],int N){
    for(int i = 0; i < N; i++){
        if(i > 0){
            cout << " ";
        }
        cout << A[i];
    }
    cout << endl;
}

int selectionSort(int A[],int N){
    int cnt = 0;
    for(int i = 0;i < N;i++){
        int minj = i;
        for(int j = i; j < N; j++){
            if(A[minj] > A[j]){
                minj = j;
            }
        }
        swap(A[minj], A[i]);
        if(minj != i){
            cnt++;
        }
        
    }
    traceArray(A,N);
    return cnt;
}

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n ; i++){
        cin >> a[i];
    }
    int cnt = selectionSort(a,n);
    cout << cnt << endl;
    return 0;
}


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

int main() {
	// your code goes here
	int n,cnt=1,curr_max;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	curr_max=a[0];
	for(int i=1;i<n;i++)
	{
		curr_max=max(curr_max,a[i]);
		if((a[i]>=a[0])&&(a[i]>=curr_max)) cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <unistd.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    ll n;
    cin >> n;
    ll res = 0;
    for(ll i=1;i*i<=n;++i){
        ll t = n-i;
        if(t%i==0&&t/i>0){
            ll k = t/i;
            if(n/k==n%k){
                res+=k;
            }
        }
    }
    put(res);
    return 0;
}


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

using namespace std;

char s[3010], t[3010];
int dp[3010][3010];

void drum(int i, int j)
{
    if(i >= 1 && j >= 1)
    {
        if(s[i] == t[j])
        {
            drum(i-1, j-1);
            cout << s[i];
        }
        else if(dp[i-1][j] > dp[i][j-1])
            drum(i-1, j);
        else drum(i, j-1);
    }
}

int main()
{
    cin >> (s+1);
    cin.get();
    cin >> (t+1);

    for(int i=1; i<=strlen(s+1); i++)
        for(int j=1; j<=strlen(t+1); j++)
        {   if(s[i] == t[j]) dp[i][j] = dp[i-1][j-1] + 1;
            else dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    drum(strlen(s+1), strlen(t+1));
    return 0;
}

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

int main(){
  string s;
  int n[10];
  while(cin >> s){
    for(int i=0; i<10; i++)
      n[i] = s[i]-'0';
    for(int i=0; i<9; i++)
      for(int j=0; j<9-i; j++)
	n[j] = (n[j]+n[j+1])%10;
    cout << n[0] << endl;
  }
  return 0;
}

Measured memory_bytes: 1180
import sys


def main():
    n, m = [int(s) for s in sys.stdin.readline().strip().split()]
    a = [0] * m
    c = [0] * m
    inf = float('inf')

    for i in range(m):
        ai, bi = [int(s) for s in sys.stdin.readline().strip().split()]
        a[i] = ai
        ci = [int(s)-1 for s in sys.stdin.readline().strip().split()]
        # print(ci)
        c_val = sum([2 ** num for num in ci])
        c[i] = c_val

    dp = [[inf] * (2 ** n) for _ in range(m)]
    for i in range(m):
        dp[i][0] = 0

    for j in range(2 ** n):
        first_key_boxes = c[0]
        if first_key_boxes & j == j:
            dp[0][j] = a[0]

    for i in range(1, m):
        for j in range(1, 2 ** n):
            prev = j & (~c[i])
            dp[i][j] = min(dp[i-1][j], a[i] + dp[i-1][prev])
    if dp[m-1][2**n-1] == inf:
        print(-1)
    else:
        print(dp[m-1][2**n-1])


main()


Measured memory_bytes: 196248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{    
    
    public void slove()
    {
        var inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = inputs[0];
        int m = inputs[1];
        int [] ball = Enumerable.Range(0, n).Select(x => 1).ToArray();
        bool[] possibility = new bool[n];
        possibility[0] = true;
        foreach(int i in Enumerable.Range(0, m))
        {
            inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = inputs[0] - 1;
            int b = inputs[1] - 1;
            ball[a]--;
            ball[b]++;
            if(possibility[a])
            {
                possibility[b] = true;
            }
            if(ball[a] == 0)
            {                
                possibility[a] = false;
            }
        }
        System.Console.WriteLine(possibility.Count(x => x));
    }
    
    static void Main(string[] args)
    {
        new Program().slove();
    }
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;
  for (int i = 0; i <= N-3;i++) {
    if ((S.at(i)=='A') && (S.at(i+1) == 'B') && (S.at(i+2)=='C')) {
      count++;
    }
  }
  cout << count << endl;
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

    public String next() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public String nextLine() {
      if (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          return reader.readLine();
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int[] a = sc.nextIntArray(n);
    for (int val : a) {
      if ((val & 1) == 1) continue;
      if (val % 3 == 0 || val % 5 == 0) continue;
      System.out.println("DENIED");
      return;
    }
    System.out.println("APPROVED");
  }
}

Measured memory_bytes: 22480
#include <cstdio>
using namespace std;

int main() {
	int n;
	int h[105];
	scanf("%d", &n);
	int max = 0, ans = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		if (h[i] >= max) {
			max = h[i];
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
N = int(input())
R = [tuple(map(int,input().split())) for _ in range(N)]
B = [tuple(map(int,input().split())) for _ in range(N)]

B.sort(key=lambda x: x[0])
# print(R)
# print(B)
ans =0
for b in B:
    candidate_R = [R[k] for k in range(len(R)) if (R[k][0] < b[0]) and (R[k][1] < b[1])] # 青い点に対する赤い点の候補
    if candidate_R:
        selected_R = sorted(candidate_R, key=lambda x:x[1])[-1]
        ans += 1
        R.remove(selected_R)
print(ans)


Measured memory_bytes: 3064
//あらためて見るとこの問題全然わからない

//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	int a[2][200000], b[2][200000];
	int kazuA[29] = {}, kazuB[29] = {};
	rep(i, N) {
		a[0][i] = getint(); 
		rep(j, 28) kazuA[j] += a[0][i] >> j & 1;
	}
	rep(i, N) {
		b[0][i] = getint();
		rep(j, 28) kazuB[j] += b[0][i] >> j & 1;
	}
	int kotae = 0;
	rep(i, 29) {
		int p = i & 1;

		int kazu[2];
		kazu[0] = 0;
		kazu[1] = N - kazuA[i];
		rep(j, N) a[!p][kazu[a[p][j] >> i & 1]++] = a[p][j];
		kazu[0] = 0;
		kazu[1] = N - kazuB[i];
		rep(j, N) b[!p][kazu[b[p][j] >> i & 1]++] = b[p][j];

		int kari = N;
		int k1 = kazu[0];
		int k2 = N;
		int k3 = N;
		int d = (1 << i + 1) - 1;
		int d2 = 1 << i;
		rep(j, N) {
			while (k3 > 0 && (a[!p][j] & d) + (b[!p][k3 - 1] & d) >= d2 * 3) k3--;
			k2 = min(k2, k3);
			while (k2 > 0 && (a[!p][j] & d) + (b[!p][k2 - 1] & d) >= d2 * 2) k2--;
			k1 = min(k1, k2);
			while (k1 > 0 && (a[!p][j] & d) + (b[!p][k1 - 1] & d) >= d2) k1--;
			kari ^= k1 ^ k2 ^ k3;
		}
		kotae += (kari & 1) << i;
	}
	printf("%d", kotae);

	Would you please return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;  
typedef vector<ll> vi; 
typedef pair<int, int> ii; 
typedef vector<ii> vii; 
typedef vector<vi> vvi;
#define F first
#define S second
#define pb emplace_back
#define M 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr(i,a,b) for(int i = a; i<= b; i++)
#define ws " "
#define all(c) c.begin(), c.end()
#define ln "\n" 
 
void printarray(int ar[], int n) {
    for (int i = 0; i < n; i++) {
        cout << ar[i] << ws;
    }
    cout << ln;
}

vi ar;
 
main() {
    IOS;
 
    int n, k;
    cin >> n >> k;
    ar.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> ar[i];
    }
    int dp[k + 1] = {0};
    for (int i = 1; i <= k; i++) {
        for (int j = 0; j < n; j++) {
            if (ar[j] > i) {
                break;
            }
            if (dp[i - ar[j]] == 0) {
                dp[i] = 1;
            }
        }
    }
    if (dp[k] == 1) {
        cout << "First";
    } else {
        cout << "Second";
    }


}
 
/*  Check for base cases such as n == 1
    and cases like it where code can fail */

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

int main() {
    std::cout<<std::fixed<<std::setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    vector<int> C(N-1);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N-1) cin >> C[i];

    // 前に食べた料理
    int bef = -1;
    int mzk = 0;
    rep(i, N) {
        // 食べる料理
        // cout << i << " " << mzk << endl;
        mzk += B[A[i]-1];
        if (bef+1 == A[i]) {
            mzk += C[A[i]-2];
        }
        bef = A[i];
        // cout << i << " " << mzk << endl;
    }
    cout << mzk << endl;
    return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
X = sorted([list(map(int,input().split())) for n in range(N)])
G = 0
D = 0

for m in range(M):
  if D+X[m][1]<M:
    D+=X[m][1]
    G+=X[m][0]*X[m][1]
  else:
    G+=X[m][0]*(M-D)
    print(G)
    exit()

Measured memory_bytes: 28364
N=int(input())
A=[]
B=[]
C=[]
for i in range(N):
  a,b,c=map(int,input().split())
  A.append(a)
  B.append(b)
  C.append(c)

dpa=[0]*(N+1)
dpb=[0]*(N+1)
dpc=[0]*(N+1)

for i in range(N):
  dpa[i]=max(dpb[i-1],dpc[i-1])+A[i]
  dpb[i]=max(dpa[i-1],dpc[i-1])+B[i]
  dpc[i]=max(dpa[i-1],dpb[i-1])+C[i]

print(str(max(dpa[N-1],dpb[N-1],dpc[N-1])))

Measured memory_bytes: 26840
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#define rep(i,n) for (int i=0;i<(n);i++)

using namespace std;

int main() {
	long long a,b,c,d;
	cin >> a >> b >> c >> d;

	long long ans = b * d;
	
	if (ans < b* c)ans = b * c;
	if (ans < a * c)ans = a * c;
	if (ans < a * d)ans = a * d;

	if (a < 0 && b>0 || c < 0 && d>0) {
		if (ans < 0)ans = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
#define MAX_N 300005
   
ull B=5575777;
ull mem[MAX_N];
   
ull pow(int x){
  if(x==0)return 1;
  if(mem[x]>0)return mem[x];
  if(x&1)return mem[x]=pow(x-1)*B;
  mem[x]=pow(x/2);
  mem[x]*=mem[x];
  return mem[x];
}
   
int n,m;
char s[MAX_N+MAX_N];
ull p[MAX_N+MAX_N];
   
ull get(int l,int r){
  return p[r]-p[l]*pow(r-l);
}
   
ull get(int l,int r,int x,char ch){
  ull res=p[r]-p[l]*pow(r-l);
  if(l<=x&&x<r){
    int dist=r-x-1;
    res-=pow(dist)*s[x];
    res+=pow(dist)*ch;
  }
  return res;
}
   
bool eq(int a,int b,int l,int r){
  return ( get(a,b) == get(l,r) );
}
   
bool eq(int a,int b,int l,int r, int x,char ch){
  return ( get(a,b,x,ch) == get(l,r,x,ch) );
}
   
bool calc(int a,int b,int l,int r){
  int L=0,R=b-a+1,M;
  while(R-L>1){
    M=(L+R)/2;
    if( eq(a,a+M,l,l+M) ){
      L=M;
    }else{
      R=M;
    }
  }
  if(L==b-a)return false;
  return ( eq(a,b,l,r, l+L, s[a+L]) || eq(a,b,l,r, a+L, s[l+L] )  );
}
   
   
   
int main(){
  scanf("%s",s);
  n=strlen(s);
  scanf("%s",s+n);
  m=strlen(s+n);
  
  p[0]=0;
  for(int i=1;i<=n+m;i++){
    p[i]=p[i-1]*B+s[i-1];
  }
   
  int ans=0;
  for(int i=0;i<n-m+1;i++){
    ans+=calc(i,i+m,n,n+m);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 7328
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
l = nl()

cnt=0

for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1, n):
      if not (l[i]==l[j] or l[j]==l[k] or l[i]==l[k]):
          ll = sorted([l[i],l[k],l[j]])
          if ll[0]+ll[1]>ll[2]:
            cnt+=1
print(cnt)


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

int main() {
  int N, M;
  string op;
  for(int i = 0; i < 99999; i++){
      cin >> N >> op >> M;
      if(op == "+") cout << N+M << endl;
      else if(op =="-") cout << N-M << endl;
      else if(op =="*") cout << N*M << endl;
      else if(op == "/") cout << N/M << endl;
      else break;
  }

}


Measured memory_bytes: 3148
#include <stdio.h>
#define NUM 10

int main(void)
{
  int n[NUM];
  int h1,h2,h3,t;
  int i;
  scanf("%d",&h1);
  scanf("%d",&t);
  if(t>=h1){
    h2 = h1;
    h1 = t;
  }
  else h2 = t;
  scanf("%d",&t);
  if(t>=h1){
    h3 = h2;
    h2 = h1;
    h1 = t;
  }
  else if(t>=h2){
    h3 = h2;
    h2 = t;
  }
  else h3=t;

  for(i=3;i<NUM;i++)
    {
      scanf("%d",&n[i]);
      if(n[i]>=h1){
	h3 = h2;
	h2 = h1;
	h1 = n[i];
      }
      else if(n[i]>=h2){
	h3 = h2;
	h2 = n[i];
      }
      else if(n[i]>=h3)
	h3 = n[i];
    }
  printf("%d\n%d\n%d\n",h1,h2,h3);
  return 0;
}

Measured memory_bytes: 600
//include
//------------------------------------------
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

// conversion
inline int
toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

//math
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

int main()
{
    int N, X;
    cin >> N >> X;
    VI L(N + 1);
    FOR(i, 1, N + 1)
    cin >> L[i];
    VI D(N + 2);
    D[1] = 0;
    int cnt = 1;
    FOR(i, 2, N + 2)
    {
        D[i] = D[i - 1] + L[i - 1];
        if (D[i] > X)
            break;
        ++cnt;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void){
    int h,i,j,k;
    int *p;
    scanf("%d",&h);
    p = (int*)malloc(sizeof(int)*h);
    for(i=0;i<h;i++){
        scanf("%d",&p[i]);
    }
    k=-1;
    for(i=0;i<h-1;i++){
        if(p[i]<=p[h-1]){
            k++;
            j=p[i];
            p[i] = p[k];
            p[k] = j;
        }
    }
    j = p[k+1];
    p[k+1] = p[h-1];
    p[h-1]=j;
    j=k+1;
    for(i=0;i<h;i++){
        if(j==i){printf("[");}
        printf("%d",p[i]);
        if(j==i){printf("]");}
        if(i!=h-1){
            printf(" ");
        }
    }
    printf("\n");
    free(p);
    return 0;
}




Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
#define scd(t) scanf("%d",&t)
#define scld(t) scanf("%ld",&t)
#define sclld(t) scanf("%lld",&t)
#define scc(t) scanf("%c",&t)
#define scs(t) scanf("%s",t)
#define scf(t) scanf("%f",&t)
#define sclf(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ffor(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define rfor(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define rep(i, j) ffor(i, 0, j, 1)
#define rrep(i, j) rfor(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp make_pair
#define pb push_back
//#define f first
//#define s second
#define inf (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define trace1(x)                     cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)        cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
const double pi=acos(-1.0);
typedef pair<long long int,long long int> pii;
typedef long long ll;
typedef vector<long long int> vi;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef map<long long int,long long int> mpii;
typedef set<long long int> sei;
typedef multiset<long long int> msei;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m,W;
    cin>>n>>W;
    ll w[n+1],v[n+1];
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
    }
    ll dp[n+1][W+1];
    memset(dp,0,sizeof(dp));
    ll maxi=0;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=W;j++)
        {
            if(j>=w[i])
            {
                dp[i][j]=max(dp[i][j],dp[i-1][j-w[i]]+v[i]);
            }
            dp[i][j]=max(dp[i][j],max(dp[i-1][j],dp[i][j-1]));
            maxi=max(maxi,dp[i][j]);
        }
    }
    cout<<maxi;
    return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll n;cin >>n;
    vector<ll>a(3*n);
    for (int i = 0; i < 3*n; ++i) {
        cin >>a[i];
    }
    sort(all(a));
    ll ans=0;
    ll tmp=3*n;
    for (int i = 0; i < n; ++i) {
        ans+=a[tmp-2];
        tmp-=2;
    }
    cout <<ans <<endl;
    return 0;
}



Measured memory_bytes: 2560
N,K=map(int,(input().split()))
costs = list(map(int, input().split()))

from collections import defaultdict
dp = defaultdict(int)
for i in range(len(costs)):
    dp[i]=0 
    
for i in range(1, len(costs)):
    
    min_range=max([i-K,0])
    now = costs[i]
    min_cost = min([abs(now-costs[j])+dp[j] for j in range(min_range,i)])
    dp[i] = min_cost
print(dp[N-1])

Measured memory_bytes: 61536
def examB():
    w = S()
    char = [0]*26
#    print(ord(w[0]))
    for s in w:
        char[ord(s)-97] +=1
    ans = "Yes"
    for i in char:
        if i%2==1:
            ans = "No"
    print(ans)

import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()


Measured memory_bytes: 38384
#include <cstdio>
#include <cstring>

typedef long long ll_t;

char S[12];
int N;
ll_t dp[11];
int F[11];

ll_t eval(int i, int j) {
    ll_t ret = 0;
    while (i <= j) {
        ret = ret * 10 + (S[i] - '0');
        i++;
    }
    return ret;
}

ll_t solve(int i) {
    if (i >= N) return 0;
    ll_t& ret = dp[i];
    if (ret != 0) return ret;
    for (int j = i; j < N; j++) {
        ll_t x = eval(i, j);
        ret += x * F[N-j-1] + solve(j+1);
    }
    return ret;
}

int main() {
    scanf("%s", S);
    N = strlen(S);
    F[0] = F[1] = 1;
    for (int i = 2; i < N; i++) {
        F[i] = 1;
        for (int j = 1; j < i; j++)
            F[i] += F[j];
    }
    printf("%lld\n", solve(0));
    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    ll a, b, x; cin >> a >> b >> x;
    if (a == 0) cout << b / x + 1 << endl;
    else cout << b / x - (a - 1) / x << endl;
    return 0;
}


Measured memory_bytes: 256
#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<math.h>
#include<iomanip>
#include<functional>
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define all(v) v.begin(), v.end()
#define P pair<int, int>
const ll  MOD = 1000000007;

vt pow_mod_rep_square(vt n, vt p, vt mod) { //mod付き
	if (p == 0) return 1;
	else if (p % 2 == 0) {
		vt t = pow_mod_rep_square(n, p / 2, mod);
		return t * t % mod;
	}
	else return n * pow_mod_rep_square(n, p - 1, mod) % mod;
}

vt pow_rep_square(vt n, vt p) { //modなし
	if (p == 0) return 1;
	else if (p % 2 == 0) {
		vt t = pow_rep_square(n, p / 2);
		return t * t;
	}
	else return n * pow_rep_square(n, p - 1);
}

//以下、フェルマーの小定理による逆元（mod付）

vt inv_Felmat(vt a, vt mod) {
	return pow_mod_rep_square(a, mod - 2, mod);
}

//以下,二項係数(1 <= n <= 10 ^ 9, 1 <= k <= 10 ^ 7 くらい)

vt permutation_mod(vt n, vt k, vt mod) { //mod付き順列
	if (k == 1) return n % mod;
	return permutation_mod(n, k - 1, mod) * (n - k + 1) % mod;
}

vt comb_mod(vt n, vt k, vt mod) { //mod付き二項係数
	if (k == 0) return 1;
	if (n < k) return 0;
	return permutation_mod(n, k, mod) * inv_Felmat(permutation_mod(k, k, mod), mod) % mod;
}


int main() {
	ll n, k;
	cin >> n >> k;
	if (n == k) {
		cout << 1 << endl;
		rep(i, k - 1) cout << 0 << endl;
		return 0;
	}
	reps(i, 1, k + 1) cout << comb_mod(n - k + 1, i, MOD) * comb_mod(k - 1, i - 1, MOD) % MOD << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    long long int ans,l,n,x;
    cin >> n >> l;
    ans=n*(n+1)/2 + n*(l-1);
    if(1-n<=l&&l<=0)cout << ans << endl;
    else if(l>=0)cout << ans - l << endl;
    else cout << ans - (l + n - 1) << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}

void solve(){
    ll n,ans{LLONG_MAX};
    cin>>n;
    for(ll i{1};i*i<=n;++i) if(n%i==0){
            ll tmp,_;
            tie(tmp,_)=crt(vector<ll>{0,-1},vector<ll>{i,n/i*2});
            if(tmp) chmin(ans,tmp);
            tie(tmp,_)=crt(vector<ll>{0,-1},vector<ll>{i*2,n/i});
            if(tmp) chmin(ans,tmp);
            tie(tmp,_)=crt(vector<ll>{0,-1},vector<ll>{n/i,i*2});
            if(tmp) chmin(ans,tmp);
            tie(tmp,_)=crt(vector<ll>{0,-1},vector<ll>{n/i*2,i});
            if(tmp) chmin(ans,tmp);
    }
    cout<<ans<<'\n';
}

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

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

fn main() {
    let cin = stdin();
    let mut sc = Scanner::new(cin.lock());

    let a: i32 = sc.next();
    let b: i32 = sc.next();
    let c: i32 = sc.next();

    let ans = if a < b && b < c { "Yes" } else { "No" };
    println!("{}", ans);
}

struct Scanner<R: Read> {
    reader: R,
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
    fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            token.parse::<T>().ok()
        }
    }

    fn next<T: FromStr>(&mut self) -> T {
        if let Some(s) = self.read() {
            s
        } else {
            writeln!(stderr(), "Terminated with EOF").unwrap();
            std::process::exit(0);
        }
    }
}



Measured memory_bytes: 5028
#include <iostream>
using namespace std;
int main()
{
 int n;
 cin >> n;
 if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9)
 {
  cout << "hon\n";
 }
 else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
 {
  cout << "pon\n";
 }
 if (n % 10 == 3)
 {
  cout << "bon\n";
 }
 return 0;
}

Measured memory_bytes: 3620
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;

int p[N], q[N], r[N];
int x, y, a, b, c;

int func(int mid) {
    int ans = 0;
    for (int i = 0; i <= mid; i++) {
        if (0 <= x - i && x - i <= a && 0 <= y - mid + i && y - mid + i <= b && mid <= c)
            ans = max(ans, r[mid] + p[x - i] + q[y - mid + i]);
    }
    return ans;
}

signed main(){
    IOS;
    cin >> x >> y >> a >> b >> c;
    for (int i = 1; i <= a; i++)
        cin >> p[i];
    for (int i = 1; i <= b; i++)
        cin >> q[i];
    for (int i = 1; i <= c; i++)
        cin >> r[i];
    sort(p + 1, p + a + 1, greater<int>());
    sort(q + 1, q + b + 1, greater<int>());
    sort(r + 1, r + c + 1, greater<int>());
    for (int i = 1; i <= a; i++)
        p[i] += p[i-1];
    for (int i = 1; i <= b; i++)
        q[i] += q[i-1];
    for (int i = 1; i <= c; i++)
        r[i] += r[i-1];
    int l = 0, r = min(c, x + y);
    int ans = 0;
    while (l <= r) {
        int mid = (l + r) >> 1;
        dbg(mid)
        int v1 = func(mid);
        int v2 = func(mid + 1);
        dbg(v1, v2, mid)
        if (v1 > v2) {
            r = mid - 1;
        }
        else {
            l = mid + 1;
        }
        ans = max({ans, v1, v2});
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double lb;
typedef long double ld;
typedef pair<int,int> P;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1e9+7;
#define INF 1e12;
#define EPS 1e-9;

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;


signed main(){
  int N;cin>>N;
  vector<int> A(N),vec1(N,0),vec2(N,0);
  REP(i,0,N){
    cin>>A[i];
  }
  vec1[0]=A[0];vec2[N-1]=A[N-1];
  REP(i,1,N){
    vec1[i]=vec1[i-1]+A[i];
  }
  RREP(i,N-2,-1){
    vec2[i]=vec2[i+1]+A[i];
  }
  int ans=INF;
  REP(i,0,N-1){
    ans=min(ans,abs(vec1[i]-vec2[i+1]));
  }
  print(ans)


}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll gcd(ll m, ll n){
  ll m1 = m, n1 = n;
  ll tmp;

  while(n1 != 0){
    tmp = n1;
    n1 = m1 % n1;
    m1 = tmp;
  }

  return m1;
}

int main(){
  ll N, X;
  cin >> N >> X;
  vl x(N);
  rep(i, N) cin >> x[i];

  ll tmp;
  ll ans = abs(x[0] - X);

  rep2(i, 1, N){
    tmp = abs(x[i] - X);
    ans = gcd(ans, tmp);
  }

  cout << ans << "\n";
  
  return 0;
}


Measured memory_bytes: 4048