akhauriyash/Code-Regression huggingface dataset:
import numpy as np
MOD = 10 ** 9 + 7

S = [int(x) if x != "?" else -1 for x in input()]
N = len(S)

# 現在考えてる一つ前の桁数で、余りが i になる整数の個数
r = [0]*13

# まず一つ目の値が１の位とする
s = S[0]
if s != -1:
  r[s] = 1
else:
  for i in range(10):
    r[i] = 1

# 桁を進めながら個数をカウント
for i in range(1, N):
    # dp[j]
    # 現在考えている桁(i)を除く、余りが j となる整数の個数
    dp = [0]*26
    # 桁が一つ上がるので、一つ前の余りが 10 倍になる
    for j in range(13):
      dp[j*10%13] += r[j] % MOD
    # アクセスを高速にするため２倍の長さとる (dp[i] == dp[i + 13])
    dp[13:26] = dp[0:13]
    r = [0]*13
    s = S[i]
    if s == -1:
      w = sum(dp[4:14])
      for j in range(13):
        r[j] += w
        w += dp[j+1] -dp[j+4]
    else:
      for j in range(13):
        r[j] += dp[13-s+j]
print(r[5]%MOD)        

Measured memory_bytes: 13768
#include <bits/stdc++.h>
#define re register
#define SIZE 105
using namespace std;
int n,k;
int a[SIZE];
int dp[100005];
int main()
{
	cin>>n>>k;
	for(re int i=1;i<=n;++i)
		cin>>a[i];
	dp[0]=0;
	for(re int j=0;j<=k;++j)
		for(re int i=1;i<=n;++i)
			if(j-a[i]>=0 && dp[j-a[i]]!=1)
				dp[j]=1;
	if(dp[k]==1)
		cout<<"First"<<endl;
	else
		cout<<"Second"<<endl;
	return 0;
} 

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF 2147483647
typedef long long ll;
typedef unsigned long long ull;

//dark power
//#define int ll
//define Error、大抵は、セミコロン忘れとか、Defineは関係ない
/*
vector<int> d(100000);
vector<int> b(100000);
class UnionFind{
	public:
	UnionFind(signed n){rep(i,n){d[i]=i;b[i]=0;}}
	signed find(signed x){
		if(d[x]==x){
			return x;
		}else{
			return d[x]=find(d[x]);
		}
	}
	UnionFind(signed n){rep(i,n){d[i]=i;b[i]=0;}}
	void unite(signed x,signed y){
		x=find(x);
		y=find(y);
		if(x==y)return;
		if(b[x]<b[y]){
			d[x]=y;
		}else{
			d[y]=x;
			if(b[x]==b[y])b[x]++;
		}
	}
	bool same(signed x,signed y){return (find(x)==find(y));}
};
*/
int
digitBinary(int n)
{
    if (n < 100000) {
        if (n < 1000) {
            if (n < 10)
                return 1;
            else if (n < 100)
                return 2;
            else
                return 3;
        } else {
            if (n < 10000)
                return 4;
            else
                return 5;
        }
    } else {
        if (n < 10000000) {
            if (n < 1000000)
                return 6;
            else
                return 7;
        } else {
            if (n < 100000000)
                return 8;
            else if (n < 1000000000)
                return 9;
            else
                return 10;
        }
    }
}
signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int b=0;
	int sum=0;
	rep(i,1,5){
		if((n%(int)round(pow(10,i))-b)==2*(int)round(pow(10,i-1)))sum++;
		b=n%(int)round(pow(10,i));
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
main(){
 long int k,i,n;
  scanf("%ld",&n);
  long long int a[n],b[n],l=0,s=0,m=1000000000+7;
  for(i=0;i<n;i++){scanf("%lld",&a[i]);l=(l+a[i])%m;b[i]=l;}
 for(k=0;k<n;k++){b[n-1]-=a[k];
                  if(b[n-1]<0){
                    b[n-1]+=m;}
                  s+=a[k]*b[n-1];
                  s=s%m;}
  printf("%lld",s);
}

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

int main() {
  int y[2], m[2], d[2];
  int i;
  for (i = 0; i < 2; i++) {
    cin >> y[i] >> m[i] >> d[i];
  }
  int result = max(y[0], y[1]) - min(y[0], y[1]) + 1;
  if (y[0] > y[1]) {
    if (m[0] < m[1]) {
      result--;
    } else if (m[0] == m[1] && d[0] < d[1]) {
      result--;
    }
  } else if (y[0] < y[1]) {
    if (m[0] > m[1]) {
      result--;
    } else if (m[0] == m[1] && d[0] > d[1]) {
      result--;
    }
  } else if (m[0] == m[1] && d[0] == d[1]) {
    result--;
  }
  cout << result << endl;
  return 0;
}



Measured memory_bytes: 3100
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int n,m;cin>>n>>m;
    int ans = 0;
    if (n>=2) ans += n*(n-1)/2;
    if (m>=2) ans += m*(m-1)/2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>



int main(void){

  int N;
  scanf("%d", &N);
  
  int x[N];
  
  long i;
  
  for( i = 0; i < N; i++ ){
    scanf("%d", x+i);
  }
  
  long long ans = 1;
  long mod = 1000000007;
  long num = 0;
  
  for(i = 0; i < N; i++ ){
    if( x[i] < 2*(i-num)+1 ){
      ans *= (i+1-num);
      ans = ans % mod;
      num++;
    }
  }
  
  
  
  for( i = 1; i <= (N-num); i++ ){
    ans *= i;
    ans = ans % mod;
  }
  
  printf("%d\n", ans );
  
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MOD = 1000000007;

int k;
vector<ll> v;

void dfs(int k, ll x){
  v.push_back(x);
  if(k>=9)return;
  int a=x%10;
  if(a){
    dfs(k+1, x*10 + a - 1);
  }
  dfs(k + 1, x * 10 + a);
	if(a<9){
		dfs(k+1, x*10+a+1);
	}
}

int main(){
  cin >> k;
  for(int i=1; i<10; i++){
    dfs(0, i);
  } 
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v[k-1] << endl;
  return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
const lld MAXN = 1e5;

int main()
{
	lld n,k;

	pair<lld,lld> p[MAXN];

	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		lld a,b;
		cin >> a >> b;
		p[i].first = a;
		p[i].second = b;
	}

	sort(p,p+n);
	lld cnt = 0;

	for(int i = 0; i < n; i++)
	{
		cnt += p[i].second;
		if (cnt >= k)
		{
			cout << p[i].first << endl;
			break;
		}
	}

	return 0;
}

Measured memory_bytes: 1792
// D - 756
#include <bits/stdc++.h>
using namespace std;

map<int,int>P{
{ 2,0},{ 3,0},{ 5,0},{ 7,0},{11,0},
{13,0},{17,0},{19,0},{23,0},{29,0},
{31,0},{37,0},{41,0},{43,0},{47,0},
{53,0},{59,0},{61,0},{67,0},{71,0},
{73,0},{79,0},{83,0},{89,0},{97,0},
};

int num(int m){
	m--;
	int c = 0;
	for(auto e:P) if(e.second>=m) c++;
	return c;
}

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

	for(int i=2; i<=N; ++i){
		for(auto e:P){
			int p = e.first;
			for(int n=i; n%p==0; n/=p) P[p]++;
		}
	}

	int ans = num(75);
	ans += num(25) * (num(3)-1);
	ans += num(15) * (num(5)-1);
	ans += num(5) * (num(5)-1) * (num(3)-2)/2;

	cout << ans <<endl;

}

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

typedef long long LL;
#define MAXN 500005
LL ft[MAXN];
int n, q;

//fenwick tree
void add(int i, LL val){
    for(; i<MAXN; i+=i&-i){
        ft[i] += val;
    }
}

LL sum(int i){
    LL ret=0;
    for(; i>0; i-=i&-i){
        ret += ft[i];
    }
    return ret;
}

LL range_sum(int fr, int to){
    return sum(to) - sum(fr-1);
}
//fenwick tree

int main() {
    cin>>n>>q;
    for(int i=1; i<=n; i++){
        LL a;
        cin>>a;
        add(i,a);
    }
    
    while(q--){
        int op,u,v;
        cin>>op>>u>>v;
        u++;
        if(op==0) add(u, v);
        else{
            printf("%lld\n", range_sum(u, v));
        }
    }
    return 0;
}


Measured memory_bytes: 8256
#include<stdio.h>
#define swap(a,b)({a ^= b; b ^= a; a ^= b;})
int main(){
    int n, i, j, a[101], count, mini;

    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    count=0;
    for(i = 0; i<n; i++){
        mini = i;
        for(j=i+1;j<n;j++){
            if(a[j] < a[mini]) mini = j;
        }
        if(i != mini){
            count++;
            swap(a[i], a[mini]);
        }
    }
    for(i=0;i<n-1;i++)printf("%d ", a[i]);printf("%d\n", a[i]);
    printf("%d\n", count);

return 0;
}



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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  map<char, char>m;
  m['D'] = 'A';
  m['E'] = 'B';
  m['F'] = 'C';
  m['G'] = 'D';
  m['H'] = 'E';
  m['I'] = 'F';
  m['J'] = 'G';
  m['K'] = 'H';
  m['L'] = 'I';
  m['M'] = 'J';
  m['N'] = 'K';
  m['O'] = 'L';
  m['P'] = 'M';
  m['Q'] = 'N';
  m['R'] = 'O';
  m['S'] = 'P';
  m['T'] = 'Q';
  m['U'] = 'R';
  m['V'] = 'S';
  m['W'] = 'T';
  m['X'] = 'U';
  m['Y'] = 'V';
  m['Z'] = 'W';
  m['A'] = 'X';
  m['B'] = 'Y';
  m['C'] = 'Z';

  char str[1024];
  while(~scanf("%s", str)){
    rep(i, strlen(str)) str[i] = m[str[i]];
    puts(str);
  }
  return 0;
}

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

int main(){
  int x,n;
  cin >> x>>n;
  vector<bool> v(101,false);
  rep(i,n){
    int num;
    cin >> num;
    v[num] = true;
  }
  rep(i,100){
    if(x-i<=0){
      cout << 0 << endl;
      return 0;
    }
    if(v[x-i]==false){
      cout << x-i << endl;
      return 0;
    }
    if(x+i>=101){
      cout << 101 << endl;
      return 0;
    }
    if(v[x+i]==false){
      cout << x+i << endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

signed main() {
	ll x, y;

	cin >> x >> y;

	cout << x + y / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(), (x).end()

void Main()
{
    string s;
    cin >> s;

    int a = 0, b = 0;
    rep(i, s.size())
    {
        if (s[i] == 'A')
        {
            a = i;
            break;
        }
    }

    rep(i, s.size())
    {
        if (s[s.size() - i - 1] == 'Z')
        {
            b = s.size() - i - 1;
            break;
        }
    }

    cout << b - a + 1 << endl;

    return;
}

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


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
const int MAXK = 2005;

int K;
int h[2][MAXK][MAXK];
int v[2][MAXK][MAXK];
int sq[2][MAXK][MAXK];
int w[MAXK][MAXK];
int b[MAXK][MAXK];

int get_h(int i, int j, int c)
{
    i = (i + 8*K)%(2*K);
    j = (j + 8*K)%(2*K);
    int rc = (j + K-1)%(2*K);
    int lc = (j + 2*K-1)%(2*K);
    if (rc > lc)
        return h[c][i][rc] - h[c][i][lc];
    return h[c][i][rc] + (h[c][i][2*K-1] - h[c][i][lc]);
}

int get_v(int i, int j, int c)
{
    i = (i + 8*K)%(2*K);
    j = (j + 8*K)%(2*K);
    int rr = (i + K-1)%(2*K);
    int lr = (i + 2*K-1)%(2*K);
    if (rr > lr)
        return v[c][rr][j] - v[c][lr][j];
    return v[c][rr][j] + (v[c][2*K-1][j] - v[c][lr][j]);
}

int main()
{
	//freopen(".in", "r", stdin);
    int N;
    cin >> N >> K;

    for (int i = 0; i < N; i++)
    {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if (c == 'W')
            w[x % (2 * K)][y % (2 * K)]++;
        else
            b[x % (2 * K)][y % (2 * K)]++;
    }

    for (int i = 0; i < 2 * K; i++)
    {
        h[0][i][0] = w[i][0];
        h[1][i][0] = b[i][0];
        v[0][0][i] = w[0][i];
        v[1][0][i] = b[0][i];
        for (int j = 1; j < 2 * K; j++)
        {
            h[0][i][j] = h[0][i][j-1] + w[i][j];
            h[1][i][j] = h[1][i][j-1] + b[i][j];
            v[0][j][i] = v[0][j-1][i] + w[j][i];
            v[1][j][i] = v[1][j-1][i] + b[j][i];
        }
    }

    for (int i = 0; i < 2 * K; i++)
    {
        if (i == 0)
        {
            for (int q = 0; q < K; q++)
            {
                sq[0][0][0] += get_h(q,0,0);
                sq[1][0][0] += get_h(q,0,1);
            }
        }
        else
        {
            for (int c = 0; c < 2; c++)
                sq[c][i][0] = sq[c][i-1][0] +
                              get_h(i+K-1, 0, c) -
                              get_h(i-1, 0, c);
        }

        for (int j = 1; j < 2 * K; j++)
        {
            for (int c = 0; c < 2; c++)
                sq[c][i][j] = sq[c][i][j-1] +
                              get_v(i, j+K-1, c) -
                              get_v(i, j-1, c);
        }

    }

    int ans = 0;
    for (int i = 0; i < 2 * K; i++)
    {
        for (int j = 0; j < 2 * K; j++)
        {
            int res = sq[0][i][j] + sq[0][(i+K)%(2*K)][(j+K)%(2*K)] +
                  sq[1][i][(j+K)%(2*K)] + sq[1][(i+K)%(2*K)][j];

            ans = max(ans, res);
        }
    }

    cout << ans;
	return 0;
}



Measured memory_bytes: 125824
#include <stdio.h>
int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 1812
import java.util.*;
public class Main
{
	public static void main(String[] args) {
	    Scanner s = new Scanner(System.in);
	    int x=s.nextInt();
	    int y=s.nextInt();
	    int z=s.nextInt();
	    
	    int t=y;
	    y=x;
	    x=z;
	    z=t;
	    System.out.println(x);
	    System.out.println(y);
	    System.out.println(z);
	}
}


Measured memory_bytes: 23764
import sys
# import pdb
input = sys.stdin.readline

N = int(input())
hs = list(map(int, input().split()))

dp_list = [-1 for _ in range(N)]
dp_list[0] = 0
dp_list[1] = abs(hs[1] - hs[0])

sys.setrecursionlimit(1000000)
def dp_memo(p):
  if dp_list[p] != -1:
    return dp_list[p]

  result = min(dp_memo(p-1) + abs(hs[p] - hs[p-1]), dp_memo(p-2) + abs(hs[p] - hs[p-2]))
  dp_list[p] = result
  return result


def dp_recur():
  cost1 = 0
  cost2 = abs(hs[1] - hs[0])

  if N == 2:
    print(cost2)
    exit()
  # pdb.set_trace()
  for i in range(2, N):
    cost3 = min(cost2 + abs(hs[i] - hs[i-1]), cost1 + abs(hs[i] - hs[i-2]))
    cost1 = cost2
    cost2 = cost3
  return cost3

# print(dp_recur())
print(dp_memo(N-1))


Measured memory_bytes: 120352
#include <iostream>

using namespace std;

int main()
{
    int A , B , C , result;
    int max_ , min_;
    cin>>A>>B>>C;

    if(A > B)
    {
        max_ = A ;
        min_ = B;
    }
    else
    {
        max_ = B;
        min_ = A;
    }
    if(C <= max_ && C >= min_)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}


Measured memory_bytes: 256
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    k = int(input())
    a, b = map(int, input().split())
    for i in range(a, b + 1):
        if i % k == 0:
            print('OK')
            exit()
    print('NG')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Measured memory_bytes: 61904
#include <bits/stdc++.h>
using namespace std;
int main() {
  bool b = true;
  string S, T;
  cin >> S >> T;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) != T.at(i)) {
      b = false;
      break;
    }
  }
  if (b) {cout << "Yes" << endl;}
  else {cout << "No" << endl;}
}

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

int main(){
	string s; cin >> s;
	if(s[0] == s[2]) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 256
package main

import (
        "fmt"
)

func solution(n, k int, x []int) int {
        sum := 0
        for i := 0; i < n; i++ {
                a := x[i] * 2
                b := abs(k, x[i]) * 2
                sum += min(a, b)
        }
        return sum
}

func abs(x, y int) int {
        if x > y {
                return x - y
        }
        return y - x
}

func min(x, y int) int {
        if x < y {
                return x
        }
        return y
}

func main() {
        var n, k int
        fmt.Scan(&n, &k)

        x := make([]int, n)

        for i := range x {
                t := 0
                fmt.Scan(&t)
                x[i] = t
        }
        fmt.Println(solution(n, k, x))
}

Measured memory_bytes: 512
(let ((n (read))
      (s (read-line)))
  (format t "~a~%"
   (loop for i from 0 below (- n 2)
         count (and (char= #\A (char s i))
                    (char= #\B (char s (+ i 1)))
                    (char= #\C (char s (+ i 2)))))))


Measured memory_bytes: 13152
// https://atcoder.jp/contests/abc120/tasks/abc120_b

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main() {
    int cnt = 0, pos;
    bool flag = true;
    string s;
    cin >> s;

    int i = 0;
    while (i < s.size() - 1 && s.size() >= 2) {
        // [0, 1]か[1, 0]のデータを見つけたら削除して、前に戻る
        if (s[i] != s[i + 1]) {
            s.erase(s.begin() + i, s.begin() + i + 2);
            cnt += 2;
            if (i > 0)
                i--;
        } else {
            i++;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 512
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    ret = 0
    for a in A:
        while a % 2 == 0:
            a //= 2
            ret += 1
    print(ret)




if __name__ == '__main__':
    main()


Measured memory_bytes: 11004
function abmp(a,b,p)
	if b == 0
		1
	elseif b%2 == 0
		k = abmp(a,div(b,2),p)
		(k*k)%p
	else
		(a*abmp(a,b-1,p))%p
	end
end

function combi(n,p)
	z = 1
	for i in 1:n
		z = z*i%p
	end
	fac = Array{Int}(n+1)
	inv = Array{Int}(n+1)
	inv[n+1] = abmp(z,p-2,p)
	for i in 0:n-1
		inv[n-i] = (inv[n+1-i]*(n-i))%p
	end
	for i in 0:n
		fac[i+1] = (((z*inv[i+1])%p)*inv[n+1-i])%p
	end
	fac
end


function main()
	n,a,b,k = map(x->parse(Int,x), split(readline()))
	count = 0
	factmat = combi(n,998244353)
	for i in 0:n
		if (k-i*a)%b==0
			j = div(k-i*a,b)
			if i+j <= 2*n && 0<= i <=n && 0<= j <= n
				count += (factmat[i+1]*factmat[j+1])%998244353
			end
		end
	end
	print(count%998244353)
end

main()


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

int main(){
  int a,b;
  cin>>a>>b;
  
  if(a<=b){
    for(int i=0;i<b;i++){cout<<a;}
  }else{
    for(int i=0;i<a;i++){cout<<b;}
  }
  cout<<endl;
}

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

using namespace std;

int F[100][5*2];
int P[100][10+1];

int main(){
    int N; cin >> N;
    for(int i=0;i<N;i++){
        for(int j=0;j<5;j++){
            for(int k=0;k<2;k++){
                cin >> F[i][2*j+k];
            }
        }
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<=10;j++){
            cin >> P[i][j];
        }
    }

    int ans = -2e9;
    for(int i=1;i<(1<<10);i++){ // for all 2^10 paterns
        // open or close
        vector<int> cnt(N,0);
        for(int id=0;id<10;id++){ // loop for time table
            if((i>>id)&1){
                for(int l=0;l<N;l++){
                    if(F[l][id] == 1) cnt[l]++;
                }
            }
        }
        int sale = 0;
        for(int l=0;l<N;l++){
            sale += P[l][cnt[l]];
        }
        ans = max(ans, sale);
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
//#include <bits/stdc++.h>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <complex>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)


void solve(long long N, std::vector<long long> a){
  long long b=0;
  REP(i,N)b^=a[i];
  REP(i,N)cout<<(a[i]^b)<<(i==N-1?"\n":" ");
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long> a(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&a[i]);
  }
  solve(N, std::move(a));
  return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static int n;
        static List<long> a;
        
        static void Main(string[] args)
        {
            //[summary]C - Sequence
            n = int.Parse(Console.ReadLine());
            a = ReadLine();

            //偶数のインデックスを1にするケース
            long count1 = CountOperations(0);

            //奇数のインデックスを1にするケース
            long count2 = CountOperations(1);

            if (count1 < count2)
            {
                Console.WriteLine(count1);
            }
            else
            {
                Console.WriteLine(count2);
            }
        }

        static long CountOperations(int mod)
        {
            var b = GetNewNumbers(mod);
            long count = 0;

            for (int i = 0; i < n; i++)
            {
                count += Math.Abs(a[i] - b[i]);
            }

            return count;
        }

        static List<long> GetNewNumbers(int mod)
        {
            var b = new List<long>(a);
            long sum = 0;

            for (int i = 0; i < n; i++)
            {
                if (i % 2 == mod)
                {
                    //i項までの和をプラスに
                    if (sum + b[i] <= 0)
                    {
                        //i項までの和を1にする
                        b[i] += Math.Abs(sum + b[i]) + 1;
                    }
                }
                else
                {
                    //i項までの和をマイナスに
                    if (sum + b[i] >= 0)
                    {
                        //i項までの和を-1にする
                        b[i] -= (Math.Abs(sum + b[i]) + 1);
                    }
                }

                sum += b[i];
            }

            return b;
        }

        static List<long> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => long.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 30044
#include<bits/stdc++.h>
      using namespace std;
      #define ll long long
      #define pb push_back
      #define pll  pair <long long,long long>
      #define mp make_pair
      #define ss second
      #define ff first
      #define maa 1000000007
      #define endl '\n'
      #define ld long double
      #define all(x) x.begin(),x.end()
      ll  power(ll  i,ll  j)
      {
        if(j==0)
        return 1 ;
        ll t=power(i,j/2)%maa ;
        if(j%2==0)
        return (t%maa*t%maa)%maa ;
        else
        return ((t%maa*t%maa)%maa*(i%maa)%maa)%maa ;
      }
      bool is(ll  i)
      {
        if(i==1)
            return 0 ;
        ll  f=0 ;
        for(ll  j=2;j<=sqrt(i);j++)
        {
            if(i%j==0)
            {
                f=1 ;
                break ;
            }
        }
        return !f ;
      }
      int main()
      {

        /// 50-4
        /// freopen("input.txt","r",stdin);
        /// freopen("output.txt","w",stdout);
        ll n,m ;
        cin>>n>>m ;
        ll dp[n+1] ;
        for(ll i=0;i<=n;i++)
        dp[i]=-1 ;
        
        ll in[n+1] ;
        memset(in,0,sizeof(in)) ;
        vector<ll>v[n+1]  ;
        for(ll i=0;i<m;i++)
        {
            ll a,b ;
            cin>>a>>b ;
            v[b].pb(a) ;
            in[a]++ ;
        }
        for(ll i=1;i<=n;i++)
        {
            if(dp[i]!=-1||in[i]>0)
            continue ;
            
            dp[i]=0 ;
            queue<int>q ;
            q.push(i) ;
            while(!q.empty())
            {
                ll x=q.front() ;
                q.pop() ;
                for(ll j:v[x])
                {
                    dp[j]=max(dp[j],dp[x]+1) ;
                    in[j]-- ;
                    if(in[j]==0)
                    q.push(j) ;
                }
            }
            
        }
        ll ans=0 ;
        for(ll i:dp)
        ans=max(ans,i) ;
        
        cout<<ans ;
        
        
      }








Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define rep(i,q) for(int i = 0; q > i; i++)
bool top_end = false;
int main(void){
  int n,k;
  int sum = 0;
  cin >> n >> k;
  if (k * 2 > n){
    top_end = true;
  }
  int l[n];
  rep(i,n){
    cin >> l[i];
    sum += l[i];
  }
  sort(l,l+n);
  if(top_end){
    rep(i,n-k){
      sum -= l[i];
    }
  } else {
    sum = 0;
    rep(i,k){
      sum += l[n - i - 1];
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'||ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();}
	return f;
}
char s[200005];int v[30];
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	long long ans=1LL*n*(n-1)/2;
	for(int j=1;j<=n;j++)
	{
		v[s[j]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		ans-=1LL*v[i]*(v[i]-1)/2;
	}
	cout<<ans+1;
}


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

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

  int k,n; cin >> k >> n;
  int before = 0;
  int maxa = 0;
  int first;
  rep(i, n) {
    int a; cin >> a;
    if(i == 0) first = a;
    maxa = max(maxa, a - before);
    before = a;
  }

  maxa = max(maxa, abs(k + first - before));

  cout << k - maxa << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
bool cmp(pair<long long int ,long long int  > a , pair<long long int ,long long int  > b){
	return a.x > b.x || ((a.x == b.x )&&(a.y>b.y));
}

int main(){
	long long int  n,m,v,p;
	cin >> n >> m >> v >> p;
	long long int  a[n];
	for(long long int  i =0;i<n;i++){
		cin >> a[i];
	}
	long long int  ans = 0;
	sort(a,a+n);
	reverse(a,a+n);	
	auto ok = [&](long long int  mid){
		if(mid<p) return true;
		if(a[mid]+m<a[p-1]) return false;

		long long int tot = 0;
		
		for(int i =n-1;i>=mid;i--)
			tot+=m;
		for(int i =0;i<p-1;i++)
			tot+=m;

		for(int i = p-1;i<mid;i++)
			tot+=(m+a[mid]-a[i]);

		return tot>=m*v;
	};

	long long int  lo = 0,hi = n-1;
	while(lo<=hi){
		long long int  mi = (lo+hi)/2;
		if(ok(mi))lo=mi+1;
		else hi = mi-1;
	}
	ans = hi+1;
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
using namespace std;
#define scii(x, y)     int x, y;    scanf("%d%d", &x, &y);
int main() {
  scii(N,K)scii(X,Y)
  int sum=0;
  for(int i=1;i<=N;i++){
    if(i>K) sum+=Y;
    else sum+=X;
  }
  printf("%d\n",sum);
}

Measured memory_bytes: 256
import itertools

N,M=map(int,input().split())
link = [set() for _ in range(N+1)]
for _ in range(M):
    a,b = map(int,input().split())
    link[a].add(b)
    link[b].add(a)
sqs = itertools.permutations(range(2,N+1))
ans = 0
for sq in sqs:
    v = 1
    success = 1
    for w in sq:
        if w in link[v]:
            v = w
        else:
            success = 0
            break
    ans += success
print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define up(j,k,i) for(i=j;i<k;i++)
#define down(j,k,i) for(i=j;i>k;i--)
#define ipp(n) printf("%d\n",n)
#define pp(n) printf("%lld\n",n)
#define pps(n) printf("%lld ",n)
#define ipps(n) printf("%d ",n)
#define all(x) x.begin(),x.end()
#define ps(s) printf("%s",s)
#define is(n) scanf("%lld",&n)
#define iis(n) scanf("%d",&n)
#define ips(n) scanf("%lld",n)
#define ss(s) scanf("%s",s)
#define cool 0
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define f(i) cout<<i<<endl;
#define pll pair<lld,lld> 
#define pi acos(-1)
#ifdef G
#define dg(x) cout<<#x<<' '<<x<<endl;
#define dg2(x,y) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<endl;
#define dg3(x,y,z) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<endl;
#define dg4(x,y,z,zz) cout<<#x<<' '<<x<<' '<<#y<<' '<<y<<' '<<#z<<' '<<z<<' '<<#zz<<' '<<zz<<endl;
#else
#define dg(x) ;
#define dg2(x,y) ;
#define dg3(x,y,z) ;
#define dg4(x,y,z,zz) ;
#endif
#define ds(n,m) scanf("%lld %lld",&n,&m)
#define ids(n,m) scanf("%d %d",&n,&m)
#define ts(n,m,k) scanf("%lld %lld %lld",&n,&m,&k)
#define its(n,m,k) scanf("%d %d %d",&n,&m,&k)
#define yes printf("YES\n")
#define no printf("NO\n")
#define isset(num,i) ((num&(1LL<<i))!=0)
typedef long double ld;
typedef long long int lld;
using namespace std;
const lld M =2e5+10;
const lld mod=1e9+7;
const lld infi =LLONG_MAX;
lld ans,k,n,x,y,m,mymax=LLONG_MIN,mymin=LLONG_MAX,b,c,z,sum;
vector<lld> v[M];
int main()
{
    lld i,j;
    ds(n,m);
    string s,t;
    cin>>s>>t;
    if(s[0]!=t[0])
    {
    	ps("-1\n");
    	return 0;
    }
    lld l=__gcd(n,m);
    l=(n*m)/l;
   	up(1,m,i){
   		if((i*n)%m==0)
   		{
   			x=(i*n)/m;
   			if(t[i]!=s[x]){
   				//dg2(i,x);
   				ps("-1\n");
   				return 0;
   			}
   		}
   	}
   	pp(l);
    return 0;
}

Measured memory_bytes: 5500
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int arr[] = new int[N];

        for (int i = 0; i < N; i++) {
           arr[i] = sc.nextInt();
        }

        int max = arr[0];
        int maxLength = arr[0];
        
        for (int i = 1; i < N; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }

            maxLength += arr[i];
        }

        if (max >= maxLength - max) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }

     }
}

Measured memory_bytes: 23380
/*
    ( ´-ω･)︻┻┳══━一一一一一一一				(× _ ×)
	
	Stay Low. Go Fast
	Kill First. Die Last
	One Shot. One Kill
	No Luck. Pure Skill 
*/

#include<bits/stdc++.h>
using namespace std;

/*************************** MACROS **************************/
#define ld long double
#define ll long long  
#define ull unsigned long long
#define loop(i,x,y) for(ll i=x;i<y;i++)
#define rloop(i,x,y) for(ll i=x;i>=y;i--)
#define vll vector<ll>
#define pb push_back
#define S second
#define F first
#define B begin()
#define E end()
#define W(x) while(x--)
#define pll pair< ll,ll >
#define vpll vector< pll >
#define qll queue<ll>
#define dqll deque<ll>
#define qpll queue<pll>
#define dqpll deque<pll>
#define pqll priority_queue<ll>
#define pqpll priority_queue<pll>
#define Line cout<<"\n**************************\n\n";

/*************************** CONST ******************************/

const ll MOD = 1000000007;
const ll MOD1 = 998244353;
const ll MIN_LL = -1e18;
const ll MAX_LL = 1e18;
const int MAX_INT = 1e9;
const int MIN_INT = -1e9;
const ld pie = 3.1415926535;
 
/************************** POW UTIL *****************************/
 
ll fpow(ll n,ll p){;ll m=1;while(p){if(p%2)m*=n;p>>=1;n*=n;}return m;}
ll mfpow(ll n,ll p,ll M){ll m=1;n%=M;while(p){if(p%2)m=(m*n)%M;n=(n*n)%M;p>>=1;}return m%M;}
 
/************************* PRINT UTIL *****************************/

template<class T> inline ostream& operator<<(ostream& o,vector<T> v){for(auto i:v)o<<i<<" ";return o;};
template<class T> inline ostream& operator<<(ostream& o,set<T> s){for(auto i:s)o<<i<<" ";return o;}
template<class T> inline ostream& operator<<(ostream& o,multiset<T> s){for(auto i:s)cout<<i<<" ";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,pair<T1,T2> p){o<<p.F<<" "<<p.S<<"\n";return o;}
template<class T1,class T2> inline ostream& operator<<(ostream& o,map<T1,T2> m){for(auto p:m)o<<p.F<<" "<<p.S<<"\n";return o;}

/*************************** VARIABLES **************************/

const vll days={31,28,31,30,31,30,31,31,30,31,30,31};
 
bool br,br1,br2; 
char ch,ch1,ch2;
 

ll n,m,k,x,y,z,mini,maxi,l,r,sum,t,w;
pll p,p1,p2;

string s,s1,s2;

set<ll> st,st1,st2;
multiset<ll> mst; 

map<ll,ll> mp;

/**************************** FXNS ****************************/

void solve()
{

	cin>>x;

	cout<<x+x*x+x*x*x<<endl;

}
 
/*************************** MAIN ****************************/
 
int main(){
 
 
	// #ifndef ONLINE_JUDGE
	        // freopen("input.txt", "rt", stdin);
	        // freopen("output.txt", "wt", stdout);
	// #endif
 
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);

	solve();
 
	return 0;
}


Measured memory_bytes: 3616
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect


from math import factorial
# 組み合わせ
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    x, k = map(int, input().split())

    for i in range(k - x + 1, k + x):
        print(i, end='')
        if i == k + x - 1:
            print()
        else:
            print(' ',end='')




if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import java.util.HashMap;
import java.util.Scanner;

class Main{


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力

		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] k = new int[n];
		
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
		
		for(int i = 0;i < n;i++){
			k[i] = sc.nextInt();
			for(int j = 0;j < k[i];j++){
				int num = sc.nextInt();
				int sum = map.getOrDefault(num, 0);
				map.put(num,sum + 1);
			}
		}
		int ans = 0;
		for(int num:map.values()){
			if(num == n){
				ans++;
			}
		}
		System.out.println(ans);
		
	}
}



Measured memory_bytes: 24020
#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>

#define M 1000000007

using namespace std;

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

  int l = 0;
  int r = s.size()-1;
  int n = 0;
  while(l < r){
    if(s[l] != s[r]){
      if(s[l] == 'x'){
	l++;
	n++;
      }else if(s[r] == 'x'){
	r--;
	n++;
      }else{
	n = -1;
	break;
      }
    }else{
      l++;
      r--;
    }
  }

  cout << n << endl;
  
  return 0;
}


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

int main() {
  int A;
  cin >> A;
  char O;
  cin >> O;
  int B;
  cin >> B;
  
  if (O == '+')
  {
    cout << A + B;
  }
  else if (O == '-')
  {
    cout << A -B;
  }
  else if (O == '*')
  {
    cout << A * B;
  }
  else if (O == '/')
  {
    cout << A / B;
  }
}
 

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

using namespace std;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	
	string s;
	cin >> s;

	int c = 0;
	if (s[0] == 'o')c++;
	if (s[1] == 'o')c++;
	if (s[2] == 'o')c++;

	cout << 700 + (c * 100) << "\n";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  string S; cin >> S;
  int count = 0;
  for(int i = 0; i < N - 2; i++) {
    if(S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') {
      count++;
    }
  }
  cout << count << endl;
}

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

int main(){
  int N;
  cin >> N;
  vector<vector<int>> G(N,vector<int>(0));
  for(int i=0; i<N-1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  vector<int> dist_F(N,-1);
  vector<int> dist_S(N,-1);
  
  queue<int> Q;
  Q.push(0);
  dist_F.at(0) = 0;
  while(Q.size()){
    int x = Q.front();
    Q.pop();
    for(int i=0; i<G.at(x).size(); i++){
      int y = G.at(x).at(i);
      if(dist_F.at(y) == -1){
        dist_F.at(y) = dist_F.at(x)+1;
        Q.push(y);
      }
    }
  }
  
  Q.push(N-1);
  dist_S.at(N-1) = 0;
  while(Q.size()){
    int x = Q.front();
    Q.pop();
    for(int i=0; i<G.at(x).size(); i++){
      int y = G.at(x).at(i);
      if(dist_S.at(y) == -1){
        dist_S.at(y) = dist_S.at(x)+1;
        Q.push(y);
      }
    }
  }
  
  int cnt = 0;
  for(int i=0; i<N; i++){
    //cout << dist_F.at(i) << " " << dist_S.at(i) << endl;
    if(dist_F.at(i) <= dist_S.at(i)){
      cnt++;
    }
  }
  if(N - cnt < cnt){
    cout << "Fennec" << endl;
  }
  else{
    cout << "Snuke" << endl;
  }
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,c) memset(a,c,sizeof(a))

#define DEBUG(x) cout<<"#x"<<": "<<x<<endl

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = INT_MAX/3;
const ll MOD = 1000000007;
const double EPS = 1e-14;
const int dx[] = {1,0,-1,0} , dy[] = {0,1,0,-1};

int main(){
    while(true){
	int n;
	cin >> n;
	if(n==0) break;
	bool flg = false;
	vl v(n);
	REP(i,n) cin >> v[i];
	v.PB(20000000000000000);
	vector< string > ans;
	int h = v[0];
	int t = v[0];
	FOR(i,1,n+1){
	    if(v[i] - t == 1){
		t = v[i];
	    }else{
		if(h == t)
		    ans.PB(to_string(h));
		else
		    ans.PB(to_string(h) + "-" + to_string(t));
		h = v[i];
		t = v[i];
	    }
	}
	cout << ans[0];
	FOR(i,1,ans.size()){
	    cout << " " << ans[i];
	}
	printf("\n");
    }

    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
string s,t;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N >> s >> t;
}

int solve(){
    int ans=N;
    for (int i = 0; i < N; i++)
    {
        bool ok=true;
        for (int j = 0; j < N-i; j++)
        {
            if(s[i+j]!=t[j]) ok=false;
        }
        if(ok) {
            ans=i;
            break;
            }       
    }
    cout << ans+N << endl;
    

    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
const int N=2e5+5;
using namespace std;
template<typename tp>inline void r(tp &n){
	n=0;char c=getchar();
	while(!isdigit(c)) c=getchar();
	while( isdigit(c)) n=n*10+c-48,c=getchar();	
}
char s[N]; 
int main(){
	
	int n,ans=0;r(n);
	scanf("%s",s+1);
	queue<int>v;
	for(int i=1;i<=n;++i)	
		if(s[i]=='W') v.push(i);
	for(int i=n;i>=1;--i){
		if(!v.size()) break; 
		if(s[i]=='R') if(v.front()>i) break;
		else ++ans,v.pop();
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4784
K,N = map(int,input().split())
A = list(map(int,input().split()))

A.sort()
B=[]
for i in range(N-1):
    B.append(A[i+1]-A[i])
B.append((K-A[N-1])+A[0])

D = max(B)
print(K-D)

Measured memory_bytes: 86732
#include<stdio.h>

int main(){
  int a;
  int b;
  scanf("%d %d",&a,&b);
  if(a>b){
    printf("a > b\n");
  }else if(a<b){
    printf("a < b\n");
  }else{
    printf("a == b\n");
  }
}



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

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main() {
    int N; cin >> N;
    vector<ll> A(N); for (int i = 0; i < N; i++) cin >> A[i];

    for (int i = 1; i < N; i++){
        A[i] = GCD( A[i-1], A[i]);
    }

    cout << A[N - 1] << endl;
}

Measured memory_bytes: 1024
require 'pp'

x, y = gets.split.map(&:to_i)

0.upto(100) do |i|
    0.upto(100) do |j|
        next if i + j != x 

        if i * 2 + j * 4 == y
            puts "Yes"
            exit 0
        end
    end
end

puts "No"


Measured memory_bytes: 14652