akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

typedef long long ll;

ll a[100005];

int main() {
  int n;
  scanf("%d",&n);
  for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
  sort(a+1,a+n+1);
  if (!(n&1)) {
  	ll ans=0;
  	for(int i=1;i<=(n>>1);i++) ans-=2LL*a[i];
  	for(int i=(n>>1)+1;i<=n;i++) ans+=2LL*a[i];
  	ans+=a[(n>>1)];
  	ans-=a[(n>>1)+1];
  	printf("%lld\n",ans);
  }
  else {
  	if (n==1) {
  		puts("0");
  		return 0;
	  }
  	ll ans1=0;
  	for(int i=1;i<=(n>>1);i++) ans1-=2LL*a[i];
  	for(int i=(n>>1)+1;i<=n;i++) ans1+=2LL*a[i];
  	ans1-=a[(n>>1)+1]+a[(n>>1)+2];
  	ll ans2=0;
  	for(int i=1;i<=(n>>1)+1;i++) ans2-=2LL*a[i];
  	for(int i=(n>>1)+2;i<=n;i++) ans2+=2LL*a[i];
  	ans2+=a[(n>>1)]+a[(n>>1)+1];
  	printf("%lld\n",max(ans1,ans2));
  }
  return 0;
}

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

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

	int n,x;
	cin>>n;
	int b[n+1];
	for(int i=1;i<=n;i++){
		cin>>b[i];
	}
	vector<int> res;
	res.resize(n);
	res[0]=0;
	int flag=1;
	for(int i=n;i>0;i--){
		x=0;
		for(int j=i;j>0;j--){
			// cout<<j<<" "<<b[j]<<"\n";
			if(b[j]==j){
				x=j;
				break;
			}
		}
		if(x==0) flag=0;
		res[i]=x;
		for(int j=x;j<i;j++){
			b[j]=b[j+1];
		}
	}
	if(flag==0) cout<<"-1\n";
	else{
		for(int i=1;i<=n;i++){
			cout<<res[i]<<"\n";
		}
	}
	return 0;
}

Measured memory_bytes: 256
import numpy as np

N,K = map(int,input().split())

al = []
bl = []

for i in range(N):
	a,b = map(int, input().split())
	al.append(a)
	bl.append(b)

al = np.array(al)
bl = np.array(bl)

s = al.argsort()

bl = bl[s]
al = al[s]

c = 0

for a,b in zip(al,bl):
	c += b
	if c >= K:
		print(a)
		break




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

namespace ConsoleApplication6
{

    class Program
    {
        static string alfa = "abcdefghijklmnopqrstuvwxyz";
        static void Main(string[] args)
        {

            var ret = string.Empty;
            var num = c2i(RL())-1;
            var ls = new List<int>();

            while (num >= 0)
            {
                ls.Add((int)(num % 26));
                num = num/26-1;
            }
            
            for (int i = ls.Count; i > 0; i--)
            {
                ret += alfa[ls[i - 1]];
            }

            Console.WriteLine(ret);
            Console.ReadLine();

        }

        static IEnumerable<Int64> RL2IE() { return spr(RL()).Select(x => c2i(x)); }
        static string RL() { return Console.ReadLine().Trim(); }
        static IEnumerable<string> spr(string s) { return s.Split(' '); }
        static Int64 c2i(string c) { return Int64.Parse(c); }
        //static double c2d(string c) { return double.Parse(c); }
        static string bool2ret(bool b) { return b ? "Yes" : "No"; }
    }
}


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

int main(){
    int x, y;
  cin >> x >> y;
  if (x == 2 || y == 2) {
    cout << "No" << endl;
  }
  else if (x == 4 || x == 6 || x == 9 || x == 11) {
    if (y == 4 || y == 6 || y == 9 || y == 11) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
    else {
      if (y == 4 || y == 6 || y == 9 || y == 11) {
        cout << "NO" << endl;
      }
        else {
          cout << "Yes" << endl;
        }
      }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>  
#include <cstdlib>
#include <limits>
#include <numeric>
#include <type_traits>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++) 

int main() {
    string s;
    cin >> s;
    int n = s.length();
    rep(i,n) {
        if(i%2==0) {
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  int v;
  map<int, int> v1, v2;
  for(int i = 0; i < n; i++){
    cin >> v;
    if(i % 2 == 0) v1[v]++;
    else v2[v]++;
  }
  
  int odd1 = 0, odd2 = 0, even1 = 0, even2 = 0;
  for(int i = 1; i <= 1e5; i++){
    if(v1[i] > v1[odd2]){
      if(v1[i] > v1[odd1]){
        odd2 = odd1;
        odd1 = i;
      }
      else{
        odd2 = i;
      }
    }
    if(v2[i] > v2[even2]){
      if(v2[i] > v2[even1]){
        even2 = even1;
        even1 = i;
      }
      else{
        even2 = i;
      }
    }
  }
  
  if(odd1 == even1){
    cout << min(n - v1[odd2] - v2[even1], n - v1[odd1] - v2[even2]) << '\n';
  }
  else{
    cout << n - v1[odd1] - v2[even1] << '\n';
  }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<string> A(N);
  vector<string> B(M);
  for (auto &v : A) cin >> v;
  for (auto &v : B) cin >> v;
  
  bool b = false;
  vector<string> isB;
  for (int i = 0; i < N-M+1; i++) {
    for (int j = 0; j < N-M+1; j++) {
      for (int k = 0; k < M; k++) {
        string s = A[i+k].substr(j,M);
        isB.push_back(s);
      }
      if (isB == B) b = true;
      else isB.clear();
    }
  }
  cout << (b ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#define mod 1000000007
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed()
{
	long long a = rng();
    return a;
}
int n;
vector<int>v[100002];
long long dp[2][100002];
void dfs(int dad, int nod)
{
    dp[0][nod] = dp[1][nod] = 1;
    for(int i = 0; i < v[nod].size(); ++i)
    {
        int vecin = v[nod][i];
        if(vecin != dad)
        {
            dfs(nod, vecin);
            dp[0][nod] = (dp[0][nod] * (dp[0][vecin] + dp[1][vecin])) % mod;
            dp[1][nod] = (dp[1][nod] * dp[0][vecin]) % mod;
        }
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    for(int i = 1; i < n; ++i)
    {
        int a, b;
        cin >> a >> b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(0, 1);
    cout << (dp[0][1] + dp[1][1]) % mod;
    return 0;
}



Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int x, y, n1, n2, n3, i, j;
	cin >> x >> y >> n1 >> n2 >> n3;
	int a[n1], b[n2], c[n3];
	
	fo(i, 0, n1)
	cin >> a[i];
	fo(i, 0, n2)
	cin >> b[i];
	fo(i, 0, n3)
	cin >> c[i];
	
	sort(a, a + n1, greater <int>());
	sort(c, c + n3, greater <int>());
	
	i = j = 0;
	ll sum = 0;
	int cnt = 0;
	while(i < n1 && j < n3 && cnt < x) {
		if(a[i] >= c[j]) {
			sum += a[i];
			++i;
		}
		else {
			sum += c[j];
			++j;
		}
		cnt++;
	}
	int curr = j;
	vector <pii> v;
	for(; i < n1; i++)
	v.pb({a[i], 1});
	for(i = 0; i < n2; i++)
	v.pb({b[i], 2});
	for(; j < n3; j++)
	v.pb({c[j], 3});
	
	sort(all(v), greater <pii>());
	cnt = 0;
	int c1 = 0;
	for(i = 0; i < v.size() && cnt < y; i++) {
		pii p = v[i];
		if(p.s != 1)
		sum += p.f;
		else {
			if(c1 == curr) continue;
			else {
				sum += p.f;
				c1++;
			}
		}
		cnt++;
	}
	cout << sum;
}


Measured memory_bytes: 7664
#include<iostream>
#include<cmath>
#define Min min((x[loop] - x[loop - 1])*A, B)
#define max (int)pow(10,9)
using namespace std;

int min(int, int);

int main(){
	long long int N, A, B;
	long long int x[100000];
	int loop;
	long long int ans = 0;
	int ans2 = 0;

	cin >> N >> A >> B;
	for (loop = 0; loop < N; loop++)cin >> x[loop];

	for (loop = 1; loop < N; loop++){
		ans += Min%max;
	}
	if (ans2 != 0)cout << ans2;
	cout<< ans << "\n";
	return 0;
}

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

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

using namespace std;

int main() {
  long long a, b ,c;
  cin >> a >> b >> c;
  int count = 0;
  while(a%2 == 0 && b%2 == 0 && c%2 == 0) {
    long long aa = 0, bb = 0, cc = 0;
    aa = b/2 + c/2;
    bb = c/2 + a/2;
    cc = a/2 + b/2;
    a= aa; b = bb; c= cc;
    count++;

    if(count > 1000000) {cout << -1 << endl; return 0;}
  }
  cout << count << endl;
}


Measured memory_bytes: 256
import math
import itertools
from functools import reduce

def sangcd(i,j,k):
    return reduce(math.gcd, [i,j,k])

K = int(input())
Ans = 0
for i in itertools.product(range(1,K+1), repeat=3):
    Ans += sangcd(i[0],i[1],i[2])

print(Ans)

Measured memory_bytes: 69016
n, m = input().split()
n = int(n)
m = int(m)
if n >= 2:
    n = int(n * (n-1) / 2)
else:
    n = 0

if m >= 2:
    m = int(m * (m-1) / 2)
else:
    m = 0

print(n+m)

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

int main(){
	long long a, b, c;
  	cin >> a >> b >> c;
  
  	long long d = c - a - b;
  
	if(d > 0 && d * d > 4 * a * b){
    	cout << "Yes" << endl;
    } else {
    	cout << "No" << endl;
    }
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val map = mutableMapOf<String, Int>()
    map["AC"] = 0
    map["WA"] = 0
    map["TLE"] = 0
    map["RE"] = 0
    repeat(n) {
        val s = readLine()!!
        val v = map[s]!!
        map[s] = v+1
    }
    println("AC x ${map["AC"]}")
    println("WA x ${map["WA"]}")
    println("TLE x ${map["TLE"]}")
    println("RE x ${map["RE"]}")
}



Measured memory_bytes: 59096
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007LL;

string S;
ll dp[100010][13];

int main ()
{
    cin >> S;

    dp[0][0] = 1LL;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '?') {
            for (ll t = 0; t <= 9; t++) {
                for (int j = 0; j < 13; j++) {
                    dp[i + 1][(j * 10 + t) % 13] += dp[i][j];
                    dp[i + 1][(j * 10 + t) % 13] %= MOD;
                }
            }
        } else {
            ll t = S[i] - '0';
            for (int j = 0; j < 13; j++) {
                dp[i + 1][(j * 10 + t) % 13] += dp[i][j];
                dp[i + 1][(j * 10 + t) % 13] %= MOD;
            }
        }
    }

    cout << dp[S.size()][5] << endl;

    return 0;
}


Measured memory_bytes: 10624
#include <bits/stdc++.h>
#define npos std::string::npos
typedef long long ll;
using namespace std;
int main()
{
	int n, k; 
  	string s;
  	cin >> n >> k >> s;
  	s[k - 1] += 'a' - 'A';
  	cout << s << endl;
}



Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int A, B, nQuery;

ll as[100000+10];
ll bs[100000+10];

int main(void) {
  scanf("%d%d%d", &A, &B, &nQuery);
  REP(i, A) {
    scanf("%lld", &as[i]);
  }
  REP(i, B) {
    scanf("%lld", &bs[i]);
  }
  REP(iQuery, nQuery) {
    ll start;
    scanf("%lld", &start);
    ll res = 1000000000000000000LL;
    REP(fromA, 2) {
      REP(leftA, 2) {
        REP(leftB, 2) {
          ll cur = 0, first, second;
          if(fromA) {
            int idx = lower_bound(as, as + A, start) - as;
            if(leftA) --idx;
            if(idx < 0 || A <= idx) continue;
            first = as[idx];
          } else {
            int idx = lower_bound(bs, bs + B, start) - bs;
            if(leftB) --idx;
            if(idx < 0 || B <= idx) continue;
            first = bs[idx];
          }
          cur += abs(start - first);
          if(fromA) {
            int idx = lower_bound(bs, bs + B, first) - bs;
            if(leftB) --idx;
            if(idx < 0 || B <= idx) continue;
            second = bs[idx];
          } else {
            int idx = lower_bound(as, as + A, first) - as;
            if(leftA) --idx;
            if(idx < 0 || A <= idx) continue;
            second = as[idx];
          }
          cur += abs(first - second);
          res = min(res, cur);
        }
      }
    }
    printf("%lld\n", res);
  }
  return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
const ll MOD = 1e9+7;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second


const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
template<typename T>
T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T>
T ngcd(vector<T> a){
    T res;
    res = a[0];
    for(int i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}
 
template<typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

template<typename T>
T nlcm(vector<T> numbers) {
    T res;
    res = numbers[0];
    for (int i = 1; i < numbers.size(); i++) {
        res = lcm(res, numbers[i]);
    }
    return res;
}


// 素数判定
template<typename T>
bool isPrime(T x){
    T i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
};

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}



// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}


using pint = pair<int, int>;
using pll = pair<ll, ll>;

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> p(n);
    cins(all(p));
    sort(rall(p));
    p[0] /= 2;
    int ans = 0;
    rep(i, n) ans += p[i];
    print(ans);
}


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

int main(void){
    int S,W;
    cin >> S >> W;
    if(W >= S) cout << "unsafe" << endl;
    else cout << "safe" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <numeric>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10
#define MAX_N 20000
#define MAX_M 16

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
string s;
char c;

map<string,int> mp;
map<string, int>::iterator it;
vector< pair<int, string> > vis;

bool flag(pair<int,string> a,pair<int,string> b){
	if (a.first == b.first)return a.second < b.second;
	return a.first > b.first;
}

int main(){
	while (cin >> n&&n){
		vis.clear();
		mp.clear();
		cin.ignore();
		REP(i, n){
			getline(cin, s);
			stringstream ss;
			string buf;
			ss << s;
			while (ss >> buf){
				mp[buf]++;
			}
		}
		cin >> c;
		it = mp.begin();
		while (it != mp.end()){
			vis.push_back(make_pair((*it).second, (*it).first));
			it++;
		}
		sort(ALL(vis), flag);
		int co = 0;
		REP(i, vis.size()){
			if (co >= 5)break;
			if (vis[i].second[0] == c){
				if (co == 0)cout << vis[i].second;
				else cout << " " << vis[i].second;
				co++;
			}
		}
		if (co == 0)cout << "NA" << endl;
		else cout << endl;
	}
}

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

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

using namespace std;

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

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...) 42
#define dump(x) 42
#define debug(x) 42
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

void solve(ll N) {
    ll answer = 0;

    ll maxRemainder = ceil(sqrt(N));
    REP(i,1,maxRemainder+1) {
        if (N % i != 0) continue;
        ll m = N / i - 1;
        if (m <= i) continue;
        answer += m;
    }

    cout << answer << '\n';

    return;
}

signed main() {
    ll N;
    cin >> N;
    solve(N);
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
int main()
{
    fastRead;
    int n;
    cin>>n;
    vector<int>fre(MAX);
    ll sum = 0;
    for(int i =0 ; i < n ; i++ ) {
        int tmp;
        cin>>tmp;
        sum += tmp;
        fre[tmp]++;
    }
    
    int q;
    cin>>q;
    while(q--) {
        int b, c;
        cin>>b>>c;
        sum -= 1LL*b*fre[b];
        sum += 1LL*c*fre[b];
        fre[c] += fre[b];
        fre[b] = 0;
        cout<<sum<<'\n';
    }
    return 0;
}

Measured memory_bytes: 7136
#!/usr/bin/env python3
import bisect


N = int(input().split()[0])
l_list = list(map(int, input().split()))
l_list = sorted(l_list)
total = 0

for a_i, a in enumerate(l_list):
    # 一番長い辺を固定
    for b_i, b in enumerate(l_list[:a_i]):
        # 2番目に長い辺を固定
        c_i = bisect.bisect_right(l_list, abs(a - b))
        total += max(b_i - c_i, 0)

ans = total
print(ans)


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
		// solver.solve();
	}
}

class Solver {
	int N;
	int P;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		P = Integer.parseInt(strArr[1]);
		// System.out.println(N);
	}

	public boolean hasNext() {
		// return cnt < N;
		return cnt < 1;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
		String[] strArr = str.split(" ");
		int evenCnt = 0;
		int oddCnt = 0;
		for (int i = 0; i < N; i++) {
			int a = Integer.parseInt(strArr[i]);
			if (a % 2 == 0)
				evenCnt++;
			else
				oddCnt++;
		}
		// System.out.println(evenCnt + " " + oddCnt);

		if (P == 1 && evenCnt == 0) {
			System.out.println(0);
			return;
		}

		mem = new long[N + 1][N + 1];

		long evenCombi = 0;
		for (int i = 0; i <= evenCnt; i++) {
			evenCombi += combin(evenCnt, i);
		}
		long oddCombi = 0;
		for (int i = 0; i <= oddCnt; i++) {
			if (i % 2 == P)
				oddCombi += combin(oddCnt, i);
		}
		long ans = evenCombi * oddCombi;

		System.out.println(ans);

	}

	long mem[][];

	private long combin(int t, int c) {
		if (t == c)
			return (1);
		else if (c == 0)
			return (1);
		else if (c == 1)
			return (t);
		if (mem[t][c] > 0)
			return mem[t][c];
		mem[t][c] = combin(t - 1, c - 1) + combin(t - 1, c);
		return mem[t][c];
	}

	public void solve() {

	}
}


Measured memory_bytes: 21332
/*
Author: Babin Dutta
*/

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define endl "\n"
#define inf 1e18

void solve(){
	int n, k; cin>>n>>k;
	int a[2*k];
	f(i,k) cin>>a[i];
	f(i,k) a[i+k] = a[i] + n;
	ll ans = inf;
	for(int i=k-1;i<2*k;i++){
		if(a[i]-a[i-k+1] < ans) ans = a[i] - a[i-k+1];
	}
	cout<<ans<<endl;
}

int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

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

const double pi = 3.14159265358979323846;

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double x1, y1, x2, y2, ans;
  h = h + m/60.0;
  x1 = a * sin(-pi*h/6.0);
  y1 = a * cos(-pi*h/6.0);
  x2 = b * sin(-pi*m/30.0);
  y2 = b * cos(-pi*m/30.0);
  ans = pow(pow(x2-x1,2.0)+pow(y2-y1,2.0),0.50);
  cout << fixed << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 4224
# coding: utf-8
# Your code here!
A,B=map(int,input().split())
def mon(A,B):
    while True:
        for i in range(1,4):
            if A*B*i%2==1:
                return 'Yes'
                break
        return 'No'
        break

print(mon(A,B))

Measured memory_bytes: 2940
N = int(input())
XY = [tuple(float(s) for s in input().split(' ')) for _ in range(N)]

total = 0.0
count = 0.0
for i in range(N):
  for j in range(i+1, N):
    length = ((XY[i][0] - XY[j][0])**2
              +(XY[i][1] - XY[j][1])**2)**0.5
#    print(i,j,length)
    count += 1
    total += length
mean = total/count
#print(total, count, mean)
print(mean * (N-1))

Measured memory_bytes: 38256
#include<limits>
using ll=long long;constexpr int INF=std::numeric_limits<int>::max()/2;constexpr ll LNF=std::numeric_limits<ll>::max()/2;constexpr double EPS=1e-8;constexpr int DX[]={1,0,-1,0,1,1,-1,-1};constexpr int DY[]={0,1,0,-1,-1,1,1,-1};
#ifdef PA_DEBUG
#define PD(stmt)stmt
#else
#define PD(stmt)
#endif
#include<iostream>
#include<vector>
namespace pcl{namespace utility{template<typename T>std::ostream&operator<<(std::ostream&os,std::vector<T>const&v){os<<'[';for(size_t i=0;i<v.size();i++){if(i!=0)os<<",";os<<v[i];}os<<']';return os;}template<typename T>std::istream&operator>>(std::istream&is,std::vector<T>&v){for(size_t i=0;i<v.size();i++)is>>v[i];return is;}}}using namespace pcl::utility;
#include<bits/stdc++.h>
using namespace std;int main(){int a,b;cin>>a>>b;int N=b-a;int total=0;for(int i=1;i<N;i++){total+=i;}total-=a;cout<<total<<endl;}

Measured memory_bytes: 256
dish = []
r    =[]
time = 0

for i in range(5):
	dish.append(int(input()))
#print("dish = " + str(dish))

for i in range(5):
	r.append((dish[i]-1)%10 + 1)
#print("r = " + str(r))

minr = min(r)
#print("minr = " + str(minr))

ind = r.index(min(r))
#print("ind = " + str(ind))

resdish = dish.pop(ind)
#print("resdish = " + str(resdish))
#print("dish = " + str(dish))
for i in range(4):
#	print(  ( (dish[i]-1)//10 )*10+10)
	time += ( (dish[i]-1)//10 )*10+10

time += + resdish
print(int(time))


Measured memory_bytes: 3064
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {
            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

       
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = Read();
            long ans = 0;
            for (int i = 1; i <=n; i++)
            {
                if (i % 3 != 0 && i % 5 != 0) ans += i;
            }

            Console.WriteLine(ans);






            Console.Out.Flush();
        }
    }
}


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

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		String str=in.next();int q=in.nextInt();
		char[] C=str.toCharArray();
		
		for(int i=0;i<q;i++) {
			String odr=in.next();
			if(odr.equals("print")) {
				int s=in.nextInt(),e=in.nextInt();
				for(int j=s;j<=e;j++)out.print(C[j]);
				out.println();
			}
			else if(odr.equals("reverse")) {
				int s=in.nextInt(),e=in.nextInt();
				char[] rev=new char[e-s+1];
				for(int j=0;j<=e-s;j++)rev[j]=C[e-j];
				for(int j=0;j<=e-s;j++)C[s+j]=rev[j];
			}
			else if(odr.equals("replace")) {
				int s=in.nextInt(),e=in.nextInt();
				char[] rep=in.next().toCharArray();
				for(int j=0;j<=e-s;j++)C[s+j]=rep[j];
			}
		}
		out.flush();
	}

}



Measured memory_bytes: 29168
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n,k;
  while(cin >> n >> k,n+k) {
    int a[n];
    REP(i,n) {
      cin >> a[i];
    }
    int s = 0;
    REP(i,k) {
      s += a[i];
    }
    int res = s;
    for(int i=k; i<n; ++i) {
      s -= a[i-k]; s+= a[i];
      res = max(res, s);
    }
    cout <<res << endl;
  }

}

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

void q_sort(const std::vector<long long> &vec,std::vector<size_t> &index,int first,int last){
	if(last-first<1){
		return;
	}
	int i=first,j=last;
	for(size_t pivot=first;;i++,j--){
		while(vec[index[i]]<vec[index[pivot]]){
			i++;
		}
		while(vec[index[j]]>vec[index[pivot]]){
			j--;
		}
		if(i>=j){
			break;
		}
		size_t p=index[j];
		index[j]=index[i];
		index[i]=p;
	}
	q_sort(vec,index,first,i-1);
	q_sort(vec,index,j+1,last);
}

int main(){
	//入力機構
	size_t N,M;
	std::cin>>N>>M;
	std::vector<long long> X,Y,Z;//10,000,000,000の値が入りintだとオーバーする可能性大。
	X.reserve(N);
	Y.reserve(N);
	Z.reserve(N);
	for(size_t i=0;i<N;i++){
		long long x,y,z;
		std::cin>>x>>y>>z;
		X.push_back(x);
		Y.push_back(y);
		Z.push_back(z);
	}

	//処理機構
	long long ans=0;
	long long xAns,yAns,zAns;//それぞれ(綺麗さの合計),(おいしさの合計),(人気度の合計)を指す
	std::vector<long long> vec;//N個の配列を用意
	vec.reserve(N);
	for(size_t i=0;i<N;i++){
		vec.push_back(0);
	}
	std::vector<size_t> index;
	index.reserve(N);
	for(size_t i=0;i<N;i++){
		index.push_back(0);
	}
	//xAns,yAns,zAnsの全ての正負について考える。計8パターン。
	int pattern[8][3]={{-1,-1,-1},{-1,-1,1},{-1,1,-1},{-1,1,1},{1,-1,-1},{1,-1,1},{1,1,-1},{1,1,1}};
	for(size_t i=0;i<8;i++){
		//各合計を記入
		for(size_t j=0;j<N;j++){
			vec[j]=X[j]*pattern[i][0]+Y[j]*pattern[i][1]+Z[j]*pattern[i][2];
		}
		//vecが大きい順にindexをソート
		for(size_t j=0;j<N;j++){
			index[j]=j;
		}
		q_sort(vec,index,0,N-1);
		xAns=0;
		yAns=0;
		zAns=0;
		for(size_t j=0;j<M;j++){
			xAns+=X[index[j]]*pattern[i][0];
		}
		for(size_t j=0;j<M;j++){
			yAns+=Y[index[j]]*pattern[i][1];
		}
		for(size_t j=0;j<M;j++){
			zAns+=Z[index[j]]*pattern[i][2];
		}
		long long pal=std::abs(xAns)+std::abs(yAns)+std::abs(zAns);
		if(ans<pal){
			ans=pal;
		}
	}

	//出力機構
	std::cout<<ans<<std::endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,x,t,p,sum=0,i;
    string s;
   cin>>s;
   for(i=0; s[i]!='\0'; i++)
   {
       sum=sum+(s[i]-48);
   }
   if(sum%9==0)
   {
       cout<<"Yes";
   }
   else
    cout<<"No";
}





Measured memory_bytes: 3728
use std::io;
use std::io::Read;

fn main () {
    let mut lines = String::new();
    io::stdin().read_to_string(&mut lines).unwrap();

    let mut results = String::new();
    for line in lines.split('\n') {
        if line == "" {
            break;
        }
        let mut line_iter = line.split_whitespace();
        let n: u64 = line_iter.next().unwrap().parse().unwrap();
        let m: u64 = line_iter.next().unwrap().parse().unwrap();

        let result = match (n, m) {
            (1, 1) => 1,
            (1, m) => m - 2,
            (n, 1) => n - 2,
            (n, m) => (n - 2) * (m - 2)
        };
        results += &format!("{}\n", result);
    }
    println!("{}", results);
}

Measured memory_bytes: 4352
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        int n = std.nextInt();
        int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = std.nextInt();
        }

        PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = 0; i < n; i++) {
            pq.add(p[i]);
        }


        int ans = 0;
        int max = pq.poll();
        ans += max / 2;

        while (!pq.isEmpty()) {
            ans += pq.poll();
        }

        System.out.println(ans);
    }
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    string ans;
    rep (i, 3) {
        ans += S[i];
    }

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

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  string S; cin >> S;
  string T; cin >> T;

  int N_S = S.size();
  int N_T = T.size();
  vector<vector<int>> dp(N_S + 10, vector<int>(N_T + 10, 0));
  dp[0][0] = dp[0][1] = dp[1][0] = 0;
  for (int i = 0; i < N_S; ++i){
    for (int j = 0; j < N_T; ++j){
      if (S[i] == T[j]) chmax(dp[i + 1][j + 1], dp[i][j] + 1);
      else chmax(dp[i + 1][j + 1], dp[i][j]);
      chmax(dp[i + 1][j + 1], dp[i + 1][j]);
      chmax(dp[i + 1][j + 1], dp[i][j + 1]);
    }
  }
  string ans = "";
  int i = (int)S.size(), j = (int)T.size();
  while (i > 0 && j >> 0){
    // (i, j + 1) -> (i + 1, j + 1)
    if (dp[i][j] == dp[i - 1][j]) --i;
    // (i + 1, j) -> (i + 1, j + 1)
    else if (dp[i][j] == dp[i][j - 1]) --j;
    // (i, j) -> (i + 1, j + 1)
    else {
      ans = S[i - 1] + ans;
      --i, --j;
    }
  }
  //cout << dp[N_S][N_T] << endl;
  cout << ans << endl;
}


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

int main()
{
    double a, b, h, m;
    cin >> a >> b >> h >> m;
    h *= 30;
    h += 0.5*m;
    m *= 6;
    double x = abs(h - m);
    x *= M_PI/180.0;
    //cout << x << endl;
    double ans;
    //cout << cos(x) << endl;
    ans = pow(a, 2) + pow(b, 2) - 2.0*a*b*cos(x);
    //cout << ans << endl;
    printf("%.16f\n", pow(ans, 0.5));
    return 0;
}


Measured memory_bytes: 4376
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	map<long long, int> d;
	for(int i = 0; i < n; i++){
		long long a;
		cin >> a;
		d[a]++;
	}
	int m;
	cin >> m;
	map<long long, int> t;
	for(int i = 0; i < m; i++){
		long long a;
		cin >> a;
		t[a]++;
	}
	bool yes = true;
	for(auto p : t){
		if(p.second > d[p.first]) yes = false;
	}
	if(yes) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 25216
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	public static void main(String[] args) {
		StringBuffer S = new StringBuffer(sc.next());
		boolean x=true;
		int a=S.indexOf("A");
		if(a==-1) {
			x=false;
		}
		int b=S.lastIndexOf("Z");
		if(b<a)x=false;
		//p(a+" "+b);
		if(x)p(b-a+1);
		else p(0);
		
	}

	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


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

int main(){
  string s;
  cin >> s;
  if(s[0]==s[1] || s[1]==s[2] || s[2]==s[3]){
    cout << "Bad" << endl;
  }
  else cout << "Good" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long int
#define fi first
#define se second
#define pub push_back
#define mkp make_pair
#define pi pair<int,int>
#define all(v) (v).begin(), (v).end()
#define rep(i, l, r) for(int i=(int)(l);i<(int)(r);i++)
#define repd(i, l, r) for (int i=(int)(l);i>=(int)(r);i--)
int power(int x, unsigned int y){int res = 1;while (y > 0){ if (y & 1){res = res*x;} y = y>>1;x = x*x;}return res;}
int powermod(int x, unsigned int y, int p){int res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1; x = (x*x) % p;}return res;}
#define print2d(mat,n,m){for(int i=0;i<(int)(n);i++){for(int j=0;j<(m);j++){cout<<mat[i][j]<<" ";}cout<<endl;}}
#define print1d(mat,n){for(int i=0;i<(int)(n);i++)cout<<mat[i]<<" ";cout<<endl;}
#define clr(a,x) memset(a,x,sizeof(a))
#define rr(v) for(auto &val:v)
#define printpair(v) for(auto val: v){cout<<val.fi<<":"<<val.se<<", ";}cout<<endl;
#define print(v) for (const auto itr : v){cout<<itr<<' ';}cout<<endl;
#define init(v,x) for (auto &itr:v){itr=x;}
#define ln length()
const int mod = 1e9+7;
#define sz size()
const int inf = 1e18;
int n;
int dp[1000005][2][2];
int f(int i, int nine, int zero){
//    cout<<i<<endl;
    if(i==n){
        if(nine==1 and zero==1){
            return 1;
        }
        else{
            return 0;
        }
    }

    if(dp[i][zero][nine]!=-1){
        return dp[i][zero][nine];
    }
    int s=0;
    rep(j,0,10){
        if(j==9){
            s+=f(i+1,1,nine);
            s%=mod;
        }
        else if(j==0){
            s+=f(i+1,zero,1);
            s%=mod;
        }
        else{
            s+=f(i+1,zero,nine);
            s%=mod;
        }


    }
//    cout<<i <<  "  "<<s<<endl;
    dp[i][zero][nine]=s;
    return s;

}
void solve() {
    clr(dp,-1);
    cin>>n;
    cout<<f(0,0,0)<<endl;
}

int32_t main(){
    fastIO
    int t=1;
//    cin>>t;
    while(t--){
        solve();
//        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 112896
#include"bits/stdc++.h"
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int count = 2;
	if (a != b && b != c && c != a) {
		count = 3;
	}
	else if (a == b && b == c) {
		count = 1;
	}
	cout << count << endl;
	return 0;
}

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

using namespace std;

int main() {
	string str;
	cin >> str;
	int g = 0;
	for (int i = 0; i < str.size(); i++) {
		if (str[i] == '9')g++;
	}
	if (g > 0)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main (void) {
    int i;
    int X, Y, N, M;

    scanf("%d%d%d%d", &N, &M, &X, &Y);

    int x[N], y[M], x_max=X, y_min=Y;
    for ( i=0; i<N; i++ ) {
        scanf("%d", &x[i]);
        if ( x[i] > x_max )
            x_max = x[i];
    }
    for ( i=0; i<M; i++ ) {
        scanf("%d", &y[i]);
        if ( y[i] < y_min )
            y_min = y[i];
    }

    if ( x_max < y_min )
        printf("No War\n");
    else
        printf("War\n");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include<stdio.h>
int max(int a,int b)
{
    if(a>=b)
    {
        return a;
    }
    if(b>a)
    {
        return b;
    }
}
int main()
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(c>=a && c<=b)
{
printf("Yes");
}
else
{
    printf("No");
}
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int main()
{
	int N, K, Q; scanf("%d%d%d", &N, &K, &Q);
	int table[100001]; fill(table, table + N, 0);
	for (int i = 0; i < Q; i++){
		int val; scanf("%d", &val);
		table[val - 1]++;
	}
	for (int i = 0; i < N; i++){
		if (table[i] + K - Q>0){
			printf("Yes\n");
		}
		else{
			printf("No\n");
		}
	}

	return 0;
}

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

int main() {
  string s;
  int m, sh;

  cin >> s;

  while (s != "-") {
    cin >> m;
  
    rep(i,m) {
      cin >> sh;
      s = s.substr(sh, s.size()-sh) + s.substr(0, sh);
    }
    cout << s << endl;

    cin >> s;
  }

  return 0;
}



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

typedef long long ll;

vector<ll> a(51,1);
vector<ll> p(51,1);

ll f(ll n, ll x)
{
    if(n == 0){
        return 1;
    }
    if(x <= 1){
        return 0;
    }else if(x <= 1 + a.at(n-1)){
        return f(n-1,x-1);
    }else if(x == 2 + a.at(n-1)){
        return p.at(n-1) + 1;
    }else if(x <= 2 + 2*a.at(n-1)){
        return p.at(n-1) + 1 + f(n-1,x-2-a.at(n-1));
    }else if(x == 3 + 2*a.at(n-1)){
        return 2*p.at(n-1) + 1;
    }
    return 0;
}

int main()
{
    ll n,x,i;
    cin >> n >> x;

    for(i = 1;i <= n;++i){
        a.at(i) = 2*a.at(i-1) + 3;
        p.at(i) = 2*p.at(i-1) + 1;
    }

    ll ans = f(n,x);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    string s;cin>>s;
    vector<char> ans;
    for(int i=0;i<s.length();i++){
        if(s[i]=='B'&&ans.size()!=0){
            ans.pop_back();
        }else if(s[i]!='B'){
            ans.push_back(s[i]);
        }
    }
    for(int i=0;i<ans.size();i++){
        cout<<ans[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
vector < vector<int> > ed;
vector<int> v;
int dmx;
int kk;
bool f = false;
int att;
vector<int> path;
set<int> setpath;
void init(int N) {
	v.clear();
	v.resize(N, 0);
	dmx = -1;
	f = false;
}

void dfs(int a, int d) {
	v[a] = 1;
	if (dmx < d) {
		dmx = d;
		kk = a;
	}
	for (int i = 0; i < ed[a].size(); i++) {
		if (v[ed[a][i]] == 0) {
			dfs(ed[a][i], d + 1);
		}
	}
	
}


void dfs2(int a) {
	v[a] = 1;
	path.push_back(a);
	if (att == a) {
		f = true;
		return;
	}
	for (int i = 0; i < ed[a].size(); i++) {
		if (v[ed[a][i]] == 0) {
			dfs2(ed[a][i]);
			if (f) {
				return;
			}
		}
	}
	path.pop_back();

}
int N;
vector<int> solve(int a,int b) {
	
	set<int> st;
	att = b;
	//cerr << a << " " << b << endl;
	init(N);
	path.clear();
	dfs2(a);
	setpath.clear();
	for (int i = 0; i < path.size(); i++) {
		setpath.insert(path[i]);
	}
	int k = 1;
	int t;
	vector<int> res;
	for (int i = 0; i < path.size(); i++) {
		//cerr << path[i] << endl;
		t = k;
		k++;
		for (int j = 0; j < ed[path[i]].size(); j++) {
			if (setpath.count(ed[path[i]][j]) == 0) {
				res.push_back(k);
				k++;
			}
		}
		res.push_back(t);
	}
	return res;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N;
	ed.resize(N);
	//int res = 0;
	int a, b;
	for (int i = 0; i < N - 1; i++) {
		cin >> a >> b;
		a--;
		b--;
		ed[a].push_back(b);
		ed[b].push_back(a);
	}
	init(N);
	dfs(0, 0);
	a = kk;
	init(N);
	dfs(a, 0);
	b = kk;
	vector<int>res1 = solve(a, b);
	if ((int)res1.size() < N) {
		cout << -1 << endl;
		return 0;
	}
	vector<int>res2 = solve(b, a);
	/*for (int i = 0; i < res2.size(); i++) {
		cerr << res2[i] << " ";
	}
	cerr << endl;*/
	vector<int> res = res1;
	for (int i = 0; i < res1.size(); i++) {
		if (res1[i] > res2[i]) {
			res = res2;
			break;
		}
		else if (res1[i] < res2[i]) {
			break;
		}
	}
	if ((int)res.size() < N) {
		cout << -1 << endl;
	}
	else {
		for (int i = 0; i < res.size(); i++) {
			if (i > 0)cout << " ";
			cout << res[i];
		}
		cout << endl;
	}
}

Measured memory_bytes: 18164
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(11);
  int T;
  T = 1;
  while (T--) solve();
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  int ma = 1, c = 1;
  rep3(i, 1, n) {
    if (a[i - 1] >= a[i]) {
      c++;
      chmax(ma, c);
    } else {
      c = 1;
    }
  }
  cout << ma - 1 << endl;
}


Measured memory_bytes: 640