akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
long long a[200010];
long long b[200010];
int main()
{
    int c;
    cin>>c;
    long long s=0;
    for(int i=0;i<c;i++)
	{
        cin>>a[i];
        if(i==0)
            b[i]=a[i];
        else
            b[i]=b[i-1]+a[i];
        s=s+a[i];
    }
    long long m;
    if(b[0]>s-b[0])
        m=b[0]+b[0]-s;
    else
        m=s-b[0]-b[0];
    for(int i=1;i<(c-1);i++)
	{
        if(m>abs(s-b[i]-b[i]))
        m=abs(s-b[i]-b[i]);
    }
    cout<<m<<endl;
    return 0;
} 

Measured memory_bytes: 3328
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

flug = False
if V != W:
    dist = abs(A - B)
    speed = V - W
    second = dist / speed
    if 0 <= second <= T:
        flug = True
if flug: print("YES")
else: print("NO")

Measured memory_bytes: 61628
#include <iostream>

using namespace std;

int a, b;
void solve() {
	cin >> a >> b;
	cout << (a * b) << '\n';
}

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

	int a, b;
	cin >> a >> b;
	cout << (a * b) << '\n';
	/*int t;
	cin >> t;
	while (t--) solve();*/

	return 0;
}

Measured memory_bytes: 3640
def actual(a1, a2, a3):
    A = sorted([a1, a2, a3])

    amount_cost = 0
    
    for i in range(len(A) - 1):
        amount_cost += A[i + 1] - A[i]

    return amount_cost

a1, a2, a3 = map(int, input().split())
print(actual(a1, a2, a3))

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long int

using namespace std;

int main(){
	cin.tie(0); ios::sync_with_stdio(0);
	
	int n;
	cin >> n;
	int x, y;
	vector< pair<double, pair <ll, ll>>> pt(n);
	
	for(int i = 0; i< n; i++){
		cin >> x >> y;
		double ang = 0;
		if(x == 0 && y == 0) ang = 0;
		else ang = atan2(x, y);
		pt[i] = {ang, {x, y}};
	}
	sort(pt.begin(), pt.end());
	double ans = 0;
		for(int i = 0; i < n; i++){
		ll sumx = 0, sumy = 0;
		for(int j = i; j < i + n; j++){
			sumx += pt[j%n].second.first;
			sumy += pt[j%n].second.second;
			ans = max(ans, sqrt(sumx * sumx + sumy * sumy));
		}
	}
  	/**/
	printf("%.20f\n", ans);
	/**/
	/**/
}

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

//穴のない階段をn段上るときの組み合わせorフィボナッチ数列n項目
ll upstairs(int n) {
  ll S[n];
  S[0] = 1;
  if (n > 0) {
    S[1] = 1;
  }
  for (int i=2; i<=n; i++) {
    S[i] = S[i-1]%1000000007 + S[i - 2]%1000000007;
  }
  return S[n]%1000000007;
}
    
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> H(M);
  for (int i=0; i<M; i++) {
    cin >> H[i];
  }
  H.push_back(N+1);
  
  ll ans = 1;
  for (int i=0; i<=M; i++) {
    if (i == 0) {
      ll keep = upstairs(H[i] - 1);
      ans *= keep % 1000000007;
      ans %= 1000000007;
    }
    else {
      ll keep = (H[i] - H[i-1] > 1 ? upstairs(H[i] - H[i-1] - 2) : 0);
      ans *= keep % 1000000007;
      ans %= 1000000007;
    }
//    cout << ans << endl;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
 
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    
    cout << max({a*b,c*d}) <<endl;
    
    return 0;
}



Measured memory_bytes: 256
n=int(input())
ac,wa,tle,re=0,0,0,0
for i in range(n):
	s = input()
	if (s == "AC"):
		ac+=1
	elif (s == "WA"):
		wa+=1
	elif (s == "TLE"):
		tle+=1
	else:
		re+=1
print("AC x "+str(ac))
print("WA x "+str(wa))
print("TLE x "+str(tle))
print("RE x "+str(re))



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

signed main(void)
{
	int n, m, sum;
	cin >> n >> m;
	vector<int> x(m), diff(m - 1);
	
	rep(i, m) cin >> x[i];
	sort(x.begin(), x.end());
	rep(i, m - 1) diff[i] = abs(x[i + 1] - x[i]);
	sort(diff.begin(), diff.end());
	sum = 0;
	rep(i, m - n)
	{
		sum += diff[i];
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    multiset<ll> ms;
    rep(i, n) {
        auto it = ms.lower_bound(a[i]);
        if (it == ms.begin()) {
            ms.insert(a[i]);
            continue;
        }
        it--;
        ms.erase(it);
        ms.insert(a[i]);
    }
    cout << sz(ms) << endl;
    return 0;
}


Measured memory_bytes: 5760
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

internal static class CR
{
    public static string GetText() { return Console.ReadLine(); }
    public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
    public static long GetLong() { return long.Parse(Console.ReadLine()); }
    public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
}

namespace AtCoder.B
{
    public class Program
    {
        public static long N { get; private set; }
        public static List<long> A { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            N = CR.GetLong();
            A = CR.GetLongs();

            return A.Where(x => x % 2 == 0).All(x => x % 3 == 0 || x % 5 == 0) ? "APPROVED" : "DENIED";
        }
    }
}


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

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

static const int64_t MOD = 1'000'000'007;

inline int64_t add_mod(int64_t a, int64_t b) { return (a + b) % MOD; }
inline int64_t sub_mod(int64_t a, int64_t b) { return (a - b + MOD) % MOD; }
inline int64_t mul_mod(int64_t a, int64_t b) { return (a * b) % MOD; }

int64_t pow_mod(int64_t n, int64_t p) {
    n %= MOD;
    int64_t ans = 1;
    while (p > 0) {
        if (p & 1) {
            ans = mul_mod(ans, n);
        }
        n = mul_mod(n, n);
        p >>= 1;
    }
    return ans;
}

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

    // g(i): gcd(A_1,..,A_N) = i となるような {A_1,..,A_N} の数
    vector<int64_t> g(K+1);

    for (int i = K; i > 0; --i) {
        int64_t k = pow_mod(K/i, N);
        for (int j = 2; i*j <= K; ++j) {
            k = sub_mod(k, g[i*j]);
        }
        g[i] = k;
    }

    int64_t ans = 0;
    for (int i = 1; i <= K; ++i) {
        ans = add_mod(ans, mul_mod(g[i], i));
    }
    cout << ans << '\n';
}


Measured memory_bytes: 4052
#include<iostream>
#include<algorithm>
int ride2(int n){return n*n;}
using namespace std;
int main(){
    int a[3],n;
    cin>>n;
    while(n--){
        for(int i=0;i<3;i++)cin>>a[i];
        sort(a,a+3);
        if(ride2(a[0])+ride2(a[1])==ride2(a[2]))
            cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 1168
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	vector<ll> A(N);
	REP(i, N) cin >> A[i];
	vector<ll> a(N);
	REP(i, N) a[i] = A[i] - i - 1;
	sort(a.begin(), a.end());
	ll res = 0;
	REP(i, N) res += abs(a[i] - a[N / 2]);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3328
N = int(input())
A = list(map(int, input().split()))
res = True
for n in range(N):
    if A[n] % 2 == 0:
        if A[n] % 3 != 0 and A[n] % 5 != 0:
            res = False
if res:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
N = int(input())
List = [[int(i) for i in input().split()] for _ in range(N)]
for xt, yt, ht in List:
    if ht > 0:
        break
for px in range(0, 101):
    for py in range(0, 101):
        H = ht + abs(px - xt) + abs(py - yt)
        if len(list(filter(lambda x: x[2] != max(H - abs(px - x[0]) - abs(py - x[1]), 0), List))) == 0:
            print(px, py, H)
            break
    else:
        continue
    break

Measured memory_bytes: 3188
#include <stdio.h>

int main () {

    int i, j, n, q, c;
    int a[10000], b[500];

    c = 0;

    scanf("%d", &n);

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

    scanf("%d", &q);

    for (i = 0; i < q; i++)
        scanf("%d", &b[i]);

    for (i = 0; i < q; i++) {
        for (j = 0; j < n; j++) {
            if (a[j] == b[i]) {
                c += 1;
                break;
            }
        }
    }

    printf("%d\n", c);

    return 0;

}



Measured memory_bytes: 2132
N,K = map(int,input().split())
A = []
for _ in range(K):
    d = int(input())
    a = list(map(int,input().split()))
    A.append(a)
B = [0 for _ in range(N+1)]
for a in A:
    for j in range(len(a)):
        B[a[j]] = 1
print(N-sum(B))

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

int main()

{
    int b1 = 10000, b2 = 5000, b3 = 1000;
    int n, y;
    cin >> n >> y;

    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= n - i; j++) {

            int tmp = b1 * i + b2 * j;
            if(tmp > y)
                break;

            if( (y - tmp) % b3 == 0) {
                int k = (y - tmp) / b3;
                if(i + j + k == n) {
                    printf("%d %d %d\n", i, j, k);
                    return 0;
                }
            }

        }
    }

    printf("-1 -1 -1\n");

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define MAX ((int)(1e7))
#define MAX_X ((int)(1e6 + 2))
#define pi (2.0*acos(0))
#define M ((ll)(1e9 + 7))
#define NN ((ll)(305))
#define N ((int)(1e5 + 5))
#define eps (0)
#define log 20


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;

/*fast io
ios_base::sync_with_stdio(false);
cin.tie(NULL);
*/


typedef tree < pair < int, int >,  null_type,  less < pair < int, int > >,  rb_tree_tag,  tree_order_statistics_node_update > o_set;
/// o_set s;
/// s.order_of_key(k) : Number of items strictly smaller than k .
/// *(s.find_by_order(k)) : K-th element in a set (counting from zero).

struct info{
    int l  , r;
}arr[N];

bool cmp(info a , info b)
{
    return a.r-a.l>b.r-b.l;
}

bool cmp1(info a , info b)
{
    return a.r<b.r || (a.r==b.r && a.l<b.l);
}

int main()
{
    int n, mnnr = 1e9, mxxl = 0;
    scanf("%d",&n);
    for(int i = 1; i<=n; i++){
        scanf("%d %d",&arr[i].l,&arr[i].r);
        mxxl = max(mxxl,arr[i].l);
        mnnr = min(mnnr,arr[i].r);
    }
    if(n==2){
        printf("%lld\n",arr[1].r+arr[2].r-arr[1].l-arr[2].l+2);
        return 0;
    }
    sort(arr+1,arr+n+1,cmp);
    int ans = 0;
    for(int i = 2; i<=n; i++){
        if(arr[i].l==mxxl){
            for(int j = 2; j<=n; j++){
                if(arr[j].r==mnnr){
                    ans = arr[1].r-arr[1].l +1 + max(0,mnnr-mxxl+1);
                    break;
                }
            }
            break;
        }
    }

    sort(arr+1,arr+n+1,cmp1);
    int tmp = mxxl;
    mnnr = arr[1].r;
    mxxl = arr[1].l;
    for(int i = 2; i<=n; i++){
        ans = max(ans,max(0,arr[i].r-tmp+1)+max(0,mnnr-mxxl+1));
        mnnr = min(mnnr,arr[i].r);
        mxxl = max(mxxl,arr[i].l);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  int a;
  int b;
  char line[128];
  fgets(line, 127, stdin);
  sscanf(line, "%d %d", &a, &b);
  if (a <= 8 && b <= 8) {
    printf("Yay!\n");
  } else {
    printf(":(\n");
  }

  return 0;
}


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

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

	int N, d, ans = 0;
	vector<int> D;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> d;
		D.push_back(d);
	}

	for (int i = 0; i < N - 1; i++) {
		for (int j = i + 1; j < N; j++) {
			ans += D[i] * D[j];
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD1=1e9+7;
const int MOD2=998244353;
const int INF=2*1e9;
int main()
{
    ll a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll n;
    cin>>n;
    cout<<a[n-1];
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

    static Scanner scan;

    public static void main(String[] args) {
        scan = new Scanner(System.in);

        int n = scan.nextInt();

        int h = n / 3600;
        int s = n % 60;
        int m = (n - h*3600) / 60;

        System.out.printf("%d:%d:%d\n", h, m, s);
    }
}




Measured memory_bytes: 26480
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

int main(){
    string S;
    cin >> S;

    reverse(S.begin(), S.end());
    for(int i = 0; i < 4; i++){
        reverse(divide[i].begin(), divide[i].end());
    }
    bool can = true;

    for(int i = 0; i < S.size();){
        bool can2 = false;
        for(int j = 0; j < 4; j++){
            string d = divide[j];
            if(S.substr(i, d.size()) == d){
                can2 = true;
                i = i + d.size();
            }
        }
        if(can2 == false){
            can = false;
            break;
        }
    }

    if(can == true){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }

    return 0;

}



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


int main() {string s;
cin >> s;
long left, right;
rep(i, s.size()){
  if(s.at(i) == 'A'){
    left = i;
    break;
  }
}
for(long i = s.size() - 1; i >= 0; i--){
  if(s.at(i) == 'Z'){
    right = i;
    break;
  }
}
long ans = right - left + 1;

cout << ans << endl;
  return 0;
 
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000




int main(){
	string A;
	cin>>A;
	
	vector<long long> cnt(26,0);
	
	long long ans = 0;
	
	for(int i=0;i<A.size();i++){
		cnt[A[i]-'a']++;
	}
	
	for(int i=0;i<26;i++){
		ans += cnt[i] * (A.size()-cnt[i]);
	}
	
	ans /= 2;
	
	ans ++;
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
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<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//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 SQ(a) ((a)*(a))
#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())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


int main() {
  int A,B,C;
  cin >> A >> B >> C;
  
  if(A+B >= C) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>

using namespace std;

int main() {
    while(true) {
        int a, b;
        string op;
        cin >> a >> op >> b;
        if (op == "?") {
            break;
        }
        int result;
        if (op == "+") {
          result = a + b;
        } else if (op == "-") {
            result = a - b;
        } else if (op == "*") {
            result = a * b;
        } else if (op == "/") {
            result = a / b;
        } else {
            break;
        }
        printf("%d\n", result);
    }
    return 0;
}


Measured memory_bytes: 3208
/*  Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=1e5+10;

int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
double a[N];
int32_t main()
{
    IOS;
    int n;
    cin>>n;
    priority_queue<double ,vector<double> ,greater<double> >pq;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        pq.push(a[i]);
    }
    while(pq.size()>1)
    {
        double k=pq.top();
        pq.pop();
        double k1=pq.top();
        pq.pop();
        pq.push((k1+k)/2.0);
    }
    cout<<fixed<<setprecision(12)<<pq.top()<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int n, m, h[100001];
int main()
{
    cin >> n >> m;

    vector <int> road[100001];
    for(int i = 1; i <= n; i++) {
        cin >> h[i];
    }
    for(int i = 0; i < m; i++) {
        int x, y;
        cin >> x >> y;
        road[x].push_back(y);
        road[y].push_back(x);
    }

    int ans = n;

    for(int i = 1; i <= n; i++) {
        bool ok = true;
        for(int j = 0; j < road[i]. size(); j++) {
            if(h[i] <= h[road[i][j]])
                ok = false;
        }
        if(!ok)
            ans--;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 9120
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		int h;
		cin >> h;
		if (h >= K) { ++ans; }
	}
	cout << ans << endl;

	return 0;
}


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

bool solve(long long N) {
  if (N == 1) return true;
  for (long long b = 2; b * b <= N; ++b) {
    long long v = b;
    while (v < N) {
      v *= b;
      if (v == N) return true;
    }
  }
  return false;
}

int main() {
  int N;
  cin >> N;
  int res;
  for (int i = N; i >= 1; --i) {
    if (solve(i)) {
      res = i;
      break;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 3544
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<queue>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

vector<int> G[100100];
int dp[100100][11];
int V[100100], D[100100], C[100100];

void dfs(int v, int d, int label) {
	int& ret = dp[v][d];
	if (ret > 0) return;
	ret = label;
	if (!d) return;
	for (int el : G[v]) {
		dfs(el, d-1, label);
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int Q;
	cin >> Q;
	for (int q = 1; q <= Q; q++) {
		cin >> V[q] >> D[q] >> C[q];
		--V[q];
	}
	for (int q = Q; q >= 1; --q) {
		dfs(V[q], D[q], q);
	}
	for (int i = 0; i < N; i++) {
		int ans = 0;
		for (int d = 0; d <= 10; ++d) {
			ans = max(ans, dp[i][d]);
		}
		cout << C[ans] << endl;
	}
	return 0;
}


Measured memory_bytes: 12024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll N,M,C;
    cin >> N >> M >> C;
    int B[M];
    for(int i = 0; i < M; i++) cin >> B[i];
    int A[N][M];
    int ans = 0;
    for(int i = 0; i < N; i++){
        int tmp = 0;
        for(int j = 0; j < M; j++){
            cin >> A[i][j];
            tmp += (B[j]*A[i][j]); 
        }
        if(tmp + C > 0) ans++;
    }
        
    
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
n = int(input())
alist = [int(s) for s in input().split(" ")]
adict = {}
ans = 0
for a in alist:
  ans += a
  if a in adict:
    adict[a] += 1
  else:
    adict[a] = 1
q = int(input())
bclist = []
for _ in range(q):
  b, c = [int(s) for s in input().split(" ")]
  bclist.append([b, c])

for b, c in bclist:
  if c in adict and b in adict:
    ans += (c - b) * adict[b]
    adict[c] += adict[b]
    del adict[b]
  elif b in adict:
    ans += (c - b) * adict[b]
    adict[c] = adict[b]
    del adict[b]
  print(ans)

Measured memory_bytes: 33396
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  long long n;cin>>n;
  long long a[n];
  for(int i = 0; n > i; i++){
    cin>>a[i];
  }
  vector<long long> b(n);
  for(int i = 1; n >= i; i++){
    b[i-1] = a[i-1]-i;
  }
  sort(b.begin(),b.end());
  long long ans = 0;
  if(n % 2){
    for(int i = 0; n > i; i++){
      ans += abs(b[i]-b[n/2]);
    }
  }else{
    long long tmp[2] = {0,0};
    for(int i = 0; n > i; i++){
      tmp[0] += abs(b[i]-b[n/2]);
      tmp[1] += abs(b[i]-b[n/2-1]);
    }
    ans = min(tmp[0],tmp[1]);
  }
  cout << ans << endl;
}

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

int32_t main(){
    int n;cin>>n;
    long long ans=0;
    for(int i=1;i<=n;i++){
        if(i%3==0||i%5==0){

        }
        else{
            ans+=i;
        }
    }
    cout<<ans;
   return 0;
}

Measured memory_bytes: 3636
#ABC134-E Sequence Decomposing
"""
与えられたリストを反転した場合の広義(重複を許した)LIS(最長増加部分列)
の長さが答え。
"""
import bisect
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0


lst1 = []
n = int(readline())
for i in range(n):
    lst1.append(int(readline()))

lst1.reverse() #減少→増加へ

def LIS(lst):
    dp=[]
    for i in lst:
        pos=bisect.bisect_right(dp,i) #rightなら広義、leftなら狭義
        if len(dp)<=pos:
            dp.append(i)
        else:
            dp[pos]=i
    return len(dp)

print(LIS(lst1))

Measured memory_bytes: 47708
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
 
void solve() {
	int N; cin >> N;
    char S[100000];

    if ( N % 2 == 0) {
        S[0] = '0'; 
        N /= (-2);
    }
    else { 
        S[0] = '1';
        N -= 1;
        N /= (-2);
    }

    int i = 1;
    while ( N != 0) {
            if (N % 2 == 0) {
                S[i] = '0';
                i ++;
                N /= (-2);
            }
            else {
                S[i] = '1';
                i ++;
                N = (N - 1) / (-2);
            }
        
    }

    string s;
    per(j,i) s += S[j];

    cout<< s << endl;

}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char x[100],y[100],z[100];
	cin>>x>>y>>z;
	if(x[0]>='a' && x[0]<='z')
	x[0]-=32;
	if(y[0]>='a' && y[0]<='z')
	y[0]-=32;
	if(z[0]>='a' && z[0]<='z')
	z[0]-=32;
	cout<<x[0]<<y[0]<<z[0];
}

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

int E[]={3,1,0,5,4,2};
int N[]={1,5,2,3,0,4};
int S[]={4,0,2,3,5,1};
int W[]={2,1,5,0,4,3};

int v[6]={};
int u[6]={};
int w[6]={};
int t[6]={};

bool is_rotatable(int* X){
    for(int i=0;i<6;i++){
        u[i] = v[i];
    }
    for(int i=0;i<6;i++){
        w[i] = u[X[i]];
    }
    w[5]--;
    if(w[5]<0)return false;
    int a = w[0]+w[5];
    int b = w[1]+w[4];
    int c = w[2]+w[3];
    if(a>=b&&a>=c){
        if(a>b+c){
            return false;
        }else{
            return true;
        }
    }else{
        int mx = max(b,c);
        if(2*mx>a+b+c+1){
            return false;
        }else{
            return true;
        }
    }
}

void rotate(int* X){
    for(int i=0;i<6;i++){
        u[i] = v[i];
    }
    for(int i=0;i<6;i++){
        v[i] = u[X[i]];
    }
    v[5]--;
    return;
}

string calc(){
    string ans;
    while(1){
        bool flag = 1;
        for(int i=0;i<6;i++){
            if(v[i]!=0){
                flag = 0;
            }
        }
        if(flag)break;
        if(is_rotatable(E)){
            rotate(E);
            ans.push_back('E');
        }else if(is_rotatable(N)){
            rotate(N);
            ans.push_back('N');
        }else if(is_rotatable(S)){
            rotate(S);
            ans.push_back('S');
        }else if(is_rotatable(W)){
            rotate(W);
            ans.push_back('W');
        }else{
            ans = "impossible";
            break;
        }
    }

    return ans;
}

int main(){
    while(1){
        bool fflag = 1;
        for(int i=0;i<6;i++){
            cin >> t[i];
            if(t[i]!=0)fflag = 0;
        }
        if(fflag)break;
        string ans = "impossible";
        do{
            for(int i=0;i<6;i++)v[i]=t[i];
            string tmp = calc();
            if(tmp=="impossible")continue;
            if(ans=="impossible"){
                ans = tmp;
            }else{
                ans = min(ans,tmp);
            }
        }while(next_permutation(t,t+6));
        int p,q;
        cin >> p >> q;
        if(ans=="impossible"){
            printf("impossible\n");
        }else{
            for(int i=p-1;i<q;i++){
                printf("%c",ans[i]);
            }
            printf("\n");
        }
    }



    return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g;}
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

int main()
{
	string s; cin >> s;
	string t="CODEFESTIVAL2016";
	int ans = 0;
	rep(i, sz(t))if (s[i] != t[i])ans++;
	co(ans);
	return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)
if N % 2 == 0:
    if S[N//2] != S[N//2-1]:
        print(N-N//2)
        exit()
    tmp = S[N//2]
    ans = N-N//2
    l = N//2-1
    r = N//2
    while S[l] == tmp and S[r] == tmp:
        ans += 1
        l -= 1
        r += 1
        if l < 0 or r > N-1:
            break
    print(ans)
else:
    tmp = S[N//2]
    ans = N-N//2-1
    l = N//2
    r = N//2
    while S[l] == tmp and S[r] == tmp:
        ans += 1
        l -= 1
        r += 1
        if l < 0 or r > N-1:
            break
    print(ans)


Measured memory_bytes: 3192
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout<<#x<<" "<<x<<" ";
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define ll long long
#define all(A)  A.begin(),A.end()  
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
const int MSIZE = 3e3+5;
const int MOD = 1e9+7;


int arr[MSIZE];
ll dp[MSIZE][MSIZE];

int main(){

    FIO
    int n; cin>>n;
    f(i,0,n-1)    cin>>arr[i];
    
    f(i,0,n-1)  dp[i][i] = n%2?arr[i]:-arr[i];
    f(k,1,n-1) for(int i=0, j = k; j<n; i++, j++) {
        dp[i][j] = (n-j+i)%2?max(arr[i]+dp[i+1][j],arr[j]+dp[i][j-1])
                                :min(-arr[i]+dp[i+1][j],-arr[j]+dp[i][j-1]);
    }
    // f(i,0,n-1){ 
    //     f(j,0,n-1)  cout<<dp[i][j]<<" ";  cout<<endl; 
    // }
    cout<<dp[0][n-1]<<endl; 
    return 0;

}
    


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

int main() {
char x,y;
cin >> x >> y;
 max(x,y);
 if(x > y){
     cout << '>' << endl;
 }
 else if(x == y){
     cout << '=' <<endl;
 }
 else if(x < y){
     cout << '<' <<endl;
 }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int a = k / 100;
        int t = k % 100;
        int b = t / 10;
        int c = t % 10;
        if(a == 7 || b == 7 || c == 7){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35756
i = 0
while True:
	m,f,r = list(map(int, input().split()))
	if (m == -1 and f == -1 and r == -1):
		break
	elif ((m == -1) or (f == -1)) or (m + f < 30):
		print("F")
	elif (80 <= m + f):
		print("A")
	elif (65 <= m + f) and (m + f < 80):
		print("B")
	elif (50 <= m + f) and (m + f < 65) or (50 <= r):
		print("C")
	elif (30 <= m + f) and (m + f <50) :
		print("D")
		

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

#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
#define mp            make_pair
typedef long long     ll;



int main()
{

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

vector<ll>lf;
ll r=b,k;
  for(ll y=0;y<a;y++){
cin>>k;
ll f=k-b;
ll w=abs(f);
lf.push_back(w);
  }
if(a==1){
    cout<<abs(b-k);
  }else{
      r=__gcd(lf[0],lf[1]);
       for(ll y=2;y<a;y++){
r=__gcd(r,lf[y]);
  }
   cout<<r;
  }


   }



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

int main(){
	ios_base::sync_with_stdio(0);
	long long q,h,s,d,n;
	cin>>q>>h>>s>>d>>n;
	long long ans = min(4*q,2*h);
	ans = min(ans,s);
	if(2*ans <= d){
		cout<<n*ans<<endl;
		return 0;
	}	
	if(n%2==0){
		cout<<(n/2)*d<<endl;
	}
	else cout<<(n/2)*d+ans<<endl;
	return 0;	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;


int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size();i++){
        if(s[i]!=t[i]){
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3916
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

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

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numX = nextInt();
		int numA = nextInt();
		int numB = nextInt();

		if (Math.abs(numX - numA) > Math.abs(numX - numB)) {
			out.println("B");
		} else {
			out.println("A");
		}

	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

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

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i,n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  //ここまでで入力完了。以下は最も大きい値をとるkeyを受け取る
  int mx = 0;
  for(auto p : mp) {
    mx = max(mx, p.second);
  }//最大値を受け取る
  for(auto p : mp) {
    if(p.second != mx) continue;
    cout << p.first << endl;
  }
}

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

int main(void){
char weather1[10] = "Sunny";
char weather2[10] = "Cloudy";
char weather3[10] = "Rainy";
char weather4[10];

  scanf("%s",weather4);

if (strcmp(weather1,weather4) == 0){
printf("%s",weather2);
  }
else if (strcmp(weather2,weather4) == 0){
printf("%s",weather3);
  }
else if (strcmp(weather3,weather4) == 0){
printf("%s",weather1);
  }
 
return 0;
 } 


Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define MOD 1e+7
#define inf 1e9
#define fi first
#define se second
using namespace std;

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

  int n, m;
  cin >> n >> m;
  vector<int> s(0);
  vector<vector<int>> Graph(n, vector<int>(0));
  rep(i,n) s.push_back(i);
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    Graph[a].push_back(b);
    Graph[b].push_back(a);
  }

  int res = 0;
  do {
    if(s[0] != 0) continue;
    //print_array(s);
    bool flag = true;
    rep(i,n-1) {
      int a = count(Graph[s[i]].begin(), Graph[s[i]].end(), s[i+1]);
      if(a == 0) flag = false;
    }
    if(flag) res++;
  } while(next_permutation(s.begin(), s.end()));
  cout << res << endl;
  return 0;
}

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

void dfs(ll i, vector<vector<ll>>& adj, vector<bool>& vis, ll& cnt)
{
	vis[i] = true;
	cnt++;
	for(auto t: adj[i])
	{
		if(!vis[t])
			dfs(t,adj,vis,cnt);
	}
}

void solve()
{
	ll n,m;
	cin>>n>>m;
	vector<vector<ll>> adj(n+1);
	for (int i = 0; i < m; ++i)
	{
		ll u,v;
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	ll maxi = 0;
	vector<bool> vis(n+1,false);
	for (int i = 1; i <= n; ++i)
	{
		ll cnt = 0 ;
		if(!vis[i])
		{
			dfs(i,adj,vis,cnt);
			maxi = max(maxi,cnt);
		}
	}
	cout<<maxi<<endl;
}

int main()
{
	ll t = 1;
	// cin>>t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 26592
#include<bits/stdc++.h>
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 repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1);
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; }

int main() {
    string s; cin >> s;
    vector<int> cnt(3, 0);
    rep(i, (int)s.size()) {
        cnt[s[i] - 'a']++;
    }
    sort(all(cnt));

    if (cnt[2] - cnt[0] > 1) cout << "NO" << endl;
    else cout << "YES" << endl;
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int m = ri();
	int l[m], r[m], c[m];
	for (int i = 0; i < m; i++) l[i] = ri() - 1, r[i] = ri() - 1, c[i] = ri();
	std::vector<int> hen[n];
	std::vector<int> finish[n + 1];
	int64_t cost_hen[m];
	for (int i = 0; i < m; i++) hen[l[i]].push_back(i), finish[r[i]].push_back(i);
	int64_t dp[n];
	for (int i = 0; i < m; i++) cost_hen[i] = l[i] ? 1000000000000000000 : c[i];
	for (int i = 0; i < n; i++) dp[i] = 1000000000000000000;
	dp[0] = 0;
	std::multiset<int64_t> costs;
	std::set<int> cur;
	for (int i = 0; i + 1 < n; i++) {
		for (auto j : hen[i]) cur.insert(j), costs.insert(c[j] + dp[i]);
		for (auto j : finish[i]) cur.erase(j), costs.erase(costs.find(c[j] + dp[l[j]]));
		if (costs.size()) dp[i + 1] = *costs.begin();
	}
	std::cout << (dp[n - 1] >= 1000000000000000000 ? -1 : dp[n - 1]) << std::endl;
	return 0;
}


Measured memory_bytes: 16768
#include<iostream>
#include<vector>
using namespace std;
#define maxsize 505
struct node
{
    int y1;
    int x1;
    int y2;
    int x2;
    node(int i1,int i2,int i3,int i4)
    {
        y1=i1;x1=i2;y2=i3;x2=i4;
    }
};
vector<node> V;
int h,w;
int a[maxsize][maxsize];
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>h>>w)
    {
        V.clear();
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                cin>>a[i][j];
            }
        }
        for(int i=0;i<h-1;i++)
        {
            for(int j=0;j<w;j++)
            {
                if(a[i][j]%2)
                {
                    a[i+1][j]++;
                    a[i][j]--;
                    V.push_back(node(i+1,j+1,i+2,j+1));
                }
            }
        }
        for(int i=0;i<w-1;i++)
        {
            if(a[h-1][i]%2)
            {
                a[h-1][i]--;
                a[h-1][i+1]++;
                V.push_back(node(h,i+1,h,i+2));
            }
        }
        cout<<V.size()<<endl;
        vector<node>::iterator it;
        for(it=V.begin();it!=V.end();it++)
        {
            cout<<it->y1<<" "<<it->x1<<" "<<it->y2<<" "<<it->x2<<endl;
        }
    }
}

Measured memory_bytes: 5232
def min(a, b)
  a < b ? a : b
end

gets
h = gets.split(" ").map(&:to_i)


# dp[i] 足場 i に到達するまでの最小のコスト
dp = []
dp[0] = 0
dp[1] = (h[0] - h[1]).abs

2.upto(h.size - 1) {|i|
  cost1 = dp[i - 1] + (h[i] - h[i - 1]).abs
  cost2 = dp[i - 2] + (h[i] - h[i - 2]).abs
  dp[i] = min(cost1, cost2)
}

puts dp.last


Measured memory_bytes: 8908
#include <bits/stdc++.h>
const int mod = 1000000007;
const int modx = 998244353;
#define ll long long
#define readi(x) scanf("%d", &x)
#define reads(x) scanf("%s", x)
#define readl(x) scanf("%I64d", &x)
#define rep(i, n) for (i = 0; i < n; i++)
#define rep1(i, a, b) for (i = a; i < b; i++)
#define rep2(i, a, b) for (i = b; i >= a; i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define bpc(x) __builtin_popcount(x)
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pdd pair<double, double>
#define pic pair<int, char>
#define ddouble long double
#define PI 3.1415926535
#define endl "\n"
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define prod(x, y) ((x % mod) * (y % mod)) % mod
#define add(x, y) ((x % mod) + (y % mod)) % mod
#define ub(a, b) upper_bound(all(a), b)
#define lb(a, b) lower_bound(all(a), b)
#define pqs priority_queue<int, vector<int>, greater<int>>
#define pqb priority_queue<int>
#define mii map<int, int>
#define mll map<ll, ll>
using namespace std;
//using namespace __gnu_pbds;
/*ll power(ll x, ll y)
{
    ll r = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            r = (r*x) % mod;

        y = y>>1;
        x = (x*x) % mod;
    }
    return r;
}*/
const int N = 3000;
int n;
ddouble dp[N + 1][N + 1] = {}, vis[N + 1][N + 1] = {};
ddouble p[N + 1];
void thunder()
{
    cin >> n;
    int i;
    rep(i, n) cin >> p[i + 1];
    dp[1][0] = 1.0 - p[1];
    rep1(i, 2, n + 1)
        dp[i][0] = dp[i - 1][0] * (1 - p[i]) * 1.0;
    dp[1][1] = 1.0 * p[1];
    rep1(i, 2, n + 1)
        dp[i][i] = dp[i - 1][i - 1] * p[i] * 1.0;
    ddouble res = 0;
    int j;
    rep1(i, 1, n + 1)
    {
        rep1(j, 1, i)
        {
            dp[i][j] = dp[i - 1][j] * (1 - p[i]) + dp[i - 1][j - 1] * p[i];
        }
    }
    rep1(i, n / 2 + 1, n + 1) res += dp[n][i];
    /*rep1(i, 1, n + 1)
    {
        rep1(j, 0, n + 1) cout << dp[i][j] << " ";
        cout << endl;
    }*/
    cout << setprecision(12) << res << endl;
    return;
}
int main()
{
    /*#ifndef ONLINE_JUDGE
	    freopen("input.txt", "r", stdin);
	    freopen("output.txt", "w", stdout);
	#endif*/
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll q = 1;
    //cin >> t;
    while (q--)
        thunder();
}


Measured memory_bytes: 85664
N = int(input())
W = input()
shiri = W[-1]
said = set()
said.add(W)
for i in range(N-1):
    W = input()
    if W[0] != shiri:
        print("No")
        exit()
    if W in said:
        print("No")
        exit()
    shiri = W[-1]
    said.add(W)
print("Yes")


Measured memory_bytes: 3060
#include <stdio.h>

bool d[12];

int a[4];
int b[4];

int main()
{
while(1 == scanf("%d",a))
{
for(int i = 1; i < 4; i++)
{
scanf("%d",a + i);
}
for(int i = 0; i < 4; i++)
{
scanf("%d",b + i);
}
for(auto& i : d)
{
i = false;
}
for(auto i : a)
{
d[i] = true;
}
int hi = 0;
int bu = 0;
for(int i = 0; i < 4; i++)
{
if(a[i] == b[i])
{
hi++;
}
else if(d[b[i]])
{
bu++;
}
}
printf("%d %d\n",hi,bu);
}
}

Measured memory_bytes: 1008
*> AtCoder My Practice
       *> author: Leonardone @ NEETSDKASU
       *>
       IDENTIFICATION DIVISION.
       PROGRAM-ID. Answer.
       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
       REPOSITORY.
              FUNCTION ALL INTRINSIC.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
              01 Input-Values.
                     05 a-str  PIC 9(5).
                     05 sp     PIC X.
                     05 b-str  PIC 9(5).
              01 Calc-Values.
                     05 a      BINARY-LONG.
                     05 b      BINARY-LONG.
              01 Answer-Values.
                     05 disp   PIC Z(4)9.
                     05 ans    BINARY-LONG.
       PROCEDURE DIVISION.
       AnswerMain SECTION.
       000-Start.
       
              ACCEPT Input-Values.
              MOVE a-str TO a.
              MOVE b-str TO b.
       
       001-LoopHead.
              MOVE a TO a-str.
              IF a-str(1:1) = a-str(5:1)
              AND a-str(2:1) = a-str(4:1) THEN
                    ADD 1 TO ans
              END-IF.
              ADD 1 TO a.
              IF a > b THEN
                     GO TO 002-OutputAnswer
              END-IF.
              GO TO 001-LoopHead.
      
       002-OutputAnswer.
      	      MOVE ans TO disp.
              DISPLAY TRIM(disp).
       END PROGRAM Answer.


Measured memory_bytes: 384