akhauriyash/Code-Regression huggingface dataset:
/**
       ????????????    ????????????
		Author : Avi J Patel
		University : DA-IICT
       ????????????    ????????????
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair 
#define mt make_tuple
#define N 100000
#define ff first
#define ss second
#define si size()
#define MOD 1000000007
#define large 10000000000000001
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));

int main()
 {
	int x,a;
	cin>>x>>a;
	if(x<a)
	cout<<0;
	else
	cout<<10;
	return 0;
}








Measured memory_bytes: 256
a,b,c,d=[int(i) for i in input().split()]
x=0
while(a>0 and c>0):
    if(x):
        a=a-d
    else:
        c=c-b
    # print(b,d)
    x=not x
if(a<=0):
    print('No')
else:
    print('Yes')

Measured memory_bytes: 9180
#include<stdio.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i = 0;i < n;i++)
#define PRN(n) printf("%d\n",n)
#define PRS(s) printf("%s",s)
#define PRC(s) printf("%c",s)
int main(void){
  int n;
  scanf("%d",&n);
  printf("ABC%d",n);
  return 0;
}
/*
scanf("%d",&n);
scanf("%d %d",&a,&b);
*/

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

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    string S; cin >> S;
    if(S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
    return 0;
}

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

int main() {
  int N;
  scanf ("%d", &N);
  vector<int64_t> A(N + 1);
  A.at(0) = 2;
  A.at(1) = 1;
  
  for (int i = 0; i < N - 1; i++) {
    A.at(i + 2) = A.at(i + 1) + A.at(i);
  }
  
  printf("%ld \n ", A.at(N));
}


Measured memory_bytes: 256
class UnionFind:
  def __init__(self, n):
    self.par = [i for i in range(n)]
    self.rank = [0]*n
  def find(self, x):
    if self.par[x]==x:
      return x
    else:
      self.par[x] = self.find(self.par[x])
      return self.par[x]
  def unit(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x==y:
      return
    elif self.rank[x]<self.rank[y]:
      self.par[x] = y
      return
    elif self.rank[y]<self.rank[x]:
      self.par[y] = x
    else:
      self.par[y] = x
      self.rank[x] += 1
      
  def same(self, x, y):
    return self.find(x)==self.find(y)
  
N,M = map(int, input().split())
u = UnionFind(N+M)
for i in range(N):
  inf = list(map(int, input().split()))
  for l in inf[1:]:
    u.unit(i,N+l-1)

ans = all(u.same(i,i+1) for i in range(N-1))
if ans:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 12948
def medium(a,b):
  print((b-a)//2)
n,a,b = map(int,input().split())
if (b-a-1)%2==1:
  print(min((b-a)//2,b-1,n-a))
else:
  print(min(b-1,n-a,a+((b-a-1)//2),n-b+1+(b-a-1)//2))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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 gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll n, m;
    cin >> n >> m;

    vector<ll> a(n);
    vector<ll> b(n);
    vector<ll> gusuc(n, 0);
    REP(i, n)
    {
        cin >> a[i];
        b[i] = a[i] / 2;

        ll pow2 = 2;
        while (b[i] % pow2 == 0){
            gusuc[i]++;
            pow2 *= 2;
        }
    }



    bool flag = true;
    REP(i,n){
        if(gusuc[i] != gusuc[0]){
            flag = false;
            break;
        }
    }

    if(flag){
        ll pow2 = pow(2, gusuc[0]);
        REP(i, n)
        {
            b[i] /= pow2;
        }
        ll lcm = b[0];

        FOR(i,1,b.size()){
            lcm = lcm * b[i] / gcd(lcm, b[i]);
        }

        ll cnt = 0;
        ll kisu = 1;
        lcm *= pow2;

        while (kisu  <= (double)m / lcm)
        {
            cnt++;
            kisu += 2;
        }
        cout << cnt << endl;
    }
    else{
        cout << 0 << endl;
    }


    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

string s;
int main() {
    cin >> s;
    int ans = 0;
    for(int i = 0; i < s.length(); ++i) {
        if(s.at(i) == '+') ans++;
        else ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, s, e) for (int i = s; i < e; i++)
#define endl '\n'
int main()
{
    string S;
    cin >> S;
    if (S == "ABC")
        cout << "ARC" << endl;
    else
        cout << "ABC" << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
 
int main(){

    int A,B;
    cin>>A>>B;
    if((A+B)%3==0){
        cout<<"Possible"<<endl;
    }
    else if(A%3==0){
        cout<<"Possible"<<endl;
    }
    else if(B%3==0){
        cout<<"Possible"<<endl;
    }
    else{
        cout<<"Impossible"<<endl;
    }
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    int s[n]; for (int i = 0; i < n; i++) cin >> s[i];
    long long ans = 0;
    for (int d = 1; d < n-1; d++) {
        bool stop = (n-1)%d==0;
        int m = 0, a = n-1;
        long long sum = 0;
        for (;;) {
            m += d; a -= d;
            if ((stop && m >= a) || a <= d) break;
            else sum += s[m] + s[a];
            // cerr << d << ' ' << m << ' ' << a << ' ' << sum << endl;
            ans = max(ans, sum);
        }
    }
    cout << ans << endl;
}


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

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 100001

int N,M,S,T;
vi adj[maxn];
vpi adj2[maxn];
bool vis[maxn][3];
int dist[maxn][3];
vpi nodes[3];

int main(){
	fast;
	
	cin>>N>>M;
	
	FOR(i,0,M-1){
		int a,b; cin>>a>>b; adj[a].pb(b);
	}
	
	cin>>S>>T;
	

		
	queue <pi> q;
	q.push(pi(S,0));
		
	while (!q.empty()){
		pi cur = q.front(); q.pop();
			
		if (vis[cur.f][cur.s%3]) continue;
		vis[cur.f][cur.s%3] = 1;
		
		dist[cur.f][cur.s%3] = cur.s;
		aFOR(i,adj[cur.f]){
			q.push(pi(i,cur.s+1));
		}
	}
	
	if (vis[T][0] == 1) cout<<dist[T][0]/3;
	else cout<<-1;

		
}



Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 1010101010101010;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
  int n,k; cin>>n>>k;
  vll a(n); rep(i,n) cin>>a[i];
  //s[0]=a[0];
  //vll s(n); rep(i,n-1) s[i+1]+=s[i]+a[i+1];
  rep(i,n-k){
    if(a[i]<a[i+k]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}


Measured memory_bytes: 4840
N = int(input())

Lst = [x for x in range(1, int(N ** 0.5) + 1) if N % x == 0]

Mn = len(str(N))
for x in range(len(Lst)):
  A = Lst[x]
  B = int(N/Lst[x])
  Mx = max(len(str(A)),len(str(B)))
  if Mn > Mx:
    Mn = Mx

print(Mn)

Measured memory_bytes: 39280
#include <bits/stdc++.h>
#define ll long long
#define INF LONG_LONG_MAX
#define pb push_back
#define mp make_pair
#define MAXN 1000009
#define MOD 1000000007
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
using namespace std;

int fre[MAXN];

int main(){
    int n,m,a,b;
    cin>>n>>m;
    while(m--){
        cin>>a>>b;
        if(a==1)
            fre[b]++;
        if(b==n)
            fre[a]++;
    }
    for(int i=1;i<=n;++i){
        if(fre[i]==2){
            cout<<"POSSIBLE";
            return 0;
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  char c1, c2;
  c1 = getchar();
  c2 = getchar();
  int ans = 999;
  while(1){
    char c3 = getchar();
    if (c3 == EOF || c3 == 10) {
      break;
    }
    int tmp = ((int)(c1-'0'))*100+((int)(c2-'0'))*10+((int)(c3-'0'));
    if (tmp > 753){
      if(tmp - 753 < ans){
        ans = tmp - 753;
      }
    }else{
      if(753 - tmp < ans){
        ans = 753 - tmp;
      }
    }
    c1 = c2;
    c2 = c3;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
N, A, B = tuple(map(int, input().split()))
S = input()
cutline = A + B
qualified = 0
foreigner = 0

for i in range(len(S)):
    c = S[i]
    if c == "a":
        if qualified < cutline:
            print("Yes")
            qualified += 1
        else:
            print("No")
    
    elif c == "b":
        if (qualified < cutline) and (foreigner < B):
            print("Yes")
            qualified += 1
        else:
            print("No")
        
        foreigner += 1
    
    else:
        print("No")

Measured memory_bytes: 53336
# # 整数の入力
# a = int(input())
# # スペース区切りの整数の入力
# b, c = map(int, input().split())
# # 文字列の入力
# s = input()
a,b = map(int, input().split())

ans=-1
 
if a<10 and b<10:
	ans=a*b

print(ans)


Measured memory_bytes: 2940
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*(i)+100*(j)+50*(k)==x:
            
                count=count+1

print(count)

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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

int a[20][20];
int n, m, x;
int c[20];

bool check(int idx)
{
  bool ret = true;
  for (int i = 0; i < m; i++)
  {
    int sum = 0;
    for (int j = 0; j < n; j++)
    {
      if ((idx >> j) & 1)
        sum += a[j][i];
    }
    if (sum < x)
    {
      ret = false;
    }
  }
  return ret;
}

int powl(int n, int x)
{
  int ret = n;
  for (int i = 1; i < x; i++)
    ret *= n;
  return ret;
}

int calc(int idx)
{
  int sum = 0;
  for (int i = 0; i < n; i++)
    if ((idx >> i) & 1)
    {
      sum += c[i];
    }
  return sum;
}

signed main()
{
  cin >> n >> m >> x;
  for (int i = 0; i < n; i++)
  {
    cin >> c[i];
    for (int j = 0; j < m; j++)
      cin >> a[i][j];
  }

  int mn = INF;
  for (int i = 0; i < pow(2, n); i++)
  {
    if (check(i))
    {
      mn = min(mn, calc(i));
    }
  }
  if (mn == INF)
    mn = -1;
  cout << mn << endl;
}

Measured memory_bytes: 4064
#include<bits/stdc++.h>
using namespace std;
char a[15][15];
int main()
{
    int n,m;
    bool p=true;
    scanf("%d %d",&n,&m);
    for(int i=1;i<=n;i++)
    {
    	scanf("%s",a[i]+1);
	}
	if(a[1][1]!='#'||a[n][m]!='#')p=false;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]=='#')
			{
				if(a[i+1][j]=='#'&&a[i][j+1]=='#')p=false;
			}
		}
	}
	int rr[15],ll[15];
	for(int i=1;i<=n;i++)
	{
		ll[i]=1000;
		rr[i]=-1000;
		for(int j=1;j<=m;j++)
		{
			if(a[i][j]=='#')
			{
				rr[i]=max(rr[i],j);
				ll[i]=min(ll[i],j);
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(rr[i]>ll[j])p=false;
		}
	}
	if(p)printf("Possible");
	else printf("Impossible");
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            int x = m + f;
            if (m == -1 && f == -1 && r == -1) break;

            if (m == -1 || f == -1) {
                System.out.println("F");
            } else {
                if (x >= 80) System.out.println("A");
                if (65 <= x && x < 80) System.out.println("B");
                if (50 <= x && x < 65) System.out.println("C");
                if (30 <= x && x < 50) {
                    if (r >= 50) System.out.println("C");
                    else System.out.println("D");
                }
                if(x<30) System.out.println("F");
            }
        }
    }
}


Measured memory_bytes: 26156
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

int main(void) {
    Int a, b, x;
    cin >> a >> b >> x;
    if (a > x) {
        cout << "NO" << endl;
    } else if (a + b < x) {
        cout << "NO" << endl;
    } else {
        cout << "YES" << endl;
    }
    return 0;
}


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


using namespace std;

typedef long long ll;


ll N, M, Q, A, B, C, D, E, X, Y, Z, arr[100005];

string s;

multiset<ll> s1, s2;
ll sum1, sum2;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> Q;
	for (int i = 1; i <= Q; ++i){
		cin >> X;
		if (X == 1){
			cin >> A >> B;
			C += B;
			if (s2.size() > s1.size()){
				if (s1.size() == 0 || A >= *(--s1.end())){
					s2.insert(A);
					sum2+=A;
					Y = *s2.begin();
					sum2-=Y;
					sum1+=Y;
					s1.insert(Y);
					s2.erase(s2.find(Y));
				}
				else{
					s1.insert(A);
					sum1+=A;
				}
			}
			else{
				if (s1.size() == 0){
					s2.insert(A);
					sum2 += A;
					continue;
				}
				if (A >= *(--s1.end())){
					s2.insert(A);
					sum2+=A;
				}
				else{
					s1.insert(A);
					sum1+=A;
					Y = *(--s1.end());
					sum1-=Y;
					sum2+=Y;
					s2.insert(Y);
					s1.erase(s1.find(Y));
				}
			}
		}
		else{
			if (s2.size() > s1.size()){
				cout << *s2.begin() << ' ' << sum2-*s2.begin()-sum1+C << '\n';
			}
			else{
				cout << *(--s1.end()) << ' ' << sum2-sum1+C << '\n';
			}
		}
	}
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); ++ i)
#define per(i,a,b) for(int i = (a); i >= (b); -- i)
#define pb push_back
#define VI vector<int>
#define VVI vector<VI>
#define Pii pair<int,int>
#define Pll pair<ll,ll>
#define Pli pair<ll,int>
#define fi first
#define se second
#define Ppi pair<Pii,int>
#define VII vector<Pii>

using namespace std;

typedef long long ll;
typedef int (*funI_I) (int);
typedef int (*funI_II) (int, int);

constexpr int N = 4000100;

int n, a[N], R, A;

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> n >> R;
    while(n > 0) {
        n /= R;
        A++;
    }
    cout << A << "\n";
}


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

#define fa(x,v) for(auto x:v)
#define f(i,a,b) for(ll i=(ll)a;i<=(ll)b;i++)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define spc " "
#define endl '\n'
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(s) (ll)int(s.length())
#define sz(v) (ll)int(v.size())
#define MOD 1000000007

void Fast_IO() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.in","r",stdin);
    freopen("output.out","w",stdout);
    freopen("debug.out","w",stderr);
    #endif
} 

// Code Here

int main()
{
    // Fast_IO();
    ll k; cin >> k;
    string s; cin >> s;
    ll n = len(s);
    if(n <= k) cout << s;
    else {
        f(i,0,k-1) cout << s[i];
        cout << "...";
    }
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換
#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-10; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
 ll gcd(ll a, ll b) {
	 if (b == 0) return a;
	 return gcd(b, a % b);
	
}

 ll lcm(ll a, ll b) {
	 ll g = gcd(a, b);
	 return a / g * b; // Be careful not to overflow
 }

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 1, n = 0, m=1, count=0, sum = 0, ch = 0;
	llint  a, aa, aaa, rr = 0, gg = 0, bb = 0,b=0;
	llint bbb=0, bbbb=0;
	bool check = false;
	string s,out;
	vector<llint> r, g;
	char c;
	cin >> n;
	rep(i, n) {
		cin >> a;
		ans = lcm(ans, a);
	}
	cout << ans << endl;
	
	please AC;
}


Measured memory_bytes: 256
s=list(input())
b=0
a=[[0 for i in range(len(s))] for j in range(len(s))]
if len(s)>=3:
    a[0][0],a[0][1]=1,1
    for i in range(2,len(s)):
        a[0][i]=a[0][i-1]*2
    for i in range(1,len(s)):
        for j in range(i,len(s)):
            a[i][j]=a[i-1][j-1]*2
    for i in range(len(s)):
        for j in range(len(s)):
            b+=int(s[i])*a[i][j]*10**(len(s)-j)
    print(b//10)
elif len(s)==2:
    print(11*int(s[0])+2*int(s[1]))
else:
    print(int(s[0]))

Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define int long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB emplace_back
#define PF emplace_front
#define FILL(a,b) memset(a,b,sizeof(a))
#define lwb lower_bound
#define upb upper_bound
using namespace std;
int c[200005],cnt[200005],ans[200005],sub[200005],n;
V<int> v[200005]; 
void get(int p,int fa){
	sub[p]=1;
	for(auto u:v[p])if(u!=fa){
		get(u,p);sub[p]+=sub[u];
	}
}
void dfs(int p,int fa){
	int pre=cnt[c[p]],t=n-sub[p]+1-pre,last=cnt[c[p]],sum=0,add=0;
	V<int> tv;
	for(auto u:v[p])if(u!=fa){
		dfs(u,p);
		ans[c[p]]-=(cnt[c[p]]-pre)*t;
		tv.PB(sub[u]-(cnt[c[p]]-pre));
		pre=cnt[c[p]];
	}
	reverse(ALL(tv));
	sum=sub[p]-1-(cnt[c[p]]-last);
	for(auto u:v[p])if(u!=fa){
		add+=tv.back()*(sum-tv.back());
		tv.pop_back();
	}
	ans[c[p]]=ans[c[p]]+sub[p]*t+add/2;
	cnt[c[p]]=last+sub[p];
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x,y;
	cin>>n;
	FOR(i,1,n)cin>>c[i];
	rep(i,1,n){
		cin>>x>>y;
		v[x].PB(y);v[y].PB(x);
	}
	get(1,-1);
	dfs(1,-1);
	FOR(i,1,n)cout<<ans[i]<<'\n';
	RE 0;
}




Measured memory_bytes: 51960
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

namespace SolutionCS
{
    class Program
    {
        static List<int> Divisor(int input)
        {
            List<int> result = new List<int>();

            for (int i = 1; i * i <= input; i++)
            {
                if (0 == input % i)
                {
                    result.Add(i);
                    if (i * i != input)
                    {
                        result.Add(input / i);
                    }
                }
            }

            return result;
        }

        static int M;
        static int D;

        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            M = int.Parse(s[0]);
            D = int.Parse(s[1]);

            int ans = 0;
            for (int i = 4; i <= M; i++)
            {
                List<int> d = Divisor(i);

                foreach(int t in d)
                {
                    if (t >= 2 && t <= 9)
                    {
                        int o = i / t;

                        if (o >= 2 && o < 10 && t * 10 + o <= D)
                        {
                            ans++;
                        }
                    }
                }
            }

            Console.WriteLine(ans);
        }
    }
}



Measured memory_bytes: 13268
S = input().strip()
K = int(input())
if len(S)==1:
    cnt = K//2
else:
    A = []
    cur = 0
    for i in range(1,len(S)):
        if S[i]!=S[i-1]:
            if i-cur>=2:
                A.append([S[i-1],cur,i])
            cur = i
    if S[-1]==S[-2]:
        A.append([S[-1],cur,len(S)])
    cnt = 0
    for j in range(len(A)):
        cnt += (A[j][2]-A[j][1])//2
    if S[0]!=S[-1]:
        cnt = cnt*K
    else:
        if S[0]!=S[1] and S[-1]!=S[-2]:
            cnt = cnt+(cnt+1)*(K-1)
        elif S[0]==S[1] and S[-1]!=S[-2]:
            if (A[0][2]-A[0][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        elif S[0]!=S[1] and S[-1]==S[-2]:
            if (A[-1][2]-A[-1][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        elif S[0]==S[1] and S[-1]==S[-2] and len(A)>1:
            if (A[0][2]-A[0][1])%2==0 or (A[-1][2]-A[-1][1])%2==0:
                cnt = cnt*K
            else:
                cnt = cnt+(cnt+1)*(K-1)
        else:
            cnt = (len(S)*K)//2
print(cnt)

Measured memory_bytes: 3192
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    int N;
    cin >> N;

    map<string, int> S;
    FOR(i, 0, N){
        string word;
        cin >> word;
        S[word]++;
    }

    int M;
    cin >> M;
    map<string, int> T;
    FOR(i, 0, M){
        string word;
        cin >> word;
        T[word]++; 
    }

    int answer = 0;
    for(auto a : S){
        string key = a.first;
        int count = a.second;
        
        int T_count = T[key];
        int diff = count - T_count;
        answer = max(answer, diff);
    }

    p(answer);
    
    return 0;
}

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

typedef ostringstream OSS;
typedef istringstream ISS;

typedef long long LL;
typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef vector<VS> VVS;
typedef vector<bool> VB;
typedef vector<VB> VVB;
typedef vector<PII> VPII;

#define fst first
#define snd second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x) (x).begin(),(x).end()
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a) { OSS oss; oss << a; return oss.str(); };

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

const string CHARS("PQR");

const int not_[] = {2, 1, 0};

const int and_[3][3] = {
	{0, 0, 0},
	{0, 1, 1},
	{0, 1, 2}
};

const int or_[3][3] = {
	{0, 1, 2},
	{1, 1, 2},
	{2, 2, 2}
};

PII solve(string &str, int pos);

PII ope(string &str, int pos) {
//	cout << "-- " << pos << " " << str[pos] << endl;
	PII l = solve(str, pos);
	PII r;
	int v;

	switch (str[l.fst]) {
		case '*':
			r = solve(str, l.fst + 1);
			v = and_[l.snd][r.snd];
			return MP(r.fst, v);

		case '+':
			r = solve(str, l.fst + 1);
			v = or_[l.snd][r.snd];
			return MP(r.fst, v);
	}

	return MP(-1, -1);
}

PII solve(string &str, int pos) {
	int n = str.size();

	if (pos >= n) {
		return MP(pos, -1);
	}

//	cout << pos << " " << str[pos] << endl;

	char c = str[pos];

	PII tmp;

	switch (c) {
		case '0':
		case '1':
		case '2':
			return MP(pos + 1, c - '0');

		case '-':
			tmp = solve(str, pos + 1);
			return MP(tmp.fst, not_[tmp.snd]);
			
		case '(':
			tmp = ope(str, pos + 1);
			return MP(tmp.fst + 1, tmp.snd);

		default:
			cout << "!!! error !!!" << endl;
			cout << str << endl;
			cout << pos << " " << c << endl;
			exit(1);
	}

	return MP(0, 0);
}

int main(void) {
	VVI ps;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				ps.PB(VI({i, j, k}));
			}
		}
	}
	int psn = ps.size();

	string str0;

	while (cin >> str0, str0 != ".") {
		int cnt = 0;
		
		for (int i = 0; i < psn; i++) {
			string str = str0;
			// replace
			for (int j = 0; j < 3; j++) {
				replace(ALL(str), CHARS[j], (char)('0' + ps[i][j]));
			}

//			cout << endl << "case: " << i << " " << str << endl;
			auto tmp = solve(str, 0);
//			cout << tmp.fst << " " << tmp.snd << endl;
			cnt += tmp.snd == 2;
		}

		cout << cnt << endl; 
	}


	return 0;
}

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

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

const long long INF = 1LL << 60;

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

  cout << ((a*b)%2 == 0 ? "Even" : "Odd") << endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int e[12],i,j,box;
	for(i=0;i<12;i++){
	scanf("%d",&e[i]);
	}
	for(i=0;i<11;i++){
		for(j=i+1;j<12;j++){
			if(e[i]>e[j]){
				box=e[i];
				e[i]=e[j];
				e[j]=box;
			}
		}
	}
		if(e[0]==e[1]&&e[1]==e[2]&&e[2]==e[3]&&e[4]==e[5]&&e[5]==e[6]&&e[6]==e[7]&&e[8]==e[9]&&e[9]==e[10]&&e[10]==e[11]){
		printf("yes\n");
		}
		else{
			printf("no\n");
		}
	return 0;
}


Measured memory_bytes: 2692
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
arrA = list(map(int,input().split()))
arrA = np.array(arrA)

arrA = arrA % 4
num4s = len(arrA[arrA==0])
num2s = len(arrA[arrA==2])
num13s = len(arrA) - num2s - num4s

if num13s - num4s == 0:
    ans = "Yes"
elif num13s - num4s == 1 and num2s>0:
    ans = "No"
elif num13s - num4s > 1:
    ans = "No"
else:
    ans = "Yes"
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


Measured memory_bytes: 23116
#include <iostream>

using namespace std;

int main () {
    int n, a, min = 1000000, max = -1000000;
    long long sum = 0;

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> a;

        if (a > max) max = a;
        if (a < min) min = a;

        sum += a;
    }
    cout << min << ' ' << max << ' ' << sum << endl;
}


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

int main(void){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    if(A+B > C+D)
        cout << "Left" << endl;
    else if(A+B == C+D)
        cout << "Balanced" << endl;
    else if(A+B < C+D)
        cout << "Right" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int fuyu,a,b,amax,bmax;
  int aday,bday,day;
  scanf("%d",&fuyu);
  scanf("%d",&a);
  scanf("%d",&b);
  scanf("%d",&amax);
  scanf("%d",&bmax);
  aday=a/amax;
  if(a%amax!=0){
    aday+=1;
  }
  bday=b/bmax;
  if(b%bmax!=0){
    bday+=1;
  }
  day=aday;
  if(bday>day){
    day=bday;
  }
  
  printf("%d\n",fuyu-day);
  return 0;
}

Measured memory_bytes: 2676
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

typedef long long ll;

typedef pair<ll,ll> P;
#define X first
#define Y second

void go() {
	int n;
	cin >> n;
	vector<vector<int> > a(2,vector<int>(n));
	for(int i = 0; i < n; i++) cin >> a[0][i];
	for(int i = 0; i < n; i++) cin >> a[1][i];
	for(int i = 1; i < n; i++) {
		a[0][i] += a[0][i-1];
		a[1][i] += a[1][i-1];
	}
	int res = 0;
	for(int i = 0; i < n; i++) {
		int ans;
		ans = a[0][i];
		ans += a[1][n-1];
		if(i>0) ans -= a[1][i-1];
		res = max(ans,res);
	}
	cout << res << endl;

}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}



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

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> m(N);
  rep(i, N) cin >> m[i];
  
  int S = 0;
  int M = 1500;
  for(int i = 0; i < N; i++){
    S += m[i];
    if(m[i] < M){
      M = m[i];
    }
  }
  
  int ans = N + (X - S) / M;
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define Time (double)clock()/CLOCKS_PER_SEC
#define y1 lmao
const int N = 187;
int n, m;
bool a[N][N];
int sum[N][N];
int getsum(int x1, int y1, int x2, int y2) { return sum[x2 + 1][y2 + 1] - sum[x2 + 1][y1] - sum[x1][y2 + 1] + sum[x1][y1]; }
bool is_null(int x1, int y1, int x2, int y2) {
    int t = getsum(x1, y1, x2, y2);
    return t == 0 || t == (x2 - x1 + 1) * (y2 - y1 + 1);
}   
short int x[N][N][N], y[N][N][N], x1[N][N][N], y1[N][N][N];
bool check(int x1, int y1, int x2, int y2) {
    return x[x1][x2][y1] >= y2 || y[y1][y2][x1] >= x2 || x[x1][x2][x[x1][x2][y1] + 1] >= y2 || y[y1][y2][y[y1][y2][x1] + 1] >= x2;
}   
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        string s; cin >> s;
        for (int j = 0; j < m; ++j) a[i][j] = s[j] == '#';
    }   
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) sum[i + 1][j + 1] = sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + a[i][j];
    }   
    for (int l = 0; l < n; ++l) {
        for (int r = l; r < n; ++r) {
            for (int ly = 0; ly < m; ++ly) {
                x[l][r][ly] = ly - 1;
                while (x[l][r][ly] + 1 < m && is_null(l, ly, r, x[l][r][ly] + 1)) ++x[l][r][ly];
            }   
        }   
    }   
    for (int l = 0; l < m; ++l) {
        for (int r = l; r < m; ++r) {
            for (int lx = 0; lx < n; ++lx) {
                y[l][r][lx] = lx - 1;
                while (y[l][r][lx] + 1 < n && is_null(lx, l, y[l][r][lx] + 1, r)) ++y[l][r][lx];
            }   
        }   
    }   
    for (int ans = 0; ; ++ans) {
        if (x[0][n - 1][0] == m - 1) {
            cout << ans << '\n';
            exit(0);
        }   
        for (int l = 0; l < n; ++l) {
            for (int r = l; r < n; ++r) {
                for (int ly = 0; ly < m; ++ly) {
                    x1[l][r][ly] = x[l][r][ly];
                    while (x1[l][r][ly] + 1 < m && check(l, ly, r, x1[l][r][ly] + 1)) ++x1[l][r][ly];
                }   
            }   
        }   
        for (int l = 0; l < m; ++l) {
            for (int r = l; r < m; ++r) {
                for (int lx = 0; lx < n; ++lx) {
                    y1[l][r][lx] = y[l][r][lx];
                    while (y1[l][r][lx] + 1 < n && check(lx, l, y1[l][r][lx] + 1, r)) ++y1[l][r][lx];
                }   
            }   
        }               
        for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) for (int k = 0; k < N; ++k) { x[i][j][k] = x1[i][j][k]; y[i][j][k] = y1[i][j][k]; }
    }   
}

Measured memory_bytes: 51456
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define fi first
#define se second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"---------------"#x"---------------"<<endl
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
						For(_x,L,R)cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector <int> vi;
typedef long double LD;
LL read(){
	LL x=0,f=0;
	char ch=getchar();
	while (!isdigit(ch))
		f|=ch=='-',ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return f?-x:x;
}
const int N=55;
int n;
int a[N][N],b[N];
int dp[N][N][N];
bool check(int *a,int b,int k){
	For(i,0,50)
		if (dp[b][k][i]&&a[i])
			return 1;
	return 0;
}
bool check(int a[N][N],int k){
	For(i,1,n)
		if (!check(a[i],b[i],k))
			return 0;
	return 1;
}
int main(){
	n=read();
	For(i,1,n)
		a[i][read()]=1;
	For(i,1,n)
		b[i]=read();
	For(b,0,50){
		dp[b][0][b]=1;
		For(k,1,50)
			For(i,0,50)
				dp[b][k][i]=dp[b][k-1][i]|dp[b][k-1][i%k];
	}
	if (!check(a,50))
		return puts("-1"),0;
	LL ans=0;
	Fod(i,50,1)
		if (!check(a,i-1)){
			ans+=1LL<<i;
			For(j,1,n)
				For(k,0,50)
					a[j][k%i]|=a[j][k];
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
 
 
 
int main(){
	//freopen("output.txt","r",stdin);
 
	int t;
	cin>>t;
 
	bool flag = false;
 
	while(t != 0){
		int x = t % 10;
		t /= 10;
		if(x == 7)
			flag = true;
	}
 
	if(flag)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

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

/*
#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")*/

#define I inline void 
#define S struct 
#define vi vector<int> 
#define vii vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std ; 
using ll = long long ; 
using ld = long double ; 

const int N = 1e5 + 7 , mod = 1e9 + 7 ; 
const ll inf = 1e11 ; 
// How interesting!

int n ,w ; 
ll dp[N] ; 

int main(){
        ios_base::sync_with_stdio(0) ;
        cin.tie(0) ; 
        //freopen("in.in" , "r" , stdin) ; 

        cin >> n >> w ; 
        for(int j = 1 ;j< N ;j ++){
                dp[j] = inf ; 
        }
  
        for(int i = 1 ;i <= n; i++){
                ll x , y ;
                cin >> x >> y ;
                for(int j = N - y - 1  ; ~j  ;j --){
                        dp[j + y] = min(dp[j + y], dp[j] + x) ; 
                }
        }
        int ans = 0 ;
        for(int i = 0 ;i < N ;i ++){
                if(dp[i] <= w)
                        ans = i ; 
        }
        cout<< ans ; 
        return 0 ; 
}

Measured memory_bytes: 4432
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define fast ios_base::sync_with_stdio(false)
typedef long long ll;
typedef pair<ll,ll> p;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n;
cin>>n;
string s;
cin>>s;
ll ans=0;
for(ll i=0;i<=n-3;i++)
{
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
    {
        ans++;
    }
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
using namespace std;
const int inf = static_cast<int>(pow(10,9)); 
int main()
{
	int n , k;
	cin >> n >> k;
	auto h = vector<int>(n,0);
	for(int i=0;i<n;i++){
	        cin >> h[i];
	}
	sort(h.begin(),h.end());
	
	auto ans = inf;
	for(int _min=0;_min+k-1<n;_min++){
	    auto _max = _min + k-1;
	    ans = min(ans,h[_max]-h[_min]);
	}
	
	cout << ans;
}

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

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

    long long x=0;
    int cnt = 0;
    long long ret = 0;
    long long tmp = 0;
    int calcresult[a];
    if(n<b-1){
        tmp = (a*n)/b - a*(n/b);
        cout << tmp << endl;
        return 0;
    }
    for(int i=0; i<a; i++){
        calcresult[i]=0;
    }
    while(1){
        cnt += 1;
        x = cnt * b - 1;
        if (x>n){
            break;
        }
        tmp = (a*x)/b - a*(x/b);
        if (calcresult[tmp]==1){
            break;
        }
        calcresult[tmp]=1;
        if(tmp > ret){
            ret = tmp;
        }
    }
    cout << ret << endl;
    return 0;
}


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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }


// ***************************************

int main(void) {

	int N;
	cin >> N;
	vector<int> dp(N, 1e10);
	dp[0] = 0;

	vector<int> H(N);
	for (int& h : H) {
		cin >> h;
	}

	dp[1] = dp[0] + abs(H[1] - H[0]);
	FOR(i, 2, N) {
		dp[i] = min(dp[i - 2] + abs(H[i] - H[i - 2]), dp[i - 1] + abs(H[i] - H[i - 1]));
	}

	cout << dp.back() << endl;


	return 0;
}

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

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

void solve(){
	int n;
	cin >> n;

	vector<int> arr(n);
	for(auto& i : arr) cin >> i;
	sort(arr.begin(), arr.end());

	int cnt = 0;

	for(int i = 0; i < n; ++i)
		for(int j = i + 1; j < n; ++j)
			for(int k = j + 1; k < n; ++k)
				cnt += ((arr[i] != arr[j]) and
				        (arr[j] != arr[k]) and
				        (arr[k] != arr[i]) and
				        (arr[i] + arr[j] > arr[k]) and
				        (arr[i] + arr[k] > arr[j]) and
				        (arr[j] + arr[k] > arr[i]));


	cout << cnt << "\n";
}

signed main (void){
	// Fast_IO
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	// Set Fixed Notation (default sucks), High Precision for Floating-Point Output
	cout << fixed << setprecision(20);

	// Multiple TCs
	int tt = 1;
	// cin >> tt;
	while(tt--) solve();
}


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

int keta(int n) {
    int res;
    for(int i = 0; i < 100; i++) {
        n = n / 10;

        if(n == 0) {
            res = i + 1;
            break;
        }
    }
    return res;
}
int main() {
    int l, r, d, cnt = 0;
    cin >> l >> r >> d;
    for(int i = l; i <= r; i++) {
        if(i % d == 0) cnt++;
    }
    cout << cnt << endl;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

int main() {
    string S;
    cin >> S;
    int n = S.size();
    ll ans = 0;
    rep(i, 1 << (n - 1)) {
        ll x = 0;
        rep(j, n) {
            x = x * 10 + S[j] - '0';
            if (j < n - 1 && (i >> j & 1)) {
                ans += x;
                x = 0;
            }
        }
        ans += x;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
using ll = long long;
typedef pair<ll, ll> P;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

/*def*/
ll dp[100100];
ll n, h[100100];

int main() {
/*input*/
    cin >> n;
    rep(i, n){cin >> h[i];}

    rep(i, 100100){dp[i] = LLONG_MAX;}
    dp[0] = 0;

/*main配るdp*/
    rep(i, n-1){
        chmin(dp[i+1], dp[i] + abs(h[i+1] - h[i]));
        chmin(dp[i+2], dp[i] + abs(h[i+2] - h[i]));
    }

/*output*/
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 5104
#include <stdio.h>
int main(){
  int h,w,i,j;

  while(1){
    scanf("%d %d",&h,&w);
    if((h==0)&&(w==0)) break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	if((((i%2)==0)&&((j%2)==0))||(((i%2)==1)&&((j%2)==1))) printf("#");
	else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 572
#include <cmath>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;
using vi = vector<int>;

int n;
vi a;

void input() {
  cin >> n;

  a.resize(n);
  for (auto&& i : a)
    cin >> i;
}

void solve() {
  ll ans = 0;
  int maxo = 0;

  for (auto&& i : a) {
    maxo = max(maxo, i);
    ans += maxo - i;
  }

  cout << ans << '\n';
}

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

  cout.precision(16);
  cout << fixed;

  int _times = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);

  _times = 2;
#endif

  // cin >> _times;

  while (_times--) {
    input();
    solve();
  }
}


Measured memory_bytes: 3992
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < (n); i++)
#define INF (1<<20)

int main() {
	int N, M, Q;
	cin >> N >> M >> Q;
	vector<int> L(M+1), R(M+1);
	vector<vector<int> > x(N+1, vector<int>(N+1,0)), C(N+1, vector<int>(N+1,0));
	for (int i = 1; i <= M; i++) {
		cin >> L[i] >> R[i];
		x[L[i]][R[i]]++;
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			C[i][j] = C[i][j-1]+x[i][j];
		}
	}
	vector<int> p(Q), q(Q);
	for (int i = 0; i < Q; i++) {
		cin >> p[i] >> q[i];
		int sum = 0;
		for (int j = p[i]; j <= q[i]; j++) {
			sum += C[j][q[i]]-C[j][p[i]-1];
		}
		cout << sum << endl;
	}



}



Measured memory_bytes: 5248