akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <ctime>
#include <cstring>
#include <unordered_map>
#include <cstdio>
 
#define gc getchar_unlocked
#define N 109
 
using namespace std;
 
int sug[3009],wat[3009];
 
int main(){	
	int i,j,t1,t2,t3,t4,a,b,c,d,e,f,a1,a2;
	double perc=0,temp;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	sug[0]=wat[0]=1;
	a1=a2=0;
	for(i=1;i<=3000;i++){
		if(i-c>=0){
			sug[i]|=sug[i-c];
		}
		if(i-d>=0){
			sug[i]|=sug[i-d];
		}
		if(i-100*a>=0){
			wat[i]|=wat[i-100*a];
		}
		if(i-100*b>=0){
			wat[i]|=wat[i-100*b];
		}
	}
	for(i=1;i<=f;i++){
		//water used
		for(j=1;j<=i;j++){
			if(wat[j] && sug[i-j]){
				t1=e*j;
				t1/=100;
				if(i-j<=t1){
					temp=(100.0*(i-j))/i;
					if(temp>=perc){
						perc=temp;
						a1=i;
						a2=i-j;
					}
				}
			}
		}
	}
	printf("%d %d\n",a1,a2);
	return 0;
}

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

typedef long long ll;
typedef long double ld;

const int N = 100;
int grid[N+1][N+1];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	memset(grid, 0, sizeof(grid));
	int n; cin >> n;
	
	int cx, cy, realH;
	for (int i = 0; i < n; i++){
		int x,y,h; cin >> x >> y >> h;	
		grid[x][y] = h;

	}
	vector<pair<int,pair<int,int>>> ans;
	bool found = false;
	for (int i = 0; i < N+1; i++){
		for (int j = 0; j < N+1; j++){
			int fakeH = 0;
			int valid = true;
			for (int x = 0; x < N+1; x++){
				for (int y = 0; y < N+1; y++){
					if (grid[x][y]){
						if (fakeH != 0){
							if (max(fakeH-abs(x-i)-abs(y-j),0) != grid[x][y]){
								valid = false;
								break;
							}
						}
						else{
							fakeH = grid[x][y] + abs(x-i) + abs(y-j);
						}
					}
				}
				if (!valid) break;
			}
			if (valid){
				found = true;
				ans.push_back(make_pair(fakeH,make_pair(i,j)));
			}
		}
	}
	
	auto p = *min_element(ans.begin(),ans.end());
	
	cout << p.second.first << " " << p.second.second << " " << p.first << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define REP(i, n)  for(int i=0; i<(int)(n); i++)
#define REPS(i, n)  for(int i=1; i<=(int)(n); i++)
#define PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n)-1; i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define pb  push_back
#define eb  emplace_back

const int INF = 1<<28;
const int MOD = 1000000007;

struct Restaurant{
  std::string name;
  int score;
  int num;

  Restaurant(std::string _name, int _score, int _num):
  name(_name),
  score(_score),
  num(_num)
  {
  }

  bool operator<(const Restaurant& restaurant) const{
    return (name < restaurant.name) ||
     (name == restaurant.name && score > restaurant.score);
  }
  bool operator>(const Restaurant& restaurant) const{
    return (name > restaurant.name) ||
     (name == restaurant.name && score < restaurant.score);
  }
};

int main(){
  int N;  cin >> N;
  vector<Restaurant> vec;
  REP(i, N){
    string s;
    int p;
    cin >> s >> p;
    Restaurant restaurant(s, p, i+1);
    vec.emplace_back(restaurant);
  }
  sort(ALL(vec));
  REP(i, N){
    cout << vec[i].num << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 100005

int main(){

    int a,b,c,d;
    cin >> a;

    if(a<=999){
        cout << "ABC" << endl;
    }else{
        cout << "ABD" << endl;
    }
   
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define all(v) (v).begin(),(v).end()
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T>bool chmin(T &a,T b){if(b<a){a=b;return 1;} return 0;}

int dx[4] = {0,0,-1,1};
int dy[4] = {1,-1,0,0};
string rlud = "RLUD";


const int MAX = 10000;
const int mod = 998244353;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

ll dp[2001][2001];

// run : ctrl + c 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    
    string s;
    cin>>s;
    int n = s.size();
    COMinit();
    int r=0,b=0;
    dp[0][0] = 1;
    for(int i=0;i<n;i++){
        int nb=b,nr=r;
        if(s[i]=='0')nr+=2;
        if(s[i]=='2')nb+=2;
        if(s[i]=='1')nr++,nb++;
        for(int j=0;j<=i;j++){
            if(r>=j && b>=i-j){
                if(nr-j>0){
                    dp[i+1][nr-j-1] += dp[i][r-j];
                    dp[i+1][nr-j-1] %= mod;
                }
                if(nb-(i-j)>0){
                    dp[i+1][nr-j] += dp[i][r-j];
                    dp[i+1][nr-j] %= mod;
                }
            }
        }
        r=nr, b=nb;
    }
    ll ans = 0;
    for(int i=0;i<=n;i++){
        ans += (dp[n][i] * COM(n,i))%mod;
        ans %= mod;
    }
    cout << ans << endl;

    
}

Measured memory_bytes: 30336
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int n;
    string s;
    cin >> n >> s;
    map<pair<string,string>,ll>mp;
    rep(i,1<<n){
        string a,b;
        rep(j,n){
            if(i&(1<<j)){
                a+=s[j];
            }else{
                b+=s[j];
            }
        }
        reverse(b.begin(),b.end());
        mp[make_pair(a,b)]++;
    }
    ll ans = 0;
    rep(i,1<<n){
        string a,b;
        rep(j,n){
            if(i&(1<<j)){
                a+=s[j+n];
            }else{
                b+=s[j+n];
            }
        }
        reverse(b.begin(),b.end());
        ans += mp[make_pair(b,a)];
    }
    cout << ans << endl;
}

Measured memory_bytes: 49408
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  int64_t N, x;
  cin >> N >> x;
  vector<int64_t> a(N);
  rep(i, N){
    cin >> a.at(i);
  }
  if(accumulate(all(a), 0LL) <  x){
    cout << N-1 << endl;
    return 0;
  }
  sort(all(a));
  int64_t cnt = 0;
  int64_t dist = 0;
  int64_t j = 0;
  while(j <= N-1 && dist + a.at(j) <= x){
    cnt++;
    dist += a.at(j);
    j++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
N, M = map(int,input().split())
G = [[] for k in range(N)]

for k in range(M):
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

def dfs(ima,visited):
    global ans
    visited[ima] = 1
    for tsugi in G[ima]:
        if visited[tsugi] == 0:
            visited[tsugi] = 1
            if sum(visited) == N:
                ans += 1
            dfs(tsugi,visited)
            visited[tsugi] = 0
ans = 0
dfs(0,[0]*N)
print(ans)


Measured memory_bytes: 9216
#include<bits/stdc++.h>
using namespace std;
using Data = pair<long long,vector<int>>;
typedef struct{
  long long flavor;
  int i;
  int j;
  int k;
}vect;

int longsort(const void *a,const void *b){
	long long *A=(long long *)a;
	long long *B=(long long *)b;
	if(*A>*B) return -1;
	if(*A<*B) return 1;
	return 0;
}

int main(){
  int x,y,z,K,i,j,k,l;
  long long a[1000]={0},b[1000]={0},c[1000]={0};
  vect t;
  scanf("%d",&x);
  scanf("%d",&y);
  scanf("%d",&z);
  scanf("%d",&K);

  for(i=0;i<x;i++){
    scanf("%lld",&a[i]);
  }
  qsort(a,1000,sizeof(long long),longsort);
  for(i=0;i<y;i++){
    scanf("%lld",&b[i]);
  }
  qsort(b,1000,sizeof(long long),longsort);
  for(i=0;i<z;i++){
    scanf("%lld",&c[i]);
  }
  qsort(c,1000,sizeof(long long),longsort);

  priority_queue<Data> que;
  set<Data> se;
  auto tt=Data(a[0]+b[0]+c[0],vector<int>({0,0,0}));
  que.push(tt);
  auto cnt=se.insert(tt);

  for(l=0;l<K;l++){
    tt=que.top();
    t.i=tt.second[0];
    t.j=tt.second[1];
    t.k=tt.second[2];
    printf("%lld\n",tt.first);
    que.pop();
    if(t.i+1<x){
      auto next=Data(a[t.i+1]+b[t.j]+c[t.k],vector<int>({t.i+1,t.j,t.k}));
      cnt=se.insert(next);
      if(cnt.second)que.push(next);
    }
    if(t.j+1<y){
      auto next=Data(a[t.i]+b[t.j+1]+c[t.k],vector<int>({t.i,t.j+1,t.k}));
      cnt=se.insert(next);
      if(cnt.second)que.push(next);
    }
    if(t.k+1<z){
      auto next=Data(a[t.i]+b[t.j]+c[t.k+1],vector<int>({t.i,t.j,t.k+1}));
      cnt=se.insert(next);
      if(cnt.second)que.push(next);
    }
  }
  return 0;
}

Measured memory_bytes: 1404
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}



int main() {

  long n;
  cin >> n;

  // FABは最大桁数
  // FABの最小値

  //

  long nn = sqrt(n);

  cerr << nn <<endl <<endl;

  long ans =1000;

  for (int i = 1; i <= nn; ++i){
    if ( n % i ==0 ){
      cerr << i <<endl;
      string s = to_string((long)(max((long)i,n/(long)i)));
      ans = min(ans, (long)s.size() );
    }
  }




  cout << ans <<endl;


}




















Measured memory_bytes: 256
n,q = map(int,input().split())
s = input()
x = []
y = []
for i in range(q):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1) 

t = [0]*n

for i in range(n-1):
    if s[i+1] == "C" and s[i] == "A":
        t[i+1] = t[i]+1
    else:
        t[i+1] = t[i]
for i in range(q):
    ans = t[y[i]-1] - t[x[i]-1]
    print(ans)

Measured memory_bytes: 14208
x, y = gets.split(' ').map(&:to_i)
if y.odd?
        puts 'No'
        return
end

j = (x * 4 - y) / 2
if j >= 0 and (x * 4 - y) % 2 == 0 and x - j >= 0
        puts 'Yes'
else
        puts 'No'
end

Measured memory_bytes: 14328
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

//#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
//#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
//#include <atomic>
#include <chrono>
//#include <condition_variable>
#include <forward_list>
//#include <future>
#include <initializer_list>
//#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
//#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>


using namespace std;

template<typename T>
class UF
{
public:
	UF ()
	{
		count = 0;
	}

	void push ( T a )
	{
		M[a] = count;
		V.push_back ( count );
		rank.push_back ( 0 );
		count++;
	}

	void unite ( T a , T b )
	{
		long long int x = find ( M[a] );
		long long int y = find ( M[b] );
		if( x == y )return;
		if( rank[x] < rank[y] )
		{
			V[x] = y;
		} else
		{
			V[y] = x;
			if( rank[x] == rank[y] )rank[x]++;
		}
	}
	void merge ( T a , T b )
	{
		unite ( a , b );
	}
	bool same ( T a , T b )
	{
		return find ( M[a] ) == find ( M[b] );
	}
	long long int group ()
	{
		set<long long int>S;
		for( long long int i = 0; i < V.size (); i++ )
		{
			S.insert ( find ( V[i] ) );
		}
		return S.size ();
	}

private:
	vector<long long int> V , rank;
	map < T , long long int>M;
	long long int count;

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

int main ()
{
	int V , d;
	int data[1001] = {};
	data[0] = 2;
	data[1] = 3;
	for( size_t i = 2; i < 1001; i++ )
	{
		data[i] = data[i - 1] + data[i - 2];
		data[i] %= 1001;
	}

	while( cin >> V >> d )
	{
		UF<int> uf;
		for( size_t i = 0; i < V; i++ )
		{
			uf.push ( i );
		}
		for( size_t i = 0; i < V; i++ )
		{
			for( size_t j = i + 1; j < V; j++ )
			{
				if( abs ( data[i] - data[j] ) < d )
				{
					uf.merge ( i , j );
				}
			}
		}
		cout << uf.group () << endl;
	}
}

Measured memory_bytes: 1304
#include<cstdio>
#include<iostream>
#include<ctype.h>
#include<string>
using namespace std;
int main(){
	string S;
	cin >> S;
	int a = 0;
	for(int i = 0; i <= 3; i++){
		if(S[i] == '+'){
			a ++;
		}
		else{
			a --;
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
l=[]
for i in range(n):
    x,y,h = map(int, input().split())
    l.append([x,y,h])
l.sort(reverse=True, key=lambda x: x[2])
for i in range(101):
    for j in range(101):
        px, py, ph = l[0]
        H = ph + abs(px-i) + abs(py-j)
        if all(h == max(H-abs(x - i) - abs(y - j),0) for x, y, h in l):
            print(i,j,H)
            break

Measured memory_bytes: 3064
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, K = MI()
p = 0

for i in range(1, N + 1):
    p_i = 1 / N
    ex = 0
    
    if i < K: 
        while 1:
            ex += 1
            if i * pow(2, ex) >= K:
                break
    
    p += p_i * (1 / 2)**ex
    
print(p)

Measured memory_bytes: 65700
N, M = map(int, input().split())
L, R = [0]*M, [0]*M
A = set(range(N))
lm, rm = 0, N
for i in range(M):
    L[i], R[i] = map(int, input().split())
    lm = max(lm, L[i])
    rm = min(rm, R[i])
if lm <= rm:
    print(rm-lm+1)
else:
    print(0)

Measured memory_bytes: 23980
#include "bits/stdc++.h"
using namespace std;
#define INF 1e9
#define rep(i, n) for(int i=0;i<n;i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef long long ll;  //ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;  
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VII;   // VII a(n,vector<int>(m)) n * m 
typedef vector<VL> VLL;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<ll, ll> > PS;
void input() {}
template<typename... R> void input(int& f, R&... r) { scanf("%d", &f); input(r...); }
template<typename... R> void input(double& f, R&... r) { scanf("%lf", &f); input(r...); }
template<typename... R> void input(ll& f, R&... r) { scanf("%lld", &f); input(r...); }
template<typename... R> void input(char& f, R&... r) { scanf("%c", &f); input(r...); }
template<typename T, typename... R> void input(vector<T>& f, R&... r) { rep(i, f.size())input(f[i]); input(r...); }

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b){
    if (a < b){ a = b;return 1;}
    return 0;
}
template <class T, class U> //chmin(min,a)
bool chmin(T &a, U b){
    if (a > b){ a = b; return 1;}
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}
// g++ -std=c++11 prac.cpp 

int main(){
    ll x=0,y=0,z=0,n,m=0,k,h,w,sum=0,Max=-1e9-1,count=0,Min=1e9+1;
    string s,t;
    bool ok=true;
    cin >> x >> y;
    VI a(3);
    a[x-1]++;
    a[y-1]++;
    rep(i,3){
        if(a[i]==0){
            cout << i+1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include<map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define LONGINF 1000000000000000000
int main() {
	int n;
	cin >> n;
	long long ans = 0;
	long long a;
	cin >> a;
	ans = a - 1;
	long long cnt = 1;
	REP(i, n - 1) {
		cin >> a;
		if (cnt+1 != a) {
			if (a - cnt >= 0) {
				ans += (a -1) / (cnt+1);
			}
		}
		else cnt++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,a[500][500],f[500],flag[500],ans;
bool fk[500],ff;
int read(){
	char c=getchar();while (c!='-'&&(c<'0'||c>'9'))c=getchar();
	int kk=1,k=0;if (c=='-')kk=-1,c=getchar();
	while (c>='0'&&c<='9')k=k*10+c-'0',c=getchar();return kk*k;
}
signed main(){
	n=read();m=read();for (int i=1;i<=n;i++)for (int j=1;j<=m;j++)a[i][j]=read();
	for (int i=1;i<=n;i++)f[i]=1,flag[a[i][1]]++;ff=1;ans=1e9;
	while (ff){
		int k=0;for (int i=1;i<=m;i++)if (flag[i]>flag[k])k=i;
		ans=min(ans,flag[k]);fk[k]=1;
		for (int i=1;i<=n;i++){
			while (fk[a[i][f[i]]]&&f[i]<n+1)flag[a[i][f[i]]]--,f[i]++,flag[a[i][f[i]]]++;
			ff&=f[i]<n+1;
		}
	}cout<<ans<<endl;
}


Measured memory_bytes: 1408
import sys
sys.setrecursionlimit(10**9)

n = int(input())
graph = [[] for _ in range(n)]
ans = [0] * (n-1)

for i in range(n-1):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    graph[a].append([b, i])

# coloring
def dfs(now, color):
    cnt = 1
    for to, num in graph[now]:
        if cnt == color:
            cnt += 1
        ans[num] = cnt
        dfs(to, cnt)
        cnt += 1    

dfs(0, 0)

print(max(ans))
for i in ans:
    print(i)

Measured memory_bytes: 71040
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
		int n,k,s;
		cin>>n>>k>>s;
		n-=k;
		while(k--)cout<<s<<" ";
		while(n--)cout<<(s==1e9?s-1:s+1)<<" ";
}
int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 1280
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }

int main() {
	int N; int M;
	while (~scanf("%d%d", &N, &M)) {
		vector<int> A(N - 1);
		for (int i = 0; i < N - 1; ++i)
			scanf("%d", &A[i]);
		vector<vector<int> > B(N, vector<int>(M));
		for (int i = 0; i < N; ++i) for (int j = 0; j < M; ++j)
			scanf("%d", &B[i][j]);
		vector<ll> pos(N, 0);
		rep(i, N - 1)
			pos[i + 1] = pos[i] + A[i];
		ll ans = -INFL;
		rep(i, N) {
			ll sum = accumulate(B[i].begin(), B[i].end(), 0LL);
			amax(ans, sum);
		}
		static ll add[5001][5001];
		function<void(int, int)> rec = [&](int left, int right) {
			if (left + 1 == right) return;
			int size = right - left, half = size / 2;
			
			vector<int> maxVal(size);
			rep(i, size) rep(j, size + 1)
				add[i][j] = 0;
			rep(j, M) {
				for (int i = half - 1; i >= 0; --i)
					maxVal[i] = max(B[left + i][j], i == half - 1 ? -INF : maxVal[i + 1]);
				for (int i = half; i < size; ++i)
					maxVal[i] = max(B[left + i][j], i == half ? -INF : maxVal[i - 1]);
				for (int i = half - 1, j = half; i >= 0; --i) {
					for (; j < size && maxVal[i] >= maxVal[j]; ++j);
					add[i][0] += maxVal[i];
					add[i][j] -= maxVal[i];
				}
				for (int i = half, j = half; i < size; ++i) {
					for (; j > 0 && maxVal[i] > maxVal[j - 1]; --j);
					add[i][j] += maxVal[i];
					add[i][half] -= maxVal[i];
				}
			}
			rep(i, size) rep(j, size)
				add[i][j + 1] += add[i][j];
			rep(i, half) reu(j, half, size) {
				ll sum = 0;
				sum += add[i][j];
				sum += add[j][i];
				ll dist = pos[left + j] - pos[left + i];
				ll value = sum - dist;
				amax(ans, value);
			}

			rec(left, left + half);
			rec(left + half, right);
		};
		rec(0, N);
		printf("%lld\n", ans);
	}
	return 0;
}


Measured memory_bytes: 199936
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let a: Vec<i64> = sc.vec(n);
    let mut x = vec![0; n];
    for (i, v) in a.iter().enumerate() {
        if i % 2 == 0 {
            x[0] += *v;
        } else {
            x[0] -= *v;
        }
    }
    for (i,  _) in a.iter().enumerate().skip(1) {
        x[i] = 2 * a[i - 1] - x[i - 1];
    }
    for &y in x.iter() {
        print!("{} ", y);
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 11644
import java.io.BufferedInputStream



// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    fun iterateTokens(): Iterator<String> {
        val reader = BufferedInputStream(System.`in`).bufferedReader()
        val iterator = reader.lineSequence()
                .map { it.split(" ") }
                .reduce { left, right -> left + right }
                .iterator()
        return iterator
    }
    val tokens = iterateTokens()
    val A = tokens.next().toLong()
    val B = tokens.next().toLong()
    val T = tokens.next().toLong()
    solve(A, B, T)
}

fun solve(A: Long, B: Long, T: Long){
    println(B* (T / A))
    return
}

Measured memory_bytes: 35696
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int x2 = sc.nextInt();
		int x3 = sc.nextInt();
		int x4 = sc.nextInt();
		int x5 = sc.nextInt();
		if (x1 == 0) {
			System.out.println(1);
		} else if (x2 == 0) {
			System.out.println(2);
		} else if (x3 == 0) {
			System.out.println(3);
		} else if (x4 == 0) {
			System.out.println(4);
		} else {
			System.out.println(5);
		}
	}
}


Measured memory_bytes: 35780
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <limits>
#include <math.h>
#include <string>
#include <map>

using namespace std;

int main() {
  string s;
  cin >> s;
  map<char, int> m;
  int n = (int)s.size();
  for (int i = 0; i < n; ++i) {
    m[s[i]]++;
  }
  if (m.size() == 4) {
    puts("Yes");
  } else if (m.size() == 2) {
    if (m['S'] > 0 && m['N'] > 0) {
      puts("Yes");
    } else if (m['E'] > 0 && m['W'] > 0) {
      puts("Yes");
    } else {
      puts("No");
    } 
  } else {
    puts("No");
  }
  return 0;
}


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

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

  int n;
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;

    if(a%2 == 0 && !(a%3 == 0 || a%5 == 0)) {
      cout << "DENIED" << endl;
      return 0;
    }
  }

  cout << "APPROVED" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pf printf
#define sf scanf
using namespace std;
int main(){
 //freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 int a,b,c;
 cin>>a>>b>>c;
 if(a+b+c>=22)cout<<"bust";
 else cout<<"win";
  


  
  


  
 
 
 
    
 
return 0;
}

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

const int N = 110;

char str[N][N];
int R[N], C[N];

int main() {
	
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> str[i];
	
	for (int i = 0; i < n; i++) {
		int cnt = 0;
		for (int j = 0; j < m; j++) cnt += str[i][j] == '#';
		if (!cnt) R[i] = 1;
	}
	for (int j = 0; j < m; j++) {
		int cnt = 0;
		for (int i = 0; i < n; i++) cnt += str[i][j] == '#';
		if (!cnt) C[j] = 1;
	}
	
	for (int i = 0; i < n; i++) if (!R[i]) {
		for (int j = 0; j < m; j++) if (!C[j]) cout << str[i][j];
		cout << "\n";
	}
	
	return 0;
}

Measured memory_bytes: 3668
#include<iostream>
#include<algorithm>
#include<cmath>
#define int long long
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define c(n) cout<<n<<endl;
signed main(){
	int n;
	cin>>n;
	c(48-sqrt(n*n))
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
#include <stack>
using namespace std;
#define N 200005
struct node{int to,next;}e[N<<1];
int head[N],cnt,f[N],ans,n;
void add(int x,int y){e[cnt]=(node){y,head[x]};head[x]=cnt++;}
void dfs(int x,int from)
{
	f[x]=1;
	for(int i=head[x];i!=-1;i=e[i].next)
	{
		int to1=e[i].to;
		if(to1!=from)dfs(to1,x),ans=max(ans,f[x]+f[to1]),f[x]=max(f[x],f[to1]+1);
	}
}
bool g[N];
int main()
{
	scanf("%d",&n);memset(head,-1,sizeof(head));ans=1;
	for(int i=1,x,y;i<n;i++)scanf("%d%d",&x,&y),add(x,y),add(y,x);dfs(1,0);
	g[1]=1,g[2]=0;
	for(int i=3;i<=ans;i++)
	{
		if((!g[i-1])||(!g[i-2]))g[i]=1;
		else g[i]=0;
	}
	puts(g[ans]?"First":"Second");
}

Measured memory_bytes: 14080
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <iostream> 
#include <iomanip>  
#include <string>
#include <sstream>  
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <cstring>
#include <cmath>
#include <cassert>


#define INF              (int)1000000007
#define EPS              1e-9
#define pb               push_back
#define mp               make_pair
#define all(c)           c.begin(), c.end()
#define forall(i,a,b)    for(int i=a;i<(b);++i)
#define trav(a,x)        for(auto & a: x)
#define in(a,b)          ((b).find(a) != (b).end())
#define sz(c)            (int)(c).size()
#define input(a)         for(auto & x : a) cin >> x;

using namespace std;

typedef vector<int>      vi;
typedef pair<int,int>    ii;
typedef vector<vi>       vvi;
typedef vector<ii>       vii;
typedef long long        ll;

#ifdef DEBUG
#define trace(...)       __f(#__VA_ARGS__, __VA_ARGS__)
#define debug(args...)   {dbg,args; clog<<endl;}
#define print_( a )      for( auto & x : a ) clog << x << ' '; clog << '\n';
#define printPair_( a )  for( auto & x : a ) clog << '(' << x.first << ',' << x.second << ')' << ' '; clog << '\n';
#else
#define trace(...)       
#define debug(args...)            
#define print_( a )               
#define printPair_( a )           
#endif

struct debugger {
  template<typename T> debugger& operator , (const T& x) {    
    clog << x << " ";    return *this;    
  }
}dbg;

template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " | ";
    __f(comma + 1, args...);
}

auto ____ =[]() { std::ios::sync_with_stdio(0); cin.tie(0); return nullptr; }();

int main( int argc, char * argv[] ){
  int n; cin >> n; 
  vector<ll> v(n); input(v);
  vector<vector<ll>> dp(n, vector<ll>(n,0));
  for(int L = n-1; L >= 0; -- L){
    for(int R = L; R < n; ++ R){
      if( L==R ) dp[L][R] = v[L];
      else dp[L][R] = max(v[L] - dp[L+1][R], v[R] - dp[L][R-1]);
    }
  }
  cout << dp[0][n-1] << endl;
  return 0;
}


Measured memory_bytes: 70784
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>  //for bool
#include <stdlib.h> // abs,labs,llabs
#include <limits.h>
#include <ctype.h>

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld; //%Lf

int main(void) {
  int n, d;
  float ans = 0.0;
  scanf("%d", &n);
  ans = ceil(n / 2.0) / (float)n;
  printf("%f", ans);
  return 0;
}



Measured memory_bytes: 128
cnt = [0]*4
for i in range(3):
    a,b = map(int,input().split())
    cnt[a-1] += 1
    cnt[b-1] += 1
if cnt[0] == 1 and cnt[1] == 2 and cnt[2] == 2 and cnt[3] == 1:
    print("YES")
else:
    print("NO")


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


Measured memory_bytes: 23764
#!/usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


mod = 1000000007
inf = float('INF')

# solve


def solve():
    a, b = LI()
    print(a*b//gcd(a, b))
    return


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39024
#include<iostream>
#include<deque>
#include<queue>
#include<math.h>
#include<string>
#include<string.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<iomanip>
#include<map>
#include<bitset>
#include<algorithm>
#include<stack>
#include<unordered_map>
#include<cstdlib>
#include<unordered_set>
#include<algorithm>
#include<chrono>
 
#define inf 0x3f3f3f3f
#define sup_inf 2e18
#define pb push_back
		
#define ii pair	<long long ,long long >
#define i64ii pair< long long, pair<int,int> >
#define i64i pair<long long , int >
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define iii pair<int, ii >	
#define in freopen("entrada","r",stdin);
#define out freopen("myfile.txt", "w", stdout);
#define eps 1e-9
#define id pair<int ,double > 
#define di pair<double, int>
 
#define pi 3.14159265359
#define nl (no<<1)
#define nr ( (no<<1)|1)
#define mid l + ( (r-l)>>1)
 
using namespace std;

typedef long long ll;	
typedef vector< int> vi;
typedef long double ld;
		
typedef  pair <ii, ii > iiii;
typedef vector < ii > vii;

const int MAX = 1e2;
const int maxn = 1e6 + 100;
 


int lg(ll n ){
	int cnt = 0;
	while (n ){
		n>>=1;
		++cnt;
	}
	return cnt;
}
 
int main (){
	//~ in
	fast_io
	
	ll a, ans = 0;
	cin >> a;
	ll pot = 1;
	for(int i = 0;i < lg(a);i++){
		ans += pot;
		pot <<=1;
	}
	cout << ans << '\n';
	
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
 

    class Program
    {
        static void Main(string[] args)
        {
            int[] ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            if (ab[0] == ab[1])
            {
                Console.WriteLine("a == b");
            }else if (ab[0] > ab[1])
            {
                Console.WriteLine("a > b");
            }else
            {
                Console.WriteLine("a < b");
            }

        }
        
    }
}

Measured memory_bytes: 9368
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);cout<<"\n";};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts> auto make_v(size_t a,Ts... ts){   return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){ for(auto &e:t) fill_v(e,v); }
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value!=0>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V> typename enable_if<is_same<T, U>::value==0>::type fill_v(U &u,const V... v){ for(auto &e:u) fill_v<T>(e,v...);}
//FUNCTION

//BELOW
void solve(void)
{ 
  int N,K;
  cin>>N>>K;
  vector<int> vec(N);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }
  vector<int> v;
  for (int i = 0; i < N; i++)
  {
    int s = 0;
    for (int j = i; j < N; j++)
    {
      s += vec[j];
      v.push_back(s);
    }
  }
  
  sort(ALL(v));
  // DEBUG(v);

  int cur = 0;
  for (int i = 40; i >= 0; i--)
  {
    int ncur = cur +(1LL<<i);
    // DEBUG(ncur);
    int ok = 0;
    for (int j = 0; j < v.size(); j++)
    {
      if((ncur&v[j]) == ncur)ok++;

    }
    if(ok >= K)cur = ncur;
  }
  cout<<cur<<endl;
  

  
  

  
  return;
}
  
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

  return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
#define ll long long int;
#define pb push_back;
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main() {
	ios;
	int i,c=0,n;
	cin>>n;
	string s;
	cin>>s;
	for(i=0;i<n-2;i++)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
		{
				c++;
				i+=2;
		}
	}
	cout<<c;
	return 0;
}

Measured memory_bytes: 384
open System

module Test1 =
    let test1 n a b =
        let mutable min = b
        let na : int = n * a
        if na < min then min <- na
        min

[<EntryPoint>]
let main _argv =
    let inputArray = stdin.ReadLine().Split(' ') |> Array.map int
    let n = inputArray.[0]
    let a = inputArray.[1]
    let b = inputArray.[2]
    Test1.test1 n a b |> printfn "%d"
    0
 

Measured memory_bytes: 13916
class _Node {
  constructor(key, parent = null, left = null, right = null) {
    this.key = key;
    this.parent = parent;
    this.left = left;
    this.right = right;
  }

  getChildrenNumber() {return Number(this.left !== null) + Number(this.right !== null);}

  isLeftChild() {
    if (this.parent === null) return null;
    return this.parent.left === this;
  }

  getLeftOrRight() {return this.isLeftChild() ? 'left' : 'right';}

  getSuccessor() {
    let n;
    if (this.right !== null) {
      n = this.right;
      while (n.left !== null) n = n.left;
    } else {
      n = this.parent;
      while (!n.isLeftChild && n.parent != null) n = n.parent;
    }
    return n;
  }
}

class BinaryTree {
  constructor() {
    this.root = null;
  }

  static get Node() { return _Node; }

   insert(key) {
     if (this.root === null) {
       this.root = new BinaryTree.Node(key);
       return;
     }
     let x = this.root, y;
     let newNode = new BinaryTree.Node(key);
     while (x !== null) {
       y = x;
       x = x[key < x.key ? 'left' : 'right'];
     }
     newNode.parent = y;
     y[key < y.key ? 'left' : 'right'] = newNode;
   }


  find(key, n = this.root) {
    if (n === null || n.key === key) return n;
    return this.find(key, n[key < n.key ? 'left' : 'right']);
  }

  delete(key) {
    const n = this.find(key);
    if (n === null) return;
    let leftOrRight = n.getLeftOrRight();
    switch (n.getChildrenNumber()) {
    case 0:
      n.parent[leftOrRight] = null;
      break;
    case 1:
      n.parent[leftOrRight] = n.left || n.right;
      n.parent[leftOrRight].parent = n.parent;
      break;
    default:
      let skey = n.getSuccessor().key;
      this.delete(skey);
      n.key = skey;
    }
  }

  printByIneorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      innerFunc(n.left);
      str += ` ${n.key}`;
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  printByPreorder() {
    let str = '';
    const innerFunc = (n) => {
      if (n === null) return;
      str += ` ${n.key}`;
      innerFunc(n.left);
      innerFunc(n.right);
    }
    innerFunc(this.root);
    console.log(str);
  }

  print() {
    this.printByIneorder();
    this.printByPreorder();
  }
}

(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());

  const tree = new BinaryTree();
  lines.forEach(function(cmd) {
    switch (cmd.charAt(0)) {
    case 'i': tree.insert(Number(cmd.split(' ')[1])); break;
    case 'f': console.log(tree.find(Number(cmd.split(' ')[1])) ? 'yes' : 'no'); break;
    case 'd': tree.delete(Number(cmd.split(' ')[1])); break;
    default: tree.print();
    }
  });
})();



Measured memory_bytes: 203588
#include<stdio.h>

#define N 100000

int binarySearch(int,int*,int);

int main(void){
  int S[N];
  int n,q,T,C=0;
  int i;

  scanf(" %d",&n);
  for(i = 0; i < n; i++){
    scanf(" %d",&S[i]);
  }
  scanf(" %d",&q);
  for(i = 0; i < q; i++){
    scanf(" %d",&T);
    C += binarySearch(n,S,T);
  }

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

int binarySearch(int n, int *S, int key){
  int left=0,right=n,mid;
  while(left < right){
    mid = (left + right) /2;
    if(S[mid] == key) return 1;
    else if(S[mid] > key) right = mid;
    else if(S[mid] < key) left = mid +1;
  }
  return 0;
}



Measured memory_bytes: 2156
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  ll N, T;
  cin >> N >> T;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  T /= 2;
  priority_queue<ll, vector<ll>, greater<ll>> Min;
  vector<ll> Mn(N);
  repp(i, 0, N - 2) {
    Min.push(A[i]);
    Mn[i] = Min.top();
  }

  priority_queue<ll> Max;
  vector<ll> Mx(N);
  repr(i, N - 1, 1) {
    Max.push(A[i]);
    Mx[i] = Max.top();
  }

  ll max_prof = 0;
  rep(i, N - 1) {
    chmax(max_prof, Mx[i + 1] - Mn[i]);
  }

  int ans = 0;
  rep(i, N - 1) {
    if (Mx[i + 1] - A[i] == max_prof)
      ans++;
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc149_a() {
	string S, T;
	string ans;

	cin >> S >> T;

	ans = T + S;

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

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

	solve_abc149_a();

	return 0;
}

Measured memory_bytes: 256