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

int main(){
  int n;
  double t;
  double ans=0;
  cin>>n>>t;
  for(int i=0;i<n;i++){
    double x,y;
    cin>>x>>y;
    ans=max(ans,y/x);
  }
  printf("%.10f\n",ans*t);
  return 0;
}



Measured memory_bytes: 3280
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    long long int n,ans=0,i,j,k;
    cin>>n;
    long long int a[n+1][n+1];
    bool p[n+1][n+1];
    memset(p,0,sizeof(p));
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
            cin>>a[i][j];
    for(k=1;k<=n;k++)      
        for(i=1;i<=n;i++)
            for(j=1;j<=n;j++){
                if(k!=j&&k!=i&&i!=j){
                    if(a[i][j]==a[i][k]+a[k][j])
                        p[i][j]=1; 
                    if(a[i][j]>a[i][k]+a[k][j]){
                        cout<<"-1"<<endl;  
                        return 0;
                    }
                }
            }
    for(i=1;i<=n;i++)
        for(j=1;j<=n;j++)
            if(p[i][j]==0)
                ans+=a[i][j]; 
    cout<<ans/2<<endl;
    return 0;
}

Measured memory_bytes: 1024
class BIT:
    def __init__(self, n):
        #A1 ... AnのBIT(1-indexed)
        self.BIT = [0] * (n + 1)
        self.n = n

    #A1 ~ Aiまでの和 O(logN)
    def query(self, idx):
        res_sum = 0
        while idx > 0:
            res_sum += self.BIT[idx]
            idx -= idx & (-idx)
        return res_sum

    #Ai += x O(logN)
    def add(self, idx, x):
        while idx <= self.n:
            self.BIT[idx] += x
            idx += idx&(-idx)
        return
def get_int(f):
    if "." not in f:
        return int(f),0
    return int(f.replace(".","")),len(f)-f.index(".")-1
n = int(input())
p = []
for i in range(n):
    a, b = get_int(input())
    c, d = 0, 0
    while a % 2 == 0:
        c += 1
        a //= 2
    while a % 5 == 0:
        d += 1
        a //= 5
    c -= b
    d -= b
    p.append((c, d))
p.sort()
now = n - 1
t = BIT(200)
ans = 0
for i in range(n):
    for j in range(now, i, -1):
        if p[i][0] + p[j][0] >= 0:
            t.add(-p[j][1] + 100, 1)
            now -= 1
        else:
            break
    if now < i:
        t.add(-p[i][1] + 100, -1)
    ans += max(0, t.query(100 + p[i][1]))

print(ans)

Measured memory_bytes: 88204
n = int(input())
arr = list(map(int, input().split()))
coun = 0
for i in range(1, n):
    if arr[i - 1] <= arr[i]:
        continue
    else:
        coun += arr[i - 1] - arr[i]
        arr[i] = arr[i - 1]
print(coun)


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end() 
#define size(x) ll(x.size())
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

int main() {
  string s;
  cin >> s;
  if(s[s.length()-1] == 's'){
    s.pb('e');
    s.pb('s');
  }else{
    s.pb('s');
  }
  cout << s << endl;
}


Measured memory_bytes: 3624
//config = { input: 'tmp', newline: '\r\n' }; // win
config = { input: '/dev/stdin', newline: '\n' }; // linux

const assert = require('assert');

const SIZE = 9;

init = require('fs').readFileSync(config.input, 'ascii')
  .trim()
  .split(config.newline)
  .join('')
  .replace(/ /g, '');
goal = [];
for (i = 1; i < SIZE; i++) goal.push(i);
goal = goal.join('') + '0';

cnt = 0;
step = {};
next = [];
function register_string(str, next, cnt) {
  if (!step.hasOwnProperty(str)) {
    step[str] = cnt;
    next.push(str);
  }
}
register_string(init, next, cnt);

function switch_array(ary, i, j) {
  var tmp = ary[i];
  ary[i] = ary[j];
  ary[j] = tmp;
}

function register(ary, next, i, j, cnt) {
  switch_array(ary, i, j);
  register_string(ary.join(''), next, cnt);
  switch_array(ary, i, j);
}

function widen(cur) {
  var next = [], i, ary, idx0;
  cnt++;
  for (i in cur) {
    ary = cur[i].split('');
    idx0 = ary.indexOf('0');
    if (idx0 === 0) {
      register(ary, next, 0, 1, cnt);
      register(ary, next, 0, 3, cnt);
    } else if (idx0 === 1) {
      register(ary, next, 1, 0, cnt);
      register(ary, next, 1, 2, cnt);
      register(ary, next, 1, 4, cnt);
    } else if (idx0 === 2) {
      register(ary, next, 2, 1, cnt);
      register(ary, next, 2, 5, cnt);
    } else if (idx0 === 3) {
      register(ary, next, 3, 0, cnt);
      register(ary, next, 3, 4, cnt);
      register(ary, next, 3, 6, cnt);
    } else if (idx0 === 4) {
      register(ary, next, 4, 1, cnt);
      register(ary, next, 4, 3, cnt);
      register(ary, next, 4, 5, cnt);
      register(ary, next, 4, 7, cnt);
    } else if (idx0 === 5) {
      register(ary, next, 5, 2, cnt);
      register(ary, next, 5, 4, cnt);
      register(ary, next, 5, 8, cnt);
    } else if (idx0 === 6) {
      register(ary, next, 6, 3, cnt);
      register(ary, next, 6, 7, cnt);
    } else if (idx0 === 7) {
      register(ary, next, 7, 4, cnt);
      register(ary, next, 7, 6, cnt);
      register(ary, next, 7, 8, cnt);
    } else if (idx0 === 8) {
      register(ary, next, 8, 5, cnt);
      register(ary, next, 8, 7, cnt);
    }
  }
  return next;
}

while (next.indexOf(goal) === -1)
  next = widen(next);
console.log(cnt);

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 51;
int n, m, k, ans;
string a[N], b[N];

bool check(int x, int y) {
    for (int i = 0; i < m; ++i) {
        for (int j = 0; j < m; ++j) {
            if (a[x + i][y + j] != b[i][j])
                return false;
        }
    }
    return true;
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
    }
    for (int i = 0; i + m <= n; ++i) {
        for (int j = 0; j + m <= n; ++j) {
            if (check(i, j)) {
                cout << "Yes" << endl;
                exit(0);
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  char c; cin >> c;
  if (c >= 'A' && c <= 'Z')
    cout << 'A' << endl;
  else
    cout << 'a' << endl;
}


Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;

int main() {
	string S;
	cin >> S;
	int ans = 0;
	for (int i = 1; i < S.size(); i++) {
		if (S[i] != S[i - 1]) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 2000000000;

int N;
vector<int> a;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  a.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());

  int ans_n = a[0], ans_r = 0;
  int half = ans_n / 2;
  int min_diff = INF;
  for (int i = 1; i < N; i++) {
    int r = a[i];
    if (r > half) {
      r = ans_n - r;
    }
    if (half - r < min_diff) {
      min_diff = half - r;
      ans_r = a[i];
    }
  }

  cout << ans_n << " " << ans_r << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());}
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();}
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);}
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}


void solve(long long N, std::vector<long long> X){
    int ans=INF;
    REP(i,0,101){
        int tans=0;
        REP(j,0,N){
            tans += (i-X[j])*(i-X[j]);
        }
        chmin(ans,tans);
    }
    cout<<ans<<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)
signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> X(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&X[i]);
    }
    solve(N, std::move(X));
    return 0;
}


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

const Int MOD = 1000000007;
const Int MAX = 2000010;

Int fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i=2; i<MAX; 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;
    }
}

Int COM(Int n, Int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}


Int modpow(Int a, Int n) {
    Int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


int main(){ 

    COMinit(); //これをやっておくこと


    Int K;
    cin >> K;
    string S;
    cin >> S;
    Int N = S.size();

    Int sum = 0;

    for (Int i = N; i <= N+K; i++) {
        sum = (sum + (((COM(i-1,N-1) * modpow(25,i-N)) % MOD) * modpow(26,N+K-i)) % MOD) % MOD;
    }

    cout << sum << endl;
}

Measured memory_bytes: 52088
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  uint64_t H, N;
  cin >> H >> N;
  vector<uint64_t> A(N);
  uint64_t tmp, sum = 0;
  string result = "No";
  for (uint64_t i = 0; i < N; i++) {
    cin >> tmp;
    sum += tmp;
    if (sum >= H) {
      result = "Yes";
      break;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
typedef long long ll;
using namespace std;

ll abs(ll a) {
  return a > 0 ? a : -a;
}

int main(void) {
  ll i, j, k, n, m, a, b, c, ans = 1e9;
  char s[15];
  scanf("%s", s);
  for(i = 0; i < strlen(s) - 2; ++i) {
    ll t = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
    if(ans > abs(753 - t)) ans = abs(753 - t);
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 128
n = int(input())
a = [int(i) for i in input().split()]
f, t = 0, 0
for ai in a:
  if ai % 4 == 0:
    f += 1
  elif ai % 2 == 0:
    t += 1	
r = n - 2 * f
if r - 1 <= 0 or r <= t:
  print("Yes")
else:
  print("No")

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

void solve() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> S(H);
    rep(i, H) cin >> S[i];
    vector<vector<int>> G(H, vector<int>(W));
    int n = 0;
    rep(i, H) {
        if(count(S[i].begin(), S[i].end(), '#')) {
            bool first = true;
            rep(j, W) {
                if(first && S[i][j] == '#') {
                    first = false;
                    ++n;
                    for(int k = j; k >= 0; --k) {
                        G[i][k] = n;
                    }
                } else if(S[i][j] == '#') {
                    ++n;
                }
                G[i][j] = n;
            }
        }
    }
    rep(i, H) {
        if(count(S[i].begin(), S[i].end(), '#')) {
            for(int j = 0; j < W; ++j) {
                for(int k = i; k >= 1; --k) {
                    if(G[k - 1][j] == 0) G[k - 1][j] = G[k][j];
                }
                for(int k = i; k < H - 1; ++k) {
                    if(G[k + 1][j] == 0) G[k + 1][j] = G[k][j];
                }
            }
            break;
        }
    }
    for(auto r : G) {
        for(auto p : r) printf("%d ", p);
        printf("\n");
    }
}

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


Measured memory_bytes: 1280
n,m = map(int,input().split())
ans = 0
import heapq
g = [[] for i in range(100000)]
for i in range(n):
    a,b = map(int,input().split())
    a -= 1
    g[a].append(-b)
for i in range(100000):
    heapq.heapify(g[i])
p = []
heapq.heapify(p)
for i in range(m):
    if len(g[i]) != 0:
        heapq.heappush(p,[heapq.heappop(g[i]),i])
    if len(p) != 0:
        x = heapq.heappop(p)
        ans += -x[0]
        if len(g[x[1]]) != 0:
            heapq.heappush(p,[heapq.heappop(g[x[1]]),x[1]])            
print(ans)

Measured memory_bytes: 22436
#include<bits/stdc++.h>
#define endl '\n'
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define mod 1000000007
#define FASTIO ios::sync_with_stdio(0); cin.tie(0);
#define REP(i,a,b) for(int i=a;i<b;i++)
#define maxx 1000001
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

int main(){
    FASTIO
    int n;
    cin>>n;
    int d[2][n];
    REP(i,0,n)
      cin>>d[0][i]>>d[1][i];
    bool ok=false;
    REP(i,0,n-2){
      if(d[0][i]==d[1][i]&&d[0][i+1]==d[1][i+1]&&d[0][i+2]==d[1][i+2]){
        ok=true;break;
      }
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3624
def main():
    n, k = map(int, input().split())
    P = [int(x) for x in input().split()]
    p_e = list()
    exp = 0
    for p in P:
        # 期待値
        # 累積和
        exp += (1+p)/2
        p_e.append(exp)
    # 初期値
    maxv = p_e[k-1] - 0
    for i in range(1, n-k):
        # 隣接するk個の期待値の和
        p_sum = p_e[k+i] - p_e[i]
        maxv = max(maxv, p_sum)
    print(maxv)
if __name__ == '__main__':
    main()


Measured memory_bytes: 31892
#include<bits/stdc++.h>
long long a[55],n,i,x,ans;
main(){
for(std::cin>>n;i<n;std::cin>>a[++i]);
for(;std::sort(a+1,a+n+1),a[n]>=n;a[n]%=n)for(ans+=x=a[n]/n,i=1;i<n;a[i++]+=x); 
std::cout<<ans<<'\n';
}

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

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine()) - 1;
        var c = new int[n];
        var s = new int[n];
        var f = new int[n];
        for (int i = 0; i < n; i++)
        {
            string[] cin = Console.ReadLine().Split();
            c[i] = int.Parse(cin[0]);
            s[i] = int.Parse(cin[1]);
            f[i] = int.Parse(cin[2]);
        }
        for (int i = 0; i < n; i++)
        {
            int ans = 0;
            for (int j = i; j < n; j++)
            {
                if (ans <= s[j]) ans = s[j];
                else
                {
                    int tmp = (ans - s[j]) % f[j];
                    if (tmp != 0) ans += (f[j] - tmp);
                }
                ans += c[j];
            }
            Console.WriteLine(ans);
        }
        Console.WriteLine(0);
    }
}

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

using namespace std;

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

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

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

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

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

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  int a,b;
  cin>>a>>b;
  cout<<(a*b%2==0 ? "Even" : "Odd")<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF=2e18;
string S;
ll N;
ll level[505][505];
void Func(ll l,ll r,ll nowL){
    if(r-l<=1)return;
    ll  mid=(l+r)/2;
    for(ll i=l;i<mid;i++){
        for(ll j=mid;j<r;j++){
            level[i][j]=nowL;
        }
    }
    Func(l,mid,nowL+1);
    Func(mid,r,nowL+1);
}
int main(){
    cin>>N;
    Func(0,N,1);
    for(ll i=0;i<N;i++){
        for(ll j=i+1;j<N;j++){
            cout<<level[i][j]<<" ";
        }cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 2432
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	k, x := nextInt(), nextInt()
	if 500*k >= x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

constexpr ll INFLL = (1LL<<62);

ll calc1(ll H, ll W){
  ll H1 = H/3;
  ll H2 = (H-H1)/2;
  ll H3 = H-H1-H2;
  ll S1 = H1*W;
  ll S2 = H2*W;
  ll S3 = H3*W;
  return max({abs(S1-S2), abs(S2-S3), abs(S3-S1)});
}

ll calc2(ll H, ll W){
  return calc1(W, H);
}

ll calc3(ll H, ll W){
  ll H1 = H/3;
  ll H2 = H-H1;
  ll W1 = W/2;
  ll W2 = W-W1;
  ll S1 = H1*W;
  ll S2 = H2*W1;
  ll S3 = H2*W2;
  return max({abs(S1-S2), abs(S2-S3), abs(S3-S1)});
}

ll calc4(ll H, ll W){
  return calc3(W, H);
}

ll calc5(ll H, ll W){
  ll H1 = H/3+1;
  ll H2 = H-H1;
  if(H2<0) return INFLL;
  ll W1 = W/2;
  ll W2 = W-W1;
  ll S1 = H1*W;
  ll S2 = H2*W1;
  ll S3 = H2*W2;
  return max({abs(S1-S2), abs(S2-S3), abs(S3-S1)});
}

ll calc6(ll H, ll W){
  return calc5(W, H);
}

int main(void){
  ll H, W;
  cin >> H >> W;
 
  ll ans = min(calc1(H, W), calc2(H, W));
  ans = min(ans, calc3(H, W));
  ans = min(ans, calc4(H, W));
  ans = min(ans, calc5(H, W));
  ans = min(ans, calc6(H, W));
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
student=[]
for i in range(n):
    s=list(map(int,input().split()))
    student.append(s)
point=[]
for j in range(m):
    p=list(map(int,input().split()))
    point.append(p)

manh=[]
for k in range(n):
    for l in range(m):
        x=abs(student[k][0]-point[l][0])
        y=abs(student[k][1]-point[l][1])
        manh.append([x+y])
    
    print(manh.index(min(manh))+1)
    manh=[]

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


int main() {

    int n;
    cin >> n;
    ll L[87];
    L[0] = 2LL, L[1] = 1LL;
    for (int i = 2; i <= n; ++i) L[i] = L[i-2]+ L[i-1];
    cout << L[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<int,int> PII;
int a,b;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define MAX(a,b) a>b? a:b
#define MIN(a,b) a>b? b:a

int MINN(vector<int>a,int k){
int min=1e9;
REP(i,k){
  if(a[i]<=min)min=a[i];
}
return min;
}

int main(){
int n;
cin>>n;
vector<int> v(n);
vector<int> c(n);
REP(i,n)cin>>v[i];
REP(i,n){
  while(v[i]%2==0){
    if(v[i]==0)break;
    v[i]/=2;
    c[i]++;
  }
}
cout<<MINN(c,n)<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;vector<int> v[20010];int main(){int n,x,y,l,r,z,i,j,w,a=1145141919;cin>>n;for(i=0;i<n;i++){cin>>x>>y;x+=10000,y+=10000;w=sqrt(a);for(j=max(0,x-w);j<=min(20005,x+w);j++){l=0,r=v[j].size();while(l<r){z=(r+l)/2;a=min(a,(x-j)*(x-j)+(y-v[j][z])*(y-v[j][z]));if(v[j][z]<y)l=z+1;else r=z;}}v[x].push_back(y);}cout<<a<<endl;return 0;}

Measured memory_bytes: 7116
# Problem C - Candles

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

# initialization
ans = float('INF')
loop_count = N - K + 1

# count
if N-K==0:
    loop_count = 1
for i in range(loop_count):
    f = x_nums[i]
    l = x_nums[i+K-1]
    if f<0:
        if l>=0:
            tmp_time_1 = abs(f)*2 + abs(l)
            tmp_time_2 = abs(l)*2 + abs(f)
            tmp_time = min(tmp_time_1, tmp_time_2)
            ans = min(ans, tmp_time)
        else:
            ans = min(ans, abs(f))
    else:
        ans = min(ans, abs(l))

# output
print(ans)


Measured memory_bytes: 14536
#include<stdio.h>
#include<math.h>
 
int main(){
    int a;
    scanf("%d",&a);
    int b=100000;
    for(int i=0;i<a;i++){
        b*=1.05;
        if(b%1000!=0)b=(b/1000+1)*1000;
    }
    printf("%d\n",b);
}


Measured memory_bytes: 2560
s = int(input())

mod = 10**9 + 7
dp = [0]*(s+1)
dp[0] = 1
for i in range(1,s+1):
    for j in range((i-3)+1):
        dp[i] +=dp[j]
        dp[i] %=mod
        
print(dp[s])

Measured memory_bytes: 64828
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 100005
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
#define mp make_pair
#define ff first
#define ss second

int n,m;

inline int read(){
    int x=0,f=1; char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int main(){
	n=read(); int x=__builtin_popcount(n);
	if (x==1){puts("No"); return 0;} puts("Yes");
	if (n==3){for (int i=1;i<(n*2);i++) printf("%d %d\n",i,i+1); return 0;}
	int pps=1; while ((pps<<1)<=n) pps<<=1;
	for (int i=1;i<pps-1;i++) printf("%d %d\n%d %d\n",i,i+1,i+n,i+1+n); printf("%d %d\n",pps-1,n+1);
	for (int i=pps;i<n;i+=2) printf("%d %d\n%d %d\n%d %d\n%d %d\n",i+1,i,i,1,1,i+n+1,i+n+1,i+n);
	if (!(n&1)) printf("%d %d\n%d %d\n",n,n+n-1,n+n,((n&-n)<<1)-2);
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std ;
	#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	#define lli long long int
	#define ulli unsigned long long int
	#define ff first
	#define ss second
	#define mp make_pair
	#define pb push_back
	#define pf pop_front()
	#define lb lower_bound
	#define ub upper_bound
	#define bs binary_search
	#define loop(i,a,b) for(lli i=a;i<b;i++)
	#define loopi(i,a,b) for(int i=a;i<b;i++)
	#define all(v) v.begin(), v.end()
	#define mod 1000000007
	#define inf 100000000000000000
	#define lld long double
	#define pll pair<long long int,long long int>
	#define pii pair<int,int>
	#define vll vector<lli>
	#define vii vector<int>
	#define endl '\n'
	#define setp(k, x) fixed << setprecision(k) << (x)
	#define deb(x) cerr << #x << ": " << x << " " << endl;
	#define debug(x) cout << "m here-" <<#x<<" ..."<<"\n";
	#define printa(a,n) for(lli i=0;i<n;i++) cout<<a[i]<<" "; cout<<"\n";
  #define printv(a) for(lli i=0;i<a.size();i++) cout<<a[i]<<" "; cout<<"\n";
	bool sortcol( const vector<lli>& v1, const vector<lli>& v2 ) //sort on basis of column //use- sort(vect.begin(), vect.end(),sortcol);
      { return v1[1] < v2[1]; }//[] o based indexing in column
	bool sortpair(const pair<lli, lli> &a, const pair<lli, lli> &b)
			{return a.second < b.second;}


int main ()
{
	// fastio
 	// lli  t;
 	// cin>>t;
 	// while(t--)
 	{
		lli n,i,d,a,b,c,j,k,sum=0;
    double r;
    cin>>n;
    unordered_map<lli,lli> mpp;
    for(i=1;i<=n-1;i++)
    {
      cin>>b;
      mpp[b]++;
    }
    for(i=1;i<=n;i++)
    {
      cout<<mpp[i]<<"\n";
    }


 	}
}


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

int main() {
  long long int n,x;
  cin >> n >> x;
  vector<long long int> a(n);
  
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  
  sort(a.begin(), a.end());
  
  long long int cnt = 0;
  for(long long int p = 0; p < n-1; p++) {
    if (a[p] <= x) {
      cnt ++;
      x -= a[p];
    } else {
      break;
    }
  }
  
  if (x == a[n-1])
    cnt ++;
  
  cout << cnt << endl;
}

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

int main(){
  string s; cin>>s;
  vector<int>V(4);
  rep(i,4) V[i] = s[i] - '0';
  rep(bit, 1<<3){
    int sum = V[0];
    rep(i,3){
      if (bit & (1<<i)) sum += V[i+1];
      else sum -= V[i+1];
    }
    if (sum==7){
      cout << V[0];
      rep(i,3){
        if (bit & (1<<i)) cout << "+";
        else cout << "-";
        cout << V[i+1];
      }
      cout << "=7" << endl;
      return 0;
    }
  }
}

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


def dfs(s:str) -> int: 
    #sに目標値以上の値が入ったら再帰を止める
    if int(s) > N:
        return 0

    #リスト内包表記でsが7, 5, 3のすべてを含んでいるか調べている
    #sが7, 5, 3のすべてを含んでいる場合はs自体が条件を満たす
    ret = 1 if all(s.count(c) > 0 for c in '753') else 0

    #引数の後ろに7,5, 3をつける
    for c in '753':
        ret += dfs(s + c)
    
    return ret
    
print(dfs('0'))

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1000000000
#define  pow(x) pow(10,(x)) 
typedef long long int LL;

int main(){
    int X,A; cin >> X >> A;
    if(X < A){
        cout << 0 << endl;
    }
    else{
        cout << 10 << endl;
    }
}

Measured memory_bytes: 256
import copy
n = int(input())
s = input()
ans = copy.deepcopy(s) 
flag = True
while flag:
    flag = False
    for i in range(len(s)-1):
        if s[i] == '(' and s[i+1] == ')':
            s = s[:i] + s[i+2:]
            flag = True
            break


for i in range(len(s)):
    if s[i] == "(":
        ans += ")"
    elif s[i] == ")":
        ans = "(" + ans


print(ans)

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

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int q; cin >> q;
    map<string, int> m;
    while (q--) {
        int a; cin >> a;
        if (a == 0) {
            string k;
            int x; cin >> k >> x;
            m[k] = x;
        } else if (a == 1) {
            string k; cin >> k;
            cout << m[k] << endl;
        } else if (a == 2) {
            string k; cin >> k;
            m.erase(k);
        }
    }
}


Measured memory_bytes: 27796
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int alp[30];

int main() {

	char W[200];
	scanf("%s", W);

	int base = 'a';

	for (int i = 0; i < strlen(W); i++) {
		alp[W[i] - base]++;
	}

	for (int i = 0; i < 30; i++) {
		if (alp[i] % 2 != 0) {
			printf("No");
			return 0;
		}
	}
	printf("Yes");

}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  int n,q;cin>>n>>q;
  string s;cin>>s;
  int satan,utan;
  satan = 0;
  utan = n-1;
  char t[q],d[q];
  REP(i,q){
    cin>>t[i]>>d[i];
  }

  for(int i=q-1;i>=0;i--){
    if(s[satan]==t[i]&&d[i]=='L'){
      satan++;
    }
    if(satan!=0){
      if(s[satan-1]==t[i]&&d[i]=='R'){
        satan--;
      }
    }
    if(s[utan]==t[i]&&d[i]=='R'){
      utan--;
    }
    if(utan!=n-1){
      if(s[utan+1]==t[i]&&d[i]=='L'){
        utan++;
      }
    }
    if(satan>n-1||utan<0){
      cout<<0<<endl;
      return 0;
    }

  }


  cout<<utan-satan+1<<endl;


  return 0;
}

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

#define ll   long long int
#define rep(i,n)    for(int i=0;i<(int)n;i++)
#define show(s)     cout<<s<<endl

int main() {

    ll N,K,Q;
    cin >> N >> K >> Q;
    vector<ll> P(N,0);

    ll A;
    for(ll i=0; i<Q; i++){
        cin >> A;
        P[A-1]++;
    }

    for(ll i=0; i<N; i++){
        if(P[i] > (Q-K)){
            show("Yes");
        }else{
            show("No");
        }
    }

    return 0;
}


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

int main() {
  long long N;
  cin >> N;
  long long m = N;
  int mod = 0;

  for(int i=0;i<9;i++){
    mod += m % 10;
    m /= 10;
  }
  
  if(N % mod == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 384
#include <iostream>
#include <stack>

using namespace std;

int main() {
	stack<int> st;
	int n;
	while (cin >> n) {
		if (n != 0)
			st.push(n);
		else {
			cout << st.top() << endl;
			st.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 0
a = list(map(int, input().split()))
if a[0] == 1 and a[1] == 1:
    b = 1
elif a[0] == 1:
    b = a[1] - 2
elif a[1] == 1:
    b = a[0] - 2
else:
    b = (a[0] - 2) * (a[1] - 2)
print(b)

Measured memory_bytes: 2940
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

#[cfg(debug_assertions)]
macro_rules! debug {
    ($( $args:expr ),*) => { eprintln!( $( $args ),* ); }
}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($( $args:expr ),*) => {
        ()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, n: usize);
    let c: Vec<_> = it.next().unwrap().chars().collect();
    let nr = c.iter().filter(|x| **x == 'R').count();
    let nr2 = c[..nr].iter().filter(|x| **x == 'R').count();
    println!("{}", nr - nr2);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2972
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main()
{
    char str[20];
    while(scanf("%s",str)==1)
    {
        int res=0;
        int num=0;
        for(int i=0;str[i]!='\0';i++)
        {
            num*=10;
            num+=str[i]-'0';
            res+=str[i]-'0';
        }
        if(num%res==0)
            printf("Yes\n");
        else
            printf("No\n");
    }
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

const int MAX_N=1e5*3+1;

long long c[MAX_N];
long long A[MAX_N];
int main(){
  int N;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>A[i];
    c[A[i]]++;
  }
  long long sum=0;
  for(int i=1;i<=N;i++){
    if(c[i]>=2)sum+=c[i]*(c[i]-1)/2;
  }
  for(int i=0;i<N;i++){
    if(c[A[i]]<=1)cout<<sum<<endl;
    else cout<<sum-(c[A[i]]-1)<<endl;
  }

}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
//cout << std::fixed << std::setprecision(15) << y << endl;

vector<pair<ll,ll>> prime_factorize(ll N){
  vector<pair<ll,ll>> ret;
  for(ll a = 2; a * a <= N; a++){
    if(N % a != 0) continue;
    ll ex = 0;
    while(N % a == 0){
      ex++;
      N /= a;
    }
    ret.push_back({a, ex});
  }
  if(N != 1) ret.push_back({N, 1});
  return ret;
}
 
int main(){
  ll n;  cin >> n;
  VL a(n); rep(i,0,n) cin >> a[i];
  ll ans = 0;
  rep(i,0,n){
    auto v = prime_factorize(a[i]);
    for(auto e : v){
      if(e.first == 2){ans += e.second; break;}
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <math.h>
#include <stack>
#include <string>
#include <string.h>
using namespace std;
double PI = 3.1415926535897932;
long mod = 1000000007;

const long INF = 1e9 + 1;

int main() {
  int x1,x2,y1,y2;
  cin >> x1 >> y1 >> x2 >> y2;
 
  int a = x2 - x1; 
  int b = y2 - y1; 

  cout << x2-b << " " << y2+a
  << " " << x1 - b << " " << y1+a << endl;    
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=1000500;
#define int long long
ll ans[max_n]={1};//??
ll ans1[max_n]={1};//?????
ll end1[max_n];
ll n,p=1e9+7;
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b)
{
	int x=gcd(a,b);
	return a*b%p*end1[x]%p;
}
void fun(int n,int p)
{
    ans[1]=1;
    for(int i=2;i<=n;i++)
    {
        ans[i]=(ans[i-1]*i)%p;
    }
}

ll pow(ll x,ll n,ll mod)//???
{
    if(n==0)return 1%mod;
    ll ans=1;
    while(n>0)
    {
        if(n&1)ans=ans*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return ans;
}

void fu(int n,int p)
{
    ans1[n]=pow(ans[n],p-2,p);//??n!mod p???
    //??????1!~(n-1)!???
    //(n-1)!=n!???*n
    for(int i=n-1;i>=1;i--)
    {
        ans1[i]=ans1[i+1]*(i+1)%p;
    }
}

void f(int n,int p)
{
    for(int i=n;i>=1;i--)
    {
        end1[i]=(ans1[i]*ans[i-1])%p;
    }
}
ll a[1000006];
ll LCM=1;
ll GCD;
int x;
ll endd;
ll cheng=1;
int mx[1000005];
signed main()
{
	n=1000005;
    fun(n,p);
    fu(n,p);
    f(n,p);
	int t;cin>>t;
	for(int i=1;i<=t;i++)
	{
		cin>>a[i];
		int x=a[i];
		for(int v=2;v*v<=x;v++)
		{
			if(x%v)continue;
			int cur=0;
			while(x%v==0)
			{
				cur++;
				x/=v;
			}
			mx[v]=max(mx[v],cur);
		}
		if(x!=1)mx[x]=max(mx[x],1LL);
	}
	for(int i=2;i<=n;i++)
	{
		if(mx[i])
		{
			LCM=LCM*pow(i,mx[i],p)%p;
		}
	}
	//cout<<LCM%p<<endl;
	//return 0;
	for(int i=1;i<=t;i++)
	{
		endd=(endd+LCM*end1[a[i]]%p)%p;
	}
	cout<<endd%p;
}

Measured memory_bytes: 33152
V, E, r = map(int, input().split())
es = []
for i in range(E):
    s, t, d = map(int, input().split())
    es.append((s, t, d))

inf = 10**18
d = [inf for i in range(V)]
d[r] = 0
cnt = 0
while True:
    update = False
    for i in range(E):
        e = es[i]
        if d[e[0]] != inf and d[e[1]] > d[e[0]] + e[2]:
            d[e[1]] = d[e[0]] + e[2]
            update = True
    if update == False:
        break
    cnt += 1
    if cnt >= V:
        break

if cnt >= V:
    print('NEGATIVE CYCLE')
else:
    for i in range(V):
        if d[i] == inf:
            print('INF')
        else:
            print(d[i])


Measured memory_bytes: 6012
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
signed main(){
  string a;
  cin>>a;
  int k=0;
  rep(i,4){
  if(a[i]=='+')
    k++;
    else
      k--;
  }
  cout<<k;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, d; cin >> n >> d;
    ll sum = 0;
    for(ll i=0; i<n; i++){
        ll x, y; cin >> x >> y;
        if(d >= sqrt(x*x + y*y)) sum++;
    }
    cout << sum;
    cout << endl;
    return 0;
}

Measured memory_bytes: 3696
console.log((args=>{
  const [[N],...X] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const A = [], B = [];
  for ( let i = 0; i < N; i++ ) {
    A.push(X[i][0]);
    B.push(X[i][1]);
  }
  A.sort((a,b)=>a-b);
  B.sort((a,b)=>a-b);
  if ( N&1 ) {
    const m = (N-1)/2;
    return B[m] - A[m] + 1;
  } else {
    const m = N/2;
    return B[m] + B[m-1] - A[m] - A[m-1] + 1;
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 111948
#include<stdio.h>
int main(){
	int n,k,x,y;
	double z;
	scanf("%d%d",&n,&k);
	x=n/k,y=n%k;
	z=(double)n/(double)k;
	printf("%d %d %lf",x,y,z);
	return 0;
}


Measured memory_bytes: 2008
import numpy as np

n = int(input())

a = 1
b = n

ans = n - 1

for i in range(2, int(np.sqrt(n) + 1)):
    if n % i ==  0:
        a = int(i)
        b = int(n / i)
        ans = min(ans, int(a + b - 2))

print(ans)

Measured memory_bytes: 12488
#encoding: utf-8
import os, sys
import math

def read_items_in_line(cast=int):
    return [cast(x) for x in sys.stdin.readline().strip(' \n').split(' ')]

def checK(remain_N, remain_Y, a, b, c):
    if remain_N == 0 and remain_Y == 0:
        print("{} {} {}".format(a, b, c))
        exit(0)

N, Y = read_items_in_line()

for a_i in reversed(range(int(Y / 10000) + 1)):
    remain_N = N - a_i
    remain_Y = Y - a_i * 10000
    if remain_N < 0 or remain_Y < 0:
        continue
    for b_i in reversed(range(int(remain_Y / 5000) + 1)):
        remain_N = N - a_i - b_i
        remain_Y = Y - a_i * 10000 - b_i * 5000
        if remain_N < 0 or remain_Y < 0:
            continue
        if remain_N == remain_Y / 1000:
            c_i = int(remain_Y / 1000)
            remain_N = N - a_i - b_i - c_i
            remain_Y = Y - a_i * 10000 - b_i * 5000 - c_i * 1000
            # print((a_i, b_i, c_i, remain_N, remain_Y))
            checK(remain_N, remain_Y, a_i, b_i, c_i)

### unsat
print("-1 -1 -1")

Measured memory_bytes: 3064
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
sum = 0
#sum += a[1]
kouho = a[1]
strt=0

for i in 0..a[0]-1
  if b[i] > kouho
    sum += kouho-strt
    strt = b[i]
    kouho = b[i]+ a[1] 
  else
    kouho = b[i]+ a[1] 
  end
  #p kouho
  #if a[1]-before-b[i-1] > 0
  #  p a[1]-before-b[i-1]
  #  sum -= (a[1]-before - b[i-1]) 
  #else
  #  before = b[i]
  #end
end
p sum+kouho-strt


Measured memory_bytes: 17924
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

K, X = lr()
left = max(X-K+1, -1000000)
right = min(X+K-1, 1000000)
answer = range(left, right+1)
print(*answer)


Measured memory_bytes: 3060
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<functional>
#include<list>
#include<map>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<algorithm>
#include<memory.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(c<=b)cout<<"delicious"<<endl;
	else if(c<=a+b)cout<<"safe"<<endl;
	else cout<<"dangerous"<<endl;
	return 0;
}


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

using LL = long long int;
LL MOD = 1e9 + 7;

class Solution {
public:
    vector<int> solve(int n, vector<int> &c) {
        int i, j;
        tie(i, j) = find_dup(c);
        ++ i;
        ++ j;
        ++ n;
        LL a = n, b = 1;
        vector<int> result(n);
        result[0] = n - 1;
        for(int k = 2; k <= n; ++ k) {
            a = comb(a, n, k);
            if(k <= i-1+n-j+1) {
                b = comb(b, i-1+n-j, k-1);
            }
            else {
                b = 0;
            }
            result[k-1] = (a - b + MOD) % MOD;
        }
        return result;
    }

    LL comb(LL a, LL n, LL k) {
        LL r = fast_power(k, MOD - 2);
        r *= a;
        r %= MOD;
        r *= n - k + 1;
        r %= MOD;
        return r;
    }

    LL fast_power(LL a, LL b) {
        if(b == 0) {
            return 1;
        }
        LL r = fast_power(a, b >> 1);
        r *= r;
        r %= MOD;
        if(b & 1) {
            r *= a;
            r %= MOD;
        }
        return r;
    }

    pair<int, int> find_dup(vector<int> &a) {
        vector<char> occurrences(a.size());
        for(auto ai : a) {
            ++ occurrences[ai];
        }
        int n = distance(begin(occurrences), find(begin(occurrences), end(occurrences), 2));
        int i = distance(begin(a), find(begin(a), end(a), n));
        int j = distance(begin(a), find(begin(a) + i + 1, end(a), n));
        return make_pair(i, j);
    };
};

int main() {
    Solution s;
    int n;
    cin >> n;
    vector<int> a(n+1);
    for(auto &ai : a) {
        cin >> ai;
    }
    for(auto bi : s.solve(n, a)) {
        cout << bi << endl;
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
using namespace std;
typedef long long llg;

const llg borneMax = 2 * (llg)(1e5) + 5;
llg nbDechets, coutFixe;
llg pos[borneMax];
llg somme[borneMax];

int main()
{
    scanf("%lld%lld", &nbDechets, &coutFixe);
    for (llg indDechet = 1; indDechet <= nbDechets; ++indDechet) {
        scanf("%lld", &pos[indDechet]);
        somme[indDechet] = somme[indDechet - 1] + pos[indDechet];
    }
    llg reponse = LLONG_MAX;
    for (llg portesParTour = 1; portesParTour <= nbDechets; ++portesParTour) {
        llg dernier = nbDechets;
        llg sous = 0;
        for (llg indTour = 1; dernier > 0; ++indTour) {
            llg coefficient = max(5LL, 2*indTour+1);
            llg inv = somme[dernier];
            dernier -= portesParTour;
            dernier = max(dernier, 0LL);
            inv -= somme[dernier];
            llg ajout = coefficient*inv;
            if (ajout >= (LLONG_MAX - sous)) { sous = -1; break; }
            sous += ajout;
        }
        if (sous == -1) continue;
        sous += portesParTour*coutFixe;
        sous += nbDechets*coutFixe;
        reponse = min(reponse, sous);
    }
    printf("%lld\n", reponse);
}

Measured memory_bytes: 3328
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = null;
		PrintStream out = null;
		try {
			sc = new Scanner(System.in);
			out = System.out;
			exec(sc, out);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			if(out != null) {
				out.close();
			}
			if(sc != null) {
				sc.close();
			}
		}
		System.exit(0);
	}
	public static void exec(final Scanner sc, final PrintStream out) throws Exception{
		final int N = sc.nextInt();
		final int K = sc.nextInt();
		final int Q = sc.nextInt();

		final int[] score = new int[N+1];

		for(int i=1;i<=Q;i++) {
			int Ai = sc.nextInt();
			score[Ai]++;
		}

		for(int i=1;i<=N;i++) {
			if(K- Q + score[i] <= 0) {
				out.println("No");
			}else {
				out.println("Yes");
			}
		}

	}

}


Measured memory_bytes: 58652
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
x, a, b = ri_()
print('A' if abs(a - x) < abs(b - x) else 'B')

Measured memory_bytes: 62956