akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main () {
  string s;
  int count = 0;
  cin >> s;
  for (int i=0; i<s.size(); i++) {
    if (s[i] == 'o') count++;
  }
  cout << 700 + 100 * count << endl;
}

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

int main() {
    int n;
    string s;
    cin >> n >> s;

    int minC = 1000000;

    vector<int> wsum(n + 1, 0);
    vector<int> bsum(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        if (s[i - 1] == '.') {
            wsum[i] = wsum[i - 1] + 1;
            bsum[i] = bsum[i - 1];
        } else {
            wsum[i] = wsum[i - 1];
            bsum[i] = bsum[i - 1] + 1;
        }
    }

    int mn = 1000000;
    for (int i = 0; i <= n; i++) {
        mn = min(mn, bsum[i] + (wsum[n] - wsum[i]));
    }

    cout << mn << endl;
}


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

const int N = 10;

int a[N];

void input()
{
    for (int i = 0; i < N; i ++) {
        scanf("%d", &a[i]);
    }
}

void solve()
{
    bool res = false;
    for (int k = 0; k < (1<<10); k++) {
        int num = 0;
        int i;
        for (i = 0; i < N; i ++) {
            if ( (1 << i)&k ) {
                if (a[i] > num)
                    num = a[i];
                else
                    break;
            }
        }
        if (i < N)
            continue;
        num = 0;
        for (i = 0; i < N; i ++) {
            if ( ((1 << i)&k) == 0 ) {
                if (a[i] > num)
                    num = a[i];
                else
                    break;
            }
        }
        if (i == N) {
            res = true;
            //printf("k=%d\n", k);
            break;
        }
    }
    if (res)
        printf("YES\n");
    else
        printf("NO\n");
}

int main(void)
{
    int t;
    cin >> t;
    while (t--) {
        input();

        solve();
    }

    return 0;
}

Measured memory_bytes: 1200
while 1:
    arr = [[0 for i in range(21)] for j in range(21)]
    x = int(raw_input())
    if x == 0: break
    for i in range(x):
        y,z = map(int,raw_input().split())
        arr[z][y] = 1
    a = int(input())
    nx, ny = 10,10
    for i in range(a):
        d, l = raw_input().split()
        for j in range(int(l)):
            if d == "N":
                ny += 1
            elif d == "E":
                nx += 1
            elif d == "S":
                ny -= 1
            elif d == "W":
                nx -= 1
            arr[ny][nx] = 0    
    arr2 = [[0 for i in range(21)] for j in range(21)]
    print "Yes" if arr == arr2 else "No"

Measured memory_bytes: 6372
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    reverse(a.begin(), a.end());
    int ans = 0;
    int t = 0;
    for(int i = n - 2; i >= 0; i--){
        if(a[i] <= a[i+1])t++;
        else t = 0;
        ans = max(ans, t);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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;
}
int main(){
    ll d;cin >> d;
    vl c(26);rep(i,26)cin >> c[i];
    vvl s(d,vl(26));rep(i,d)rep(j,26)cin >> s[i][j];
    vl last(26,-1);
    rep(i,d){
        ll t=0;
        ll maxi=-INF;
        rep(j,26){
            ll p=s[i][j];
            rep(k,26){
                if(k==j)continue;
                p-=c[k]*(i-last[k]);
            }
            if(chmax(maxi,p))t=j;
        }
        cout << t+1 <<endl;
        last[t]=i;
    }
}

Measured memory_bytes: 3720
#include <iostream>
using namespace std;
int main() {
    long long n , m;
    cin>>n>>m; 
    long long sum = 0;
    long long a[m]; 
    for(int i =0; i<m ; i++){
       cin>>a[i];
        sum += a[i];
    }
    if(n -sum>= 0){
        cout<<n - sum;
    }
    else{
        cout<<-1;
    }

}


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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

// dp、13で割ったあまり

int main() {
  string s;
  cin >> s;
  int m = 13;
  vector<mint> dp(m);
  dp[0] = 1;
  for (char c : s) {
    vector<mint> prev(m);
    rep(i, m) prev[i] = 0;
    swap(prev, dp);
    if (c == '?') {
      rep(j, m) {
        rep(k, 10) {
          dp[(j*10+k)%m] += prev[j];
        }
      }
    } else {
      int x = c - '0';
      rep(j, m) {
        dp[(j*10+x)%m] += prev[j];
      }
    }
  }
  mint ans = dp[5];
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3744
import math

n = int(input())
li = [int(x) for x in input().split()]
ans = 0
isAvailable = False
for a in li:
    if a % 2 == 0:
        isAvailable = True
        while(a % 2 == 0):
            a /= 2
            ans += 1
if isAvailable:
    print(ans)
else:
    print(0)


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

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define fst first
#define snd second

int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    cout << n / (a + b) * a + min(a, n % (a + b));

    return 0;
}


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

using namespace std;

#define int long long
long long pw[15], sum, cur = 0, pw1[15];

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    pw[0] = 1;
    for(int i = 1; i <= 9; i++){
        pw[i] = pw[i - 1] * 10;
    }
    int num = -1;
    for(int i = 9; i >= 0; i--){
        cout << "? " << pw[i] << "\n";
        cout.flush();
        char c;
        cin >> c;
        if(c == 'Y'){
            num = i + 1;
            break;
        }
    }
    if(num == 10){
        for(int i = 9; i >= 0; i--){
            if(i == 0){
                cout << "! " << pw[i] << "\n";
                cout.flush();
                exit(0);
            }
            cout << "? " << pw[i] - 1 << "\n";
            cout.flush();
            char c;
            cin >> c;
            if(c == 'N'){
                cout << "! " << pw[i] << "\n";
                cout.flush();
                exit(0);
            }
        }
    }
    for(int i = 1; i <= num; i++){
        int l = 0, r = 9, mid;
        if(i == 1)
            l = 1;
        if(i < num){
            while(l < r){
                mid = (l + r + 1) >> 1;
                sum = cur * 10 + mid;
                cout << "? " << sum << "\n";
                cout.flush();
                char c;
                cin >> c;
                if(c == 'Y')
                    l = mid;
                else
                    r = mid - 1;
            }
            cur = cur * 10 + l;
        }
        else{
            for(int j = l; j <= r; j++){
                int sum = cur * 10 + j;
                if(i == num)
                sum = sum * 10 + 9;
                cout << "? " << sum << "\n";
                cout.flush();
                char c;
                cin >> c;
                if(c == 'Y'){
                    cur = cur * 10 + j;
                    break;
                }
            }
        }
    }
    cout << "! " << cur << "\n";
    cout.flush();
    exit(0);
}


Measured memory_bytes: 596
#pragma region head
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pi = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
using vv = vector<vector<T>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rrepi(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bit(n) (1LL << (n))
template <class T>
inline bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, const T &b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const int INF = 1002003004;
const ll LINF = 1002003004005006007ll;
struct preprocess {
    preprocess() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} ____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main() {
    int h, w;
    cin >> h >> w;
    int sx, sy;
    cin >> sx >> sy;
    int gx, gy;
    cin >> gx >> gy;
    sx--;
    sy--;
    gx--;
    gy--;
    vv<char> vec(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> vec[i][j];
    vi dx = {1, 0, -1, 0};
    vi dy = {0, 1, 0, -1};
    vv<int> dist(h, vector<int>(w, INF));
    deque<tuple<int, int, int>> q;
    q.emplace_front(sx, sy, 0);
    dist[sx][sy] = 0;
    vi wx, wy;
    rep(i, 5) rep(j, 5) {
        if (abs(i - 2) + abs(j - 2) < 2) continue;
        wx.emplace_back(i - 2);
        wy.emplace_back(j - 2);
    }

    // dist
    while (!q.empty()) {
        int x, y, val;
        tie(x, y, val) = q.front();
        q.pop_front();
        if (dist[x][y] < val) continue;
        int cnt = 0;
        rep(i, 4) {
            int nx = x + dx[i], ny = y + dy[i];
            if (nx < 0 || nx >= h) continue;
            if (ny < 0 || ny >= w) continue;
            if (vec[nx][ny] == '#') continue;
            cnt++;
            if (dist[nx][ny] > dist[x][y]) {
                dist[nx][ny] = dist[x][y];
                q.emplace_front(nx, ny, dist[nx][ny]);
            }
        }
        if(cnt==4) continue;
        rep(i, 20) {
            int nx = x + wx[i], ny = y + wy[i];
            if (nx < 0 || nx >= h) continue;
            if (ny < 0 || ny >= w) continue;
            if (vec[nx][ny] == '#') continue;
            if (dist[nx][ny] > dist[x][y] + 1) {
                dist[nx][ny] = dist[x][y] + 1;
                q.emplace_back(nx, ny, dist[nx][ny]);
            }
        }
    }
    if (dist[gx][gy] != INF)
        cout << dist[gx][gy] << '\n';
    else
        cout << -1 << '\n';
}


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

vector<vector<int>> x(4,vector<int>(4));
int main(){
  for(int i=1; i<4; i++){
    for(int j=1; j<4; j++){
      int c;
      cin >> c;
      x[i][j]=c;
    }
  }
  string ans="Yes";
  if(x[1][1]-x[2][1]!=x[1][2]-x[2][2]
   ||x[2][2]-x[3][2]!=x[2][3]-x[3][3]
   ||x[1][1]-x[3][1]!=x[1][3]-x[3][3]) ans="No";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n));
#define Vec(a,n) vector<string> (a)((n));
#define twovec(a,n,m) vector<vector<int>> a(n,vector<int>(m,0));
#define Twovec(a,n,m) vector<vector<double>> a(n,vector<double>(m,0));
#define P pair<int,int>
#define All(a) (a).begin(),(a).end()
#define Sort(a) sort(All(a));
#define Reverse(a) reverse(All(a));
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
#define print(a) cout << (a) << endl
#define printD(a) cout << setprecision(15) << (a) << endl;
using namespace std;
int max_int = 2147483647;
int prime = 998244353;
void Debug(auto a);
int nibul(auto a,auto b);
int nibuu(auto a,auto b);
void input(vector<auto>& a,int n);
double PI = 3.14159265358979;
int n;

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            return false;
        }
    }
    return true;
}

signed main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    cin >> n;
    if(n==1){print(0);return 0;}
    if(IsPrime(n)){
        print(1);
        return 0;
    }
    int t = sqrt(n);
    int ans = 0;
    FOR(i,2,t){
        int tmp = i;
        while(n%tmp == 0){
            n /= tmp;
            tmp *= i;
            ans++;
        }
        while(n%i==0){n/=i;}
    }
    if(n != 1){
        ans++;
    }
    print(ans);

    return 0;
}

void Debug(auto a){
    cout << "{ ";
    for(auto b: a){
        cout << b << " ";
    }
    cout << "}" << endl;
}
int nibul(auto a,auto b){
    int x = lower_bound(All(a),b) - a.begin();
    //key以上の初めてのitr
    return x;
}
int nibuu(auto a,auto b){
    int x = upper_bound(All(a),b) - a.begin();
    //key以下の最後のitr
    return x-1;
}

void input(vector<auto>& a,int n){
    REP(i,n){
        cin >> a[i];
    }
}


Measured memory_bytes: 3664
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define dump(x) 
#endif

class range {
    struct Iterator {
        int val, inc;
        int operator*() {return val;}
        bool operator!=(Iterator& rhs) {return val < rhs.val;}
        void operator++() {val += inc;}
    };
    Iterator i, n;
    public:
    range(int e) : i({0, 1}), n({e, 1}) {}
    range(int b, int e) : i({b, 1}), n({e, 1}) {}
    range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {}
    Iterator& begin() {return i;}
    Iterator& end() {return n;}
};

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

int main(){
    iostream_init();
    double d;
    while(cin >> d) {
        double ans = d;
        for(int x = 1; x <= d; x++) {
            double y = sqrt(max(0.0, d*d - x*x));
            if(y < 1) y = 1;
            ans = max(ans, x + y);
        }

        ans = max(ans, sqrt(2) * d);

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

/* vim:set foldmethod=marker: */

Measured memory_bytes: 1288
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    
    if(k%2) swap(a,b);
    ll ans=a-b;
    if(abs(ans)>1e18){
        cout1("Unfair")
    }else{
        cout1(ans)
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
// #define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


//BELOW

void solve(void)
{ 
  int N;cin>>N;
  vector<pair<int,int> > vp;
  for (int i = 0; i < N; i++)
  {
    int X,Y;cin>>X>>Y;
    vp.push_back(make_pair(X,Y));
  }
  int res = INF;
        map<pair<int,int> ,int> mp;

  for (int i = 0; i < N; i++)
  {
    for (int k = i+1; k < N; k++)
    {

      int DX = vp[i].first - vp[k].first;
      int DY = vp[i].second - vp[k].second;
      if(DX != 0 || DY != 0)
      {
        mp[make_pair(DX,DY)]++;
        mp[make_pair(DX*(-1),DY*(-1))]++;
      }
      // DEBUG(DX,DY,"\n");
    }

    
  }
        int MAX = 0;
    for (auto &&x : mp)
    {
      chmax(MAX,x.second);
      // DEBUG(x.second);
    }
    chmin(res,N - MAX);    
  cout<<res<<endl;
  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


Measured memory_bytes: 3740
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B; cin >> A >> B;
  int result = A+B/2;
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

void add(ll& a, ll b){a = (a+b) % MOD;}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int>A(4);
    REP(i,3){
        int a,b;
        cin>>a>>b;
        A[a-1]++;
        A[b-1]++;
    }
    VSORT(A);
    if(A[0]==1&&A[1]==1&&A[2]==2&&A[3]==2) cout<<"YES";
    else cout<<"NO";
}

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

int main()
{
 int a, b, box, ans = 0;
 string s;
 cin >> a >> b;
 s = to_string(a) + to_string(b);
 box = atoi(s.c_str());

 for(int i = 0; i < box; i++)
  if(i * i == box)
    ans = 1;
  if(ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;



  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
p = []
S = []
for i in range(M):
	p_, S_ = input().split()
	p.append(int(p_))
	S.append(S_)

uni_p = list(set(p))
AC_numbers = {key:0 for key in uni_p}
WA_numbers = {key:0 for key in uni_p}

for num, res in zip(p, S):
	if res == "WA":
		if AC_numbers[num] != 1:
			WA_numbers[num] += 1

	else:
		AC_numbers[num] = 1

ac = 0
wa = 0
for i in uni_p:
	ac += AC_numbers[i]
	if AC_numbers[i] == 1:
		wa += WA_numbers[i]
	
print(ac, wa)


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

int main() {
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];

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

  if(a[0]+a[1]==a[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int n, w1, w2, a[N];
int main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%d", &a[i]);
	}
	sort(a, a + n);
	w1 = a[n - 1];
	w2 = a[0];
	for (i = 1; i < n - 1; i++) {
		if (a[i] > 0) w2 -= a[i];
		else w1 -= a[i];
	}
	cout << w1 - w2 << endl;
	w1 = a[n - 1];
	w2 = a[0];
	for (i = 1; i < n - 1; i++) {
		if (a[i] > 0) break;
		printf("%d %d\n", w1, a[i]);
		w1 -= a[i];
	}
	for (; i < n - 1; i++) {
		printf("%d %d\n", w2, a[i]);
		w2 -= a[i];
	}
	printf("%d %d\n", w1, w2);
    return 0;
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;cin>>s;int b,e;
    for(int i=0;i<s.size();i++)
        if(s[i]=='A'){
        b=i;
        break;
        }
    for(int i=s.size()-1;i>=0;i--)
        if(s[i]=='Z'){
        e=i;
        break;
        }
        cout<<e-b+1;
   return 0;
   }





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

using namespace std;
int main() {
	string s, p;
	cin >> s >> p;
	s += s;
	int j = 0;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == p[j]) {
			for (int j = 0; j < p.length()+1; j++) {
				if (p[j] == '\0') {
					cout << "Yes" << endl;
					return 0;
				}
				if (s[i + j] != p[j]) break;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

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

int main()
{
	int a, b, c, x,i;
	cin >> a;
	cin >> b;
	cin >> c;
	i = 0;
	for (x = a; x <= b; x++)
	{
		if (c%x == 0)i = i + 1;
	}
	cout << i << endl;

	return 0;
}


Measured memory_bytes: 3100
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


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

int main(){
    int a[3];rep(i,0,2)cin>>a[i];
    sort(a,a+3);
    cout<<a[2]-a[0]<<endl;
    return 0;
}


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

priority_queue<int, vector<int>, greater<int>> pq;
int X[100010];
int main() {
	int N, M; cin >> N >> M;
	if(N<M){
	    for(int i=0; i<M; ++i) cin >> X[i];
	    sort(X, X+M);
	    for(int i=1; i<M; ++i) pq.push(X[i]-X[i-1]);
	    int ans=0;
	    for(int i=0; i<M-N; ++i){
	        ans += pq.top();
	        pq.pop();
	    }
	    cout << ans << endl;
	}
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 1276
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int i,j;
char c;
double x,y,a,pi=3.1415926;
x=y=0;a=90*pi/180;
while(1){
cin>>i>>c>>j;
if(i==0&&j==0)break;
x+=i*cos(a);
y+=i*sin(a);
a-=j*pi/180;
}
cout<<trunc(x)<<endl;
cout<<trunc(y)<<endl;
return 0;
}

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

Measured memory_bytes: 3632
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;

int a,b,c,d,e,k;

int main()
{
    cin>>a>>b>>c>>d>>e>>k;
    if(e - a <= k) cout<<"Yay!"<<endl;
    else cout<<":("<<endl;
    return 0;
}

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

typedef long long ll;

const int MAX_N = 3e3 + 9, MOD = 1e9 + 7;
int n;
string s;
int dp[MAX_N][MAX_N];

int _sum (int a, int b) {
	int c = a + b;
	if (MOD <= c)
		c -= MOD;
	
	return c;
}

int _sub (int a, int b) {
	int c = a - b;
	if (c < 0)
		c += MOD;

	return c;
}

int _mul (int a, int b) {
	int c = 1LL * a * b % MOD;
	return c;
}


int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n >> s;
	dp[n - 1][1] = 1;
	for (int i = n - 2; ~i; i--) {
		if (s[i] == '<')
			dp[i][1] = dp[i + 1][n - (i + 1)];
		for (int j = 2; j + i <= n; j++) {
			dp[i][j] = dp[i][j - 1];
			if (s[i] == '<')
				dp[i][j] = _sum(dp[i][j], _sub(dp[i + 1][n - (i + 1)], dp[i + 1][j - 1]));
			else
				dp[i][j] = _sum(dp[i][j], dp[i + 1][j - 1]);
		}
	}
	cout << dp[0][n] << "\n";
	return 0;
}

Measured memory_bytes: 35200
import java.util.*;
import static java.lang.System.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(in);
        double a=sc.nextDouble();
        double b=sc.nextDouble();
        if(a>b){
            out.println("GREATER");
        }else if(a==b){
            out.println("EQUAL");
        }else{
            out.println("LESS");
        }
    }
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
  
using namespace std;
 
#define endl "\n"
#define JAM(x) cout<< #x <<" = "<<x<<"\n"
#define II() ( { int a ; read(a) ; a; } )
#define LL() ( { ll a ; read(a) ; a; } )
#define DD() ({double a; scanf("%lf", &a); a;})
 
 
//Fast Reader
template<class T>inline bool read(T &x){
    int c=getchar();int sgn=1;
    while(~c&&c<'0'||c>'9'){if(c=='-')sgn=-1;c=getchar();}
    for(x=0;~c&&'0'<=c&&c<='9';c=getchar())x=x*10+c-'0'; 
    x*=sgn; return ~c;
}
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
typedef vector<PII> VPI;
 
const int INF=2e9;
const int MX=100005;
const int MOD=1000000007;
const double PI=acos(-1.0);




long long int power(long long int a,long long int b)
{
    a %= MOD;
    long long int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}
bool isprime(int n)
{
    if(n==1)
    return 0;
    int i;
    for(i=2;i*i<=n;i++)
    {
        if(n%i==0)
        return false;
    }
    return true;
}



/*_______________________________________________*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int sieve[1000001];
    int i,j;
    for(i=2;i<=1000000;i=i+2)
    {
        sieve[i]=2;
    }    
    sieve[1]=1;
    for(i=3;i<=1000000;i=i+2)
    sieve[i]=i;
    for(i=3;i*i<=1000000;i=i+2)
    {
        if(sieve[i]!=i)
        continue;
        for(j=i*i;j<=1000000;j=j+i)
        {
            sieve[j]=i;
        }
    }
    int n;
    cin>>n;
    int a[n];
    unordered_map<int,int> mp;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        unordered_map<int,int> vis;
        while(a[i]!=1)
        {
            if(vis[sieve[a[i]]]==0)
            mp[sieve[a[i]]]++;
            vis[sieve[a[i]]]=1;
            a[i]/=sieve[a[i]];
        }
    }
    string ans="not coprime";
    int flag=1,flag1=1;
    for(auto i : mp)
    {
        if(i.second>1)
        flag=0;
        if(i.second==n)
        flag1=0;
    }
    if(flag)
    {
        ans="pairwise coprime";
    }
    else if(flag1)
    {
        ans="setwise coprime";
    }
    cout<<ans;
}


Measured memory_bytes: 14288
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define ins insert
#define fi first
#define se second
#define okay ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define llmax 2e18
#define PI 3.14159265
using namespace std;

int main() {
	okay;
//	int t;
//	cin>>t;
//	while(t--)
	{
		ll n,m,k;
		cin>>n>>m>>k;
		ll a[n],b[m];
		ll sum=0;
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}
		for(int i=0;i<m;i++)
		cin>>b[i];
		ll i,j=0,jsum=0;
		ll ans=0;
		for(i=n;i>=0;i--)
		{
			if(i<n)
			sum-=a[i];
			if(sum<=k)
			{
				while(j<m && sum+jsum+b[j]<=k)
				{
					jsum+=b[j];
					j++;
				}
				ans=max(ans,i+j);
			}
			
		}
		cout<<ans;
	}
}

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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  int cnt1=vec_sum(v)/n;
  int cnt2=cnt1+1;
  int ans1=0,ans2=0;
  rep(i,n){
    ans1+=(int)pow(abs(v[i]-cnt1),2);
    ans2+=(int)pow(abs(v[i]-cnt2),2);
  }
  cout<<min(ans1,ans2)<<endl;
}
///////////////////////////

Measured memory_bytes: 256
#include <cstdio>
#include <set>
#include <stack>
#include <bitset>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <vector>
#include <string.h>
#include <array>

using namespace std;

const int xp[]={1, 0, -1, 0};
const int yp[]={0, 1, 0, -1};

vector < vector < bool > > l;
vector < vector < int > > prva[4];
int h, w, k;
vector < vector < int > > dist;

int find(int ind, int x, int y){
	if(prva[ind][x][y]==-1){
		return -1;
	}
	if(ind%2){
		if(prva[ind][x][y]==y){
			return y;
		}
		return prva[ind][x][y]=find(ind, x, prva[ind][x][y]);
	}
	else{
		if(prva[ind][x][y]==x){
			return x;
		}
		return prva[ind][x][y]=find(ind, prva[ind][x][y], y);
	}
}

void scan(int &a){
	a=0;
	char c=getchar();
	while(c>='0' && c<='9'){
		a*=10;
		a+=c-'0';
		c=getchar();
	}
}

void bfs(int x, int y){
	queue < pair < int, int > > q;
	q.push({x, y});
	pair < int, int > p;
	int xs, ys, xd, yd;
	while(!q.empty()){
		p=q.front();
		q.pop();
		for(int i=0; i<4; i++){
			xs=p.first+xp[i];
			ys=p.second+yp[i];
			if(xs>-1 && ys>-1 && xs<h && ys<w){
				if(i%2){
					ys=find(i, xs, ys);
				}
				else{
					xs=find(i, xs, ys);
				}
//				printf("proso\n");
				while(xs>-1 && ys>-1 && xs<h && ys<w && abs(p.first-xs)<=k && abs(p.second-ys)<=k && l[xs][ys]){
//					printf("%d %d\n", xs, ys);
					dist[xs][ys]=dist[p.first][p.second]+1;
					q.push({xs, ys});
					for(int j=0; j<4; j++){
						xd=xs+xp[j];
						yd=ys+yp[j];
						if(xd>-1 && yd>-1 && xd<h && yd<w){
							prva[j][xs][ys]=prva[j][xd][yd];
						}
						else{
							prva[j][xs][ys]=-1;
						}
					}
					if(i%2){
						ys=find(i, xs, ys);
					}
					else{
						xs=find(i, xs, ys);
					}
				}
//				printf("dalje\n");
			}
		}
	}
}

int main(){
	scan(h);
	scan(w);
	scan(k);
	int x1, y1, x2, y2;
	scan(x1);
	scan(y1);
	scan(x2);
	scan(y2);
	x1--;
	x2--;
	y1--;
	y2--;
	vector < bool > vi;
	vector < int > v;
	vector < int > x, y;
	char c;
	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			c=getchar();
			if(c=='.'){
				vi.push_back(1);
			}
			else{
				vi.push_back(0);
			}
			if(!i){
				v.push_back(-1);
			}
			x.push_back(i);
			y.push_back(j);
		}
		getchar();
		prva[0].push_back(x);
		prva[1].push_back(y);
		prva[2].push_back(x);
		prva[3].push_back(y);
		x.clear();
		y.clear();
		l.push_back(vi);
		dist.push_back(v);
		vi.clear();
	}
	dist[x1][y1]=0;
	bfs(x1, y1);
/*	for(int i=0; i<h; i++){
		for(int j=0; j<w; j++){
			printf("%d ", dist[i][j]);
		}
		printf("\n");
	}*/
	printf("%d\n", dist[x2][y2]);
	return 0;
}

Measured memory_bytes: 34188
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INF = (int) 1e9;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.00001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//cin.tie(0);
	//ios::sync_with_stdio(false);
	int n, d;
	cin >> n >> d;
	vector<int> h(n);
	vector<int> dp(n);
	for (int i = 0; i < n; i++) cin >> h[i];
	dp[0] = 0;
	dp[1] = abs(h[1] - h[0]);
	for (int k = 2; k < n; k++) {
		dp[k] = dp[k - 1] + abs(h[k] - h[k - 1]);
		for (int i = 2; i <= d && k - i >= 0; i++) {
			dp[k] = min(dp[k], dp[k - i] + abs(h[k] - h[k - i]));
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}


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

int main(){
    int n,aux_sec=0, aux=0;
    char l;
    cin >> n;
    if(n%2!=0)cout << "No"<<endl;
    else{
    for(int i = 0; i<n;i++){
        if(i>=n/2){
            cin >> l;
            // cout << l << endl;
            aux_sec+=int(l);
            // cout <<aux_sec <<endl;    
        }
        else{
        cin >> l;
        // cout << l << endl;
        aux+=int(l);
        // cout <<aux <<endl;
        }
    }
    if(aux==aux_sec)cout << "Yes"<<endl;
    else cout << "No"<<endl;

    }
    return 0;
}

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

#define STRING_LIMIT 1000

void Input(vector<char> &);
int EditDistance(vector<char> &, vector<char> &);

int main()
{
  int e_dist; //編集距離
  vector<char> s_buf; //文字列S
  vector<char> t_buf; //文字列T
  
  /* 入力 */
  Input(s_buf);
  Input(t_buf);
  
  /* 編集距離計算 */
  e_dist = EditDistance(s_buf, t_buf);

  /* 出力 */
  cout << e_dist << endl;
  
  return 0;
}

void Input(vector<char> &buf)
{
  	char c;
    int i,ret;
  
	for(i=0 ; i < STRING_LIMIT+1 ; i++)
    {
    	ret = scanf("%c",&c);
    	if( c == '\n' || ret == EOF ) break;
        else buf.push_back(c);
    }
}

int EditDistance(vector<char> &str1, vector<char> &str2)
{
    int i,j;
  	int e_dist = STRING_LIMIT; //編集距離
    int count = 0;
    int str1_len = str1.size();
    int str2_len = str2.size();
    
  	for(i=0 ; i < (str1_len-str2_len+1) ; i++)
    {
    	for(j=0 ; j < str2_len ; j++)
        {
        	if( str1[i+j] != str2[j] ) count++;
        }
        if( count < e_dist )
        {
        	e_dist = count;
        }
        count = 0;
    }
  	
    return e_dist;
}

Measured memory_bytes: 3236
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int t=0,yen,put=0,coin[6]={500,100,50,10,5,1};
	while(scanf("%d",&yen),yen!=0)
	{
		yen=abs(1000-yen);
		for(int i=0;i<6;i++,t=0)
		{
			t=yen/coin[i];
			put+=t;
			yen-=t*coin[i];
		}
		printf("%d\n",put);
		put=0;
	}
	//Sleep(1000);
}

Measured memory_bytes: 1028
#include <iostream>
#include <cmath>
#include <iomanip>
#define eps 10e-12

using namespace std;


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

	double res = 0;
	for (int i = n; i > 0; i--) {
		int a = 0;

		while (i * pow(2, a) < k) {
			a++;
			//cout << a << endl;
		}
		double is = (1.0 / n) * (1.0 / pow(2, a));
		//cout << is << endl;

		if (is <= eps) break;
		res += is;
	}

	cout << setprecision(12) << res << endl;

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    if(n<=111){
        cout << 111;
    }else if(n<=222){
        cout << 222;
    }else if(n<=333){
        cout << 333;
    }else if(n<=444){
        cout << 444;
    }else if(n<=555){
        cout << 555;
    }else if(n<=666){
        cout << 666;
    }else if(n<=777){
        cout << 777;
    }else if(n<=888){
        cout << 888;
    }else if(n<=999){
        cout << 999;
    }

    return 0;
}


Measured memory_bytes: 256
#134_E
import bisect
n=int(input())
a=[int(input()) for _ in range(n)][::-1]

LIS = [a[0]]
for i in range(1, n):
    if a[i] >= LIS[-1]:
        LIS.append(a[i])
    else:
        LIS[bisect.bisect_right(LIS, a[i])] = a[i]

print(len(LIS))

Measured memory_bytes: 7840
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<utility>
#include<queue>
#include<stdbool.h>
#include<math.h>
typedef long long ll;
#define N (1000000000+7)
using namespace std;
typedef pair<int, int> P;

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

ll prime[100010];
ll kaijo[200010];
void init() {
	kaijo[0] = 1;
	for (ll i = 1;i <= 200000;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}

ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}

ll Comb(ll n, ll k) {
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd)%N) + N) % N;
}

int num[100010];

int main(void) {
	int n, a, ans = 0;
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a;
		if (a > 100000)ans++;
		else num[a]++;
	}
	for (int i = 1;i <= 100000;i++) {
		if (num[i] > i)ans += num[i] - i;
		else if (num[i] < i)ans += num[i];
	}
	cout << ans << endl;
	return 0;
}

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

constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> constexpr bool chmax(T &a, const T b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> constexpr bool chmin(T &a, const T b) {
    if(a <= b) return false;
    a = b;
    return true;
}

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

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

    int n, l;
    cin >> n >> l;
    deque<pair<int, int>> dq;
    l--;
    rep(i, n) {
        int a;
        cin >> a;
        while(!dq.empty() && dq.back().first >= a)
            dq.pop_back();
        dq.push_back({a, i});
        if(i >= l) {
            cout << dq.front().first << (i == n - 1 ? "\n" : " ");
            if(dq.front().second == i - l) dq.pop_front();
        }
    }

    return 0;
}


Measured memory_bytes: 3240
def find(A,B,K):

    pre_A = []
    pre_B = []
    temp_A = 0
    temp_B = 0
    
    for x in A:
        temp_A += x
        pre_A += [temp_A]
    for x in B:
        temp_B += x
        pre_B += [temp_B]
    
    
    
    def okay(num,K):
        if num == 0:
            return True
        
        if len(A) + len(B) <num:
            return False
        
        total = 10**9
        for i in range(0,num+1):
            if num-1-i>=len(A):
                continue
            if i-1>=len(B):
                continue
            if i == 0:
                total = pre_A[num-1]
            elif i == num:
                total = pre_B[num-1]
            else:
                total = pre_A[num-1-i] + pre_B[i-1]
            if total<=K:
                return True
        return False
    
    
    left = 0
    right = len(A) + len(B) + 1
    while right - left>1:
        mid = (right+left)//2
        if okay(mid,K):
            left = mid
        else:
            right = mid

        
    return left
        
        
N,M,K = list(map(int,input().strip().split()))
A = list(map(int,input().strip().split()))
B = list(map(int,input().strip().split()))
print(find(A,B,K))

Measured memory_bytes: 126020
package main

import (
	"fmt"
)

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	if (c+b-1)/b <= (a+d-1)/d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1756
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i<(n);i++)
#define fore(i,a) for(auto &i:a)
#define debug(a,b) cout << "debug : " << a << " , "<< b << endl
using ll=long long;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
const ll INF=1LL<<60;
const ll mod=1E9+7;


int main(){
  int n;cin >> n;
  vector<int>cnt(4,0);
  rep(i,n){
    string s;cin >> s;
    if(s=="AC")cnt[0]++;
    else if(s=="WA")cnt[1]++;
    else if(s=="TLE")cnt[2]++;
    else cnt[3]++;
  }
  cout << "AC x " << cnt[0] << endl;
  cout << "WA x " << cnt[1] << endl;
  cout << "TLE x " << cnt[2] << endl;
  cout << "RE x " << cnt[3] << endl;
}



Measured memory_bytes: 3628
from operator import itemgetter

A, B, C, D, E, F = list(map(int,input().split()))
X = []
ans = 1000
for i in range(31):
    for j in range(31):
        for k in range(51):
            for l in range(51):
                if 100*A*i+100*B*j+C*k+D*l != 0:
                    if 100*A*i+100*B*j+C*k+D*l <= F and (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l) <= E/(100 + E):
                        ans =(E/(100 + E) - (C*k+D*l)/(100*A*i+100*B*j+C*k+D*l))
                        X.append([ans , 100*A*i+100*B*j+C*k+D*l, C*k+D*l])
X = sorted(X,key=itemgetter(0),reverse = False) 

print(X[0][1],X[0][2])

Measured memory_bytes: 15808
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iomanip>
#include <string>
#include <unordered_map>

using namespace std;
typedef long long LL;
template <typename S, typename T> ostream& operator<<(ostream& os, const pair<S,T>& x);
template <typename T> ostream& operator<<(ostream& os, const vector<T>& x);
template <typename T> ostream& operator<<(ostream& os, const set<T>& v);
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& v);
template <typename S, typename T> ostream& operator<<(ostream& os, const unordered_map<S,T>& v);
template <typename S, typename T> ostream& operator<<(ostream& os, const map<S,T>& v);

vector<LL> readvec(LL length, LL off = 0);
#define ALL(x) x.begin(), x.end()
#define REP(x) for(LL repvar = 0; repvar < x; repvar++)

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

    LL X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    LL m = min(X / D, K);
    X -= m*D;
    K -= m;
    if(K % 2 == 1) X -= D;
    cout << abs(X) << "\n";
        
}

















/*
Utilities
*/

template <typename S, typename T>
ostream& operator<<(ostream& os, const unordered_map<S,T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "]";
    return os;
}


template <typename S, typename T>
ostream& operator<<(ostream& os, const map<S,T>& v){
    os << "{";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "}";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S,T>& x){
    os << "(" << x.first << ", " << x.second << ")";
    return os;
}

vector<LL> readvec(LL length, LL off){
    vector<LL> v;
    for(LL i = 0; i < length; i++){
        LL x; cin >> x; v.push_back(x + off);
    }
    return v;
}


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

int n;
int parent[100004], size[100004], r[100004],p[100004],m,x,y;

void init(){
	for(int i = 1;i<=n;i++){	
		parent[i] = i; 
		size[i] = 1; 
		r[i] = 0;
	}
}
int find(int p){
	if(parent[p] == p)	return p;
	else return parent[p] = find(parent[p]);
}
void uni(int p, int q){
	p = find(p);
	q = find(q);
	if(r[p]<r[q]) parent[p] = q, size[q] += size[p];
	else	parent[q] = p, size[p] += size[q];
	if(r[p] == r[q])	r[p]++;
}

int main() {
	cin>>n>>m;
	for(int i = 1; i <= n; i++)	cin>>p[i];
	init();
	while(m--){
		cin>>x>>y;
		if(find(x)==find(y))	continue;
		uni(x,y);
	}
	int cnt = 0;
	for(int i = 1;i<=n;i++){
		if(p[i] == i){
			cnt++;
			continue;
		}
		if(find(p[i]) == find(i))	cnt++;
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 1792