akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = Reader.NextUInt;
        int last = 0;
        int cur = 0;
        int max = 0;
        for (int i = 0; i < n; i++)
        {
            var h = Reader.NextUInt;
            if (last >= h) max = Max(max, ++cur);
            else cur = 0;
            last = h;
        }
        Console.WriteLine(max);
    }
}

static class Reader
{
    const int BUF_SIZE = 1 << 12;
    static Stream Stream;
    static byte[] buffer = new byte[BUF_SIZE];
    static int ptr = 0;
    static Reader() { Stream = Console.OpenStandardInput(); }

    private static void Read()
    {
        Stream.Read(buffer, 0, BUF_SIZE);
    }

    private static byte Next { get { if (ptr >= buffer.Length) { Read(); ptr = 0; } return buffer[ptr++]; } }

    public static int NextUInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0; byte next;
            do { next = Next; } while (next < 48);
            do { res = res * 10 + next - 48; next = Next; } while (48 <= next);
            return res;
        }
    }
}


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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n;
	ret((n*(n-1))/2)	
	
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int H, W, N;
    scanf("%d %d %d", &H, &W, &N);
    int A[H+1][W+1], Color[N+1];
    for (int i = 1; i <= N; ++i) {
        scanf("%d", &Color[i]);
    }
    int c = 1;
    for (int i = 1; i <= H; ++i) {
        if (i & 1) {
            for (int j = 1; j <= W; ++j) {
                A[i][j] = (Color[c]) ? c : ++c;
                --Color[c];
            }
        } else {
            for (int j = W; j >= 1; --j) {
                A[i][j] = (Color[c]) ? c : ++c;
                --Color[c];
            }
        }
    }
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            printf("%d ", A[i][j]);
        }
        putchar('\n');
    }
    return 0;
}

Measured memory_bytes: 256
// Aizu Vol0 0005: GCD and LCM
// 2017.7.28

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


unsigned gcd(unsigned n1, unsigned n2)
{
#if 0
	if (n2 == 0) return n1;
	return gcd(n2, n1 % n2);
#else
	unsigned r;

	while (n2 != 0) {
		r = n1 % n2;
		n1 = n2;
		n2 = r;
	}
	return n1;
#endif
}

int main()
{
	unsigned a, b;
	unsigned long long c;
	unsigned int g;

	while (scanf("%u%u", &a, &b) == 2) {
		g = gcd(a, b);
		c = a; c *= b;
		printf("%u %llu\n", g, c / g);
	}
	return 0;
}

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


int main(){
    int a,b;cin>>a>>b;
    int max =10000;
    for(int i = 0;i<max;i++){
        int x8 = i*0.08;
        int x10 = i*0.1;

        if(a==x8&&b==x10){
            cout<<i<<endl;
            return 0;
        }

    }
    cout<<-1<<endl;

}


Measured memory_bytes: 3636
use std::cmp::{max, min};
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let _n: usize = read();
    let m: usize = read();
    let lr: Vec<(i32, i32)> = (0..m).map(|_| (read(), read())).collect();

    let (l_max, r_min) = lr.iter().fold(
        (std::i32::MIN, std::i32::MAX),
        |(l_max, r_min), &(l_i, r_i)| (max(l_max, l_i), min(r_min, r_i)),
    );

    println!("{}", max(r_min - l_max + 1, 0));
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb(x) push_back(x);
#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}



int main(){
    migmig
    int a , b,  c;
  	cin >> a >> b >> c;
  swap(a , b);
  swap(a , c);
  cout << a << ' ' << b << ' ' <<  c;


    return(0);
}

//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, life is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.
//It is important to draw wisdom from diffrent places. If you take it from only one place it becomes rigid and stale.
//kuxtal jach uts chuchul u u páajtal máak jach táaj meyajilo'ob le castigadas tumen ch'aik descansos.


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

const int N = 1e5 + 10;
typedef long long ll;
ll n, a[N], pre[N], ans;

int main() {
    cin >> n;
    rep(i, 1, n) scanf("%lld", &a[i]);
    sort(a + 1, a + n + 1);
    rep(i, 1, n) {
        a[i] += a[i - 1];
        ans++;
        if (a[i] * 2 < a[i + 1]) ans = 0;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 4556
import std.stdio;
import std.string;
import std.conv;

void main() {
	auto l = readln.chomp;
	auto fst = l[0..2].to!int;
	auto snd = l[2..4].to!int;
	auto fM = fst > 0 && fst <= 12;
	auto sM = snd > 0 && snd <= 12;
	if (fM && sM)
		write("AMBIGUOUS");
	else if (sM)
		write("YYMM");
	else if (fM)
		write("MMYY");
	else
		write("NA");
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		//		new Main().solveA();
//		new Main().solvB();
		new Main().solveB2();
		//		new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numA = 0;
		int numB = 0;

		try {
			scanner = new Scanner(System.in);
			numA = scanner.nextInt();
			numB = scanner.nextInt();

			System.out.println((numA - 1) * (numB - 1));

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int count = 0;
			for (int i = 1; i <= numN; i++) {
				if (i % 2 == 0) {
					continue;
				}
				int wk = i;
				Map<Integer, Integer> wkMap = new HashMap<Integer, Integer>();
				for (int j = 2; j < i;) {
					if (wk % j == 0) {
						wk /= j;
						wkMap.put(j, wkMap.get(j) == null ? 1 : wkMap.get(j) + 1);
					} else {
						j++;
					}
				}
				int wkRes = 1;
				for (Integer val1 : wkMap.values()) {
					wkRes *= (val1 + 1);
				}
				if (wkRes == 8) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB2() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int count = 0;
			/*
			 * 1からNまでの数値を全探索
			 */
			for (int i = 1; i <= numN; i++) {
				if (i % 2 == 0) {
					continue;
				}
				int wkRes = 0;
				/*
				 * 数値iが、約数をいくつ持つのか調べる
				 * 最大でもNまで（i<=Nだし）
				 */
				for (int j = 1; j <= numN; j++) {
					if (j % 2 == 0) {
						continue;
					}
					if (i % j == 0) {
						wkRes++;
					}
				}
				if (wkRes == 8) {
					count++;
				}
			}

			System.out.println(count);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		String wkS;
		long count = 0;

		try {
			scanner = new Scanner(System.in);
			wkS = scanner.next();
			count = scanner.nextLong();
			String wk = wkS;
			if (count <= wkS.length()) {
				wk = wkS.substring(0, (int) count);
			}
			for (int i = 0; i < wk.length(); i++) {
				if (wk.charAt(i) != '1') {
					System.out.println(wk.charAt(i));
					return;
				}
			}
			System.out.println(1);
		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int numN = 0;
		int numK = 0;
		int numS = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

constexpr int atcoder_mod = 1e9+7;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int K,X;
	cin >> K >> X;
	vector<int> V;
	for(int i=X-(K-1);i<=X+(K-1);i++){
		V.push_back(i);
	}
	for(int i=0,ei=V.size();i<ei;i++){
		cout << V[i];
		if(i==ei-1) cout << endl;
		else cout << ' ';
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>
#include <stack>

using namespace std;
typedef long long ll;

ll dp[50][2];

int main() {
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> vec(N);
  for (int i = 0; i < N; ++i) {
    cin >> vec[i];
  }
  for (int i = 0; i < 50; ++i) {
    dp[i][0] = dp[i][1] = -1;
  }
  
  dp[45][0] = 0;
  for (int d = 44; d >= 0; --d) {
    ll D = 1LL << d;
    int num1 = 0;
    for (int i = 0; i < N; ++i) {
      if (vec[i] & D) {
        num1++;
      }
    }
    int num0 = N - num1;
    if (dp[d+1][1] >= 0) {
      dp[d][1] = max(dp[d][1], dp[d+1][1] + D * max(num1, num0));
    }
    if (dp[d+1][0] >= 0) {
      if (K & (1LL<<d)) {
        dp[d][1] = max(dp[d][1], dp[d+1][0] + D * num1); // 0を使う(xorなのでnum1を使う)
        dp[d][0] = max(dp[d][0], dp[d+1][0] + D * num0); // 1を使う(xorなのでnum0を使う)
      }
      else {
        dp[d][0] = max(dp[d][0], dp[d+1][0] + D * num1);
      }
    }
  }
  cout << max(dp[0][0], dp[0][1]) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(i64 i = 0; i < N; i++)
#define Rep(i, k, N) for(i64 i = k; i < N; i++)
#define all(v) v.begin(), v.end()
#define eb emplace_back
#define Cout(s) cout << s << endl
string Yes(bool b) {if(b){return "Yes";} else {return "No";}}
string YES(bool b) {if(b){return "YES";} else {return "NO";}}

int main(){
    int N;
    cin >> N;
    set<string> st;
    rep(i, N){
        string S; cin >> S;
        st.insert(S);
    }

    Cout(st.size());
}


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


int main(){

int a,b,c,x;
cin >> a >> b  >> c >> x;
int count=0;

for(int i=0;i<=a;i++){
    for(int j=0;j<=b;j++){
        for(int k=0;k<=c;k++){
            if(x==500*i+100*j+50*k)count++;
        }
    }
}
cout << count << endl;
return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

/*
  vector<vector<int>> tb;
  tb.resize(H);
  for (size_t i = 0; i < H; i++) {
    tb[i].resize(W);
  }
*/

int func_min(int a, int b){
  if (a>b){
    return b;
  }else{
    return a;
  }
}

int main(void) {
  int N,T;
  scanf("%d %d",&N,&T);

  int A,min=0,ans=0,num=0;

  for (int i = 0; i < N; i++) {
    cin >> A;
    if(i==0){
      min = A;
    }else{
      min = func_min(min,A);
    }
    if (ans < A-min) {
      ans = A - min;
      num = 1;
    }else if(ans == A-min){
      num ++;
    }
  }
  printf("%d\n",num);
}


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

using namespace std;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pii pair<int,int>
#define INF LLONG_MAX
#define EPS 1e-8
#define all(v) (v).begin(),(v).end()
#define sq(x) ((x)*(x))
#define foreach(it, v) for(auto it=(v).begin(); it != (v).end(); ++it)
#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)


#define tr(...) cout<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)

template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
 
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}
 
typedef long double dbl;
bool codejam = 0;

const int MOD = 1000*1000*1000 + 7;
const int NMAX = 1000*1000 + 11;

int arr[NMAX];
int n,m,p,q,k,a,b,c,ans;
string s,str;
char ch;
vector<int> v;

const int step = 1e18;

void solve()
{
    cin>>n;
    int ans = 1;
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    if(arr[0] == 0){
        cout<<"0";
        return;
    }
    ans = 1;
    for(int i=0;i<n;i++){
        if(arr[i] - (1.0*step/(ans)) - EPS > 0){
            // tr(step,arr[i],ans,(1.0*step/(ans)));
            cout<<"-1";
            return;
        }
        ans = ans*arr[i];
        if(ans - step > 0){
            cout<<"-1";
            return;
        }
        // tr(ans, ans-step);
    }
    cout<<ans;
}

int32_t main(){ fio;
    int t = 1;
    int cs = 1;
    while(t--){
        if(codejam){
            cout<<"Case #"<<cs<<": ";
        }
        cs++;
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 4428
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
#define INF 1e9;
#define LINF 1e18;
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;}
// clang-format on

void solve(std::string C){
  ANS((char)(C[0]+1));
}

// clang-format off
int main() {
  std::string C;
  std::cin >> C;
  solve(C);
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int k = scan.nextInt();

		if(k <= a) {
			System.out.println(k);
		}else if(k <= a + b) {
			System.out.println(a);
		}else {
			System.out.println(a - (k - a - b));
		}

	}
}

Measured memory_bytes: 27004
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

anscount=[0]*(n+1)
for i in range((n+1)//2):
    now=i
    teki=a[now]-anscount[now]
    if teki<=b[now]:
        b[now]-=teki
        anscount[now]+=teki
        if a[now+1]<=b[now]:
            anscount[now+1]+=a[now+1]
            b[now]-=a[now+1]
        else:
            anscount[now+1]+=b[now]
            b[now]=0
    else:
        anscount[now]+=b[now]
        b[now]=0
# print(anscount)
# print(b)
for i in range((n+1)//2):
    now=n-i
    teki=a[now]-anscount[now]
    if teki<=b[now-1]:
        b[now-1]-=teki
        anscount[now]+=teki
        teki=a[now-1]-anscount[now-1]
        if teki<=b[now-1]:
            anscount[now-1]+=teki
            b[now-1]-=teki
        else:
            anscount[now-1]+=b[now-1]
            b[now-1]=0
    else:
        anscount[now]+=b[now-1]
        b[now-1]=0
# print(b)

# for i in range(n+1):
#     if i%2==0:
#         now=i//2
#         teki=a[now]-anscount[now]
#         if teki<=b[now]:
#             b[now]-=teki
#             anscount[now]+=teki
#             if a[now+1]<=b[now]:
#                 anscount[now+1]=a[now+1]
#                 b[now]-=a[now+1]
#             else:
#                 anscount[now+1]=b[now]
#                 b[now]-=0
#         else:
#             anscount[now]+=b[now]
#             b[now]=0
#     else:
#         now=n-(i//2)
#         teki=a[now]-anscount[now]
#         if teki<=b[now-1]:
#             b[now-1]-=teki
#             anscount[now]+=teki
#             if a[now-1]<=b[now-1]:
#                 anscount[now-1]=a[now-1]
#                 b[now-1]-=a[now-1]
#             else:
#                 anscount[now-1]=b[now-1]
#                 b[now-1]-=0
#         else:
#             anscount[now]+=b[now-1]
#             b[now-1]=0
# print(b)
print(sum(anscount))
# print(anscount)

Measured memory_bytes: 18476
class Card
  def initialize(card)
    @mark = card[0]
    @number = card[1].to_i
  end

  def mark
    @mark
  end

  def number
    @number
  end

  def to_s
    @mark + @number.to_s
  end
end

N = gets.to_i
C = gets.split(" ").map{ |c| Card.new(c) }

def stableSort(c, n)
  sorted_b = bubleSort(c, n).map(&:to_s)
  sorted_s = selectionSort(c, n).map(&:to_s)
  puts sorted_b.join(" ")
  puts "Stable"
  puts sorted_s.join(" ")
  puts (sorted_b == sorted_s ? "Stable" : "Not stable")
end

def selectionSort(a, n)
  a = a.clone
  for i in (0..(n-1)).to_a
    minj = i
    for j in (i..(n-1)).to_a
      if a[j].number < a[minj].number
        minj = j
      end
    end
    if a[i] != a[minj]
      karinobasyo = a[i]
      a[i] = a[minj]
      a[minj] = karinobasyo
    end
  end
  return a
end

def bubleSort(a, n)
  a = a.clone
  flag = 1
  while flag == 1
    flag = 0
    for j in (1..n-1).to_a.reverse
      if a[j].number < a[j-1].number
        karinotoko = a[j]
        a[j] = a[j-1]
        a[j-1] = karinotoko
        flag = 1
      end
    end
  end
  return a
end

stableSort(C, N)


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

#define trav(a, A) for (auto & a : A)
#define f first
#define s second

typedef long long ll;

const ll MOD = 1e+9+7;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const int INF = 0x3f3f3f3f;
const ll MAXN = 1e+5+7;

void solve(){
    double d, t, s;
    cin >> d >> t >> s;
    if (t >= d/s) cout << "Yes\n";
    else cout << "No\n";

}

int main ()
{
	ios_base::sync_with_stdio (0);
	cin.tie (0);
	ll i, j, n;
	int t = 1; //cin >> t;
	while(t--) solve();
	return 0;
}



Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N;
vector<int> G[5050];

i64 MOD = 1e9 + 7;

i64 com[5050];


i64 dp[5050][2][5050];
int sz[5050];

i64 ne[2][5050];

void dfs(int v,int f = -1){
  sz[v] = 2;
  dp[v][0][1] = 1;
  for(int to : G[v]){
    if(to == f) continue;
    dfs(to,v);
    int n = sz[v];
    int m = sz[to];
    for(int i = 0;i < n + m - 1;i++){
      for(int j = 0;j < 2;j++){
        ne[j][i] = 0;
      }
    }
    rep(a,1,n - 1) rep(b,1,m - 1){
      (ne[0][a + b] += dp[v][0][a] * dp[to][0][b] + dp[v][1][a] * dp[to][1][b]) %= MOD;
      (ne[1][a + b] += dp[v][1][a] * dp[to][0][b] + dp[v][0][a] * dp[to][1][b]) %= MOD;
      (ne[0][a] += dp[v][1][a] * dp[to][0][b] % MOD * com[b] + dp[v][0][a] * dp[to][1][b] % MOD * com[b]) %= MOD;
      (ne[1][a] += dp[v][0][a] * dp[to][0][b] % MOD * com[b] + dp[v][1][a] * dp[to][1][b] % MOD * com[b]) %= MOD;
    }
    swap(dp[v],ne);
    sz[v] = n + m - 1;
  }
}
int main(){
  com[2] = 1;
  for(int i = 4;i <= 5000;i+= 2) com[i] = (com[i - 2] + com[i - 2] * (i - 2)) % MOD;
  cin >> N;
  for(int i = 0;i < N - 1;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  i64 ans = 0;
  dfs(0);
  for(int i = 0;i <= N;i += 2){
    (ans += dp[0][0][i] * com[i]) %= MOD;
    (ans -= dp[0][1][i] * com[i] % MOD - MOD) %= MOD;
  }

  cout << ans << endl;
}


Measured memory_bytes: 396416
#include <iostream>
#include <cstdio>
using namespace std;
#define MAXN 100
struct node{
	int data;
	node *lchild, *rchild;
};

int pre[MAXN], in[MAXN], post[MAXN];

node* create(int preL, int preR, int inL, int inR)
{
	if (preL > preR) {
		return NULL;
	}
	node* root = new node;
	root->data = pre[preL];
	int k;
	for (k = inL; k <= inR; k++) {
		if (in[k] == pre[preL]) {
			break;
		}
	}
	int numLeft = k - inL;
	root->lchild = create(preL + 1, preL + numLeft, inL, k-1);
	root->rchild = create(preL + numLeft + 1, preR, k+1, inR);
	return root;
}

int cnt = 0;
void postOrder(node* root)
{
	if (root == NULL) {
		return;
	}
	postOrder(root->lchild);
	postOrder(root->rchild);
	if (cnt) {
		printf(" ");
	}
	cnt++;
	printf("%d", root->data);
}

int main(int argc, char *argv[]) {
	int n;
	scanf("%d", &n);
	int d;
	for (int i = 0; i < n; i++) {
		scanf("%d", &d);
		pre[i] = d;
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &in[i]);
	}
	node* root = create(0, n-1, 0, n-1);
	postOrder(root);
	printf("\n");
	return 0;
}


Measured memory_bytes: 3216
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
ll isPrime(ll x) {
	ll i;
	if (x < 2) {
		return 0;
	}
	else if (x == 2) {
		return 1;
	}
	else if (x % 2 == 0) {
		return 0;
	}
	else {
		for (i = 3; i * i <= x; i += 2) {
			if (x % i == 0) {
				return 0;
			}
		}
		return 1;
	}
}
int main() {
	cin >> N;
	ll p = 3;
	while (N>0) {
		if (isPrime(p) && p%5==1) {
			cout << p << " "; N--;
		}
		p += 2;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
using Graph=vector<vector<int>>;
using edge= struct{int to;ll cost;};


template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}


int main()
{
  int N;
  cin>>N;
  ll H[N];
  REP(i,N)
  {
    cin>>H[i];
  }
  if(H[0]!=0)
  {
    H[0]=H[0]-1;
  }
  REP(i,N-1)
  {
    if(H[i]<H[i+1])
    {
      H[i+1]=H[i+1]-1;
    }
    else if(H[i]>H[i+1])
    {
      cout<<"No"<<endl;
      return 0;
    }
  }
cout<<"Yes"<<endl;
return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int n;
  	cin>>n;
  	int x=n%10;
  	if(x==2 || x==4 || x==5 || x==7 || x==9)
      cout<<"hon";
  	else if(x==3)
      cout<<"bon";
  	else
      cout<<"pon";
 	return 0;
}

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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}
// ===========================================

//Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

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


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int n;
  scanf("%d",&n);
  int i;
  int money;
  int ans;
  money = 1000;
  i = 1000;
  while (money < n)
  {
    money += i;
  }
  ans = money - n;
  printf("%d",ans);
}

Measured memory_bytes: 1736
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a, b;
    cin >>a >>b;
    int x = (a + b) / 2;
    if(a == b)
        cout <<0;
    else if((a < x && b > x && x - a == b - x) || (a > x && b < x && a - x == x - b))
        cout <<x;
    else 
        cout <<"IMPOSSIBLE";
    return 0;
}


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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long h, w;
  cin >> h >> w;
  if (h == 1 || w == 1) cout << 1 << '\n';
  else {
    long long more = (h + 1) / 2;
  	long long less = h - more;
  	cout << more * ((w + 1) / 2) + less * (w - (w + 1) / 2) << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int len, a; cin >> len >> a;
    string s; cin >> s;
    string b;
    transform(s.begin(), s.end(), b.begin(), ::tolower);
    REP(i, len){
        if(i == a - 1) cout << b[a - 1];
        else cout << s[i];
    }
    cout << endl;
}

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


int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int A , B , C , K;
	cin >> A >> B >> C >> K;
	cout<<min(A , K) - max(0ll , K - A - B)<<endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define FORR(i, m, n) for (ll i = m; i >= n; i--)
#define REPO(i, n) for (ll i = 1; i <= n; i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(), n.end()
#define MOD 1000000007
#define P pair<ll, ll>

ll n, d;


int main() {
    ll k;
    cin >> k;
    ll t = 0;
    REP(i, 10000000){
        t = (t * 10 + 7) % k;
        if(t == 0){
            cout << i + 1 << endl;
            return 0;
        }
        
    }
    cout << -1 << endl;
}

Measured memory_bytes: 3632
import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N,K = LI()
A = LI()

sa = list(itertools.accumulate([0]+A))
b = []
for i in range(N):
    for j in range(i+1,N+1):
        b.append(sa[j]-sa[i])
b.sort(reverse=True)
max_b = (max(b)).bit_length()

mask = 0
for i in range(max_b-1,-1,-1):
    bit = 2**i
    cnt = 0
    for x in b:
        if x & mask == mask:
            cnt += (x & bit > 0)
    if cnt >= K:
        mask += bit

print (mask)




Measured memory_bytes: 71544
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

vector<ll> a;
vector<vector<int>> dp;

int calc(int k, int hand){
    const int hi = (hand + 1) / 2;
    if(dp.at(k).at(hi) != 0){
        return dp.at(k).at(hi);
    }
    for(int i = 0; i < a.size(); ++i){
        if(a.at(i) <= k){
            int tmp = calc(k - a.at(i), -1 * hand);
            if(tmp == hand){
                dp.at(k).at(hi) = hand;
                return hand;
            }
        }
    }
    dp.at(k).at(hi) = -1 * hand;
    return -1 * hand;
}

int main(){
    ll n, k;
    cin >> n >> k;
    a.resize(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }

    dp.resize(k + 1, vector<int>(2, 0));
    int ret = calc(k, 1);
    if(ret == 1){
        cout << "First" << endl;
    }else{
        cout << "Second" << endl;
    }
    return 0;
}

Measured memory_bytes: 13568
#include<cstdio>
using namespace std;
long long h,w;
int main()
{
   scanf("%lld%lld",&h,&w);
   if(h==1||w==1)
   return 0*printf("1");
   long long cnt=h*w;
   if(cnt%2==0)
   printf("%lld",cnt/2);
   else if(cnt%2==1)
   printf("%lld",(cnt+1)/2);
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();
		if (a > x) {
			System.out.println("NO");
		} else if (a+b >= x) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 20692
import java.util.*;
import java.io.*;
import java.text.DecimalFormat;
class Main {
	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
	        int n = scan.nextInt();
	        int[] x = new int[n];
	        int[] y = new int[n];
	        for (int i = 0; i < n; i++) {
	            x[i] = scan.nextInt();
	        }
	        for (int i = 0; i < n; i++) {
	            y[i] = scan.nextInt();
	        }
	        double dis1 = 0,dis2 = 0, dis3 = 0, ans = Math.abs(x[0] - y[0]);
	        int dt;
	        for (int i = 0; i < n; i++) {
	            dt = Math.abs(x[i] - y[i]);
	            dis1 += dt;
	            dis2 += Math.pow(dt, 2);
	            dis3 += Math.pow(dt, 3);
	            if (ans < dt)ans = dt;
	        }
	        DecimalFormat f = new DecimalFormat("0.000000");
	        System.out.println( f.format(dis1) + "\n" + f.format(Math.sqrt(dis2))+ "\n" + f.format(Math.cbrt(dis3))+ "\n" + f.format(ans));
	        
		
	}

}  

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12
#define MAX_V 100
#define MAX_M 1000

int d[MAX_V][MAX_V];

int main(void)
{
  int n, m;
  cin >> n >> m;
  REP(i, n) REP(j, n) d[i][j] = INF;
  REP(i, n) d[i][i] = 0;
  int a[MAX_M], b[MAX_M], c[MAX_M];
  REP(i, m) {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--; b[i]--;
    d[a[i]][b[i]] = c[i];
    d[b[i]][a[i]] = c[i];
  }
  REP(k, n) REP(i, n) REP(j, n) {
    d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
  }
  ll ans = 0;
  REP(i, m) {
    if(c[i] > d[a[i]][b[i]]) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
while 1:
    n, x = map(int, input().split())
    if n == x == 0:
        break

    count = 0 
    for i in range(1, n - 1): 
        for j in range(i + 1, n):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    count += 1
    print(count)   

Measured memory_bytes: 7664
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  vector<int> a(4);
  for (int i = 0; i < 4; ++i) a[i] = s[i] - '0';
  for (int k = 0; k < 8; ++k) {
    int sum = a[0];
    for (int i = 0; i < 3; ++i) {
      if (k & (1 << i)) {
        sum += a[i + 1];
      } else {
        sum -= a[i + 1];
      }
      if (sum == 7) {
        cout << a[0];
        for (int j = 0; j < 3; ++j) {
          if (k & (1 << j)) {
            cout << "+";
          } else {
            cout << "-";
          }
          cout << a[j + 1];
        }
        cout << "=7" << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <cstdint>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 1000000007;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T;
    cin >> S >>T;
    int ans = 0;
    for (size_t i = 0; i < S.size(); ++i) {
        if (S[i] != T[i])ans++;
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3736
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;

using namespace std;

int main() 
{   
    ll n; cin >> n;
    v_ll a(n), b(n), c(n);

    irep(i, n) { cin >> a[i]; } sort(a.begin(), a.end());
    irep(i, n) { cin >> b[i]; } sort(b.begin(), b.end()); 
    irep(i, n) { cin >> c[i]; } sort(c.begin(), c.end()); 

    ll ans = 0;
    for(ll i = 0; i < n; i ++) {
        auto A_first = lower_bound(a.begin(), a.end(), b[i]);
        size_t A_pos = distance(a.begin(), A_first);  

        auto C_first = upper_bound(c.begin(), c.end(), b[i]);
        size_t C_pos = distance(c.begin(), C_first);  
        
        ans += (A_pos * (n-C_pos));
    }

    cout << ans << endl;

    return 0;
}
    



Measured memory_bytes: 2560
l = []
for i in range(5):
    x = int(input())
    l.append(x)

min_i = 0
min_rest = 10
times = []
for i, x in enumerate(l):
    rest = x%10
    if rest > 0:
        times.append((x//10)*10+10)
        if rest < min_rest:
            min_i = i
            min_rest = rest
    else:
        times.append(x)

print(sum(times[:min_i])+sum(times[min_i+1:])+l[min_i])

Measured memory_bytes: 3064
#include <cstdio>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>

int main()
{
  int n;
  scanf("%d", &n);
  std::map<long long, long long> m;
  for (int i = 0; i < n; ++i)
  {
    int a;
    scanf("%d", &a);
    m[a]++;
  }
  std::vector<std::pair<long long, long long>> v;
  for (auto &p : m)
  {
    v.emplace_back(p);
  }
  std::sort(v.begin(), v.end(), [](auto a, auto b){ return a.first > b.first; });
  long long A[2] = {0, 0}; int index = 0;
  for (int i = 0; i < v.size();)
  {
    if (v[i].second >= 2 && v[i].first > A[index])
    {
      A[index] = v[i].first;
      v[i].second -= 2;
      if (++index == 2) break;
      continue;
    }
    ++i;
  }
  printf("%lld\n", A[0] * A[1]);
  return 0;
}

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

char Judge(string WordT, string WordH){
	for(int i = 0; i < min(WordT.size(), WordH.size()); i++){
		if(WordT[i] > WordH[i]) return 'T';
		if(WordT[i] < WordH[i]) return 'H';
	}
	if(WordT.size() >  WordH.size()) return 'T';
	if(WordT.size() <  WordH.size()) return 'H';
	if(WordT.size() == WordH.size()) return 'D';
}

int main(){
	//???????????????????????°n????????????
	int n;
	cin >> n;
	//???????????????????????????????????????????????????????????¨????????????????????????
	int PointT = 0;
	int PointH = 0;
	for(int i = 0; i < n; i++){
		string WordT;
		string WordH;
		cin >> WordT >> WordH;
		if(Judge(WordT, WordH) == 'T') PointT += 3;
		if(Judge(WordT, WordH) == 'D') PointT++, PointH++;
		if(Judge(WordT, WordH) == 'H') PointH += 3;
	}
	//????¨????????????¨?????????
	cout << PointT << " " << PointH << endl;
	return 0;
}

Measured memory_bytes: 1216
# ABC141C - Attack Survival  (w/o Counter)
def main():
    N, K, Q, *A = map(int, open(0).read().split())
    ans, C = [], [0] * (N + 1)
    for i in A:
        C[i] += 1
    for i in C[1:]:
        x = "Yes" if K - Q + i > 0 else "No"
        ans.append(x)
    print("\n".join(ans))


if __name__ == "__main__":
    main()

Measured memory_bytes: 13940
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long ;

int main(){
    string s ;
    cin >> s ;
    ll k ;
    cin >> k ;
    for(int i=0;i<(int)s.size();i++){
        if ( s[i] == '1' ){
            if ( i + 1 == k ) {
                cout << s[i] << endl;
                return 0 ;
            }
        }
        else{
            cout << s[i] << endl;
            return 0 ;
        }

    }
    return 0 ;
}


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

int main(){
  int h,n; cin >> h >> n;
  int a[n];
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  int total=0;
  for(int i=0;i<n;i++){
    total += a[i];
  }
  if(h-total <= 0 ){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }
}

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

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

   sort(s.begin(), s.end());

   if (s[0] != s[1] || s[1] != s[2]) {
       cout << "Yes" << endl;
   } else {
       cout << "No" << endl;
   }
}

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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

vector<vector<ll> >F,P;
ll MAX=-(1<<30);
int N;
vector<int>check;

void func(int bit){
   map<int,int>M;
   for(int i=0;i<N;i++){
      for(int j=0;j<10;j++){
         if((bit>>j&1) && F[i][j]){
               //check[j]++;
               M[i]++;
         }
      }
   }
   ll res=0;
   for(int i=0;i<N;i++){
      res+=P[i][M[i]];
   }
   MAX = max(MAX,res);
   return;
}

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

   cin>>N;
   F.resize(N,vector<ll>(10));
   P.resize(N,vector<ll>(11));
   check.resize(N);
   for(int i=0;i<N;i++){
      for(int j=0;j<10;j++){
         cin >> F[i][j];
      }
   }
   for(int i=0;i<N;i++){
      for(int j=0;j<=10;j++){
         cin >> P[i][j];
      }
   }

   for(int i=1;i<(1<<10);i++){
      func(i);
   }

   cout<<MAX<<endl;
   return 0;

}


Measured memory_bytes: 256
#include<cstdio>
#include<complex>
#define Re real()
#define Im imag()
using namespace std;
typedef complex<double> Point;
typedef Point Vector;

double dot(const Point& a, const Point& b)
{
    return (conj(a)*b).Re;
}

int main()
{
    int vol;
    double x1,x2,y1,y2;
    while(~scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2))
    {
        Point p0 = Point(x1,y1),p1 = Point(x2,y2);
        Vector v0 = p1 - p0;
        scanf("%d",&vol);
        while(vol--)
        {
            double tx,ty;
            scanf("%lf%lf",&tx,&ty);
            Point Pn = Point(tx,ty);
            Vector v1 = Pn - p0;
            Point Pt = dot(v0,v1)*v0/norm(v0) + p0;
            printf("%.10f %.10f\n",Pt.Re,Pt.Im);
        }
    }
    return 0;
}

Measured memory_bytes: 1116
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))
    factors = [ factor-k for factor,k in zip(a, range(1,n+1)) ]
    factors.sort()
    index = (n//2)
    ans = sum([ abs(factor-factors[index]) for factor in factors ])
    print(ans)


Measured memory_bytes: 26836