akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var N = ReadLong();
            var L = ReadLongs().OrderBy(x => x).ToArray(); ;
            var count = 0;
            for (var i = 0; i < N - 2; i++)
            {
                var min = L[i];
                for (var j = i + 1; j < N - 1; j++)
                {
                    var mid = L[j];
                    if (min == mid) { continue; }
                    for (var k = j + 1; k < N; k++)
                    {
                        var max = L[k];
                        if (mid == max) { continue; }
                        if (max < min + mid)
                        {
                            count++;
                        }
                    }
                }
            }
            return count;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

int main() {
    int a, b, c; cin >> a >> b >> c;
    int k; cin >> k;
    while (a >= b && k > 0) {
        b *= 2;
        k--;
    }
    if (a >= b) {
        puts("No");
        return 0;
    }
    while (b >= c && k > 0) {
        c *= 2;
        k--;
    }
    if (b >= c) {
        puts("No");
    }
    else {
        puts("Yes");
    }
}


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

int p[1000000];

int main(){
	for(int i = 0 ; i < 1000000 ; i++) p[i] = 1;
	p[0] = p[1] = 0;
	for(int i = 2 ; i*i < 1000000 ; i++){
		if( p[i] ){
			for(int j = i*i ; j < 1000000 ; j+=i){
				p[j] = false;
			}
		}
	}
	int a,d,n;
	while(cin >> a >> d >> n && (a||d||n) ){
		for(int i = a ; ; i+=d){
			if(p[i]){
				n--;
				if( n == 0 ){
					cout << i << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	int l =max(a,c);
	int r = min(b,d);
	cout << max(0,r-l) << endl;
	return 0;
}


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

using namespace std;
typedef long long ll;

struct BIT {
    vector<ll> x;
    BIT(ll n) : x(n, 0) {}
    ll sum(ll i){
        ll s = 0;
        while(i > 0){
            s += x.at(i - 1);
            i -= i & (-i);
        }
        return s;
    }
    void add(ll i, ll v){
        i += 1;
        while(i <= x.size()){
            x.at(i - 1) += v;
            i += i & (-i);
        }
    }
};

ll calc_inversion_number(const vector<ll>& x){
    ll maxv = *max_element(x.begin(), x.end());
    ll minv = *min_element(x.begin(), x.end());
    ll n = maxv - minv + 1;
    BIT bit(n);
    ll ret = 0;
    for(int i = 0; i < x.size(); ++i){
        ret += i - bit.sum(x.at(i) - minv + 1);
        bit.add(x.at(i) - minv, 1);
    }
    return ret;
}

bool check(const vector<ll> a, ll x){
    // cerr << "check(" << x << ")" << endl;

    const ll n = a.size();
    vector<ll> b(n, 0);
    for(ll i = 0; i < n; ++i){
        if(a.at(i) >= x){
            b.at(i) = 1;
        }else{
            b.at(i) = -1;
        }
    }

    // cerr << "b = ";
    // for(ll bi : b){ cerr << bi << " "; }
    // cerr << endl;

    vector<ll> c(n + 1, 0);
    for(int i = 1; i <= n; ++i){
        c.at(i) = c.at(i - 1) + b.at(i - 1);
    }

    // cerr << "c = ";
    // for(ll ci : c){ cerr << ci << " "; }
    // cerr << endl;

    ll invnum = calc_inversion_number(c);
    ll total = n * (n + 1) / 2;
    ll half = total / 2;
    // cerr << "total = " << total
    //     << ", half = " << half << ", invnum = " << invnum
    //     << ", ans = " << (total - invnum) << endl;
    return half <= total - invnum;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(ll i = 0; i < n; ++i){
        cin >> a.at(i);
    }
    ll lo = *min_element(a.begin(), a.end());
    ll hi = *max_element(a.begin(), a.end());
    while(lo < hi){
        ll x = (lo + hi + 1) / 2;
        // cerr << "lo = " << lo << ", x = " << x << ", hi = " << hi << endl;
        if(check(a, x)){
            lo = x;
        }else{
            hi = x - 1;
        }
    }
    cout << lo << endl;
    return 0;
}


Measured memory_bytes: 3912
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define REP(i, x, n) for(int i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

int main(){
    lint x;
    cin >> x;
    lint ans = ((x-1) / 11LL + 1LL) * 2LL;
    if(1 <= x % 11LL && x % 11LL <= 6LL){
        ans--;
    }
    cout << ans << endl;
    return 0;
}

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

ll k, m = 0, n;
ll t[1 << 17], d[1 << 17];
vector<ll> u, v;

int main()
{
    cin >> n >> k;
    for (int i = 1; i <= n; i += 2)
    {
        m++;
    }
    if (m >= k)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception{
		// TODO ?????????????????????????????????????????????
		String str[];
		int ans[] = new int[3];
		int stock;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        str = br.readLine().split(" ");
        ans[0] = Integer.parseInt(str[0]);
        ans[1] = Integer.parseInt(str[1]);
        ans[2] = Integer.parseInt(str[2]);
        for(int i = 0; i < str.length; i++){
        	for(int j = i + 1; j < str.length; j++){
            	if(ans[j] < ans[i]){
            		stock = ans[i];
            		ans[i] = ans[j];
            		ans[j] = stock;
            	}
            }
        }
        System.out.println(ans[0] + " " + ans[1] + " " + ans[2]);

	}

}

Measured memory_bytes: 24180
s=input()
ans=[]
I=[0]*len(s)
for i in range(len(s)):
    if (s[i]=="A" or s[i]=="T" or s[i]=="G" or s[i]=="C"):
        I[i]=1

    else:
        I[i]=0
for i in range(len(I)):
    if (I[i]==1 and I[i-1]==0) or (I[i]==1 and i==0):
        ans.append(1)
    elif (I[i]==1 and I[i-1]==1):
        ans[-1]+=1
if ans==[]:
    print(0)
else:
    print(max(ans))


Measured memory_bytes: 3064
import java.util.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		Main answer = new Main();
		System.out.printf("%.10f",answer.solve());
	}

	private double solve() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double [] array = new double[N+1];
		for(int i=1;i<=N;i++) {
			array[i] = sc.nextDouble();
		}

		double [][] dp = new double[3001][3001];
		for(int i=0;i<3001;i++) {
			Arrays.fill(dp[i], -1.0);
		}

		return solve(dp, N, (N+1)/2, array);
	}

	private double solve(double[][] dp, int coins, int headCount, double[] array) {

		if(headCount==0) return 1;
		if (coins==0) return 0;

		if (dp[coins][headCount] > -0.9) return dp[coins][headCount];

		double left = array[coins] * solve(dp, coins-1, headCount-1, array);
		double right = (1-array[coins]) * solve(dp, coins-1, headCount, array);

		dp[coins][headCount] = left+right;
		return dp[coins][headCount];
	}

}

Measured memory_bytes: 116188
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<stack>
#include<map>
#include<iostream>
#include<algorithm>
#define m(a,b) memset(a,b,sizeof(a));
using namespace std;
typedef long long LL;
typedef pair<int,int>PII;
const int inf = 1 << 30;
const int maxn = 1e5;
struct point{
	int x,cont;
	float mon;
}ans[maxn+5];
bool cmp(point a,point b){
	if(a.mon != b.mon) return a.mon > b.mon;
	if(a.cont == b.cont)
		return a.x < b.x;
	return a.cont > b.cont;
}
int main(){
	int n,d,x,ans = 0;
	cin >> n >> d >> x;
	for(int i = 0;i<n;i++){
		int a;
		cin >> a;
		if(d%a) ans+=d/a+1;
		else ans+=d/a;
	}
	ans+=x;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ms(x, n) memset(x,n,sizeof(x));
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define rep2(i, a, b) for (int i = a; i >= b; --i)
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define mod(x) (x % 1000003)
#define deb(x) cout << #x << " " << x << endl;
#define yes cout << "yes" << endl;
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

int n;

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n;
    vector<int> a(n); vector<int> b(n);
    forn(i, n) {cin >> a[i]; b[i] = a[i];}
    sort(a.begin(), a.end());
    int cnt = 0;
    forn(i, n) {
        if (a[i] != b[i]) ++cnt;
    }
    if (cnt <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
A = []
for i in range(0, 3):
  a = input().split(' ')
  for j in a:
    A.append(int(j))

# print(A)
N = int(input())

for i in range(0, N):
  data = int(input())
  if data in A:
    A[A.index(data)] = 0

if sum(A[0:3]) == 0 \
or sum(A[3:6]) == 0 \
or sum(A[6:9]) == 0 \
or A[0] + A[4] + A[8] == 0 \
or A[2] + A[4] + A[6] == 0 \
or A[0] + A[3] + A[6] == 0 \
or A[1] + A[4] + A[7] == 0 \
or A[2] + A[5] + A[8] == 0: 
  print("Yes")
else:
  print("No")

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int h, a;
	cin >> h >> a;
	if (h % a == 0) {
		cout << h / a << endl;
	}
	else {
		cout << h / a + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;

using PII = pair<int, pair<int, int>>;
int main() {
	int n, m;
	cin >> n >> m;
	string A[n];
	for (int i = 0; i < n; i++) {
		cin >> A[i];
	}
	vector<vector<int>> dist(n, vector<int>(m, MOD));
	dist[0][0] = (A[0][0] == '#');
	priority_queue<PII, vector<PII>, greater<PII>> pq;
	pq.push({dist[0][0], {0, 0}});
	while(!pq.empty()) {
		int x = pq.top().ss.ff;
		int y = pq.top().ss.ss;
		pq.pop();
		if (x+1 < n) {
			if (dist[x+1][y] > dist[x][y] + ((A[x+1][y] == '#') && (A[x][y] != A[x+1][y]))) {
				dist[x+1][y] = dist[x][y] + ((A[x+1][y] == '#') && (A[x][y] != A[x+1][y]));
				pq.push({dist[x+1][y], {x+1, y}});
			}
		}
		if (y+1 < m) {
			if (dist[x][y+1] > dist[x][y] + ((A[x][y+1] == '#') && (A[x][y] != A[x][y+1]))) {
				dist[x][y+1] = dist[x][y] + ((A[x][y+1] == '#') && (A[x][y] != A[x][y+1]));
				pq.push({dist[x][y+1], {x, y+1}});
			}
		}
	}
	cout << dist[n-1][m-1];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define inf (ll)1e9
#define mod (ll)(1e9+7)
#define d(x) cerr<<#x<<"="<<x<<endl;
#define p(x) cout<<(x)<<endl
#define ps(x) cout<<(x);
#define pfix(d,x) cout << fixed << setprecision(d) << x << endl;
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define minel(v) *min_element(all(v))
#define minind(v) distance((v).begin(), min_element(all(v)))
#define maxel(v) *max_element(all(v))
#define maxind(v) distance((v).begin(), max_element(all(v)))
#define fi first
#define se second
ll a,b,c,d,n,m,p,q,x,y,k,h,w,sum,mi,ma,ans,l,r,res;
string s;
typedef vector<int> VI;
typedef vector<pair<int,int> > VP;

int main() {
    //要望を路に波及し、もっとも要望が多い辺をきる
    //もっとも区間の狭い要望から切る
    //この要望を達成できるならこの要望を達成できる、というものがある
    //*右をソートして最も小さいものを切る
    //*左が切れ目より小さいものは達成できる
    //*左が切れ目より大きかったとき、そこを切る
    cin>>n>>m;
    VP bri;
    rep(i,m){
        cin>>a>>b;
        bri.pb({b,a});
    }
    //rep(i,m){ps(bri[i].fi);ps(" ");p(bri[i].se);}
    sort(all(bri));
    //rep(i,m){ps(bri[i].fi);ps(" ");p(bri[i].se);}
    mi=bri[0].fi;
    ans++;
    //miの手前を切ったことにする。
    d(mi)
    rep(i,m){
        if(mi<=bri[i].se){
            ans++;
            mi=bri[i].fi;
            d(mi)
        }
    }
    p(ans);
    return 0;
}


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

char s[310];
int K, f[310][310][610];

int main() {
    scanf("%s %d", s + 1, &K);
    int n = strlen(s + 1);
    memset(f, -1, sizeof(f));
    function<int(int, int, int)> dfs = [&](int l, int r, int k) {
        if (r - l < 1) return r - l + 1;
        if (~f[l][r][k]) return f[l][r][k];
        f[l][r][k] = max(dfs(l + 1, r, k), dfs(l, r - 1, k));
        int t = s[l] != s[r];
        if (k >= t) f[l][r][k] = max(f[l][r][k], dfs(l + 1, r - 1, k - t) + 2);
        return f[l][r][k];
    };
    printf("%d\n", dfs(1, n, K));
    return 0;
}

Measured memory_bytes: 229376
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main() {
	int n, ans = 0;
	cin >> n;
	vector<int> a(n), x(1000001);
	rep(i,n) cin >> a[i];
	sort(a.begin(), a.end());
	for (int i : a) {
		if (x[i] != 0) {
			x[i] = 2;
			continue;
		}
		for (int j = i; j <= 1e6; j += i) {
			x[j]++;
		}
	}
	for (int i : a) {
		if (x[i] == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}


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

using namespace std;

const int INF = 1e9 + 7;

int n, k;
vector<int> h, dp;

int dfs(int now){
    if(now + 1 == n) return 0;
    if(~dp[now]) return dp[now];
    int res = INF;
    for(int i = 1; now + i < n && i <= k; i++){
        res = min(res, abs(h[now] - h[now + i]) + dfs(now + i));
    }
    return dp[now] = res;
}

int main(){
    cin >> n >> k;
    h.resize(n);
    dp.resize(n, -1);
    for(auto&& i : h){
        cin >> i;
    }
    cout << dfs(0) << "\n";
}

Measured memory_bytes: 7296
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n;
vi x;

int main()
{
    cin >> n;
    x.resize(n); rep(i, n) cin >> x[i];

    vi x2 = x;
    sort(all(x2));

    int ans;
    int mx = INF;

    if(x2[n - 1] % 2 == 0){
        int tar = x2[n - 1] / 2;
        rep(i, n){
            if(abs(tar - x2[i]) < mx){ mx = abs(tar - x2[i]); ans = x2[i]; }
        }
    }

    else{
        int tar1 = x2[n - 1] / 2;
        int tar2 = x2[n - 1] / 2 + 1;
        rep(i, n){
            if(abs(tar1 - x2[i]) < mx){ mx = abs(tar1 - x2[i]); ans = x2[i]; }
            if(abs(tar2 - x2[i]) < mx){ mx = abs(tar2 - x2[i]); ans = x2[i]; }
        }
    }

    cout << x2[n - 1] << " " << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<set>
using ll =  long long;

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

using namespace std;

int main(){

    int n;
    cin >> n;
    set<string> st;

    rep(i,n){
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
    return 0;
}

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

using ll=long long;
using P=pair<int,int>;

const int MOD=1e9+7;
const int INF=1<<30;
const int MAX=1e5;

template<class T>
inline void xmin(T &a, T b){a=(a<b)?a:b;}
template<class T>
inline void xmax(T &a, T b){a=(a>b)?a:b;}

int a,b;

void solve(){
    cin>>a>>b;
    cout<<max(a-2*b,0)<<endl;
}

signed main(){
    //while(1)
    solve();
}


Measured memory_bytes: 256
n = int(input())
count = 0
for i in range(1, n+1):
    if i%3 ==0 and i%5 == 0 and i%7 ==0:
        count+=1
    
    elif i%27==0 and i%5==0:
        count+=1
    
    elif i%27==0 and i%7 ==0:
        count+=1
    elif i%3==0 and i%5==0 and i%13==0:
        count+=1
    elif i%3 ==0 and i%5==0 and i%11 ==0:
        count+=1

print(count)

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

int main(){
  int n;
    cin >> n;
  vector<ll> s(n);
    for(int i=0; i<n; i++) cin >> s.at(i);
    sort(s.begin(), s.end());
    reverse(s.begin(), s.end());
    ll a=0, b=0;
    // for(int i=0; i<n; i++) cout << s[i];
    // cout << endl;
    for(int i=0; i<n-1; i++){
      if(s[i] == s[i+1]){
        if(a==0){
          a = s[i];
          i += 1;
        }else{
          b = s[i];
          break;
        }
      }
    }
    ll ans = a*b;
    cout << ans << endl;

}

Measured memory_bytes: 1024
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))
ans=0
position=1
flag=True
for i in range(N):
    if position==2:
        print(ans)
        flag=False
        break 
    else:
        position=a[position-1]
        ans+=1

if flag:
    print(-1)

Measured memory_bytes: 13020
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    ll sum = 0, last = 0;
    for(ll i=1; i<=n; i++){
        sum += i;
        last = i;
        if(sum >= n) break;
    }
    ll excess = sum - n;
    for(ll i=1; i<=last; i++){
        if(i == excess) continue;
        cout << i << endl;
    }
}

Measured memory_bytes: 3568
#include<stdio.h>
int main(void)
{
	int a,b,c,x = 0;
	
	scanf("%d %d %d",&a ,&b ,&c);
	if(a>b){
		x=a;
		a=b;
		b=x;
	}
	if(b>c){
		x=b;
		b=c;
		c=x;
	}
	if(a>b){
		x=a;
		a=b;
		b=x;
	}
	printf("%d %d %d\n",a,b,c );
	
	return 0;
}
		


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

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

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976

int main()
{
    int n; cin >> n;
    vector<int> l(n);
    rep(i,n) cin >> l[i];
    sort(l.begin(),l.end());
    ll ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = i+1; j < n; j++){
            int key = l[i] + l[j];
            auto iter = lower_bound(l.begin(), l.end(), key);
            int id = distance(l.begin(),iter);
            id--;
            ans += max(0,id-j);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
        int N, M;
        cin>>N>>M;
        bool suc=false;
        bool st[200010]={0}, gl[200010]={0};
        for(int i=0;i<M;i++){
                int a, b;
                cin>>a>>b;
                if(a==1)
                        st[b]=true;
                else if(b==N)
                        gl[a]=true;
        }
        for(int i=2;i<=200000&&!suc;i++){
                if(st[i]&&gl[i])
                        suc=true;
        }
        if(suc)
                cout<<"POSSIBLE"<<endl;
        else
                cout<<"IMPOSSIBLE"<<endl;
        return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N;
    cin >> N;
    vector<int> As(N), Bs(N), Cs(N - 1);
    for (int i = 0; i < N; ++i) cin >> As[i];
    for (int i = 0; i < N; ++i) cin >> Bs[i];
    for (int i = 0; i < N - 1; ++i) cin >> Cs[i];
    int score = 0;
    int prevFood = -100;
    for (int i = 0; i < N; ++i)
    {
        int food = As[i] - 1;
        score += Bs[food];
        if (prevFood == food - 1)
        {
            score += Cs[prevFood];
        }
        prevFood = food;
    }
    cout << score << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <complex>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second

void solve(void){
	int M;
	cin >> M;
	rep(M, i) {
		string train;
		cin >> train;
		set <string> s;
		s.insert(train);
		rep(train.size()-1, i) {
			string f, l;
			f = train.substr(0, i+1);
			l = train.substr(i+1, train.size()-i-1);
			s.insert(l+f);
			reverse(all(f));
			s.insert(f+l);
			s.insert(l+f);
			reverse(all(l));
			s.insert(f+l);
			s.insert(l+f);
			reverse(all(f));
			s.insert(f+l);
			s.insert(l+f);
		}
		cout << s.size() << endl;
	}
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



Measured memory_bytes: 3248
N = input()

if N == 'SUN':
    print(7)
elif N == 'MON':
    print(6)
elif N == 'TUE':
    print(5)
elif N == 'WED':
    print(4)
elif N == 'THU':
    print(3)
elif N == 'FRI':
    print(2)
elif N == 'SAT':
    print(1)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long x, y;
        x = sc.nextLong();
        y = sc.nextLong();
        long num = x;
        long count = 1;
        while (num * 2 <= y) {
            num = num * 2;
//            System.out.println(num);
            count++;
        }
        System.out.println(count);

    }
}


Measured memory_bytes: 22740
def main():
	N, M = map(int,input().split())
	ans = 0
	if N == 1 and M == 1:
		ans = 1
	elif N == 1 or M == 1:
		ans = max(N, M) - 2
	elif N == 2 or M == 2:
		ans = 0
	else:
		ans = (N-2)*(M-2)
	print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>

/* constant */

#define GOAL    (6174)

/* typedef */

/* global variables */

/* subroutines */

static void n2a(int n, int a[4]) {
  a[0] = n / 1000;
  a[1] = (n / 100) % 10;
  a[2] = (n / 10) % 10;
  a[3] = n % 10;
}

static int a2n(int a[4]) {
  return a[0] * 1000 + a[1] * 100 + a[2] * 10 + a[3];
}

static int comp_l(const void *a, const void *b) {
  return *((int *)b) - *((int *)a);
}

static int comp_s(const void *a, const void *b) {
  return *((int *)a) - *((int *)b);
}

/* main */

int main(int argc, char **argv) {
  int c, l, n, s;
  int ns[4], ls[4], ss[4];

  for (;;) {
    scanf("%d", &n);
    if (n == 0) break;

    n2a(n, ns);
    if (ns[0] == ns[1] && ns[1] == ns[2] && ns[2] == ns[3]) {
      puts("NA");
      continue;
    }

    c = 0;

    while (n != GOAL) {
      n2a(n, ns);
      bcopy(ns, ls, sizeof(int) * 4);
      bcopy(ns, ss, sizeof(int) * 4);

      qsort(ls, 4, sizeof(int), comp_l);
      qsort(ss, 4, sizeof(int), comp_s);

      n = a2n(ls) - a2n(ss);
      c++;
    }

    printf("%d\n", c);
  }

  return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
//#include <atcoder/all>
#define rep(i, n) for (int i=0; i < (n); i++)
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int NIL = -1;
const int MAX = 10000;
const int MOD = 1000000007;
const double pi = 3.141592653589;

int main() {
    int n, l;
    cin >> n >> l;
    int taste = 0;
    int ate = INF;
    rep(i,n){
        taste += l + i;
        if(abs(ate) > abs(l+i)) ate = l+i;
    };
    cout << taste - ate << endl;
    return 0;
}

Measured memory_bytes: 3608
public class Main {


		public static void main(String[] args) {
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int h, w, i, t;
		
while(true){
		h = scan.nextInt();
		w = scan.nextInt();
		
		if(h == 0 && w == 0){
				break;
			}
		if(1 <= h && h <= 300 && 1 <= w && w <= 300){
			for(i = 1; i <= h ; i++){
			for(t = 1; t <= w ; t++){
				if(t % 2 != 0 && i % 2 != 0 || t % 2 == 0 && i % 2 == 0){
				System.out.print("#");
				}else{
					
					System.out.print(".");
				}
			}System.out.println("");
			
			}System.out.println("");
		
		
		}
		
		}
		}
}	

Measured memory_bytes: 34236
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <vector>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e6 + 5;

int m[MAXN];
long long cnt;

void insertion(int m[], int dis, int n)
{
	for(int i = dis; i < n; i++)
		for(int j = i; j >= dis && m[j] < m[j - dis]; j -= dis)
		{
			int temp = m[j-dis];
			m[j-dis] = m[j];
			m[j] = temp;
			cnt++;
		}
}

void shell(int m[], int n)
{
	vector<int> v;
	int temp = 1;;
	do
	{
		v.push_back(temp);
		temp = temp * 3 + 1;
	}while(temp < n);
	printf("%d\n", v.size());
	for(int i = v.size()-1; i >= 0; i--)
	{
		printf("%d", v[i]);
		if(i)
			printf(" ");
		insertion(m, v[i], n);
	}
	cout << endl << cnt << endl;
}

int main()
{
	int n;
	cnt = 0;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", m+i);

	shell(m, n);
	for(int i = 0; i < n; i++)
		printf("%d\n", m[i]);
	return 0;
}

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

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

    vector<int> ans;
    while(b.size() > 0){
        int n = b.size();
        bool ok = false;
        for(int i=n-1; i>=0; i--){
            if(b[i] == i+1){
                ans.push_back(i+1);
                b.erase(b.begin() + i);
                ok = true;
                break;
            }
        }
        if(!ok){
            cout << -1 << endl;
            return 0;
        }
    }
    for(int i=N-1; i>=0; i--){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
 int A,B,C,D;
 cin >> A >> B >> C >> D;
 for(int i=0;i < 150;i++)
 {
   C = C-B;
   if(C <=0)
   {
     cout << "Yes" << endl;
     break;
   }
   A = A-D;
   if(A <=0)
   {
     cout << "No" << endl;
     break;
   }
 }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define int long long int
#define sci(n) scanf("%lld",&n)
#define pri(n) printf("%lld",n)
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fl2(i,a,b) for(int i=(a);i<(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define ff first
#define ss second
#define pb push_back
#define mkp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define nl printf("\n")
#define spc printf(" ")
#define pii pair<int,int>
#define piii pair<pii,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mss map<string,string>
using namespace std;


int32_t main()
{

//#ifdef ONPC
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
//#endif
    int n;
    sci(n);
    string str,str1;
    cin>>str>>str1;
    for(int i=0;i<n;i++)
    {
        cout<<str[i]<<str1[i];
    }
    nl;



    return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}

	for _, a := range as {
		if a%2 == 1 {
			continue
		}
		if a%3 != 0 && a%5 != 0 {
			fmt.Println("DENIED")
			return
		}
	}
	fmt.Println("APPROVED")
}


Measured memory_bytes: 1776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,T,w[100005],v[100005];
ll ans,f[100005];
int main()
{
	scanf("%d%d",&n,&T);
	for(int i=1;i<=n;i++) scanf("%d%d",&w[i],&v[i]);
	for(int i=1;i<=n;i++)
	{
		for(int j=T;j>=1;j--)
		{
			if(j>=w[i]) f[j]=max(f[j],f[j-w[i]]+v[i]);
		}
	}
	for(int i=1;i<=T;i++) ans=max(ans,f[i]);
	printf("%lld\n",ans);
	return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    double A, B, H, M; cin >> A >> B >> H >> M;
    double w = 2 * pi * H/12 + 2*pi /12 *M/60 - 2*pi*M/60;
    double tmp = A*A + B*B - 2*A*B*cos(w);

    cout << sqrt(tmp) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 8344
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

template <typename T>
inline T gi()
{
	T f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 1003, M = N << 1, mod = 1000000007;

int n, m;
int dp[N][N];
char a[N][N];

int main()
{
	//File("");
	n = gi <int> (), m = gi <int> ();
	for (int i = 1; i <= n; i+=1) scanf("%s", a[i] + 1);
	for (int i = 1; i <= n; i+=1) if (a[i][1] != '#') dp[i][1] = 1; else break;
	for (int i = 1; i <= m; i+=1) if (a[1][i] != '#') dp[1][i] = 1; else break;
	for (int i = 2; i <= n; i+=1)
		for (int j = 2; j <= m; j+=1)
			if (a[i][j] != '#')
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
	printf("%d\n", dp[n][m]);
	return 0;
}


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



// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // Failed to predict input format
    long long N;
    int Q;
    string S;
    cin >> N;
    cin >> S;
    cin >> Q;
    vector<set<int>> alphabets(26);
    for(int i=0;i<N;i++){
        alphabets[S[i]-'a'].insert(i);
    }
    cerr << "read finish" << endl;
    for(int i=0;i<Q;i++){
        int j;
        cin >>j;
        if(j==1){
            int k;
            char c;
            cin >> k >> c;
            k--;
            for(int l=0;l<26;l++){
                alphabets[l].erase(k);
            }
            alphabets[c-'a'].insert(k);
        }else{
            int s,t;
            cin >> s >> t;
            s--;
            t--;
            int ans =0;
            for(int l=0;l<26;l++){
                auto iter = alphabets[l].lower_bound(s);
                if(iter != alphabets[l].end() &&*iter <= t){
                    cerr << *iter << endl;
                    ans++;
                }
            }
            cout << ans << endl;

        }
    }
    return 0;
}


Measured memory_bytes: 26244
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
inline bool cmp(int a,int b){return a>b;}
int a[100005],b[100005];
int n,m,len;
int main(){
	// freopen("a.in","r",stdin);
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>a[i];
	sort(a+1,a+1+m);
	/*
	for(int i=1;i<=m;i++)
		cout<<a[i]<<" ";
	cout<<endl;
	*/
	len=a[m]-a[1];
	// cout<<len<<endl;
	for(int i=1;i<m;i++)
		b[i]=a[i+1]-a[i];
	
	sort(b+1,b+m,cmp);
	/*
	for(int i=1;i<=m-1;i++)
		cout<<b[i]<<" ";
	cout<<endl;
	*/
	int sum=0;
	for(int i=1;i<=n-1;i++) sum+=b[i];
	printf("%d\n",len-sum);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#define pi 3.1415926535897932
using namespace std;

int main(){
        double r;
        cin >> r;

        // cout << (double)r * r * pi << " " << r * 2 * pi << endl;
        printf("%lf %lf", r*r*pi, r*2*pi);

}



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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,ans=0;
    cin >> n;
    map<int,int> mp;
    for(int i = 0;i < n;i ++){
        int a;
        cin >> a;
        if(a>0)mp[a-1] ++;
        mp[a+1] ++;
        mp[a] ++;
    }
    for(auto ite = mp.begin();ite != mp.end(); ++ite){
        if(ans<ite->second) ans = ite->second;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4736
# -*- coding=utf-8 -*-

H, N = list(map(int, input().split(" ")))
T = list(map(int, input().split(" ")))
f = False

for i in T:
    H = H - i
    if(H <= 0):
        print("Yes")
        f = True
        break

if f == False:
    print("No")

Measured memory_bytes: 13964
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define fio ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;

int main() {
	int n;
	map<int,int> f[2];
	vector<pii> q[2];
	cin >> n;
	for(int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		++f[i&1][a];
	}
	int ans = 0;
	for(int i = 0; i < 2; ++i) {
		for(auto x : f[i])
			q[i].emplace_back(x.second, x.first);
		sort(q[i].rbegin(), q[i].rend());
	}

	if(q[0][0].second != q[1][0].second) {
		ans = q[0][0].first + q[1][0].first;
	}  else {
		ans = max(q[0][1].first + q[1][0].first, q[1][1].first+q[0][0].first);
	}
	cout << n-ans << "\n";
}


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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    int a, b;
    cin >> a >> b;

    for (int i = 1; i <= 1000; i++) {
        int tmp = i;
        //cout << tmp*0.08 << " " << tmp*0.10 << endl;
        if (floor(tmp*0.08) == a and floor(tmp*0.10) == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in);) {
			
			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();
			
			long a[][] = new long[n][m];
			long b[][] = new long[m][l];
			
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < m; j++) {
					a[i][j] = sc.nextInt();
				}
			}
			for(int i = 0; i < m; i++) {
				for(int j = 0; j < l; j++) {
					b[i][j] = sc.nextInt();
				}
			}
			
			StringBuilder sb = new StringBuilder();
			
			for(int i = 0; i < n; i++) {
				for(int j = 0; j < l; j++) {
					long c = 0;
					for(int k = 0; k < m; k++) {
						c += a[i][k] * b[k][j];
					}
					sb.append(c);
					if(j < l - 1) {
						sb.append(" ");
					} else {
						sb.append("\n");
					}
				}
			}
			
			System.out.print(sb.toString());
		}
	}
}


Measured memory_bytes: 52036
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader =
                new BufferedReader(new InputStreamReader(System.in));
        while (true) {
            String input = reader.readLine();
            if (input == null) {
                break;
            }
            String out = "";
            double weight = Double.parseDouble(input);
            if (weight <= 48.00) {
                out = "light fly";
            } else if (weight <= 51.00) {
                out = "fly";
            } else if (weight <= 54.00) {
                out = "bantam";
            } else if (weight <= 57.00) {
                out = "feather";
            } else if (weight <= 60.00) {
                out = "light";
            } else if (weight <= 64.00) {
                out = "light welter";
            } else if (weight <= 69.00) {
                out = "welter";
            } else if (weight <= 75.00) {
                out = "light middle";
            } else if (weight <= 81.00) {
                out = "middle";
            } else if (weight <= 91.00) {
                out = "light heavy";
            } else {
                out = "heavy";
            }
            System.out.println(out);
        }
    }
}

Measured memory_bytes: 9368
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n;
	cin>>n;
	lli place[n+1];

	for(lli i=1;i<=n;i++){
		lli a;
		cin>>a;
		place[a]=i;
	}

	lli ans=0;
	set<lli> used={0,n+1};

	for(lli i=1;i<=n;i++){
		lli r,l;

		auto itr = used.lower_bound(place[i]);
		r = *itr;

		l = *(--itr);

		ans += i*(place[i]-l)*(r-place[i]);
		used.insert(place[i]);
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){ 

    int A, B, C, D, x, y;

    cin >> A >> B >> C >> D;
    
    for (int i = 1; i < 110; i++) {
        if (C <= i * B) {
            cout << "Yes" << endl;
            break;
        }
        else if (A <= i * D) {
            cout << "No" << endl;
            break;
        }
    }




}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 	int n;
 	cin >> n;

 	for(int i=0;i<n;i++){
 		string s;
 		cin >> s;
 		if(s=="Y"){
 			cout << "Four" << endl;
 			return 0;
 		}
 	}
 	cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll H, W, K;
    cin >> H >> W >> K;
    vvc org(H+1, vc(W, '0'));
    rep(i, H) rep(j, W) cin >> org[H-1-i][j];

    ll ans = 0;

    if(K == 1) {
        rep(i, H) rep(j, W) ans += org[i][j] - '0';
        cout << ans << endl;
        return 0;
    }

    rep(py, H) rep(px, W) {
        if(py == 0 && px == 2) {
            ;
        }

        vvc in(H+1, vc(W, '0'));
        rep(i, H) rep(j, W) in[i][j] = org[i][j];

        for(ll y = py; y < H; y++) in[y][px] = in[y+1][px];

        ll ret = 0, num = 0;
        bool end = false;
        while(!end) {
            vvb used(H+1, vb(W, false));
            end = true;
            ll sumin = 0;

            rep(i, H) {
                ll left = 0, right = 0, cnt = 1;
                for(ll j = 1; j <= W; j++) {
                    if(in[i][j-1] == in[i][j] && in[i][j] != '0') {
                        cnt++;
                        right = j;
                        if(j == W && cnt >= K) {
                            sumin += cnt * (in[i][j] - '0');
                            for(ll k = left; k <= right; k++) used[i][k] = true;
                            end = false;
                        }
                    }
                    else {
                        if(cnt >= K) {
                            sumin += cnt * (in[i][j-1] - '0');
                            for(ll k = left; k <= right; k++) used[i][k] = true;
                            end = false;
                        }
                        left = right = j;
                        cnt = 1;
                    }
                }
            }
            ret += (1<<num) * sumin;
            num++;

            rep(j, W) {
                rep(i, H) {
                    ll k = i;
                    while(used[k][j]) k++;
                    in[i][j] = in[k][j];
                    if(in[k][j] != '0') used[k][j] = true;
                }
            }
        }
        chmax(ans, ret);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    
    int N,A,B;
    scanf("%d %d %d", &N, &A, &B);
    
    int count = 0;
    for(int i = 1; i <= N; i++){
        int num = i;
        int sum = 0;
        while(num != 0){
            sum += num % 10;
            num /= 10;
        }
        if(sum >= A && sum <= B){
            count+= i;
        }
    }
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 1724
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0) break;
			int[] s = new int[n];
			for (int i = 0; i < n; i++) {
				s[i] = sc.nextInt();
			}
			Arrays.sort(s);
			int sum = 0;
			for (int i = 1; i < n - 1; i++) {
				sum += s[i];
			}
			System.out.println(sum / (n - 2));
		}
	}
}



Measured memory_bytes: 29604
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  int n; cin >> n;
  map<ll, ll> m;
  vector<ll> v(n);
  rep(i, n){
    cin >> v[i];
    m[v[i]]++;
  }
  ll ans = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++){
    ll a = itr->first, b = itr->second;
    if(a == b)continue;
    if(a > b)ans += b;
    else ans += b-a;
  }
  cout << ans << endl;
  system("pause");
}

Measured memory_bytes: 7288