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

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rreb(i,b,n) for(int i = b-1; i >= n; i--)
#define rrep(i,n) reb(i,n,0)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v) for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;

using namespace std;
using std::stringstream;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class F, class T> inline void convert(const F &f, T &t){stringstream ss;ss<<f;ss>>t;}
template<class T> inline T sqr(T x) {return x*x;}

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

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

int main(int argc, char *argv[])
{
    int S, W;

    cin >> S >> W;

    if (W >= S) {
        cout << "unsafe" << endl;
    } else {
        cout << "safe" << endl;
    }
    return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

int n, C, len[10], sum[10];
LL f[32][305];

int main() {
	scanf("%d%d", &n, &C);
	for (int i = 0; i < n; i++) scanf("%d", len + i);
	sort(len, len + n, greater<int>());
	long double ans = 0;
	for (int i = 1, m = 0; i <= n; i++) {
		for (int j = 0; j < n; j++) sum[j] += len[j];
		m += C;
		memset(f, 0, sizeof(f));
		f[0][sum[0]] = 1;
		for (int o = 0; o < m; o++)
		for (int l = 1; l < n; l++)
		for (int j = 0; j < 1 << (n - 1); j++) if (~j >> (l - 1) & 1)
		for (int k = o; k <= m; k++) if (f[j][k])
			f[j | 1 << (l - 1)][max(min(m, o + sum[l]), k)] += f[j][k];
		long double y = f[(1 << (n - 1)) - 1][m];
		for (int j = 1; j <= n; j++) if (j != i) y /= j - i;
		ans += y;
	}
	if (~n & 1) ans = -ans;
	for (int i = 1; i < n; i++) ans /= C;
	printf("%.18Lf\n", ans);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node{
  int p,l,r;  
};

Node T[MAX];
int n,D[MAX];

void print(int u){
    int i,c;
    cout << "node " << u << ": ";
    cout << "parent = "<< T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";
    
    if(T[u].p == NIL ) cout << "root, ";
    else if(T[u].l == NIL) cout << "leaf, ";
    else cout << "internal node, ";
    
    cout << "[";
    
    for(i = 0,c = T[u].l;c != NIL;i ++,c = T[c].r){
        if(i) cout << ", ";
        cout << c;
    }
    cout << "]" << endl;
}

int rec(int u,int p){
    D[u] = p;
    if(T[u].r != NIL) rec(T[u].r,p);
    if(T[u].l != NIL) rec(T[u].l,p + 1);
}

int main(){
    int i,j,d,v,c,l,r;
    cin >> n;
    for(i = 0;i < n;i ++){
        T[i].p = T[i].l = T[i].r = NIL;
    }
    for(i = 0;i < n;i ++ ){
        cin >> v >> d;
        for(j = 0;j < d;j ++){
            cin >> c;
            if(j == 0) T[v].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = v;
        } 
    }
    
    for(i = 0; i < n;i ++){
        if(T[i].p == NIL ) r = i;
    }
    
    rec(r,0);
    
    for(i = 0;i < n;i ++) print(i);
    
    return 0;
}







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

int n;
int main(){
  cin>>n;
  int ans=0;
  int n1=0;
  int n2;
  for(int i=0;i<n;i++){
  	cin>>n2;
    ans+= max(n2-n1,0);
    n1=n2;
  }
  cout <<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,l,n) for(int i=(l);i<(n);i++)
#define MAX 8
int N,M,MAX_N;
vector<vector<int>> edges(MAX,vector<int>(MAX,0));

int kai(int n){
    if(n==0) return 1;
    return 2*kai(n-1);
}

int dfs(int check,int parent){
    int sum=0;
    if(check==MAX_N) return 1;
    for(int child : edges[parent]){
        if((check & (1<<child))==0) sum+=dfs((check | (1<<child)),child); 
    }
    return sum;
}

int main(){
    cin >> N >> M;
    MAX_N = kai(N)-1;
    rep(i,M){
        int parent,child;
        cin >> parent;
        cin >> child;
        edges[parent-1].emplace_back(child-1);
        edges[child-1].emplace_back(parent-1);
    }
    cout << dfs(1,0) << endl; 
    return 0;
}

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

void fnInput(string& rsSrc, string& rsTrg)
{
  cin >> rsSrc >> rsTrg;
}

string fnConvChk(string sSrc, string sTrg)
{
  vector<int> vnSrc(26, -1), vnTrg(26, -1);

  for (int i = 0; i < sSrc.size(); ++i)
  {
    int nSrc = sSrc[i] - 'a';
    int nTrg = sTrg[i] - 'a';

    if (vnSrc[nSrc] == -1 && vnTrg[nTrg] == -1)
    {
      vnSrc[nSrc] = nTrg;
      vnTrg[nTrg] = nSrc;
    }
    else
      if (vnSrc[nSrc] != nTrg || vnTrg[nTrg] != nSrc)
        return "No";
  }

  return "Yes";
}
  
int main()
{
  string sSrc, sTrg;
  
  fnInput(sSrc, sTrg);
  cout << fnConvChk(sSrc, sTrg) << endl;

  return 0;
}

Measured memory_bytes: 4108
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second


int main() {
	ll n, s, ans = INF3;
	cin >> n >> s;
	if (n == s) {
		cout << n + 1 << endl;
		return 0;
	}
	for (ll i = 2;i <= sqrt(n) + 1;i++) {
		ll sum = 0, b = 0, m = n;
		for (ll j = 1;b < n;j++) {
			b = pow(i, j);
		}
		while (true) {
			if (b == 0)break;
			sum += m / b;
			m %= b;
			b /= i;
		}
		//cout << sum << endl;
		if (sum == s) {
			ans = min(ans, i);
		}
	}
	for (ll i = sqrt(n) - 1;i >= 1;i--) {
		if ((i + n - s) % i == 0 && i + n - s > 0 && n / ((i + n - s) / i) == i) {
			ans = min(ans, (i + n - s) / i);
		}
	}
	if (ans != INF3)cout << ans << endl;
	else cout << -1 << endl;
	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))
using ll = long long;
using namespace std;

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

    if (S[2] == S[3] and S[4] == S[5]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
from decimal import Decimal, ROUND_DOWN

def main():
    A, B = tuple(c for c in input().split(' '))
    A = Decimal(A)
    B = Decimal(B)
    ret = A*B
    print(ret.quantize(Decimal('0'), rounding=ROUND_DOWN))


if __name__ == "__main__":
    main()

Measured memory_bytes: 9780
#include<bits/stdc++.h>
#define For(i,l,r) for(int i = (l),i##end = (r);i <= i##end;i++)
#define Fordown(i,r,l) for(int i = (r),i##end = (l);i >= i##end;i--)
#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long ll;

template <typename T> inline bool chkmin(T &x,T y) { return y < x ? x = y,1 : 0; }
template <typename T> inline bool chkmax(T &x,T y) { return x < y ? x = y,1 : 0; }

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 10;

int to[N << 1],nex[N << 1],beg[N],Max[N],ans[N];
int e,n;

inline int read() {
	int x = 0,flag = 1;
	char ch = getchar();
	while(!isdigit(ch) && ch != '-') ch = getchar();
	if(ch == '-') flag = -1,ch = getchar();
	while(isdigit(ch)) x = (x << 3) + (x << 1) + (ch - '0'),ch = getchar();
	return x * flag;
}

inline void add(int x,int y) {
	to[++e] = y,nex[e] = beg[x],beg[x] = e;
}

inline void dfs(int x,int fa,int Las,int Sec) {
	Max[x] = Max[fa];
	if(fa > Max[x]) Max[x] = fa,Las = Sec = x;
	else chkmax(Sec,x);
	if(x > Max[x]) ans[x]++;
	else if(Max[Max[x]] > Sec) ans[Max[x]]++;
	else ans[Las]++;
	for(int i = beg[x];i;i = nex[i]) {
		if(to[i] == fa) continue;
		dfs(to[i],x,Las,Sec);
	}
}

inline void dfs_ans(int x,int fa) {
	ans[x] += ans[fa];
	for(int i = beg[x];i;i = nex[i]) {
		if(to[i] == fa) continue;
		dfs_ans(to[i],x);
	}
}

int main() {

	n = read();
	For(i,2,n) {
		int x = read(),y = read();
		add(x,y),add(y,x);
	}
	For(i,1,n) Max[i] = i;
	dfs(1,0,0,0),ans[1] = 0,dfs_ans(1,0);
	For(i,2,n) printf("%d%c",ans[i],i == n ? '\n' : ' ');
	return 0;
}


Measured memory_bytes: 13312
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define enter putchar('\n')
#define space putchar(' ')
//#define ivorysi
#define MAXN 100005
typedef long long int64;
using namespace std;
template<class T>
void read(T &res) {
	res = 0;char c = getchar();T f = 1;
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
int N;
int M = 0;
int64 op[35],sum,X[1005],Y[1005];
int64 dx[] = {1,0,-1,0},dy[] = {0,-1,0,1};
char s[1005][45];
const char *dir = "RDLU";
void Solve() {
	read(N);
	for(int i = 1 ; i <= N ; ++i) {
		read(X[i]);read(Y[i]);
	}
	for(int i = 2 ; i <= N ; ++i) {
		if((abs(X[i]) + abs(Y[i])) % 2 != (abs(X[1]) + abs(Y[1])) % 2)  {
			puts("-1");return ;
		}
	}
	bool flag = 0;
	flag = ((abs(X[1]) + abs(Y[1])) % 2 == 0);
	if(flag) {op[++M] = 1;}
	for(int i = 30 ; i >= 0 ; --i) {op[++M] = 1 << i;sum += op[M];}
	pii st = mp(0,0);
	if(flag) st = mp(1,0);
	for(int i = 1 ; i <= N ; ++i) {
		if(flag) s[i][1] = 'R';
		pii p = st;
		int64 tmp = sum;
		for(int j = flag ? 2 : 1 ; j <= M ; ++j) {
			for(int k = 0 ; k <= 3 ; ++k) {
				int64 tx = p.fi + dx[k] * op[j],ty = p.se + dy[k] * op[j];
				int64 a = abs(tx - X[i]) + abs(ty - Y[i]);
				if(a <= tmp - op[j]) {
					tmp -= op[j];
					s[i][j] = dir[k];
					p = mp(tx,ty);
					break;
				}
			}
		}
	}
	out(M);enter;
	for(int i = 1 ; i <= M ; ++i) {
		out(op[i]);space;
	}
	enter;
	for(int i = 1 ; i <= N ; ++i) {
		for(int j = 1 ; j <= M ; ++j) {
			putchar(s[i][j]);
		}
		enter;
	}
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
vector<int> fact[N + 1];
int freq[N + 1];
int main() {
  for (int i = 1; i <= N; i++)
    for (int j = 1; j * i <= N; j++)
      fact[i * j].push_back(i);
  int n, ans = 0;
  cin >> n;
  int v[n];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    freq[v[i]]++;
  }
  for (int i = 0; i < n; i++) {
    bool absent = true;
    freq[v[i]]--;
    for (int f : fact[v[i]])
      if (freq[f])
        absent = false;
    ans += absent;
    freq[v[i]]++;
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 122588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, a, b;cin>>n>>a>>b;
	ll ans = n/(a+b)*a;
	ans += min(a, n%(a+b));
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
def main():
    n = int(input())
    s = input()

    x, maxv = 0, 0
    for c in s:
        if c == 'I':
            x += 1
        elif c == 'D':
            x -= 1
        if x > maxv:
            maxv = x
    print(maxv)


if __name__ == "__main__":
    main()

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

int main() {
  int n;
  cin >> n;
  
  int a,b,c,d;
  a = n / 1000;
  b = (n - a * 1000) / 100;
  c = (n - a * 1000  - b * 100) / 10;
  d = (n - a * 1000 - b * 100 - c * 10);
  
  if((a == b && b == c) || (b == c && c == d)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

struct line{
    int h,p,q;
};

void swap(int a, int b, int num[105]){
    int temp = num[a]; //テヲツィツェテァツキツ堙」ツ?ョテ・ツ?ヲテァツ青?
    num[a] = num[b];
    num[b] = temp;
}

void sort(struct line line[1005], int m){
    if(m == 0) return;
    rep(i,m){ //テゥツォツ佚」ツ?陛」ツ?古ゥツォツ佚」ツ??ゥツ??」ツ?ォテ・ツ?ヲテァツ青?」ツ?凖」ツつ凝」ツ?淌」ツつ?」ツ??」ツつステ」ツδシテ」ツδ?
        rep(j,m - 1){
            if(line[j].h < line[j + 1].h){
                struct line temp = line[j];
                line[j] = line[j + 1];
                line[j + 1] = temp;
            }
        }
    }
}

int main(){
   int n, m, a;
   while(cin >> n >> m >> a, n||m||a){
       int num[1005] = {0};
       num[a] = 1;
       struct line line[1005];
       rep(i,m){
           cin >> line[i].h >> line[i].p >> line[i].q;
       }
       sort(line,m);
       rep(i,m){
        swap(line[i].p, line[i].q, num);
       }
       rep(i,n + 1){
           if(1 == num[i]) cout << i << endl;
       }
   }
}

Measured memory_bytes: 1172
#include <iostream>
#include <vector>
#include <array>
#include <map>

using namespace std;

int main()
{
    map<int, int> a;

    // オリジナルの回答
    for (int i = 0; i < 3; i++) {
        int input;
        
        cin >> input;
        a[input] = i * 3;

        cin >> input;
        a[input] = i * 3 + 1;

        cin >> input;
        a[input] = i * 3 + 2;
    }

    int n;
    cin >> n;

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

    vector<bool> temp(9);
    fill(temp.begin(), temp.end(), false);

    for (int i = 0; i < b.size(); i++) {
        if (a.count(b[i]) != 0) {
            temp[a.at(b[i])] = true;
        }
    }

    bool isBingo = false;
    for (int i = 0; i < 3; i++) {
        isBingo |= temp.at(i * 3) && temp.at(i * 3 + 1) && temp.at(i * 3 + 2);
        isBingo |= temp[i] && temp.at(i + 3) && temp.at(i + 6);
    }
    
    isBingo |= temp[0] && temp[4] && temp[8];
    isBingo |= temp[2] && temp[4] && temp[6];

    cout << (isBingo ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

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

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

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

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N;
    cin >> N;
    vec<lint> A_list(N);
    range(i, 0, N) cin >> A_list.at(i);
    unordered_map<lint, lint> count;
    for (const auto A : A_list) count[A] += 1;
    lint num_unique = count.size();
    lint num_even_counts = 0;
    for (const auto p : count) {
        num_even_counts += (p.second % 2 == 0 ? 1 : 0);
    }
    cout << num_unique - (num_even_counts % 2 == 1 ? 1 : 0) << "\n";
}


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

int main() {
  int64_t a ,b ,c;
  cin >> a >> b >> c;
  
  int64_t d = a * b * 4;
  int64_t e = (c - a - b);
  int64_t f = e * e;
  
  
  if(d < f && e > 0){
    cout << "Yes" << endl;
  }
  
  else{
    cout << "No" << endl;
  }
  

  
  
  
  
}

  
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600

int main(){
  int w,a,b;
  cin>>w>>a>>b;
  cout<<max(0, abs(a-b)-w)<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		while (true) {
			C -=B;
			if (C<=0) {
				System.out.println("Yes");
				return ;
			}
			A-=D;
			if (A<=0) {
				System.out.println("No");
				return ;
			}
		}
	}
}

Measured memory_bytes: 35764
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        // Your code here!
        int[] hoge=System.Console.ReadLine().Trim().Split(' ').Select(x=>int.Parse(x)).ToArray();
        if(hoge[0]+hoge[1]>=hoge[2]) System.Console.WriteLine("Yes");
        else System.Console.WriteLine("No");
    }
}

Measured memory_bytes: 13396
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val l = readLine()!!.split(" ").map { it.toInt() }
    var a = 1
    var mx = l[0]
    for(i in 1 until n){
        if(mx <= l[i]){
            a += 1
            if(mx < l[i]){
                mx = l[i]
            }
        }
    }
    println(a)
}

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

int main() {
    ll n, ans = 10000000;
    string sa, sb;
    cin >> n;
    for (ll i = 1; i * i <= n; ++i) {
        ll j = n / i;
        if (i * j == n) {
            sa = to_string(i);
            sb = to_string(j);
            ll tmp = max(sa.length(), sb.length());
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int a;

int main()
{
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
  int W[10],K[10],wsum,ksum;
  wsum=0,ksum=0;
  for(int i=0;i<10;i++){
    cin >> W[i];
  }for(int i=0;i<10;i++){
    cin >> K[i];
  }
  sort( W , W+10 , greater<int>() );
  sort( K , K+10 , greater<int>() );
  for(int i=0;i<3;i++){
    wsum+=W[i];
    ksum+=K[i];
  }
  cout << wsum << " " << ksum << endl;
  return 0;
}

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

using namespace std;

int main(){

	int N, A , j, k;

	k = 999;

	j = 0;

	cin >> N;

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

	cin  >> A;

		while( A % 2 == 0){

			A = A / 2;

			j++;

			}

	if( j < k)

	k = j;
	
	j = 0;

	}

cout << k << endl;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
int n,q;
int a[100002];

int binary_search(int key){
	// <= left never satisfy
	// right <= always satisfy

	int left = -1; 
	int right = n; // index of size + 1;

	while(right - left > 1){
			int mid = left + (right - left) / 2;

			if (a[mid] >= key) right = mid;
			else left = mid;
	}

	// left is the maximum that don't satisfy the condition.
	// right is the minimum that satisfies the condtion.

	return right; 

}

int main(){
	SCD(n);
	REP(i,n){
		int x; SCD(x);
		a[i] = x;
	}
	SCD(q);

	REP(i,q){
		int k; SCD(k);
		PRINTD(binary_search(k));
	}
	return 0;
}
	
	



Measured memory_bytes: 3540
function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    var N = parseInt(input[0][0], 10);
    var count = [0, 0, 0, 0];
    for (var i = 0; i < N; i++){
        if (input[i + 1][0] === "AC") count[0]++;
        if (input[i + 1][0] === "WA") count[1]++;
        if (input[i + 1][0] === "TLE") count[2]++;
        if (input[i + 1][0] === "RE") count[3]++;
    }

    console.log("AC x %d", count[0]);
    console.log("WA x %d", count[1]);
    console.log("TLE x %d", count[2]);
    console.log("RE x %d", count[3]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8")); 

Measured memory_bytes: 49324
from itertools import accumulate

MOD = 10**9 + 7
N, K = map(int, input().split())
*A, = map(int, input().split())
dp = [0] * (K+1)
dp[K] = 1
for a in A:
    temp = [0] * (K+1)
    for k in range(K+1):
        temp[k - min(a, k)] += dp[k]; temp[k - min(a, k)] %= MOD
        temp[k] -= dp[k]; temp[k] %= MOD
    temp = list(accumulate(temp))
    dp = [(d + t) % MOD for d, t in zip(dp, temp)]
print(dp[0] % MOD)

Measured memory_bytes: 126024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int buf = 0;
		Scanner scan = new Scanner(System.in);
		buf = buf + scan.nextInt();
		if(scan.next().equals("+")){
			buf = buf + scan.nextInt();
		}else{
			buf = buf - scan.nextInt();
		}
		System.out.println(Integer.toString(buf));
		scan.close();
	}
}

Measured memory_bytes: 9812
//Volume0-0078
import java.util.Scanner;

class P {
	public int x;
	public int y;
}

public class Main {

	//declare
	private static int     n;
	private static int[][] square;

	public static void main(String[] args) {

		int     max;
		P       p;

        //input
        Scanner sc = new Scanner(System.in);
        while((n = sc.nextInt()) != 0){
        	square = new int[n][n];
        	max = (int)Math.pow(n, 2);
        	p = start_p(n);
        	for(int i=1;i<=max;i++){
        		square[p.y][p.x] = i;
        		p = next_p(p);
        	}
        	print();
        }
	}

	private static P start_p(int n){
		P ret = new P();
		ret.x = (n - 1) / 2;
		ret.y = ret.x + 1;
		return ret;
	}

	private static P next_p(P p){
		p.x = (p.x + 1) % n;
		p.y = (p.y + 1) % n;
		if(square[p.y][p.x] != 0){
			p.x = (p.x - 1 + n) % n;
			p.y = (p.y + 1) % n;
		}
		return p;
	}

	private static void print(){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				System.out.printf("%4d",square[i][j]);
			}
			System.out.println();
		}
	}
}

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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define X first
#define Y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

const int MAXN = 2e5 + 10;

int n, q;
ii range[ MAXN ];
vi graph[ MAXN ];
ll FWT[ MAXN ];

void update( int x, ll v )
{
	for( ;x < MAXN;x += ( x & -x ) )
		FWT[ x ] += v;
}

ll query( int x )
{
	ll ret = 0;
	for( ;x > 0;x -= ( x & -x ) )
		ret += FWT[ x ];
	return ret;
}

int dt = 1;
void dfs( int parent, int node )
{
	range[ node ].X = dt;
	dt++;
	FOR( i, 0, ( int )graph[ node ].size() )
	{
		if ( graph[ node ][ i ] == parent )
			continue;
		
		dfs( node, graph[ node ][ i ] ); 
	}
	
	range[ node ].Y = dt - 1;
}

int main()
{
	cin >> n >> q;
	FOR( i, 0, n - 1 )
	{
		int a, b;cin >> a >> b;a--;b--;
		graph[ a ].pb( b );
		graph[ b ].pb( a );
	} 
	
	dfs( 0, 0 );
	while ( q-- )
	{
		int p;ll x;
		cin >> p >> x;
		p--;
		int lo = range[ p ].X, hi = range[ p ].Y + 1;
		update( lo, x );
		update( hi, -x );
	}
	
	FOR( i, 0, n )
	{
		cout << query( range[ i ].X ) << ' ';
	}
	cout << "\n";
	return 0;
}


Measured memory_bytes: 31872
import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;
import java.io.*;

public class Main {

	void solve() {
		int R = sc.nextInt();
		int C = sc.nextInt();
		int Q = sc.nextInt();

		char[][] S = new char[R][];
		for (int r = 0; r < R; r++) {
			S[r] = sc.next().toCharArray();
		}
		
		int[][] vs = new int[R+1][C+1];
		int[][] e0 = new int[R+1][C+1];
		int[][] e1 = new int[R+1][C+1];
		
		for (int r = 0; r < R; r++) {
			for (int c = 0; c < C; c++) {
				vs[r+1][c+1] = vs[r][c+1] + vs[r+1][c] - vs[r][c] + (S[r][c] =='1' ? 1 : 0);
			}
		}
		
		for (int r = 0; r < R; r++) {
			for (int c = 0; c + 1 < C; c++) {
				e0[r+1][c+1] = e0[r][c+1] + e0[r+1][c] - e0[r][c] + 
					(S[r][c] =='1' && S[r][c+1] =='1' ? 1 : 0);
			}
		}

		for (int r = 0; r + 1 < R; r++) {
			for (int c = 0; c < C; c++) {
				e1[r+1][c+1] = e1[r][c+1] + e1[r+1][c] - e1[r][c] + 
					(S[r][c] =='1' && S[r+1][c] == '1' ? 1 : 0);
			}
		}

		for (int q = 0; q < Q; q++) {
			int x1 = sc.nextInt() - 1;
			int y1 = sc.nextInt() - 1;
			int x2 = sc.nextInt();
			int y2 = sc.nextInt();
			int V = vs[x2][y2] - vs[x2][y1] - vs[x1][y2] + vs[x1][y1];
			int E0 = e0[x2][y2-1] - e0[x2][y1] - e0[x1][y2-1] + e0[x1][y1];
			int E1 = e1[x2-1][y2] - e1[x2-1][y1] - e1[x1][y2] + e1[x1][y1];
			tr(V, E0, E1);
			int ans = V - (E0 + E1);
			out.println(ans);
		}

	}

	static void tr(Object... os) { System.err.println(deepToString(os)); }

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

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

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

    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    bool ok = true;
    map<ll, ll> mp;
    for(int i = 0; i < n ; i++){
        if(n % 2 == 0){
            if(a[i] % 2 == 0){
                ok = false;
            }
        } else{
            if(a[i] % 2 != 0){
                ok = false;
            }
        }
        mp[a[i]]++;
    }

    if(n % 2 != 0){
        if(mp[0] != 1){
            ok = false;
        }
    } else {
        if(mp[0] > 0){
            ok = false;
        }
    }

    for(auto i : mp){
        if(i.second =! 2){
            ok = false;
        }
    }
    
    if(!ok){
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    for(int i = 0; i < n / 2; i++){
        ans *= 2;
        ans %= MOD;
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N, a, m, cnt[3];
int main() {
	cin >> N >> a;
	cnt[1] = 1;
	for (int i = 0; i != N - 1; ++i) {
		cin >> m;
		if (abs(m - a) > 1) {
			cout << "No" << endl;
			return 0;
		}
		++cnt[m - a + 1];
	}
	if (cnt[0] && cnt[2]) {
		cout << "No" << endl;
		return 0;
	}
	if (cnt[2]) {
		cnt[0] = cnt[1];
		cnt[1] = cnt[2];
		++a;
	}
	if (!cnt[0]) {
		if (a == N - 1 || a <= N / 2)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
		return 0;
	}
	if (a <= cnt[1] / 2 + cnt[0] && cnt[0] < a)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

a,b = getNM()
od_a, od_b = [((a)%4) // 2], [((b+1)%4) // 2]
a,b = bin(a-1)[2:], bin(b)[2:]


def checkod(binary, is_od):
    lower = binary[-1]
    for d in binary[::-1][1:]:
        if d == "0":
            is_od.append(0)
        else:
            if lower == "1":
                is_od.append(0)
            else:
                is_od.append(1)

checkod(a, od_a)
checkod(b, od_b)
lenb = len(od_b)
lena = len(od_a)
od_a = od_a + [0] * (lenb-lena)


od_f = []
for x,y in zip(od_a,od_b):
    if x^y == 0:
        od_f.append("0")
    else:
        od_f.append("1")

#print(od_a, od_b, od_f)
bin_str = "".join(od_f[::-1])
#print(bin_str)
print(int(bin_str, 2))



Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;
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 main(){
  int N; cin >> N;
  ll sum = 0;
  rep(i,N){
    int num = i+1;
    if(num%3!=0 && num%5 != 0){
      sum += num;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct Button{
	string name;
	int x1,y1,x2,y2;
	Button(){}
	Button(string name,int x1,int y1,int x2,int y2):name(name),x1(x1),y1(y1),x2(x2),y2(y2){}
};

struct Page{
	string name;
	vector<Button> buttons;
	Page(){}
	Page(string name):name(name){}
};

bool input(vector<Page>& pages,vs& cmds)
{
	int n;
	cin>>n;
	if(!n)
		return false;
	
	pages.resize(n);
	int h,w;
	cin>>h>>w;
	rep(i,n){
		string name;
		cin>>pages[i].name;
		int b;
		cin>>b;
		rep(j,b){
			int x1,y1,x2,y2;
			string name;
			cin>>x1>>y1>>x2>>y2>>name;
			pages[i].buttons.push_back(Button(name,x1,y1,x2,y2));
		}
	}
	int m;
	cin>>m;
	cmds.resize(m);
	cin.get();
	rep(i,m)
		getline(cin,cmds[i]);
	
	return true;
}

bool clicked(const Button& b,int x,int y)
{
	//printf("%d %d %d %d (%d,%d)\n",b.x1,b.y1,b.x2,b.y2,x,y);
	//dump(b.x1<=x && x<=b.x2 && b.y1<=y && y<=b.y2);
	return b.x1<=x && x<=b.x2 && b.y1<=y && y<=b.y2;
}

void solve(vector<Page>& pages,vs& cmds)
{
	map<string,int> nameToId;
	rep(i,pages.size())
		nameToId[pages[i].name]=i;
	
	vi buffer(1,0);
	int pos=0;
	rep(i,cmds.size()){
		if(cmds[i].substr(0,4)=="show")
			//dump(pages[buffer[pos]].name);
			cout<<pages[buffer[pos]].name<<endl;
		if(cmds[i].substr(0,4)=="back")
			pos=max(pos-1,0);
		if(cmds[i].substr(0,7)=="forward")
			pos=min(pos+1,(int)buffer.size()-1);
		if(cmds[i].substr(0,5)=="click"){
			buffer.resize(pos+1);
			istringstream iss(cmds[i].substr(5));
			int x,y;
			iss>>x>>y;
			Page& page=pages[buffer[pos]];
			rep(j,page.buttons.size()){
				if(clicked(page.buttons[j],x,y)){
					buffer.push_back(nameToId[page.buttons[j].name]);
					pos++;
				}
			}
		}
		//dump(pos);
	}
}

int main()
{
	for(;;){
		vector<Page> pages;
		vs cmds;
		if(!input(pages,cmds))
			break;
		solve(pages,cmds);
		//puts("--");
		//rep(i,pages.size()){
		//	dump(pages[i].name);
		//	rep(j,pages[i].buttons.size()){
		//		Button& b=pages[i].buttons[j];
		//		printf("%s %d %d %d %d\n",b.name.c_str(),b.x,b.y,b.w,b.h);
		//	}
		//}
		//rep(i,cmds.size())
		//	dump(cmds[i]);
	}
	
	return 0;
}

Measured memory_bytes: 0
package main

import (
	"fmt"
	"math"
)

// 2018-08-25T20:07:28+0800
// 2018-08-25T20:14:21+0800
// 2018-08-25T20:37:15+0800
func main() {
	var N, K int
	fmt.Scanf("%d%d", &N, &K)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &x[i])
	}
	if K == 1 {
		//
	}
	out := math.MaxInt64
	var r, t int
	for i := 0; i < N; i++ {
		r = i + K - 1
		if r >= N {
			break
		}
		if (r+1 < N && x[r+1] < 0) || (i-1 >= 0 && x[i-1] > 0) {
			continue
		}
		if x[r] < 0 {
			t = -x[i]
			if t < out {
				out = t
			}
		} else if x[i] > 0 {
			t = x[r]
			if t < out {
				out = t
			}
		} else {
			t = x[r] - x[i] + x[r]
			if t < out {
				out = t
			}
			t = x[r] - x[i] - x[i]
			if t < out {
				out = t
			}
		}
	}

	fmt.Println(out)
}

Measured memory_bytes: 5504
def main():
    n = int(input())
    m,p = 0,0
    A = []
    for i in range(n):
        a = int(input())
        if a>m:
            m = a
            p = i
        A.append(a)
    for i in range(n):
        if i==p:
            A_ = A[:i]+A[i+1:]
            print(max(A_))
        else:
            print(m)

if __name__ == "__main__":
    main()

Measured memory_bytes: 15604
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

def primes(array,n):
    C = collections.Counter(array)
    count = 0
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    for i in array:
      if is_prime[i]:
        if C[i] == 1: count += 1
        for j in range(i, n + 1, i):
            is_prime[j] = False
    return count

n = int(input())
A = list(map(int,input().split()))
A.sort()
data = [0] * (10**6+1)


print(primes(A,10**6))

Measured memory_bytes: 136960
a, b = map(int, input().split())
s = list(input())

if len(s) == a + b + 1:
	if s[a] == "-":
		del s[a]
		try:
			if all([0 <= int(x) <= 9 for x in s]):
				print("Yes")
			else:
				print("No")
		except:
			print("No")
	else:
		print("No")
else:
	print("No")

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

using namespace std;

int main(){
    int n, d;
    cin>>n>>d;
    double x[20][20];
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>x[i][j];
        }
    }
    vector <int> d1;
    vector <double> d2;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            double sum=0;
            for(int k=0;k<d;k++){
                sum+=pow(x[i][k]-x[j][k], 2);
            }
            //cout<<sum<<endl;
            sum=sqrt(sum);
            d1.push_back(sum);
            d2.push_back(sum);
        }
    }
    int res=0;
    for(int i=0;i<d1.size();i++){
        //cout<<d1[i]<<" "<<d2[i]<<endl;
        if((double)d1[i]==d2[i])
            res++;
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <cassert>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
int main(){

	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	cout << a[0] + a[1] << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static double solve(int n, double[] prob) {
      
      double[][] dp = new double[n + 1][n + 1];
      dp[0][0] = 1;
      

      for(int i = 1; i <= n; i++){
        double headEvent = prob[i-1], tailEvent = 1 - prob[i-1];
        dp[0][i] = tailEvent * dp[0][i - 1];
        
        for(int heads = 1; heads <= i; heads++)
        {
            dp[heads][i] = headEvent*dp[heads - 1][i - 1] + tailEvent*dp[heads][i - 1];
        }
      }
      
      double result = 0;
      for(int i = n/2 + 1; i <= n; i++)
          result += dp[i][n];

      
      return result;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        
        double[] prob = new double[n];

        for (int i = 0; i < n; i++) {
          prob[i] = scanner.nextDouble();
        }

      	double result = solve(n, prob);
        System.out.println(result);
    }
}


Measured memory_bytes: 122272
n = int(input())
wl = []
for i in range(n):
    wl.append(list(map(int,input().split())))
wl.sort(key = lambda x: x[1])
wls = 0
f = 0
for i in range(n):
    wls = wls+wl[i][0]
    if(wls > wl[i][1]): f += 1
if(f == 0):
    print("Yes")
else: print("No")

Measured memory_bytes: 53720
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    int d=c*3-a-b;
    int e=c*2-d;
    int f=c*3-a-e;
    int g=c*2-f;
    int h=c*2-b;
    int i=c*2-a;
    cout<<a<<" "<<b<<" "<<d<<endl<<f<<" "<<c<<" "<<g<<endl<<e<<" "<<h<<" "<<i<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;

int n, x, p[105];
vector<P> v;

int main(void) {
    cin >> x >> n;
    rep(i, 0, n) cin >> p[i];

    rep(i, -200, 200) {
        bool ok = true;
        rep(j, 0, n) {
            if (i==p[j]) ok = false;
        }
        if (ok) {
            v.pb(mp(abs(x-i), i));
        }
    } 

    sort(all(v));

    cout << v[0].second << "\n";
    return 0;
}



Measured memory_bytes: 3644
#include<cstdio>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define Rep(i,x) for(int i=head[x];i+1;i=nxt[i])
#define rep2(i,a,b) for(int i=(a);i<(b);i++)
#define ff first
#define ss second
using namespace std;
const int N=200005;
const int inf=1e9+7;
typedef long long ll;
inline void read(int &x){x=0; char ch=getchar();while(ch<'0') ch=getchar();while(ch>='0'){x=x*10+ch-48; ch=getchar();}}
//------------------------------------------head---------------------------------------------------//
inline ll cal2(int x,int y)
{
	return (ll)(y/2)*x;
}
inline int Solve(int x,int y)
{
	if(x%3==0)return 0;
	ll res=y;
	rep(i,1,x-1)
	{
		ll jp=cal2(i,y);
		ll a1=jp,a2=(ll)i*y-a1,a3=(ll)x*y-a1-a2;
		res=min(res,max(max(a1,a2),a3)-min(min(a1,a2),a3));
	}
	return (int)res;
}
int main()
{
	int n,m;read(n);read(m);
	int val=min(Solve(n,m),Solve(m,n));
	printf("%d\n",val);
	return 0;
}

Measured memory_bytes: 128
#![allow(dead_code, unused_imports, non_snake_case)]

use std::io::*;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::str::FromStr;

const MOD: i32 = 1_000_000_007;

fn main() {
    let (q, h, s, d): (u64, u64, u64, u64) = input();
    let n: u64 = input();
    let h = min(q*2, h);
    let s = min(h*2, s);
    let ans = if s*2 < d {
        s * n
    } else {
        d * (n/2) + s * (n%2)
    };
    println!("{}", ans);
}

trait Read {
    fn read(s: &str) -> Self;
}

fn input<T: Read>() -> T {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

macro_rules! read_impl {
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl Read for String {
    fn read(s: &str) -> Self {
        s.to_string()
    }
}

impl Read for Vec<char> {
    fn read(s: &str) -> Self {
        s.chars().collect()
    }
}

impl<T: Read> Read for Vec<T> {
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

impl<A: Read, B: Read, C: Read, D: Read> Read for (A, B, C, D) {
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]), D::read(tokens[3]))
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int read();
int n, L, res;
int x[300005], t[300005], del[300005];
int l[300005], r[300005];
int main() {
    n = read(), L = read(), res = n + 1;
    for (int i = 1; i <= n; ++i) x[i] = read();
    for (int i = 1; i <= n; ++i)
        res += (t[i] = read()) / (L << 1), t[i] %= L << 1;
    for (int i = 1; i <= n; ++i) {
        if (!t[i]) {
            --res, del[i] = 1;
            continue;
        }
        del[i] = !((l[i] = 2 * (L - x[i]) >= t[i]) | (r[i] = 2 * x[i] >= t[i]));
    }

    res -= l[n];
    int sum = 0, top = 0, pos = n;
    for (int i = 1; i < n; ++i) {
        if (del[i]) continue;
        if (!l[i]) {
            pos = i;
            break;
        }
        r[i] ? ++top : (top ? --top, --res : 0);
    }

    sum += top, top = 0;
    for (int i = n - 1; i >= pos; --i) {
        if (del[i]) continue;
        if (!r[i]) break;
        l[i] ? ++top : (top ? --top, --res : 0);
    }
    printf("%lld\n", 2ll * L * (res -= sum + top >> 1));
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

Measured memory_bytes: 10240