akhauriyash/Code-Regression huggingface dataset:
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
ll bit[200002],n;
ll sum(ll i){
    ll s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
        //cout<<s<<" "<<i<<endl;
    }
    return s;
}
void add(ll i,ll x){
    while(i<=n){
        bit[i]+=x;
        i+=i&-i;
    }
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    /*cin>>n;ll q;cin>>q;
    //vector<ll>a(n+1);
    for(int i=1;i<=n;i++)
        cin>>bit[i];
    while(q--){
        char c;
        cin>>c;
        if(c=='Q'){
            int a,b;cin>>a>>b;
            //cout<<sum(b[i])<<endl;
            cout<<sum(bit[b])-sum(bit[a-1])<<endl;
        }
        else{
            int a,b,d;
            cin>>a>>b>>d;
            for(int i=a;i<=b;i++)
                add(i,d);
        }
    }*/
    cin>>n;ll q;cin>>q;
    while(q--){
        int c;cin>>c;ll a,b;cin>>a>>b;
        if(c==0){
            add(a,b);
        }
        else
            cout<<sum(b)-sum(a-1)<<endl;
    }
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------



Measured memory_bytes: 3960
#include<bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long LL;
int arr[212121], dp[12121];	

int main() {
	int N, P;
	string S;
	LL ans = 0;
	cin >> N >> P >> S;
	if (P == 2) {
		int idx = 1;
		for (auto i : S) {
			int x = i - '0';
			if (x % 2 == 0) ans += idx;
			idx++;
		}
		cout << ans << "\n";
		return 0;
	} else if (P == 5) {
		int idx = 1;
		for (auto i : S) {
			int x = i - '0';
			if (x % 10 == 0 || x % 10 == 5) ans += idx;
			idx++;
		}
		cout << ans << "\n";
		return 0;
	}
	int tmp = 1;
	for (int i = N - 1; i >= 0; i--) {
		int x = S[i] - '0';
		arr[i] = (tmp * x) % P;
		tmp *= 10;
		tmp %= P;
	}
	dp[0] = 1;
	int pre = 0;
	for (int i = 0; i < N; i++) {
		pre += arr[i];
		pre %= P;
		ans += dp[pre];
		dp[pre]++;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 1412
import java.util.Scanner;

class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int e = sc.nextInt();

        String result = (e-a <= sc.nextInt()) ? "Yay!" : ":(";
        System.out.println(result);
    }
}

Measured memory_bytes: 21332
#include <iostream>
using namespace std;
int se[100];
int dish[100];
int buf[100];
int main() {
    int n,tmp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>tmp;
        se[i]=tmp-1;
    }
    for(int i=0;i<n;i++)
        cin>>dish[i];
    for(int i=0;i<n-1;i++)
        cin>>buf[i];
    int pre=-1,now=0,sum=0;
    for(int i=0;i<n;i++){
        if(pre == se[i] - 1){
            sum += buf[pre];
            //cout<<sum<<end;;
        }
        sum += dish[se[i]];
        pre = se[i];
        //cout<<sum<<endl;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#define LL long long
using namespace std;

int n,m,l;
LL f[305][305],a[305][305];

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c<'0'||c>'9')&&c!='-')c=getchar();
	if(c=='-')t=-1,c=getchar();
	while(c>='0'&&c<='9')s=s*10+c-'0',c=getchar();
	return s*t;
}

int main(void){
	n=read();
	m=read();
	l=read();
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
		if(i!=j)a[i][j]=f[i][j]=1e17+0ll;
	}
	for(int i=1;i<=m;i++){
		int x,y,z;
		x=read();
		y=read();
		z=read();
		f[x][y]=f[y][x]=z;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(i==j||j==k||i==k)continue;
				f[i][j]=min(f[i][j],f[i][k]+f[k][j]);
			}
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
		if(i!=j&&f[i][j]<=l)a[i][j]=1;
	}
	for(int k=1;k<=n;k++){
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++)
			a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
		}
	}
	int q;
	scanf("%d",&q);
	while(q--){
		int i,j;
		i=read();
		j=read();
		if(a[i][j]==1e17+0ll)printf("-1\n");
		else printf("%d\n",a[i][j]-1);
	}
}

Measured memory_bytes: 1920
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var k = cin.nextInt();

            var ans = 0.0;
            for (int i = 1; i <= n; i++)
            {
                var p = 1.0 / n;
                var now = i;
                while (now < k)
                {
                    now *= 2;
                    p /= 2;
                }
                ans += p;
            }

            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}


Measured memory_bytes: 13140
N, M = map(int, input().split())
a = list(map(int, input().split()))
for k in range(N):
  a[k] //= 2

foo = 1
while a[0]%2 == 0:
  foo *= 2
  a[0] //= 2
for k in range(1, N):
  if a[k] % foo == 0 and a[k]%(2*foo) !=0:
    a[k] //= foo
    continue
  else:
    print(0)
    exit()
ans = 0

for odd in [3, 5, 7, 11]:
  flag = False
  for k in range(N):
    if a[k]%odd == 0:
      a[k] //= odd
      flag = True
  if flag:
    foo *= odd
 
 
def euclid(a, b):
  while b:
    a, b = b, a%b
  return a

lcm = a.pop()
for k in range(1, N):
  b = a.pop()
  lcm = lcm * b // euclid(lcm, b)
  if lcm* foo > M:
    print(0)
    exit()
lcm *= foo
ans = int((M / lcm -1)//2 + 1)
print(ans)



Measured memory_bytes: 19964
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int n;
    cin >> n;
    ll tmp = 0;
    int cnt = 0;
    while (tmp < n)
    {
        cnt++;
        tmp += cnt;
    }
    for (int i = 1; i <= cnt; i++)
    {
        if (tmp - n == i)
            continue;
        cout << i << "\n";
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
 
using namespace std;
 
long long gcd(long long a,long long b){
  if(b==0) return a;
  return gcd(b,a%b);
}
  
int main(){
 
  long long a[3],m[3];
  long long c[3];
  long long n;
  long long ans;
 
  while(1){
 
    cin>>a[0]>>m[0]>>a[1]>>m[1]>>a[2]>>m[2];
    if(a[0]==0) break;
 
    for(int i=0;i<3;i++){
      n=(1*a[i])%m[i];
      c[i]=1;
      while(1){
    if(n==1) break;
    c[i]++;
    n=(n*a[i])%m[i];
      }
    }
 
    ans=c[0];
    ans=(ans*c[1])/(gcd(max(c[1],ans),min(c[1],ans)));
    ans=(ans*c[2])/gcd(max(c[2],ans),min(c[2],ans));
 
    cout<<ans<<endl;
  }
 
}

Measured memory_bytes: 1156
#include <iostream>
#include <algorithm>
#include <vector>
#include "string"

using namespace std;

typedef long long ll;

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

    int N;
    string s;
    cin >> N;
    cin >> s;
    string comp(N, '#');
    vector<int> ans(N+1);
    int back, forw;
    for (int i = 0; i <= N; i++) {
        if (i != 0) comp[i-1] = '.';
        if (i == 0) {
            back = 0;
            forw = 0;
            for (int j = 0; j < N; j++) {
                if (comp[j] != s[j]) forw++;
            }
        } else {
            if (comp[i-1] != s[i-1]) back++;
            else forw--;
        }
        ans[i] = back + forw;
    }
    int min = *min_element(ans.begin(), ans.end());
    cout << min << endl;

    return 0;
}


Measured memory_bytes: 1556
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int A, B, K; cin >> A >> B >> K;
    int i = min(A, B);
    while (K) {
        if (A % i == 0 && B % i == 0) {
            K--;
        }
        i--;
    }
    cout << i + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int a,b,c;

	cin>>a>>b>>c;

	cout<<a*b/2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,x,f,m,i,j;
string s;
int main()
{
  for(cin>>s;i<s.size();i++)if(s[i]=='A')break;
  for(j=s.size()-1;j>-1;j--)if(s[j]=='Z')break;
  cout<<max(0,j-i+1)<<endl;
}

Measured memory_bytes: 640
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char) 
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
    
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n: i32 = read();
  for i in 1..10 {
    for j in 1..10 {
      if i * j == n {
        println!("Yes");
        return;
      }
    }
  }
  
  println!("No");
}

Measured memory_bytes: 4352
#include<iostream>

#define MAX_WAIGHT 10000

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	int* w = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> w[i];
	}
	int left, right, mid;
	left = 0;
	right = MAX_WAIGHT * (n / k + 1);
	int waight,cnt_track,cnt_luggage;
	while ((right - left) > 1) {
		mid = (right + left) / 2;
		cnt_track = 1;
		cnt_luggage = 0;
		waight = 0;
		while (cnt_track <= k && cnt_luggage<n) {
			if (w[cnt_luggage] > mid) {
				cnt_track = k + 1;
				break;
			}
			if (w[cnt_luggage] > mid - waight) {
				cnt_track++;
				waight = w[cnt_luggage];
			}
			else {
				waight += w[cnt_luggage];
			}
			cnt_luggage++;
		}
		if (cnt_track > k) {
			left = mid;
		}
		else {
			right = mid;
		}
	}
	cout << right << endl;
}


Measured memory_bytes: 3488
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) std::begin(a), std::end(a)
#define RALL(a) std::rbegin(a), std::rend(a)
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define INT(x) (static_cast<int>(x))
#define PRECISION(x) std::fixed << std::setprecision(x)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

constexpr int INF = 2e9;
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);

constexpr int dx[] = {-1, 0, 1, 0};
constexpr int dy[] = {0, -1, 0, 1};

template <typename T>
constexpr int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
constexpr int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T, typename U>
constexpr void chmax(T& m, U x) {
	m = max(m, x);
}

template <typename T, typename U>
constexpr void chmin(T& m, U x) {
	m = min(m, x);
}

template <typename T>
constexpr T square(T x) {
	return x * x;
}

int main() {
	int a;
	cin >> a;
	cout << a + a * a + a * a * a << endl;
	return 0;
}


Measured memory_bytes: 3620
N,Y=map(int,input().split())
count=0
a=0
for i in range(N+1):
    for k in range(N+1):
        a=N-i-k
        if i*10000+k*5000+a*1000==Y and a>=0:
            print(str(i)+" "+str(k)+" "+str(a))
            exit(0)
print("-1 -1 -1")

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define mod (1000000000+7)
#define N (10007)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

int ans[500][500];
char s[500][500];
bool exist[500];

int main(void){
    int h,w,k;
    for(int i=0;i<500;i++)exist[i]=false;
    cin>>h>>w>>k;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>s[i][j];
            if(s[i][j]=='#')exist[i]=true;
        }
    }
    int index=0;
    for(int i=0;i<h;i++){
        if(!exist[i])continue;
        index++;
        bool flag=false;
        bool first=false;
        for(int j=0;j<w;j++){
            if(!first){
                if(!flag){
                    if(s[i][j]=='#')flag=true;
                    ans[i][j]=index;
                }
                else{
                    if(s[i][j]=='#'){
                        index++;
                        ans[i][j]=index;
                        flag=false;
                        first=true;
                    }
                    else ans[i][j]=index;
                }
            }
            else{
                if(s[i][j]!='#')ans[i][j]=index;
                else{
                    index++;
                    ans[i][j]=index;
                }
            }
        }
    }
    if(h>=2){
        for(int i=0;i<h;){
            if(!exist[i]){
                if(i==0){
                    int j=i;
                    while(true){
                        if(i==h)break;
                        if(!exist[i])i++;
                        else break;
                    }
                    for(int k=j;k<i;k++){
                        for(int x=0;x<w;x++){
                            ans[k][x]=ans[i][x];
                        }
                    }
                }
                else{
                    int ass=i-1;
                    int j=i;
                    while(true){
                        if(i==h)break;
                        if(!exist[i])i++;
                        else break;
                    }
                    for(int k=j;k<i;k++){
                        for(int x=0;x<w;x++){
                            ans[k][x]=ans[ass][x];
                        }
                    }
                }
            }
            else i++;
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cout<<ans[i][j]<<" ";
        }
        cout<<endl;
    }
    return 0;
}


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

using namespace std;

#define int long long
#define PB push_back
#define MP make_pair
#define ALL(V) V.begin(), V.end()
#define RALL(V) V.rbegin(), V.rend()
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
typedef pair<pii, pii> pipi;

constexpr int INF = 1LL << 60;
constexpr int MOD = 1000000007;
constexpr int MAX_N = 1005;
constexpr int dx[] = { 0, 1, 0, -1 };
constexpr int dy[] = { 1, 0, -1, 0 };

int hoge[MAX_N], n;

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

    cin >> n;
    for (int i = 2; i <= n; ++i) {
        int t = i;
        for (int j = 2; j <= i; ++j) {
            int cnt = 0;
            while (t % j == 0) {
                t /= j;
                cnt++;
            }
            hoge[j] += cnt;
        }
    }

    int ans = 1;
    for (int i = 1; i <= n; ++i) {
        if (hoge[i] == 0) continue;
        ans *= hoge[i] + 1;
        ans %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;
ll dub[25][100010] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,L,Q;
    ll X[100010], A[100010], B[100010];
    cin >> N;
    rep(i,0,N) cin >> X[i];
    cin >> L >> Q;
    rep(i,0,Q){
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        if(A[i] > B[i]) swap(A[i], B[i]);
    }
    ll next_pos[100010] = {};
    rep(i,0,N){
        ll pos = upper_bound(X, X+N, X[i] + L) - X;
        next_pos[i] = pos-1;
    }
    // printa(next_pos, N);
    rep(i,0,N){
        dub[0][i] = next_pos[i];
    }
    rep(k,0,20){
        rep(i,0,N){
            if(dub[k][i] == -1){
                dub[k+1][i] = -1;
            }else{
                dub[k+1][i] = dub[k][dub[k][i]];
            }
        }
    }
    rep(i,0,Q){
        ll lv = 0, rv = N+1;
        while(rv - lv > 1){
            ll mid = (rv + lv) / 2;
            ll p = A[i];
            rrep(k,19,0){
                if((mid >> k) & 1){
                    p = dub[k][p];
                }
            }
            if(p >= B[i]){
                rv = mid;
            }else{
                lv = mid;
            }
        }
        print(rv);

    }


}


Measured memory_bytes: 22400
#include <iostream>

using namespace std;
int main() {
    int N;
    int A[100] = {0};
    int B[100];
    cin >> N;
    for (int i=0; i<N-1; i++) cin >> B[i];

    A[0] = B[0];
    for (int i=0; i<N-2; i++) {
        A[i+1] = min(B[i], B[i+1]);
    }
    A[N-1] = B[N-2];

    int ans = 0;
    for (int i=0; i<N; i++) ans += A[i];
    cout << ans << endl;
    return 0;
}



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

#define REP(i, n) for(ll i=0;i<ll(n); i++)

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

    vector<ll> H;
    vector< vector<int> > data(N);

    int i, j;
    for(i=0;i<N;i++){
        ll hi;
        cin >> hi;
        H.push_back(hi);
    }

    for(i=0;i<M;i++){
        int a, b;
        cin >> a >> b;
        data.at(a-1).push_back(b-1);
        data.at(b-1).push_back(a-1);
    }


    bool flag = 0;
    int count = 0;
    ll height_i, height_j;
    for(i=0;i<N;i++){
        flag = 0;
        height_i = H.at(i);
        if(data.at(i).size() == 0){count += 1;}
        for(j=0;j<data.at(i).size();j++){
            height_j = H.at(data.at(i).at(j));
            if(height_i <= height_j){flag = 0; break;}
            flag = 1;
        }
        if(flag == 1){count += 1;}

    }
    cout << count << endl;


    return 0;
}


Measured memory_bytes: 8844
/*
Author : N_o_o_B
Created : April 22 2020 22:01:25 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n,m;
    cin >> n >> m;
    vi cnt(m);
    fori(i,n){
        int k;
        cin >> k;
        while(k--){
            int x;
            cin >> x;
            cnt[--x]++;
        }
    }
    int ans = 0;
    fori(i,m){
        ans += (cnt[i]==n);
    }
    cout << ans << endl;



    time_taken();
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    A,B,C=map(int,input().split())
    YesNo(A<=C<=B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 3000000000000000000;

#include <random>

int score;
vector<int> c, t;
vector<vector<int>> s;
vector<set<int>> S1, S2;

int kaeru_val(int d, int q) {
    int sco = score;
    sco -= s[d][t[d]];
    sco += s[d][q];
    int x = *(S2[t[d]].upper_bound(-d));
    x *= (-1);
    int y = *(S1[t[d]].upper_bound(d));
    sco += c[t[d]] * (d - x - 1) * (d - x) / 2;
    sco += c[t[d]] * (y - d - 1) * (y - d) / 2;
    sco -= c[t[d]] * (y - x - 1) * (y - x) / 2;
    x = *(S2[q].upper_bound(-d));
    x *= (-1);
    y = *(S1[q].upper_bound(d));
    sco += c[q] * (y - x - 1) * (y - x) / 2;
    sco -= c[q] * (d - x - 1) * (d - x) / 2;
    sco -= c[q] * (y - d - 1) * (y - d) / 2;
    return sco;
}

void kaeru(int d, int q) {
    score -= s[d][t[d]];
    score += s[d][q];
    int x = *(S2[t[d]].upper_bound(-d));
    x *= (-1);
    int y = *(S1[t[d]].upper_bound(d));
    score += c[t[d]] * (d - x - 1) * (d - x) / 2;
    score += c[t[d]] * (y - d - 1) * (y - d) / 2;
    score -= c[t[d]] * (y - x - 1) * (y - x) / 2;
    x = *(S2[q].upper_bound(-d));
    x *= (-1);
    y = *(S1[q].upper_bound(d));
    score += c[q] * (y - x - 1) * (y - x) / 2;
    score -= c[q] * (d - x - 1) * (d - x) / 2;
    score -= c[q] * (y - d - 1) * (y - d) / 2;
    S1[t[d]].erase(d);
    S2[t[d]].erase(-d);
    S1[q].insert(d);
    S2[q].insert(-d);
    t[d] = q;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int D;
    cin >> D;
    c = vector<int>(26);
    s = vector<vector<int>>(D, vector<int>(26));
    rep(i, 26) cin >> c[i];
    rep(i, D) rep(j, 26) cin >> s[i][j];
    
    random_device rd;
    mt19937 mt(rd());
    uniform_int_distribution<int> dist1(0, D - 1);
    uniform_int_distribution<int> dist2(0, 25);
    
    t = vector<int>(D, 0);
    rep(i, D) score += s[0][i];
    REP(i, D) score -= (D + 1) * D / 2 * c[i];
    S1 = S2 = vector<set<int>>(26);
    rep(i, D) {
        S1[t[i]].insert(i);
        S2[t[i]].insert(-i);
    }
    rep(i, 26) {
        S1[i].insert(-1);
        S2[i].insert(1);
        S1[i].insert(D);
        S2[i].insert(-D);
    }
    
    rep(_, 2000000) {
        int x = dist1(mt);
        int y = dist2(mt);
        if (kaeru_val(x, y) > score) kaeru(x, y);
    }
    
    // cout << "Score: " << score << "\n";
    rep(i, D) cout << t[i] + 1 << "\n";
    
    return 0;
}



Measured memory_bytes: 3768
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <random>
#include <array>
#include <chrono>
#include <cmath>
#include <memory>
#include <map>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

using llint=long long;

llint scoring(vector<llint> c,
            vector<vector<llint>> s,
            vector<llint> result,
            llint d=365){
    
    if(c.size()!=s[0].size()||s.size()!=result.size()){
  
        return -1;
    }else{
        llint score=0;
        vector<llint>held(26,1);
        REP(i,d){
            score+=s[i][result[i]-1];
            REP(j,26){
                if(j+1!=result[i]){
                    held[j]++;
                    
                }else{held[j]=0;}
                score-=c[j]*held[j];
            }
        }
         
        return score;
    }
 }

int main(){
    chrono::system_clock::time_point start, end;
    std::random_device rnd;     // 非決定的な乱数生成器を生成
    std::mt19937 mt(rnd());     //  メルセンヌ・ツイスタの32ビット版、引数は初期シード値
    start = chrono::system_clock::now();
    llint d;
    cin>>d;
    std::uniform_int_distribution<> rand26(1, 26),randd(0,d-1);        // [0, 99] 範囲の一様乱数
    
    llint anum=26;
    vector<llint> c(anum);
    
    REP(i,anum){
        cin>>c[i];
    }
    vector<vector<llint>> s(d,vector<llint>(anum));
    REP(i,d){
        REP(j,anum){
            cin>>s[i][j];
        }
    }
    vector<llint> result(d);

    REP(i,d){
        result[i]=rand26(mt);
    }
    double time;
    auto newresult=result;
    while(( time = static_cast<double>(chrono::duration_cast<chrono::microseconds>(
        ( chrono::system_clock::now()) - start).count()
        ))<1900000.){
        newresult=result;
        REP(i,26){
            newresult[randd(mt)]=rand26(mt);
        }
        if(scoring(c,s,newresult,d)>scoring(c,s,result,d)){
            result=newresult;
        }
        //cout<<"unko"<<endl;
    }
   //  cout<<scoring(c,s,result,d)<<endl;
    REP(i,d){
        cout<<result[i]<<endl;
    }
}


Measured memory_bytes: 3452
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <map>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

bool check(string s1, string s2) {
    map<char, char> mcc;
    REP(i, s1.length()) {
        if (mcc.find(s1[i]) == mcc.end()) mcc[s1[i]] = s2[i];
        else if (mcc[s1[i]] != s2[i]) return false;
    }
    return true;
}

int main() {
    string S, T;
    cin >> S >> T;
    if (check(S, T) && check(T, S)) cout << "Yes" << endl;
    else                            cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	int N;
	cin >> N;
	ll pow2[N + 1];
	pow2[0] = 1;
	for (int i = 1;i <= N;i++)
		pow2[i] = pow2[i - 1] * 2 % mod;
	map<pll, int> p, n;
	int cntz = 0, l = 0, r = 0;
	for (int i = 0;i < N;i++) {
		ll a, b;
		cin >> a >> b;
		bool pos = 1;
		if (a < 0) {
			a = abs(a);
			pos = !pos;
		}
		if (b < 0) {
			b = abs(b);
			pos = !pos;
		}
		ll g = __gcd(a, b);
		if (g == 0) {
			cntz++;
			continue;
		}
		if (a == 0) {
			l++;
			continue;
		}
		if (b == 0) {
			r++;
			continue;
		}
		a /= g;
		b /= g;
		if (pos)
			p[{a, b}]++;
		else
			n[{a, b}]++;
	}
	ll ans = 1;
	N -= cntz;
	for (auto x : p) {
		int a = x.se;
		int b = n[{x.fi.se, x.fi.fi}];
		N -= (a + b);
		ans = ans * (pow2[a] + pow2[b] - 1) % mod;
	}
	ans = ans * (pow2[l] + pow2[r] - 1) % mod;
	N -= (l + r);
	ans = ans * pow2[N] % mod;
	cout << (ans + mod - 1 + cntz) % mod << '\n';
}


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

vector<vector<int>> adj(100005);
int dp[100005];

int dfs(int node)
{
    if(dp[node]!=-1)
    {
        return dp[node];
    }
    
    dp[node]=0;
    for(int i=0;i<adj[node].size();i++)
    {
        int child=adj[node][i];
        dp[node]=max(1+dfs(child),dp[node]);
    }
    return dp[node];
}


int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int a,b;
        cin>>a>>b;
        adj[a].push_back(b);
    }
    
    memset(dp,-1,sizeof(dp));
    
    for(int i=1;i<=n;i++)
    {
        int node=i;
        if(dp[node]==-1)
            dfs(node);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        ans=max(ans,dp[i]);
    }
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 7424
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>
#include <climits>

using namespace std;



int main(void)
{
    string s;
    int len,i,num;
    int dif=INT_MAX;
    int target=753;

    cin >> s;
    len=s.size();

    //部分文字列の生成
    //substr()を使う。第一引数で部分文字列の開始indexを、
    //第二引数で部分文字列の長さを指定する。
    
    for( i = 0 ; i < len ; i++ )
    {
        int tmp=INT_MAX ;  

        num=stoi(s.substr(i,3));
        if( num < target )
        {
            tmp=target-num;
        }
        else
        {
            tmp=num-target;
        }

        if(tmp<dif){
            dif=tmp;
        }

    }

    printf("%d",dif);
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
    string s;
    cin>>s;
    if(s=="ABC")
    {
        cout<<"ARC"<<endl;

    }
    else
        cout<<"ABC"<<endl;
    return 0;
}


Measured memory_bytes: 3612
from itertools import combinations_with_replacement

N, M, Q = map(int, input().split(' '))

a = [None]
b = [None]
c = [None]
d = [None]

for _ in range(Q):
    x, y, z, w = map(int, input().split(' '))
    a.append(x)
    b.append(y)
    c.append(z)
    d.append(w)

max_score = 0

for A in combinations_with_replacement(range(1, M + 1), r=N):
    A = [None, *A]
    score = 0
    for i in range(1, Q + 1):
        if A[b[i]] - A[a[i]] == c[i]:
            score += d[i]
    max_score = max(score, max_score)

print(max_score)

Measured memory_bytes: 9172
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>

using namespace std;

int main(){
    while(1){
    int n,x,flag=0;
    cin>>n>>x;
    if(n==0&&x==0)break;
    if(n>=x)n=x-3;
       for(int i=1;i<=n;i++){
       for(int j=i+1;j<n;j++){
          if(x-(i+j)>j&&x-(i+j)<=n)flag++;
       }
   }
   cout<<flag<<endl;
}
}


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

  public static void main(String[] args) {
    // TODO 自動生成されたメソッド・スタブ
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringBuilder sb = new StringBuilder();
    try {
      String strNum = br.readLine();
      sb.append(strNum + ":");
      int number = Integer.parseInt(strNum);
      
      int devideNum = 2; 
      while (number % devideNum == 0) {
        sb.append(" ");
        sb.append(devideNum);
        number /= 2;
      }
     
      devideNum++;
      while (number != 1) {
        if (number % devideNum == 0) {
          sb.append(" ");
          sb.append(devideNum);
          number /= devideNum;
        } else {
          devideNum +=2;
        }
      }

        
//      for (int i= devideNum; i <= number; i++) {
//        if (number < devideNum) {
//          break;
//        }
//        devideNum = i;
//        while ((number % devideNum) == 0) {
//          number /= devideNum;
//          sb.append(" ");
//          sb.append(devideNum);
//        }
//      }
      
    } catch (IOException e) {
      // TODO 自動生成された catch ブロック
      e.printStackTrace();
    }
    System.out.println(sb.toString());
  }

}



Measured memory_bytes: 24716
//
//  atcoder.cpp
//
//
///
#include <bits/stdc++.h>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor.hpp>
#include <boost/algorithm/string.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) (void)0; const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;

using ll = long long;
namespace bst = boost;
template<typename T> class in {
    T value;
public:
    in() { cin >> value; }
    operator const T&() const { return value; }
    operator T&() { return value; }
    in& operator=(T source) { value = source; return *this; }
};
template<> class in<string> : public string {
public:
    in() { cin >> *this; }
};
template<class T> class inseq : public T {
public:
    template<typename... Arg> inseq(Arg... arg) : T(forward<Arg>(arg)...) { for (auto&& i : *this) cin >> i; }
};
template<class T> using invec = inseq<vector<T>>;

auto solve() {
  in<ll> H, W;

   if (H == 1 || W == 1)
     return 1LL;

  return (H * W) / 2LL + (H* W) % 2LL;
}

template<typename T> void plot(const T& func) { cout << func() << endl; }
template<> void plot<void()>(void(&func)()) { func(); }
template<> void plot<double()>(double(&func)()) { cout << setprecision(9) << func() << endl; }

int main() {
  plot(solve);

  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <cctype>
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr ll INF = 3000000000000000000;

int main() {
    ll N, M;
    cin >> N >> M;
    if (M < 2 * N) {
        cout << M / 2 << "\n";
    } else {
        cout << N + (M - 2 * N) / 4 << "\n";
    }
    return 0;
}


Measured memory_bytes: 3628
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	while (1) {
		auto n = readln.chomp.to!int;
		if (n == -1) break;
		n.to!string(4).writeln;
	}
}

Measured memory_bytes: 1044
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }

int main() {
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	a--; b--; c--; d--;
	string s;
	cin >> s;
	if (c < b) {
		bool flag = true;
		FOR(i, a, d) {
			if (s[i] == '#' && s[i + 1] == '#') {
				flag = false;
			}
		}
		if (flag) {
			put("Yes");
		}
		else {
			put("No");
		}
	}
	else if (c < d) {
		bool flag = true;
		FOR(i, a, d) {
			if (s[i] == '#' && s[i + 1] == '#') {
				flag = false;
			}
		}
		if (flag) {
			put("Yes");
		}
		else {
			put("No");
		}
	}
	else {
		bool flag = true;
		FOR(i, a, c) {
			if (s[i] == '#' && s[i + 1] == '#') {
				flag = false;
			}
		}
		if (!flag) {
			put("No");
			return 0;
		}
		bool flag2 = false;
		FOR(i, b-1, d) {
			if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') {
				flag2 = true;
				break;
			}
		}
		if (flag2) {
			put("Yes");
		}
		else {
			put("No");
		}
	}
	return 0;
}


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

using namespace std;

int main(){
  int A = 0;
  int B = 0;
  int C = 0;
  int N = 0;
  int M = 0;
  cin >> N;
  if (N <= 999)
    cout << "ABC" << endl;
  else cout << "ABD" << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {

		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
			int n = Integer.parseInt(br.readLine());
			String[] tmp = br.readLine().split(" ");
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = Integer.parseInt(tmp[i]);
			}
			int q = Integer.parseInt(br.readLine());
			tmp = br.readLine().split(" ");
			int cnt = 0;
			for (int i = 0; i < q; i++) {
				int key = Integer.parseInt(tmp[i]);
				if (binarySearch(s, key) != -1) {
					cnt++;
				}
			}
			System.out.println(cnt);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	static int binarySearch(int[] s, int key) {
		int left = 0;
		int right = s.length;
		int mid = (left + right) / 2;

		while (left < right) {
			mid = (left + right) / 2;
			if (s[mid] == key) {
				return mid;
			} else if (key < s[mid]) {
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;

	}

}



Measured memory_bytes: 51268
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	
	static final int MAX = 1000001;
	static int[] cant;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		cant = new int[MAX];
		for (int i = 0; i < N; i++) {
			int tmp = sc.nextInt();
			cant[tmp]++;
		}
		int ans = cant[1] == 1 ? 1 : 0;
		for (int i = 2; i < MAX; i++) if (cant[i] == 1) {
			boolean can = cant[1] == 0;
			for (int div = 2; div * div <= i && can; div++) {
				if (i % div == 0 && (cant[div] > 0 || cant[i / div] > 0)) {
					can = false;
					break;
				}
			}
			if (can) ans++;
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}


Measured memory_bytes: 58192
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
using namespace std;
int main(){
    int k,t;
    cin>>k>>t;
    
    if(500*k>=t)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

using namespace std;
using ll = long long;

int main() {
    int X;
    cin >> X;
    vector<bool> prime(1000001,1);
    prime.at(0) = prime.at(1) = 0;
    for(int i = 2; i < 1000001; i++) {
        if(X <= i && prime.at(i)) {
            cout << i << endl;
            return 0;
        }
        if(prime.at(i)) {
            for(int j = 2; j*i < 1000001; j++) {
                prime.at(j*i) = 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3724
c1 = list(map(int, input().split(' ')))
c2 = list(map(int, input().split(' ')))
c3 = list(map(int, input().split(' ')))


check_b12 = c1[0] - c2[0] == c1[1] - c2[1] == c1[2] - c2[2]
check_b13 = c1[0] - c3[0] == c1[1] - c3[1] == c1[2] - c3[2]

check_a12 = c1[0] - c1[1] == c1[0] - c1[1] == c2[0] - c2[1]
check_a13 = c1[0] - c1[2] == c1[0] - c1[2] == c2[0] - c2[2]

if check_a12 and check_a13 and check_b12 and check_b13:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n, q;
    ll s = 0;
    cin >> n;
    map<int, int> mp;
    for(int i = 0;i < n;i++) {
        int a;
        cin >> a;
        mp[a]++;
        s += a;
    }
    cin >> q;
    for(int i = 0; i < q; i++) {
        int b, c;
        cin >> b >> c;
        mp[c] += mp[b];
        s += (c - b) * mp[b];
        mp[b] = 0;
        cout << s << endl;
    }
    return;
}

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

Measured memory_bytes: 8008
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

ll N, K;
ll A[200000];
ll sum;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> K;
    for(int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    if(sum-N <= K){
        cout << 1 << endl;
        return 0;
    }
    ll l = 1, r = 1e9;
    while(r-l > 1){
        ll c = (l+r)/2;
        ll tmp = 0;
        for(int i = 0; i < N; i++){
            tmp += (A[i]+c-1)/c;
            tmp--;
        }
        if(tmp <= K) r = c;
        else l = c;
    }
    cout << r << endl;
}

Measured memory_bytes: 5144
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int a[100100];
int main()
{
	int n,p=0;cin>>n;rep(i,n) cin>>a[i];a[n]=0;sort(a,a+n+1);
	rep(i,n){
		//cout<<a[i]<<endl;
		if((a[i+1]-a[i])%2>0) p^=n-i;
	}
	if(p==0) cout<<"second"<<endl;else cout<<"first"<<endl;
}


Measured memory_bytes: 640