akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#include<queue>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
typedef pair<int,int> P;
int ceil(int a,int b){// a以上でbの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){//stoi関数の代用 文字列を数値として読み取りint型に変換//
    return atoi(s.c_str());
}
int dp[110];
int a[1010];
int main(){
	while(1){
	int n,m;
	cin>>n>>m;
	if(n==0 && m==0) return 0;
	int price[1000];
	int max=0;
	rep(i,n) cin>>price[i];
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int sum=price[i]+price[j];
			if(sum<=m && sum>max){
				max=sum;
			}
		}
	}
	if(max==0) cout<<"NONE"<<endl;
	else cout<<max<<endl;
	}
}	


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;

int main() {
	int a, b, c, d;
	int cntt=0, cntm = 0;
	cin >> a >> b >> c >> d;
	while (a > 0) {
		a = a - d;
		cntt++;
	}
	while (c > 0) {
		c = c - b;
		cntm++;
	}
	//cout << cntt << cntm;
	if (cntt >= cntm)
		cout << "Yes";
	else
		cout << "No";


}

Measured memory_bytes: 3520
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
    int S,h,m,s;
    cin >> S;
    cout << S/3600;
    cout << ":";
    cout << (S%3600)/60;
    cout << ":";
    cout << (S%3600)%60;
    cout << endl;
    
}



Measured memory_bytes: 3108
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <time.h>

#define loop(i, num)  for (int i = 0; i < num; i++)

using namespace std;

int main() {
    
    int n;
    
    vector<int> dat;
    
    cin >> n;
    
    dat.resize(n);
    
    loop (i, n) {
        
        cin >> dat[i];
        
    }
    
    sort(dat.begin(), dat.end());
    
    cout << unique(dat.begin(), dat.end()) - dat.begin() << endl;
    
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = [int(i) for i in input().split()]
g = {}
ans = 0
for i, a in enumerate(A):
    g[a] = N
    for j, b in enumerate(A):
        if a < b:
            g[a] -= 1
        if  i < j and a > b:
            ans += 1

ans = ans * K
S = (K * (K-1))//2
m = 10**9 + 7
for v in A:
    i = g[v]
    ans += S * (N - i) % m

print(ans % m)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
long long n,m,p,ans;
vector<pair<long long,long long> >v;
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		long long x,y;
		cin>>x>>y;
		v.push_back(make_pair(x,y));
	}
	sort(v.begin(),v.end());
	while(m>0)
	{
		ans+=min(m,v[p].second)*v[p].first;
		m-=v[p].second;
		p++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int q;
    cin>>q;
    priority_queue<int> q1;
    priority_queue<int,vector<int>,greater<int>> q2;
    int cnt=0;
    ll sum=0,k=0;
    for(int i=0;i<q;i++){
        int id;
        cin>>id;
        if(id==1){
            cnt++;
            int a,b,prev;
            cin>>a>>b;
            k+=b;
            if(q1.size()){
                prev=q1.top();
            }
            if(q2.size()&&q2.top()<a){
                int tmp=q2.top();
                q2.pop();
                q2.push(a);
                q1.push(tmp);
            }else{
                q1.push(a);
            }
            if(cnt%2==0){
                int tmp=q1.top();
                q1.pop();
                q2.push(tmp);
                sum+=abs(q1.top()-prev);
            }
            sum+=abs(a-q1.top());
        }else{
            cout<<q1.top()<<" "<<sum+k<<endl;
        }
    }
}


Measured memory_bytes: 3452
#include <bits/stdc++.h>
#define re return
#define ull unsigned long long
#define ll long long
#define ld long double
#define mid l+(r-l)/2
#define f first
#define s second
#define oo 1e9
#define pi acos(-1)
#define OO 1e18
#define EPS 1e-7
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define Hossam_Yehia ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int n;
string s,k;
int main(){
    Hossam_Yehia;
    cin >> n >> s >> k;
    for(int i=0;i<n;++i){
        string temp=s.substr(i,n-i);
        if(k.find(temp)!=-1)
            re cout<<2*i+temp.size(),0;
    }
    cout<<2*n<<endl;
    re 0;
}

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

using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef long int li;

int main()
{
    IOS;
    //freopen("fr.txt","r",stdin);
   string s;
   int n;
   cin>>n;
   cin>>s;
   int c=0;
   for(int i=0;i<n;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C')
        c++;
   }
   cout<<c<<endl;

    return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int GCD(int a,int b){
    if(b==0) return a;
    return GCD(b,a%b);
}
int main() {
    ll n,m;
    string s,t;
    cin>>n>>m>>s>>t;
    bool ans=true;
    ll gcd=GCD(n,m);
    ll nn=n/gcd,mm=m/gcd;
    rep(i,gcd){
        if(s[nn*i]!=t[mm*i]){
            ans=false;
            break;
        }
    }
    ll res=(n/gcd)*m;
    if(ans) cout<<res;
    else cout<<-1;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int cnt[64];

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	int n;
	cin >> n;
	vector<long long> a(n);
	long long ans = 0;
	for (int i = 0; i < n; ++i){
		cin >> a[i];	
		for (int j = 0; j < 60; ++j){
			if ((1ll << j) & a[i]) cnt[j]++;
		}
	}
	for (int i = 0; i < n; ++i){
		for (int j = 0; j < 60; ++j){
			if ((1ll << j) & a[i]) cnt[j]--;
		}
		for (int j = 0; j < 60; ++j){
			if ((1ll << j) & a[i]){
				ans = (ans + (1ll << j) % MOD * (n - i - cnt[j] - 1) % MOD) % MOD;
			}
			else{
				ans = (ans + (1ll << j) % MOD * cnt[j] % MOD) % MOD;
			}
		}
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 2560
#include <stdio.h>

int main ()
{
    int A, B;

    scanf("%d %d", &A, &B);

    if(A > 0 && A <= 8 && B > 0 &&B <= 8)
    {
        printf("Yay!\n");
    }
    else
    {
        printf(":(\n");
    }

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define int             long long
#define ld              long double
#define fi              first
#define se              second
#define pb              push_back
#define mp              make_pair
#define mt              make_tuple
#define sq(a)           (a)*(a)
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define rep(i,a,b)      for(i=a;i<=b;i++)
#define Fo(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(x)          x.begin(),x.end()
#define rall(x)         x.rbegin(),x.rend()
#define sortall(x)      sort(all(x))
#define sortrall(x)     sort(rall(x))
#define clr(x)          memset(x,0,sizeof(x))
#define tr(it, a)       for(auto it=a.begin();it!=a.end();it++)
#define pii             pair<int,int>
#define mk(arr,n,type)  type *arr=new type[n];
#define vi              vector<int>
#define si              set<int>
#define usi             unordered_set<int>
#define mii             map<int,int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int>>
#define setbits(x)      __builtin_popcountll(x)
#define trailzrobits(x) __builtin_ctzll(x)
#define leadzrobits(x)  __builtin_clzll(x)
#define paritybits(x)   __builtin_parityll(x)
#define gcd             __gcd
#define lcm(x, y)       (x * y)/gcd(x,y)
#define mod             1000000007
#define endl            '\n'
#define PI              3.1415926535897932384626
#define inf             1e18
#define sp(x,y)         fixed<<setprecision(y)<<x
void __print(int32_t x) {cout<<x;}
void __print(int x) {cout<<x;}
void __print(ld x) {cout<<x;}
void __print(double x) {cout<<x;}
void __print(float x) {cout<<x;}
void __print(bool x) {cout<<(x?"true":"false");}
void __print(char x) {cout <<'\''<<x<<'\'';}
void __print(const char *x) {cout <<'\"' <<x<<'\"';}
void __print(const string &x) {cout<<'\"'<<x<<'\"';}
template<typename T,typename V>     void __print(const pair<T,V> &x) {cout<<'{';__print(x.first);cout<<',';__print(x.second);cout<<'}';}
template<typename T>                void __print(const T &x) {int f=0;cout<<'{';for(auto &i:x)cout<<(f++?",":""),__print(i);cout<<"}";}void _print(){cout<<"]\n";}
template <typename T,typename... V> void _print(T t, V... v) {__print(t);if(sizeof...(v))cout<<", ";_print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_print(x)
#else 
#define dbg(x...)
#endif
int power(int base,int exp) {int res=1;base%=mod;while(exp>0){if(exp&1)res=(res*base)%mod;base=(base*base)%mod;exp=exp>>1;}return res;}
int inv(int x) {return power(x,mod-2)%mod;}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




const int N=1e6+6,M=N;
int i,j;

void solve() {
    
    int a,b,c,k; cin>>a>>b>>c>>k;

    while(b<=a and k!=0){
        b*=2;
        k--;
    }

    while(c<=b and k!=0){
        c*=2;
        k--;
    }

    if(c>b and b>a) cout<<"Yes";
    else cout<<"No";
    
    
}




int32_t main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
    return 0;
}

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

"""
input:
4
0 0
3 1
2 3
0 3
3
2 1
0 2
3 2

output:
2
1
0
"""

import sys

EPS = 1e-9


def generate_polygon(_e_info):
    for edge in _e_info:
        ex, ey = map(int, edge)
        init_polygon.append(ex + ey * 1j)

    return init_polygon


def cross(a, b):
    return a.real * b.imag - a.imag * b.real


def dot(a, b):
    return a.real * b.real + a.imag * b.imag


def check_contains(g, p):
    flag = False
    for j in range(edges):
        a, b = g[j] - p, g[(j + 1) % edges] - p
        if abs(cross(a, b)) < EPS and dot(a, b) < EPS:
            return 1
        elif a.imag > b.imag:
            a, b = b, a

        if a.imag < EPS < b.imag and cross(a, b) > EPS:
            flag = not flag
    return 2 if flag else 0


def solve(_p_info):
    for point in _p_info:
        px, py = map(int, point)
        p = px + py * 1j
        print(check_contains(polygon, p))
    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    edges = int(_input[0])
    e_info = map(lambda x: x.split(), _input[1:edges + 1])
    points = int(_input[edges + 1])
    p_info = map(lambda x: x.split(), _input[edges + 2:])

    init_polygon = list()
    polygon = generate_polygon(e_info)
    solve(p_info)

Measured memory_bytes: 7960
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
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; }
int main(int argc, char* argv[]) {
    int n,k;
    cin >> n >> k;
    vector<double> p(n);
    rep(i,n) cin >> p[i];
    vector<double> r(n+1);
    r[0]=0;
    double ans =0;
    for(int i =1; i<n+1; i++){
        r[i]=1/2.0*(p[i-1]+1);
    }
    for(int i =1; i<n+1; i++){
        r[i]+=r[i-1];
    }
    for(int i =1; i<n-k+2; i++){
        double e;
        e = r[i+k-1] - r[i-1];
        if(ans < e) ans = e;
    }

    cout << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define INF         1e9
#define EPS         1e-9
#define REP(i,n)    for(lint i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(lint i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(lint i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(lint i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define R_UP(a,b)   (((a)+(b)-1)/(b))
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP        cout << fixed << setprecision(8)
using namespace std;
using lint = long long;
template<typename T = lint>inline T in() { T x; cin >> x; return x; }

signed main()
{
	int tr1 = 0, tr2 = 0, tr3 = 0, tr4 = 0;
	for (;;)
	{
		int a = in(), b = in(), c = in();
		if (a >= b + c || b >= c + a || c >= a + b)
		{
			cout << tr1 << ' ' << tr2 << ' ' << tr3 << ' ' << tr4 << endl;
			return 0;
		}
		else
		{
			tr1++;
			if (a * a == b * b + c * c || b * b == c * c + a * a || c * c == a * a + b * b)tr2++;
			else if (a * a < b * b + c * c && b * b < c * c + a * a && c * c < a * a + b * b)tr3++;
			else tr4++;
		}
	}
}


Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Linq;

class Program{

  static int a, b, c;

  static int Main() {

    string[] nyu = new string[2];

    nyu = Console.ReadLine().Split(' ');
    a = int.Parse(nyu[0]);
    b = int.Parse(nyu[1]);

    if (a <= b) {
      c = a;
    } else {
      c = a - 1;
    }

    Console.WriteLine("{0}", c);

    return 0;
  }

}


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

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


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

  vector<lint> check(n,-1);
  lint cur=1, cnt=0;
  check[cur] = 1;

  for(cnt=1;;cnt++) {
    cur = a[cur-1];
    if(cur == 2) {
      cout << cnt << endl;
      return 0;
    }

    if(check[cur-1] == -1) { check[cur-1] = 1; }
    else { break; }
  }

  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
class SCC{//cmp(0 - kk-1) is scc's return. Same number is group. The number is no relatoin.
	public:
	int n;
	vvi G,rG;
	vector<bool>used;
	vi vs,cmp;
	vvp cost;
	void init(int size){
		n=size;
		G=rG=vvi(n);
		used=vector<bool>(n);
		cmp=vi(n);
		cost=vvp(n);
		vs=vi(0);
	}
	void add_edge(int s,int t,int c){
		cost[s].pb(pii(t,c));
		G[s].pb(t);
		rG[t].pb(s);
	}
	void rdfs(int v,int k){
		used[v]=true;
		cmp[v]=k;
		rep(i,rG[v].size())if(!used[rG[v][i]])rdfs(rG[v][i],k);
	}
	void dfs(int v){
		used[v]=true;
		rep(i,G[v].size())if(!used[G[v][i]])dfs(G[v][i]);
		vs.pb(v);
	}
	int scc(){
		rep(i,n)used[i]=false;
		rep(v,n)if(!used[v])dfs(v);
		rep(i,n)used[i]=false;
		int kk=0;
		for(int i=vs.size()-1;i>=0;i--)if(!used[vs[i]])rdfs(vs[i],kk++);
		return kk;  
	}
	void solve(){
		int N=scc();
		vi ma(N),co(N);
		rep(i,n)rep(j,cost[i].size()){
			int t=cost[i][j].first;
			if(cmp[t]==cmp[i]){
				ma[cmp[t]]=max(ma[cmp[t]],cost[i][j].second);
			}
		}
		rep(i,n)rep(j,cost[i].size()){
			int t=cost[i][j].first;
			if(cmp[t]==cmp[i]&&ma[cmp[t]]==cost[i][j].second){
				co[cmp[t]]++;
			}
		}
		int out=1;
		rep(i,N)(out*=co[i]/2)%=10007;
		cout<<out<<endl;
	}
};
int main(){
	int n;
	SCC scc;
	while(cin>>n,n){
		scc.init(n);
		rep(i,n){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			scc.add_edge(i,a,b);
			scc.add_edge(i,c,d);
		}
		scc.solve();
	}
}

Measured memory_bytes: 4744
import itertools
N = int(input())
P = list(map(int,(input().split())))
Q = list(map(int,(input().split())))
X = list(itertools.permutations(range(1,N+1)))
Y = 1 
for i in range(1,N+1):
    Y *= i
for i in range(Y):
    if list(X[i]) == P:
        p = i
    elif list(X[i]) == Q:
        q = i
if P == Q:
    ans = 0
else:
    ans = abs (p - q)
print(ans)  

Measured memory_bytes: 8052
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>

// Aliases
using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using ll = long long;
using ull = unsigned long long;

using std::cout;
using std::cerr;
using std::cin;
using std::endl;
using std::string;
using std::vector;
using std::array;
template <class T>
using matrix = vector<vector<T>>;
template <class T>
constexpr T inf = std::numeric_limits<T>::max();
template <class T>
constexpr T neg_inf = -std::numeric_limits<T>::max();
template <class T>
constexpr T pi = static_cast<T>(3.141592653589793);

template <class T = i64>
vector<T> read_vector(const u64 n)
{
    vector<T> vec;
    vec.reserve(n);
    for (u64 i = 0; i < n; i++)
    {
        T v;
        cin >> v;
        vec.emplace_back(v);
    }

    return vec;
}

template <class T>
void print(const vector<T>& vec, const bool new_line = false)
{
    const u64 n = vec.size(); 
    if (new_line)
    {
        for (u64 i = 0; i < n; i++)
        {
            cout << vec[i];
            if (i != n - 1) { cout << '\n'; }
        }
    }
    else
    {
        for (u64 i = 0; i < n; i++)
        {
            cout << vec[i];
            if (i != n - 1) { cout << ' '; }
        }
    }

    cout << endl;
}

int main()
{
    u32 n;
    cin >> n;
    bool flag = false;
    for (u32 i = 1; i <= 9; i++)
    {
        if (n % i == 0 && 1 <= n / i && n / i <= 9)
        {
            flag = true;
            break;
        }
    }

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

    return 0;
}


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

namespace Project
{
	class Lake
	{
		public int left;
		public int right;
		public double area = 0;
	}

	class MainClass
	{
		public static void Main(string[] args)
		{
			string s = Console.ReadLine();
			int[] h = new int[s.Length + 1];
			h[0] = 0;
			for (int i = 0; i < s.Length; i++)
			{
				switch (s[i])
				{
					case '/':
						h[i + 1] = h[i] + 1;
						break;
					case '_':
						h[i + 1] = h[i];
						break;
					case '\\':
						h[i + 1] = h[i] - 1;
						break;
				}
			}
			int now = 0;
			List<Lake> lakes = new List<Lake>();
			while (now < h.Length - 1)
			{
				if (h[now] <= h[now + 1])
					now += 1;
				else
				{
					bool b = false;
					for (int i = now + 1; i < h.Length; i++)
					{
						if (h[now] == h[i])
						{
							Lake lake = new Lake();
							lake.left = now;
							lake.right = i;
							lakes.Add(lake);
							now = i;
							b = true;
							break;
						}
					}
					if (b == false)
						now += 1;
				}
			}
			foreach (Lake x in lakes)
			{
				for (int i = x.left; i < x.right; i++)
				{
					if (h[i] < h[i + 1])
						x.area += h[x.left] - h[i] - 0.5;
					else if (h[i] == h[i + 1])
						x.area += h[x.left] - h[i];
					else
						x.area += h[x.left] - h[i] + 0.5;
				}
			}
			int SumLakeArea = 0;
			foreach (Lake x in lakes)
			{
				SumLakeArea += (int)x.area;
			}
			Console.WriteLine(SumLakeArea);
			Console.Write(lakes.Count);
			Console.Write(lakes.Count != 0 ? " " : "\n");
			for (int i = 0; i < lakes.Count; i++)
			{
				Console.Write(lakes[i].area);
				Console.Write(i != lakes.Count - 1 ? " " : "\n");
			}
		}
	}
}

Measured memory_bytes: 9560
#include <iostream>
#include <math.h>
using namespace std;

int main(int argc, const char * argv[]) {
    int a,b;
    cin >> a >> b;
    int add = a+b,sub1=a-b, mul=a*b;
    int MAX = max(add,sub1);
    MAX = max(MAX,mul);
    cout << MAX << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
#define No cout<<"No"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n;
    cin>>n;
    int p[n];
    rep(i,n){
        cin>>p[i];
    }
    rep(i,n){
        rep(j,n){
            int t=p[i];
            p[i]=p[j];
            p[j]=t;
            bool f=true;
            rep(k,n){
                if(p[k]!=k+1){
                    f=false;break;
                }
            }
            if(f){
                YES;return 0;
            }
            t=p[i];
            p[i]=p[j];
            p[j]=t;
        }
    }
    NO;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 44  

int main(){
    
  int i, n;
  int fibo[MAX];
 
  scanf("%d",&n);

  for(i = 0; i <= n; i++){

    if(i == 0) 
      fibo[0] = 1;

    if(i == 1) 
      fibo[1] = 1;

    if(i > 1) 
      fibo[i] = fibo[i - 1] + fibo[i - 2];

    if(i == n) 
      printf("%d\n", fibo[i]);
  
  }
 
  return 0;

}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)

int main()
{

  string S;
  cin >> S;
  int cnt0 = 0;
  int cnt1 = 0;
  rep(i, S.size())
  {
    if (S[i] == '0')
      cnt0++;
    if (S[i] == '1')
      cnt1++;
  }
  cout << S.size() - abs(cnt1 - cnt0);
}

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




int main(){
   int n;
   cin>>n;
   if(n%2==0){
	   cout<<(double)1/2<<endl;
   }else{
	   int a=n/2;
	   a++;
	   cout<<(double)a/n<<endl;
   }
   return 0;
}



Measured memory_bytes: 256
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,t = readInts()
ts = readInts()
end = ts[0]+t
ans = t

for i in ts:
	ans+=min(t-(end-i),t)
	end = i+t

print(ans)

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

using namespace std;

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;

ll mod = 1e9+7;

string solve() {
    string s; cin >> s;

    rep(i, static_cast<int>(s.size())) {
        s[i] = 'x';
    }

    return s;
}

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

	cout << solve() << endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <set>
#include <map>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <climits>
#include <fstream>
#include <cassert>
#include <unordered_map>
using namespace std;
#pragma warning(disable : 4996)
typedef long long ll;
typedef long double ld;



int main() {
#ifdef _DEBUG
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int h, n, s = 0;
	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		s += x;
	}
	cout << (s >= h ? "Yes" : "No");
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n[10000], h, w, s;
int main() {
	memset(n, 0, sizeof(n));
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> s;
			n[i] += s;
		}
	}
	sort(n, n + h);
	cout << n[h - 1] << endl;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int32 N, Q;
vector<PII> G[112345];
int64 dep[112345], dis[112345];
int64 par[112345][20];

void dfs(int32 v=0, int32 p=-1, int32 d=0, int32 x=0){
	dep[v] = d; dis[v] = x;
	par[v][0] = p;
	REP(i, G[v].size()){
		int32 u, di;
		tie(di, u) = G[v][i];
		if(u == p){
			continue;
		}
		dfs(u, v, d+1, x+di);
	}
}

void build(){
	REP(k, 20){
		REP(i, N){
			if(par[i][k] != -1)
				par[i][k+1] = par[par[i][k]][k];
		}
	}
}

int32 lca(int32 u, int32 v){
	if(dep[u] < dep[v]) swap(u, v);
	REP(i, 20){
		if((dep[u]-dep[v]) >> i & 1) u = par[u][i];
	}
	if(u == v) return u;
	for(int32 i = 19;i >= 0;i--){
		if(par[u][i] != -1 && par[u][i] != par[v][i]){
			u = par[u][i];
			v = par[v][i];
		}
	}
	return par[u][0];
}

int64 dist(int32 u, int32 v){
	return dis[u]+dis[v]-2*dis[lca(u, v)];
}

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

	memset(dep, -1, sizeof dep);
	memset(par, -1, sizeof par);
	memset(dis, -1, sizeof dis);
	cin >> N >> Q;
	REP(i, N-1){
		int32 u, v, w;
		cin >> u >> v >> w; u--; v--;
		G[u].push_back(PII(w, v));
		G[v].push_back(PII(w, u));
	}
	dfs();
	build();

	REP(i, Q){
		int32 a, b, c;
		cin >> a >> b >> c; a--; b--; c--;
		PII p(a, b);
		if(dist(b, c) > dist(p.fs, p.sc)) p = PII(b, c);
		if(dist(a, c) > dist(p.fs, p.sc)) p = PII(a, c);
		int64 w = dist(p.fs, p.sc)/2;
		int32 r = lca(p.fs, p.sc);
		if(dis[p.fs] < dis[p.sc]) swap(p.fs, p.sc);
		int32 u = p.fs;
		for(int32 i = 19;i >= 0;i--){
			if(dist(par[u][i], p.fs) < w)
				u = par[u][i];
		}
		int64 res = INF_LL;
		res = min(res, max({dist(u, a), dist(u, b), dist(u, c)}));
		if(par[u][0] != -1){
			u = par[u][0];
			res = min(res, max({dist(u, a), dist(u, b), dist(u, c)}));
		}
		cout << res << endl;
	}
}



Measured memory_bytes: 37540
from bisect import bisect_left
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
res = 0
idx = bisect_left(H, K)
if idx < N:
    if H[idx] < K:
        res = N - idx - 1
    else:
        res = N - idx
print(res)



Measured memory_bytes: 18384
#include<stdio.h>

#define MAX 250

int main(){
  int A[MAX];
  int heap_size,i;

  scanf("%d",&heap_size);
  for(i=1;i<=heap_size;i++){
    scanf("%d",&A[i]);
  }
  printf("node 1: key = %d, left key = %d, right key = %d, \n",A[1],A[2],A[3]);
  
  for(i=2;i<=heap_size;i++){
    if((2*i+1)<=heap_size) printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n",i,A[i],A[i/2],A[2*i],A[2*i+1]);
    else if((2*i<=heap_size)&&(2*i+1>heap_size))printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,A[i],A[i/2],A[2*i]);
    else if((2*i)>heap_size)printf("node %d: key = %d, parent key = %d, \n",i,A[i],A[i/2]);
  }
  return 0;
}

Measured memory_bytes: 596
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    avg = sum(A)/N
    mi = abs(A[0] - avg)
    idx = 0
    for i, a in enumerate(A[1:], start=1):
        if abs(a - avg) < mi:
            mi = abs(a - avg)
            idx = i
    print(idx)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61984
#include<iostream>
using namespace std;
int main(){
	int a, b, c, d, e, f;
	cin >> d >> e >> f;
	if (d < e && d < f){
		a = d;
		if (e < f){
			b = e;
			c = f;
		}
		else{
			b = f;
			c = e;
		}
	}
	else if (e < d && e < f){
		a = e;
		if (d < f){
			b = d;
			c = f;
		}
		else{
			b = f;
			c = d;
		}
	}
	else{
		a = f;
		if (e < d){
			b = e;
			c = d;
		}
		else{
			b = d;
			c = e;
		}
	}
	cout << a <<" "<< b <<" "<< c <<endl;
	return 0;
}

Measured memory_bytes: 3080
local function reada(n,m)m=m or 1 r={}for i=1,m do r[i]={}end for i=1,n do for j=1,m do r[j][i]=io.read"*n"end end return unpack(r)end
local function b_search(t,k,min,max)
	if(min>max)then return -1 end
	local mid=min+math.floor((max-min)/2)
	if(t[mid]>k)then return b_search(t,k,min,mid-1)
	elseif(t[mid]<k)then return b_search(t,k,mid+1,max)
	else return mid
	end
end

Q=io.read"*n"
l,r=reada(Q,2)

a={2}
for i=3,200000,2 do
	table.insert(a,i)
end

for i=3,math.sqrt(200000),2 do
	local b={}
	for _,v in ipairs(a)do
		if(v%i~=0 or v==i)then table.insert(b,v)end
	end
	a=b
end

s={0}
for i=1,50000 do
	if(b_search(a,i,1,#a)~=-1 and b_search(a,i*2-1,1,#a)~=-1)then
		s[i+1]=s[i]+1
	else
		s[i+1]=s[i]
	end
end

for i=1,Q do
	print(s[(r[i]+1)/2+1]-s[(l[i]+1)/2])
end

Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    string s;
    cin >> s;
    queue<char>q;
    rep(i, s.size()) {
        q.push(s[i]);
    }
    string t;
    while (q.size()>1) {
        char a=q.front();q.pop();
        char b=q.front();
        if (a=='B'&&b=='C') {
            t.push_back('D');
            q.pop();
        }
        else {
            t.push_back(a);
        }
    }
    ll co=0;
    ll ans=0;
    rep(i, t.size()) {
        if (t[i]=='B'||t[i]=='C') {
            co=0;
        }
        else if (t[i]=='D') {
            ans+=co;
        }
        else {
            co++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 4036
N=int(input())
S=list(input())
c = 0
l=0
r=len(S)-1
while r > l:
    while l < r and S[l] == 'R':
        l += 1
    while r > l and S[r] == 'W':
        r -= 1
    if r > l:
        S[l] = 'R'
        S[r] = 'W'
        c += 1
print(c)


Measured memory_bytes: 10652
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn exe(h: usize, a: usize) -> usize {
    let ans = h / a;
    if h % a == 0 {
        ans
    } else {
        ans + 1
    }
}

fn main() {
    input! {
        h: usize,
        a: usize,
    }
    let ans = exe(h, a);
    println!("{}", ans);
}


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

    int x, a;
    cin >> x >> a;
    
    if(x < a){
        cout << 0 << endl;
    }
    else{
        cout << 10 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [0]
for _ in range(n):
    a.append(int(input()))

ans = 0
for i in range(n):

    # (x,x)のペア
    ans += a[i] // 2
    a[i] -= a[i] // 2 * 2

    # (x,x+1)のペア
    ans += min(a[i], a[i + 1])
    a[i + 1] -= min(a[i], a[i + 1])

else:  # 最後にa[-1]でできるだけペアを作る
    ans += a[-1] // 2

print(ans)


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

int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  int left = 0;
  int right = 1e6;
  rep(i, m) {
    int l, r;
    cin >> l >> r;
    
    left = max(left, l);
    right = min(right , r);
  }
  int ans = 0;
  if(right < left) {
    cout << 0 << endl;
    return 0;
  }
  else {
    ans = right - left + 1;
    cout << ans << endl;
    return 0;
  }
}

Measured memory_bytes: 3632
a, b, x = map(int, input().split())

if x == a**2*b:
  print(0)
  exit()

if x <= a**2*b/2:
  t = (2*x)/(a*b**2)
else:
  t = (a**3)/(2*(a**2*b-x))
#print(t)

import math
a = math.atan(t)
a = math.degrees(a)
print(90-a)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int n;
vs v;

int solve(int r, int c)
{
	if (v[r][c] == '+')
	{
		int res = 0;
		int p = r + 1;
		while (p < n && c < v[p].size() && v[p][c] == '.')
		{
			if (v[p][c + 1] != '.')
			{
				res += solve(p, c + 1);
			}
			p++;
		}
		return res;
	}
	else if(v[r][c] == '*')
	{
		int res = 1;
		int p = r + 1;
		while (p < n && c < v[p].size() && v[p][c] == '.')
		{
			if (v[p][c + 1] != '.')
			{
				res *= solve(p, c + 1);
			}
			p++;
		}
		return res;
	}
	else if(isdigit(v[r][c]))
	{
		return v[r][c] - '0';
	}
	else assert(false);
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	while (cin >> n, n)
	{
		v.resize(n); cin >> v;
		cout << solve(0, 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 3228
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

// GCD : greatest common divisor (GCD) via Euclidean algorithm
func GCD(a, b int) int {
	for b != 0 {
		t := b
		b = a % b
		a = t
	}
	return a
}

// LCM : find Least Common Multiple (LCM) via GCD
func LCM(a, b int, integers ...int) int {
	result := a / GCD(a, b) * b

	for i := 0; i < len(integers); i++ {
		result = LCM(result, integers[i])
	}

	return result
}

func main() {
	sc.Split(bufio.ScanWords)

	A, B, C, D := getInt(), getInt(), getInt(), getInt()
	A--

	lcm := LCM(C, D)
	t := B / lcm
	f := A / lcm
	tc := B / C
	fc := A / C
	td := B / D
	fd := A / D

	ans := B - A
	ans -= tc - fc
	ans -= td - fd
	ans += t - f
	out(ans)
}


Measured memory_bytes: 640
import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	static Node ci = new Node(-1, null, null);

	public static void main(String arg[]) throws IOException {
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);
		String N = null;
		try{
			N = br.readLine();
		}catch(Exception e){
			System.out.println(e);
		}
		int n = Integer.parseInt(N);
		int key;
		String Com;
		String[] com;
		
		
		init();
		for(int i=0; i<n; i++){
			Com = br.readLine();
			com = Com.split(" ");
			if(com[0].equals("insert")){
				key = Integer.parseInt(com[1]);
				insert(key);
			}else if(com[0].equals("deleteFirst")){
				deleteFL(ci.p);
			}else if(com[0].equals("deleteLast")){
				deleteFL(ci.n);
			}else{
				//com = Com.split(" ");
				//System.out.println(com[1]);
				key = Integer.parseInt(com[1]);
				deleat(key, ci.p);
			}
		}
		
		print(ci.p);
	}
	
	static void init(){
		ci.p = ci;
		ci.n = ci;
	}
	
	static void deleat(int de, Node x){
		while (x != ci){
			if(de == x.key) {
				x.p.n = x.n;
				x.n.p = x.p;
				return;
			}
			x = x.p;
		}
		/*
		if(de == x.key) {
			x.p.n = x.n;
			x.n.p = x.p;
			return;
		} else if(ci.key == x.key){
			return;
		}
		deleat(de, x.p);
		*/
	}
	
	static void deleteFL(Node x){
		if(x != ci){
			x.p.n = x.n;
			x.n.p = x.p;
		}
	}
	
	static void insert(int key) {
		Node x = new Node(key, null, null);
		ci.p.n = x;
		x.p = ci.p;
		x.n = ci;
		ci.p = x;
	}
	
	static void print(Node u) {
		while(u != ci){
			if (u != ci.n){
				System.out.print(u.key + " ");
			} else {
				System.out.println(u.key);
			}
			u = u.p;
		}
		/*
		if (u.key == ci.key) return;
		if (u != ci.n){
			System.out.print(u.key + " ");
		} else {
			System.out.println(u.key);
		}
		print(u.p);
		*/
	}
}

class Node {
	int key;
    Node n = null;
    Node p = null;
    public Node(int key, Node n, Node p) {
        this.key = key;
        this.n = n;
        this.p = p;
    }
}


Measured memory_bytes: 191448
#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
const ll maxn = 86;
ll n,l[maxn+1];
int main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	cin >> n;
	l[0]=2;
	l[1]=1;
	for (ll i=2; i<=maxn; i++)
	l[i]=l[i-1]+l[i-2];
	cout << l[n];
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  double mx = -1.0;
  double mn = 1000001.0;
  double n;
  while (cin >> n) {
    mx = max(mx, n);
    mn = min(mn, n);
  }
  cout << mx - mn << endl;
  return 0;
}


Measured memory_bytes: 3232
s=input()
if s=="SUN":
  print(7)
if s=="MON":
  print(6)
if s=="TUE":
  print(5)
if s=="WED":
  print(4)
if s=="THU":
  print(3)
if s=="FRI":
  print(2)
if s=="SAT":
  print(1)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
write = sys.stdout.write
def ii(): return int(readline())
def mi(): return map(int, readline().rstrip().split())
def li(): return list(readline().rstrip())
def lmi(): return list(map(int, readline().rstrip().split()))
def end(*arg): print(*arg); sys.exit()
# template


def main():
    k, x = mi()
    if 500 * k >= x:
        print("Yes")
    else:
        print("No")
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int s,w;
	cin >> s >> w;
	if(s<=100 && s>=1 && s<=100 && s>=1)
	if(s>w)
	cout << "safe";
	else
	cout << "unsafe";
	return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main(void)
{
    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: 2604
#include <bits/stdc++.h>
using namespace std;

bool is_open(set<int> called, int number) {
  return called.find(number) != called.end();
}

int main() {
  int a[3][3];
  for ( int i = 0; i < 3; i++ ) {
    for ( int j = 0; j < 3; j++ ) {
      cin >> a[i][j];
    }
  }
  int n;
  set<int> called;
  cin >> n;
  while ( n-- > 0 ) {
    int b;
    cin >> b;
    called.insert(b);
  }

  string bingo = "No";
  for ( int i = 0; i < 3; i++ ) {
    if ( is_open(called, a[i][0]) && is_open(called, a[i][1]) && is_open(called, a[i][2]) ) { bingo = "Yes"; }
  }
  for ( int j = 0; j < 3; j++ ) {
    if ( is_open(called, a[0][j]) && is_open(called, a[1][j]) && is_open(called, a[2][j]) ) { bingo = "Yes"; }
  }
  if ( is_open(called, a[0][0]) && is_open(called, a[1][1]) && is_open(called, a[2][2]) ) { bingo = "Yes"; }
  if ( is_open(called, a[0][2]) && is_open(called, a[1][1]) && is_open(called, a[2][0]) ) { bingo = "Yes"; }

  cout << bingo << endl;
  return 0;
}


Measured memory_bytes: 3608
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(ll i=(x);i<(y);i++)
#define RREP(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class ABeginner {
public:
    void solve(std::istream& in, std::ostream& out) {
        int N, R;
        in >> N >> R;
        out << R + (N <= 10 ? 100 * (10 - N) : 0) << endl;
    }
};


signed main() {
    ABeginner solver;
    std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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


int main() {
  int n, m, x;
  cin >> n >> m >> x;
  vector<int> a(m);
  rep(i,m)cin >> a[i];
  int s=0, t=0;
  for(int i = x; i > 0; --i){
    rep(j,m){
      if(i==a[j]) ++s;
    }
  }
  for(int i = x; i < n; ++i){
    rep(j,m){
      if(i==a[j]) ++t;
    }
  }
  cout << min(s,t) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
const int L=-1000000,R=1000000;
int K,X;
int main(){
	scanf("%d%d",&K,&X);
	int t=max(L,X-K+1),h;
	h=min(R,X+K-1);
	for(int i=t;i<=h;i++)printf("%d ",i);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
using P=pair<int,int>;
typedef unsigned long long ull;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int h,w,n;
  cin >> h >> w >> n;
  vector<int>a(n);
  rep(i,n) cin >> a[i];
  
  int c[h][w]={};
  
  int nowy=0,nowx=0;
  rep(i,n){
    while(a[i]){
      if(c[nowy][nowx]==0){
        c[nowy][nowx]=i+1;
      }
      a[i]--;
      if(nowy%2==0 && nowx==w-1){
        nowy++;
        nowx=w;
      }
      else if(nowy%2==1 && nowx==0){
        nowy++;
        nowx=-1;
      }
      if(nowy%2==0)nowx++;
      else nowx--;
    }
  }
  rep(i,h){
    rep(j,w){
      if(j!=0)cout<<" ";
      cout << c[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;
int main() {
    int N; cin >> N;
    int res=0;
    for (int i=0;i<N;i++) {
        ll tmp; cin >> tmp;
        if (tmp%2==1) res++;
    }
    if (res%2==0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


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

string rev(string s){
  string ans="";
  for(int i=s.size()-1; i>=0; i--)
    ans += s.substr(i,1);
  return ans;
}

int main(){

  int n;
  cin >> n;
  for(int k=0; k<n; k++){
    string s;
    cin >> s;
    vector<string> ans;
    for(int i=1; i<s.size(); i++){
      string pre  = s.substr(0,i);
      string late = s.substr(i,s.size()-i);
      ans.push_back(pre+late);
      ans.push_back(late+pre);
      ans.push_back(rev(pre)+late);
      ans.push_back(late+rev(pre));
      ans.push_back(rev(late)+pre);
      ans.push_back(pre+rev(late));
      ans.push_back(rev(late)+rev(pre));
      ans.push_back(rev(pre)+rev(late));
    }
    sort(ans.begin(),ans.end());
    ans.erase(unique(ans.begin(),ans.end()), ans.end());
    cout << ans.size() <<endl;
  }
}

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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i ++){
        cin >> S.at(i);
    }
    sort(S.begin(),S.end());

    vector<int> num(N);
    string cnt = " ";
    for(int i = 0; i < N; i ++){
        if(S.at(i) != cnt){
            cnt = S.at(i);
            num.at(i) = 1;
        }else{
            num.at(i) = num.at(i-1) + 1;
        }
    }

    int max = 0;
    for(int i = 0; i < N; i ++){
        if(num.at(i) > max){
            max = num.at(i);
        }
    }

    for(int i = 0; i < N; i ++){
        if(num.at(i) == max){
            cout << S.at(i) << endl;
        }
    }

}

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

int main(void){
    int N;
    cin >>N;
    int sum = 1;
    rep(i,3){
        sum *= N;
    }
    cout << sum << endl;
}




Measured memory_bytes: 256
N, D= map(int, input().split())

# 文字列の入力
X = []
for i in range(N):
    X.append(list(map(int, input().split())))

count=0

for i in range(len(X)-1):
    for j in range(i+1, len(X)):
        tmp=0
        for k in range(D):
            tmp+=(X[i][k]-X[j][k])**2
        tmp=tmp**0.5
        if tmp.is_integer():
            count+=1
print(count)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String args[] ) throws Exception {
        Integer arrays[] = new Integer[10];

        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 10; i++){
            arrays[i] = sc.nextInt();
        }
        Arrays.sort(arrays, Comparator.reverseOrder());
        for (int i = 0; i < 3; i++) {
            System.out.println(arrays[i]);
        }
    }
}

Measured memory_bytes: 26076
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        ss: [String; n],
    }

    let mut arr = [0; 4];
    let case = ["AC", "WA", "TLE", "RE"];

    for s in ss.iter() {
        match &s[..] {
            "AC" => arr[0] += 1,
            "WA" => arr[1] += 1,
            "TLE" => arr[2] += 1,
            "RE" => arr[3] += 1,
            _ => {}
        }
    }

    for i in 0..4 {
        println!("{} x {}", case[i], arr[i]);
    }
}


Measured memory_bytes: 7844