akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
#define ALL(x) (x).begin(), (x).end()
#define dll(x) scanf("%I64d",&x)
#define xll(x) printf("%I64d\n",x)
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define eps 1e-6
#define gg(x) getInt(&x)
#define db(x) cout<<"== [ "<<x<<" ] =="<<endl;
using namespace std;
typedef long long ll;
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;}
ll powmod(ll a,ll b,ll MOD){ll ans=1ll;while(b){if(b&1)ans=ans*a%MOD;a=a*a%MOD;b>>=1;}return ans;}
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int main()
{
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\in.txt.txt","r",stdin);
	//    freopen("C:\\Users\\DH_M\\Desktop\\code_io\\out.txt.txt","w",stdout);
	int sx,sy;
	int tx,ty;
	cin>>sx>>sy>>tx>>ty;
	int sc=ty-sy;
	int yc=tx-sx;
	repd(i,1,sc)
	{
		cout<<"U";
	}
	repd(i,1,yc)
	{
		cout<<"R";
	}
	repd(i,1,sc)
	{
		cout<<"D";
	}
	repd(i,1,yc)
	{
		cout<<"L";
	}

	cout<<"L";
	repd(i,0,sc)
	{
		cout<<"U";
	}
	repd(i,0,yc)
	{
		cout<<"R";
	}
	cout<<"D";
	cout<<"R";
	repd(i,0,sc)
	{
		cout<<"D";
	}
	repd(i,0,yc)
	{
		cout<<"L";
	}
	cout<<"U";
    return 0;

}

inline void getInt(int* p) {char ch;do {ch = getchar();} 
while (ch == ' ' || ch == '\n');if (ch == '-') {*p = -(getchar() - '0');
while ((ch = getchar()) >= '0' && ch <= '9') {*p = *p * 10 - ch + '0';}}
else {*p = ch - '0';while ((ch = getchar()) >= '0' && ch <= '9') 
{*p = *p * 10 + ch - '0';}}}

Measured memory_bytes: 256
#import<ios>
int s,i,x,m,n,a,b;
main(){
	for(scanf("%d%d%d",&n,&a,&b);i++<n;){
		x=i;
		m=0;
		while(x)m+=x%10,x/=10;
		if(a<=m&&m<=b)s+=i;
	}
	printf("%d",s);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define tezi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(c) c.begin(),c.end()
#define ll long long
#define ull unsigned long long
#define traverse(c,it) for(auto it=c.begin();it!=c.end();it++)
#define lowerb(v,a) lower_bound(v.begin(),v.end(),a)
#define lowerbarr(v,n,a) lower_bound(v,v+n,a)
#define upperb(v,a) upper_bound(v.begin(),v.end(),a)
#define upperbarr(v,n,a) upper_bound(v,v+n,a)
#define maxval(v) max_element(v.begin(),v.end())
#define maxarr(v,n) max_element(v,v+n)
#define minval(v) min_element(v.begin(),v.end())
#define minarr(v,n) min_element(v,v+n)
#define sz(a) (ll)a.size()
#define f first
#define s second
#define PI 3.1415926536
#define mem0(v) memset(v,0,sizeof(v))
#define memf(v) memset(v,false,sizeof(v))
#define memt(v) memset(v,true,sizeof(v))
#define mem(v,a) memset(v,a,sizeof(v))
#define npos string::npos
#define inf 1e10;
#define MAX 1000000
#define MOD 1000000007
                   /**************SIEVE****************/

/*bool prime[MAX+1];
vector<ll> v;
void sieve(){ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true.
   
    memset(prime, true, sizeof(prime)); 
  
    for (long p=2; p*p<=MAX; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (long i=p*p; i<=MAX; i += p) 
                prime[i] = false; 
        } 
    } 
  for(int i=0;i<=MAX;i++)if(prime[i])v.pb(i);
  
   
    
   
} 
 
                                        /**************gcd****************/

ll gcd(ll a,ll b) 
{ if(a>b)swap(a,b);
    if (a == 0) 
        return b; 
 return gcd(b%a, a); 
}
 
 
 
                                         /**************POWER****************/
 ull binpow(ll a, ll b) {
    if (b == 0)
        return 1;
    ll res = binpow(a, b / 2)%MOD;
    if (b % 2)
        return ((ull)res * (ull)res * (ull)a)%MOD;
    else
        return ((ull)res * (ull)res)%MOD;
}
   

 
 
 
 
                                     /**************MAIn****************/



int main()
{   
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("put.txt","w",stdout);
  #endif
  int T=1;
  //cin>>T;
  while(T--)
  {

    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    bool hasz=0;
    if(a<=0&&b>=0||c<=0&&d>=0)hasz=1;
    ll t=max(a*c,max(a*d,max(b*c,b*d)));
    if(hasz)
    {
      t=max(0ll,t);
    }
    cout<<t;

  }    


  
  
      cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}

    

  
 
    
  

   
 
 
 
 
 
  
 
 



Measured memory_bytes: 3792
#include <iostream>
//#include <iomanip>
//#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
#include <set>
#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	vll a(n) ;
	for(auto &i:a) cin >> i ;
	sort(all(a)) ;
	bool ok = true ;
	for(int i=0;i<n;i++) ok &= (a.at(0)==a.at(i)) ;
	if(ok){
		yorn(a.at(0)==n-1||a.at(0)<=n/2) ;
	}else{
		map<ll,ll> m ;
		for(int i=0;i<n;i++) m[a.at(i)]++ ;
		yorn(a.at(n-1)-a.at(0)==1&&a.at(n-1)>m[a.at(0)]&&(a.at(n-1)-m[a.at(0)])*2<=m[a.at(n-1)]) ;
	}
}


Measured memory_bytes: 10196
import sys

n, t = map(int, input().split())

min_c = 1e4
has_root = False
for i in range(n):
    ci, ti = map(int, input().split())
    if ti > t:
        continue
    if ci < min_c:
        min_c = ci
        has_root = True


if has_root:
    print(min_c)
else:
    print('TLE')

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

int main(void) {
    long long X;
    cin >> X;

    for (long long i = -1000; i < 1000; i++) {
        for (long long j = -1000; j < 1000; j++) {
            if (i*i*i*i*i - j*j*j*j*j == X) {
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }
}

Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <cmath>
#include <complex>
#include <vector>
#include <cstdio>
using namespace std;

typedef complex<double> P;

const double eps = 1.0e-7;
const double pi = acos(-1);

bool equals(double a, double b) { return abs(a-b) < eps; }
bool equals(P a, P b) {
  return equals(a.real(),b.real()) && equals(a.imag(),b.imag());
}

namespace std {
  bool operator < (const P& a, const P& b) {
    if(!equals(a.real(),b.real())) return a.real() < b.real();
    if(!equals(a.imag(),b.imag())) return a.imag() < b.imag();
    return false;
  }
}

P rotate(P p, double rad) {
  return P(cos(rad)*p.real() - sin(rad)*p.imag(),
	   sin(rad)*p.real() + cos(rad)*p.imag());
}

double solve(int N) {
  const static double r2 = 1.0/(2.0*(1.0-cos(pi*2.0/3.0)));
  vector<P> ps;
  vector<P> tri;
  tri.push_back(P(1.0,0.0));
  tri.push_back(rotate(P(1.0,0.0),pi*2.0/3.0));
  tri.push_back(rotate(P(1.0,0.0),-pi*2.0/3.0));
  double d = pi*2.0/(double)N;
  for(int i = 0; i < N; ++i) {
    for(int j = 0; j < tri.size(); ++j) {
      ps.push_back(rotate(tri[j],pi*2.0*i/(double)N));
    }
  }

  sort(ps.begin(), ps.end());
  int n = ps.size();
  for(int i = 1; i < ps.size(); ++i)
    n -= equals(ps[i-1],ps[i]);

  double rad = pi*2.0/(double)n;
  double rad2 = (pi*(n-2)/(double)n - pi/3.0)/2.0;
  double l2 = 2.0 * r2 * (1.0-cos(rad));
  return r2*pi - n*( (rad-sin(rad))*r2/2.0 + tan(rad2)*l2/4.0 );
}

int main() {
  int n;
  while(scanf("%d",&n) != EOF && n) printf("%.6f\n", solve(n));
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,m;
    cin>>n>>m;
    ll arr[m+5]= {0};
    ll brr[m+5]= {0};
    ll ans=0;
    for(int i=0; i<m; i++)
    {
        ll x,y;
        cin>>x>>y;
        arr[i]=x;
        brr[i]=y;
    }
    sort(arr,arr+m);
    sort(brr,brr+m,greater<ll>());
    //cout<<arr[m-1]<<" "<<brr[m-1]<<endl;
    if(brr[m-1]-arr[m-1]+1>0)
    {
        ans=brr[m-1]-arr[m-1]+1;
    }
    else
    {
        ans=0;
    }
    cout<<ans<<endl;
}


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */
signed main() 
{
  int n,m;
  cin>>n>>m;
  int cnt[n]={};
  rep(i,2*m)
  {
    int tmp=in();
    tmp--;
    cnt[tmp]++;
  }
  rep(i,n) print(cnt[i]);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9 + 7;
using ll = long long;
using Graph = vector<vector<int>>;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(),a.end());
    if(a[0] == 0){
        cout << 0 << endl;
        return 0;
    }
    ll res = 1;
    rep(i,n){
        if(a[i] > (ll)1e18 / res ){
            cout << -1 << endl;
            return 0;
        }
        res *= a[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 4036
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int s,w;
    cin>>s>>w;
    if(s<=w) cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}

Measured memory_bytes: 3624
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
input = sys.stdin.readline

setrecursionlimit(1000000)

dp = defaultdict(lambda x:-1)

def main():
	n = int(input())
	l = list(map(int,input().split()))
	l.sort()
	ans = 0
	for mx in reversed(range(1,n)):
		for sc in reversed(range(1,mx)):
			tr_mx = l[mx] - l[sc] + 1
			tr = bisect.bisect_left(l,tr_mx)
			if(sc - tr > 0):
				ans += sc-tr
	print(ans)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]
main()


Measured memory_bytes: 5380
#include<iostream>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)

class Cube{
    public:
    int f[6];
    Cube(){}
    void roll_z(){ roll(1, 2, 4, 3);}
    void roll_y(){ roll(0, 2, 5, 3);}
    void roll_x(){ roll(0, 1, 5, 4);}
    void roll(int i, int j, int k, int l){
        int t=f[i]; f[i]=f[j]; f[j]=f[k]; f[k]=f[l]; f[l]=t; 
    }
};

bool eq(Cube c1, Cube c2){
    rep(i, 6){
        if(c1.f[i]!=c2.f[i]) return false;
    }
    return true;
}

bool equal(Cube c1, Cube c2){
    rep(i, 6){
        rep(j, 4){
            if(eq(c1, c2)) return true;
            c1.roll_z();
        }
        if(i%2==0) c1.roll_y();
        else c1.roll_x();
    }
    return false;
}

int main(){
    Cube c1, c2;

    rep(i, 6) cin>>c1.f[i];
    rep(i, 6) cin>>c2.f[i];

    if(equal(c1, c2)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
using namespace std;
int main() {
        long long int sum=0,n;
        cin >> n;
        for (int i = 1; i <= n; i++) 
                if (!(i % 3 == 0 || i % 5 == 0 || i % 15 == 0)) 
                        sum += i;
        cout << sum << endl;
        return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#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 REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

// aのp乗を求める関数
ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1)*a%MOD;
	}
}


signed main(){
	ll h,w,a,b; cin>>h>>w>>a>>b;
	ll m=max(h-a+b+1,w+a-b-1);
	ll c[m+5]; c[0]=1LL;
	reps(i,m+3){
		c[i]=c[i-1]*i%MOD;
	}
	ll ans=0LL;
	ll i=0LL;
	while(h-a-i>0&&b+i<w){
		// cerr<<h-a-i SP b+i-1 SP a+i SP w-1-b-i<<endl;
		ll tmp=c[h-a+b-1]*mpow(c[h-a-1-i],MOD-2)%MOD*mpow(c[b+i],MOD-2)%MOD;
		tmp*=c[w+a-b-1]%MOD*mpow(c[a+i],MOD-2)%MOD*mpow(c[w-1-b-i],MOD-2)%MOD;
		ans+=tmp; i++; ans%=MOD;
	}
	// cerr<<i<<endl;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1536
# AGC 027: A – Candy Distribution Again
n, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

a.sort()

answer = 0
for i in range(n - 1):
    if x - a[i] < 0:
        break
    answer += 1
    x -= a[i]

if x == a[n - 1]:
    answer += 1

print(answer)

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
long long siguma(int n){
  return (long long)(n*(n+1)/2);
}

int main(){
  int n,ans=0;
  cin >>n;
  rep(i,(n+1)/2)ans=i;


    
  cout<<ans<<endl;
  }

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n;
    char s[150];
    scanf("%d",&n);
    scanf("%s",s);
    int ans=0;
    int i,j;
    for(i=1;i<n;i++)
    {
        int ji[26]={0};
        for(j=0;j<i;j++)
        {
            ji[ s[j]-'a' ]=1;
        }
        int t=0;
        for(j=i;j<n;j++)
        {
            if( ji[ s[j]-'a' ]==1 )
            {
                t++;
                ji[ s[j]-'a' ]=0;
            }
        }
        //printf("%d*",t);
        if(t>ans)
            ans=t;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
  int R[MAX], n;
  
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> R[i];
  }
  
  int maxv = -2000000000;
  int minv = R[0];

  for (int i = 1; i < n; i++) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }
  
  cout << maxv << endl;
  
  return 0;
}

Measured memory_bytes: 1940
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
#include<set>
using namespace std;
int read()
{
	char c=getchar();
	int res=0;
	while(c<'0'||c>'9') c=getchar();
	while(c>='0'&&c<='9') res=(res<<1)+(res<<3)+(c^48),c=getchar();
	return res;
}
int n,m,k,tail,tot,a[2000005],b[2000005],na[2000005],nb[2000005];
char s[2000005],t[2000005];
struct node
{
	int v,pos;
}sta[2000005],tmp[2000005];
int main()
{
	n=read(),m=read(),k=read();
	scanf("%s",s+1);scanf("%s",t+1);
	reverse(s+1,s+n+1);reverse(t+1,t+m+1);
	for(int i=1;i<=n;i++) na[i]=s[i]-'0';
	for(int i=1;i<=m;i++) nb[i]=t[i]-'0';
	int T=max(n,m);
	for(int i=T;i>=1;i--)
	{
		int x=(na[i]<<1)|nb[i],num=k,now=i;
		if(x==3)
		{
			tot=0;
			while(tail)
			{
				if(x==3)
				{
					if(num>=sta[tail].pos-now)
					{
						num-=sta[tail].pos-now;
						now=sta[tail].pos;
						tmp[++tot]=(node){x^sta[tail].v,now};
						x=x&sta[tail].v;
					}
					else break;
				}
				else if(x)
				{
					if(sta[tail].pos==now+1)
					{
						now=sta[tail].pos;
						if(x^sta[tail].v) x=3;
						else x=x&sta[tail].v;
					}
					else break;
				}
				else break;
				tail--;
			}
			if(x!=0&&x!=3)
			{
				now++;
				tmp[++tot]=(node){x,now};
			}
			else if(x)
			{
				now+=num;
				a[now]=b[now]=1;
			}
			for(int i=tot;i>=1;i--) sta[++tail]=tmp[i];
		}
		else if(x) sta[++tail]=(node){x,i};
	}
	for(int i=1;i<=tail;i++)
	{
		int x=sta[i].pos;
		a[x]=sta[i].v>>1;b[x]=sta[i].v&1;
	}
	T=n+k;
	while(!a[T]) T--;
	for(int i=T;i>=1;i--) printf("%d",a[i]);
	puts("");
	T=m+k;
	while(!b[T]) T--;
	for(int i=T;i>=1;i--) printf("%d",b[i]);
}

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

typedef long long ll;

using namespace std;

#define MAX 1000000

int a,d,n;

bool is_prime[MAX+1];
bool is_prime_small[MAX+1];


int main(){
    while(1){
        int ans=0;
        scanf("%d %d %d",&a,&d,&n);
        if(a==0 && d==0 && n==0)break;
        for (int i = 0; i*i <= MAX; i++) is_prime_small[i] = true;
        for (int i = 0; i <= MAX; i++) is_prime[i] = true;

        for(int i= 2; i*i <= MAX ;i++){
            if(is_prime_small[i]){
                for (int j = 2*i; j*j <= MAX ; j+= i) is_prime_small[j] = false;
                for(int j = max(2,(a+i-1)/i)*i;j <= MAX;j+= i)is_prime[j-a] = false;
            }
        }
        int p=0;
        //is_prime[i-a] = true ⇒　iが素数
        for (int i = a; i <= MAX; i+=d){
            if(i==1)continue;
            if(is_prime[i-a]){
                p++;
            }
            if(p==n){
                ans=i;
                break;
            }
        }
        printf("%d\n",ans);


    }
}


Measured memory_bytes: 4068
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner scan = new Scanner(System.in)) {

			int N = scan.nextInt();
			int K = scan.nextInt();

			int[] h = new int[N];
			
			for(int i=0; i<N; i++) {
				h[i] = scan.nextInt();
			}
			
			int[] dp = new int[N];
			
			dp[0] = 0;
			for(int i=1; i<N; i++) {
				dp[i] = Integer.MAX_VALUE;
				for(int j=i-K; j<=i; j++) {
					if(j<0) {
						continue;
					}
					dp[i] = Math.min(dp[i], dp[j]+Math.abs(h[j]-h[i]));
				}
			}
			
			System.out.println(dp[N-1]);

		}
	}
}

Measured memory_bytes: 51404
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
	bool judge = true;
	int N; cin >> N;
	vector<string> w(N);
	for (int i = 0; i < N; i++)cin >> w[i];

	for (int i = 1; i < N; i++) {
		if (w[i - 1][w[i - 1].length() - 1] != w[i][0]) {
			judge = false;
			break;
		}
		else {
			for (int j = 0; j < i; j++) {
				if (w[i] == w[j]) {
					judge = false;
					break;
				}
			}
		}
	}
	cout << (judge ? "Yes" : "No") << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional> // std::function<void(int)>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 111111;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s,t;
    cin>>s;
    deque<char> Q;
    for(auto c:s)Q.push_back(c);
    int res=0;
    while(Q.size()>=2){
        char l,r;
        l=Q.front();
        r=Q.back();
        if(l==r){
            Q.pop_front();
            Q.pop_back();
        }
        else if(l=='x'){
            Q.pop_front();
            res++;
        }
        else if(r=='x'){
            Q.pop_back();
            res++;
        }
        else{
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<res<<endl;
}

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

ll cnt[10000005];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll ans = 0;
    for(ll i = 1; i <= n; ++i){
        for(ll j = i; j <= n; j+=i){
            cnt[j]++;
        }
        ans += i * cnt[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 81732
#include <iostream>

using namespace std;
#define NUM 100

bool A[102];

int main(void){
  for(int i=0;i<102;i++){
    A[i] = true;
  }
 int X,N;
 cin >> X >> N;
 for(int i=0;i<N;i++){
   int tmp;
   cin >> tmp;
   A[tmp] = false;
 }
 if(A[X] == true){
   cout << X << endl;
   return 0;
 }
  int count = 1;
  for(count = 1;;count++){
    if(A[X - count] == true){
      cout << X - count << endl;
      return 0;
    }
    if(A[X + count] == true){
      cout << X + count << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3620
//I AM THE CREED
/* //I AM THE CREED
/* package codechef; // don't place package name! */
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.StringTokenizer; 
import java.util.*;
import java.awt.Point;
public class Main{
    public static void main(String[] args) throws IOException 
    { 
  
        Scanner input = new Scanner(System.in);
        while(input.hasNext()){
            int n=input.nextInt();
            int m=input.nextInt();
            long tot=input.nextLong();
            Long[] l=new Long[n];
            Long[] l1=new Long[m];
            for(int i=0;i<n;i++){
                if(i==0){
                    l[i]=input.nextLong();
                    continue;
                }
                l[i]=input.nextLong()+l[i-1];
            }
            for(int i=0;i<m;i++){
                if(i==0){
                    l1[i]=input.nextLong();
                    continue;
                }
                l1[i]=input.nextLong()+l1[i-1];
            }
            int max=0;
            for(int i=0;i<m;i++){
                if(l1[i]<=tot){
                    max=i+1;
                }
            }
            for(int i=0;i<n;i++){
                long rem=tot-l[i];
                if(rem<0){
                    break;
                }
                int lower=0;
                int upper=m-1;
                while(upper>lower){
                    if(upper==lower+1){
                        if(l1[upper]<=rem){
                            lower=upper;
                            break;
                        }
                        upper=lower;
                        break;
                    }
                    int mid=lower+((upper-lower)/2);
                    if(l1[mid]>rem){
                        upper=mid-1;
                        continue;
                    }
                    lower=mid;
                    
                }
                if(l1[lower]>rem){
                    max=Math.max(max, i+1);
                    continue;
                }
                max=Math.max(max, (i+1)+(lower+1));
            }
            System.out.println(max);
        }
        
    }
    


}

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

int sx,sy,tx,ty;

int main(){
  cin>>sx>>sy>>tx>>ty;
  for(int i=0;i<tx-sx;i++){
    cout<<'R';
  }
  for(int i=0;i<ty-sy;i++){
    cout<<'U';
  }
  cout<<'R';
  for(int i=0;i<ty-sy+1;i++){
    cout<<'D';
  }
  for(int i=0;i<tx-sx+1;i++){
    cout<<'L';
  }
  cout<<'U';


  for(int i=0;i<ty-sy;i++){
    cout<<'U';
  }
  for(int i=0;i<tx-sx;i++){
    cout<<'R';
  }

  cout<<'U';
  for(int i=0;i<tx-sx+1;i++){
    cout<<'L';
  }
  for(int i=0;i<ty-sy+1;i++){
    cout<<'D';
  }
  cout<<'R'<<endl;
  
  return 0;
}


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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;
#define DBG(x) cerr << x << endl;

/*
	http://abc069.contest.atcoder.jp/tasks/arc080_b
*/
int h, w, n;
VI color;
void solve()
{
	VVI ans(h, VI(w));
	for(int i = 0, j = 0, c = 1, d = 0; i < h && c <= n;
	 i += (j == w || j < 0), d ^= (j == w || j < 0), c += (color[c] == 0),
	 j = j < 0 ? 0 : j,  j = j == w ? w - 1 : j)
	{
		if(d == 0) {
			for(; j < w && color[c] > 0; --color[c])
				ans[i][j++] = c;
		}
		else {
			for(; j >= 0 && color[c] > 0; --color[c])
				ans[i][j--] = c;
		}
	}

	REP(i, 0, h) {
		REP(j, 0, w)
			cout << ans[i][j] << " ";
		cout << endl;
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
//	freopen("tmp.out", "w", stderr);
#endif
	cin >> h >> w >> n;

	color.resize(n + 1);
	REPC(i, 1, n) cin >> color[i];

	solve();
	
	return 0;
}

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

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> heights(N);
    for (int i = 0; i < N; i++)
    {
        cin >> heights.at(i);
    }
    sort(heights.begin(), heights.end());
    ll answer = heights.at(K - 1) - heights.at(0);
    for(int i = 1; i < N - K + 1; i++)
    {
        answer = min(answer, heights.at(i + K - 1) - heights.at(i));
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 200;


char st[maxn][maxn];
int num[maxn][maxn];
int flag[maxn], flag2[maxn];

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1; i<=n; i++)
        scanf("%s",st[i]+1);

    for(int i=1; i<=n; i++)
    {
        for(int j=1 ; j<= m; j++)
        {
            if(st[i][j] == '.')
                num[i][j] = num[i][j-1] + 1;
            else
                num[i][j] = num[i][j-1];
        }
        if(num[i][m] == m)
            flag[i] = 1;
    }
    memset(num,0,sizeof(num));

    for(int j=1 ; j<= m; j++)
    {
        for(int i=1; i<=n; i++)

        {
            if(st[i][j] == '.')
                num[j][i] = num[j][i-1] + 1;
            else
                num[j][i] = num[j][i-1];
        }

        if(num[j][n] == n)
            flag2[j] = 1;

    }


    for(int i=1;i<=n;i++)
    {
        if(flag[i] == 1) continue;
        for(int j=1;j<=m;j++)
        {
            if(flag2[j] == 1)
                continue;
            printf("%c",st[i][j]);
        }
        puts("");
    }



}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  string a, b, c;
  cin >> a >> b >> c;
  ll ans = 0;
  rep(i,n){
    if(a[i]==b[i]&&b[i]==c[i]){
      continue;
    }
    else if(a[i]!=b[i]&&b[i]!=c[i]&&c[i]!=a[i]){
      ans += 2;
    }
    else{
      ans++;
    }
  }
  print(ans);
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{


    class Characters
    {

        string alf = "abcdefghijklmnopqrstuvwxyz";
      
       public void CharcterCmpare(int[] data, char[] strT, char[] strH)
       {
            int i;
            int Tindexnum;
            int Hindexnum;
            for(i = 0; i < (strT.Length < strH.Length ? strT.Length : strH.Length); i++)
            {
                Tindexnum = alf.IndexOf(strT[i]);
                Hindexnum = alf.IndexOf(strH[i]);
                
                if(Tindexnum > Hindexnum)
                {                   
                    data[0] += 3;                    
                    break;                  
                }
                else if(Tindexnum < Hindexnum)
                {
                    data[1] += 3;                   
                    break;
                }
                else if(i == strT.Length - 1)
                {
                    data[1] += 3;
                }
                else if(i == strH.Length - 1)
                {
                    data[0] += 3;
                }
               
                
            }

       }


    }
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        char[] strT;
        char[] strH;
       
        int[] result = new int[2] { 0, 0 };

        for(int i = 0; i < n; i++)
        {
            string input = Console.ReadLine();
            var str = input.Split(' ');
            strT = str[0].ToArray();
            strH = str[1].ToArray();

            if(str[0] == str[1])
            {
                result[0] += 1;
                result[1] += 1;              
                continue;
            }
            else
            {
                var p = new Characters();
                p.CharcterCmpare(result, strT, strH);
            }

        }

        Console.WriteLine($"{result[0]} {result[1]}");

    }
}


Measured memory_bytes: 18336
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
using namespace std;
typedef long long ll;

class Edge
{
	public:
	ll cost;
	int from;
	int to;

	Edge(int n,ll c)
	{
		to=n;
		cost=c;
	}

	Edge(int f,int t,ll c)
	{
		from=f;
		to=t;
		cost=c;
	}
};

vector<Edge> g[100010];
int color[100010];

int dfs(int now)
{
	for(int i=0;i<g[now].size();i++)
	{
		Edge e=g[now][i];
		if(color[e.to]!=-1)
			continue;
		
		if(e.cost%2==0)
		{
			color[e.to]=color[now];
			dfs(e.to);
		}else{
			color[e.to]=((color[now]+1)&1);
			dfs(e.to);
		}
	}
	return 0;
}

int main()
{
	int n;
	cin>>n;
	fill(color,color+n+10,-1);
	for(int i=0;i<n-1;i++)
	{
		int u,v;
		ll w;
		cin>>u>>v>>w;
		g[u].push_back(Edge(v,w));
		g[v].push_back(Edge(u,w));
	}
	color[1]=0;
	dfs(1);
	for(int i=1;i<n+1;i++)
		cout<<color[i]<<endl;
	return 0;
}

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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    string s; cin >> s;
    ll r[SIZE(s)] = {0}, l[SIZE(s)]={0}, ans[SIZE(s)]={0}, memo[SIZE(s)]={0};
    ll temp = 0;
    
    // r[0] = 1;
    REP(i,SIZE(s)) {
        if (s[i] == 'R') temp++;
        else {
            r[i-1] = temp;
            temp = 0;
        }
    }

    // REP(i,SIZE(s)) cout << r[i] << " ";
    // cout << "\n";
    
    temp = 0;
    // l[SIZE(s)-1] = 1;
    REPD(i,SIZE(s)) {
        if (s[i] == 'L') temp++;
        else {
            l[i+1] = temp;
            temp = 0;
        }
    }

    // REP(i,SIZE(s)) cout << l[i] << " ";
    // cout << "\n";

    REP(i,SIZE(s)-1) {
        if (s[i] == 'R' && s[i+1] == 'L') {
            ll sum = r[i] + l[i+1];
            if (sum % 2 == 0) {
                ans[i] = sum/2;
                ans[i+1] = sum/2;
            }
            else {
                ans[i] = l[i+1]/2 + r[i]/2 + r[i]%2;
                ans[i+1] = l[i+1]/2 + l[i+1]%2 + r[i]/2;
            }
        }
    }

    REP(i,SIZE(s)) cout << ans[i] << " ";
    cout << "\n";
}


Measured memory_bytes: 3840
#include <iostream>
using namespace std;
int main(void){
    string str;
    cin>>str;
    int i;
    for(i=0;i<str.length();i++){
        char c = str[i];
        string sub = str;sub.erase(sub.begin()+i);
        if(sub.find(c) != -1){
            break;
        }
    }
    if(i != str.size())cout<<"no"<<endl;
    else cout<<"yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/dynamic_bitset.hpp>
namespace adaptor = boost::adaptors;
using index_t = std::size_t;

namespace lib
{
	using graph_t = std::vector<std::set<index_t>>;
	template<class T>using weighted_graph_t = std::vector<std::map<index_t, T>>;

	struct max_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::max(lhs, rhs);
		}
	};
	struct min_t
	{
		template<class T>constexpr T operator()(T const& lhs, T const& rhs)const
		{
			return std::min(lhs, rhs);
		}
	};

	constexpr max_t max;
	constexpr min_t min;

	template<class T>auto order_by(T func)
	{
		return [=](auto&& lhs, auto&& rhs)
		{
			return func(lhs) < func(rhs);
		};
	}

	template<class T>constexpr auto max_v = std::numeric_limits<T>::max();
	template<class T>constexpr auto min_v = std::numeric_limits<T>::min();

	template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
}

void Main()
{
	int a;
	std::cin >> a;
	std::cout << a + a * a + a * a * a << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c; //purvikaurraina
	if(a==b &b!=c)
	{
		cout<<"Yes";
	}
	else if(a==c && a!=b)
	{
		cout<<"Yes";
	}
	else if(b==c && a!=b)
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	return 0;
}

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

int main(){
      ios_base::sync_with_stdio(false);
      cin.tie(0);
      
      int n;
      cin >> n;
      string s;
      cin >> s;
      
      string p = "ABC";
      
    
      int m = p.length();
      int count = 0;
      for(int i=0;i<=n-m;i++){
          int j = 0;
          while(j<m && p[j] == s[i+j]){
              j++;
          }
          if(j == m){
              count++;
          }
      }
      cout<< count<<"\n";
      return 0;
}


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

int main() {
  int a, b, c;
  std::cin >> a >> b >> c;

  if (a < c && c < b) {
    std::cout << "Yes" << std::endl;
  } else if (b < c && c < a) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
  return 0;
}


Measured memory_bytes: 256
W, H, x, y, r = map(int, input().split())
if x < r or y < r or W - x < r or H - y < r:
	print("No")
else:
	print("Yes")

# x - r < 0 or x + r > W
#   print("No")
# x - r > 0 and x + r < W
#   print("Yes")
# y - r < 0 or x + r > H
#   print("No")
# y - r > 0 and y + r < H
#   print("Yes")



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

template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

class modint {
	static constexpr std::int_fast64_t Modulus = 1e9 + 7;
	using u64 = std::int_fast64_t;

public:
	u64 a;
	constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
	constexpr u64& value() noexcept { return a; }
	constexpr const u64& value() const noexcept { return a; }
	constexpr modint operator+(const modint rhs) const noexcept {
		return modint(*this) += rhs;
	}
	constexpr modint operator-(const modint rhs) const noexcept {
		return modint(*this) -= rhs;
	}
	constexpr modint operator*(const ll rhs) const noexcept {
		return modint(*this) *= modint(rhs);
	}
	constexpr modint operator*(const modint rhs) const noexcept {
		return modint(*this) *= rhs;
	}
	constexpr modint& operator+=(const modint rhs) noexcept {
		a += rhs.a;
		if (a >= Modulus) {
			a -= Modulus;
		}
		return *this;
	}
	constexpr modint& operator-=(const modint rhs) noexcept {
		if (a < rhs.a) {
			a += Modulus;
		}
		a -= rhs.a;
		return *this;
	}
	constexpr modint& operator*=(const modint rhs) noexcept {
		a = a * rhs.a % Modulus;
		return *this;
	}
	constexpr operator u64() const { return a; }
};

int main() {
	ll x,y,z,k;
	cin >> x >> y >> z >> k;
	vector<ll> as(x), bs(y), cs(z);
	rep(i, x) cin >> as[i];
	rep(i, y) cin >> bs[i];
	rep(i, z) cin >> cs[i];
	vector<ll> xy;
	rep(i, x) {
		rep(j, y) {
			xy.push_back(as[i] + bs[j]);
		}
	}
	sort(xy.begin(), xy.end(), greater<ll>());
	sort(cs.begin(), cs.end(), greater<ll>());
	vector<ll> ans;
	for (int i = 0; i < min<ll>(xy.size(), k); i++) {
		for (int j = 0; j < min<ll>(cs.size(), k); j++) {
			ans.push_back(xy[i] + cs[j]);
		}
	}
	sort(ans.begin(), ans.end(), greater<ll>());
	rep(i, k) {
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 44116
/*  ***  In The Name of God ... ***  */ 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 1e5 + 10 ;

int n , ar [ N ] ;
vector < int > vc ;
map < int , int > mp ; 

inline void work ( ) {
	for ( int i = 1 ; i <= n ; ++ i )
		vc . push_back ( ar [ i ] ) ;
	sort ( all ( vc ) ) ;
	int ptr = 1 ; 
	for ( int x : vc )
		mp [ x ] = ptr ++ ;
	for ( int i = 1 ; i <= n ; ++ i )
		ar [ i ] = mp [ ar [ i ] ] ; 
}

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for ( int i = 1 ; i <= n ; ++ i )
		cin >> ar [ i ] ;
	work ( ) ;
	vector < int > odd ; 
	for ( int i = 1 ; i <= n ; i += 2 ) {
		odd . push_back ( ar [ i ] ) ; 
	}
	for ( int x : odd )
		cerr << x << ' ' ;
	cerr << '\n' ; 
	int bads = 0 ; 
	for ( int x : odd ) 
		bads += ( x % 2 == 0 ) ;
	cout << bads << '\n' ; 
}


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

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

int threemax(int a, int b, int c) {
	if (a >= b && a >= c) {
		return a;
	}
	else if (b >= a && b >= c) {
		return b;
	}
	else {
		return c;
	}
}

int threemin(int a, int b, int c) {
	if (a <= b && a <= c) {
		return a;
	}
	else if (b <= a && b <= c) {
		return b;
	}
	else {
		return c;
	}
}

void chmaxl(ll &a,ll b){
	if(a<b){
		a=b;
	}
	return;
}

void chminl(ll &a,ll b){
	if(a>b){
		a=b;
	}
	return;
}

void chmaxi(int &a,int b){
	if(a<b){
		a=b;
	}
	return;
}

void chmini(int &a,int b){
	if(a>b){
		a = b;
	}
	return;
}



int main() {
  string S;
  cin >> S;
  if(S.at(0)==S.at(1)&&S.at(1)!=S.at(2)&&S.at(2)==S.at(3)){
    cout << "Yes";
  }
  else if(S.at(0)!=S.at(1)&&S.at(0)==S.at(2)&&S.at(1)==S.at(3)){
    cout << "Yes";
  }
  else if(S.at(0)==S.at(3)&&S.at(1)==S.at(2)&&S.at(0)!=S.at(1)){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#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++)
#define pri(a) cout << a << endl;

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

  ll n,ans=0,k;
  cin >> n >> k;
  //ll n,k,ans=0;
  //cin >> n >> k;
  // stirng s;
  // cin >> s;


  if(n-2*k>0){
      cout << n-2*k << endl;
  }
  else{
    cout << "0" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int cul(int n){
    vector<int> ar(5,0);
    int re = 0;
    rep(i,5){
        ar[i] = n % 10;
        n /= 10;
        re += ar[i];
    }
    return re;
}

int main() {
    int n, a, b; cin >> n >> a >> b;
    int ans = 0;
    repp(i,n+1,1){
        if (a <= cul(i) && cul(i) <= b) ans += i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596