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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<string> vs;
const ll mod = 1e9+7;
const ll inf = 1e17;
const int INF = 1e9;
const double PI = acos(-1);
#define fo(i, a, b) for(int i = a; i < b; i++)
#define re(i, n) fo(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(s) s.begin(), s.end()
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
int main()
{
  int a, b, c;
  cin >> a >> b >> c;

  bool can = false;
  re(i, 1000) {
    re(j, 1000) {
      if(a * i == b * j + c) can = true;
    }
  }
  if(can) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
//
// Created by yamunaku on 2019/12/28.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    vi a(n);
    vector<pair<ll, ll>> mp;
    rep(i, n){
        cin >> a[i];
    }
    sort(all(a), greater<>());
    ll b = a[p - 1];
    ll ans = 0;
    ll c = 0, c2 = 0;
    rep(i, n){
        if(a[i] >= b){
            ans++;
            if(a[i] == b) c++;
            else c2++;
        }else{
            if(mp.size() == 0) mp.push_back({a[i], 1});
            else if(a[i] == mp.back().first) mp.back().second++;
            else mp.push_back({a[i], 1});
        }
    }
    ll sum = m * c;
    ll kosu = c;
    ll pre = b;
    for(auto &pa:mp){
        if(pa.first + m < b) break;
        sum -= (pre - pa.first) * kosu;
        pre = pa.first;
        if(sum >= (v - (n - kosu)) * m) ans += pa.second;
        sum += m * pa.second;
        kosu += pa.second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2932
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int x;
  cin >> x;
  ll ans = 0;
  ans += x / 500 * 1000LL;
  x -= x / 500 * 500;
  ans += x / 5 * 5LL;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<cmath>
#include<cstdio>
#include<cassert>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aut(r,v) __typeof(v) r = (v)
#define each(it,o) for(aut(it,(o).begin()); it!=(o).end(); ++it)
#define reach(it,o) for(aut(it,(o).rbegin()); it!=(o).rend(); ++it)
#define fi first
#define se second
#define debug(...) {cerr<<"[L"<<__LINE__<<"] "; _debug(__VA_ARGS__);}

template<typename T1, typename T2> ostream& operator<<(ostream& o, const pair<T1, T2>& p)
{return o<<"("<<p.first<<", "<<p.second<<")";}
template<typename T>string join(const vector<T>&v, string del=", ")
{stringstream s;rep(i,v.size())s<<del<<v[i];return s.str().substr(del.size());}
template<typename T>ostream& operator<<(ostream& o, const vector<T>&v)
{if(v.size())o<<"["<<join(v)<<"]";return o;}
template<typename T>ostream& operator<<(ostream& o, const vector<vector<T> >&vv)
{int l=vv.size();if(l){o<<endl;rep(i,l){o<<(i==0?"[ ":",\n  ")<<vv[i]<<(i==l-1?" ]":"");}}return o;}
template<typename T>ostream& operator<<(ostream& o, const set<T>& st)
{vector<T> v(st.begin(),st.end());o<<"{ "<<join(v)<<" }";return o;}
template<typename T1, typename T2>ostream& operator<<(ostream& o, const map<T1, T2>& m)
{each(p,m){o<<(p==m.begin()?"{ ":",\n  ")<<*p<<(p==--m.end()?" }":"");}return o;}
inline void _debug(){cerr<<endl;}
template<class First, class... Rest>
void _debug(const First& first, const Rest&... rest){cerr<<first<<" ";_debug(rest...);}

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

const double PI = (1*acos(0.0)); 
const double INF = 0x3f3f3f3f;
const double INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
const double mod = 1e9 + 7;

inline void finput(string filename) {
    freopen(filename.c_str(), "r", stdin);
}

vi g[100010];
int c[100010];
int bt;

void dfs(int v){
    each(u,g[v]){
        if(c[*u] == -1){
            c[*u] = c[v]^1;
            dfs(*u);
        }else{
            if((c[*u]^c[v]) != 1) bt=0;
        }
    }
}

int main(){
    ios_base::sync_with_stdio(0);
    // finput("./input");
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int u,v;
        cin >> u >> v;
        u--; v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    fill(c,c+n,-1);

    ll a[3] = {0};
    rep(i,n){
        if(c[i] != -1) continue;
        if(g[i].size() == 0){ c[i]=0; a[0]++; }
        else{
            bt=1; c[i]=0;
            dfs(i);
            if(bt) a[1]++;
            else a[2]++;
        }
    }

    ll ans=0;
    REP(i,1,3) 
        REP(j,1,3)
            if(i == 1 && j == 1) ans += 2ll*a[i]*a[j];
            else ans += a[i]*a[j];

    ans += 2ll*a[0]*(n-a[0]) + a[0]*a[0];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9088
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}

using namespace std;
// now

struct UnionFind {
    vector<int> d;
    UnionFind(int n=0) : d(n,-1){}
    int Find (int x){//根の番号を探す
        if(d[x] < 0) return x;
        return d[x] = Find(d[x]);
    }
    bool unite (int x, int y){
        x = Find(x); y = Find(y);
        if(x == y ) return false;
        if(d[x] < d[y]){
            swap(x,y);
        }
        d[x] += d[y];
        d[y] = x;
        return true;
    } 

    bool same(int x, int y){
        return Find(x) == Find(y);
    }
    int size(int x) {
        return (-d[Find(x)]);
    }
};


ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}
 ll modd = 1e9+ 7;
ll wa (ll n,ll mi, ll ma){
    ll ans  = n * (mi+ma) /2;
    return ans;
}
ll kw(ll k,ll n){
    
    ll ans  =0;
    ll mi,ma;
    mi= wa(k,0,k-1);
    
    ma = wa(k,n-k+1,n);
    
    return (ma-mi +1)%modd;
}
ll mo = 1000000000+7;
ll powmod (int n,int k){
    ll res = 1;
    for(int i = 0; i < k ; i++){
        res = res * n %mo;
    }
    return res;
}
int main(){
    int n;
    cin >> n;
    vector<int> vec(n),dp(n);
    REP(i,n){
        cin >> vec[i];
    }
    dp[0] = 0;
    dp[1] = abs(vec[1] - vec[0]);

    for(int i = 2;i<n;i++){
        dp[i] = min((dp[i-1]+abs(vec[i]-vec[i-1])), (dp[i-2]+ abs(vec[i]-vec[i-2])));
    }

    cout << dp[n-1]  <<endl;
}





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

int main() {
  int N;
  cin >> N;
  vector<ll> result(N);
  for (int i=0; i<N; ++i) {
    ll a;
    cin >> a;
    ll cnt = 0;
    while (true) {
      if (a % 2 == 0) {
        a /= 2;
        ++cnt;
      } else {
        break;
      }
    }
    result[i] = cnt;
  }
  cout << accumulate(result.begin(), result.end(), 0) << endl;
}

Measured memory_bytes: 384
def main():
    S = input()
    first = int(S[0:2])
    last = int(S[2:4])

    if((first>12 or first==0) and last<=12 and last>=1):
        print("YYMM")
    elif((last>12 or last==0) and first<=12 and first>=1):
        print("MMYY")
    elif(last<=12 and first<=12 and last>=1 and first>=1):
        print("AMBIGUOUS")
    else:
        print("NA")
    
    return
main()


Measured memory_bytes: 3064
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
	char a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;
	if (a == f && b == e && c == d) { printf("YES\n"); }
	else { printf("NO\n"); }
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<n; i++)
#define FOR(i,a,b) for(int i=a; i<b; i++)

template<typename T>
void fillall(T& arr, const T& value) {
    arr = value;
}
template<typename T,typename ARR>
void fillall(ARR& arr, const T& value) {
    for(auto& i:arr) fillall(i,value);
}

void FZT2(int n, int *a){
    // REP(i,1<<n)printf("%d: %d\n",i,a[i]);
    REP(i,n)REP(j,(1<<n)){
        if((j&(1<<i)))a[j] = max(a[j],a[j^(1<<i)]);
    }
}

int n;
bool g[42][42];
int v[42];
char buf[25];
string name[42];
vector<string> lst[42];

bool memo[1<<20];
int dp[1<<20];

int os[25];

int main(){
    while(true){
        scanf("%d",&n);
        if(n==0)break;
        REP(i,n){
            fill(buf,buf+25,'\0');scanf("%s",buf);
            name[i] = string(buf);
            scanf("%d",v+i);
            int m;
            scanf("%d",&m);
            lst[i].clear();
            REP(j,m){
                fill(buf,buf+25,'\0');scanf("%s",buf);
                lst[i].push_back(string(buf));
            }
        }
        REP(i,n)REP(j,n)g[i][j] = false;
        REP(i,n)for(string s : lst[i]){
            REP(j,n)if(name[j]==s){
                g[i][j] = true;
            }
        }

        if(n==1){
            printf("%d\n",v[0]);
            continue;
        }
        int a = n/2;
        int b = n-a;
        // first brute-force
        fill(dp,dp+(1<<a),-1<<28);
        fill(memo,memo+(1<<a),false);
        REP(msk,(1<<a)){
            if(!(msk&1))continue;
            if(msk==0){
                memo[msk] = true;
            }else{
                int id = 0;
                REP(i,a)if(msk>>i&1)id=i;
                int m2 = msk - (1<<id);
                if(m2!=0 && !memo[m2])continue;
                memo[msk] = true;
                REP(i,a)if(m2>>i&1){
                    if(g[id][i]){
                        memo[msk] = false; break;
                    }
                }
                if(!memo[msk])continue;
            }
            dp[msk] = 0;
            REP(i,a)if(msk>>i&1)dp[msk] += v[i];
        }
        // z
        FZT2(a,dp);
        // second
        REP(i,b){
            os[i] = 0;
            REP(j,a)if(g[j][i+a]){
                os[i] = os[i] | (1<<j);
            }
        }
        fill(memo,memo+(1<<a),false);
        int ans = 0;
        REP(msk,(1<<b)){
            if(msk==0){
                memo[msk] = true;
            }else{
                int id = 0;
                REP(i,b)if(msk>>i&1)id=i;
                int m2 = msk - (1<<id);
                if(!memo[m2])continue;
                memo[msk] = true;
                REP(i,b)if(m2>>i&1){
                    if(g[id+a][i+a]){
                        memo[msk] = false; break;
                    }
                }
                if(!memo[msk])continue;
            }
            int sum = 0;
            REP(i,b)if(msk>>i&1)sum += v[i+a];
            int omsk = 0;
            REP(i,b)if(msk>>i&1){
                omsk = omsk | os[i];
            }
            omsk = ((1<<a)-1)-omsk;
            ans = max(ans, sum + dp[omsk]);
        }
        printf("%d\n",ans);
    }
    return 0;
}



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

const int mod = 1000000007, N = 2005;
typedef long long LL;

int n, k, f[N * N], inv[N * N], dp[N][N];
int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> k;
	if (k == 1) return std::cout << 1 << '\n', 0;
	f[k - 2] = 1, inv[1] = 1;
	for (int i = 2; i <= n * k - (k - 2); ++i)
		inv[i] = (LL) inv[mod % i] * (mod - mod / i) % mod;
	for (int i = k - 1; i <= n * k; ++i)
		f[i] = (LL) f[i - 1] * i % mod * pow(i - (k - 2), mod - 2) % mod;
	for (int i = 0; i <= n; ++i) {
		dp[i][0] = 1;
		for (int j = 1; j <= i; ++j)
			dp[i][j] = (dp[i - 1][j] + (LL) dp[i][j - 1] * f[n * k - i - (j - 1) * (k - 1) - 1]) % mod;
	}
	int ans = dp[n][n];
	for (int i = 1; i <= n; ++i) ans = (LL) ans * i % mod;
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 46464
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int x,a,b;
    cin >>x>>a>>b;
    if(abs(x-a)>abs(x-b)) cout << 'B' << endl;
    else cout << 'A' <<endl;



}


Measured memory_bytes: 256
//By Tushar Gautam
#include <bits/stdc++.h>
using namespace std;
#define printint(v) copy(begin(v), end(v), ostream_iterator<int>(cout," "))
#define printintv(s,e) copy(s,e, ostream_iterator<int>(cout," "))
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (for ints only diff for ll)
//https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html for other in built
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
#pragma GCC optimize ("-O2")
const int LIM = 5e5+5, MOD = 1e9+7;
int t,n,x,y;
int sum(int a){
    int ans=0;
    while(a){
        ans+=a%10;
        a/=10;
    }
    return ans;
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin>>n;
    int ans=MOD;
    forsn(i,1,n){
        ans=min(sum(i)+sum(n-i),ans);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define dunk(a) cout << (a) << endl
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;

int main() {
	int n; cin >> n;
	int a = 0;
	int b = 0;
	string Ps = "";
	string Qs = "";
	vector<string> p(n);
	vector<string> q(n);
	rep(i, n) {
		cin >> p[i];
		Ps += p[i];
	}
	rep(i, n) {
		cin >> q[i];
		Qs += q[i];
	}
	int Pn = stoi(Ps);
	int Qn = stoi(Qs);

	vector<int> vec(n);
	rep(i, n) vec[i] = i + 1;
	vector<int> dp;

	do {
		string s = "";
		for (int i = 0; i < n; i++) {
			int ind = vec[i];
			s += to_string(ind);
		}
		int x = stoi(s);
		dp.push_back(x);
	} while (next_permutation(all(vec)));
	
	sort(all(dp));

	int sz = dp.size();
	rep(i, sz) {
		if (Pn == dp[i]) a = i + 1;
	    if (Qn == dp[i]) b = i + 1;
	}
	dunk(abs(a - b));
	return 0;
}


Measured memory_bytes: 640
import sys
import collections
sys.setrecursionlimit(10**6)

class gv:
    K = 0
    N = 0
    A = []
    max_interval = 0

def build():
    gv.K, gv.N = map(int, sys.stdin.readline().split(' '))
    *gv.A, = map(int, sys.stdin.readline().split())
    for i in range(1,gv.N):
        gv.max_interval = max(gv.max_interval, gv.A[i] - gv.A[i-1])

def solve():
    ans = 0
    ans = min(  gv.A[gv.N -1] - gv.A[0], 
                gv.K - gv.max_interval)
    
    print(ans)

if __name__ == '__main__':
    build()
    solve()


Measured memory_bytes: 25432
#!/usr/bin/perl

use strict;
use warnings;

my ($n, $k);
{
    my $in = <STDIN>;
    ($n, $k) = split(" ", $in);
}
my @h;
{
    my $in = <STDIN>;
    @h = split(" ", $in);
}
@h = sort { $b <=> $a } @h;

while ($k>0)
{
    shift @h;
    $k--;
}
my $sum = sub
{
    my $x = 0;
    $x += $_ for @h;
    return $x;
};

my $ans = $sum->();

print "$ans\n";

Measured memory_bytes: 37156
'use strict'

function main(input){
  const lines = input.split('\n');
  const ABCDEF = lines.shift().split(' ').map(x => parseInt(x));
  const A = ABCDEF[0];
  const B = ABCDEF[1];

  const C = ABCDEF[2];
  const D = ABCDEF[3];

  const E = ABCDEF[4];
  const F = ABCDEF[5];

  let water = [];
  let sugers = [];
  for(var i=0;i<=F;i++){
    for(var j=0;j<=F;j++){
      let c_water = 100*(A*i+B*j);
      if(c_water<=F){ water.push(c_water); }

      let suger = C*i + D*j;
      if(suger<=F){ sugers.push(suger); }
    }
  }


//--------------

  let results = [];
  // とりうる砂糖水と砂糖の量を列挙
  for(let i = 0; i <= water.length; i++){
    for(let j = 0; j <= sugers.length; j++){
      let total = water[i] + sugers[j];
      let melt_suger = 100*sugers[j]/water[i];
      if( total <= F && melt_suger <= E){
        results.push([total, sugers[j]]);
      }
    }
  }  

  // 各砂糖水と砂糖の量から、濃度を求める
  var noudo = 0;
  var noudoIndex = 0;
  for(var i = 0; i < results.length; i++){
    var noudoTmp = (100 * results[i][1]) / results[i][0]; // 砂糖水の濃度
    if(noudoTmp > noudo){
      noudo = noudoTmp;
      noudoIndex = i;
    }
  }
  
  console.log(results[noudoIndex][0] + ' ' + results[noudoIndex][1]);

return;
//--------------


  let tmp_density = 0.0;
  let result = [];
  for(var i=0;i<results.length;i++){
      let current_density = (100*results[i][1])/(results[i][0]+results[i][1]);
      if(current_density > tmp_density){ 
        tmp_density = current_density;
        result = results[i];
      }
  }

//console.log(result);
  console.log((result[0] + result[1])+' '+result[1]);
}
main( require('fs').readFileSync( '/dev/stdin', 'utf8') );


Measured memory_bytes: 98860
import math
[A,B]=[int(item) for item in input().split()]

#Aから判断される、元値として適切な値は?
Akagen=math.ceil(A*12.5 )
Azyogen=math.ceil((A+1)*12.5-1)
#B
Bkagen=math.ceil(B*10 )
Bzyogen=math.ceil((B+1)*10-1 )

#print("{} {} {} {} ".format(Akagen,Azyogen,Bkagen,Bzyogen))
if Azyogen<Bkagen or Bzyogen<Akagen:
    print("-1")
    exit()
print(Akagen if Akagen>Bkagen else Bkagen)

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;  
  ll tmp=10;
  char c;
  vector<char>p(24);
  rep(i,0,12){
    cout<<"?" spa tmp-1<<endl;
    cin>>p[2*i];
    cout<<"?" spa max(1LL,tmp)<<endl;
    cin>>p[2*i+1];
    if(i!=0&&p[2*i]=='Y'&&p[2*i-1]=='Y'&&(p[2*i+1]=='N'||p[2*i-2]=='N'))break;
    tmp*=10;
    if(i==11)tmp=10;
  }
  ll l=tmp/10-1,r=tmp-1;
  while(r-l>=2){
    ll mid=(l+r)/2;
    cout<<"?" spa mid<<"9"<<endl;
    char x;cin>>x;
    if(x=='Y')r=mid;
    else l=mid;
  }
  cout<<"!" spa r<<endl;
  return 0;
}

Measured memory_bytes: 668
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
vector<int> a;
int main(){
	cin>>n;
	REP(i,n){
		int ta;
		cin>>ta;
		a.push_back(ta);
	}
	sort(a.begin(),a.end(),greater<int>());
	int k=a[0];
	for(int i=k;i>=(k+1)/2;i--){
		auto itr=find(a.begin(),a.end(),i);
		if(itr==a.end()){
			cout<<"Impossible"<<endl;
			return 0;
		}
		a.erase(itr);
	}
	if(k%2==1){
		auto itr=find(a.begin(),a.end(),(k+1)/2);
		if(itr==a.end()){
			cout<<"Impossible"<<endl;
			return 0;
		}
		a.erase(itr);
	}
	for(int i=(k+1)/2+1;i<=k;i++){
		auto itr=find(a.begin(),a.end(),i);
		if(itr==a.end()){
			cout<<"Impossible"<<endl;
			return 0;
		}
		a.erase(itr);
	}
	for(int i=0;i<a.size();i++){
		if(a[i]<(k+1)/2+1){
			cout<<"Impossible"<<endl;
			return 0;
		}
	}
	cout<<"Possible"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
 
public class Main {
 
		public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
	        int n = sc.nextInt();
	        int k = sc.nextInt();
			int[] strs = new int[n];
			for (int i = 0; i < n; i++) { 
				strs[i] = sc.nextInt(); 
            }
	       Arrays.sort(strs);
			int min = 0;
	        for(int j = 0; j < k;j++){
            	min += strs[j]; 
            }
			System.out.println(min);
	}
}

Measured memory_bytes: 39588
from collections import Counter
n = int(input())
s = input()
sn = Counter(s)

l = 0
r = sn['E']

ans = r
for i in range(n):
    if s[i] == 'W':
        l += 1
    else:
        r -= 1
    ans = min(ans, l+r)
print(ans)


Measured memory_bytes: 10004
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        Map<Integer, List<Integer>> graph = new TreeMap<>();
        for(int i = 0; i < n; i++){
            int u = Integer.parseInt(sc.next());
            graph.put(u, new ArrayList<>());
            int k = Integer.parseInt(sc.next());
            for(int j = 0; j < k; j++){
                graph.get(u).add(Integer.parseInt(sc.next()));
            }
        }
        
        ArrayDeque<Integer> stack = new ArrayDeque<>();
        int[] d = new int[n+1];
        int[] f = new int[n+1];
        int time = 0;
        stack.push(1);
        d[1] = ++time;
        while(!stack.isEmpty()){
            int u = stack.peek();
            int v = -1;
            for(Integer i : graph.get(u)){
                if(d[i] == 0){
                    v = i;
                    break;
                }
            }
            if(v != -1){
                stack.push(v);
                d[v] = ++time;
            }else{
                stack.pop();
                f[u] = ++time;
            }
            if(stack.isEmpty()){
                for(int i = 1; i <= n; i++){
                    if(d[i] == 0){
                        stack.push(i);
                        d[i] = ++time;
                        break;
                    }
                }
            }
        }
        
        StringBuilder sb = new StringBuilder();
        for(int i = 1; i <= n; i++){
            sb.append(i).append(" ");
            sb.append(d[i]).append(" ");
            sb.append(f[i]).append(System.lineSeparator());
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 27312
#include <stdio.h>
#include <string.h>
#define NUM (200+1)
int main(void){
    char str1[NUM];
    int num1,num2,i;
    
    while(1){
        scanf("%s",str1);
        if(0==strcmp(str1,"-"))break;
        scanf("%d",&num1);
        for(i=0;i<num1;i++){
            scanf("%d",&num2);
            
            char str2[NUM]={};
            char str3[NUM]={};
            
            strncpy(str2,str1,num2);
            strcpy(str3,str1+num2);
            strcpy(str1,strcat(str3,str2));
        }
        printf("%s\n",str1);
    }
    return 0;
}



Measured memory_bytes: 2644
/********************************************************************************
	
	Code by a weak man who named CYJian, and he hopes the code can get more points.

	Algorithm: 

 ********************************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

//{{{ FAST IO AND SOME FUNCTIONS
const int __SIZE = 1 << 18;
char ibuf[__SIZE], *iS, *iT;

#define ge (iS == iT ? (iT = (iS = ibuf) + fread(ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
#define ri read_int()
#define rl read_ll()
#define FILE(s) freopen(s"in", "r", stdin), freopen(s"out", "w", stdout), freopen(s"log", "w", stderr)

template<typename T>
inline void read(T &x) {
	char ch, t = 0; x = 0;
	while(!isdigit(ch = ge)) t |= ch == '-';
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = ge;
	x = t ? -x : x;
}
inline int read_int() { int x; return read(x), x; }
inline ll read_ll() { ll x; return read(x), x; }

template<typename T> inline void chkmin(T&a, T b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T&a, T b) { a = a > b ? a : b; }
//}}}

const int mod = 1e9 + 7;

inline int fsp(int x, int k = mod - 2) {
	int s = 1;
	while(k) {
		if(k & 1) s = 1LL * s * x % mod;
		x = 1LL * x * x % mod, k >>= 1;
	} return s;
}

int fac[65540];
int ifac[65540];

int f[65540];
int a[17];

inline void init(int n) {
	fac[0] = 1;
	for(int i = 1; i <= n; i++) fac[i] = 1LL * i * fac[i - 1] % mod;
	ifac[n] = fsp(fac[n]);
	for(int i = n; i >= 1; i--) ifac[i - 1] = 1LL * ifac[i] * i % mod;
}

inline int C(int n, int m) { return m > n || m < 0 ? 0 : 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod; }

int main() {
#ifdef LOCAL
	FILE("");
#endif

	int n = ri, m = ri, S = 1 << n;
	init(S);
	for(int i = 1; i <= m; i++)
		a[i] = ri;

	f[0] = 1;
	for(int i = m; i >= 1; i--) {
		for(int s = S - 1; ~s; s--) {
			if(!f[s]) continue;
			int F = f[s], hv = S - a[i] - s;
			for(int j = 0; j < n; j++) {
				if(s & (1 << j)) continue;
				int ts = s | (1 << j), sz = 1 << j;
				f[ts] = (f[ts] + 1LL * F * C(hv, sz - 1) % mod * fac[sz]) % mod;
			}
		}
	}

	int res = 0, ans = 0;
	for(int i = 0; i < S; i++) {
		if((bitset<32>(i)).count() & 1)
			ans = (ans + 1LL * f[i] * fac[S - i - 1]) % mod;
		else
			res = (res + 1LL * f[i] * fac[S - i - 1]) % mod;
	} res = 1LL * (res + mod - ans) * S % mod;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 4400
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main()
{
	char a[100],b[100],c[100];
	int m,n;
	scanf("%s %s",&a,&b);
	scanf("%d %d",&m,&n);
	scanf("%s",&c);
	if(strncmp(a,c,100)==0)
	m--;
	else
	n--;
	printf("%d %d",m,n);
	return 0;
}


Measured memory_bytes: 128
Point = Struct.new(:x, :y)
class Point
  def -(other)
    self.class.new(self.x - other.x, self.y - other.y)
  end
end
while ln = gets
  points = ln.split(',').map(&:to_f).each_slice(2).
    each_with_object([]){|(x, y), memo| memo << Point.new(x, y)}

  edges = (points + points.values_at(0)).each_cons(2).map{|s, t| t - s}

  cps = (edges + edges.values_at(0)).each_cons(2).map{|a, b| a.x * b.y - b.x * a.y > 0}

  puts cps.uniq.size == 1 ? 'YES':'NO'
end


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

int main() {
	int InputN; // 支払う額
	int InputA; // 1円効果の枚数

	cin >> InputN >> InputA;

	if ( ( InputN % 500 ) <= InputA ) {
		cout << "Yes";
	} else{
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

enum DIST{
	LEFT,
	RIGHT,
};

struct Info{
	Info(int arg_x,int arg_line_num){
		x = arg_x;
		line_num = arg_line_num;
	}
	bool operator<(const struct Info &arg) const{
			return x > arg.x;
	};
	int x,line_num;
};

int main(){

	int n,m,tmp_x,tmp_line_num;

	scanf("%d %d",&n,&m);

	int** dp = new int*[n+1];
	for(int i = 1; i <= n; i++){
		dp[i] = new int[2];
		dp[i][LEFT] = 0;
		dp[i][RIGHT] = 0;
	}

	priority_queue<Info> Q;

	for(int i = 0; i < m; i++){
		scanf("%d %d",&tmp_x,&tmp_line_num);
		Q.push(Info(tmp_x,tmp_line_num));
	}

	while(!Q.empty()){
		dp[Q.top().line_num+1][RIGHT] = max(dp[Q.top().line_num+1][RIGHT],dp[Q.top().line_num][RIGHT]+1);
		dp[Q.top().line_num][LEFT] = max(dp[Q.top().line_num][LEFT],dp[Q.top().line_num+1][LEFT]+1);
		Q.pop();
	}

	printf("%d",dp[1][LEFT]+dp[1][RIGHT]+1);
	for(int i = 2; i <= n; i++){
		printf(" %d",dp[i][LEFT]+dp[i][RIGHT]+1);
	}
	printf("\n");

	return 0;
}

Measured memory_bytes: 11168
#include<cstdio>
#include<iostream>

using namespace std;

int getDividend(int n, int m, int p,int array[]){
  int sum=0;
  for(int i=0;i<n;i++){
    sum+=array[i]*100;
  }
  sum -= sum * p / (double)100;
  return (array[m-1]==0) ? 0 : sum/array[m-1];
}

int main(){
  
  while(1){
    int n,m,p,N;
    int array[100];    
    cin >> n >> m >>p;
    if(n+m+p==0) break;
    for(int i=0; i<n; i++){
      cin >> array[i];
    }
    cout << getDividend(n,m,p,array) << endl;
  }

  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,t,s;
	cin>>a>>b>>c;
	t=max(a,max(b,c));
	s=t;
	int k;
	cin>>k;
	t=t*pow(2,k);
	cout<<a+b+c+t-s;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll dp[85][85][2*90*90];  // dp[i][j][k] : (i,j)の偏りをkにできるか？
 
int main() {
    ll h, w;
    cin >> h >> w;

    vvl a(h, vl(w));
    rep(i, h) {
        rep(j, w) {
            cin >> a[i][j];
        }
    }

    vvl b(h, vl(w));
    rep(i, h) {
        rep(j, w) {
            cin >> b[i][j];
        }
    }

    dp[0][0][abs(a[0][0] - b[0][0])] = true;
    rep(i, h) {
        rep(j, w) {
            exrep(k, 0, 2*80*80) {
                if(dp[i][j][k]) {
                    if(i < h-1) {
                        dp[i+1][j][abs(b[i+1][j] + k - a[i+1][j])] = true;
                        dp[i+1][j][abs(a[i+1][j] + k - b[i+1][j])] = true;
                    }
                    if(j < w-1) {
                        dp[i][j+1][abs(b[i][j+1] + k - a[i][j+1])] = true;
                        dp[i][j+1][abs(a[i][j+1] + k - b[i][j+1])] = true;
                    }
                }
            }
        }
    }

    ll ans = INF;
    exrep(k, 0, 2*80*80) {
        if(dp[h-1][w-1][k]) {
            chmin(ans, k);
        }
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 858624
X = int(input())


def is_ok(A, B, X):
    return A ** 5 - B ** 5 == X


def spiral():
    i = 1
    p = [0, 0]
    yield p
    while True:
        for j in range(i):
            p[0] += 1
            yield p
        for j in range(i):
            p[1] -= 1
            yield p
        i += 1
        for j in range(i):
            p[0] -= 1
            yield p
        for j in range(i):
            p[1] += 1
            yield p
        i += 1


for a, b in spiral():
    if is_ok(a, b, X):
        print(a, b)
        break

Measured memory_bytes: 9128
to_binary = {
  ' ' => '101',
  "'" => '000000',
  "," => '000011',
  "-" => '10010001',
  "." => '010001',
  "?" => '000001',
  "A" => '100101',
  "B" => '10011010',
  'C' => '0101',
  'D' => '0001',
  'E' => '110',
  'F' => '01001',
  'G' => '10011011',
  'H' => '010000',
  'I' => '0111',
  'J' => '10011000',
  'K' => '0110',
  'L' => '00100',
  'M' => '10011001',
  'N' => '10011110',
  'O' => '00101',
  'P' => '111',
  'Q' => '10011111',
  'R' => '1000',
  'S' => '00110',
  'T' => '00111',
  'U' => '10011100',
  'V' => '10011101',
  'W' => '000010',
  'X' => '10010010',
  'Y' => '10010011',
  'Z' => '10010000'
}

to_char = { }

[*'A'..'Z', ' ', '.', ',', '-', "'", '?'].each_with_index do |char, i|
  to_char[sprintf("%05b", i)] = char
end

readlines.each do |line|
  string = line.chomp

  binary = string.chars.map do |char|
    to_binary[char]
  end.join

  puts binary.chars.each_slice(5).map { |bin|
    to_char[bin.join.ljust(5, '0')]
  }.join
end

Measured memory_bytes: 9144
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>

int main(void){
    int i,j,k;
    int K,X;
    
    scanf("%d %d",&K,&X);
    
    int start,end;
    
    start = X - K + 1;
    end = X + K - 1;
    
    for(i = start;i <= end;i++){
        printf("%d ",i);
    }
    printf("\n");
    
    return 0;
}



Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String str2 = sc.next();

        if(str.length()+1 == str2.length() && str.equals(str2.substring(0,str.length()))){
            System.out.println("Yes");
        }else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35644
#include <bits/stdc++.h> 
 
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

int main(){
    int N;
    cin>>N;
    set<int>a;
    REP(i,N){
        int t;
        cin>>t;a.insert(t);
    }
    cout<<SZ(a)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long   ll;
ll inf=100000000000000000,mod=1000000007;
int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
       
        ll a,b;
        cin>>a>>b;
        if(b<a){
            cout<<"safe"<<endl;
        }
        else
        cout<<"unsafe"<<endl;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

double solve(double a,double b,double c){
  double s=(a+b+c)/(double)2;
  double S=sqrt(s*(s-a)*(s-b)*(s-c));
  double h=2*S/c;
  double ans=S/(s+h);
  return ans;
}


  
int main(){
  double x1,y1,x2,y2,x3,y3;
  cin>>x1>>y1>>x2>>y2>>x3>>y3;
  double a,b,c;
  a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
  c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
  double ans=solve(a,b,c);
  chmax(ans,solve(a,c,b));
  chmax(ans,solve(c,b,a));
  cout<<setprecision(15)<<ans<<endl;
}

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

int func(long long x,long long y)
{
	long long t;
	if (x<y) swap(x,y);
	t=x%y;
	while(t!=0){
		x=y;
		y=t;
		t=x%y;
	}
	return y;
}

int main()
{
	int n;
	cin>>n;
	long long a[n+1],x,d;
	cin>>x;
	for(int i=1;i<=n;i++) cin>>a[i];
	d=abs(x-a[1]);
	for(int i=2;i<=n;i++){
		int k=abs(x-a[i]);
		d=func(d,k);
	}
	cout<<d<<endl;
	return 0;
}

Measured memory_bytes: 1024
use proconio::input;

fn main() {
  input! {
    n: usize,
    m: usize,
    pairs: [(usize, String);m]
  }

  let mut arr: Vec<bool> = vec![false;n+1];
  let mut was_arr: Vec<usize> = vec![0;n+1];
  let mut was = 0;
  for (a, b) in pairs {
    match b.as_ref() {
      "AC" => arr[a] = true,
      "WA" => {
        if !arr[a] {
          was_arr[a] += 1
        }
      },
      _ => {}
    }
  }
  
  let mut acs = 0;
  for i in 1..=n {
    let v = arr[i];
    if v {
      acs += 1;
      was += was_arr[i];
    }
  }
  
  println!("{} {}", acs, was);
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
//#define i_7 (ll)(1E9+7)
//#define i_7 998244353
ll i_7;
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
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;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=50000;
    rep(y,1,P){
        ll x=mod(y*k);
        
        if(abs(x)<=P||x+P>=i_7){
            if(x+P>=i_7){
                x-=i_7;
            }
            cout<<x<<"/"<<y<<endl;
            //cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
typedef vector<ll> vl;
//////////////////////////


ll po(ll i,ll p){
    if(p==0)return 1;
    else{
        i=mod(i);
        if(p==1)return i;
        if(p%2==0)return po(mod(i*i),p/2);
        return mod(i*po(i,p-1));
    }
}
ll bunbo(ll n){
    return po(n,i_5);
}


int main(){fastio
    /*ll n;cin>>n;
    string s;cin>>s;
    ll cr=0;
    rep(i,0,n-1){
        if(s[i]=='R')cr++;
    }*/
    ll k;cin>>k;
    i_7=k;
    ll sum=0;
    ll bai=1;
    rep(ans,1,2000005){
        Add(sum,bai*7);
        if(sum%k==0){
            cout<<ans<<endl;
            return 0;
        }
        bai=mod(bai*10);
    }
    cout<<-1<<endl;
    
    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  i64 A, B, K;
  cin >> A >> B >> K;
  
  if(K <= A) {
    cout << A-K << " " << B << endl;
  } else if(K <= A+B) {
    cout << 0 << " " << B-(K-A) << endl;
  } else {
    cout << 0 << " " << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
x, y , xx, yy = map(int,input().split())

ans=[0,0,0,0]

ans[0] = xx-yy+y
ans[1] = yy+xx-x
ans[2] = x-yy+y
ans[3] = y+xx-x

print(ans[0],ans[1],ans[2],ans[3])

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

int cnt[100];

int main(void) {
    int i, n;
    cin >> n;
    int mx = 0;
    REP (i,n) {
        int a;
        cin >> a;
        cnt[a]++;
        mx = max(mx,a);
    }
    int x = mx;
    bool ans = true;
    int rest = n;
    while (x > (mx+1) / 2) {
        if (cnt[x] < 2)
            ans = false;
        rest -= cnt[x];
        x--;
    }
    if (mx % 2 == 0) {
        if (cnt[mx/2] != 1)
            ans = false;
        rest -= cnt[mx/2];
    }
    else {
        if (cnt[mx/2+1] != 2)
            ans = false;
        rest -= cnt[mx/2+1];
    }
    if (ans && rest == 0)
        puts("Possible");
    else
        puts("Impossible");
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m, 0));
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) { cin >> a[i][j]; }
    }
    const int INF = INT32_MAX;
    int ans = INF;
    for (int i = 0; i < (1 << n); i++) {
        vector<int> suma(m, 0);
        int sum = 0;
        for (int j = 0; j < n; j++) {
            if (i >> j & 1) {
                sum += c[j];
                for (int k = 0; k < m; k++) { suma[k] += a[j][k]; }
            }
        }
        bool ok = true;
        for (int k = 0; k < m; k++) {
            if (suma[k] < x) {
                ok = false;
                break;
            }
        }
        if (ok) ans = min(ans, sum);
    }

    if (ans == INF) ans = -1;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3164
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef long long ll;

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

int main() {

    string S;
    cin >> S;
    char A,B;
    string out = "No";
    ll countA = 0;
    ll countB = 0;
    rep(i,4){
        if(i==0) A = S[0];
        else if(S[i]!=A&&countB==0){
            B = S[i];
            countB++;
        }
        else if(S[i]==A) countA++;
        else if(S[i]==B) countB++;
    }
    if(countA==1&&countB==2) out = "Yes";
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int i;
  char s[5],t[5];
  scanf("%s",s);
  scanf("%s",t);

  int count=0;
  for(i=0;i<3;i++)
    if(s[i]==t[i])
      count++;

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


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef long int li;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef pair<ll, ll>P;
#define PI 3.14159265358979
#define MOD 998244353
const int MAX = 510000;

int main() {
  int N;
  int ma;
  cin>>N>>ma;
  ma=N%10;
  if(ma==2||ma==4||ma==5||ma==7||ma==9){
  	cout<<"hon";
  }
  if(ma==0||ma==1||ma==6||ma==8){
  	cout<<"pon";
  }
  if(ma==3){cout<<"bon";}   
}

Measured memory_bytes: 3620