akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define endl "\n"
#define pii pair<int,int>
#define pll pair<ll,ll>
typedef long long ll;
#define loop() for(int i=0; i<(); i++)
const int MOD=1e9+7;
int modpow(int x, int n, int m)
{
    if(n==0) return 1;
    ll ans=1;
    while(n>0)
    {
        if(n%2==1) ans=(ans*x)%m;
        x=(x*x)%m;
        n/=2;
    }
    return ans;
}

void solve()
{
    int n;
    cin>>n;
    vector<int>a(n);
    for(auto&i :a) cin>>i;
    vector<vector<ll>>dp(n+1,vector<ll>(n+1,0));
    for(int i=1; i<=n; i++)
    {
        for(int j=i; j>=1; j--)
        {
            if(j==i) dp[j][i]=a[i-1];
            else dp[j][i]=max(a[j-1]-dp[j+1][i],a[i-1]-dp[j][i-1]);
        }
    }
    cout<<dp[1][n]<<endl;
}   

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

}


Measured memory_bytes: 73696
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);

    long n = scan.nextInt();
    long m = scan.nextInt();
    long sum = 0;

    for (int i = 0; i < m; i++) {
      sum += scan.nextInt();
    }
    if (n >= sum) {
      System.out.println(n - sum);
    } else {
      System.out.println(-1);
    }
  }

}

Measured memory_bytes: 46368
from heapq import heappush, heappop, heapify
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
    N = int(readline())
    S = readline().strip()
    L = len(S)
    S += "+"
    if L % 2 == 0 and N < 10:
        write("-1\n")
        return
    pw10 = [1]*11
    for i in range(10):
        pw10[i+1] = pw10[i] * 10
    INF = N+1
    dist = [[INF]*(L+2) for i in range(L+1)]
    ques = [[] for i in range(L+1)]
    ques[0] = [(0, 0)]
    dist[0][0] = 0
    for k in range(L+1):
        que = ques[k]
        dist0 = dist[k]
        heapify(que)
        while que:
            cost, i = heappop(que)
            if dist0[i] < cost or i > L:
                continue

            p = S[i]
            if i+1 != L-1:
                if p != "+":
                    v = int(p)
                    if S[i+1] != '+':
                        if cost + v < dist[k+1][i+2]:
                            dist[k+1][i+2] = cost + v
                            ques[k+1].append((cost + v, i+2))
                    else:
                        if cost + v < dist0[i+2]:
                            dist0[i+2] = cost + v
                            heappush(que, (cost + v, i+2))
                if p != "0":
                    nk = k+1 + (S[i+1] != "+")
                    if cost < dist[nk][i+2]:
                        dist[nk][i+2] = cost
                        ques[nk].append((cost, i+2))
            def calc(c0, p):
                for j in range(i+2, min(i+10, L+1)):
                    if j == L-1:
                        continue
                    p1 = p + S[i+1:j]; l = j-i
                    c = c0 + p1.count("+")
                    v = int(p1.replace(*"+0"))
                    if v <= N:
                        nk = k+c + (S[j] != '+')
                        if cost + v < dist[nk][j+1]:
                            dist[nk][j+1] = cost + v
                            ques[nk].append((cost + v, j+1))
                    b = pw10[l-2]
                    for e in range(l-2, -1, -1):
                        a = (v // b) % 10
                        if a:
                            v -= a * b
                            c += 1
                            if v <= N:
                                nk = k+c + (S[j] != '+')
                                if cost + v < dist[nk][j+1]:
                                    dist[nk][j+1] = cost + v
                                    ques[nk].append((cost + v, j+1))
                        b //= 10
            if p not in "0+":
                calc(0, p)
            if p != "1":
                calc(1, "1")
        if dist0[L+1] <= N:
            write("%d\n" % k)
            break
solve()


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

using namespace std;

int main(){
    string S,T;
    cin >> S;
    cin >> T;
    unordered_map<char,char> mp1,mp2;
    for(int i=0;i<S.size();i++){
        if(mp1[S[i]]==NULL){
            mp1[S[i]] = T[i];
        }

        if(mp2[T[i]]==NULL){
            mp2[T[i]] = S[i];
        }
        
        if(mp1[S[i]]!=T[i] || mp2[T[i]]!=S[i]){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define all(x) (x).begin(), (x).end()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end());
const long long INF = 1LL << 60;
// map<int,int> mp;

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

  ll  sum = 0;

  for (ll i = 0; i < N.size(); i++) {
    // cout <<  << endl;
    sum += (int)(N[i]-'0');
  }

  if (sum == 0) {
    cout << "Yes" << endl;
    return 0;
  }

  if (sum % 9 == 0) {
    cout << "Yes" << endl;

  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
int main() {
     int r, D, X;
     cin >> r >> D >> X;
     vector<int> x(10);
     x[0] = r*X - D;
     cout << x[0] << endl;
     for(int i = 1;i < 10;i++){
          x[i] = r*x[i-1] - D;
          cout << x[i] << endl;
     } 
}

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

int main() {
	int n;
	cin >> n;
	vector<vector<int>> mp(2, vector<int>(n));
	rep(i, 2) {
		rep(j, n) {
			cin >> mp[i][j];
		}
	}
	vector<vector<int>> dp(2, vector<int>(n));
	dp[0][0] = mp[0][0];
	rep(i, n - 1) dp[0][i + 1] = dp[0][i] + mp[0][i + 1];
	dp[1][0] = dp[0][0] + mp[1][0];
	rep(i, n - 1) dp[1][i + 1] = max(dp[0][i + 1], dp[1][i]) + mp[1][i + 1];
	cout << dp[1][n - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MOD = (int)1e9 + 7;
int INF = (int)2e18;
// Comment out below and program paste

// #include "UnionFind.hpp"
// #include "power.hpp"

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> A(5);
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
    }
    int k;
    cin >> k;
    bool check = true;
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            if (abs(A[i] - A[j]) > k) check = false;
        }
    }

    cout << (check ? "Yay!" : ":(") << endl;
}


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

const int maxn=100100;
int a[maxn],b[maxn];
const int md=1e9+7;
struct node{
	int x,y;
}c[maxn];
bool operator == (const node &A,const node &B){
	return A.x==B.x&&A.y==B.y;
}
bool cmpc(const node &A,const node &B){
	return A.x==B.x?A.y>B.y:A.x<B.x;
}
int tr[maxn<<1];
int num=0,p;
void Add(int x,int v){
	while(x<=num){
		tr[x]=(tr[x]+v)%md;
		x+=x&(-x);
	} 
}
int Query(int x){
	int res=1;
	while(x){
		res=(res+tr[x])%md;
		x-=x&(-x);
	}
	return res;
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(int i=1;i<=m;i++)
		scanf("%d",&b[i]);
	sort(a+1,a+n+1);
	sort(b+1,b+m+1);
	for(int i=1;i<=n;i++)
		if(a[i]>=b[1]&&a[i]<=b[m]){
			p=lower_bound(b+1,b+m+1,a[i])-b-1;
			c[++num]=(node){a[i]-b[p],b[p+1]-a[i]};
		}
	sort(c+1,c+num+1,cmpc);
	num=unique(c+1,c+num+1)-(c+1);
	for(int i=1;i<=num;i++)
		a[i]=c[i].x;
	sort(a+1,a+num+1);
	for(int i=1;i<=num;i++)
		c[i].x=lower_bound(a+1,a+num+1,c[i].x)-a;
	
	for(int i=1;i<=num;i++)
		a[i]=c[i].y;
	sort(a+1,a+num+1);
	for(int i=1;i<=num;i++)
		c[i].y=lower_bound(a+1,a+num+1,c[i].y)-a;
	
	sort(c+1,c+num+1,cmpc);
	int ans,val;
	for(int i=1;i<=num;i++){
		val=Query(c[i].y-1);
		Add(c[i].y,val);
	}
	ans=Query(num);
	printf("%d\n",ans);
	return 0;
} 

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

int main() {

  string  n;
  cin >> n;
  
  if( (n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]) )
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(11);
    int N;
    cin >> N;
    double ans = 0;
    for(int i=0; i < N; i++){
        double xi;
        cin >> xi;
        string ui;
        cin >> ui;
        if(ui == "JPY") ans += xi;
        else if(ui == "BTC") ans += xi * 380000.0;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

struct SieveOfEratosthenes {
    vector<ll> primes;
    vector<bool> isPrime;
    SieveOfEratosthenes(ll n_) : isPrime(n_ + 1, true) {
        isPrime[0] = isPrime[1] = false;
        ll k = 2;
        for (ll sqrt_n = (ll)sqrt(n_) + 2; k < sqrt_n; ++k) {
            if (!isPrime[k]) continue;
            primes.push_back(k);
            for (ll l = k * 2; l <= n_; l += k) isPrime[l] = false;
        }
        for (; k <= n_; ++k) if (isPrime[k]) primes.push_back(k);
    }
    int operator [](int i) const { return primes[i]; }
    int size() const { return primes.size(); }
} soe(1e6);

int main() {
    int X;
    cin >> X;
    rep(i, X, 1e6) {
        if (soe.isPrime[i]) {
            write(i);
            return 0;
        }
    }
}

Measured memory_bytes: 1528
#include<stdio.h>
int main(){
    double W,H,x,y;
    int ok=0;
    scanf("%lf%lf%lf%lf",&W,&H,&x,&y);
    if(x==W/2&&y==H/2)ok=1;
    printf("%.9lf %d\n",(W*H)/2,ok);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};

int main(){
    int n; cin >> n;
    ll cnt = 0;
    for(int i = 1; i < n; i++){
        ll tmp = n/i;
        if(n - tmp* i == 0){
            tmp--;
            cnt += tmp;
        }else {
            cnt += tmp;
        }
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } else return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } else return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1e9+100;
const ll INFL = 1e18+100;
const ll MOD = 1e9+7;
const bool debug = 0;

int main() {
	int N;
	cin >> N;
	
	int ans = 0;
	FOR(i, 1, N + 1) if (i % 2 == 1) {
		int cnt = 0;
		FOR(j, 1, i + 1) if (i % j == 0) cnt++;
		if (cnt == 8) ans++;
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#define M 1000000007

static inline int gcd(unsigned s, unsigned t)
{
  int r;
  if (t == 0) return s;
  for ( ;(r = s % t) != 0; s = t, t = r);
  return t;
}

static inline long inverse(unsigned long a)
{
  long x = 1, g = a % M, v = 0, w = M, s, t, q;

  while (w != 0) {
    q = g / w;
    t = g - q * w;
    s = x - q * v;
    x = v;
    g = w;
    v = s;
    w = t;
  }

  x %= M;

  if (x < 0) x += M;

  return x;
}

int
main(int ac, char *av[])
{
  int n;
  unsigned long A[10000];
  unsigned long G[10000];

  unsigned long u, l, ll = 1, z = 0;

  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lu", &A[i]);
  }

  for (int i = 0; i < n; ++i) {
    unsigned long a = A[i];

    l = 1;
    for (int j = 0; j < i; ++j) {
      l *= (A[j] / G[j]);
      l %= a;
    }

    G[i] = gcd(l, a);

    u = a / G[i];

    z = (z * u) + ll * inverse(G[i]);

    z %= M;

    ll = (ll * u) % M;
  }

  printf("%lu\n", z);

  return 0;
}


Measured memory_bytes: 1860
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////

ll a,b,c,d[100005] = {},n,m;
string s,t;


int main(){

    cin >> a >> b;
    if(a < 10 && b < 10)P(a*b);
    else P(-1);

    ret 0;
    cin >> n;

    rep(i,1,10){
	if(n == (n/i) * i){
	    Yes;
	    ret 0;
	}
    }
    No;
    
    return  0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	string want;
	int n, res = 0;
	cin >> want >> n;
	rep(i, n)
	{
		string ring;
		cin >> ring;
		if ((ring + ring).find(want) != string::npos)
			++res;
	}
	cout << res << endl;
}

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

using namespace std;

int main() {
int n;
cin>>n;
string s;
cin>>s;
int a[n]={0},b[n]={0};
if(s[0]=='E')a[0]=1;
else b[0]=1;
for(int i=1;i<n;i++)
{
    if(s[i]=='E'){a[i]=a[i-1]+1;b[i]=b[i-1];}
    else{ b[i]=b[i-1]+1;a[i]=a[i-1];}
   // cout<<a[i]<<" "<<b[i]<<'\n';
}
int ans=n+2;
for(int i=0;i<n;i++)
{
    if(i==0)ans=min(ans,a[n-1]-a[i]);
    else
    {   if(i==n-1){ans=min(ans,b[i-1]);}
    else{
        int u=b[i-1]+a[n-1]-a[i];
    ans=min(u,ans);
  
    }
    }
   // cout<<ans<<' '<<i<<'\n';
}
cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 2948
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;

int main()
{
	boost;
	string s;
	cin >> s;
	if(s.back() == 's') s += "es";
	else s += "s";
	cout << s;
}


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector<char> arr;
    arr.push_back(s[0]);
    for(int i=1;i<s.length();i++)
    {
        if(s[i]!=s[i-1]){arr.push_back(s[i]);}
    }
    cout<<arr.size();
}


Measured memory_bytes: 3696
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

// 各桁の和を計算する関数
int findSumOfDigits(int n) {
	if (n < 10)return n;
	return findSumOfDigits(n / 10) + n % 10;
}

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

	int N;
	cin >> N;
	cout << (N%findSumOfDigits(N)==0?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#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;
  vector<int> x(N), y(N);
  rep(i,N) cin >> x[i] >> y[i];
  double dis = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i+1; j < N; ++j) {
      dis += sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
    }
  }
  int way = 1;
  rep(i,N) way *= i+1;
  double ans = dis * 2 / N;
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 3256
#include <stdio.h>
#include <math.h>
int abs(int n){
    if(n > 0){
        return n;
    } else {
        return -n;
    }
}


int main(){
  int n;
  scanf("%d", &n);
  int h[n];
  for(int i = 0; i < n; i++){
      scanf("%d", &h[i]);
  }
  
  int count = 1;
  int flag = 1;
  for(int i = 1; i < n; i++){
    flag = 1;
    for(int j = 0; j < i; j++){
        if(h[j]>h[i]){
            flag = 0;
        }

        if(flag==0){
            break;
        }
    }
    if(flag==1){
        count++;
    }
  }

  printf("%d", count);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <cmath>
#include <numeric>
#include <sstream>
#include <iomanip>
using ll = long long;
using namespace std;

int main()
{
    ll N;
    cin >> N;
    vector<ll> cost(5);
    for (int i = 0; i < 5; i++)
        cin >> cost[i];
    sort(cost.begin(), cost.end());
    cout << N / cost[0] + 4 + (N % cost[0] != 0) << endl;

    return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if(a > b){
    if((a-b)%2 == 0){
      cout << (a-b)/2 + b << endl;
    }else{
      cout << "IMPOSSIBLE" << endl;
    }
  }else{
    if((b-a)%2 == 0){
      cout << (b-a)/2 + a << endl;
    }else{
      cout << "IMPOSSIBLE" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    string S;
    cin >> S;
    if(S=="Sunny") pr("Cloudy");
    else if(S=="Cloudy") pr("Rainy");
    else pr("Sunny");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

struct UnionFind {
  const int n;
  V<> t; // root ? -sz : par
  UnionFind(int n) : n(n), t(n, -1) {}
  int find(int v) { return t[v] < 0 ? v : t[v] = find(t[v]); }
  void unite(int u, int v) {
    if ((u = find(u)) == (v = find(v))) return;
    if (-t[u] < -t[v]) swap(u, v);
    t[u] += t[v];
    t[v] = u;
  }
  bool same(int u, int v) { return find(u) == find(v); }
  int size(int v) { return -t[find(v)]; }
};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  while (true) {
    int w, h; cin >> w >> h;
    if (!w) break;
    V<string> s(h); for (auto&& e : s) cin >> e;
    V<> di{1, 0, -1, 0}, dj{0, 1, 0, -1};
    auto in = [&](int i, int j) -> bool { return 0 <= i and i < h and 0 <= j and j < w; };
    auto _ = [&](int i, int j) -> int { return i * w + j; };
    UnionFind uf(h * w);
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] == '.') {
      if (i + 1 < h and s[i + 1][j] == '.') uf.unite(_(i, j), _(i + 1, j));
      if (j + 1 < w and s[i][j + 1] == '.') uf.unite(_(i, j), _(i, j + 1));
    }
    set<int> sb, sw;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) {
      if (s[i][j] == 'B') {
        for (int d = 0; d < 4; ++d) {
          int ni = i + di[d], nj = j + dj[d];
          if (!in(ni, nj)) continue;
          if (s[ni][nj] == '.') sb.insert(uf.find(_(ni, nj)));
        }
      }
      if (s[i][j] == 'W') {
        for (int d = 0; d < 4; ++d) {
          int ni = i + di[d], nj = j + dj[d];
          if (!in(ni, nj)) continue;
          if (s[ni][nj] == '.') sw.insert(uf.find(_(ni, nj)));
        }
      }
    }
    int cb = 0, cw = 0;
    for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j) if (s[i][j] == '.') {
      int p = uf.find(_(i, j));
      cb += sb.count(p) and !sw.count(p);
      cw += sw.count(p) and !sb.count(p);
    }
    cout << cb << ' ' << cw << '\n';
  }
}


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

int main() {
  int N;
  int ans = 0;
  cin >> N;

  for (int i = 1; i <= N; i+=2) {
    int count = 0;
    for (int j = 1; j <= i; j++)
      if (i % j == 0)
	count++;

    if (count == 8)
      ans++;
  }

  cout << ans << endl;

  return 0;
}


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

using namespace std;

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }
};

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

    UnionFind UF(n);
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        a -= 1; b -= 1;
        UF.unite(a, b);
    }
    
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        ans = max(ans, UF.size(i));
    }
    
    cout << ans << endl;
    
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

ll dis(ll x,ll y){
    ll res;
    if(x>=0&&y>=0)res=abs(x-y);
    else if(x<0)res=abs(y-x);
    else if(y<0)res=abs(x-y);
    else res=abs(x*-1-y*-1);
    return res;
}

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

    cin>>n;
    rep(i,n){
        cin>>a[i+1];
    }
    a[0]=0;
    a[n+1]=0;
    rrep(i,1,n+2){
        ans+=dis(a[i],a[i-1]);
    }
    rrep(i,1,n+1){
        pos=ans;
        pos-=dis(a[i],a[i-1]);
        pos-=dis(a[i],a[i+1]);
        pos+=dis(a[i-1],a[i+1]);
        Cout(pos);
    }
    return 0;
}


Measured memory_bytes: 2048
n = int(input())

num = [[0] * 10 for _ in range(10)]
for k in range(1, n + 1):
    s = str(k)
    num[int(s[0])][int(s[-1])] += 1

count = 0
for k in range(10):
    for i in range(10):
        count += num[k][i] * num[i][k]

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n;

ll a[55][55],b[55][55],c[55][55],d[55][55],k,mod=1e9+7,ans;

void p1(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            d[i][j]=0;
            for(int k=1;k<=n;k++){
                d[i][j]+=(b[i][k]*b[k][j])%mod;
                d[i][j]%=mod;
            }
        }
    }
}

void p2(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            d[i][j]=0;
            for(int k=1;k<=n;k++){
                d[i][j]+=(c[i][k]*a[k][j])%mod;
                d[i][j]%=mod;
            }
        }
    }
}

void pwr(ll k){
    if(k==1){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                b[i][j]=a[i][j];
            }
        }
        return;
    }
    pwr(k/2);
    p1();
    if(k%2){
        for(int i=1;i<=n;i++){
            for(int j=1;j<=n;j++){
                c[i][j]=d[i][j];
            }
        }
        p2();
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            b[i][j]=d[i][j];
        }
    }
}


int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> k;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin >> a[i][j];
        }
    }
    pwr(k);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            ans+=b[i][j];
            ans%=mod;
        }
    }
    cout << ans;
}


Measured memory_bytes: 384
#include<cstdio>
#include<algorithm>

using namespace std;

typedef long long ll;

int par[100000], _rank[100000];

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

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if(x == y) return;
  if(_rank[x] < _rank[y]) par[x] = y;
  else {
    par[y] = x;
    if(_rank[x] == _rank[y]) _rank[x]++;
  }
}

bool same(int x, int y) {
  return find(x) == find(y);
}

int main(){
  int N, M, p[100000], x[100000], y[100000];
  scanf("%d%d", &N, &M);
  for(int i = 0; i < N; i++) scanf("%d", &p[i]);
  for(int i = 0; i < N; i++) p[i]--;
  int num[100000];
  for(int i = 0; i < N; i++) num[p[i]] = i;
  for(int i = 0; i < M; i++) scanf("%d%d", &x[i], &y[i]);
  for(int i = 0; i < M; i++) x[i]--, y[i]--;
  for(int i = 0; i < N; i++) par[i] = i, _rank[i] = 0;
  for(int i = 0; i < M; i++) unite(x[i], y[i]);
  int ans = 0;
  for(int i = 0; i < N; i++) if(same(i, num[i])) ans++;
  printf("%d\n", ans);
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    char ch[m+1][3];
    int a[n+1],x[m+1],cnt[n+1];
    memset(a,0,sizeof(a));
    memset(cnt,0,sizeof(cnt));
    for(int i=0;i<m;i++)
    {
        //int x;
        cin>>x[i];
        a[x[i]]++;
        cin>>ch[i];
    }
    int acpt=0,accept=0,pel=0;
    for(int i=0;i<m;i++)
    {
        /*if(a[i]!=acpt&&ch[i][0]=='A')
        {
            accept++;
            acpt=a[i];
            pel+=cnt;
            cnt=0;
        }
        else if(a[i]!=acpt&&ch[i][0]=='W')
        {
            cnt++;
        }*/
        //rng=a[i];
        if(a[x[i]]>0&&ch[i][0]=='A')
        {
            accept++;
            pel+=cnt[x[i]];
            a[x[i]]=0;
            cnt[x[i]]=0;
        }
        else if(a[x[i]]>0&&ch[i][0]=='W')
        {
            cnt[x[i]]++;
            //a[x[i]]--;
        }
    }
    cout<<accept<<" "<<pel<<endl;
    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>

using namespace std;


int main() {
	
	int A,B,C;
	cin >> A >> B >> C;

	vector<int> v;

	v.push_back(A);
	v.push_back(B);
	v.push_back(C);

	sort(v.begin(), v.end());

	int max = (v[2] * 10) + v[1] + v[0];


	cout << max << endl;
	return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main() {
	int n;
	cin >> n;
	bool check = false;
	REP(i, 1, 10) {
		REP(j, 1, 10) {
			if (i * j == n) {
				check = true;
			}
		}
	}
	
	if (check)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

bool edge[9][9];
int ans = 0;
int n, m;

void solve(int p, vector<bool> v, int count){
	if(count == n){
		ans++;
		return;
	}
	reppp(i, 1, n){
		if(edge[p][i] && !v[i]){
			vector<bool> w(v);
			w[i] = true;
			solve(i, w, count+1);
		}
	}
	return;
}

signed main(){
	cin >> n >> m;
	fill(edge[0], edge[9], false);
	rep(m){
		int a, b;
		cin >> a >> b;
		edge[a][b] = true;
		edge[b][a] = true;
	}
	vector<bool> v(n+1, false);
	v[1] = true;
	solve(1, v, 1);
	cout << ans;
}


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

int main() {
	int N; cin >> N;
	int a[100010]; 
	for(int i=0; i<N; ++i) cin >> a[i];
	long plus=0, minus=0;
	long psum=0, msum=0;
	for(int i=0; i<N; ++i){
	    psum += a[i];
	    msum += a[i];
	    if(i%2){
	        if(psum>=0){
	            plus += psum+1;
	            psum=-1;
	        }
	        if(msum<=0){
	            minus += 1-msum;
	            msum=1;
	        }

	    }else{
	        if(psum<=0){
	            plus += 1-psum;
	            psum=1;
	        }
	        if(msum>=0){
	            minus += msum+1;
	            msum=-1;
	        }
	    }
	}
	cout << min(plus, minus) << endl;
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
	int a[5],i,j,k;
	for(i=0;i<5;i++){
		scanf("%d",&a[i]);
	}
	scanf("%d",&k);
	if(a[4]-a[0]>k)printf(":(\n");
		else printf("Yay!\n");
		return 0;
}

Measured memory_bytes: 128
a,b = map(int,input().split())
def fac(n):
    p = 1
    for i in range(1,n+1):
        p = (p*i) % (10**9+7)
    return p
if (2*a-b) % 3 == 0 and (-a+2*b) % 3 == 0 and 2*a-b>=0 and -a+2*b >= 0:
    x = (2*a-b) // 3
    y = (-a+2*b) // 3
    print((fac(x+y)*pow(fac(x),10**9+5,10**9+7)*pow(fac(y),10**9+5,10**9+7))%(10**9+7))
else:
    print(0)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
#define f(i,j,k) for(int i=j;i<k;i++)
#define f2(i,j,k) for(int i=j;i>k;i--)
using namespace std;
int main(){
    long long n,ans=0,d;
    cin>>n;
    long long a[n+1],b[n],f[n+1][n+1];
    f(i,0,n+1){
        cin>>a[i];
    }
    f(i,0,n+1){
        cin>>b[i];
    }
    f2(i,n-1,-1){
        d=min(a[i+1],b[i]);
        ans+=d;
        b[i]-=d;
        d=min(a[i],b[i]);
        ans+=d;
        a[i]-=d;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5232
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(), b = sc.nextInt();
		sc.close();
		int p = b - a;
		int ans = 0;
		for(int i = 1; i <= p; ++i) 
			ans += i;
		ans -= b;
		System.out.println(ans);
	}

}


Measured memory_bytes: 22868
#include <stdio.h>
#include <stdlib.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, A[N][N], d[N], color[N];
int Q[N+1];
int head = 0, tail = 0;

void BFS(int);
void enqueue(int);
int dequeue(void);

int main()
{
  int i, j, u, k, v;

  scanf("%d",&n);

  for(i = 0; i < n; i++)
    {
      for(j = 0; j < n; j++)
	{
	  A[i][j] = 0;
	}
    }

  for(i = 0; i < n; i++)
    {
      scanf("%d %d",&u,&k);
      u--;
      for(j = 0; j < k; j++)
	{
	  scanf("%d",&v);
	  v--;
	  A[u][v] = 1;
	}
    }

  BFS(0);
  
  return 0;
}

void BFS(int x)
{
  int u, v;
  for(u = 0; u < n; u++)
    {
      color[u] = WHITE;
      d[u] = -1;
    }

  color[x] = GRAY;
  d[x] = 0;
  enqueue(x);

  while(head != tail)
    {
      u = dequeue();
      for(v = 0; v < n; v++)
	{
	  if(A[u][v] == 1 && color[v] == WHITE)
	    {
	      color[v] = GRAY;
	      d[v] = d[u]+1;
	      enqueue(v);
	    }
	}
       color[u] = BLACK;
    }

  for(u = 0; u < n; u++)
    {
      printf("%d %d\n",u+1,d[u]);
    }
}

void enqueue(int x)
{
  Q[tail] = x;
  if(tail+1 == N)tail = 0;
  else tail++;
}

int dequeue(void)
{
  int x;
  x = Q[head];
   if(head+1 == N)head = 0;
   else head++;
   return x;
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using vec_b = vector<bool>;
using vec_str = vector<string>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back


int main()
{
    ll H, W;
    cin >> H >> W;
    vec_str S(H);
    REP(i,0,H) cin >> S[i];

    mat L(H, vec(W, 0));
    mat R(H, vec(W, 0));
    mat U(H, vec(W, 0));
    mat D(H, vec(W, 0));

    REP(i,0,H) {
        REP(j,0,W) {
            if(S[i][j] == '.') {
                if(j == 0) L[i][j] = 1;
                else L[i][j] = L[i][j-1] + 1;
            } 
        }
    }
    
    REP(i,0,H) {
        for(ll j=W-1; j>=0; --j) {
            if(S[i][j] == '.') {
                if(j == W-1) R[i][j] = 1;
                else R[i][j] = R[i][j+1] + 1;
            } 
        }
    }
    
    REP(j,0,W) {
        REP(i,0,H) {
            if(S[i][j] == '.') {
                if(i == 0) D[i][j] = 1;
                else D[i][j] = D[i-1][j] + 1;
            } 
        }
    }
    
    REP(j,0,W) {
        for(ll i=H-1; i>=0; --i) {
            if(S[i][j] == '.') {
                if(i == H-1) U[i][j] = 1;
                else U[i][j] = U[i+1][j] + 1;
            } 
        }
    }

    ll m = 0;
    REP(i,0,H) {
        REP(j,0,W) {
            m = MAX(m,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
        }
    }
    _PR(m);

    return 0;
}

/*



*/

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

int main(){
    string s, t;
    cin >> s >> t;
    string sub_t;
    sub_t = t.substr(0, s.size());
    //cout << s << " " << sub_t << endl;
    if (sub_t == s){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    } 
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t n,ans=0,S=0,sum=0;
  cin >> n;
  int64_t a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
    sum+=a[i];
  }
  sort(a,a+n);
  int k=n/2;
  if(n%2==0)k--;
  for(int i=0;i<n;i++){
    S+=a[i];
    if(i>k){
      ans=a[i]-a[i-1];
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4356
a,b,c = map(int, input().split())
k = int(input())

ans = 0
while b <= a:
    b *= 2
    ans += 1
while c <= b:
    c *= 2
    ans += 1
#print(a,b,c, ans)
if ans <= k:
    print('Yes')
else:
    print('No')

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

int main(){
    int num[3];
    int maxn=-1;
    int sum=0;
    int cnt=0;
    for(int i=0;i<3;i++){
        cin>>num[i];
        sum+=num[i];
        maxn=max(maxn,num[i]);
    }
    int r=sum%2;
    for(int i=sum;;i+=2){
        if(i%3==0&&i>=maxn*3)break;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    string a,b;
    cin >> a >> b;
    if (a.size() > b.size()) {
        cout << "GREATER" << endl;
        return 0;
    }else if(a.size() < b.size()){
        cout << "LESS" << endl;
        return 0;
    }else{
        rep(i, a.size()){
            if (a[i] > b[i]) {
                cout << "GREATER" << endl;
                return 0;
            }else if(a[i] < b[i]){
                cout << "LESS" << endl;
                return 0;
            }
        }
    }
    cout << "EQUAL" << endl;
    return 0;
}


Measured memory_bytes: 256
n = input()
p = [int(x) for x in input().split()]

ans = 0
for i in range(len(p)-2):
    if (p[i+1] < p[i+2] and p[i+1] > p[i]) or (p[i+1] > p[i+2] and p[i+1] < p[i]):
        ans += 1

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
int A, B, C, X, T;

int main(void){
	//IO("test.in", "test.out");
	scanf("%d%d%d%d", &A, &B, &C, &X);
	for(int i = 0; i <= A; i++)
		for(int j = 0; j <= B; j++)
			for(int k = 0; k <= C; k++)
				if(i * 500 + j * 100 + k * 50 == X) T++;
	printf("%d\n", T);
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	// 1-9
	// 100-999
	// 10000-99999
	if N < 10 {
		fmt.Println(N)
	} else if 10 <= N && N < 100 {
		fmt.Println(9)
	} else if 100 <= N && N < 1000 {
		fmt.Println(9 + (N - 100 + 1))
	} else if 1000 <= N && N < 10000 {
		fmt.Println(9 + 900)
	} else if 10000 <= N && N < 100000 {
		fmt.Println(9 + 900 + (N - 10000 + 1))
	} else {
		fmt.Println(9 + 900 + 90000)
	}

}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
typedef pair<ll, ll> Pair;
template <class T> T input() {T t; cin>>t; return t;}
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define CHMAX(a,b) a = max(a,b)
#define CHMIN(a,b) a = min(a,b)
#define FIND(x,key) x.find(key) != x.end()
#define IN_RANGE_V2(v,k,x,y) (0<=x+dx[k]&&x+dx[k]<v[y].size()&&0<=y+dy[k]&&y+dy[k]<v.size())
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define PRINT_ARRAY_H(a) REPALL(__i,a) {cout<<a[__i]<<(__i != a.size()-1 ? " " : "");} newline;
#define PRINT_ARRAY_V(a) REPALL(__i,a) {cout<<a[__i]<<endl;}
#define e1 first
#define e2 second
#define newline putchar('\n')
#define cspace ' '
#define sspace " "
const int INF = 1e7;
const ll MOD = 1e9 + 7;
const double pi = 3.141592653589793;
const VI dx = {1, 0, -1, 0};
const VI dy = {0, 1, 0, -1};
//const VI dx = {1, 1, 0, -1, -1, -1, 0, 1};
//const VI dy = {0, 1, 1, 1, 0, -1, -1, -1};

void solve()
{
    ll b, c, d, n, m, l, r, k, x, y, z, ans = 0ll;
    string s, t;
    cin>>n>>k;
    VLL a(n);
    REP(i,n) cin>>a[i];
    l = 0, r = 1e10;
    ll mid;
    REP(i,100) {
        ll cnt = 0;
        mid = (l+r)/2;
        if (mid == 0) {
            r = 1;
            break;
        }
        REP(j,n) {
            cnt += (a[j]+mid-1) / mid - 1;
        }
        if (cnt <= k) {
            r = mid;
        } else {
            l = mid;
        }
        //cout<<r<<sspace<<cnt<<endl;
    }
    cout<<r<<endl;
}

int main()
{
    cout<<fixed<<setprecision(20);
    int __t = 1;
    //cin>>__t;
    REP(i,__t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4848
// Think twice, Code once
// 1SAC
#include<bits/stdc++.h>
using namespace std;

/*============================ DEBUGGING =============================*/

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif

/*============================= DEFINES ==============================*/

#define eps 1e-9
#define mod 1000000007
#define pb emplace_back
#define mp make_pair
#define B begin()
#define E end()
#define F first
#define S second
#define tostr(x) to_string(x)
#define SZ(x) ((int)x.size())
#define ins insert
#define rep(i,x,y) for(int i=x;i<y;i++)
#define per(i,x,y) for(int i=x;i>y;i--)
#define repi(i,x,y) for(int i=x;i<=y;i++)
#define peri(i,x,y) for(int i=x;i>=y;i--)
#define inf (ll)LLONG_MAX
#define ds1(i,x) for(auto i=x.begin();i!=x.end();i++)
#define ds2(i,x) for(auto i:x)
#define FIO {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define dig(n) (int)(log10(n)+1)
#define ss(x,k) substr(x,k)  // x is the start pos and k is the length of substr.
#define set(x,k) memset(x,k,sizeof x)
#define Sort(a) sort(a.begin(),a.end())

/*============================== TYPEDEFS ============================*/

typedef long long ll;
typedef long double ld;
typedef long l;
typedef string str;
typedef vector<int> vi;
typedef vector<ll> vlli;
typedef vector<bool> vb;
typedef queue<int> qi;
typedef vector<pair<int,int> > vpii;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;

/*============================ START FROM HERE =======================*/

int main(){
	FIO
	
	int n;cin>>n;
	ll fact[n+1];
	fact[1]=1;
	rep(i,2,n+1)fact[i]=fact[i-1]*i%mod;
	cout<<fact[n]%mod;
	return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;
  
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
  
#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
  
const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
  
  
int main(){
	string str;
	int i,j=0;
	cin>>i>>j;
	
	cout<<j+j-i<<endl;

    return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
K = int(input())
d = deque([1,2,3,4,5,6,7,8,9])
for i in range(K-1):
    x = d.popleft()
    if x%10 != 0:
        d.append(10*x+x%10-1)
    d.append(10*x+x%10)
    if x%10 != 9:
        d.append(10*x+x%10+1)
print(d.popleft())

Measured memory_bytes: 11908