akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
int bitsums[300000][60];
int main(){
  prep();
  int n;
  cin >> n;
  long long arr[n];
  for (int i=0; i<n; i++){
      cin >> arr[i];
  }
  for (int i=0; i<n; i++){
      bitset<60> bs(arr[i]);
      for (int j=0; j<60; j++){
          bitsums[i][j] += bs[j];
      }
  }
  for (int i=1; i<n; i++){
      for (int j=0; j<60; j++){
          bitsums[i][j] += bitsums[i-1][j];
      }
  }
  long long res = 0;
  for (int i=0; i<n-1; i++){
      bitset<60> mine(arr[i]);
      long long mysum = 0;
      long long curpow = 1;
      for (int j=0; j<60; j++){
          int cnt = bitsums[n-1][j]-bitsums[i][j];
          if (mine[j]){
              res += ((n-i-1-cnt)*curpow)%mod;
          }else{
              res += (cnt*curpow)%mod;
          }
          curpow *= 2;
          curpow %= mod;
          res %= mod;
      }
  }
  cout << res;
  return 0; 
}


Measured memory_bytes: 72960
#include<iostream>
using namespace std;
#define ll long long

int main() {
  std::string S;
  cin >> S;
  bool retbool = true;
  ll i = 0;
  while (retbool && i < S.size()) {
    const char c = S[i];
    if (i%2==0 && c == 'L') retbool = false;
    else if (i%2 == 1 && c == 'R') retbool = false;
    i++;
  }
  if (retbool) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    string ans;
    int flag = 0;
    for (int i = 1; i < 10; ++i){
        if ( N % i == 0 && N / i < 10 && N / i > 0){
            flag = 1;
        }
    }
    
    if (flag == 1){
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
hs = [list(map(int, input().split())) for _ in range(n)]
hs.sort(key= lambda x: x[2], reverse = True)

def main():
    for x in range(101):
        for y in range(101):
            height = hs[0][2] + abs(x-hs[0][0]) + abs(y-hs[0][1])
            for i in range(1,n):
                if max(height-(abs(x-hs[i][0]) + abs(y-hs[i][1])),0)== hs[i][2]:
                    pass
                else:
                    break
                
                if i ==n-1:
                    print(x,y,height)
                    return x,y,height
main()

Measured memory_bytes: 9180
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int INF = 1 << 30;
const int MAX_PRIME = 1000010;
bool is_prime[MAX_PRIME + 10];
vector<int> primes;

void init_primes() {
    fill(is_prime, is_prime + MAX_PRIME + 10, true);
    is_prime[0] = is_prime[1] = false;
    for(int i=0; i<=MAX_PRIME; i++) {
        if(is_prime[i]) {
            primes.push_back(i);
            for(int k=i+i; k<=MAX_PRIME; k+=i) {
                is_prime[k] = false;
            }
        }
    }
}

int main() {
    init_primes();
    primes.push_back(INF);

    int N;
    while(scanf("%d", &N) != EOF) {
        printf("%zu\n", upper_bound(primes.begin(), primes.end(), N) - primes.begin());
    }
    return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  long long ans = 1LL * N * (N + 1) * (N + 2) / 6;
  for (int i = 0; i < N - 1; i++) {
    long long u, v;
    cin >> u >> v;
    if (u > v) swap(u, v);
    ans -= u * (N - v + 1);
  }
  cout << ans << endl;
  return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend()
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (b % 2 == 0) return (pow(a * a, b / 2, m) % m); else return (pow(a * a, b / 2) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};
const ll MAX_N = 1e5;
ll N, M;
Vi G_in[MAX_N] = {}; //iの親
Vi G_out[MAX_N] = {}; //iの子
ll parent[MAX_N];
ll dist[MAX_N] = {};
ll root = -1;
ll d(ll x){
   if (x == root) return 0;
   if (dist[x] > 0) return dist[x];
   else{
      ll ans = 0;
      for(auto &e: G_in[x]){
         chmax(ans, d(e) + 1);
      }
      dist[x] = ans;
      return ans;
   }
}
int main(){
   cin >> N >> M;
   REP(i, N + M - 1){
      ll A, B;
      cin >> A >> B;
      A--; B--;
      //edge A -> B
      G_out[A].pb(B);
      G_in[B].pb(A);
   }
   REP(i, N) parent[i] = -1;
   REP(i, N){
      if (G_in[i].empty()) root = i;
   }
   REP(i, N){
      for(auto &e: G_in[i]){
         if (d(i) == d(e) + 1) parent[i] = e;
      }
   }
   REP(i, N) cout << parent[i] + 1 << endl;
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
const ll mod = 1e9 + 7;
const int M = 2e6 + 5;
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll expo(ll base,ll pow){ll ans = 1;
   if(pow < 0) return 0;
   while(pow!=0){if(pow&1==1){ans = ans*base;ans = ans%mod;}
   base *= base;base%=mod;pow/=2;}return ans;}
ll inv(ll x){return expo(x,mod-2);}
ll mult_mod(ll a , ll b){a = a%mod; b = b%mod;ll c = (a * b)%mod;return c;}
ll add_mod(ll a , ll b){a = (a + mod)%mod;b = (b + mod)%mod;ll c = (a + b)%mod;return c;}
ll fac[(int)(2e6 + 7)] , inv_fac[(int)(2e6 + 7)];
void precomp_factorial(){fac[0] = 1;for(ll i = 1 ; i <= M ; i++) fac[i] = mult_mod(i , fac[i - 1]);
    inv_fac[M] = inv(fac[M]);for(ll i = M - 1 ; i >= 0 ; i--) inv_fac[i] = mult_mod(i + 1 , inv_fac[i + 1]);}
ll nCk(ll n , ll k){ll ans = fac[n];ans = mult_mod(ans , inv_fac[n - k]);ans = mult_mod(ans , inv_fac[k]);return ans;}
int dx[8] = {1 , 0 , -1 , 0 , 1 , -1 , -1 , 1};    // last 4 diagonal
int dy[8] = {0 , 1 , 0 , -1 , 1 , 1 , -1 , -1};

int xi[101], yi[101], hi[101];

int main(){
    int n;
    cin >> n;
    
    for(int i = 0; i < n; i++) cin >> xi[i] >> yi[i] >> hi[i];
    for(int Cx = 0; Cx <= 100; Cx++){
        for(int Cy = 0; Cy <= 100; Cy++){
            int H = -1;
            int cond = 1, cond1 = 0;
            for(int i = 0; i < n; i++){
                if(hi[i] == 0){
                    if(H == -1) H = abs(Cx-xi[i])+abs(Cy-yi[i]);
                    else{
                        if((H > abs(Cx-xi[i])+abs(Cy-yi[i])) && cond1){
                            cond = 0; break;
                        }
                        H = min(H,abs(Cx-xi[i])+abs(Cy-yi[i]));
                    }
                    continue;
                }
                
                if(H != hi[i]+abs(Cx-xi[i])+abs(Cy-yi[i])){
                    if(H == -1){
                        H =  hi[i]+abs(Cx-xi[i])+abs(Cy-yi[i]);
                        cond1 = 1;
                        continue;
                    }
                    if(cond1 == 0){
                       if(hi[i]+abs(Cx-xi[i])+abs(Cy-yi[i]) <= H){
                            H =  hi[i]+abs(Cx-xi[i])+abs(Cy-yi[i]);
                        cond1 = 1;
                        continue;
                       }
                    }
                    cond = 0; break;
                }
                cond1 = 1;
            }
            if(cond){
                cout << Cx << " " << Cy << " " << H << endl;
                
            }
        }
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

ll dp[(1<<18)];

ll n,m,a,b,c;
P cost[1010];

ll rec(ll s){
    queue<P>que;
    que.push(P(s,0));
    dp[0]=0;
    while(!que.empty()){
        P p=que.front();
        que.pop();
        ll now=p.first;
        ll d=p.second;
        for(ll i=0;i<m;i++){
            ll x=now|cost[i].first;
            ll c=cost[i].second;
            if(dp[x]>d+c){
                dp[x]=d+c;
                que.push(P(x,dp[x]));
            }
        }
    }
    return dp[(1<<n)-1];
}

int main(void){
    cin>>n>>m;
    for(ll i=0;i<m;i++){
        cin>>a>>b;
        ll num=0;
        for(ll j=0;j<b;j++){
            cin>>c;
            num+=1<<(c-1);
        }
        cost[i].first=num;
        cost[i].second=a;
    }
    fill(dp,dp+(1<<18),(ll)INF);
    ll ans=rec(0);
    if(ans==(INF))cout<<-1<<endl;
    else cout<<dp[(1<<n)-1]<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  int sm = a1+ a2 + a3;
  if(sm >= 22) {
    cout << "bust";
  }
  else cout << "win";
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
const int N=2e5+10;
int n,top;
int a[N],b[N],c[N],pre[N],suf[N],stk[N];
long double ans;
void init(){
	int mx=0,ps=-1;
	for(int i=1;i<=n;i++) if(a[i]>mx) mx=a[i],ps=i;
	rotate(a+1,a+ps,a+n+1);
	rotate(b+1,b+ps,b+n+1);
	a[++n]=a[1],b[n]=b[1];
	for(int i=3;i<=n;i++) c[i]=2*(b[i-1]+c[i-1])-c[i-2],a[i]-=c[i];
}
long double slope(int tp1,int tp2){ 
	return 1.0*(a[tp2]-a[tp1])/(tp2-tp1); 
}
bool pd(int tp1,int tp2,int tp3){ 
	return slope(tp1,tp2)<=slope(tp2,tp3); 
}
void solve(){
	for(int i=1;i<=n;i++){
		while(top>1 && pd(stk[top-1],stk[top],i)) --top;
		stk[++top]=i;
	}
	stk[top+1]=n+1;
	for(int i=1;i<=top;i++) for(int j=stk[i];j<stk[i+1];j++) pre[j]=stk[i];
	for(int i=1;i<=top;i++) for(int j=stk[i-1]+1;j<=stk[i];j++) suf[j]=stk[i];
	for(int i=1;i<n;i++){
		if(pre[i]!=suf[i]) ans+=1.0*(a[suf[i]]*(i-pre[i])+a[pre[i]]*(suf[i]-i))/(suf[i]-pre[i]);
		else ans+=1.0*a[i];
	}
	for(int i=1;i<n;i++) ans+=c[i];
}
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
	init();
	solve();
	printf("%.12Lf",1.0*ans/(n-1));
} //11123

Measured memory_bytes: 13120
using System;
using static System.Console;

class Program
{
    public static void Main(string[] args)
    {
        string input = ReadLine();
        WriteLine(CountChar(input, '1'));

    }
    public static int CountChar(string s, char c)
    {
        return s.Length - s.Replace(c.ToString(), "").Length;
    }
}

Measured memory_bytes: 13140
from itertools import permutations

INF = float('inf')
n, m, R = list(map(int, input().split()))
r = list(map(int, input().split()))
dist = [[INF]*(n+1) for _ in range(n+1)]
for i in range(1, n+1):
    dist[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    dist[a][b] = c
    dist[b][a] = c

from scipy.sparse import csgraph
dist = csgraph.floyd_warshall(dist)
# for k in range(n):
#     for i in range(n):
#         for j in range(n):
#             dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j])
# for d in dist: print(d)

ans = INF
for p in permutations(r):
    ans_ = 0
    for i in range(R-1):
        ans_ += dist[p[i]][p[i+1]]
    ans = min(ans, ans_)
print(int(ans))


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


int main() {
    int a, b, c, d;
    string text;

    cin >> a >> b >> c >> d;

    if (a + b > c + d) {
        text = "Left";
    } else if (a + b == c + d) {
        text = "Balanced";
    } else {
        text = "Right";
    }

    cout << text << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
int main() {
	string N;
	int count = 0;
	char key = '1';
	
	cin >> N;
	int coutkey = std::count(N.cbegin(), N.cend(), '1');
	int notkey = N.size() - coutkey;

	for (int i = 0; i < N.size()-1; i++) {
		char target = N[i];
		char target_post = N[i + 1];
		if (target ==  target_post) {
			count += 1;
			if (N[i + 1] == '1')
			{
				N[i + 1] = '0';
			}
			else if (N[i + 1] == '0')
			{
				N[i + 1] = '1';
			}
		}


	}

	cout << count << endl;

	return 0;

}

Measured memory_bytes: 512
package main

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

var sc = bufio.NewScanner(os.Stdin)
func scanInt() int {
	sc.Scan()
	a,_ := strconv.Atoi(sc.Text())
	return a
}

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

func main() {
	sc.Split(bufio.ScanWords)
	
	n, k, q := scanInt(), scanInt(), scanInt()

	p := make([]int, n)

	for i := 0; i < q; i++ {
		a := scanInt() -1
		p[a]++
	}

	for i := 0; i < n; i++ {
		if k - q + p[i] > 0 {
			fmt.Println("Yes")
		} else {
			fmt.Println("No")
		}
	}

}


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

int main () {
  int N, a, b;
  cin >> N;
  
  a = N/10;
  b = N-a*10;
  if (a==9||b==9) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N, K = map(int, input().split())
if 2*N < K:
	print(0)
else:
	kot = (N//K)**3
	if K%2: # odd
		print(kot)
	elif N%K < K//2: # even
		print((N//K)**3 + kot)
	else:
		print((N//K + 1)**3 + kot)

Measured memory_bytes: 3060
#include<stdio.h>

int main(){

  int t_score[100],h_score[100],t_sum=0,h_sum=0,i,j,k,n,m,temp,flag;
  int h_output, t_output;

  while(1){
    scanf("%d %d",&n,&m);
    t_output = 100;
    h_output = 100;
    flag = 0;
    if( n == 0 && m==0) break;

    for(i=0;i<n;i++){
      scanf("%d",&t_score[i]);
    }
    for(i=0;i<m;i++){
      scanf("%d",&h_score[i]);
    }

    for(i=0;i<n;i++){
      for(j=0;j<m;j++){
	t_sum = 0;
	h_sum = 0;

	temp = t_score[i];
	t_score[i] = h_score[j];
	h_score[j] = temp;

	for(k=0;k<n;k++){
	  t_sum += t_score[k];
	}
	for(k=0;k<m;k++){
	  h_sum += h_score[k];
	}
	if( t_sum == h_sum ){
	  if( h_output + t_output > h_score[j] + t_score[i]){
	    t_output = h_score[j];
	    h_output = t_score[i];
	    flag = 1;
	  }
	}
	temp = h_score[j];
	h_score[j] = t_score[i];
	t_score[i] = temp;
      }
    }
    if( flag == 1){
      printf("%d %d\n",t_output,h_output);
    }
    else{
      printf("-1\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1040
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e9
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll N, M, Q;
ll A, B;
ll LR[502][502];
ll ans;
string S;
ll K;
int main() {
	cin >> N;
	if (N == 0) {
		cout << 0 << endl;
		return 0;
	}
	string ans = "";
	ll i = 1, mul = 1;
	while(N!=0){
		if (N % (i *2) != 0) {
			ans = '1' + ans;
			N -= i * mul;
		}
		else
			ans = '0' + ans;
		mul =- mul;
		i *= 2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
*/
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <string>
#include <cmath>
#include <numeric>

using namespace std;

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

    std::vector<std::pair<int, int>> xy(n);
    std::vector<std::pair<int, int>> pq;

    for (int i = 0; i < n; i++)
    {
        cin >> xy[i].first >> xy[i].second;
    }
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i != j)
            {
                int p = xy[i].first - xy[j].first;
                int q = xy[i].second - xy[j].second;
                pq.push_back(std::pair<int, int>(p, q));
            }
        }
    }

    int ans = n;
    for (int i = 0; i < pq.size(); i++)
    {
        int cnt = 0;
        for (int j = 0; j < pq.size(); j++)
        {
            if (pq[i] == pq[j])
                cnt++;
        }
        ans = min(ans, n - cnt);
    }

    //    sort(xy.begin(), xy.end());

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

Measured memory_bytes: 256
from math import sqrt
N, D = map(int, input().split(' '))
 
coordinate_list = list()
 
# 一行ずつ分解してリストに入れる
for i in range(N):
    coordinate = list(input().split())
    coordinate = list(map(int, coordinate))
    coordinate_list.append(coordinate)
 
def make_dis_list(D, coordinate_list):
    distance_list = list()
    for i, coordinate in enumerate(coordinate_list):
        for j in range(i+1, N):
            distance_list.append(measure_distance(coordinate, coordinate_list[j], D))
    return distance_list
 
def measure_distance(a, b, D):
    square_dist = 0
    for i in range(D):
        square_dist += (a[i] - b[i])**2
    return sqrt(square_dist)
 
def int_counter(nums):
    counter = 0
    for num in nums:
        if int(num) == num: counter += 1
    return counter
 
distance_list = make_dis_list(D, coordinate_list)
print(int_counter(distance_list))

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

int main(){
  string S;
  cin >> S;
  
  if(S=="Sunny")
    cout << "Cloudy" << endl;
  if(S=="Cloudy")
    cout << "Rainy" << endl;
  if(S=="Rainy")
    cout << "Sunny" << endl;
  
  
  
 
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

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() {
  string s;
  cin >> s;
  int ans = INF;
  rep (i, s.size() - 2) {
    int val = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
    ans = min(ans, abs(753 - val));
  }
  P(ans);

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>

using namespace std;
int main()
{
	long long n, a, min, max, sum;
	min = 1000000;
	max = -1000000;
	sum = 0;
	cin >> n;
	for (int i =0; i<n; i++) {
		cin >> a;
		sum += a;
		if (min > a) {
			min = a;
		}
		if (max < a) {
			max = a;
		}
	}
	cout << min << " " << max << " " << sum << endl;
}

Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <utility>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    vector<int> nums;
    for(int i = 0; i < 3; ++i){
    	int x; cin >> x;
    	nums.pb(x);
    }
    sort(nums.begin(), nums.end());
    cout << nums[0] + nums[1] << endl;
	return 0;
} 

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#define inf -2147483647
using namespace std;
struct info
{
    int l,r,d;
}s[400005];
int n,m;
int flag = 1;
int dis[100005],visited[100005];
int first[400005],nexti[400005];
void dfs(int t)
{
    if(!flag)return;
    int k = first[t];
    while(k != -1)
    {
        if(!flag)return;
        if(!visited[s[k].r])
        {
            dis[s[k].r] = dis[s[k].l] + s[k].d;
            visited[s[k].r] = 1;
            dfs(s[k].r);
        }
        else if(s[k].d != dis[s[k].r] - dis[s[k].l])
        {
            flag = 0;
            return;
        }
        k = nexti[k];
    }
}
int main()
{
    cin>>n>>m;
    memset(first,-1,sizeof(first));
    for(int i = 0;i < m;i ++)
    {
        cin>>s[i].l>>s[i].r>>s[i].d;
        nexti[i] = first[s[i].l];
        first[s[i].l] = i;
        s[i + m].r = s[i].l;
        s[i + m].l = s[i].r;
        s[i + m].d = -s[i].d;
        nexti[i + m] = first[s[i + m].l];
        first[s[i + m].l] = i + m;
    }
    for(int i = 1;i <= n;i ++)
    {
        if(!visited[i])
        {
            visited[i] = 1;
            memset(dis,0,sizeof(dis));
            dfs(i);
        }
    }
    if(flag)cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 9728
import sys
input = sys.stdin.readline
import math


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    ans = 0
    h = A[0]
    for a in A:
        if h > a:
            ans += h - a
        h = max(h, a)
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 32980
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
#include <atcoder/all>

using namespace std;
using namespace atcoder;
typedef long long ll;


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

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

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

int main(){fastio
    ll n,k;cin>>n>>k;
    ll a[n][n];rep(i,0,n-1)rep(j,0,n-1)cin>>a[i][j];
    mcf_graph<ll,ll>g(2*n+2);
    ll A=2*n,B=2*n+1;
    ll big=powl(10,10);
    rep(i,0,n-1){
        g.add_edge(A,i,k,0);
        g.add_edge(i+n,B,k,0);
    }
    g.add_edge(A,B,n*k,big);
    rep(i,0,n-1){
        rep(j,0,n-1){
            g.add_edge(i,j+n,1,big-a[i][j]);
        }
    }
    cout<<big*n*k-g.flow(A,B,n*k).se<<endl;
    vector<mcf_graph<ll,ll>::edge> v=g.edges();
    string s[n];
    rep(i,0,n-1)rep(j,0,n-1)s[i]+='.';
    for(auto e:v){
        if(e.from>=2*n)continue;
        if(e.to>=2*n)continue;
        if(e.flow!=1)continue;
        s[e.from][e.to-n]='X';
    }
    rep(i,0,n-1)cout<<s[i]<<endl;
    return 0;
}


Measured memory_bytes: 3972
#include<iostream>
#include<cstdlib>
#include<utility>
#include<tuple>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;

int main() {

	char c;

	cin >> c;

	c++;

	cout << c << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner cin = new Scanner(System.in).useDelimiter(",|\\s+");

		int a,b,t,n;

		n = cin.nextInt();
		int[] num = new int[n];
		for(int i=0; i<n; i++)
		{
			num[i] = i+1;
		}
		
		n = cin.nextInt();
		for(int i=0; i<n; i++)
		{
			a = cin.nextInt();
			b = cin.nextInt();
			
			t=num[a-1]; num[a-1]=num[b-1]; num[b-1]=t;
		}

		for(int i=0; i<num.length; i++)
		{
			System.out.println(num[i]);
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,d;
	cin>>n>>d;
	d=d*2+1;
	if(n%d==0)
	{
		cout<<n/d<<endl;
	}
	else
	{
		cout<<n/d+1<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.array, std.math, std.regex, std.range, std.ascii, std.numeric, std.random;
import std.typecons, std.functional, std.traits,std.concurrency;
import std.algorithm, std.container;
import core.bitop, core.time, core.memory;
import std.bitmanip;
import std.regex;

enum INF = long.max/3;
enum MOD = 10L^^9+7;

//辞書順順列はiota(1,N),nextPermituionを使う


void end(T)(T v)
if(isIntegral!T||isSomeString!T||isSomeChar!T)
{
    import core.stdc.stdlib;
    writeln(v);
    exit(0);
}

T[] scanArray(T = long)()
{
    static char[] scanBuf;
    readln(scanBuf);
    return scanBuf.split.to!(T[]);
}

dchar scanChar()
{
    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    return cast(dchar)c;
}

T scanElem(T = long)()
{
    import core.stdc.stdlib;
    static auto scanBuf = appender!(char[])([]);

    scanBuf.clear;

    int c = ' ';
    while (isWhite(c) && c != -1)
    {
        c = getchar;
    }
    while (!isWhite(c) && c != -1)
    {
        scanBuf ~= cast(char) c;
        c = getchar;
    }
    return scanBuf.data.to!T;
}

dchar[] scanString(){
    return scanElem!(dchar[]);
}


void main()
{
  readln.replace(",", " ").writeln;
}


Measured memory_bytes: 256
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int,int>;


    
    int main(){
       int a,b,h;cin>>a>>b>>h;
       int res = (a+b)*h/2;
       cout<<res;
    }
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n;
    string b[n];
    for(int i=0;i<n;i++)
    cin>>b[i];
    cin>>m;
    string a[m];
    for(int i=0;i<m;i++)
    cin>>a[i];

    int ans=0;
    for(int i=0;i<n;i++)
    {
        int tmp=0;
        for(int j=0;j<n;j++)
        {
            if(b[i]==b[j])
            tmp++;
        }
        for(int j=0;j<m;j++)
        {
            if(b[i]==a[j])
            tmp--;
        }
        if(ans<tmp)
        ans=tmp;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
neg = 0
for i in range(N):
  if A[i] < 0:
    neg += 1
    A[i] = -A[i]
tot = 0
for i in range(N):
  tot += A[i]
if neg % 2 == 0:
  print(tot)
else:
  print(tot - 2 * min(A))


Measured memory_bytes: 15020
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for (int i=a; i<b; ++i)

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x;
    cin >> x;
    cout << 1-x << "\n";
    return 0;
}

Measured memory_bytes: 3636
# ABC106 B - Shiritori 
n = int(input())

ans = 0
for i in range(1,n+1,2):
    t = 0
    for j in range(1,n+1):
        if i%j == 0:
             t += 1 
    if t == 8:
        ans += 1


print(ans)


Measured memory_bytes: 2940
import java.util.*;

public class Main {
    public static void main(String[] args) {
        solve(new Scanner(System.in));
//        solve(new Scanner(ex));
    }

    private static final String ex = "3 3 33";

    private static void solve(Scanner scanner) {
        String[] split = scanner.nextLine().split(" ");
        Set<String> set = new HashSet<>();
        set.add(split[0]);
        set.add(split[1]);
        set.add(split[2]);
        System.out.println(set.size());
    }
}



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

int main(){
  int isPrime[50001];
  fill(isPrime,isPrime+50001,1);
  isPrime[0] = isPrime[1] = 0;
  for(int i = 2 ; i*i < 50001 ; i++ ){
    if(isPrime[i])for(int j = i*2 ; j < 50001 ; j+=i )isPrime[j] = 0;
  }
  int n;
  while(cin >> n,n){
    int cnt = 0;
    for(int i = 0 ; i <= n/2 ; i++ ){
      if(isPrime[i] == 1 && isPrime[n-i] == 1)cnt++; 
    }
    cout << cnt << endl;
  }
  return 0;
}

Measured memory_bytes: 1352
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    map<ll, ll> m;
    rep(i,0,n) {
        int x;
        cin >> x;
        m[x]++;
    }
    int cnt=0;
    for (auto p:m) {
        if (p.second%2==1) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 6528
#include<time.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

template<typename ...Ts>
void show(Ts... ts){
  cout<<"#:";
  auto print=[](auto v){cout<<v<<" ";};
  initializer_list<int>{(void(print(ts)),0)...};
  cout<<endl;
}

int main(void){
    int n,y,m;
    string ans;
    cin>>n;
    y=n/100;
    m=n%100;
    //cout<<y<<' '<<m<<endl;
    if (1<=m and m<=12){
        if (1<=y && y<=12){
            ans="AMBIGUOUS";
        }else{
            ans="YYMM";
        }
    }else if(1<=y && y<=12){
        ans="MMYY";
    }else{
        ans="NA";
    }
    cout<<ans;
}






Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
 vector<int> h(10);
 rep(i,10) cin >> h[i];
 sort(h.rbegin(),h.rend());
 rep(i,3) cout << h[i] << endl;
 return 0;
}


Measured memory_bytes: 3092
#include<stdio.h>
int main(void)
{
    int n,r[30],i,j,w,m[30],l[30],a[11];
    char t[11],k;
    while(scanf("%d",&n),n!=0){
        for(i=0;i<n;i++){
            m[i]=0;
            l[i]=0;
            scanf(" %c",&t[i]);
            a[i]=i;
            for(j=0;j<n-1;j++){
                scanf("%d",&r[j]);
                if(r[j]==0){
                    m[i]++;
                }
                else if(r[j]==1){
                    l[i]++;
                }
            }
        }
        for(i=0;i<n-1;i++){
            for(j=i+1;j<n;j++){
                if(m[i]<m[j]){
                    w=m[i];
                    m[i]=m[j];
                    m[j]=w;
                    w=l[i];
                    l[i]=l[j];
                    l[j]=w;
                    k=t[i];
                    t[i]=t[j];
                    t[j]=k;
                    w=a[i];
                    a[i]=a[j];
                    a[j]=w;
                }
                else if(m[i]==m[j]){
                    if(l[i]>l[j]){
                        w=m[i];
                        m[i]=m[j];
                        m[j]=w;
                        w=l[i];
                        l[i]=l[j];
                        l[j]=w;
                        k=t[i];
                        t[i]=t[j];
                        t[j]=k;
                        w=a[i];
                        a[i]=a[j];
                        a[j]=w;
                    }
                    else if(l[i]==l[j]&&a[i]>a[j]){
                        w=m[i];
                        m[i]=m[j];
                        m[j]=w;
                        w=l[i];
                        l[i]=l[j];
                        l[j]=w;
                        k=t[i];
                        t[i]=t[j];
                        t[j]=k;
                        w=a[i];
                        a[i]=a[j];
                        a[j]=w;
                    }
                }
            }
        }
        for(i=0;i<n;i++){
            printf("%c\n",t[i]);
        }
    }
    return 0;
}

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

int di[] = {-1, 0, 0, 1};
int dj[] = { 0,-1, 1, 0};

int main(){
  int h,w;
  cin >> h >> w;
  
  vector<string> map(h);
  rep(i,h) cin >> map[i];
  
  queue<P> q;
  rep(i,h) rep(j,w) if(map[i][j] == '#') q.emplace(i,j);
  q.emplace(-1,-1);
  
  int ans = 0;
  while(1){
    int i = q.front().first;
    int j = q.front().second; q.pop();
    if(i == -1 && j == -1){
      if(q.empty()) break;
      ans++; q.emplace(-1,-1);
      continue;
    }
    rep(dir,4){
      int ni = i + di[dir];
      int nj = j + dj[dir];
      if(ni<0||nj<0||ni>=h||nj>=w) continue;
      if(map[ni][nj] == '#') continue;
      map[ni][nj] = '#';
      q.emplace(ni,nj);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9488
#include <iostream>
#include <string>
#define MAX_N 10
using namespace std;

int main(void){
	double r, w, c, g;
  int n;
	cin >> r >> w >> c >> g;
  while(0!=r+w+c+r){
    n=0;
    while(((r+n*g)/w)<c){
      n++;
    }
    cout << n <<endl;
  	cin >> r >> w >> c >> g;
  }
  return 0;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
#define gap ' '
#define L(i) ((i) - (&i))

const int MAXN = 1e9+1;
const int MAX = 1e6 + 1;
const int MOD = 1e9;
const int INF = 1e9 + 5; 

int main(){	
	int n,k,s; cin >> n >> k >> s;
	vector<int> a;
	for(int i = 0; i < k; ++i)
		a.push_back(s);
	while(a.size() < n){
		int t = s+10;
		t = t % MOD;
		a.push_back(t);
	}	
	for(int i = 0; i < n; ++i)
		cout << a[i] << gap;
	cout << "\n";
	return 0;
}

Measured memory_bytes: 3912
import sys
f = sys.stdin

while True:
    n = int(f.readline())
    if n == 0:
        break
    a = [int(f.readline()) for i in range(n)]
    sum_max = now = 0
    for ai in a:
        now = max(0, now + ai)
        sum_max = max(sum_max, now)
    print(sum_max if sum_max else max(a))

Measured memory_bytes: 6788
#include <cstdio>
using namespace std;
int main()
{
	long long a,b,p,i,te;
	while(~scanf("%lld %lld",&a,&b))
	{
		p=1;
		for(i=a;i<=b;++i)
		{
			if(i<0)
			te=-1;
			if(i==0)
			{
			p=0;
			break;
		}
		if(i>0)
		te=1;
		p=p*te;
	}
	if(p==1)
	printf("Positive\n");
		if(p==0)
	printf("Zero\n");
		if(p==-1)
	printf("Negative\n");
}
return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000000007
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define Nmax 500005
const long double PI = acos(-1);

int n, v[Nmax], sz, mx;
map<int,int> M;

bool solve(int x){
    // dbg(x,sz);
    if (x <= sz){
        if (mx == 0) return 0;
        while (!M.empty() && prev(M.end())->first > sz){
            M.erase(prev(M.end()));
        }
        sz = x;
        M[sz]++;
        int i = sz;
        while (M[i] > mx){
            // dbg(x,i,mx);
            if (i==1)
                return 0;
            M[i] = 0;
            M[i-1]++;
            i--;
        }
        return 1;
    }
    else{
        sz = x;
        return 1; 
    }
    return 0;
}

bool OK(int x){
    mx = x;
    M.clear(); sz = 0;
    for(int i=1;i<=n;i++){
        if (!solve(v[i])){
            return 0;
        }
    }
    return 1;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i=1;i<=n;i++){
        cin >> v[i];
    }

    int st = 0, p = 1;
    for (;p<=n;p<<=1);
    for (;p>=1;p>>=1){
        if (st + p <= n && !OK(st+p)){
            st += p;
        }
    }

    if (!OK(st)) st++;
    cout << st + 1 << '\n';


    return 0;
}

Measured memory_bytes: 1152
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include <cassert>
    #include <cmath>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;


    vector<bool> seen;
    void dfs(const Graph &G,int v){
        int cnt = 0;
        seen[v] = true;
        for(auto nv:G[v]){
            if(seen[nv])continue;
            cnt++;
            dfs(G,nv);
        }
    }

    int main(){
      int h,a;cin>>h>>a;
      int sum=0;
      rep(i,a){
          int v;
          cin>>v;
          sum += v;
      }
      cout<<(sum>=h ? "Yes":"No");
    }


Measured memory_bytes: 256
import java.util.*;
 
public class Main
{
    public static void main (String[] args)
    {
        Scanner scanner = new Scanner(System.in);
 
        int a = scanner.nextInt();
        int b = scanner.nextInt();
int c = scanner.nextInt();
 
        if(a < b && b < c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
    }
  }
}

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


int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll k;
    cin >> k;
    ll count=0;
    while(b<=a){
        count++;
        b*=2;
    }
    while(c<=b){
        count++;
        c*=2;
    }
    if(count<=k) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3592
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define forn(i,a,b) for(int i=a;i<=b;i++)
#define INF 2147483647
#define LLINF 9223372036854775807
using namespace std;
typedef long long ll;
string s;
ll dfs(ll now,ll ans,ll x){
	if(now==s.size())return ans*(x==0);
	return dfs(now+1,ans,x*10+s[now]-'0')+dfs(now+1,ans+x*10+s[now]-'0',0);
}
int main(){
	cin>>s;
	cout<<dfs(0,0,0)<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
  "sort"
)

func main() {
  var n int 
  fmt.Scan(&n)
  a := make([]int, n)
  for i := 0; i < n; i++ {
    fmt.Scan(&a[i])
  }
  sort.Ints(a)
  fmt.Println(a[n-1] - a[0])
}

Measured memory_bytes: 512
L, A, B, M = map(int, input().split())

ten = 0

def pow_(x, t):
  if t == 0:
    return 1
  if t % 2 == 1:
    return (pow_(x, t - 1) * x) % M
  else:
    y = pow_(x, t // 2)
    return (y * y) % M

def f(l):
  if l == 0:
    return 0
  if l % 2 == 1:
    pl = l - 1
    x = f(pl)
    return x * ten + 1
  else:
    pl = l // 2
    x = f(pl)
    return x * pow_(ten, pl) + x

def g(l):
  if l == 0:
    return 0
  if l % 2 == 1:
    pl = l - 1
    x = g(pl)
    return x * ten + B * pl
  else:
    pl = l // 2
    x = g(pl)
    return x * pow_(ten, pl) + x + B * pl * f(pl)

last = A + B * (L - 1)
ans = 0
ten = 10
for _ in range(18):
  l = ten // 10
  r = ten - 1
  
  if last < l:
    ten *= 10
    continue
  if A > r:
    ten *= 10
    continue
  na = 0 #初項
  nl = 0 #長さ

  if A >= l:
    na = A
  else:
    na = (l - A + B - 1) // B * B + A
    na = min(na, last)
  
  nlast = 0
  if last <= r:
    nlast = last
  else:
    nlast = (r - A) // B * B + A
  nl = (nlast - na) // B + 1

  ans *= pow_(ten, nl) % M
  ans += (na * f(nl)) % M
  ans += g(nl) % M
  ten *= 10

print(ans % M)

Measured memory_bytes: 126552
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a, Ts... ts) {return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }

template<typename T,typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v){ t = v; }

template<typename T,typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v){ for(auto &e : t) fill_v(e, v); }

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    REP(i, n) cin >> l[i];

    int ans = 1;
    int cur = 0;
    REP(i, n)
    {
        cur += l[i];
        if(cur <= x) ans++;
    }
    cout << ans << endl;
}   

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	long long a[n], b[m], c[m];
	long long tong=0;
	for(int i=0; i<n; i++)
	{
		cin >> a[i];
		tong+=a[i];
	}
	sort(a, a+n);
	for(int i=0; i<m; i++)
	{
		cin >> b[i] >> c[i];
		b[i]+=c[i]*1000000000;
	}
	sort(c, c+m);
	sort(b, b+m);
	reverse(c, c+m);
	reverse(b, b+m);
	int k=0;
	for(int i=0; i<m; i++)
	{
		b[i]-=c[i]*1000000000;
		while(b[i]>0)
		{
			if(a[k]<c[i] && k<=n) 
			{
				tong+=c[i]-a[k];
				a[k++]=c[i];
			}
			else 
			{
				cout << tong;
				return 0;
			}
			b[i]--;
		}
	}
	cout << tong;
}

Measured memory_bytes: 2688
# coding: utf-8

def main():
    q, h, s, d = map(int, input().split())
    n = int(input())
    a = min([4 * q, 2 * h, s])
    if 2 * a <= d:
        return n * a
    else:
        return (n//2) * d + (n % 2) * a


print(main())

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using ll = long long;
int main(){
  string s;
  cin >> s;

  ll sum = 0;
  for(int bit=0;bit<1<<(s.size()-1);bit++){
    int prev=0;
    for(int i=0;i<s.size();i++){
      if(bit>>i & 1 == 1){
        sum += stoll(s.substr(prev,i+1-prev));
        prev = i+1;
      }
    }
    sum += stoll(s.substr(prev,s.size()));
  }
  cout << sum << endl;
}


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

int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  
  string s;
  s.push_back(s1.at(0));
  s.push_back(s2.at(0));
  s.push_back(s3.at(0));
  
  transform(s.begin(), s.end(), s.begin(), ::toupper);
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 256