akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
  ll k;
  string s;
  cin >> s >> k;
  if(k<=s.size()){
    bool is=true;
    rep(i,k){
      if(s.at(i)!='1'){
        is=false;
      }
    }
    if(is){
      cout << 1;
      return 0;
    }
  }
  rep(i,s.size()){
    if(s.at(i)!='1'){
      cout<< s.at(i);
      return 0;
    }
  }
}
    

Measured memory_bytes: 3600
#include <iostream>

using namespace std;

int main() {
	int N, M, C;
	int ans;
	int correct = 0;
	int i, j;
	int tmp;
	cin >> N >> M >> C;
	int B[M];
	int A[N][M];

	for (i = 0; i < M; i++) {
		cin >> B[i];
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < M; j++) {
			cin >> A[i][j];
		}
	}


	for (i = 0; i < N; i++) {
		ans = C;
		for (j = 0; j < M; j++) {
			ans += (A[i][j] * B[j]);
		}
		if (ans > 0) {
			correct++;
		}
	}
	cout << correct;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int deg[200005][2], vis[200005];
vector<int> v[200005], q;
int main(){
	int n,m; string s;
	cin>>n>>m>>s;
	s = '#' + s;
	for(int i=m,x,y;i--;){
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
		++deg[x][s[y]-'A'], ++deg[y][s[x]-'A'];
	}
	for(int i=1;i<=n;++i)
		if(!deg[i][0] || !deg[i][1]){
			q.push_back(i);
			vis[i] = 1;
		}
	for(int j=0;j<q.size();++j)
		for(auto i:v[q[j]]) if(!--deg[i][s[q[j]]-'A'] && !vis[i]){
			q.push_back(i);
			vis[i] = 1;
		}
	cout<<(q.size()<n?"Yes":"No");
}

Measured memory_bytes: 14020
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,(v).size())
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define bit(n)(1ll<<(n))
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,const T&t,const U&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(const T&...t){_print(cout,t...);}template<class...T>void dprint(const T&...t){_print(cerr,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#endif
template<class T>bool chmax(T&a,const T&b){bool x=a<b;x?a=b:b;return x;}template<class T>bool chmin(T&a,const T&b){bool x=a>b;x?a=b:b;return x;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>class iterable{static false_type c(string v);template<class U>static auto c(U v)->decltype(all(v),true_type());static false_type c(...);public:const static bool value=decltype(c(declval<T>()))::value;};
template<class T,typename=enable_if_t<iterable<T>::value>>ostream&operator<<(ostream&o,const T&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);
    cout<<setprecision(10);
    int n;
    cin>>n;
    vp a(n);
    cin>>a;
    sort(all(a), [](P a, P b){return a.F+a.S>b.F+b.S;});
    ll ans=0;
    REP(i,n){
        if(i%2==0)
            ans+=a[i].F;
        else
            ans-=a[i].S;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
ll a,b;
	cin>>a>>b;
	if(a%b==0)
	{
		cout<<a/b;
	}
	else
	{
		cout<<a/b+1;
	}

    return 0 ;
}


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

int lmt,sum;
gg solve(){
    cin>>lmt>>sum;
    gg ans=0;
    for(int x=0;x<=lmt;++x){
        // for(int y=0;y<=lmt;++y){
        //     int rest=sum-x-y;
        //     if(rest<0 || rest>lmt)continue;
        //     ans+=1;
        // }
        int rest=sum-x;
        int miny=max(0,rest-lmt);
        int maxy=min(lmt,rest-0);
        ans+=max(0,maxy-miny+1);
    }
    return ans;
}

int main(){
    cout<<solve()<<endl;
    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll N=1000000007;
//ll power(ll a,ll b,ll mod)
//{
//    ll result=1;
//    while(b>0)
//    {
//        if(b%2=1)
//            result=(result*a)%mod;
//        a=(a*a)%mod;
//        b=b/2;
//    }
//    return result;
//}
//ll d,x,y;
//void extendedEuclid(ll a,ll b)
//{
//    if(b==0)
//    {
//        d=a; x=1; y=0;
//    }
//    else
//    {
//        extendedEuclid(b,a%b);
//        ll temp=x; x=y; y=temp-(a/b)*y;
//    }
//}
//ll modInverse(ll a,ll m)
//{
//    extendedEuclid(a,m);
//    return (x%m+m)%m;
//}
//ll lcm(ll a,ll b)
//{
//    if(a==0||b==0)
//        return 0;
//    return (a*b)/(__gcd(a,b));
//}
//void sieve(ll n)
//{
//    bool isPrime[n+1];
//    isPrime[0]=false; isPrime[1]=false;
//    for(ll i=2;i<=n;i++)
//        isPrime[i]=true;
//    for(ll i=2;i*i<=n;i++)
//    {
//        if(isPrime[i]==true)
//        {
//            for(ll j=i*i;j<=n;j+=i)
//                isPrime[j]=false;
//        }
//    }
//}
//bool isPowerOfTwo(ll n)
//{
//    return (n&&!(n&(n-1)));
//}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    double d,p; ll i,n,j=0,x,y; cin>>n>>d;
    for(i=0;i<n;i++){
        cin>>x>>y; p=sqrt((x*x)+(y*y));
        if(p<=d) j++;
    }
    cout<<j;
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) reps(i,0,((n)+1))
#define repst(i,s,n) reps(i,s,((n)+1))
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (i==n-1?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ');}}

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int a, b, r;

bool m(int x) {
	string s = to_string(x), t = s;
	reverse(all(t));
	return s==t;
}

signed main() {
	cin >> a >> b;
	repst(i,a,b) r += m(i);
	cout << r << ln;
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

bool used[110];

int main() {
  // 入力
  int N;
  cin >> N;
  vector<P> R;
  int a, b;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    R.push_back(P(a, b));
  }
  vector<P> B;
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    B.push_back(P(b, a));
  }

  sort(B.begin(), B.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int maxi = -1;
    int idx = -1;
    for (int j = 0; j < N; j++) {
      if (used[j]) continue;

      if (R[j].first < B[i].second && R[j].second < B[i].first) {
        if (maxi < R[j].first) {
          maxi = R[j].first;
          idx = j;
        }
      }
    }
    if (idx != -1) {
      ans++;
      used[idx] = true;
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}


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

using namespace std;

using int64 = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(9);

  int n, k;
  cin >> n >> k;
  double sum = 0;
  for (int x = 1; x <= n; x++) {
    double probability = 1;
    int current = x;
    while (current < k) {
      probability *= 0.5;
      current *= 2;
    }
    sum += probability;
  }
  double answer = sum / n;
  cout << answer << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

#define f(i,x) for(int i=0;i<x;i++)


using namespace std;

int main()
{
	string a, b;
	int i = 1;
	cin >> a >> b;
	int c = atoi((a + b).c_str());
	int x = i * i;
	while (x<=c) {
		if (x == c) {
			cout << "Yes";
			return 0;
		}
		i++;
		x = i * i;
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
while True:
    n=int(input())
    if n==0:
        break
    else:
#A(0)=1 A(1)=1 A(2)=2 An=A(n-1)+A(n-2)+A(n-3)
        A=[0]*40
        A[0]=1
        A[1]=1
        A[2]=2
        for i in range (3,31):
            A[i]=A[i-1]+A[i-2]+A[i-3]
        if A[n]%3650==0:
            print(A[n]//3650)
        else:
            print((A[n]//3650)+1)


Measured memory_bytes: 5600
N, M, C = map(int, input().split())
B_li = list(map(int, input().split()))
A_li = []
ans = 0
for i in range(N) :
    A_li = list(map(int, input().split()))
    inner_product = C
    for j in range(M) :
        inner_product +=  A_li[j] * B_li[j]
    if inner_product > 0 :
        ans += 1
print(ans)


Measured memory_bytes: 3060
import math

N = int(input())
n = math.sqrt(N)
n = math.ceil(n) 

#約数の差が最小となるa,bを求める
min_diff = N
a = -1
b = -1

for i in range(1,n+1):
    if N % i == 0:
        j = N // i
        if min_diff > abs(i-j):
            a = i
            b = j
            min_diff = abs(i-j)

print(a+b-2)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,kaisu = 0;
	cin>>a;
	int hai[a];
	for(int i = 0;i<a;i++){
		cin>>hai[i];
	}
	int zako;
	for(int i = 0;i<a-1;i++){
		int minj  =i;
		for(int j = i+1;j<a;j++){
			if(hai[minj]>hai[j]){
				minj = j;
			}

		}
		if(hai[i] != hai[minj]){
			kaisu++;
		}
		int aho;
		aho = hai[i];
		hai[i]  = hai[minj];
		hai[minj] = aho;
	}
	for(int i = 0;i<a-1;i++){
		cout<<hai[i]<<" ";
	}
	cout<<hai[a-1]<<endl;
	cout<<kaisu<<endl;
	return 0;
}



Measured memory_bytes: 3068
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

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

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}
const double PI = 3.1415926535897932384626433;

int main() {
	double r;
	cin>>r;
	cout<<setprecision(18)<<2*PI*r;

}


Measured memory_bytes: 3852
#include <algorithm>
#include <cmath>
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll  = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<T> ReadVec1(int N) {
    vector<T> vec(N);
    for(int i = 0; i < N; i++)
        vec[i] = In<T>();
    return move(vec);
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(j, ini));
    return move(vec);
}
template <typename T> vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}


int main() {
    int n = In<int>();
    auto p = ReadVec1<int>(n);
    int count = 0;
    for(int i = 1; i < n - 1; i++) {
        if(p[i] != max({p[i - 1], p[i], p[i + 1]}) &&
           p[i] != min({p[i - 1], p[i], p[i + 1]}))
            count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double distance = sc.nextInt();
		double time = sc.nextInt();
		double speed = sc.nextInt();
		
		if ((distance - time * speed) <= 0) {
			System.out.println("Yes");
			return;
		}

		System.out.println("No");

	}
}

Measured memory_bytes: 35740
using System;

namespace AtCoder.Abc
{
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            string s = Console.ReadLine();

            string res;
            if (s.EndsWith('s'))
            {
                res = s + "es";
            }
            else
            {
                res = s + "s";
            }
            Console.WriteLine(res);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 25884
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())


def rev_w(MAP,H,W):
    nextMAP = [[] for y in range(H)]
    for y in range(H):
        nextMAP[y] = MAP[y][::-1]
    return nextMAP

def rev_h(MAP,H,W):
    nextMAP = [[0]*W for y in range(H)]
    for y in range(H):
        for x in range(W):
            nextMAP[y][x] = MAP[H-y-1][x]
    return nextMAP

while True:
    W,H,t,p = inpl()
    if W == 0:
        break
    else:
        MAP = [[1]*W for y in range(H)]
        for _ in range(t):
            d,c = inpl()
            if d == 1:
                if W//2 >= c:
                    hanten = False
                else:
                    hanten = True

                if hanten:
                    MAP = rev_w(MAP,H,W)
                    c = W - c

                nextW = W - c
                nextH = H
                nextMAP = [[1]*nextW for y in range(H)]
                for y in range(H):
                    for x in range(c):
                        nextMAP[y][x] = MAP[y][x+c] + MAP[y][(c-1)-x]
                    for x in range(c,nextW):
                        nextMAP[y][x] = MAP[y][x+c]

            elif d == 2:
                if H//2 >= c:
                    hanten = False
                else:
                    hanten = True

                if hanten:
                    MAP = rev_h(MAP,H,W)
                    c = H - c

                nextW = W
                nextH = H - c
                nextMAP = [[1]*W for y in range(nextH)]
                for x in range(W):
                    for y in range(c):
                        nextMAP[y][x] = MAP[y+c][x] + MAP[(c-1)-y][x]
                    for y in range(c,nextH):
                        nextMAP[y][x] = MAP[y+c][x]

            MAP = nextMAP
            H,W = nextH,nextW

        for _ in range(p):
            x,y = inpl()
            print(MAP[y][x])



Measured memory_bytes: 7508
#include <iostream>
using namespace std;
int main() {
    int N;
    cin>>N;
    int d1;
    int d2;
    int d3;
  
    d1=N/100;
    d2=(N-(d1*100))/10;
    d3=(N-(d1*100)-(d2*10));
 
    if((d1==7)||(d2==7)||(d3==7))
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;
 
    return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 100010
using namespace std;
struct edge{int x, y, next;}a[N];
int n, k, w[N], l, p[N], ans, f[N], mx[N];
//f[i]=若i到1距离为1，则i子树的最优解
//mx[i]=若i子树的最优解为f[i]，则i到1距离的最大值
inline void add(int x, int y){a[++l].x=x; a[l].y=y; a[l].next=p[x]; p[x]=l;}
inline void dp(int x, int def){
	for(int i=p[x]; i; i=a[i].next)dp(a[i].y, def+1);
	f[x]=0; for(int i=p[x]; i; i=a[i].next)f[x]+=mx[a[i].y]==1?f[a[i].y]+1:f[a[i].y];
	mx[x]=min(k, def); for(int i=p[x]; i; i=a[i].next)if(mx[a[i].y]>=2)mx[x]=min(mx[x], mx[a[i].y]-1);
}
int main(){
	scanf("%d%d", &n, &k);
	for(int i=1; i<=n; i++)scanf("%d", &w[i]);
	ans=0; if(w[1]>=2)ans++;
	l=0; memset(p, 0, sizeof(p));
	for(int i=2; i<=n; i++)add(w[i], i);
	for(int i=p[1]; i; i=a[i].next){dp(a[i].y, 1); ans+=f[a[i].y];}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 5120
_bound = (arr, value, compare) => {
    var first = 0
    var last = arr.length - 1
    var mid
    while(first < last) {
        mid = first + Math.floor((last - first) / 2)
        if (compare(arr[mid], value)) {
            first = mid + 1
        } else {
            last = mid
        }
    }
    return last
}

_inner_bound = (arr, value) => {
    var compare = (a, b) => a < b
    return _bound(arr, value, compare)
}

input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
L = lines.shift().split(' ')
L.sort((a,b) => a-b)
sum = 0
for (i=L.length - 1; i >= 2; i--) {
    for (j=i-1; j >= 1; j--) {
        k = _inner_bound(L, L[i] - L[j] + 1)
        if (j > k) {
            sum += j - k
        }
    }
}
console.log(sum)

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

using ll = long long;
#define max_num 1000000000000000000
#define max_itr 10000000

int  main(){

	ll x,k,d;
	cin >> x >> k >> d;
	if(x<0) x=-x;//xを正にする


	//k回移動しても0を超えない場合
 	if(x/d>k){
		x-=d*k;
		cout << x << endl;
		return 0;
	}else{
		ll e = x/d;
		k-=e;
		x-=e*d;
		if(k%2 == 1) x = abs(x-d);
		cout << x << endl;
		return 0;
	}
}



Measured memory_bytes: 3624
#include <stdio.h>
 
using namespace std;
 
 
int main(){
    int debt = 100000,n;
    scanf("%d",&n);
 
    for(int i=0;i<n;i++){
        debt=(debt/100)*105;
        if((debt%1000)>0){
            debt+=(1000-(debt%1000));
        }
    }
 
    printf("%d\n",debt);
 
    return 0;
}


Measured memory_bytes: 2724
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ll h, w;
    cin >> h >> w;
    vector<vector<string>> vec(h, vector<string>(w));

    string s;
    rep(i,h){
        cin >> s;
        rep(j,w){
            vec[i][j] = s[j];
        }
    }

    vector<vector<ll>> left(h, vector<ll>(w));
    vector<vector<ll>> right(h, vector<ll>(w));
    vector<vector<ll>> up(h, vector<ll>(w));
    vector<vector<ll>> down(h, vector<ll>(w));

    rep(i,h){
        rep(j,w){
            if(vec[i][j] == "#") continue;
            if(j == 0){
                left[i][j] = 1;
                continue;
            }else{
                left[i][j] = left[i][j-1] + 1;
            }
        }
    }

    for(long long i = 0; i < h; i++){
        for(long long j = w-1; j >= 0; j--){
            if(vec[i][j] == "#") continue;
            if(j == w-1){
                right[i][j] = 1;
                continue;
            }else{
                right[i][j] = right[i][j + 1] + 1;
            }
        }
    }

    for(long long j = 0; j < w; j++){
        for(long long i = 0; i < h; i++){
            if(vec[i][j] == "#") continue;
            if(i == 0){
                up[i][j] = 1;
                continue;
            }else{
                up[i][j] = up[i-1][j] + 1;
            }
        }
    }

    for(long long j = 0; j < w; j++){
        for(long long i = h-1; i >= 0; i--){
            if(vec[i][j] == "#") continue;
            if(i == h-1){
                down[i][j] = 1;
                continue;
            }else{
                down[i][j] = down[i+1][j] + 1;
            }
        }
    }

    ll ans = 0;
    rep(i,h){
        rep(j,w){
            chmax(ans, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3);
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 346496
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
#define all(a) a.begin(),a.end()

int main(){
	int l=0,n=0,p;
	vector<int> a(1);
	string s;
	cin>>s>>p;
	
	l=a[0]= s[0]-'0';
	for(int i=2; i<s.size() ;i+=2){
		int t=s[i]-'0';
		if(s[i-1]=='*'){
			l*=t;
			a.back()*=t;
		}else{
			l+=t;
			a.push_back(t);
		}
	}
	n=accumulate(all(a),0);
	cout<<"ILMU"[(l==p?1:0) + (n==p?2:0)]<<endl;
	return 0;
}



Measured memory_bytes: 3224
import sys
sys.setrecursionlimit(1000000)

S = input()

T = ['dream', 'dreamer', 'erase', 'eraser']
lenT = [len(i) for i in T]

def dayDream(pin):
    global isDream               #;print('dayDream: ', pin, S[pin:])
    for i, d in enumerate(T):
        #print('d:', d)
        if S[pin:pin+lenT[i]] == d:            
            pout = pin + lenT[i] #; print(d, pout)
            if pout == len(S):                
                isDream = True   #; print('YES')
                return 
            else:
                dayDream(pout)
    #print('dayDream return', pin)
    return
    
isDream = False
dayDream(0)
if isDream:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 21348
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mod 1000000007

int main() {
    ll n,w;
    cin>>n>>w;
    ll a[105],b[105],i,j;
    for(i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
    }
    ll dp[n+1][w+1];
    for(i=0;i<=w;i++)
    dp[1][i]=0;
    dp[1][a[1]]=b[1];
    for(i=2;i<=n;i++)
    {
        for(j=0;j<=w;j++)
        {
            dp[i][j]=dp[i-1][j];
            if(a[i]-j>0)
            continue;
            dp[i][j]=max(dp[i][j],b[i]+dp[i-1][j-a[i]]);
        }
    }
    ll k=*max_element(dp[n],dp[n]+w+1);
    cout<<k<<"\n";
	return 0;
}

Measured memory_bytes: 78336
#include <stdio.h>
#include <stdlib.h>
#define MAX 2147483646
int *p;
int **m;


int min(int x, int q){
  if (x>q){
    return q;
  }
  else return x;
}

void matrixChainOrder(int n){
  int i,l,j,k,q;

  for(i=1;i<=n;i++){
    m[i][i] = 0;
  }

  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=MAX;
      for(k=i;k<=j-1;k++){
        q=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
        m[i][j] = min(m[i][j],q);
      }
    }
  }
}

int main() {
  int n, notuse,i;

  scanf("%d",&n);
  p = (int*)malloc(sizeof(int) * (101));
  m = malloc(sizeof(int*) * (101));
  for(i=0; i<=n; i++){
    m[i] = malloc(sizeof(int) * (n + 1));
  }
  scanf("%d %d",&p[0], &p[1]);
  //2以降左はイラない
  for(i=2; i<=n; i++){
    scanf("%d %d",&notuse, &p[i]);
  }
  matrixChainOrder(n);
  printf("%d\n",m[1][n]);
  return 0;
}



Measured memory_bytes: 2112
#d
n,W=map(int,input().split())
w=[0]
v=[0]
for i in range(n):
    x,y=map(int,input().split())
    w.append(x)
    v.append(y)

dp=[[0]*(W+1) for i in range(110)]

for i in range(1,n+1):
    for j in range(W+1):
        dp[i][j]=dp[i-1][j]#if文Falseのときの値に困らないように
        if j-w[i]>=0:
            dp[i][j]=max(dp[i][j],dp[i-1][j-w[i]]+v[i])
print(dp[n][W])


Measured memory_bytes: 120728
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;


struct Node{
  int key;
  Node *right, *left, *parent;
};

Node *root, *NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
	
  while( x != NIL ){
    y = x;
    if( z->key < x->key ){
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if( y == NIL ){
    root = z;
  } else {
    if( z->key < y->key ){
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if ( u == NIL ) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if ( u == NIL ) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  int n, i, x;
  string com;
  
  scanf("%d", &n);
  
  for( i = 0; i < n; i++ ){
    cin >> com;
    if ( com == "insert" ){
      scanf("%d", &x);
      insert(x);
    } else if ( com == "print" ) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  

  return 0;
}


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

//constexpr int mod = 998244353;
constexpr int mod = 1000000007;

struct mint {
  long long x;

  mint(long long x = 0) : x(x % mod) {};

  mint operator + (const mint right) const {
    return mint(*this) += right;
  }

  mint operator - (const mint right) const {
    return mint(*this) -= right;
  }

  mint operator / (const mint right) const {
    return mint(*this) /= right;
  }

  mint operator * (const mint right) const {
    return mint(*this) *= right;
  }

  mint &operator += (const mint right) {
    x += right.x;
    if (x >= mod) x -= mod;
    return *this;
  }

  mint &operator -= (const mint right) {
    if (x < right.x) x += mod;
    x -= right.x;
    return *this;
  }

  mint &operator *= (const mint right) {
    x = x * right.x % mod;
    return *this;
  }

  mint &operator /= (const mint right) {
    return *this *= right.inv();
  }

  mint pow(long long x) const {
    if (x == 0) return 1;
    mint a = pow(x / 2);
    a *= a;
    if (x & 1) a *= *this;
    return a;
  }

  mint inv() const {
    return pow(mod-2);
  }
};

mint nCr(ll n, ll r)
{
  mint ret(1);

  for (int i = 0; i < r; ++i) ret *= (n-i);
  for (int i = 1; i <= r; ++i) ret /= i;

  return ret;
}

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

  ll n, a, b;
  cin >> n >> a >> b;

  mint ans = mint(2).pow(n);
  ans -= nCr(n, a);
  ans -= nCr(n, b);

  cout << ans.x-1 << '\n';

  return (0);
}


Measured memory_bytes: 3644
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String str = sc.next();
    int w=0, r=0, min=200000;
    int[] max = new int[n+1];

    List<Character> wr = new ArrayList<>();

    for(int i=0; i<n; i++){
      wr.add(str.charAt(i));
      if (wr.get(i)=='R')
    	  r++;
    }
	max[0] = Math.max(w, r);

    for(int i=1; i<n+1; i++) {
    	if (wr.get(i-1) == 'W')
    		w++;
    	else
    		r--;
    	max[i] = Math.max(w, r);
    }

    for(int i=0; i<n+1; i++) {
    	if (max[i] < min)
    		min = max[i];
    }
    System.out.println(min);

    sc.close();
  }
}


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

int main(){
    int w, h, n; cin >> w >> h >> n;
    int l=0, r=w, u=h, d=0;
    for(int i = 0; i < n; i++){
        int x, y, a; cin >> x >> y >> a;
        if(a==1) l = max(x, l);
        if(a==2) r = min(x, r);
        if(a==3) d = max(y, d);
        if(a==4) u = min(y, u);
    }
    if(l>=r || d>=u) cout << 0 << endl;
    else cout << (r-l)*(u-d) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)

int main() {
	int a, b, h;
	cin >> a >> b >> h;
	cout << (a + b)*(h / 2) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m,sta,dp[1<<13],a,b,c;
int main () {
	memset(dp,0x3f,sizeof(dp));
	dp[0]=0;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) {
		scanf("%d%d",&a,&b);
		sta=0;
		for (int j=1;j<=b;j++) {
			scanf("%d",&c);
			sta|=(1<<(c-1));
		}
		for (int j=(1<<n)-1;j>=0;j--) {
			dp[j|sta]=min(dp[j|sta],dp[j]+a);
		}
	}
	printf("%d\n",dp[(1<<n)-1]==0x3f3f3f3f?-1:dp[(1<<n)-1]);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string a;
	cin >> a;

	int flag = 0;
	string b = "";
	for (int i = 0; i < a.size(); ++i)
	{
		b = a[i];
		if(b=="C" && flag==0){
			flag = 1;
		}else if(b=="F" && flag==1){
			flag = 2;
			break;
		}

	}
	// 出力
	if(flag==2){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define F first
#define S second
#define pii pair<int, int>
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, k, gcd, mx = 0;
	cin >> n >> k;
	
	for(int i=0; i<n; i++){
		int x; cin >> x;
		if(i == 0)gcd = x;
		else gcd = __gcd(gcd, x);
		mx = max(mx, x);
	}
	if(mx < k)return cout << "IMPOSSIBLE\n", 0;
	if(__gcd(gcd, k) != gcd)return cout << "IMPOSSIBLE\n", 0;
	return cout << "POSSIBLE\n", 0;
}

Measured memory_bytes: 256
/*
 ━━━━━?
 ┓┏┓┏┓┃μ'sic foever!!
 ┛┗┛┗┛┃＼○／
 ┓┏┓┏┓┃ /
 ┛┗┛┗┛┃ノ)
 ┓┏┓┏┓┃
 ┛┗┛┗┛┃
 ┓┏┓┏┓┃
 ┛┗┛┗┛┃
 ┓┏┓┏┓┃
 ┛┗┛┗┛┃
 ┓┏┓┏┓┃
 ┃┃┃┃┃┃
 ┻┻┻┻┻┻
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <vector>
using namespace std;
const int maxn=1e5+10;
bool vis[maxn];
int pre[maxn];
long long res;
bool flag;
int find(int x){
    int r = x;
    while(pre[r]!=r){
        if(!flag&&vis[pre[r]]){
            res += pre[r];
            flag = true;
            return -1;
        }
        r = pre[r];
    }
    return r;
}
void join(int a,int b){
    pre[b]=a;
}
int main(){
    int n,q,i,j,a,b;
    char op;
    while(~scanf("%d%d",&n,&q)&&n&&q){
        res = 0;
        memset(vis, false, sizeof(vis));
        for(i=1;i<=n;i++){
            pre[i] = i;
        }
        for(i=2;i<=n;i++){
            scanf("%d",&a);
            join(a,i);
        }
        getchar();
        for(i=1;i<=q;i++){
            scanf("%c %d",&op,&a);
            if(op=='Q'){
                if(!vis[a]){
                    flag = false;
                    if(find(a)==-1){
                        
                    }else{
                        res += 1;
                    }
                }else{
                    res += a;
                }
            }else{
                vis[a] = true;
            }
            getchar();
        }
        printf("%lld\n",res);
    }
    return 0;
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int h,w,n;
char c[30][30];

void disappear(){
    int t[30][30];
    REP(i,30)REP(j,30)t[i][j]=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w-n+1;j++){
            if(c[i][j]=='.')continue;
            int flag=1;
            for(int k=j+1;k<j+n;k++){
                if(c[i][j]!=c[i][k])flag=0;
            }
            if(flag){
                for(int k=j;k<j+n;k++){
                    t[i][k]=1;
                }
            }
        }
    }
    
    for(int i=0;i<w;i++){
        for(int j=0;j<h-n+1;j++){
            if(c[j][i]=='.')continue;
            int flag=1;
            for(int k=j+1;k<j+n;k++){
                if(c[j][i]!=c[k][i])flag=0;
            }
            if(flag){
                for(int k=j;k<j+n;k++){
                    t[k][i]=1;
                }
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            if(t[i][j])c[i][j]='.';
        }
    }
    return;
}

void falling(){
    int flag=0;
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w;j++){
            if(c[i][j]!='.'&&c[i+1][j]=='.'){
                flag=1;
                swap(c[i][j],c[i+1][j]);
            }
        }
    }
    if(flag)falling();
    return;
}
int check(){
    int ret=1;
    REP(i,h)REP(j,w)if(c[i][j]!='.')ret=0;
    return ret;
}
int main(){
    cin>>h>>w>>n;
    char cc[30][30];
    REP(i,h)REP(j,w){
        cin>>c[i][j];
        cc[i][j]=c[i][j];
    }
    int ans=0;
    REP(i,h){
        REP(j,w-1){
            
            REP(k,h)REP(l,w)c[k][l]=cc[k][l];
                swap(c[i][j],c[i][j+1]);
                falling();
                for(int i=0;i<100;i++){
                    disappear();
                    falling();
                }
                if(check()){
                    ans=1;
                }
            
        }
    }
    if(ans)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint A,B;
  cin>>A>>B;
  lint ans=0;
  for(lint i=A;i<(lint)4*((A/4)+1);i++)ans=ans^i;
  for(lint i=(lint)4*(B/4);i<=B;i++)ans=ans^i;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n];
  cin>>a[0];
  int max=a[0];
  for(int i=1;i<n;i++)
  {
    cin>>a[i];
    if(a[i]>max)
      max=a[i];
    if(a[i]<max)
    {
      if(max-a[i]>1)
      {
        cout<<"No";
        return 0;
      }
    
  }
  }
  cout<<"Yes";
  
  return 0;
}

Measured memory_bytes: 640
import copy
import math
import collections

inf = (10 ** 9) + 7
n, m = map(int, input().split())
prime_dict = {}
m_copy = copy.deepcopy(m)
while (m_copy % 2 == 0):
    m_copy = int(m_copy // 2)
    if 2 not in prime_dict.keys():
        prime_dict[2] = 1
    else:
        prime_dict[2] += 1
for i in range(3, int(math.sqrt(m)) + 1, 2):
    while (m_copy % i == 0):
        m_copy = int(m_copy // i)
        if i not in prime_dict.keys():
            prime_dict[i] = 1
        else:
            prime_dict[i] += 1
if m_copy != 1:
    if m_copy not in prime_dict.keys():
        prime_dict[m_copy] = 1
    else:
        prime_dict[m_copy] += 1
b = list(prime_dict.values())
ans = 1

dp = [[1 for _ in range(30)] for _ in range(n)]
for i in range(1, 30):
    for j in range(1,n):
        dp[j][i] = (dp[j - 1][i] + dp[j][i - 1]) % inf

for bb in b:
    ans *= dp[n - 1][bb]
    ans = ans % inf
print(ans)

Measured memory_bytes: 130932
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin() , v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)


int main(){
    int d; cin >> d;
    string ans;
    if(d==25) ans = "Christmas";
    else if(d==24) ans = "Christmas Eve";
    else if(d==23) ans = "Christmas Eve Eve";
    else ans = "Christmas Eve Eve Eve";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    string s;
    cin >> s;
    int n = SZ(s);

    rep(i, n - 1){
        if(s[i] == 'A' && s[i+1] == 'C'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
	int K, S;
	int x, y, z;
	int n, N=0;

	scanf("%d %d",&K,&S);

	
	for(x=0; x<=K; x++){
		
		for(y=0; y<=K; y++){
			
			n=S-x-y;
			if(0<=n&&n<=K) N=N+1;
		}
	}
	printf("%d",N);



	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, X: int, A: "List[int]"):
    L = [0] * (N+1)
    for a in A:
        L[a] = 1
    print(min(sum(L[0:X]),sum(L[X+1:])))

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    X = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, X, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
gets.to_i.times{h=Hash.new{0}
gets.to_i.times.map{gets}.map{|p|p.scan(/../).each_with_index{|s,i|h[Rational(i,p.size/2)]+=s.hex if"00"!=s}}
d=h.keys.map(&:denominator).inject(1){|r,l|r.lcm l}
puts d>1024?"Too complex.":d.times.map{|i|(f=h[Rational(i,d)])?format("%02X",f):"00"}*""}

Measured memory_bytes: 7116
#include <bits/stdc++.h>  // ver2.1.9
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define Pii pair<int,int>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lW,0,a.size()){Vout(a[lW]);}
#define INF 9000000000000000000  //  9.0 * 10^18
#define MOD 1000000007  //  10^9 + 7
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void uniq(Vi &v){sort(ALL(v)); v.erase(unique(ALL(v)),v.end());}  //  uniqのやつ

int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}

int f(int n){
  int m;
  if(n%4==1) m = 1;
  if(n%4==2) m = 1^n;
  if(n%4==3) m = 0;
  if(n%4==0) m = n;
  return m;
}

signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(16);
  int a,b;
  cin >> a >> b;
  if(a==0) a++;
  a--;
  int ans;
  ans = f(a)^f(b);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

/*
グラフの表現 隣接行列による表現
*/

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeScanner(8192)
	n := eGetInt(scanner)
	g := make([][]int, n+1)
	for i := 1; i < n+1; i++ {
		g[i] = make([]int, n+1)
		ints := eGetInts(scanner)
		num := ints[0]
		for j := 0; j < ints[1]; j++ {
			g[num][ints[j+2]] = 1
		}
	}
	dist := make([]int, n+1)
	for i := 0; i < len(dist); i++ {
		dist[i] = -1
	}
	q := []int{}

	// 訪問する
	q = append(q, 1)
	dist[1] = 0

	// キューが空でない限り
	for len(q) > 0 {
		// 先頭を取り出す
		top := 0
		top, q = q[0], q[1:]
		// 隣接マスを入れる.
		for i := 1; i < n+1; i++ {
			// 辺がある
			if g[top][i] == 1 {
				if dist[i] == -1 {
					// 訪問済みでなければ
					q = append(q, i)
					dist[i] = dist[top] + 1
				}
			}
		}
	}
	for i := 1; i < n+1; i++ {
		fmt.Println(i, dist[i])
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}



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



Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <cctype>

using namespace std;

int main(){
  string str;
  getline(cin,str);
  for(int i=0; i < str.size(); ++i){
    if(isupper(str[i])){
       str[i] = tolower(str[i]);
       continue;
     }
    if(islower(str[i])) str[i] = toupper(str[i]);
  }
  cout << str << endl;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 1000000;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

/*------------------------------------------------------------------*/


int main(){
    int n; cin >> n;
    vector<int> x(n), y(n);
    rep(i, n){
        cin >> x[i];
        y[i] = x[i];
    }
    sort(y.begin(), y.end());
    rep(i, n){
        if(x[i] < y[n / 2]) cout << y[n / 2] << endl;
        else cout << y[n / 2 - 1] << endl; 
    }
}

Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, K;
	cin >> N >> K;

	vector<pair<Int, Int>> ab(N);
	for (Int i = 0; i < N; i++) {
		cin >> ab[i].first >> ab[i].second;
	}

	sort(ab.begin(), ab.end());

	Int count = 0;
	Int num = 0;

	while (count < K) {
		count += ab[num].second;
		num++;
	}

	cout << ab[num - 1].first << "\n";
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple


int main() {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t,k;
	cin>>t>>k;
	if(k!=1&&t!=1)
	cout<<((t*k)+1)/2<<endl;
	else
	cout<<1<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    ll a, b, k;
    cin >> a >> b >> k;

    ll x, y;
    x = max((ll)0, a - k);
    y = max((ll)0, b + min((ll)0, a - k));
    printf("%lld %lld\n", x, y);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
int i;
int j;
int N;
int count = 0;
cin >> N;
int A[N];
for(i=0;i<N;i++)cin >> A[i];
sort(A,A+N);
for(i=0;i<N-1;i++){
     if(A[i]==A[i+1]){
         count++;
         break;
     }
 }
if(count>0)cout << "NO" << endl;
else{cout << "YES"<< endl;}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int d;
  cin >> d;
  if(d == 25) cout << "Christmas" << endl;
  if(d == 24) cout << "Christmas Eve" << endl;
  if(d == 23) cout << "Christmas Eve Eve" << endl;
  if(d == 22) cout << "Christmas Eve Eve Eve" << endl;
  return 0;
}

Measured memory_bytes: 256