akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    int s = a + b;
    cout << (s % 2 == 0 ? s / 2 : s / 2 + 1) << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> ans(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  for(int i = 0; i < n; i++){
    ans[a[i] - 1] = i + 1;
  }
  for(int i = 0; i < n; i++){
    cout << ans[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
typedef long long ll;
using namespace std;
const ll mod=1000000007,mod9=1000000009;
template <class T>inline T lcm(T a,T b){return (a*b/__gcd(a,b));}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);    
    ll m,d;
    cin>>m>>d;
    ll ans=0;
    for(int i=1;i<=m;i++){
        for(int j=10;j<=d;j++){
            if((j/10)*(j%10)==i && (j/10)>=2&& (j%10)>=2){
                ans++;
                
            }
        }
    }    
    cout << ans<<endl;
    return 0;
}



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

void solve(long long N, long long M, std::vector<long long> H, std::vector<long long> A, std::vector<long long> B)
{
    vector<int> C(N + 1, 0);
    for (int j = 0; j < M; j++)
    {
        if (H[A[j]] >= H[B[j]])
        {
            C[B[j]]++;
        }

        if (H[A[j]] <= H[B[j]])
        {
            C[A[j]]++;
        }
    }

    int cnt = 0;
    for (int i = 1; i <= N; i++)
    {
        if (C[i] == 0)
        {
            cnt++;
        }
    }
    cout << cnt << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    std::vector<long long> H(N + 1);
    for (int i = 1; i <= N; i++)
    {
        scanf("%lld", &H[i]);
    }
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    for (int i = 0; i < M; i++)
    {
        scanf("%lld", &A[i]);
        scanf("%lld", &B[i]);
    }
    solve(N, M, std::move(H), std::move(A), std::move(B));
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

vi g[114514];
int d[114514], d2[114514];

void dfs(int x, int a){
	if(d[x]!=-1){
		return;
	}
	d[x]=a;
	for(int y : g[x]){
		dfs(y, a+1);
	}
}

void dfs2(int x, int a){
	if(d2[x]!=-1){
		return;
	}
	d2[x]=a;
	for(int y : g[x]){
		dfs2(y, a+1);
	}
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b;
	cin>>n;
	REP(i, n-1){
		cin>>a>>b;
		--a;
		--b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	REP(i, n){
		d[i]=-1;
		d2[i]=-1;
	}
	dfs(0, 0);
	dfs2(n-1, 0);
	int cnt=0;
	REP(i, n){
		if(d[i]<=d2[i]){
			++cnt;
		}
	}
	cout<<(cnt*2>n ? "Fennec" : "Snuke")<<'\n';
	return 0;
}


Measured memory_bytes: 9984
using System;
using System.Linq;

namespace arc082_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ret = 0;
            bool flag = false;
            for (int i = 0; i < n; i++)
            {
                if (x[i] == i + 1)
                {
                    if (!flag)
                    {
                        ret++;
                    }
                    flag = !flag;
                }
                else if (flag) flag = false;
            }
            Console.WriteLine(ret);
        }
    }
}

Measured memory_bytes: 20064
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m;
const int maxn = 110;
char s[maxn][maxn];
int mp[maxn],cnt1,cnt2;
int main(){
    scanf("%d%d",&n,&m);
    for(int i = 0 ; i < n ; i++){
        scanf("%s",s[i]);
        for(int j = 0 ;  j < m ; j++){
            mp[s[i][j]-'a']++;
        }
    }
    for(int i = 0 ; i < 26 ; i++){
        if(mp[i] == 0)  continue;
        if(mp[i] % 4 == 3){
			cnt1++;
			cnt2++;
        }
        if(mp[i] % 4 == 1)  cnt1++;
        if(mp[i] % 4 == 2)  cnt2++;
    }
    if(n%2 == 1 && m%2 == 1){
        if(cnt1 > 1 || (cnt2 > (n-1)/2+(m-1)/2) ){
            printf("No\n");
            return 0;
        }
    }
    else if(n%2 == 0 && m%2 == 0){
        if(cnt1 || cnt2){
			printf("No\n");
            return 0;
        }
    }
    else if(n %2 == 0 && m%2 == 1){
        if(cnt1 || cnt2 > n/2){
			printf("No\n");
            return 0;
        }
    }
    else{
		if(cnt1 || cnt2 > m/2){
			printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
}


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

int main(){
long long int i, n, v[20], c[20], ans=0;
cin >> n;
  for(i=0; i<n; i++)
     cin >> v[i];
  for(i=0; i<n; i++)
     cin >> c[i];

  for(i=0; i<n; i++)
     if(v[i]-c[i]>0)
       ans += v[i]-c[i];
  
  cout << ans;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 4e5+6;
const ll inf =1e18;
 
 
 

int main(){
	fastio;
	ll k,a,b,n,ans=0;
	cin>>a>>b>>n;
	if(n<b) cout<<(a*n)/b<<endl;
	else cout<<(a*(b-1))/b<<endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int ret=0; char c=getchar();
	while(c<48||c>57)c=getchar();
	while(c>=48&&c<=57)ret=ret*10+c-48,c=getchar();
	return ret;
}

#define MO1 998244353
#define MO2 1000000007
long long ans;
int n,a[20],b[20];
char s[50];// \0 //n    //r
//unord_map   pair
//iterator
struct node {
	int a,b,c,d;
	bool operator < (const node &h)const {
		if(a!=h.a)return a<h.a;
		if(b!=h.b)return b<h.b;
		if(c!=h.c)return c<h.c;
		return d<h.d;
	}//^ //erweihash  chongbiaohao //shuhash//ZJOI //pkusc
};
map<node,int>mp;
void dfsa(int p, int A, int B, int A2, int B2)
{
	
	
	if(p>n){
//		cerr<<A<<' '<<B<<' '<<A2<<' '<<B2<<endl;
		++mp[(node){A,B,A2,B2}];
		return;
	}
	dfsa(p+1,((long long)A*37+a[p])%MO1,B,((long long)A2*101+a[p])%MO2,B2);
	dfsa(p+1,A,((long long)B*37+a[p])%MO1,A2,((long long)B2*101+a[p])%MO2);
}

void dfsb(int p, int A, int B, int A2, int B2)
{
	if(p>n){
		ans+=mp[(node){B,A,B2,A2}];
		return;
	}
	dfsb(p+1,((long long)A*37+b[p])%MO1,B,((long long)A2*101+b[p])%MO2,B2);
	dfsb(p+1,A,((long long)B*37+b[p])%MO1,A2,((long long)B2*101+b[p])%MO2);
}

int main()
{
	n=read();
	scanf("%s",s+1);
	for(int i=1;i<=n;++i)a[i]=s[i]-96;
	for(int i=1;i<=n;++i)b[i]=s[n*2-i+1]-96;
	
	dfsa(1,0,0,0,0);
	
//	cerr<<mp[(node){3,1444}]<<endl; //,0,0 //??? luan???
	 
	dfsb(1,0,0,0,0);
	cout<<ans;//*2; ///<<1 >> //- .. //0 -0
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
template< typename T >
T mod_pow(T x, T n, const T &p) {
  if(x < 0) return 0;
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(int i=0;i<((int)(v.size()));++i) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  string s; cin >> s;
  int sz = (int)(s.size());
  vvll dp(n+1, vll(n+1));
  dp[0][0] = 1;
  for(int i=0;i<(n);++i) {
    for(int j=0;j<(n);++j) {
      if(j != 0) {
        dp[i+1][j-1] += dp[i][j];
        dp[i+1][j-1] %= MOD;
      } else {
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= MOD;
      }
      dp[i+1][j+1] += 2 * dp[i][j];
      dp[i+1][j+1] %= MOD;
    }
  }
  ll inv2 = mod_pow<ll>(2, MOD-2, MOD);
  ll now = 1;
  for(int i=0;i<(sz);++i) now *= inv2, now %= MOD;
  cout << dp[n][sz] * now % MOD << endl;
}


Measured memory_bytes: 195840
#include<bits/stdc++.h>
using namespace std;
int n;
double p[3005];
double dp[3005][3005];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%lf",&p[i]);
	dp[0][0]=1.0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=i;j++){
			dp[i+1][j+1]+=1.0*dp[i][j]*p[i+1];
			dp[i+1][j]+=1.0*dp[i][j]*(1.0-p[i+1]);
		}
	}
	double ans=0;
	for(int i=(n+1)/2;i<=n;i++)ans+=dp[n][i];
	printf("%.12lf\n",ans);
	return 0;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,a,b,c;
	t = 1;
	while(t--) {
	 cin >> a >> b >> c;
	 if(a >= b && a >= c)
	  cout << 10 * a + b + c << endl;
     else if(b >= a && b >= c)
	  cout << 10 * b + a + c << endl;
     else 
	 cout << 10 * c + a + b << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define cin_desync()                                                           \
    do {                                                                       \
        ios_base::sync_with_stdio(false);                                      \
        cin.tie(0);                                                            \
    } while (0)

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}

#else
#define trace(...)
#endif // ifndef ONLINE_JUDGE

typedef long double ld;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int max_N = 1e5 + 10;

struct compR {
    bool operator()(const pii &a, const pii &b) const {
        return tie(a.second, a.first) < tie(b.second, b.first);
    }
};

struct compL {
    bool operator()(const pii &a, const pii &b) const {
        return tie(a.first, a.second) > tie(b.first, b.second);
    }
};

multiset<pii, compR> mvL;
multiset<pii, compL> mvR;

int main() {
    cin_desync();

    int N;
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        int L, R;
        cin >> L >> R;
        mvL.insert({L, R});
        mvR.insert({L, R});
    }

    auto backupL = mvL;
    auto backupR = mvR;

    ll ans = 0;
    for (int s = 0; s < 2; ++s) {
        int f = s;
        mvL = backupL;
        mvR = backupR;
        int curr = 0;
        ll sum = 0;
        for (int i = 1; i <= N; ++i) {
            auto nxt = (f ? *mvL.begin() : *mvR.begin());
            if (curr < nxt.first) {
                sum += nxt.first - curr;
                curr = nxt.first;
            } else if (curr > nxt.second) {
                sum += curr - nxt.second;
                curr = nxt.second;
            }
            mvL.erase(mvL.find(nxt));
            mvR.erase(mvR.find(nxt));
            f = !f;
        }

        if (curr != 0) {
            sum += abs(curr);
        }

        ans = max(ans, sum);
    }

    cout << ans << endl;
}


Measured memory_bytes: 21228
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long n,m;
	cin>>n>>m;
	if(n>=m/2){
		cout<<m/2;return 0;
	}
	long long sum=0;
	sum+=n;
	m-=2*n;
	sum+=m/4;
	cout<<sum<<endl;
	return 0;
}

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

int a[2000000], ans[2000000], vis[2000000], b[2000000];

int main() {
    long long m, K;
    cin >> m >> K;
    long long now = 1;
    for (int i = 1; i <= m; ++i)
        now <<= 1;
    now -= 1;
    int tot = 0;
    long long t = K;
    while (t) {
        int tmp = t & (-t);
        if (tmp >= now) {
            puts("-1");
            return 0;
        }
        vis[a[++tot] = tmp] = 1;
        t -= tmp;
    }
    int cnt = 0;
    for (int i = 0; i <= now; ++i)
        if (!vis[i])
            b[++cnt] = i;
    int i = 1, j;
    for (; i <= tot; ++i)
        ans[i] = a[i];
    for (j = 1; j <= cnt; ++i, ++j)
        ans[i] = b[j];
    
    for (j = tot; j >= 1; --j, ++i)
        ans[i] = a[j];

    for (j = cnt; j >= 1; --j, ++i)
        ans[i] = b[j];

    for (j = 1; j < i; ++j) printf("%d ", ans[j]);

    return 0;
}


Measured memory_bytes: 10496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pint;
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
const ll waru = 1e9 + 7;
const int intmax = 0x7fffffff, intmin = ~intmax;

int main() {
  int n, xs[100], ys[100], hs[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> xs[i] >> ys[i] >> hs[i];
  }
  int x, y, h;
  for (x = 0; x <= 100; x++) {
    for (y = 0; y <= 100; y++) {
      h = -1;
      int hmax = intmax;
      for (int i = 0; i < n; i++) {
        if (!hs[i]) {
          int hmaxh = abs(x - xs[i]) + abs(y - ys[i]);
          hmax = min(hmax, hmaxh);
          if (h > hmax) goto con;
        } else {
          int hh = hs[i] + abs(x - xs[i]) + abs(y - ys[i]);
          if (h == -1) h = hh;
          if (h != hh || h > hmax || h == 0) goto con;
        }
      }
      goto end;
    con:
      0;
    }
  }
end:
  cout << x << " " << y << " " << h << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

ll dp[105][10];

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

    int h, w, k;
    cin >> h >> w >> k;
    dp[0][1] = 1;
    for(int i = 0; i < h; ++i){
        for(int state = 0; state < (1 << (w-1)); ++state){
            vector<int> bit;
            bool flag = true;
            for(int j = 0; j < w - 1; ++j){
                if(state & (1 << j)){
                    bit.push_back(j);
                    int sz = bit.size();
                    if(sz > 1){
                        if(bit[sz - 2] + 1 == bit[sz - 1]){
                            flag = false;
                            break;
                        }
                    }
                }
            }
            if(!flag)   continue;
            int sz = bit.size();
            vector<bool> used(w + 1, false);
            for(int j = 0; j < sz; ++j){
                int left = bit[j] + 1;
                int right = left + 1;
                chadd(dp[i+1][right], dp[i][left]);
                chadd(dp[i+1][left], dp[i][right]);
                used[left] = true;
                used[right] = true;
            }
            for(int j = 1; j <= w; ++j){
                if(!used[j])    chadd(dp[i+1][j], dp[i][j]);
            }
        }
    }

    cout << dp[h][k] << endl;
}

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

const int MOD = 1e9+7;
inline int add(int a, int b){
    return (a+b)%MOD;
}
inline int sub(int a, int b){
    return ((a-b)%MOD + MOD)%MOD;
}
inline int mul(int a, int b){
    return ((ll)a*b)%MOD;
}
int pwr(int a, int b){
    if(!b) return 1;
    int temp = pwr(a, b/2);
    if(b%2) return mul(mul(temp, temp), a);
    return mul(temp, temp);
}
int dvd(int a, int b){ 
    return mul(a, pwr(b, MOD-2));
}

const int mxn = 1e6+5;
int n, k, p25[2*mxn], p26[2*mxn], ch[2*mxn];
string s;

void solve(){
    cin >> k >> s;
    n = s.length();

    p25[0] = p26[0] = 1;
    for(int i = 1; i <= n+k; ++i){
        p25[i] = mul(p25[i-1], 25); 
        p26[i] = mul(p26[i-1], 26); 
    }

    ch[n-1] = 1;
    for(int i = n; i <= n+k; ++i){
        ch[i] = mul(ch[i-1], dvd(i, i-n+1));
    }

    int ans = 0;
    for(int i = 0; i <= k; ++i){
        ans = add(ans, mul(mul(ch[n+k-i-1], p25[k-i]), p26[i]));
    }
    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 23748
x,n = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]

cur_dist,num = int(1e10),int(1e10)

for i in range(-100,201):
  if i in arr:
    continue
  dist = abs(i-x)
  if dist < cur_dist:
    cur_dist = dist
    num = i

print(num)

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;0<=i;--i)
#define rRep(i,n) for(int i=n;0<i;--i)
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define scani(a) scanf("%d",&a)
#define scanr(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define printi(a) printf("%d",a)
#define printr(a) printf("%lf",a)
#define prints(s) printf("%s",s)
#define is_odd(n) (n&1)
#define is_even(n) ((n+1)&1)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define all(x) x.begin(), x.end()
#define EPS 1e-8
#define INF 1e8
#define PI acos(-1.0)

typedef double Real;
typedef int Int;
typedef vector<Int> vi;
typedef vector<vector<Int> > vvi;
typedef pair<Int,Int> pii;

inline Real sr(Real a) {return sqrt(max(a, (Real)0));}
template <typename T> inline T sq(T a) {return a * a;}
const vi dy = {-1, 0, 1, 0}, dx = {0, -1, 0, 1};
vector<string> split(const string &s, char d) {vector<string> r;stringstream t(s);string x;while(getline(t,x,d))if(!x.empty())r.push_back(x);return r;}


void solve()
{
  for(;;)
  {
    Int N; scani(N);
    if(N == 0) break;

    vi s;
    s.resize(N);
    rep(i, N) scani(s[i]);

    sort(all(s));

    cout << accumulate(s.begin()+1, s.end()-1, 0) / (s.size()-2) << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(9);

  solve();

  return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i=0;i<N;i++){
    cin >> p[i];
  }
  int count=0;
  for (int i=0;i<N;i++){
    if (p[i]==i+1){
      count++;
      if (i!=N-1&&p[i+1]==i+2){
        i++;
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

signed main () {
    int n, m; cin >> n >> m;
    vector<vector<int>> ab(n, vector<int>(2));

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

    vector<vector<int>> cd(m, vector<int>(2));

    for(int i = 0; i < m; i++) {
        cin >> cd[i][0] >> cd[i][1];
    }

    for(int i = 0; i < n; i++) {
        int dist = INF;
        int idx = INF;
        for(int j = 0; j < m; j++) {
            int tmpdist = abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]);
            if(dist > tmpdist) {
                dist = tmpdist;
                idx = j;
            }
        }
        cout << idx + 1 << endl;
    }
}


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


Measured memory_bytes: 640
package main

import "fmt"

func main() {
	var N, M, C, ans, check int
	fmt.Scanf("%d %d %d\n", &N, &M, &C)
	B := make([]int, M)
	for i := 0; i < M; i++ {
		fmt.Scan(&B[i])
	}
	A := make([][]int, N)
	for i := 0; i < N; i++ {
		check = 0
		A[i] = make([]int, M)
		for j := 0; j < M; j++ {
			fmt.Scan(&A[i][j])
			check += A[i][j] * B[j]
		}
		if (check + C) > 0 {
			ans++
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<random>
using namespace std;

int main() {

  string s; cin >> s;

  bool f = false;
  if( s == "AKIHABARA" ) f = true;
  if( s == "KIHABARA" ) f = true;
  if( s == "AKIHBARA" ) f = true;
  if( s == "AKIHABRA" ) f = true;
  if( s == "AKIHABAR" ) f = true;
  if( s == "KIHBARA" ) f = true;
  if( s == "KIHABRA" ) f = true;
  if( s == "KIHABAR" ) f = true;
  if( s == "AKIHBRA" ) f = true;
  if( s == "AKIHABR" ) f = true;
  if( s == "AKIHBAR" ) f = true;
  if( s == "KIHBRA" ) f = true;
  if( s == "KIHBAR" ) f = true;
  if( s == "AKIHBR" ) f = true;
  if( s == "KIHABR" ) f = true;
  if( s == "KIHBR" ) f = true;

  cout << (f?"YES":"NO") << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e+9

int main(){
	int n,m,a[50],b[50],ab[51][51],tmp[51][51],ans=0;
	for(int i=0; i<51; i++)for(int j=0; j<51; j++)ab[i][j]=inf;
	cin>>n>>m;
	for(int i=0; i<m; i++){
		cin>>a[i]>>b[i];
		ab[a[i]][b[i]]=1; ab[b[i]][a[i]]=1;
	}
	
	for(int i=0; i<m; i++){
		for(int j=0; j<=n; j++)
			for(int p=0; p<=n; p++)
				tmp[j][p]=ab[j][p];
		
		tmp[a[i]][b[i]]=inf; tmp[b[i]][a[i]]=inf;
		
		for(int j=1; j<=n; j++){
			for(int p=1; p<=n; p++){
				for(int q=1; q<=n; q++){
					tmp[p][q]=min(tmp[p][q],tmp[p][j]+tmp[j][q]);
				}
			}
		}
		if(tmp[a[i]][b[i]]==inf or tmp[b[i]][a[i]]==inf)ans++;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
typedef long long ll;
int n, k;
int a[maxn];
bool check(int mid)
{
	ll ret = 0;
	for(int i = 1; i <= n; ++i) ret = ret + (a[i] - 1) / mid;
	return ret <= k;
}
int main()
{
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	int l = 1, r = 1e9;
	while(l <= r)
	{
		int mid = l + r >> 1;
		if(check(mid)) r = mid - 1;
		else l = mid + 1;
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 4368
#include <iostream>
#include <string>
#include <vector>

using namespace std;

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

    string str;
    cin >> str;

    int count = 0;
    for (int s = 0, e = str.length() - 1; s < e;) {
        if (str[s] == str[e]) {
            s++;
            e--;
        }
        else if (str[s] == 'x' && str[e] != 'x') {
            s++;
            count++;
        }
        else if (str[s] != 'x' && str[e] == 'x') {
            e--;
            count++;
        }
        else {
            count = -1;
            break;
        }
    }

    cout << count << "\n";

    int a;
    cin >> a;
}

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

using namespace std;
using ll = long long int;
constexpr ll M = 1e9 + 7;
inline ll sum_1(const ll n) { return ((n * (n + 1)) / 2) % M; }
inline ll sum_2(const ll n) { return ((n * (n + 1) * (2 * n + 1)) / 6) % M; }
inline ll sum_3(const ll n) { return (((n * (n + 1)) / 2) % M * ((n * (n + 1)) / 2) % M) % M; }
inline ll sum_1(const ll i, const ll j) { return (sum_1(j) - sum_1(i - 1) + M) % M; }
inline ll sum_2(const ll i, const ll j) { return (sum_2(j) - sum_2(i - 1) + M) % M; }
inline ll sum_3(const ll i, const ll j) { return (sum_3(j) - sum_3(i - 1) + M) % M; }

void solve() {
    ll n;
    cin >> n;
    ll ans = 1000*(n/500) + 5*((n%500)/5);
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifdef D_LOCAL
        freopen("in.in", "r", stdin);
        freopen("out.out", "w", stdout);
    #endif

    solve();

    return 0;
}

Measured memory_bytes: 256
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    int K,X;
    cin>>K>>X;

    for(int i=X-K+1;i<=X+K-1;i++){
        cout<<i<<endl;
    }
    return 0;
}


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

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  int n = s.size(), m = t.size();
  // dp[i][j] := sのi文字目, tのj文字目まで見たときの最長共通部分列(LCS)
  vector<vector<int>> dp(n + 1, vector<int>(m + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (s[i] == t[j]) {
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]) + 1;
      } else {
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i + 1][j]);
        dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j + 1]);
      }
    }
  }

  int i = n, j = m;
  string ans = "";
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) {
      i--;
    } else if (dp[i][j] == dp[i][j - 1]) {
      j--;
    } else {
      ans = s[i - 1] + ans;
      i--;
      j--;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 35712
def examA():
    def gcd(x, y):
        if y == 0:
            return x
        while (y != 0):
            x, y = y, x % y
        return x
    def lcm(x, y):
        return x * y // gcd(x, y)
    N, Z = LI()
    A = LI()
    F = set()
    for a in A:
        F.add(gcd(a,Z))
    #print(F)
    ans = 1
    for f in F:
        ans = lcm(f,ans)

    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = [[0]*3 for _ in range(3)]
    ans[0][0] = I()
    ans[0][1] = I()
    ans[1][1] = I()
    center = ans[1][1]
    ans[2][2] = center*2-ans[0][0]
    ans[0][2] = center*3-sum(ans[0])
    ans[1][2] = center*3-ans[0][2]-ans[2][2]
    ans[1][0] = center*2-ans[1][2]
    ans[2][0] = center*3-ans[1][0]-ans[0][0]
    ans[2][1] = center*3-ans[2][0]-ans[2][2]
    for v in ans:
        print(" ".join(map(str,v)))
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 59372
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def _solve(s, n, f):
    m = sum(f)
    r = range(n-m-1, n+m+1)
    cur = set([s])
    for ff in f:
        nex = set()
        for c in cur:
            for op in (1, -1):
                t = c + op * ff
                if t not in r:
                    continue
                nex.add(t)
        cur = nex
    return n in cur

def solve(s: str, x: int, y: int):
    f = tuple(map(lambda x: len(x), s.split("T")))
    return YES if _solve(f[0], x, f[2::2]) and _solve(0, y, f[1::2]) else NO

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    x = int(next(tokens))  # type: int
    y = int(next(tokens))  # type: int
    print(solve(s, x, y))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


Measured memory_bytes: 79384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<string.h>
using namespace std;
const int mod = 1e9 + 7;
int main()
{
	char s[3];
	cin >> s[0] >> s[1] >> s[2];
	int a=0, b=0;
	for (int i = 0; i < 3; i++)
	{
		if (s[i] == 'A') a++;
		if (s[i] == 'B') b++;
	}
	if (a == 1 || b == 1) cout << "Yes";
	else cout << "No";
}

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

// マクロ
// forループ
#define REP(i,n) for(int i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair



int main() {
    string S; cin >> S;
    int max_l = 0;
    REP(l, S.size()) {
        FOR(r, l, S.size()) {
            bool isOK = true;
            FOR(i, l, r) {
                if (S[i] != 'A' && S[i] != 'C' && S[i] != 'G' && S[i] != 'T') isOK = false;
            }
            if (isOK) max_l = max(max_l, r-l+1);
        }
    }
    PRINT(max_l);
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rrep1(i,n) for(ll i=n;i>=1;i--)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
vector<ll> divisor(ll x){vector<ll> div;for(ll i=1;i*i<=x;i++){if(x%i==0){div.pb(i);if(i*i!=x)div.pb(x/i);}}sort(div.bg,div.ed);return div;}
map<ll,ll> prime_factor(ll x){map<ll,ll> ret;ll tmp=x;for(ll i=2;i*i<=x;i++){while(tmp%i==0){ret[i]++;tmp/=i;}}if(tmp!=1) ret[tmp]++;return ret;}
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;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
ll power(ll x,ll n,ll mod){ll ret=1;while(n>0){if(n&1) (ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}

/*
ll fac[300001],finv[300001],inv[300001];//Nの制約
void table(){fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;for(ll i=2;i<300001;i++){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
ll comb(ll n,ll k){if(n<k) return 0;if(n<0 || k<0) return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
*/

int main(){
	ll M,D; cin>>M>>D;
	ll ans=0;
	rep1(j,M)rep1(i,D){
		ll tmp=i/10;
		if(i>=10 && tmp>=2 && i%10>=2 && tmp*(i%10)==j){
			ans++;
			//cout<<i<<endl;
		}
	}

	cout<<ans;
}

Measured memory_bytes: 256
def B():
    jpy='JPY'
    btc='BTC'
    rate_from_btc_to_jpy=380000

    N = int(input())
    x_list=[]
    u_list=[]
    for i in range(N):
        x, u = (x for x in input().split())
        x = float(x)
        x_list.append(x)
        u_list.append(u)
    
    otoshidama = 0
    for i in range(len(u_list)):
        if u_list[i] == jpy:
            otoshidama = otoshidama + x_list[i]
        elif u_list[i] == btc:
            otoshidama = otoshidama + x_list[i] * rate_from_btc_to_jpy
    
    print(otoshidama)

if __name__== '__main__':
    B()
   

Measured memory_bytes: 3064
n,m=list(map(int,input().split()))
cond=[]
for i in range(m):
    index,char=list(map(int,input().split()))
    cond.append((index-1,str(char)))

mini=0
maxi=9
if n==2:
    mini=10
    maxi=99
elif n==3:
    mini=100
    maxi=999

for i in range(mini,maxi+1):
    check=str(i)
    isOk=True
    for index,char in cond:
        if check[index]!=char:
            isOk=False
            break

    if isOk:
        print(check)
        exit()

print(-1)

Measured memory_bytes: 38256
const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const solve = (input) => {
  const [n, s] = input.split("\n")
  const ss = s.split("")
  const red = ss.filter((c) => c == "R")
  return Math.floor(ss.length / 2) < red.length ? "Yes" : "No"
}

if (process.env.NODE_ENV === "test") {
  module.exports = (input) => solve(input.trim())
} else {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(solve(input.trim()))
}


Measured memory_bytes: 7372
import sys
input = sys.stdin.readline
n = int(input())
m = 10**10
ans = 0
flag = 0
for i in range(n):
  a,b = map(int,input().split())
  if a > b:
    flag = 1
    m = min(m,b)
  ans += a
print((ans-m)*flag)


Measured memory_bytes: 3060
H, W = map(int, input().split())
maze = []
for i in range(H):
    maze.append(list(input()))
    
from collections import deque
import numpy as np
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
# 最大の地点を
def dfs(sx, sy):
    que = deque()
    # 各点までの最長距離の配列
    d = [[-1 for _ in range(W)] for _ in range(H)]
    que.append([sx, sy])
    d[sx][sy] = 0
    
    while(len(que) != 0):
        front = que.popleft()
        for i in range(4):
            nx = front[0] + dx[i]
            ny = front[1] + dy[i]
            if (0 <= nx and nx < H and 0 <= ny and ny < W):
                if maze[nx][ny] != "#" and d[nx][ny] == -1:
                    que.append([nx, ny])
                    d[nx][ny] = d[front[0]][front[1]] + 1
                else:
                    continue
            else:
                continue
    return np.max(d)

import itertools

ans = []
l1 = [(s1, s2) for s1 in range(H) for s2 in range(W)]


for v in l1:
    if maze[v[0]][v[1]] == "#":
        continue
    ans.append(dfs(v[0], v[1]))
print(max(ans))

Measured memory_bytes: 12464
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void tenka1_2019_a(vector<vector<int>> v) {

    int a = v[0][0];
    int b = v[0][1];
    int c = v[0][2];
    
    int temp1=min(a,b);
    int temp2=max(a,b);
    
    a=temp1;
    b=temp2;
    
    cout << (temp1<=c && c<=temp2 ? "Yes" : "No")<<endl;
    
            


}

int main() {

    //    vector<vector < string>> vec_arr_result;
    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    tenka1_2019_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
n = input()    
m = n.split()
p = [int(i) for i in m] 
n = input()    
m = n.split()
q = [int(i) for i in m] 
b = 0
for i in q:
    b = b + i
if b < p[0]:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 14552
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val S = rd.readString()
    val K = rd.readLong()
    val N = S.length

    if (N == 1) {
        println(K/2L)
        return
    }

    mutableSetOf<Char>().also {
        it.addAll(S.toList())
    }.let {
        if (it.size == 1) {
            println(N*K/2L)
            return
        }
    }

    val sgs = ArrayList<IntPair>()
    var i = 0; var j = 0
    while (i < N) {
        while (j < N && S[i] == S[j]) j++

        sgs.add(IntPair(i, j-i))

        i = j
    }

    var cnt = 0L
    for (sg in sgs) {
        cnt += sg.second / 2L
    }
    var ans = cnt * K
    if (S[0] == S[N-1]) {
        val a = sgs.first().second
        val b = sgs.last().second
        val diff = a/2L + b/2L - (a+b)/2L
        ans -= diff * (K-1)
    }

    println(ans)
}


//val rd = debug.Reader("agc", "039", "a", "sample-8")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
data class IntPair(val first: Int, val second: Int)
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListIntCols: (Int) -> List<List<Int>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toInt() } } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val readListLongCols: (Int) -> List<List<Long>> = { N -> (0 until N).map { br.readLine().split(' ').map { it.toLong() } } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 36776
#include <stdio.h>

int main(){
    
    int a, b;
    scanf("%d %d", &a, &b);
    
    if(a > b){
        printf("a > b\n");
    }
    else if(a < b){
        printf("a < b\n");
    }
    else{
        printf("a == b\n");
    }
}


Measured memory_bytes: 2120
#include"bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
#define int long long int
#define pb push_back
#define mp make_pair
#define loop(i,x,n) for(int i=x;i<=n;i++)
#define rloop(i,x,n) for(int i=x;i>=n;i--)
#define ff first
#define ss second
#define N4RUTO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
 
typedef tree<int, null_type, less<int>, rb_tree_tag,  
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,  
tree_order_statistics_node_update>
ordered_set;
 
int32_t main(){
	N4RUTO;
	int t;
	t=1;
	// cin>>t;
	while(t--){
		char x;
		cin>>x;
		if(x<='z' && x>='a') cout<<"a";
		else cout<<"A";
	}
	return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc[3];

int main(){
    for(int i=0;i<3;i++){
        cin>>s;
        for(auto it:s)vc[i].push_back(it-'a');
    }
    b=0;
    a=0;
    c=0;
    while(1){
        a=vc[b][0];
        
        if(vc[b].size()==0){
            c=b;
            break;
        }else vc[b].erase(vc[b].begin());
        b=a;
    }
    C char('A'+c) E;
}

Measured memory_bytes: 256
def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        print(0 if a & 1 else -1)
        return
    count = 0
    while (a | b | c) & 1 == 0:
        a, b, c = (b + c) >> 1, (c + a) >> 1, (a + b) >> 1
        count += 1
    
    print(count)
 
main()


Measured memory_bytes: 3060