akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){
    Int X; cin >> X;
    cout << (X/500)*1000 + (X%500)/5 *5 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		for (int n = sc.nextInt(); n != 0; n = sc.nextInt()) {
			int r = 0;
			for(int j = 2,i = 1,s = 3;j<n;s += (s < n)?++j:-i++)
				if(s == n) r++;
			System.out.println(r);
		}
	}
}

Measured memory_bytes: 26240
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){
    int N , M;
    cin >> N >> M;
    int X[100000];

    for(int i = 0; i < M; i++){
        cin >> X[i];
    }

    sort(X, X + M);

    int diff[100000];
    for(int j = 0; j < M - 1; j++){
        diff[j] = abs(X[j] - X[j + 1]);
    }

    sort(diff , diff + (M-1), greater<>());
/*
    for(int j = 0; j < M-1; j++){
        cout << diff[j] << endl;
    }
*/ 
    int sum = 0;

    if(N < M){
        if(N > 1){
            int sts = N - 1;
            for(int k = sts; k < M -1; k++){
                sum += diff[k];
            }
        }else{
            for(int k = 0; k < M -1; k++){
                sum += diff[k];
            }
        }
    }else{
        cout << "0" << endl;
    }

    if(sum != 0 )
        cout << sum << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

int N;
string S;
int Q;
const int INF = 1000000000;

int main() {
  cin >> N >> S >> Q;
  set<int> s[26];

  rep(i, N) {
    s[S[i]-'a'].insert(i);
  }
  rep(j, 26) {
    s[j].insert(INF);
  }
  vector<int> ans;
  rep(i, Q) {
    int temp;
    cin >> temp;
    if(temp == 1) {
      int j;
      char c;
      cin >> j >> c;
      j--;
      s[S[j]-'a'].erase(j);
      S[j] = c;
      s[S[j]-'a'].insert(j);
    } else {
      int l, r;
      cin >> l >> r;
      l--;r--;
      int t = 0;
      rep(j, 26) {
        if(s[j].empty()) continue;
        int p = *s[j].lower_bound(l);
        if(p <= r) {
          t++;
        }
      }
      ans.push_back(t);
    }
  }
  rep(i, ans.size()) {
      cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 27420
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int dp[200005];
int nxt[200005][26];
int pos[26];

signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    string a;
    cin>>a;
    int n=a.length();
    a="#"+a;
    fill_n(pos,26,n+1);

    for(int i=0;i<26;i++)
        nxt[n+1][i]=n+1;

    for(int i=n;i>=1;i--)
    {
        pos[a[i]-'a']=min(pos[a[i]-'a'],i);
        for(int j=0;j<26;j++)
            nxt[i][j]=pos[j];
    }

    dp[n+1]=1;
    for(int i=n;i>=1;i--)
    {
        int mn=1e9;
        for(int j=0;j<26;j++)
        {
            mn=min(mn,dp[nxt[i][j]+1]);
        }
        dp[i]=mn+1;
    }
    int len=dp[1];
    int ini=1;
    string ans="";
    while(ini<=n)
    {
        for(int j=0;j<26;j++)
        {
            if(nxt[ini][j]==n+1)
            {
                ans+=char(j+97);
                cout<<ans;
                return 0;
            }
            if(dp[nxt[ini][j]+1]==len-1)
            {
                ini=nxt[ini][j]+1;
                ans+=char(j+97);
                break;
            }
        }
        len--;
    }
    cout<<ans;

} 



Measured memory_bytes: 42832
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
const int mod=1e9+7;
 
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
};
 
mint c[4005][4005];
void init() {
  c[0][0] = 1;
  for (int i = 0; i <= 4000; i++) {
    for (int j = 0; j <= i; j++) {
      c[i+1][j] += c[i][j];
      c[i+1][j+1] += c[i][j];
    }
  }
}
mint comb(int n, int k) {
  return c[n][k];
}
 
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
 
    return true;
}
 
map<ll, ll> primeFact(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1) res[n]++;
  return res;
}
 
void printv(vi& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
void printv(vll& v){
  rep(i,v.size()) cout << v[i] << " ";
  cout << endl;
}
int vtotal(vi& v){
  int total=0;
  rep(i,v.size()) total+=v[i];
  return total;
}
 
int main()
{
  //init(); // mint初期化
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  int a,b;
  cin>>a>>b;
  int ans=2*b-a;
  cout(ans);
  return 0;
}

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

main(){
  int N;
  cin >> N;
  int L[N];
  for(int ii=0;ii<N;ii++){
    cin >> L[ii];
  }
  sort(L,L+N);
  int cnt=0;
  for(int ii=0;ii<N-1;ii++){
    cnt+=L[ii];
  }
  if(cnt>L[N-1])cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
#define debug2d(var)  do{std::cout << #var << " : \n";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

using namespace std;
using ll = long long;

int h, w;
vector<vector<char> > grid(2000, vector<char>(2000));
vector<vector<int> > gridL(2000, vector<int>(2000));
vector<vector<int> > gridR(2000, vector<int>(2000));
vector<vector<int> > gridT(2000, vector<int>(2000));
vector<vector<int> > gridB(2000, vector<int>(2000));

int main() {
    cin >> h >> w;

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >> grid[i][j];
        }
    }

    for (int i = h-1; i >= 0; --i) {
        for (int j = w-1; j >= 0; --j) {
            if (grid[i][j] == '#') {
                gridR[i][j] = 0;
            } else if (j == w-1) {
                gridR[i][j] = 1;
            } else {
                gridR[i][j] = gridR[i][j+1] + 1;
            }

            if (grid[i][j] == '#') {
                gridB[i][j] = 0;
            } else if (i == h-1) {
                gridB[i][j] = 1;
            } else {
                gridB[i][j] = gridB[i+1][j] + 1;
            }
        }
    }

    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (grid[i][j] == '#') {
                gridL[i][j] = 0;
            } else if (j == 0) {
                gridL[i][j] = 1;
            } else {
                gridL[i][j] = gridL[i][j-1] + 1;
            }

             if (grid[i][j] == '#') {
                gridT[i][j] = 0;
            } else if (i == 0) {
                gridT[i][j] = 1;
            } else {
                gridT[i][j] = gridT[i-1][j] + 1;
            }
        }
    }

    int ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (grid[i][j] == '#') continue;
            ans = max(ans, gridL[i][j] + gridR[i][j] + gridT[i][j] + gridB[i][j] - 3);
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 67704
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
ans=1
if n==k or max(a)<0 or min(a)>=0:
    if max(a)<0 and k%2==0:
        a.sort()
    else:
        a.sort(reverse=True)
    for i in range(k):
        ans*=a[i]
        ans%=mod
    print(ans)
    exit()
pos,neg=[],[]
for num in a:
    if num<0:
        neg.append(-num)
    else:
        pos.append(num)
neg.sort(reverse=True)
pos.sort(reverse=True)
nn=len(neg)
np=len(pos)
cand=[]
i,j=0,0
while k>0:
    if i<np-1 and j<nn-1:
        if k>=2:
            if pos[i+1]*pos[i]<neg[j+1]*neg[j]:
                cand.append(-neg[j+1])
                cand.append(-neg[j])
                k-=2
                j+=2
            else:
                cand.append(pos[i])
                k-=1
                i+=1
        else:
            cand.append(pos[i])
            k-=1
            i+=1
    elif j>=nn-1:
        cand.append(pos[i])
        k-=1
        i+=1
    elif i==np-1:
        if k==1:
            cand.append(pos[i])
            i+=1
            k-=1
        else:
            cand.append(-neg[j+1])
            cand.append(-neg[j])
            j+=2
            k-=2
    elif i==np:
        cand.append(-neg[j+1])
        cand.append(-neg[j])
        j+=2
        k-=2
for num in cand:
    ans*=num
    ans%=mod
print(ans)
    

Measured memory_bytes: 33384
package main

import "fmt"

func min(a, b int) int {
	if a >= b {
		return b
	}
	return a
}

func main() {
	var K, A, B int
	fmt.Scan(&K, &A, &B)
	if B-A < 3 {
		fmt.Println(1 + K)
	} else { // B - A >= 3
		C := 1 // 手持ちのビスケットの数
		K -= min(K, A-C)
		if K >= 0 {
			C = A
		}
		if K >= 2 {
			d := K % 2
			C += (K / 2) * (B - A)
			if d > 0 {
				C++
			}
		} else {
			C++
		}
		fmt.Println(C)
	}
}


Measured memory_bytes: 512
#include <stdio.h>

typedef struct
{
	int x;
	int y;
} point;

int main(void)
{
	int N, ni, di;
	int i;
	int maxX = 0, minX = 0, maxY = 0, minY = 0;
	while(1)
	{
		scanf("%d", &N);
		if(N == 0) break;
		point P[N];
		P[0].x = 0; P[0].y = 0;
		for(i = 1; i < N; i++)
		{
			scanf("%d %d", &ni, &di);
			switch(di)
			{
				case 0:
					P[i].x = P[ni].x - 1;
					P[i].y = P[ni].y;
					break;
				case 1:
					P[i].x = P[ni].x;
					P[i].y = P[ni].y - 1;
					break;
				case 2:
					P[i].x = P[ni].x + 1;
					P[i].y = P[ni].y;
					break;
				case 3:
					P[i].x = P[ni].x;
					P[i].y = P[ni].y + 1;
					break;
			}
			if(P[i].x > maxX) maxX = P[i].x;
			if(P[i].x < minX) minX = P[i].x;
			if(P[i].y > maxY) maxY = P[i].y;
			if(P[i].y < minY) minY = P[i].y;
		}
		printf("%d %d\n", maxX - minX + 1, maxY - minY + 1);
		maxX = 0, minX = 0, maxY = 0, minY = 0;
	}

	return 0;
}



Measured memory_bytes: 2060
#include <iostream>

using namespace std;

int main() {

int n,memo,count,ans = 0,num;

cin >> n;

for(int i = 1; i <= n ; i++){
    memo = i;
    count = 0;
    while(i%2 == 0){
        count++;
        i = i / 2;
    }
    ans = max(ans,count);
    i = memo;
    if(ans == count) num = i;
}

cout << num << endl;

return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

//--global--//
//----------//


int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//
    
    int n;
    cin >> n;
    int v[MAX];
    int a[MAX];
    int b[MAX];
    int maxA = 0;
    int numA = 0;
    int maxB = 0;
    int numB = 0;
    int nexA = 0;
    int nexB = 0;
    priority_queue<pair<int, int> > q;
    fill(v, v+MAX, 0);
    fill(a, a+MAX, 0);
    fill(b, b+MAX, 0);
    rep(i, n){
        cin >> v[i];
        if(i%2==0){
            a[v[i]]++;
        }
        else{
            b[v[i]]++;
        }
    }

    rep2(i, 1, MAX){
        int num = i;
        int val = a[i];
        pair<int, int> f = make_pair(val, num);
        q.push(f);
    }

    maxA = q.top().first;
    numA = q.top().second;
    q.pop();
    nexA = q.top().first;
    while(!q.empty()){
        q.pop();
    }

    rep2(i, 1, MAX){
        int num = i;
        int val = b[i];
        pair<int, int> f = make_pair(val, num);
        q.push(f);
    }

    maxB = q.top().first;
    numB = q.top().second;
    q.pop();
    nexB = q.top().first;
    while(!q.empty()){
        q.pop();
    }


    int res = 0;
    if(numA == numB){
        res = min(n-nexA - maxB, n-nexB - maxA);
    }
    else{
        res = n-maxA - maxB;
    }

    cout << res << endl;


    
    return 0;
}


Measured memory_bytes: 2552
#include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORI(i,l) for(i=l.begin();i!=l.end();i++)
#include <list>
int main(){
	int n,a;
	list<int> l;
	list<int>::iterator itr;
	cin >> n;
	FOR(i,0,n){
		cin >> a;
		if(i%2 == n%2) l.push_back(a);
		else l.push_front(a);
	}
	FORI(itr,l) cout << *itr << " ";
	return 0;
}

Measured memory_bytes: 8448
/* ex 7_3
   KitamoriFumiya */

#include <stdio.h>
#include <stdlib.h>

int main(void){
	int i, j, row, column, *ptr_row, *ptr_column;
	char **ptr;
	scanf("%d %d\n", &row, &column);
	//各行の配列へのポインタ分のメモリ領域を確保
	ptr = (char**)calloc(row, sizeof(char*));
	if(ptr == NULL){
		fprintf(stderr, "calloc error.\n");
		exit(1);
	}
	
	//各行の要素分のメモリ領域を確保
	for(i = 0; i < row; i++){
		ptr[i] = (char*)calloc(column, sizeof(char));
		if(ptr[i] == NULL){
			fprintf(stderr, "calloc error.\n");
			exit(1);
		}
	}
	// 残る行を記録するためのメモリ領域を確保
	ptr_row = (int*)calloc(row, sizeof(int));
	if(ptr_row == NULL){
		fprintf(stderr, "calloc error.\n");
		exit(1);
	}
	// 残る行を記録するptr_rowを初期化
	for(i = 0; i < row; i++){
		ptr_row[i] = 0;
	}
	// 残る列を記録するためのメモリ領域を確保
	ptr_column = (int*)calloc(column, sizeof(int));
	if(ptr_column == NULL){
		fprintf(stderr, "calloc error.\n");
	exit(1);
	}
	// 残る列を記録するptr_columnを初期化
	for(i = 0; i < column; i++){
		ptr_column[i] = 0;
	}
	// 元のマス目を入力し、黒を含む行と列は残すので残る列、行を記録する配列に1を格納
	for(i = 0; i < row; i++){
		for(j = 0; j < column; j++){
			scanf(" %c", &ptr[i][j]);
			if(ptr[i][j] == '#'){
				ptr_row[i] = 1;
				ptr_column[j] = 1;
			}
		}
	}
	// 黒のマスを含む行列を出力
	for(i = 0; i < row; i++){
		if(ptr_row[i] == 1){
			for(j = 0; j < column; j++){
				if(ptr_column[j] == 1){
					printf("%c", ptr[i][j]);
				}
			}
			printf("\n");
		}
	}
	
	// 残る行を記録するためのメモリ領域を開放
	free(ptr_row);
	// 残る列を記録するためのメモリ領域を開放
	free(ptr_column);
	
	//メモリ領域の解放，各行の要素分の領域を開放し，
	//各行の配列へのポインタの領域を解放
	//（メモリ領域の確保と逆順）
	for(i = 0; i < row; i++){
		free(ptr[i]);
	}
	free(ptr);
	
	return 0;
}

Measured memory_bytes: 1644
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<climits>
#include<stack>
using namespace std;

int main(){
	int H, W;
	while(cin >> H >> W, H || W){
		char fld[500][500];
		int sum[501][501] = {};

		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cin >> fld[i][j];
				if(fld[i][j] == '.') sum[i][j] = max(1, sum[i][j] );
				else sum[i][j] = 0;
				sum[i+1][j] = sum[i][j]+1;
			}
		}

		int ans = 0;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				int mi = INT_MAX;
				for(int k = 0; j+k < W && fld[i][j+k] == '.'; k++){
					mi = min(mi, sum[i][j+k] );
					ans = max(ans, mi*(k+1) );
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 2376
from collections import defaultdict,Counter
d=defaultdict(int)
h,w,n=map(int,input().split())
for _ in range(n):
  p,q=map(int,input().split())
  for x in [q-2,q-1,q]:
    for y in [p-2,p-1,p]:
      if 1<=y<=h-2 and 1<=x<=w-2:
        d[(x,y)]+=1

cnt=Counter(d.values())
print((h-2)*(w-2)-sum(cnt.values()))
for i in range(1,10):
  print(cnt[i])

Measured memory_bytes: 147388
#include <iostream>
#include <string>
#include <vector>
int sum_digit(int n) {
	switch (n) {
	case 0: return 0;
	default: return n % 10 + sum_digit(n / 10);
	}
}
int main(){
	int n;
	std::cin >> n;
	auto sum = sum_digit(n);
	if (sum == 1) std::cout << 10 << std::endl;
	else std::cout << sum << std::endl;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    bitset<2000*2000+1> bits;
    bits[0] = 1;
    for(int a : A) bits |= bits<<a;
    int S = accumulate(A.begin(), A.end(), 0);
    for(int i=(S+1)/2; i<=S; i++) if(bits[i]){
        cout << i << endl;
        return 0;
    }
}

Measured memory_bytes: 1664
import sys
read = sys.stdin.read
def main():
    n, q = map(int, input().split())
    s = input()
    acs = [0] * (n + 1)
    cnt = 0
    for i1 in range(1, n):
        if s[i1-1] =='A' and s[i1] == 'C':
            cnt += 1
        acs[i1+1] = cnt
    for _ in range(q):
        l, r = map(int, input().split())
        r = acs[r] - acs[l]
        print(r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 11604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{



    public class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split(' ');

            Console.WriteLine(Calc.Kuku(int.Parse(ab[0]), int.Parse(ab[1])));
        }
    }
    public static class Calc
    {
        public static int Kuku(int a, int b)
        {
            if (a >= 10 || b >= 10)
            {
                return -1;
            }
            return a * b;
        }
    }
}


Measured memory_bytes: 11092
import java.util.*;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int a=sc.nextInt();
			int b=sc.nextInt();
			int c=sc.nextInt();
			int d=sc.nextInt();
			int e=sc.nextInt();
			int f=sc.nextInt();
			double x=((double)(c*e-b*f))/((double)(a*e-b*d));
			double y=((double)(c*d-a*f))/((double)(b*d-a*e));
			if(x==0){
				x=Math.abs(x);
			}
			if(y==0){
				y=Math.abs(y);
			}
			System.out.printf("%.3f %.3f\n", x,y);
		}
	}
}

Measured memory_bytes: 26464
N = int(input())
e = [0]*(N+1)
for i in range(2, N+1):
    cur = i
    for j in range(2, i+1):
        while cur % j == 0:
            e[j] += 1
            cur //= j
def num(m):
    return len(list(filter(lambda x: x >= m-1, e)))

print(num(75) + num(25)*(num(3)-1) + num(15)*(num(5)-1) + num(5)*(num(5)-1)*(num(3)-2)//2)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
ll gcd(ll a,ll b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
int modpow(ll a,ll n,int m){if(a==0)return a;ll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(int)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

priority_queue<int,vector<int>,greater<int> > qmax;
priority_queue<int,vector<int>,less<int> > qmin;
ll DP[300005][2];
int n, a[300005];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  n *= 3;
  FOR(i, 0, n) cin >> a[i];
  ll s = 0;
  FOR(i, 0, n){
    s += a[i];
    qmax.push(a[i]);
    if(sz(qmax) > n/3){
      s -= qmax.top();
      qmax.pop();
    }
    DP[i][0] = s;
  }
  s = 0;
  FORR(i, n-1, 0){
    s += a[i];
    qmin.push(a[i]);
    if(sz(qmin) > n/3){
      s -= qmin.top();
      qmin.pop();
    }
    DP[i][1] = s;
  }
  ll ans = -linf;
  FOR(i, n/3, n*2/3+1){
    maxs(ans, DP[i-1][0] - DP[i][1]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7288
MOD = 10**9+7
f = [1]
for i in range(10**5+5):
    f.append(f[-1]*(i+1)%MOD)
def nCr(n, r, mod=MOD):
    return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % MOD

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()

ans = 0
for i in range(N-K+1):
    ans += (A[-1-i] - A[i]) * nCr(N-1-i, K-1)
    ans %= MOD
print(ans)


Measured memory_bytes: 18544
#include"bits/stdc++.h"
using namespace std;
#define     uniq(x)         sort(x.begin(),x.end());x.erase(unique(x.begin(),x.end()),x.end())
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)

using ll = long long int;


int main()
{

    //cout<<6%2;

    fast;
    ll n,k;
    cin>>n>>k;

    if(n==k)
        cout<<0<<endl;
    else
    {
        if(n>k)
            cout<<min(n%k,abs((n%k)-k))<<endl;
        else
        {
            cout<<min(n,(k-n))<<endl;
        }

    }



}


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

string singleOperation(string s, int n)
{
  string res = s;
  for (int i = n - 1; i >= 0; i--)
    s += s[i];
  for (int i = 1; i <= n; i++)
    res = min(res, s.substr(i, n));
  return res;
}

string findCandidate(string s, int n)
{
  for (int i = n - 1; i >= 0; i--)
    s += s[i];

  string candidate = "{";
  for (int i = 1; i <= n; i++)
  {
    string u = s.substr(i, n);
    reverse(u.begin(), u.end());
    candidate = min(candidate, u);
  }

  reverse(candidate.begin(), candidate.end());
  return candidate;
}

int main()
{
  int n, k;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < min(15, k - 1); i++)
    s = findCandidate(s, n);
  cout << singleOperation(s, n) << endl;
}


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

using namespace std;

const char en = '\n';
using  ll =          long long;
using ull = unsigned long long;
#define REP(i  ,n) for(int i=0;i<n;i++)
#define FOR(i,s,g) for(int i=s;i<g;i++)
const ll INFL = 810810191911451400;
const int INF =       1919114514;

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

	int l,a,b,c,d;
	cin>>l>>a>>b>>c>>d;

	cout<<l-max((a+(c-1))/c,(b+(d-1))/d)<<en;
	return 0;
}

Measured memory_bytes: 3152
n,m = map(int,input().split())
ab_lst = [list(map(int,input().split())) for i in range(n)]
ab_lst.sort()
total_money = 0
total_number = 0

for i in range(n):
    money = ab_lst[i][0]
    number = ab_lst[i][1]
    number = min(number, m-total_number)

    total_money += number * money
    total_number += number

    if total_number==m:
        break

print(total_money)

Measured memory_bytes: 27876
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62);

typedef long long i64;
typedef pair<i64,i64> P;


i64 a,b;

int main(){
	cin >> a >> b;
	
	if(abs(a-b) < 2) cout << "Brown" << endl;
	else cout << "Alice" << endl;
	
	return 0;
}

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

int main()
{
    int a, b, c, ans;
    cin >> a >> b >> c;
    if(b/a > c) cout << c << "\n";
    else cout << b/a << "\n";
}


Measured memory_bytes: 384
/*
[m-solutions2019] E - Product of Arithmetic Progression
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MOD = 1000003;

class gf {
public:
    int n;
    static int extgcd(int a, int b, int& x, int& y) {
        int d = a;
        if (b != 0) {
            d = extgcd(b, a % b, y, x);
            y -= (a / b) * x;
        } else {
            x = 1;
            y = 0;
        }
        return d;
    }
    static int mod_inv(int a, int m) {
        int x, y;
        extgcd(a, m, x, y);
        return (m + x) % m;
    }
    gf() : n(0) {}
    gf(int n) : n(n % MOD) {}
    gf operator+(gf x) { return gf((n + x.n) % MOD); }
    gf operator-(gf x) { return gf((n - x.n + MOD) % MOD); }
    gf operator*(gf x) { return gf((1LL * n * x.n) % MOD); }
    gf operator/(gf x) { return *this * x.inv(); }
    gf inv() { return gf(mod_inv(n, MOD)); }
    gf pow(int n) {
        gf a = *this;
        gf x = 1;
        for (; n > 0; n >>= 1) {
            if (n & 1) {
                x = x * a;
            }
            a = a * a;
        }
        return x;
    }
};

int Q;
gf fact[MOD];

void prepare() {
    fact[0] = 1;
    for (int i = 1; i < MOD; i++) {
        fact[i] = fact[i - 1] * i;
    }
}

ll solve(gf x, gf d, int n) {
    if (d.n == 0) {
        return x.pow(n).n;
    }
    gf xdd = x / d;
    if (xdd.n + n - 1 >= MOD) {
        return 0;
    }
    gf ans = fact[xdd.n + n - 1] / fact[xdd.n - 1] * d.pow(n);
    return ans.n;
}

int main() {
    cin >> Q;

    prepare();
    for (int i = 0; i < Q; i++) {
        int x, d, n;
        cin >> x >> d >> n;
        cout << solve(x, d, n) << endl;
    }

    return 0;
}


Measured memory_bytes: 4736
import heapq
k = int(input())
a = [49] * 50
for i in range(50):
    a[i] += k//50
k%=50


for i in range(k):
    for j in range(50):
        if i==j: a[j]+=k
        else: a[j]-=1

print(len(a))
print(' '.join(list(map(str, a))))

Measured memory_bytes: 9220
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
const int INF = (1<<29);

class Point{
public:
  double x,y;

  Point(double x = 0,double y = 0):x(x),y(y){}

  bool operator < (const Point a)const{
    if(x != a.x) return x < a.x;
    return y < a.y;
  }
};

bool compare(Point a,Point b){
  return a.y < b.y;
}

double solve(Point *a,int n){
  if(n <= 1) return INF;
  int m = n / 2;
  double xx = a[m].x;
  double d = min(solve(a,m),solve(a+m,n-m));
  inplace_merge(a,a+m,a+n,compare);

  vector<Point> v;
  for(int i = 0 ; i < n ; i++){
    if(fabs(a[i].x - xx >= d)) continue;
    int len = (int)v.size();
    for(int j = 0 ; j < len ; j++){
      double dx = a[i].x - v[len-j-1].x;
      double dy = a[i].y - v[len-j-1].y;

      if(dy*dy >= d) break;
      d = min(d,dx * dx + dy * dy);
    }
    v.push_back(a[i]);
  }

  return d;
}

int main(){
  int n;

  cin >> n;
  Point p[n];

  for(int i = 0 ; i < n ; i++){
    cin >> p[i].x >> p[i].y;
  }
  sort(p,p+n);

  cout << solve(p,n) << endl;

  return 0;
}

Measured memory_bytes: 22908
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    int a, b;
    cin >> a >> b;
    if ((a + b) % 2) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << (a + b) / 2 << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define MAX_N 51
using namespace std;


int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    cin>>n;
    vector<int> L(n,0);
    for(int i = 0; i<n; i++){
        int t;
        cin>>t;
        L[i] = t;
    }
    ll ans = 0;
    sort(L.begin(),L.end());
    int s = L.size();
    for(int a = s-1;a >= 0;a--){
        for(int b = a-1;b >=0;b--){
            int sum = L[a] + L[b];
            auto itr = lower_bound(L.begin(), L.end(), sum);
            int ng = distance(itr, L.end());
            int cs = s-a-1;
            ans += (cs-ng);
        }
    }
    cout<< ans <<endl;
    return 0;
}


Measured memory_bytes: 256
def zero_count(binary):
    count = 0
    def pop(binary):
        if binary[-1] == '0':
            nonlocal count
            count += 1
            pop(binary[:-1])
        else:
            return
    pop(binary)
    return count


n = int(input())
print(min(map(lambda x: zero_count(bin(int(x))), input().split())))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
  int H,W,D; cin >> H >> W >> D;
  vector<vector<int>> A(H, vector<int>(W));
  vector<vector<int>> num(H*W, vector<int>(2)); // 盤面の数字の場所 0がy,1がx
  rep(i,H) {
    rep(j,W) {
      cin >> A[i][j];
      num[A[i][j]-1][0] = i;
      num[A[i][j]-1][1] = j;
    }
  }
  
  vector<int> sum(H*W);
  rep(i,H*W) {
    if (i < D) sum[i] = 0;
    else {
      sum[i] = sum[i-D] + abs(num[i][0] - num[i-D][0]) + abs(num[i][1] - num[i-D][1]);
    }
  }

  int Q; cin >> Q;
  rep(i,Q) {
    int L,R; cin >> L >> R;
    L--; R--;
    cout << sum[R] - sum[L] << endl;
  }
}

Measured memory_bytes: 6784
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct Dinic {
	using Flow = int;
	struct Edge {
		int to, rev;
		Flow cap;
		Edge() {}
		Edge(int to, int rev, Flow cap) :to(to), rev(rev), cap(cap) {}
	};
	int n;
	vector<vector<Edge>> g;
	vector<bool> used;
	vector<int> level;
	vector<int> iter;
	Dinic(int n) :n(n), g(n, vector<Edge>()), used(n), level(n), iter(n) {};
	void addEdge(int from, int to, Flow cap) {
		g[from].emplace_back(to, (int)g[to].size(), cap);
		g[to].emplace_back(from, (int)g[from].size() - 1, 0);
	}
	Flow maxFlow(int s, int t) {
		Flow total = 0;
		while (true) {
			bfs(s);
			if (level[t] < 0)return total;
			fill(iter.begin(), iter.end(), 0);
			Flow f;
			while (true) {
				f = augment(s, t, INF);
				if (f == 0)break;
				total += f;
			}
		}
	}
	Flow augment(int v, int t, Flow f) {
		if (v == t)return f;
		for (int &i = iter[v]; i < g[v].size(); i++) {
			Edge &e = g[v][i];
			if (e.cap > 0 && level[v] < level[e.to]) {
				Flow d = augment(e.to, t, min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					g[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	void bfs(int s) {
		fill(level.begin(), level.end(), -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (que.size()) {
			int v = que.front(); que.pop();
			for (int i = 0; i < g[v].size(); i++) {
				Edge &e = g[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int V, E; cin >> V >> E;
	Dinic dinic(V);
	rep(i, 0, E) {
		int u, v, c; cin >> u >> v >> c;
		dinic.addEdge(u, v, c);
	}
	cout << dinic.maxFlow(0, V - 1) << endl;
	return 0;
}

Measured memory_bytes: 3252
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%(m))
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

ll N, A, B;

int main() {
  cin >> N >> A >> B;

  ll AB = A + B;

  if (AB == 0) {
    cout << 0 << endl;
    return 0;
  }

  cout << N / AB * A + min(N%AB, A) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>
#include <climits>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;
constexpr auto mod = 1000000007;
constexpr auto INF = ULLONG_MAX;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }
template <typename T> inline T max_value(vector<T>& x) { return *max_element(x.begin(), x.end()); }
template <typename T> inline T min_value(vector<T>& x) { return *min_element(x.begin(), x.end()); }
template <typename T> inline T sum_value(vector<T>& x) { return accumulate(x.begin(), x.end(), 0); }

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

  ull black = 0;
  ull white = 0;
  ull zerostart = 0;
  ull onestart = 0;
  each(i, s.size()) {
    if (i % 2 == 0) {
      if (s[i] == '0') {
        onestart++;
      } else if (s[i] == '1') {
        zerostart++;
      }
    } else {
      if (s[i] == '0') {
        zerostart++;
      } else if (s[i] == '1') {
        onestart++;
      }
    }
  }

  cout << min({zerostart, onestart}) << endl;


  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  int l = 0, r = N;
  for (int i = 0; i < M; i++) {
    int L, R;
    cin >> L >> R;
    if (l < L) {
      l = L;
    }
    if (R < r) {
      r = R;
    }
  }
  if (r < l) {
    cout << 0 << endl;
  } else {
    cout << r - l + 1 << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){

  double x1,y1,x2,y2;

  double distance;

  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

  distance=sqrt(pow((x2-x1),2)+pow((y2-y1),2));

  printf("%f",distance);

  return 0;

}

Measured memory_bytes: 652
#include<stdio.h>
#include<string.h>
int main(void)
{
	char change[101],hikaku[101],take[101];
	int N;
	int i,j,k;
	scanf("%s",change);
	scanf("%s",hikaku);
	N=strlen(change);
	for(i=0;i<N;i++)
	{
		for(j=i,k=0;j<N;j++,k++)take[k]=change[j];
		for(j=0;j<i;j++,k++)take[k]=change[j];
		take[k]='\0';
		if(strcmp(take,hikaku)==0){puts("Yes");return 0;}
	}
	puts("No");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
const int INF = 1001001001;

int main()
{
    int a,b; cin >> a >> b;
    cout << a*b << endl;   

}

/*
Ctrl+@
g++ a.cpp
./a.out
*/

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

int main()
{
  int A[3][3];
  bool c[3][3];
  rep(i,3){
    rep(j,3){
      cin >> A[i][j];
      c[i][j] = 0;
    }
  }
  int N;
  cin >> N;
  int b[N];
  rep(i, N) cin >> b[i];
  rep(k, N){
    rep(i,3){
      rep(j,3){
        if(b[k] == A[i][j]){
          c[i][j] = 1;
        }
      }
    }
  }
  
  /*rep(i,3){
    rep(j,3) cout << A[i][j] << " " << c[i][j] << endl;
  }*/
  
  bool f = 0;
  rep(i,3){
    if(c[i][0] == 1 && c[i][1] == 1 && c[i][2] == 1) f = 1;
  }
  rep(i,3){
    if(c[0][i] == 1 && c[1][i] == 1 && c[2][i] == 1) f = 1;
  }
  if(c[0][0] == 1 && c[1][1] == 1 && c[2][2] == 1) f = 1;
  if(c[0][2] == 1 && c[1][1] == 1 && c[0][2] == 1) f = 1;
  
  if(f==1) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().split())
A=['']*H
for i in range(H):
    A[i]=input()
#print(A)
gyou=[False]*H
retu=[False]*W
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            gyou[i]=True
            retu[j]=True
for i in range(H):
    if gyou[i]:
        for j in range(W):
            if retu[j]:
                print(A[i][j],end='')
        print()

Measured memory_bytes: 4468
#include<stdio.h>

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

Measured memory_bytes: 580
#include <iostream>
using namespace std;
#define ll long long
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, c, d;
	cin >> a >> b >> c >> d;
	if ((abs(b-a)<=d) && (abs(c-b)<=d)) cout << "Yes" << endl;
	else if (abs(c-a)<=d) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll x1,y1,x2,y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2;

    x3 = (y1-y2) + x2;
    y3 = (x2-x1) + y2;
    x4 = (y1-y2) + x1;
    y4 = (x2-x1) + y1;

    cout << x3 << " " << y3 << " " << x4 << " " <<  y4 << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

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

    string s;
    cin>>s;
    ll ans=0;
    rep(i,s.length()){
        if(s[i]=='+'){
            ans++;
        }else{
            ans--;
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)

cnt=0
n.times do |i|
  if a[i] >= b[i]
    cnt += b[i]
    next
  else
    cnt += a[i]
    b[i] -= a[i]
  end
  if a[i+1] >= b[i]
    cnt += b[i]
    a[i+1] -= b[i]
  else
    cnt += a[i+1]
    a[i+1] = 0 
  end
end

p cnt

Measured memory_bytes: 15396
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;
int a[101];

bool solve() {
    int sum = 0;
    for (int i = 0; i < n; i++)
        sum += a[i];

    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] * 4 * m >= sum)
            cnt++;
    }
    return cnt >= m;
}

void input() {
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
}

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

    input();
    cout << (solve()?"Yes":"No") << endl;
}


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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;


int main() {
    long double n, m, d;
    cin >> n >> m >> d;
    cout << fixed << setprecision(10);
    if (d == 0) {
        cout << (1 / n) * (m - 1) << endl;
    } else {
        cout << (((n - d) * 2) / (n * n)) * (m - 1) << endl;
    }
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    a, p = rli()
    print((a*3+p)//2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
<?php
  $dice_1 = explode(" ", trim(fgets(STDIN)));
  $dice_2 = explode(" ", trim(fgets(STDIN)));
  $upper_1  = $dice_1[0];
  $upper_2 = $dice_2[0];
  $side_1   = array($dice_1[2], $dice_1[1], $dice_1[3], $dice_1[4]);
  $side_2   = array($dice_2[2], $dice_2[1], $dice_2[3], $dice_2[4]);
  $bottom = $dice_1[5];
  $n = 0;
  while (true) {
    for($i=0;$i<4;$i++) {
      if (($upper_1 == $upper_2) && ($side_1[1] == $side_2[1]) && ($side_1[2] == $side_2[2]) && ($side_1[3] == $side_2[3]) && ($side_1[0] == $side_2[0])) {
        print "Yes\n";
        return;
      } else {
        $z = array_shift($side_1);
        array_push($side_1, $z);
      }
    }
    if ($n < 3) {
      $b = $bottom;
      $u = $upper_1;
      $upper_1 = $side_1[2];
      $bottom = $side_1[0];
      $side_1[2] = $b;
      $side_1[0] = $u;
    } else if ($n < 10 && $n > 2) {
      $b = $bottom;
      $u = $upper_1;
      $upper_1 = $side_1[1];
      $bottom = $side_1[3];
      $side_1[1] = $b;
      $side_1[3] = $u;
    } else if ($n > 10) {
      break;
    }
    $n++;
  }
  print "No";
?>

Measured memory_bytes: 6608
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>


int n, m;
std::pair<int, int> robot[110000];
int range[210000][4];

int main()
{
	using std::cin;
	std::cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		cin >> robot[i].first >> robot[i].second; --robot[i].second;
	}
	//for (int rrr = 0; rrr < m; ++rrr)
	//{
	//	auto& r = robot[rrr];
	//	std::cout << r.second << ";"  << std::endl;
	//}
	std::sort(robot, robot + m);

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

	for (int rrr = 0; rrr < m; ++rrr)
	{
		auto& r = robot[rrr];
		range[r.second][0] = range[r.second + 1][0] = std::min(range[r.second][0], range[r.second + 1][0]);
		range[r.second][1] = range[r.second + 1][1] = std::max(range[r.second][1], range[r.second + 1][1]);

		//std::cout << r.second << ";" << range[r.second][0] << " " << range[r.second][1] << std::endl;
	}

	std::cout << (range[0][1] - range[0][0] + 1);
	for (int i = 1; i < n; i++) {
		std::cout << " " << (range[i][1] - range[i][0] + 1);
	}
	std::cout << std::endl;
}


#endif



Measured memory_bytes: 7004
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();
  if(c>=a && b>=(c-a)){System.out.printf("YES\n");}
  else {System.out.printf("NO\n");}
  
  }
  }


Measured memory_bytes: 22740