akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#include<map>
#include<algorithm>
using namespace std;
typedef long long int ll;
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return 1; }return 0; }
#define all(a)  (a).begin(),(a).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define vll vector<ll>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i]>>y[i];
const ll INF =1LL << 62;
int main(){
  ll N,A,B,C,D,E;
  cin >> N >> A >> B >> C >> D >> E;
  ll ans=0;
  if(min({A,B,C,D,E})== A){
    if(N%A !=0)
      ans +=(N-N%A+A)/A+4;
    else
      ans +=N/A +4;
    cout << ans << endl;
    return 0;
  }
   if(min({A,B,C,D,E})== B){
    if(N%B !=0)
      ans +=(N-N%B+B)/B+4;
    else ans += N/B +4;
    cout << ans << endl;
    return 0;
  }
   if(min({A,B,C,D,E})== C){
    if(N%C !=0)
      ans +=(N-N%C+C)/C+4;
    else ans += N/C +4;
    cout << ans << endl;
    return 0;
  }
   if(min({A,B,C,D,E})== D){
    if(N%D !=0)
      ans +=(N-N%D+D)/D+4;
    else ans += N/D +4;
    cout << ans << endl;
    return 0;
  }
   if(min({A,B,C,D,E})== E){
    if(N%E !=0)
      ans +=(N-N%E+E)/E+4;
    else ans += N/E +4;
    cout << ans << endl;
    return 0;
  }
}
    

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#include <array>
#include <unordered_set>
#include <queue>
using namespace std;

#define si static inline
#define gcu getchar_unlocked
si int in() {
	int n = 0, c = gcu();
	// bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	return n; }
	// return minus ? -n : n; }
si void scan(char *s) {while (!isspace(*s++ = gcu()));}
#define pcu putchar_unlocked
#define svo si void out
template <typename T>
svo(T n) {
	static char buf[20];
	char *p = buf;
	//if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
svo(const char *s){while(*s)pcu(*s++);}
svo(char *s){while(*s)pcu(*s++);}
svo(char c){pcu(c);}
//template <typename T>
//svo(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
//svo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
template <typename head, typename... tail>
svo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef svo
#undef si

struct board {
	enum {size = 4};
	struct pos {int r, c;};
	typedef array<array<int, size>, size> arr;

	arr b;
	pos p;
	int f, g, h;

	void read() {
		for (int i = 0; i < size; i++)
			for (int j = 0; j < size; j++) {
				b[i][j] = in();
				if (!b[i][j])
					p.r = i, p.c = j;
			}
		g = 0;
		f = h = hn(b);
	}

	void print() {
		for (auto &r: b) {
			for (int &c: r)
				out(&c == &r[0]?"":" ", c);
			out('\n');
		}
		out('\n');
	}

	static int hn(const arr &a) {
		int l = 0;
		for (int i = 0; i < size; i++)
			for (int j = 0; j < size; j++) {
				if (!a[i][j])
					continue;
				int k = a[i][j] - 1;
				l += abs(i - k / size) + abs(j - k % size);
			}
		return l;
	}

	static int key(const arr &a) {
		int k = 0;
		for (auto &r: a)
			for (int c: r)
				k = (k * 10) + c;
		return k;
	}

	int solver() {
		static const pos to[] = {-1, 0, 0, -1, 1, 0, 0, 1};
		unordered_set<int> m;
		priority_queue<board> q;
		q.push(*this);
		while (!q.empty()) {
			board a = q.top();
			q.pop();
			int k = key(a.b);
			if (m.count(k))
				continue;
			m.insert(k);
			if (!a.h)
				return a.g;
			for (pos o: to) {
				o.r += a.p.r, o.c += a.p.c;
				if (0 <= o.r && o.r < size && 0 <= o.c && o.c < size) {
					board c = a;
					swap(c.b[a.p.r][a.p.c], c.b[o.r][o.c]);
					c.g += 1;
					c.h = hn(c.b);
					c.f = c.g + c.h;
					c.p = o;
					q.push(c);
				}
			}
		}
		return -1;
	}
};

bool operator < (const board &a, const board &b) {
	return a.f > b.f;
}

int main() {
	board b;
	b.read();
	out(b.solver(), '\n');
}



Measured memory_bytes: 206232
from sys import stdin
N = int(stdin.readline().rstrip())
A = [0]+[int(_) for _ in stdin.readline().rstrip().split()]+[0]
S = sum(abs(A[i+1]-A[i]) for i in range(N+1))
for i in range(1,N+1):
    print(S-abs(A[i-1]-A[i])-abs(A[i]-A[i+1])+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14048
#include <stdio.h>
#include <math.h>
#define N_MAX 10000

int isPrime(int x)
{
  int i;
  if (x <= 3) {
    return 1;
  } else if (x % 2 == 0) {
    return 0;
  } else {
    for (i = 3; i <= sqrt(x); i = i + 2) {
      if (x % i == 0) {
        return 0;
      }
    }
    return 1;
  }
}

int main(int argc, char *argv[])
{
  int i, j, n, x;
  int answer = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    answer = answer + isPrime(x);
  }
  printf("%d\n", answer);
  return 0;
}


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

struct PotentialUnionFind {
    vector<int> p;
    vector<ll> w;

    PotentialUnionFind(int n) : p(n, -1), w(n, 0) {
    }

    // w[v] - w[u] = weight
    bool UnionSet(int u, int v, ll weight) {
        int ru = root(u);
        int rv = root(v);
        if (ru == rv) return w[u] - w[v] == weight;

        w[ru] = weight - w[u] + w[v];
        p[rv] += p[ru];
        p[ru] = rv;
        return true;
    }

    pair<ll, int> find(int u, int v) {
        int ru = root(u);
        int rv = root(v);
        if (ru != rv) return {0, -1};
        return {w[u] - w[v], 0};
    }

    bool isSame(int u, int v) {
        return root(u) == root(v);
    }

    int size(int x) {
        return -p[root(x)];
    }
    int root(int x) {
        if (p[x] < 0) {
            return x;
        } else {
            int r = root(p[x]);
            w[x] += w[p[x]];
            p[x] = r;
            return r;
        }
    }

};

void solve() {
    int N, M;
    cin >> N >> M;
    PotentialUnionFind uf(N);
    for (int i = 0; i < M; i++) {
        int l, r; ll d;
        cin >> l >> r >> d;
        l--, r--;
        if (!uf.UnionSet(l, r, d)) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;

}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,i=0,j,c=0,p,h[1000010],m=0,max=0;
    string s;
    cin >> s;
    c=s.size();
    for(i=0;i<c;i++)
    {
        if(s.at(i)=='A'||s.at(i)=='C'||s.at(i)=='G'||s.at(i)=='T')
        {
            m++;
        }
        else
        {
            m=0;
        }
        if(max<m)
        {
            max=m;
        }
    }
    cout << max << endl;
    return 0;

}


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


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

double calcarea(int a, int b) {
	return (double)(a + b)/8.0;
}

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

	vector<int> t(n);
	vector<int> v(n);

	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		sum += t[i];
	}

	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}

	vector<int> limitspeed(sum*2+1,INF);
	
	int now = 0;
	for (int i = 0; i < n; i++) {
		for (int j = now; j <= t[i]*2+now; j++) {
			limitspeed[j] = min(limitspeed[j], v[i]*2);
		}

		now += t[i] * 2;
	}
	
	limitspeed[0] = 0;
	for (int i = 0; i < sum * 2; i++) {
		limitspeed[i + 1] = min(limitspeed[i + 1], limitspeed[i] + 1);
	}

	limitspeed[sum * 2] = 0;
	for (int i = sum * 2; i >0 ; i--) {
		limitspeed[i-1] = min(limitspeed[i-1], limitspeed[i] + 1);
	}

	double ans = 0.0;

	for (int i = 0; i < sum * 2; i++) {
		ans += calcarea(limitspeed[i], limitspeed[i + 1]);
	}

	cout << fixed << setprecision(12) << ans << endl;


	return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

hash = Hash.new { |h,k| h[k] = 0 }

N = get_int
N.times do |i|
  key = gets.chomp
  hash[key] += 1
end
M = get_int
M.times do |i|
  key = gets.chomp
  hash[key] -= 1
end

puts [0, *hash.values].max


Measured memory_bytes: 14416
/**
 * neb, sw=8, ts=8
 *
 */

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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;

using std::cout;	using std::cin;
using std::endl;

template<typename T>
inline T max(const T &x, const T &y) { if (x > y) return x; else return y; }

template<typename T>
inline T min(const T &x, const T &y) { if (x < y) return x; else return y; }

template<typename T>
inline void print_vec(const std::vector<T> &a) { for (auto i: a) { std::cout << i << " "; } std::cout << std::endl; }

int main()
{
	ui a;
	cin >> a;

	ui b;
	cin >> b;

	if (a <= 12 && a >= 6)
	{
		cout << b / 2 << endl;
	}
	else if (a <= 5)
	{
		cout << 0 << endl;
	}
	else {
		cout << b << endl;
	}
}


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

using namespace std;
typedef long long ll;

int n;
char s[110];

int main(void)
{
	scanf("%d", &n);
	scanf("%s", s);
	
	if(n >= strlen(s))
	{
		printf("%s", s);
		return 0;
	}
	
	else
	{
		for(int i = 0 ; i < n ; i++)
			printf("%c", s[i]);
		printf("...");
		return 0;
	}
	
	return 0;
}

Measured memory_bytes: 3828
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

tenki = input()

if tenki[0] == 'R' and tenki[1] == 'R' and tenki[2] == 'R':
  ans = 3
elif (tenki[0] == 'R' and tenki[1] == 'R') or (tenki[2] == 'R' and tenki[1] == 'R'):
  ans = 2
elif tenki[0] == 'R' or tenki[1] == 'R' or tenki[2] == 'R':
  ans = 1
else:
  ans = 0
  
print(ans)

Measured memory_bytes: 9008
#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
bool p[300001];
int main(){
	p[1]=1;
	rep(i,43000)if(i%7==1||i%7==6)if(!p[i])for(int j=i+i;j<300001;j+=i)p[j]=1;
	int n;
	while(cin>>n,n-1){
		cout<<n<<":";
		rep(i,n+1)if(i%7==1|i%7==6&&!p[i]&&n%i==0)cout<<" "<<i;
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main()
{
  int A,B,C,D,num1,num2;
  scanf("%d%d%d%d",&A,&B,&C,&D);
  num1=0;
  num2=0;
  while(C>0)
   {
     C=C-B;
     num1=num1+1;
   }
  while(A>0)
   {
     A=A-D;
     num2=num2+1;
   }
  if(num1<=num2)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }
}
        
          

Measured memory_bytes: 1696
#https://beta.atcoder.jp/contests/abc075
# -*- coding: utf-8 -*-
h,w = map(int,input().split())
bomb = []
for _ in range(h):
    n = list(list(input()))
    bomb.append(n)

for y in range(h):
    for x in range(w):
        if bomb[y][x] == '.':
            counter = 0
            for yy in list([-1,0,1]):
                if y == 0 and yy == -1: continue
                if y == h-1 and yy == 1: continue
                for xx in list([-1,0,1]):
                    if x == 0 and xx == -1: continue
                    if x == w-1 and xx == 1: continue
                    try:
                        if bomb[y+yy][x+xx]=='#': counter += 1
                    except IndexError:
                        counter += 0
            bomb[y][x] = counter

for y in range(h):
    string = ''
    for x in range(w): string += str(bomb[y][x])
    print(string)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define all(x) (x).begin(),(x).end()
int INF = 1000000000;

int main() {
  int H, W; cin >> H >> W;
  vector<vector<char>> b(H+2, vector<char>(W+2));
  vector<vector<string>> ans(H, vector<string>(W));

  rep(i, H+2) {
    rep(j, W+2) {
      if (i == 0 || i == H+1 || j == 0 || j == W+1) {
        b[i][j] = '.';
      }
      else {
        cin >> b[i][j];
      }
    }
  }
  rep2(i, 1, H+1) {
    rep2(j, 1, W+1) {
      int cnt = 0;
      if (b[i][j] == '#') {
        ans[i-1][j-1] = '#';
      }
      else {
        rep2(k, -1, 2) {
          rep2(l, -1, 2) {
            if (b[i+k][j+l] == '#') {
              cnt++;
            }
          }
        }
      ans[i-1][j-1] = to_string(cnt);
      }
    }
  }
  rep(i, H) {
    rep(j, W) {
      cout << ans[i][j];
      if (j == W-1) {
        cout << endl;
      }
    }
  }
}

Measured memory_bytes: 384
//#pragma GCC oplmize(2)
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define sc(x) scanf("%lld",&x)
#define scs(x) scanf("%s",x+1)
#define pr(x) printf("%lld\n",x)
#define prs(x) printf("%s\n",x)
using namespace std;
const int maxn=2e5+5;
const int mod=1e9+7;
const double pi=acos(-1.0);
const double eps = 1e-8;
ll t,n,x,ss;
string s;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>s;
    for(int i=0;i<s.size();i++){
        ss=ss+(s[i]-'0');
    }
    if(ss%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3764
a=input()
b=input()
d=zip(a,b)
e="".join(i[0]+i[1] for i in d)
if len(a)==len(b):
	print(e)
elif len(a)>len(b):
  	print(e+a[-1])
elif len(a)<len(b):
  	print(e+b[-1])

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    char s[6];
    ll ans=0;
    for(ll i=0;i<6;++i){
        cin>>s[i];
        if(s[i]=='1'){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
#include <cmath>
#define _USE_MATH_DEFINES
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
int main(){
  ll R;
  cin>>R;
  printf("%.5lf\n", R*2*M_PI);
  return 0;
}


Measured memory_bytes: 3228
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

LL gcd(LL a, LL b){
    if(b == 0) return a;
    return gcd(b,a%b);
}

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    int H,A;
    cin >> H >> A;
    int ans=0;
    while(H>0){
        ++ans;
        H-=A;
    }      
    cout << ans;
}

Measured memory_bytes: 256
program name
    implicit none
    integer(4):: n
    integer(4),allocatable:: h(:)
    integer(4):: i,nmax,ans

    read*, n
    allocate(h(n))
    read*, h(:)
    nmax = 0
    ans = 0
    do i=1,n
        if (h(i) >= nmax) then
            nmax = h(i)
            ans=ans+1
        end if
    end do

    print*, ans
end program name

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  if (n < 1000)
    cout << "ABC" << endl;
  else
    cout << "ABD" << endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
cnt = 0
b = []
for i in range(N):
    cnt += A[i]*(-1)**i
    b.append(cnt)
ans = [0]*N
for i in range(N):
    if i%2 == 0:
        ans[i] = b[N-1]
        if i-1 >= 0:
            ans[i] -= 2*b[i-1]
    else:
        ans[i] = -b[N-1]
        if i-1 >= 0:
            ans[i] += 2*b[i-1]
print (*ans)

Measured memory_bytes: 17688
//set many funcs
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1145141919
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int a,b,c,d,dat[128]={0},i,r=0;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for(i=a;i<b;i++){dat[i]++;}
    for(i=c;i<d;i++){dat[i]++;}
    for(i=0;i<=127;i++){if(dat[i]==2){r++;}}
    printf("%d\n",r);
    return 0;
}

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

using namespace std;
#define int long long

int a[100001];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n , k , s;
    cin >> n >> k >> s;
    for(int i = 1; i <= k; i ++) {
        a[i] = s;
    }
    if(s != 1e9) {
        s ++;
    }
    else {
        s = 1;
    }
    for(int i = k + 1; i <= n; i ++) {
        a[i] = s;
    }
    for(int i = 1; i <= n; i ++) {
        cout << a[i] << ' ';
    }
    return 0;
}


Measured memory_bytes: 2176
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	string s; cin >> s;
    rep(i, 2) {
        if(s[i] != s[i + 1]) {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

int main(){
  long long int   N;
  cin >> N;	
  vector<long long int> L(N);
  for(long long int i = 0; i < N; i++) cin >> L[i];
  
  if(N < 3){
    cout << 0 << endl;
    return 0;
  }
  
  sort(L.begin(),L.end());
  long long int ans = 0;
  for(long long int i = 2; i < N; i++){
    for(long long int j = 1; j < i; j++){
      for(long long int k = 0; k < j; k++){
        if(L[i] != L[j] && L[j] != L[k] && L[k] != L[i] && L[j] + L[k] > L[i]) ans++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const ll INF=1e18;
int n,a[100];
ll dfs(int l,int r,int x,int y){
	if(l>r) return 0;ll ret=INF;
	FOR(i,l,r) ret=min(ret,dfs(l,i-1,x,x+y)+dfs(i+1,r,x+y,y)+1ll*(x+y)*a[i]);
	return ret;
}
int main(){
	scanf("%d",&n);
	FOR(i,1,n) scanf("%d",&a[i]);
	cout<<dfs(2,n-1,1,1)+a[1]+a[n]<<'\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <cassert>
#include <cctype>
#include <cstdlib>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<ll,ll> P;
ll mod=1e9+7;
string s;
stack<P> st;
P lp_=P(-1,0),rp_=P(-2,0),and_=P(-3,0),or_=P(-4,0),not_=P(-5,0),e=P(1,1);
P calcnot(P p){
	bool rev=false;
	while(!st.empty()&&st.top()==not_) st.pop(),rev=!rev;
	if(!rev) return p;
	return P(p.sc,p.fs);
}
P calcand(P a,P b){
	return P(a.fs*b.fs%mod,(a.fs*b.sc+a.sc*b.fs+a.sc*b.sc)%mod);
}
P calcor(P a,P b){
	return P((a.fs*b.fs+a.fs*b.sc+a.sc*b.fs)%mod,(a.sc*b.sc)%mod);
}
int main(){
	cin>>s;
	s="("+s+")";
	int it=0;
	while(it<s.size()){
		if(s[it]!='x'){
			if(s[it]=='(') st.push(lp_);
			if(s[it]==')'){
				P a=st.top();st.pop();
				P b=st.top();st.pop();
				if(b==lp_){
					st.push(calcnot(a));
				}else{
					P c=st.top();st.pop();
					P d=st.top();st.pop();
					if(d==lp_){
						if(b==and_){
							st.push(calcnot(calcand(c,a)));
						}else if(b==or_){
							st.push(calcnot(calcor(c,a)));
						}else{
							assert(false);
						}
					}else{
						P f=st.top();st.pop();
						P g=st.top();st.pop();
						st.push(calcnot(  calcor(f,calcand(c,a))  ));
					}
				}
			}
			if(s[it]=='&'){
				P a=st.top();st.pop();
				P b=st.top();st.pop();
				if(b==lp_||b==or_){
					st.push(b);
					st.push(a);
					st.push(and_);
				}else{
					P c=st.top();st.pop();
					assert(b==and_);
					st.push(calcand(c,a));
					st.push(and_);
				}
			}
			if(s[it]=='|'){
				P a=st.top();st.pop();
				P b=st.top();st.pop();
				if(b==lp_){
					st.push(b);
					st.push(a);
					st.push(or_);
					it++;
					continue;
				}else if(b==and_){
					P c=st.top();st.pop();
					st.push(calcand(c,a));
				}else if(b==or_){
					P c=st.top();st.pop();
					st.push(calcor(c,a));
				}else{
					assert(false);
				}
				continue;
			}
			if(s[it]=='~') st.push(not_);
			it++;
			continue;
		}
		it++;
		while(isdigit(s[it])) it++;
		bool rev=false;
		st.push(calcnot(e));
	}
	P p=st.top();
	cout<<p.fs<<endl;
}

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

int main() {
    ll N;
    cin >> N;
    ll ans = 0;
    while(1){
        if(pow(2,ans+1)>N){
            break;
        }else{
            ans++;
        }
    }
    cout << pow(2,ans) << endl;
}


Measured memory_bytes: 256
//................ DON'T WISH IT WERE EASIER, WISH YOU WERE BETTER........................
//............ WHEN LIFE PUTS YOU IN TOUGH SITUATIONS, DONT SAY "WHY ME" SAY "TRY ME".......

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define pb emplace_back
#define endl "\n"
#define f first
#define mp make_pair
#define s second
#define int long long
#define delrep(v)  (v).erase(unique((v).begin(),(v).end()),(v).end());
#define all(a)  (a).begin(),(a).end()
#define allr(a) (a).rbegin(),(a).rend()
#define sz(x)   (int)x.size()
#define lll __int64
const int N=1e6+10;
const int mod=998244353;
using namespace std;
typedef long long ll;
const long long MAX_SIZE = 3000003;
vector<pair<int,int>>v[N]; map<int,int>hashx;
vector<int>a(N); vector<int>b(N); int pref[N]; int suff[N]; int sum[N];
// vector<ll>dp(N);
ll n,k;
ll dp[N][105];
int32_t main()
{
   int n,weight; cin>>n>>weight;
   for(int i=1;i<=n;i++) cin>>a[i]>>b[i]; 
   for(int i=1;i<=N;i++) for(int j=0;j<=n;j++) dp[i][j]=1e18;
   for(int i=1;i<=N;i++) for(int j=1;j<=n;j++)
   {
    dp[i][j]=dp[i][j-1];
    if(i>=b[j]) dp[i][j]=min(dp[i][j],dp[i-b[j]][j-1]+a[j]);
   }
   ll ans=0;  
   for(int i=0;i<=N;i++) if(dp[i][n]<=weight) ans=max(i,ans);
   cout<<ans; return 0;
}
 
 

Measured memory_bytes: 862592
A = [[j for j in list(map(int, input().split()))] for i in range(3)]
N = int(input())
B = []
for _ in range(N):
	b = int(input())
	for r in A:
		for i in range(len(r)):
			if r[i] == b:
				r[i] = 0
ans = False
for i in range(3):
	if sum(A[i]) == 0:
		ans = True
if not ans:
	for i in range(3):
		if A[0][i] + A[1][i] + A[2][i] == 0:
			ans = True
if not ans:
	if A[0][0] + A[1][1] + A[2][2] == 0:
		ans = True
	elif A[0][2] + A[1][1] + A[2][0] == 0:
		ans = True
if ans:
	print('Yes')
else:
	print('No')


Measured memory_bytes: 9120
N, x = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
ans = 0
if a[0] + a[1] > x:
    count = a[0] + a[1] - x
    ans += min(a[1], count)
    a[1] -= min(a[1], count)
    if a[0] + a[1] > x:
        count = a[0] + a[1] - x
        ans += min(a[0], count)
        a[0] -= min(a[0], count)
for i in range(1, N - 1):
    if a[i] + a[i + 1] > x:
        count = a[i] + a[i + 1] - x
        a[i + 1] -= count
        ans += count
print(ans)


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

#define MOD (1000 * 1000 * 1000 + 7)
typedef long long ll;
typedef long double ld;

int main() {
	
	int n, l;
	scanf("%d%d\n", &n, &l);
	
	vector<string> words(n);
	for(int i = 0; i < n; ++i)
		getline(cin, words[i]);
	
	sort(words.begin(), words.end());
	
	for(auto &i : words)
		cout << i;
	cout << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		long N=sc.nextLong();
		long K=sc.nextLong();
		int sz=0;
		while(N>0) {
			N/=K;
			++sz;
		}
		System.out.println(sz);
	}
	
	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
	
}


Measured memory_bytes: 21844
import numpy as np
N = int(input())
A = np.array(list(map(int,input().split())))

MOD = 10**9 + 7
ans = 0

for i in range(60):
    a = (A >> i) & 1
    count0 = np.count_nonzero(a)
    count1 = N - count0
    tmp = 2**i
    n = count0 * count1
    tmp = tmp * n
    ans += tmp
    ans = ans % MOD
print(ans)

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

int main(){
    int N;
    cin >> N;
    int A1[N];
    int A2[N];
    for (int i=0; i<N; i++){
        cin >> A1[i];
    }
    for (int i=0; i<N; i++){
        cin >> A2[i];
    }
    int sumTemp = A1[0];
    for (int i : A2){
        sumTemp += i;
    }
    int maxValue = sumTemp;
    for (int i=1; i<N; i++){
        sumTemp += A1[i] - A2[i-1];
        if (sumTemp > maxValue) maxValue = sumTemp;
    }
    cout << maxValue;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll x,y,a,b,c,ans;
vector<ll> v1,v2,v3;
int main()
{
    cin>>x>>y>>a>>b>>c;
    for(int i=1;i<=a;++i)
    {
        ll temp;
        cin>>temp;
        v1.push_back(temp);
    }
    for(int i=1;i<=b;++i)
    {
        ll temp;
        cin>>temp;
        v2.push_back(temp);
    }
    for(int i=1;i<=c;++i)
    {
        ll temp;
        cin>>temp;
        v3.push_back(temp);
    }
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    for(int i=a-1;i>a-1-x;--i)
        v3.push_back(v1[i]);
    for(int i=b-1;i>b-1-y;--i)
        v3.push_back(v2[i]);
    sort(v3.begin(),v3.end());
    ll len=v3.size();
    for(int i=len-1;i>len-1-x-y;--i)
        ans+=v3[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 7920
n, k = gets.split.map(&:to_i)
s = gets.chomp.chars
result = 0
(n-1).times do |i|
  if s[i] == s[i+1]
    result += 1
  end
end

result += k * 2
if result >= n
  puts n-1
else
  puts result
end


Measured memory_bytes: 6908
a = input()
b = input()
c = input()

ac = 0
bc = 0
cc = 0

turn = 'a'

while True:
	if turn=='a':
		if ac==len(a):
			print('A')
			break
		else:
			turn = a[ac]
			ac += 1
	elif turn=='b':
		if bc==len(b):
			print('B')
			break
		else:
			turn = b[bc]
			bc += 1
	elif turn=='c':
		if cc==len(c):
			print('C')
			break
		else:
			turn = c[cc]
			cc += 1

Measured memory_bytes: 3064
o = [2]
t = [4, 6, 9, 11]
ttt = [1, 3, 5, 7, 8, 10, 12]
x, y = map(int, input().split())
if x in o and y in o:
    print("Yes")
elif x in t and y in t:
    print("Yes")
elif x in ttt and y in ttt:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h>
 
typedef struct _card {
    int number;
    char suit;
} CARD;
 
CARD A[100000], I[100000];
char inputs[1000000];
char *ptr = inputs;
 
void exchange(CARD *a, CARD *b);
int Partition(CARD A[], int p, int r);
void Quicksort(CARD A[], int p, int r);
 
int nextInt(void) {
    int v = 0;
    while (*ptr < '0' || *ptr > '9') ++ptr;
    while (*ptr >= '0' && *ptr <= '9') {
        v = v * 10 + (int)(*ptr - '0');
        ++ptr;
    }
    return v;
}
 
char nextSuit(void) {
    while (*ptr < 'A' || *ptr > 'Z') ++ptr;
    return *ptr;
}
 
int main(void) {
    int n;
    int stable = 1;
    int i, j, c, d;
     
    fread(inputs, sizeof(char), 1000000, stdin);
     
    n = nextInt();
     
    for (i = 0; i < n; ++i) {
        A[i].suit = nextSuit();
        A[i].number = nextInt();
        I[i] = A[i];
    }
     
    Quicksort(A, 0, n - 1);
     
    for (i = 0; i < n; ++i) {
        if (i == 0) {
            c = 0;
        } else if (A[i].number != A[i - 1].number) {
            c = 0;
        } else {
            ++c;
        }
        d = 0;
        for (j = 0; j < n; ++j) {
            if (I[j].number == A[i].number) {
                if (c == d) {
                    if (I[j].suit != A[i].suit) {
                        stable = 0;
                    }
                    break;
                }
                ++d;
            }
        }
        if (stable == 0) {
            break;
        }
    }
     
    if (stable == 1) {
        puts("Stable");
    } else {
        puts("Not stable");
    }
     
    for (i = 0; i < n; ++i) {
        printf("%c %d\n", A[i].suit, A[i].number);
    }
     
    return 0;
}
 
void exchange(CARD *a, CARD *b) {
    CARD t = *a;
    *a = *b;
    *b = t;
}
 
int Partition(CARD A[], int p, int r) {
    CARD x = A[r];
    int i = p - 1;
    int j;
    for (j = p; j < r; ++j) {
        if (A[j].number <= x.number) {
            ++i;
            exchange(&A[i], &A[j]);
        }
    }
    exchange(&A[i + 1], &A[r]);
    return i + 1;
}
 
void Quicksort(CARD A[], int p, int r) {
    int q;
    if (p < r) {
        q = Partition(A, p, r);
        Quicksort(A, p, q - 1);
        Quicksort(A, q + 1, r);
    }
}


Measured memory_bytes: 3992
#include <stdio.h>
int main()
{
   	int n;
   	char input[10000000];
   	scanf("%d", &n);
   	scanf("%s", input);
   	
   	for(int i = 0; input[i] != '\0'; i++)
   	{
   		for(int j = 0; j < n; j++)
		{
		 	if(input[i] == 90)
			{
			 	input[i] -= 26;	
			 	input[i]++;
		    } else
		    {
		    	input[i]++;
			}
		}
		printf("%c", input[i]);	
	}
	
	return 0;
} 

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

long long N, A[5009], U[5009], V[5009], dp[5009][5009][2], dp2[5009][5009][2], VV[5009];
vector<int>X[5009]; bool used[5009];

void dfs2(int pos) {
	VV[pos] += 1;
	for (int i = 0; i < X[pos].size(); i++) {
		if (VV[X[pos][i]] >= 1) continue;
		dfs2(X[pos][i]);
		VV[pos] += VV[X[pos][i]];
	}
}

void dfs(int pos) {
	used[pos] = true; vector<int>Y;
	for (int i = 0; i < X[pos].size(); i++) {
		if (used[X[pos][i]] == true) continue;
		dfs(X[pos][i]);
		Y.push_back(X[pos][i]);
	}

	for (int i = 0; i <= Y.size(); i++) { for (int j = 0; j <= VV[pos]; j++) { dp2[i][j][0] = (1LL << 60); dp2[i][j][1] = (1LL << 60); } }
	if (A[pos] >= 1) dp2[0][0][0] = A[pos]; else dp2[0][0][1] = A[pos];

	int S = 0;
	for (int i = 0; i < Y.size(); i++) {
		for (int j = 0; j <= S; j++) {
			if (dp2[i][j][0] != (1LL << 60)) {
				for (int l = 0; l <= VV[Y[i]]; l++) {
					dp2[i + 1][j + l][0] = min(dp2[i + 1][j + l][0], dp2[i][j][0] + dp[Y[i]][l][0]);
					dp2[i + 1][j + l][1] = min(dp2[i + 1][j + l][1], dp2[i][j][0] + dp[Y[i]][l][1]);
					if (dp[Y[i]][l][0] < (1LL << 58) || dp[Y[i]][l][1] < 0) {
						dp2[i + 1][j + l + 1][0] = min(dp2[i + 1][j + l + 1][0], dp2[i][j][0]);
					}
				}
			}
			if (dp2[i][j][1] != (1LL << 60)) {
				for (int l = 0; l <= VV[Y[i]]; l++) {
					dp2[i + 1][j + l][1] = min(dp2[i + 1][j + l][1], dp2[i][j][1] + dp[Y[i]][l][0]);
					dp2[i + 1][j + l][1] = min(dp2[i + 1][j + l][1], dp2[i][j][1] + dp[Y[i]][l][1]);
					if (dp[Y[i]][l][0] < (1LL << 58) || dp[Y[i]][l][1] < 0) {
						dp2[i + 1][j + l + 1][1] = min(dp2[i + 1][j + l + 1][1], dp2[i][j][1]);
					}
				}
			}
		}
		S += VV[Y[i]];
	}
	for (int i = 0; i <= VV[pos]; i++) {
		dp[pos][i][0] = dp2[Y.size()][i][0];
		dp[pos][i][1] = dp2[Y.size()][i][1];
	}
}

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	for (int i = 1; i <= N - 1; i++) {
		cin >> U[i] >> V[i];
		X[U[i]].push_back(V[i]);
		X[V[i]].push_back(U[i]);
	}
	dfs2(1);
	for (int i = 1; i <= N; i++) { for (int j = 0; j <= N; j++) { dp[i][j][0] = (1LL << 60); dp[i][j][1] = (1LL << 60); } }
	dfs(1);

	int maxn = (1 << 30);
	for (int i = 0; i <= N; i++) {
		if (dp[1][i][0] < (1LL << 58) || dp[1][i][1] < 0) { maxn = min(maxn, i); }
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 784256
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <numeric>
#include <string>
#include <cstring>
#include <cmath>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long int int64;

const int N = (int) 1e5 + 100;
int a[N];
int na[N];
const int SZ = (1<<20);
int qu[SZ];
bool used[SZ];


int main(int,  char **)
{
#ifdef LOCAL
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif


	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i] );

	long long sum = 0;
	long long sb = 0;
	for (int i = 0; i < k; i++)
	{
		sb += max(a[i], 0);
		sum += a[i];
	}
	long long all = 0;
	for (int i = 0; i < n; i++)
		all += max(a[i], 0);
	long long ans = 0;
	for (int i = 0; i <= n - k; i++)
	{
		long long cur = all - sb + max(sum, 0LL);
		ans = max(cur, ans);

		sb -= max(a[i], 0);
		sb += max(a[i + k], 0);
		sum -= a[i];
		sum += a[i + k];
	}

	printf("%lld\n", ans);
/*
	int l = 0, r = 0;
	used[0] = true;
	qu[r++] = 0;
	
	while (l < r)
	{
		int mask = qu[l++];
		for (int i = 0; i < n; i++)
			a[i] = ( (mask >> i) & 1);
		for (int i = 0; i + k <= n; i++)
		{
			for (int j = 0; j < n; j++)
				na[j] = a[j];
			for (int j = 0; j < k; j++)
				na[i + j] = 0;
			int nmask = 0;
			for (int j = 0; j < n; j++)
				nmask |= (na[j] << j);
			if (!used[nmask] )
			{
				used[nmask] = true;
				qu[r++] = nmask;
			}
			for (int j = 0; j < k; j++)
				na[i + j] = 1;
			nmask = 0;
			for (int j = 0; j < n; j++)
				nmask |= (na[j] << j);
			if (!used[nmask] )
			{
				used[nmask] = true;
				qu[r++] = nmask;
			}
		}
	}

	for (int mask = 0; mask < (1 << n); mask++)
	{
		if (!used[mask] ) continue;
		for (int i = 0; i < n; i++)
			a[i] = ( (mask >> i) & 1);
		for (int i = 0; i < n; i++)
			printf("%d ", a[i] );
		printf("\n");
	}
*/
	return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <sstream>
#include <iostream>
#include <time.h>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define ll long long
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define eps 1e-7
#define zero(x) (((x) > 0? (x):(-x)) < eps)
using namespace std;
//https://codeforces.com/contest/1238/problems
//https://codeforces.com/contest/1238/submit

struct A{
    ll x,y;
}a[1000005];
bool cmp(A a,A b){
    if(a.y > b.y){
        return true;
    }
    if(a.y == b.y && a.x > b.x){
        return true;
    }
    return false;
}
int main(){
    ll n;
    ll h;
    ll sum  = 0ll;
    ll maxi = -1ll;
    sld(n) sld(h)
    for(ll i = 0ll; i < n; i ++){
        sld(a[i].x) sld(a[i].y)
        maxi = max(a[i].x,maxi);
    }
    ll count0 = 0ll;
    sort(a,a+n,cmp);
    for(ll i = 0; i < n; i ++){
        if(a[i].y >= maxi){
            h-=a[i].y;
            count0 ++;
            if(h<=0ll){
                break;
            }
        }
    }
    if(h <= 0ll){
        pld(count0) pn
    }else{
        count0 += h/maxi;
        if(h%maxi != 0ll){
            count0 ++;
        }
        pld(count0); pn
    }



    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
#define REP(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;

int a[114514], b[114514], c[114514];
signed main() {
	int n; cin >> n;
	REP(i, n)cin >> a[i];
	REP(i, n)cin >> b[i];
	REP(i, n)cin >> c[i];
	sort(a, a + n);
	sort(b, b + n);
	sort(c, c + n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int lb = -1, ub = n;
		while (ub - lb > 1) {
			int mi = (ub + lb) / 2;
			if (a[mi] < b[i]) {
				lb = mi;
			}
			else ub = mi;
		}
		int ls = -1, us = n;
		while (us - ls > 1) {
			int mi = (us + ls) / 2;
			if (c[mi] > b[i]) {
				us = mi;
			}
			else ls = mi;
		}
		ans += ((lb+1)*(n - ls-1));
	//	cout << lb << ' ' << ub << ' ' << ls << ' ' << us << endl;
	}
	cout << ans << endl;
}

Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP2_10_A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            const int  STL_LENGTH = 32;
            long x = ReadLong();
            string[] res = new string[4];
            res[0] = Convert.ToString(x, 2).PadLeft(STL_LENGTH, '0');
            res[1] = Convert.ToString(~x, 2).PadLeft(STL_LENGTH, '0');
            res[2] = Convert.ToString(x << 1, 2).PadLeft(STL_LENGTH, '0');
            res[3] = Convert.ToString(x >> 1, 2).PadLeft(STL_LENGTH, '0');
            foreach (var item in res)
            {
                Console.WriteLine(item.Substring(item.Length - STL_LENGTH, STL_LENGTH));
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



Measured memory_bytes: 17956
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

#素因数分解
def prime_factorize(n):
    if n == 1:
        return [1]
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

n = inp()
d = defaultdict(int)
for i in range(2,n+1):
    pp = prime_factorize(i)
    for x in pp:
        d[x] += 1
res = 1
# print(d)
for va in d.values():
    res *= va+1
    res %= mod
print(res)

Measured memory_bytes: 5108