akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

int main()
{
    std::vector<std::vector<int>> a(3, std::vector<int>(3));
    for (int i = 0; i < 3; i++) {
        std::cin >> a[i][0] >> a[i][1] >> a[i][2];
    }

    int n;
    std::cin >> n;

    for (int i = 0; i < n; i++) {
        int b;
        std::cin >> b;

        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (a[j][k] == b) {
                    a[j][k] = -1;
                }
            }
        }
    }

    for (int i = 0; i < 3; i++) {
        if (a[i][0] == a[i][1] && a[i][1] == a[i][2]) {
            std::cout << "Yes" << std::endl;
            return 0;
        }

        if (a[0][i] == a[1][i] && a[1][i] == a[2][i]) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    if (a[0][0] == a[1][1] && a[1][1] == a[2][2]) {
        std::cout << "Yes" << std::endl;
        return 0;
    }

    if (a[0][2] == a[1][1] && a[1][1] == a[2][0]) {
        std::cout << "Yes" << std::endl;
        return 0;
    }

    std::cout << "No" << std::endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

AA = int(S[:2])
BB = int(S[2:])

if 0 < AA and AA <= 12 and (12 < BB or BB == 0):
    print('MMYY')
elif 0 < BB and BB <= 12 and (12 < AA or AA == 0):
    print('YYMM')
elif 0 < AA and AA <= 12 and 0 < BB and BB <= 12:
    print('AMBIGUOUS')
else:
    print('NA')


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

#ifdef LOCAL_BOOKNU
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// ........................macro.......................... //
#define FOR(i, f, n) for(int (i) = (f); (i) < (int)(n); ++(i))
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (int)(n); --(i))
#define pb push_back
#define emb emplace_back
#define fi first
#define se second
#define ENDL '\n'
#define sz(A) (int)(A).size()
#define ALL(A) A.begin(), A.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define next next9876
#define prev prev1234
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef long long i64;
typedef unsigned long long ui64;
// inline i64 GCD(i64 a, i64 b) { if(b == 0) return a; return GCD(b, a % b); }
inline int getidx(const vi& ar, int x) { return lower_bound(ALL(ar), x) - ar.begin(); } // 좌표 압축에 사용: 정렬된 ar에서 x의 idx를 찾음
inline i64 GCD(i64 a, i64 b) { i64 n; if(a < b) swap(a, b); while(b != 0) { n = a % b; a = b; b = n; } return a; }
inline i64 LCM(i64 a, i64 b) { if(a == 0 || b == 0) return GCD(a, b); return a / GCD(a, b) * b; }
inline i64 CEIL(i64 n, i64 d) { return n / d + (i64)(n % d != 0); } // 음수일 때 이상하게 작동할 수 있음.
inline i64 ROUND(i64 n, i64 d) { return n / d + (i64)((n % d) * 2 >= d); }
const i64 MOD = 1e9+7;
inline i64 POW(i64 a, i64 n) {
	assert(0 <= n);
	i64 ret;
	for(ret = 1; n; a = a*a%MOD, n /= 2) { if(n%2) ret = ret*a%MOD; }
	return ret;
}
template <class T> ostream& operator<<(ostream& os, vector<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class T> ostream& operator<<(ostream& os, set<T> v) {
	os << "[";
	int cnt = 0;
	for(auto vv : v) { os << vv; if(++cnt < v.size()) os << ","; }
	return os << "]";
}
template <class L, class R> ostream& operator<<(ostream& os, pair<L, R> p) { return os << "(" << p.fi << "," << p.se << ")"; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H, debug_out(T...); }
// ....................................................... //

const int MAXN = 8;
int n, ar[MAXN], br[3], sel[MAXN];
void input() {
	cin >> n;
	FOR(i, 0, 3) cin >> br[i];
	FOR(i, 0, n) cin >> ar[i];
}

int f(int idx) {
	if(idx == n) {
		int s[3] = { 0 };
		int ret = 0;
		FOR(i, 0, n) {
			if(sel[i] != 3) s[sel[i]] += ar[i], ++ret;
		}
		ret = (ret-3)*10;
		FOR(i, 0, 3) {
			ret += abs(s[i] - br[i]);
			if(!s[i]) return 0x7fffffff; // i나무를 고른게 없으면
		}
		return ret;
	}
	int ret = 0x7fffffff;
	FOR(i, 0, 4) {
		sel[idx] = i;
		ret = min(ret, f(idx+1));
	}
	return ret;
}

int solve() {
	cout << f(0) << ENDL;
	return 0;
}

// ................. main .................. //
void execute() {
	input(), solve();
}

int main(void) {
#ifdef LOCAL_BOOKNU
	freopen("input.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
#endif
	cin.tie(0), ios_base::sync_with_stdio(false);
	execute();
	return 0;
}
// ......................................... //

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma warning(disable:4996)
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>
#include <set>
#include <map>
#include <iomanip> 
#include <ctime>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

const double PI = 3.14159265358979323846;
const int MAX = 1e10;
const int MOD = 1e9+7;

const int MAX_N = 100005;


int main(int argc, char *args[]) {
	int  a, b; cin >> a >> b;
	if (a >= b) {
		for (int i = 0; i < a; i++) cout << b;
		cout << endl;
	}
	else {
		for (int i = 0; i < b; i++) cout << a;
		cout << endl;
	}

}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;

int main(void){
    int d,e;
    while(1){
        cin>>d>>e;
        if(d==0)break;
        int x,y;
        double mini=double(1e09),l;
        for(int i=0;i<d;i++){
            x=i;
            y=d-x;
            l=sqrt(x*x+y*y)-e;
            if(l<0)l=-l;
            mini=min(mini,l);
        }
        printf("%.4f\n", mini);
    }
    return 0;
}

Measured memory_bytes: 3136
#include <cstdio>
int main(void){
    // Here your code !
    int n;
    scanf("%d", &n);
    int nums[n];
    
    for (int i = 0; i < n; i++){
        scanf("%d", &nums[i]);
    }
    for (int i = 0; i < n; i++){
        
        if (i == n - 1){
            printf("%d\n", nums[n-1-i]);
        }
        else {
            printf("%d ", nums[n-1-i]);
        }
    }
    return 0;
}

Measured memory_bytes: 2668
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void) {
    int A, B, C;
    scanf("%d%d%d", &A, &B, &C);

    if (A<=C && C<=B) printf("Yes\n");
    else printf("No\n");

    return 0;
}

Measured memory_bytes: 128
def solve(N, M):
    if N > 2 and M > 2:
        return (N - 2) * (M - 2)
    if N == 2 or M == 2:
        return 0
    if N == 1 and M == 1:
        return 1
    return max(max(N, M) - 2, 0)


if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    print(solve(N, M))


Measured memory_bytes: 2940
// This code wrote by chtholly_micromaker(MicroMaker)
#pragma GCC optimize("Ofast,O3,inline")
#pragma GCC target("avx,avx2")
#include <bits/stdc++.h>
#define reg register
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset(x,y,sizeof x)
#define sz(x) (int)(x).size()
#define ln puts("")
#define lsp putchar(32)
#define pb push_back
#define MP make_pair
#define dbg(x) cerr<<">"<<__func__<<"\tLine: "<<__LINE__<<' '<<#x<<": "<<x<<endl
using namespace std;
template <class t> inline void read(t &s){s=0;
reg int f=1;reg char c=getchar();while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c))s=(s<<3)+(s<<1)+(c^48),c=getchar();s*=f;return;}
template<class t,class ...A> inline void read(t &x,A &...a){read(x);read(a...);}
template <class t> inline void write(t x){if(x<0)putchar('-'),x=-x;
int buf[21],top=0;while(x)buf[++top]=x%10,x/=10;if(!top)buf[++top]=0;
while(top)putchar(buf[top--]^'0');return;}
inline void setIn(string s){freopen(s.c_str(),"r",stdin);return;}
inline void setOut(string s){freopen(s.c_str(),"w",stdout);return;}
inline void setIO(string s=""){setIn(s+".in");setOut(s+".out");return;}
template <class t>inline bool checkmin(t&x,t y){if(x>y){x=y;return 1;}return 0;}
template <class t>inline bool checkmax(t&x,t y){if(x<y){x=y;return 1;}return 0;}
inline int lowbit(int x){return x&(-x);}
signed main(void)
{
	int n,k;read(n,k);
	if(k==1)
	{
		puts("0");
		return 0;
	}
	write(n-k);
	return 0;
}

/*
 * Check List:
 * 1. Input / Output File (USACO and OI and UVa)
 * 2. long long 
 * 3. Special Test such as n=1
 * 4. Array Size
 * 5. Memory Limit (OI) int is 4 and longlong is 8
 * 6. Mod (a*b%p*c%p not a*b*c%p  ,  (a-b+p)%p not a-b )
 * 7. Name ( int k; for(int k...))
 * 8. more tests , (T=2 .. more)
 * 9. blank \n after a case
*/






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

int main() {
  int n;cin>>n;
  int ans=0;
  rep(i,n){
    int a;cin>>a;
    while(1){
      if(a%2==0){
        ans++;
        a/=2;
      }
      else break;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int ans = 0;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    if (s[i] == '(')
      ans++;
    if (s[i] == ')')
      ans--;
    if (s[i] == '*') {
      cout << ans << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3216
S = list(input())
lenS = len(S)
ans = 0
for i in range(2 ** (lenS - 1)):
    formula = []
    for j in range(lenS):
        formula.append(S[j])
        if i >> j & 1:
            formula.append("+")
    ans += eval("".join(formula))
print(ans)

Measured memory_bytes: 38896
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int K = scan.nextInt();
        long ans = 0;
        for (int a = 1; a <= K; a++) {
            for (int b = 1; b <= K; b++) {
                int x = gcd(a,b);
                for (int c = 1; c <= K; c++) {
                    int y = gcd(x, c);
                    ans += y;
                }
            }
        }
        System.out.println(ans);
    }
    private int gcd(int x, int y) {
        if (y == 0) {
            return x;
        }
        return gcd(y, x % y);
    }
}


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>u(N-1),v(N-1),w(N-1);
  for(int i=0;i<N-1;i++)cin>>u[i]>>v[i]>>w[i];
  for(int i=0;i<N-1;i++)w[i]%=2;
  for(int i=0;i<N-1;i++)u[i]--,v[i]--;
  vector<vector<pii>>e(N);
  for(int i=0;i<N-1;i++)
    e[u[i]].push_back({v[i],w[i]}),e[v[i]].push_back({u[i],w[i]});

  queue<pii>q;
  q.push({0,0});
  vector<bool>used(N,false);
  used[0]=true;
  vector<int>ans(N);
  while(q.size()>0){
    int now=q.front().first;
    int c=q.front().second;
    q.pop();
    ans[now]=c;
    for(auto it:e[now]){
      if(!used[it.first])q.push({it.first,(c+it.second)%2}),used[it.first]=true;
    }
  }
  for(auto it:ans)cout<<it<<endl;
  return 0;
}


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

int dp[310][310][310];

int main() {
    string s; cin >> s;
    int k; cin >> k;
    int n = s.size();
    for (int i = 0; i < n; i++) {
        dp[i][i+1][0] = 1;
        if (i) {
            if (s[i-1] == s[i]) dp[i-1][i+1][0] = 2;
            else {
                dp[i-1][i+1][1] = 2;
                dp[i-1][i+1][0] = 1;
            }
        }
    }
    for (int len = 3; len <= n; len++) {
        for (int i = 0; i < n-len+1; i++) {
            for (int u = 0; u <= 300; u++) {
                // dp[i][i+len][u]
                if (u) dp[i][i+len][u] = max(dp[i][i+len][u], dp[i+1][i+len-1][u-1] + 2);
                dp[i][i+len][u] = max(dp[i][i+len][u], dp[i+1][i+len-1][u] + 2 * (s[i] == s[i+len-1]));
                dp[i][i+len][u] = max({dp[i][i+len][u], dp[i][i+len-1][u], dp[i+1][i+len][u]});
            }
        }
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j <= n; j++) {
            for (int z = 0; z <= k; z++) {
                ans = max(ans, dp[i][j][z]);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 112896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll a[100];
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	ll ans=0;
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<n;j++){
			ans+=a[i]*a[j];
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    string str;
    bool l, c, r;
    l = true;
    c = false;
    r = false;
    while (cin>>str) {
        char left = str[0];
        char right = str[2];
        if ((left == 'A' && right == 'B') || (left == 'B' && right == 'A')) {
            swap(l, c);
        }
        else if ((left == 'A' && right == 'C') || (left == 'C' && right == 'A')) {
            swap(l, r);
        }
        else {
            swap(c, r);
        }
    }
    if (l) cout<<'A'<<endl;
    if (c) cout<<'B'<<endl;
    if (r) cout<<'C'<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

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

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    cout << (n - 1) / 2 + 1 << "\n";
    return 0;
}

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

int main(void) {
    ll n;
    cin >> n;
    ll edge_sum = 0;
    rep(i,n-1){
        ll u,v;
        cin >> u >> v;
        if (u>v) swap(u,v);
        edge_sum += u * (n-v+1);
    }
    ll ver_sum = 0;
    rep(i,n){
        ll v = i+1;
        ver_sum += v * (n-v+1);
    }
    cout << ver_sum - edge_sum << endl;
    return 0;
}


Measured memory_bytes: 3620
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

from itertools import permutations as per
tuples = per(range(1, N+1))

a = 0
b = 0
for i, t in enumerate(tuples):
    if t == P:
        a = i
    if t == Q:
        b = i
print(abs(a - b))

Measured memory_bytes: 39280
#include<bits/stdc++.h>
#define me(a,x) memset(a,x,sizeof(a))
#define sc scanf
#define itn int
using namespace std;
const int N=1e6;
const long long mod=1e9+7;
const int oo=0x7fffffff;
const int sup=0x80000000;
typedef long long ll;
typedef unsigned long long ull;
template <typename it>void db(it *begin,it *end){while(begin!=end)cout<<(*begin++)<<" ";puts("");}
template <typename it>
string to_str(it n){string s="";while(n)s+=n%10+'0',n/=10;reverse(s.begin(),s.end());return s;}
template <typename it>int o(it a){cout<<a<<endl;return 0;}
ll mul(ll a,ll b,ll c){ll ans=0;for(;b;b>>=1,a=(a+a)%c)if(b&1)ans=(ans+a)%c;return ans;}
ll ksm(ll a,ll b,ll c){ll ans=1;for(;b;b>>=1,a=mul(a,a,c))if(b&1)ans=mul(ans,a,c);return ans;}
int main(){
	int n;
	int p[50];
	cin>>n;
	for(int i=1;i<=n;i++)cin>>p[i];
	int ans=0;
	for(int i=2;i<=n-1;i++){
		int ma=max(p[i-1],p[i+1]);
		int mi=min(p[i-1],p[i+1]);
		if(p[i]>mi&&p[i]<ma)ans++;
	}
	o(ans);
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. A-AIRPLANE.
 
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP      PIC X(100).
01 IN-DATA.
   03 DT-X1 PIC X(10).
   03 DT-X2 PIC X(10).
   03 DT-X3 PIC X(10).
01 IN-LEN.
   03 DT-L1 PIC 9(2).
   03 DT-L2 PIC 9(2).
   03 DT-L3 PIC 9(2).
01 IN-P     PIC 9(3).
01 IN-Q     PIC 9(3).
01 IN-R     PIC 9(3).
01 MIN1     PIC 9(3).
01 MIN2     PIC 9(3).
01 OUT-TIME PIC ZZ9.
 
PROCEDURE DIVISION.
MAIN-001.
  ACCEPT INP.
  UNSTRING INP DELIMITED BY ALL ' '
      INTO DT-X1 COUNT IN DT-L1
           DT-X2 COUNT IN DT-L2
           DT-X3 COUNT IN DT-L3.
  MOVE DT-X1(1:DT-L1) TO IN-P.
  MOVE DT-X2(1:DT-L2) TO IN-Q.
  MOVE DT-X3(1:DT-L3) TO IN-R.
 
  IF (IN-P < IN-Q)
    MOVE IN-P TO MIN1
    MOVE IN-Q TO MIN2
  ELSE
    MOVE IN-Q TO MIN1
    MOVE IN-P TO MIN2
  END-IF.
  IF (IN-R < MIN2)
    MOVE IN-R TO MIN2
  END-IF.

  COMPUTE OUT-TIME = MIN1 + MIN2.
  DISPLAY OUT-TIME.

MAIN-EXIT.
  STOP RUN.

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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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

int main(){
    bool flag=false;
    ll ans=LINF,sum=0;

    int h,w,klim;
    cin>>h>>w>>klim;

    vector<string> g(h);

    rep(i,h)cin>>g[i];

    bool dbM=false;

    rep(i,(1<<h-1)){ //水平方向の割りかた全探索
        ll tmp=0;
        
        int cur=i;
        vector<int> gl(h);gl[0]=0;

        if(dbM)cout<<"pat:   "<<i<<endl;
        rep(j,h-1){ //グループ分け

            if(dbM)cout<<j+1<<endl;

            if(cur%2){
                ++tmp;
                gl[j+1]=gl[j]+1;
                if(dbM)cout<<" =>"<<endl;
            }else{
                gl[j+1]=gl[j];
            }

            cur /= 2;
        }
        if(dbM)cout<<h<<"\n\n";

        int Glnum=tmp+1;

        vector<int>WhCnt(Glnum);
        vector<int>curWhCnt(Glnum);

        bool cont=false;
        bool div=false;


        int curWidth=0;
        rep(j,w){//横方向にみていく、毎回、そこに切れ目を入れるべきか判断

            fill(all(curWhCnt),0);
            rep(k,h){
                if(g[k][j]=='1'){
                    ++curWhCnt[gl[k]];
                }
            }

            cont=false;div=false;

            if(dbM)cout<<" ( ";
            rep(p,Glnum){
                
                int WhC=curWhCnt[p]+WhCnt[p];
                if(dbM)db2(p,WhC);

                if(WhC > klim){
                    div=true;
                    
                    rep(p,Glnum)if(curWhCnt[p]>klim)cont=true;

                }
            }
            if(dbM)cout<<"  ) ";
            if(cont){
                if(dbM)cout<<"cont at "<<j;
                break;//積んでいたら途中でも中断

            }

            if(div){
                curWidth=0;
                fill(all(WhCnt),0);
                ++tmp;
                if(dbM)cout<<"dvided"<<endl;
            }else{
                curWidth++;
                if(dbM)ln;
            }

            rep(p,Glnum)WhCnt[p]+=curWhCnt[p];
        }
        if(dbM)ln;

        if(cont){
            continue;
        }//水平方向の別の割り方を試しに行く 

        chmin(ans,tmp);
    }
    cout<<ans<<endl;
    
    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ll n,k,d,p;
	cin>>n>>k>>d;
	n=abs(n);
	p=n/d;
	if(p>=k)
	{
		cout<<n-(d*k)<<endl;
		return 0;
	}
	n=n-d*p;
	k-=p;
	ll n2=n-d;
	k=k%2;
	if(k==1)
		cout<<abs(n2)<<endl;
	else
		cout<<abs(n)<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)

#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define itn ll
#define int ll
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };

static const int N = 100;
int d[N];
int n,M[N][N];

void dfs() {
	queue<int> q;
	q.push(0);
	int i;
	rep(i, n) d[i] = INF;
	d[0] = 0;
	while (!q.empty()) {
		int u = q.front();
		q.pop();
		int v;
		rep(v, n) {
			if (M[u][v] == 0) continue;
			if (d[v] != INF) continue;
			d[v] = d[u] + 1;
			q.push(v);
		}
	}
	rep(u, n) {
		cout << u + 1 << ' ' << ((d[u] == INF) ? (-1) : d[u]) << '\n';
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin >> n;
	int i;
	rep(i, n) {
		int u, k, v;
		cin >> u >> k;
		u--;
		int j;
		rep(j, k) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}
	dfs();
	return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;



int main() {
  ll s;
  cin>>s;
  ll x1 = 1e9, x2 = 1;
  ll y2 = dup(s,x1), y1 = x1*y2-s;
  vl ans;
  ans.pb(0); ans.pb(0);
  ans.pb(x1); ans.pb(y1);
  ans.pb(x2); ans.pb(y2);
  cout<<ans<<endl;
  return 0;
}






















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,n,a,i,k=0;
	cin>>N;
  	vector<pair<int,int>> ppl(N);
  
  	for(i=0;i<N;i++){
    	cin>>a;
    	ppl.at(i)=make_pair(a,i+1);
  	}
          
  	sort(ppl.begin(),ppl.end());
  
  	for(i=0;i<N;i++){
    	cout<<ppl.at(i).second<<" ";
  	}
  
}

Measured memory_bytes: 1536
n, k = map(int,input().split())

if k >= 2 * n:
    print(n)
    quit()
elif k >= n and k < 2*n:
    print(abs(n-k))
    quit()
else:
    x_b = n%k
    x = abs(x_b - k)
    print(min(x_b,x))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
    int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;
    int a = min(X,Y),s = 0,c = 2*C;
    if(A+B >= c) s += c*a;
    else s += (A+B)*a;
    X -= a;Y -= a;
    if(A >= c)s += c*X;
    else s += A*X;
    if(B >= c)s += c*Y;
    else s += B*Y;
    cout << s << endl;
}

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

using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;

void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }




int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n >>k;
	
	VI cnt(n+10);
	rep(i, n){
		int a; cin >>a;
		cnt[a]++;
	}
	sort(cnt.rbegin(), cnt.rend());
	cout << n - accumulate(cnt.begin(), cnt.begin()+k, 0) <<"\n"; 
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

#pragma warning(disable:4996)

int min(int a, int b) {
	if (a < b) return a;
	return b;
}

int main(void) {
	int n, k;
	scanf("%d %d", &n, &k);
	int shift = 0;
	double p = 0;
	for (int i = 0; i < n; ++i) {
		shift = 0;
		while (true) {
			if (((i + 1) << shift) >= k) {
				break;
			}
			++shift;
		}
		p += 1.0 / (1 << shift);
	}
	p /= n;
	printf("%.10lf", p);
	return 0;
}

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

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

    deque<char> que;
    for(int i = 0; i < s.size(); i++){
        que.push_back(s[i]);
    }

    int q;
    cin >> q;
    bool flag = false;
    while(q--){
        int t;
        cin >> t;
        if(t == 1) {
            if(flag) flag = false;
            else flag = true;
        } else {
            int f;
            char c;
            cin >> f >> c;
            if(f == 1){
                if(flag == false){
                    que.push_front(c);
                } else if(flag == true){
                    que.push_back(c);
                }
            } else if(f == 2){
                if(flag == false){
                    que.push_back(c);
                } else if(flag == true){
                    que.push_front(c);
                }
            }
        }
    }
    if(flag == true) reverse(que.begin(),que.end());
    for(int i = 0; i < que.size(); i++){
        cout << que[i];
    }
    cout << endl;
}

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        outer: for (int i = 1 ; ; i++) {
            int x = sc.nextInt();
            switch(x) {
                case 0:
                    break outer;
                default:
                    System.out.printf("Case %d: %d\n", i, x);
            }
        }
    }
}



Measured memory_bytes: 62740
//https://atcoder.jp/contests/abc162/tasks/abc162_a
//A - Lucky 7
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
template<class T>bool chmax(T &a, const T &b) {if (a<b) { a=b; return 1; } return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) { a=b; return 1; } return 0;}
int main(){
  string N; cin>>N;
  cout<<(find(N.begin(),N.end(),'7')!=N.end()?"Yes":"No")<<endl;
  return 0;
}
int main_() {
  string N; cin>>N;
  bool ans=false;
  for(auto& c:N){
    if(c=='7') ans=true;
  }
  cout<<(ans?"Yes":"No")<<endl;
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;

ll n;
ll dp[maxn];
ll a[maxn];
int main()
{
    gbtb;
    cin>>n;
    repd(i,1,n)
    {
        cin>>a[i];
    }
    dp[1]=0;
    dp[0]=0;
    dp[2]=abs(a[2]-a[1]);
    repd(i,3,n)
    {
        dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));

    }
    cout<<dp[n];
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	string S; cin >> S;
	int xd = 0;
	vint dp(1<<26, INF);
	dp[0] = 0;
	for (auto &s : S) {
		xd ^= (1<<(s-'a'));
		for (int i = 0; i < 26; i++) {
			chmin(dp[xd], dp[xd^(1<<i)]+1);
		}
	}
	cout << max(dp[xd], 1) << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 262736
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
  cin>>s;
  cin>>t;
  int c=0;
  for(int i=0;i<s.size();i++)
  {
    if(s[i]!=t[i])
      c++;
  }
  cout<<c;
    

}

Measured memory_bytes: 3916
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		int ans;
		if (n < 10) {
			ans = n;
		} else if (n < 100) {
			ans = 9;
		} else if (n < 1000) {
			ans = 9 + n - 99;
		} else if (n < 10000) {
			ans = 909;
		} else if (n < 100000){
			ans = 909 + n - 9999;
		} else {
			ans = 90909;
		}
		
		System.out.println(ans);
		
		sc.close();
	}
	
}




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

int main() {
  long long ans = 1, n, x = 1, z = 1;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    ans *= 10;
    x *= 9;
    z *= 8;
    ans %= 1000000007;
    x %= 1000000007;
    z %= 1000000007;
  }
  ans -= x;
  ans %= 1000000007;
  ans -= x;
  ans %= 1000000007;
  ans += z;
  ans %= 1000000007;
  ans = (ans+1000000007) % 1000000007;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

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

int main() {
  int h, w, n;
  cin >> h >> w >> n;
  int ans = n / max(h, w);
  if(n % max(h, w) != 0) ans++;
  cout << ans << endl;
  return 0;
}

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

int main()
{
  while(1){
    int n, k, m;
    cin >> n >> k >> m;
    if(n == 0 && k == 0 && m == 0) break;
    vector<int> v;
    for(int i = 1; i <= n; i++)
      v.push_back(i);
    int p = m-1;
    vector<int>::iterator ite = v.begin();
    ite += p;
    v.erase(ite);
    if(ite == v.begin()){
      ite = --v.end();
      p = v.size()-1;
    }else{
      ite--;
      p--;
    }
    while(v.size() != 1){
      p = (p+k) % v.size();
      ite = v.begin();
      ite += p;
      v.erase(ite);
      if(ite == v.begin()){
        ite = --v.end();
        p = v.size()-1;
      }else{
        ite--;
        p--;
      }
    }
    cout  << v[0] << endl;
  }
}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}
void hey(){ cout <<"hey" <<endl; }


int main() {
  int a,b; cin >>a >>b;
  cout <<a/b <<" " <<a%b <<" ";
  double x = a, y = b;
  cout <<fixed <<setprecision(12) <<x/y <<endl;
}



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

typedef long l;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, string> pis;
typedef pair<long, long> pll;

#define EACH(t, c) for (auto&& t : c)
#define ALL(c) begin(c), end(c)
#define FOR(i, s, e) for (int i = (s); i < (int)(e); ++i)
#define REP(i, n) FOR(i, 0, n)
#define endl '\n'
#define F first
#define S second
#define pb push_back
#define mp make_pair

const int DX[] = {1, 0, -1, 0, 1, 1, -1, -1}, DY[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

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

  cin >> n;

  if (n < 1000) {
    cout << "ABC" << endl;
  } else {
    cout << "ABD" << endl;
  }

}



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

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mod 1000000007
#define ull unsigned long long
#define mst(ss,b) memset(ss,b,sizeof(ss));
#define pl(x) cout << #x << "= " << x << endl;
const int inf=0x3f3f3f3f;
const int N=3e5+10;



int  main(){
    int x;
    cin>>x;
    if(x<1200)puts("ABC");
    else puts("ARC");
    return 0;
}

Measured memory_bytes: 256
x, y = map(int, input().split())

cand = [(-x, y, 1), (x, y, 0), (-x, -y, 2), (x, -y, 1)] 

ans = 10e9
for a, b, c in cand:
    if a <= b:
        if ans > b - a + c:
            ans = b - a + c

print(ans)




Measured memory_bytes: 3060
n,k = map(int,input().split())

n_li = [0]*n
for i in range(k):
    d = int(input())
    a_input = [int(i) for i in input().split()]
    for a in a_input:
        n_li[a-1]+=1

print(len([i for i in n_li if i==0]))

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define fast                                                                   \
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long
#define ll long long
#define f(i, n) for (int i = 0; i < n; i++)
#define fo(i,a,n) for (i = a; i <= n; i++)
#define F first
#define S second
#define pii pair<int,int>
#define sz size()
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front    
#define PB pop_back
#define pll pair<long long, long long>
#define vi vector<int>
#define vl vector<int>
#define mp make_pair
#define mod 1000000007
typedef unsigned long long ull;
const int N = 200005;
const int MOD = 998244353 ;



double fun(double h, double m){
    if(h == 12) h = 0;  
    if(m == 60) m = 0; 
    double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m; 
    double angle = abs(hour_angle - minute_angle);   
    angle = min(360 - angle, angle);  
    return angle;  
}  

void solve(){
    double a, b, h, m;
    cin>>a>>b>>h>>m;
    double pi = 3.1415926535897932384626433;
    double deg = (pi*fun(h,m))/180;
    //cout<<fixed<<setprecision(20)<<pi<<" "<<fun(h,m)<<" "<<deg<<" "<<cos(deg)<<endl;
    double ans = ((a*a) + (b*b) - (2*a*b*cos(deg)));
    cout<<fixed<<setprecision(20)<<sqrt(ans);
}

int32_t main() {
    fast
    int t;
    t = 1;
    //cin >> t;
    while(t--)solve();
    return 0;
}


Measured memory_bytes: 4192
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(int (i)=(n)-1; (i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	string s; cin >> s;
	bool is = true;
	rep(i, s.size()) {
		if (s.substr(i, 2) != "hi")is = false;
		++i;

	}
	cout << (is ? "Yes" : "No") << "\n";


	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;
ll GCD(ll a,ll b){
    ll hoge;
    do{
        hoge=a%b;
        a=b;
        b=hoge;
    }while(hoge!=0);
    return a;
}
ll LCM(ll a,ll b){
    return a/GCD(a,b)*b;//overflow対策
}
int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    int ans = 0,now = 1;
    rep(i,n){
        if(a[i] != now)ans++;
        else now++;
    }
    if(now != 1)cout<<ans<<endl;
    else cout<<-1<<endl;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int gcd(int a, int b) {
  if(a == b || a == 0) {
    return b;
  }
  if(!(a & 1) && !(b & 1)) {
    return gcd(a>>1, b>>1) << 1;
  }
  if((a & 1) && !(b & 1)) {
    return gcd(a, b>>1);
  }
  if(!(a & 1) && (b & 1)) {
    return gcd(a>>1, b);
  } else {
    if(a > b) {
      return gcd((a-b)/2, b);
    } else {
      return gcd((b-a)/2, a);
    }
  }
}

int main() {
  int x, y;
  cin >> x >> y;

  int res;
  res = gcd(x, y);
  
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 3100
#include <iostream>
#include <math.h>

using namespace std;

int main(void){
  int n, l, c, min_abs = 100, sum = 0;
  int i, j;
  cin >> n >> l;
  for(i = 1; i <= n; i++){
    c = i + l - 1;
    if(abs(c) < abs(min_abs)){
      min_abs = c;
    }
    sum = sum + c;
  }
  sum = sum - min_abs;
  cout << sum;
  
  return 0;
}


Measured memory_bytes: 256
# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
# import sys ; sys.exit() # プログラム終了
# from copy import deepcopy ; b=deepcopy(a)
# chr(ord('a') + 1)
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#
a = max(map(int, input().split()))
if a <= 8:
    ans = 'Yay!'
else:
    ans = ':('

print(ans)


Measured memory_bytes: 2940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BRGBBoxes solver = new BRGBBoxes();
        solver.solve(1, in, out);
        out.close();
    }

    static class BRGBBoxes {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt(), n = in.nextInt();

            int ans = 0;

            for (int i = 0; i <= n / a; i++) {
                for (int j = 0; j <= n / b; j++) {
                    int k = (n - i * a - j * b) / c;
                    if (k >= 0 && i * a + j * b + k * c == n) {
                        ans++;
                    }
                }
            }

            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21588