akhauriyash/Code-Regression huggingface dataset:
#include <ctype.h>
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int a[200000];
int main(void){
	int n=nextint();
	for(int i=0; i<n; i++){
		a[i]=nextint();
	}
	int h=a[0];
	long ans=0;
	for(int i=1; i<n; i++){
		if(a[i]>h){
			h=a[i];
		}else{
			ans+=h-a[i];
		}
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 2332
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[4] = {-1, 0, 1, 0};
ll dy[4] = {0, 1, 0, -1};

int main(void){
    ll n;
    cin >> n;
    vector<ll> b(102000, 0);
    vector<bool> c(102000, false);
    //p.push_back(2);
    vector<p> a;
    for(ll i = 0; i < n; i++){
        ll l, r;
        cin >> l >> r;
        a.push_back(p(l, r));
    }
    c[2] = true;
    for(ll i = 3; i <= 100000; i+=2){
        bool ok = true;
        for(ll j = 2; j <=sqrt(i); j++){
            if(i%j==0){
                ok=false;
                break;
            }
        }
        if(ok==true) c[i] = true;
    }
    for(ll i = 2; i <= 100000; i++){
        if(c[i]==true && c[(i+1)/2]==true) b[i]=b[i-1]+1;
        else b[i]=b[i-1];
        //cout << c[i] << endl;
    }
    for(ll i = 0; i < n; i++){
        ll ans = 0;
        ll s = a[i].first, t = a[i].second;
        ans = b[t]-b[s-1];
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
    string X;
    cin >> X;
    stack<char> s;
    
    for (int i = 0; i < X.size(); i++) {
        if (s.empty()) {
            s.push(X[i]);
        } else {
            if (s.top() == 'S' && X[i] == 'T') {
                s.pop();
            } else {
                s.push(X[i]);
            }
        }

    }
    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 644
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define rev(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ O(logN)
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//



int main() {

    int n, m;
    cin >> n >> m;
    vector <int> x(m);
    rep(i,m) cin >> x[i];
    Sort(x);

    int ans;
    if (m <= n) ans = 0;
    else {
        ans = 0;
        int k = m - n;
        vector <int> dis(m-1);
        rep(i,m-1) dis[i] = x[i+1] - x[i];
        Sort(dis);
        rep(i,k) ans += dis[i];
    }

    out(ans);

    return 0;
}








Measured memory_bytes: 1024
#include<iostream>
#include<string>

int main() {
    std::string s;
    std::cin >> s;

    char ans[20];
    int index = 0;
    for (int i = 0; i < s.size(); i++) {
        if(s[i] != 'B') {
            ans[index++] = s[i];
        } else if(index != 0) {
            index--;
        }
    }

    ans[index] = '\0';

    std::cout << ans << "\n";
}

Measured memory_bytes: 3580
def prepare(N, MOD):
    fac = [None] * (N+2)
    finv = [None] * (N+2)
    inv = [None] * (N+2)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, N+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
    return fac, finv

def combination(N, K, fac, finv, MOD):
    if N < K:
        return 0
    if N < 0 or K < 0:
        return 0
    else:
        return fac[N] * (finv[K] * finv[N - K] % MOD) % MOD

MOD = 10 ** 9 + 7

N, K = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

fac, finv = prepare(N, MOD)
ans = 0
for i in range(N):
    comb = combination(i, K-1, fac, finv, MOD)
    ans += A[i] * comb

A.sort(reverse=True)
for i in range(N):
    comb = combination(i, K-1, fac, finv, MOD)
    ans -= A[i] * comb

ans %= MOD
print(ans)

Measured memory_bytes: 66216
#!/usr/bin/env python

def main():
    a, v = map(int, input().split())
    b, w = map(int, input().split())
    t = int(input())

    d = abs(a - b)
    v_rel = v - w
    if v_rel * t >= d:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


Measured memory_bytes: 9172
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
typedef vector<tint> vtint;
typedef vector<vint> vvint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=1050;
//↑templete
signed main(){

	deque<char> S;
	string s;
	cin>>s;
	for(char c:s)
		S.pb(c);
	int Q;
	cin>>Q;

	bool flipped=0;
	while(Q--){
		int t;
		cin>>t;
		if(t==1){
			flipped=!flipped;
		}
		else{
			int F;
			char C;
			cin>>F;
			cin>>C;
			if((F==1)^flipped)
				S.push_front(C);
			else
				S.push_back(C);
		}
	}

	if(flipped)
		reverse(S.begin(), S.end());

	for(char c:S)
		cout<<c;
	cout<<endl;

    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
    using namespace std;
    typedef long long int ll;
    #define mod 1000000007
    #define all(v)  v.begin(),v.end()
    #define pb push_back
    #define size(v)  (int) v.size()
    #define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
    ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
    ll inv(ll a){return power_mod(a,mod-2);}    
    ll power(ll a, ll x){ if(x==0) return 1; ll y= power(a,x/2); ll ans=(y*y); if(x%2) ans*=a; return ans;}
     ll fre[200005]={};
    int main(){
        ll n;;
        cin>>n;
        vector<ll> d(n);
       
        for(int i=0;i<n;i++) {cin>>d[i]; fre[d[i]]++;}
        
        for(int i=1;i<=200005;i++){
            fre[i]+=fre[i-1];
        }
        sort(all(d));

        ll ans=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
              ll c = d[j]-d[i];
              ll f = d[j]+d[i];

              ans = ans+fre[f-1]-fre[c];
              if(d[j]<f and d[j]>c) ans--;
              if(d[i]<f and d[i]>c) ans--;

            //  cout<<d[i]<<" "<<d[j]<<" "<<c<<" "<<f<<" "<<ans<<endl;
            }
        }    

        cout<<ans/3<<endl;


            
    }




Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using llong = long long;

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

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

    int A, B, C;
    cin >> A >> B >> C;

    int tmp = C - (A - B);
    if(tmp >= 0) {
        cout << tmp << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


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

const int inf = 2e9;
int n;
int a[200000];
vector<int> g[200000];
int dp[200001];
int ans[200000];

void rec(int from, int prev, int curr) {
  auto it = lower_bound(dp, dp + n + 1, a[from]);
  int saved = *it;
  *it = a[from];
  int nxt = max<int>(curr, it - dp + 1);
  ans[from] = nxt;
  for (int to : g[from]) {
    if (to == prev) continue;
    rec(to, from, nxt);
  }
  *it = saved;
}

int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  
  fill(dp, dp + n + 1, inf);
  rec(0, -1, 0);
  
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 31236
L2, R2= map(int, input().split())

L=L2%2019
R=R2%2019

hasamu=R2-L2
kotae=10000
if hasamu>2017:
  kotae=0
if L>R:
  kotae=0
else:
  for i in range(L,R):
    for j in range(i+1,R+1):
      seki=i*j
      amari=seki%2019
      if amari<kotae:
        kotae=amari
print(kotae)

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

ll dp[2][100005];
ll sum[100005];
int arr[110];
ll mod =1e9+7;
void solve(){
   memset(dp, 0, sizeof(dp));
   memset(arr, 0, sizeof(arr));
   memset(sum, 0, sizeof(sum));
   int i, j, n, k;
   cin>>n>>k;
   /*n=100;
   k=100000;*/
   for(i=0;i<n;i++){
      cin>>arr[i];
   }
   dp[0][0]=1;
   for(i=1;i<=n;i++){
      dp[i%2][0]=1;
      sum[0]=dp[(i+1)%2][0];
      for(j=1;j<=k;j++){
         sum[j]= ((sum[j-1])%mod+(dp[(i+1)%2][j])%mod)%mod;
      }//cout<<"HEllo";
      for(j=1;j<=k;j++){
         if(j<=arr[i-1]){
            dp[i%2][j]=sum[j];
         }else{
            dp[i%2][j] = (sum[j]- sum[j-arr[i-1]-1] + mod)%mod;
         }
      }
   }
   cout<<dp[n%2][k]<<endl;
}

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

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

// #include <boost/algorithm/string/join.hpp>
// using boost::algorithm::join;
//
// #include "boost/multi_array.hpp"
// boost::multi_array<int, 3> dp;
// dp.resize(boost::extents[10][9][8]);
//
// #include <boost/multiprecision/cpp_dec_float.hpp>  // quite slowly
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision; // mp::log10
// using bigint = boost::multiprecision::cpp_int;
// using rational = mp::cpp_rational;  // double d = static_cast<double>(r);

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

//constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
#define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  int N;
  cin >> N;

  map<string, int> m;
  REP(i, N) {
    string s;
    cin >> s;
    m[s] += 1;
  }

  int value = 0;
  for (auto kv : m) {
    chmax(value, kv.second);
  }

  for (auto kv : m) {
    if (kv.second == value) {
      cout << kv.first << endl;
    }
  }


  return 0;
}

/* vim: set expandtab shiftwidth=2 softtabstop=2 : */


Measured memory_bytes: 23808
#include<bits/stdc++.h>
using namespace std;
int n,k,s;
int main()
{
	scanf("%d%d%d",&n,&k,&s);
	for(int i=1;i<=k;i++)printf("%d ",s);
	if(s<1000000000)
	{
		for(int i=k+1;i<=n;i++)printf("1000000000 ");
	}
	else for(int i=k+1;i<=n;i++)printf("1 ");
	putchar(10);
	return 0;
}

Measured memory_bytes: 1280
def main():
    import sys
    input = sys.stdin.readline

    import heapq


    INF = 10 ** 15

    N, M, S, T = map(int, input().split())

    G_y = [[] for _ in range(N + 1)]
    G_s = [[] for _ in range(N + 1)]

    for _ in range(M):
        u, v, a, b = map(int, input().split())
        
        G_y[u].append([a, v])
        G_y[v].append([a, u])

        G_s[u].append([b, v])
        G_s[v].append([b, u])


    def dijksrea(s, G): #始点s, 隣接グラフG
        d = [INF] * (N + 1)
        d[s] = 0 #始点の距離を0にする
        pque = []
        heapq.heappush(pque, [0, s]) #要素を[距離、頂点]として管理　最初の位置を入れる

        while len(pque) != 0: #queの中に要素が残っている時
            p = heapq.heappop(pque) #最も距離が短いものを取り出す
            v = p[1] #距離が最も短い頂点
            if d[v] < p[0]: #取り出した値より既に小さい値がdに入っているときは無視して次へ
                continue
            for i in range(len(G[v])): #頂点vの隣接リストを走査
                e = G[v][i]
                if d[e[1]] > d[v] + e[0]: #距離が更新できるかを検討
                    d[e[1]] = d[v] + e[0]
                    heapq.heappush(pque, [d[e[1]], e[1]]) #更新できた場合、その値をpqueに入れる
        
        return d

    d_y = dijksrea(S, G_y)
    d_s = dijksrea(T, G_s)

    # print (d_y)
    # print (d_s)

    ans = [0] * (N + 1)
    for i in range(N, 0, -1): #交換する場所をどこにするか
        tmp = INF - d_y[i] - d_s[i]
        ans[i] = max(ans[i], tmp)
        ans[i - 1] = ans[i]

    print (*ans[1:], sep = '\n')

if __name__ == '__main__':
    main()

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

signed main() {
	int a[4];
	cin >> a[0] >> a[1] >> a[2] >> a[3];
	sort(a, a + 4);
	if (a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) {
		puts("YES");
	}
	else puts("NO");
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,k;

	cin >> a >> b;
	vector<vector<char>> data(a + 2, vector<char>(b + 2));

	rep(i, 1, a + 1) {
		rep(j, 1, b + 1) {
			cin >> data[i][j];
		}
	}

	rep(i, 0, a + 2) {
		data[i][0] = '.';
		data[i][b+1] = '.';

	}
	rep(i, 1, b + 1) {
		data[0][i] = '.';
		data[a+1][i] = '.';

	}
	bool ans = true;

	rep(i, 1, a + 1) {
		rep(j, 1, b + 1) {
			if (data[i][j] == '#') {
				if (data[i - 1][j] == '.' && data[i + 1][j] == '.' && data[i][j - 1] == '.' && data[i][j + 1] == '.') {
					ans = false;
				}
					
					
			}
		}
	}
	

	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;


}
	

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
#include <regex>
#include <functional>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int MAX_N = 100000;

typedef long long ll;

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    while (A > 0 && C >> 0) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            break;
        }
        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            break;
        }
    }
    
    return 0;
}

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

int main(){
  int n; scanf("%d", &n);
  vector<int> a(n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  deque<int> que;
  que.push_back(a[0]);
  for(int i = 1; i < n; i++){
    int now = que.front();
    if(now >= a[i]) que.push_front(a[i]);
    else{
      int id = lower_bound(que.begin(), que.end(), a[i]) - que.begin();
      que[id - 1] = a[i];
    }
  }
  printf("%d\n", int(que.size()));
}

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

using namespace std;

inline int read(){
	int x=0,f=1;
	char p=getchar();
	while(!isdigit(p)){
		if(p=='-') f=-1;
		p=getchar();
	}
	while(isdigit(p)) x=(x<<3)+(x<<1)+(p^48),p=getchar();
	return x*f;
}

const int maxn=1e5+5;

int n,m,tot[maxn],vis[maxn],ans1,ans2,cnt;
string s;

int main(){
	n=read();m=read();
	for(int i=1;i<=m;i++){
		int x=read();cin>>s;
		if(s[0]=='W') if(!vis[x]) tot[x]++;
		if(s[0]=='A') if(!vis[x]) ans1++,vis[x]=1,ans2+=tot[x];
	}
	cout<<ans1<<" "<<ans2<<endl;
	return 0;
}





Measured memory_bytes: 1024
n=gets.to_i
nums=gets.split.map(&:to_i)

mn=1e12
l=0
r=0

nums.each do |i|
    r+=i
end

for i in 0..(n-2) do
    l+=nums[i]
    r-=nums[i]
    dif = (l-r).abs
    mn = [mn,dif].min
end

puts mn

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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define inin(a, n, i) memset(a, i, sizeof(a[0])*(n))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto &x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))
	
template<class T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; }
template<class T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; }
template<class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; }

void read() {}
void print() {}
template<class T, class... Args> void read(T& a, Args&... args) { cin >> a; read(args...); }
template<class T, class... Args> void print(T a, Args... args) { cout << a << ' '; print(args...); }
template<class... Args> void println(Args... args) { print(args...); cout << endl; }

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

//=========================

void run_test() {
	int x; read(x);
	int c = 1;
	for(int k = 2000; k >= 400; k -= 200, c++) {
		if(x < k && x >= k-200) {
			println(c);
			return;
		}
	}
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;

int main()
{
    int a, b, C;
    cin >> a >> b >> C;
    double c = 3.14159265 * C / 180.0f ;
    double S = 0.5f * a * b * sin(c);
    double l = a + b + sqrt(a*a + b*b - 2.0f * a * b * cos(c));
    double h = b * sin(c);
    cout << fixed;
    cout << setprecision(6) << S << endl;
    cout << setprecision(6) << l << endl;
    cout << setprecision(6) << h << endl;
    return 0;
}


Measured memory_bytes: 3476
from collections import Counter

S = input()
S = S[::-1]
base = 2019
count = 0
mod_list = [0]
ten = 1
for i in range(len(S)):
    mod = (ten*int(S[i]))%base
    mod_list.append((mod+mod_list[i])%base)
    ten*= 10
    ten%= base

c = Counter(mod_list)

for i in range(2019):
    num = c[i]
    count += num*(num-1)//2
print(count)


Measured memory_bytes: 16644
N = int(input())

ans = 0
for n in range(1,N+1,1):
    ans += n*(n+1)//2

for i in range(0,N-1,1):
    u,v = map(int,input().split())
    u,v = min(u,v),max(u,v)
    ans -= u*(N-v+1)
print(ans)

Measured memory_bytes: 69812
#include <stdio.h>

#define N 100

int main(){

int i;
int j;
int n;
int tmp;
int count=0;
int data[N];

scanf("%d",&n);

for(i=0;i<n;i++){
scanf("%d",&data[i]);
 }
for(i=0;i<n-1;i++){
 for(j=1;j<n;j++){
   if(data[j]<data[j-1]){
   tmp = data[j];
   data[j] = data[j-1];
   data[j-1] = tmp;
   count++;
  }
 }
}

for(i=0;i<n-1;i++){
  printf("%d ",data[i]);
 }
 printf("%d\n",data[i]);
 printf("%d\n",count);
 return 0;
}

Measured memory_bytes: 600
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
    int n,k;
    while (cin >> n >> k) {
        LL ans = 0;
        if (k == 0)
            ans = 1LL*n*n;
        else {
            FOR(i,k+1,n+1) {
                const int x = n/i;
                ans += 1LL*x*(i-k);
                const int r = n%i;
                if (r >= k)
                    ans += r-k+1;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 384
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    // Rust version 1.15.1, which is used by AtCoder,
    // does not support std::str::FromStr for char
    ($iter:expr, char) => {
        $iter.next().unwrap().chars().next().expect("Parse error")
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
fn main() {
    use std::cmp::max;
    use std::cmp::min;
    use std::collections::HashMap;

    input!{
        n: usize,
        aa: [i32; n],
        bb: [i32; n],
        cc: [i32; n],
    }
    let mut a = aa;
    let mut b = bb;
    let mut c = cc;
    a.sort();
    b.sort();
    c.sort();

    let mut pos = 0;
    let mut v = Vec::new();
    v.push(0);
    for i in 0..n {
        while pos < n && b[i] > a[pos] {
            pos += 1;
        }
        v.push(pos);
    }
    for i in 1..n+1 {
        v[i] += v[i-1];
    }
    pos = 0;
    let mut ans = 0;
    for i in 0..n {
        while pos < n && c[i] > b[pos] {
            pos += 1;
        }
        ans += v[pos];
    }
    println!("{}", ans);
}


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

int n;
char c[11];
long long sum,ans;

void dfs(int k,long long now)
{
	if(k > n)
	{
		sum += now;
		ans += sum;
		sum -= now;
		return;
	}
if(k != 1)
		dfs(k + 1, now * 10 + c[k] - '0');
	sum += now;
	dfs(k+1, c[k]-'0');
	sum -= now;
}
int main()
{
	cin >> c + 1;
	n = strlen(c+1);
	dfs(1,0);
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T> constexpr bool chmax(T &a, const T &b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T &b) {
    if(a <= b) return false;
    a = b;
    return true;
}

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

using P = pair<int, int>;

int n;
ll a[100009], b[100009], c[100009], num[100009];

vector<P> G[100009];

int g = -1;

int dfs(int v, int p) {
    int res = 1;
    int x = -1;
    bool ok = true;
    for(auto &&e : G[v]) {
        int u, i;
        tie(u, i) = e;
        if(u == p) {
            x = i;
            continue;
        }
        int d = dfs(u, v);
        res += d;
        if(d * 2 >= n) ok = false;
    }
    if(x != -1) num[x] = min(res, n - res);
    if(2 * res <= n) ok = false;
    if(ok) g = v;
    return res;
}

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

    cin >> n;
    rep(i, n - 1) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
        G[a[i]].emplace_back(b[i], i);
        G[b[i]].emplace_back(a[i], i);
    }

    dfs(0, -1);

    ll res = 0;

    rep(i, n) res += c[i] * num[i] * 2;

    if(g == -1) {
        rep(i, n) if(num[i] * 2 == n) res -= c[i];
        cout << res << endl;
    } else {
        ll mn = inf;
        for(auto &&e : G[g])
            chmin(mn, c[e.second]);
        cout << res - mn << endl;
    }

    return 0;
}

Measured memory_bytes: 15616
#include<iostream>
#include<cmath>

using namespace  std;

int main(){

    int n;
    int x[100];

    cin >> n;
    for (int i=0;i<n;i++) cin >> x[i];

    double s=0;

    int i=0;

    while (i<n){
        s+= x[i];
        i++;
        }

    s = s/n;

    int a;
    int b;
    int c;

    a = floor(s);
    b = ceil(s);

    if (s-a > b-s) 
        c = b;
    else 
        c = a;

    int v=0;

    i=0;

    while (i<n){
        v += pow((c-x[i]),2);
        i++;
    }

    cout << v << endl;
}

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

int main() {
  string s;
  cin >> s;
  
  if(s.at(2) == s.at(3) && s.at(4) == s.at(5))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int k[1000005];
int ct[1000005];
int main(){
	
	scanf("%d",&n);
	for (int i = 0; i < n; i++){
		scanf("%d",&a[i]);
		ct[a[i]]++;
	}
	
	for (int i = 1; i <= 1000000; i++){
		if (k[i] == 0 && ct[i] >= 1){
			if (ct[i] > 1) k[i] = 1;
			for (int j = 2*i; j <= 1000000; j+=i){
				k[j] = 1;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < n; i++){
		if (k[a[i]] == 0) ans++;
	}
	printf("%d",ans);
		
	
	
}	


Measured memory_bytes: 12224
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <math.h>
#include <cstdio>
#include <iomanip>
typedef  long long ll;
using namespace std;

int main(void) {
	ll n;
	map<string, int> S;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		S[s]++;
	}
	
	int cnt = 0;
	for (auto i = S.begin(); i != S.end() ; i++) cnt = max(cnt, i->second);
	for (auto i = S.begin(); i != S.end() ; i++)
	{
		if (i->second == cnt)
		{
			cout << i->first << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 25984
#include<iostream>
#include<string>
using namespace std;
#include<math.h>

int main()
{
  
  int a,b;
  cin>>a>>b;
  long long int T=0;
  string K;
  if(a==b)
  { 
    for(int i=0;i<a;++i)
    {
      T=T+(a*pow(10,i));
    }
    
    K=to_string(T);
   cout<<K<<endl;
  }
  else
  {
    if(a>b)
    {
      
       for(int i=0;i<a;++i)
    {
      T=T+(b*pow(10,i));
    }
    K=to_string(T);
   cout<<K<<endl;
      
    }
    else
    {
    
       for(int i=0;i<b;++i)
    {
       T=T+(a*pow(10,i));
    }
    K=to_string(T);
   cout<<K<<endl;
    }
  }

}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

ll dp[101010];
ll inf = 1e10;

int main() {
    ll N, K;
    cin >> N >> K;
    fill(dp, dp+N+1, inf);

    vector<ll> h(N);
    rep(i, N) cin >> h[i];

    dp[0] = 0;
    for (int i=0; i<N; ++i) {
        for (int k=1; k<=K; ++k) {
            if (i+k >= N) break;
            dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]));
        }
    }

    cout << dp[N-1] << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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 void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
// const int MOD = 1000000007;
const int MOD = 998244353;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    ll n, k;
    cin >> n >> k;
    // 10^18 < 2^60
    vvi a(60, vi(n));
    REP(j, n) {
        cin >> a[0][j];
        a[0][j]--;
    }
    // doubling
    REP(i, 59) REP(j, n) a[i + 1][j] = a[i][a[i][j]];

    int p = 59;
    int ans = 0;
    while (k > 0) {
        if (k >= (ll)pow(2, p)) {
            ans = a[p][ans];
            k -= (ll)pow(2, p);
        }
        p--;
    }
    cout << ans + 1 << endl;
}


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

ll gcd(ll a, ll b) {
	ll x = max(a,b);
	ll y = min(a,b);
	ll r = x % y;
	while(r!=0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}

int main() {
	ll a,b;
	cin >> a >> b;
	ll g = gcd(a,b);
	ll g_ori = g;
	ll ans = 1;
	ll p = 2;
	bool div_first = true;
	while(g>1) {
		if (g%p==0) {
			g/=p;
			//cout << p << " ";
			if (div_first) {
				ans++;
				div_first = false;
			}
		}
		else {
			div_first = true;
			p++;
		}
		if (p*p>g_ori) {
			ans++;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Linq;
using UnionFind;

class Program
{
    private static int N;
    private static int M;
    private static int[][] L;

    public static void Main()
    {
        /*入力を受け取る*/
        int[] inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
        N = inputs[0];
        M = inputs[1];
        L = new int[N][];
        for (int i = 0; i < N; i++)
        {
            inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
            L[i] = new int[inputs[0]];
            for (int j = 1; j <= inputs[0]; j++)
                L[i][j - 1] = inputs[j] - 1; //言語の番号は0～M-1に変更
        }

        /*どの言語間でコミュニケーションがとれるか、言語をノードとするUnionFind
           を用いて整理する。*/
        UF uf = new UF(M);
        foreach (var l in L) //各参加者について
            for (int i = 0; i < l.Length - 1; i++)
                uf.Unite(l[i], l[i + 1]); //その人の話せる言語を統合

        /*参加者iとi+1の話せる言語が同じ木に属するか、で判定*/
        for (int i = 0; i < N - 1; i++)
        {
            if (uf.Same(L[i][0], L[i + 1][0]))
                continue;
            Console.WriteLine("NO");
            return;
        }
        Console.WriteLine("YES");
    }
}

namespace UnionFind
{
    class UF
    {
        private int[] 親; //親[i] : iの親の番号

        public UF(int N) //コンストラクタ、すべてが根として初期化
        {
            親 = new int[N];
            for (int i = 0; i < N; i++)
                親[i] = i;
        }

        public int Root(int x) //xの属する木の根を返す
        {
            if (親[x] == x) return x;
            return 親[x] = Root(親[x]);
        }

        public void Unite(int x, int y) //xとyの木を統合
        {
            int rx = Root(x);
            int ry = Root(y);
            if (rx == ry) return;
            親[rx] = ry;
        }

        public bool Same(int x, int y) //xとyが同じ木に属するかどうかを返す
        {
            return Root(x) == Root(y);
        }
    }
}

Measured memory_bytes: 28492
// Problem : A - Palindromic Number
// Contest : AtCoder - AtCoder Beginner Contest 070
// URL : https://atcoder.jp/contests/abc070/tasks/abc070_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
string s;cin>>s;
for(int i=0;i<size(s)/2;i++)
{
	if(s[i]==s[size(s)-i-1])
	continue;
	else
	{
		cout<<"No";
		return;
	}
}
cout<<"Yes";
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


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

int main(){
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<vector<int>> lr(q, vector<int>(2));
    for (int i = 0; i < q; i++){
        cin >> lr[i][0] >> lr[i][1];
    }
    vector<int> a(n + 1, 0);
    for (int i = 1; i < n; i++){
        a[i + 1] = a[i];
        if (s[i - 1] == 'A' & s[i] == 'C'){
            a[i + 1] += 1;
        }
    }
    for (int i = 0; i < q; i++){
        cout << a[lr[i][1]] - a[lr[i][0]] << endl;
    }
}


Measured memory_bytes: 6784
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstring>

using namespace std;

int main(){
  char s1[52], s2[52];
  int n;
  int i = 0;
  int prev, curr;
  long long tot;
  cin >> n;
  cin >> s1;
  cin >> s2;
  if (s1[0] == s2[0]) {
    tot = 3;
    prev = 1;
    i++;
  } else {
    tot = 6;
    prev = 0;
    i += 2;
  }
  while (i<n) {
    if (s1[i] == s2[i]) {
      if (prev == 1) {
	tot = 2 * tot;
      } /*else {
	tot = 1*tot;
	}*/
      prev = 1;
      i++;
    } else {
      if (prev == 1) {
	tot = 2 * tot;
      } else {
	tot = 3*tot;
      }
      prev = 0;
      i += 2;
    }
    tot = tot % 1000000007;
  }
  cout << tot << endl;
}


Measured memory_bytes: 256
import sys
if __name__ == '__main__':
    s = input()
    o = []
    n = len(s)
    
    for i in range(1 << n - 1):
        tmp = 0
        tmp += int(s[0])
        o.clear()
        for j in range(n - 1):
            if 1 << j & i == 0:
                tmp += int(s[j + 1])
                o.append('+')
            else:
                tmp -= int(s[j + 1])
                o.append('-')
        if tmp == 7:
            print(s[0]+o[0]+s[1]+o[1]+s[2]+o[2]+s[3]+'=7')
            sys.exit()

Measured memory_bytes: 9208
import math
import numpy as np

A, B, H, M = map(int, input().split())

r_H = 360 * ((H + M / 60) / 12)
r_M = 360 * M / 60

r = np.abs(r_H - r_M)
r = min(r, 360 - r)

C = np.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(r)))

print(C)


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

int main() {
   int N,K;
   cin>>N>>K;
   int sum=0;
  int x;
  for(int i=0;i<N;i++){
  
    cin>>x;
    if (x<=K-x){
      sum+=2*x;
    }
    else if(x>K-x){
      sum+=2*(K-x);
    }
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  long long ans=0;
  for(int i=1;i<=n-1;i++){
    if(a[i]<a[i-1]) {
      ans+=a[i-1]-a[i];
      a[i]=a[i-1];
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4840
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;
int main()
{
	LL n,m;
	
	while(~scanf("%lld %lld",&n,&m))
	{
		LL ans = 0;
		if(n * 2 < m)
		{
			ans += n; 
		}
		else
		{
			printf("%lld\n",m/2);
			continue;
		}
		m -= n * 2;
		ans += m / 4;
		printf("%lld\n",ans);
	 } 
 } 

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

void main()
{
	auto pre = readln.chomp.split(",").map!(to!int).array;
  foreach (line; stdin.byLine) {
    auto now = line.chomp.split(",").map!(to!int).array;
    auto tmp = new int[](now.length);

    if (pre.length < now.length) {
      foreach (i; 0..pre.length) {
        tmp[i] = max(tmp[i], pre[i] + now[i]);
        tmp[i+1] = max(tmp[i+1], pre[i] + now[i+1]);
      }
    } else {
      foreach (i; 0..now.length) {
        tmp[i] = max(max(tmp[i], pre[i] + now[i]), pre[i+1] + now[i]);
      }
    }
    pre = tmp;
  }
  pre[0].writeln;
}

Measured memory_bytes: 1332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int h1,m1,h2,m2,k;
  cin>>h1>>m1>>h2>>m2>>k;
  cout<<60*h2+m2-60*h1-m1-k<<endl;
}

Measured memory_bytes: 3592
using System;
using static System.Console;
using static System.Math;
 
public class Hello{
    public static void Main(){
        int a = 6;
        a /= rint();
        a /= rint();
        WriteLine(a);
        
        
        
        
        
    }
    //各種読取
    static string rstr(){
        return ReadLine();
    }
    static int rint(){
        return int.Parse(ReadLine());
    }
    static long rlong(){
        return long.Parse(ReadLine());
    }
    static string[] stra(){
        return ReadLine().Split(' ');
    }
    static int[] inta(){
        string[] read_str_array = ReadLine().Split(' ');
        int[] return_int_array = new int[read_str_array.Length];
        for(int countup_i=0;countup_i<read_str_array.Length;countup_i++){
            return_int_array[countup_i] = int.Parse(read_str_array[countup_i]);
        }
        return return_int_array;
    }
    static int[,] inta2(int num_array,int in_array){
        int[,] int_array2 = new int[num_array,in_array];
        for(int i=0;i<num_array;i++){
            int[] temp_array = inta();
            for(int j=0;j<in_array;j++){
                int_array2[i,j] = temp_array[j];
            }
        }
        return int_array2;
    }
    // A/B小数点以下切上
    static int divideup(int divided,int divid){
        int temp_divide = divided/divid;
        if(divided % divid > 0){
            temp_divide++;
        }
        return temp_divide;
    }
    static long gcd(long big,long small){
        if(big < small){
            long temp = big;
            big = small;
            small = temp;
        }
        if(big % small == 0){
            return small;
        }else{
            big %= small;
            return gcd(small,big);
        }
    }
    static long lcm(long big,long small){
        long temp = big * small;
        long gcds = gcd(big,small);
        temp /= gcds;
        return temp;
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back 
int main()
{
  ll n ,d,i,ans=0,a,b;
  ll dist;
  cin>>n>>d;
  for(i=0;i<n;i++)
  {
      cin>>a>>b;
      dist=(a*a)+(b*b);
      if(dist<=(d*d))
      ans++;
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3616