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

public static class P
{
    public static void Main()
    {
        var hn = Console.ReadLine().Split().Select(int.Parse).ToArray();

        Console.WriteLine(hn[0] <= Console.ReadLine().Split().Select(int.Parse).Sum() ? "Yes" : "No");
    }
}



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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define forn(i , n) for(int i=0;i<n;i++)


int main(){
    int a;
    int b;
    
    cin >> a >> b;
    
    int area = a * b;
    int perimeter = 2 * (a + b);
    
    cout << area << " " << perimeter << endl; 
    return 0;   
}

Measured memory_bytes: 3088
use proconio::input;

fn main() {
    input! {
        n: i64,
    }
    let max = ((2 * n) as f64).sqrt() as i64;
    let mut table: Vec<i32> = Vec::with_capacity(n as usize);
    for _ in 0..n as usize {
        table.push(0);
    }
    for x in 1..max {
        for y in 1..max {
            for z in 1..max {
                let value = x * x + y * y + z * z + x * y + y * z + z * x;
                if value <= n {
                    table[(value - 1) as usize] += 1;
                }
            }
        }
    }

    for v in table {
        println!("{}", v);
    }
}

Measured memory_bytes: 2076
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
 
		Scanner sc  = new Scanner(System.in);

		Double o= 0.0 ,p = 0.0,q = 0.0;
		int a = 0, b = 0, c = 0;
		char ch;
		String str="";
		

//      String s1 = sc.next();
        int s = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        String[] test  = new String[s];
        while(true){
            test[a] = sc.next();
            a++;
            if(s==a)break;
        }
        
        Arrays.sort(test);

//	    int[] test  = new int[100000];
//      char[] c1 = s1.toCharArray();
        for(int i = 0; i < s ; i++){
            str += test[i];
        } 

        System.out.print(str);
        System.out.println();
	}
}

Measured memory_bytes: 13904
#include <iostream>

#define DAY 7 

using namespace std;

int main(void)
{
  int A, B, C;
  cin >> A >> B >> C;

  int coin = 0;
  int i = 0;
  while(coin < C) {
    i++;
    coin += A;
    if(i % DAY == 0) coin += B;
  }

  cout << i << endl;

  return 0;
}


Measured memory_bytes: 3108
N = int(input())
ImmigrantList = list(map(int, input().strip().split()))

ans = 'APPROVED'

for value in ImmigrantList:
    if value % 2 == 0:
        target = value # 該当数字をなんとなく変数に入れる
        if target % 3 != 0 and target % 5 != 0:
            ans = 'DENIED'
            break
print(ans)


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

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

int main(void){

	// 先に素数を求める
	int maxN = 100001;
	vector<bool> isPrime;
	isPrime.resize(maxN+1, true);
	isPrime[0] = false;
	isPrime[1] = false;
	for(int i=2; i<maxN+1; ++i){
		if(i*i > maxN){
			break;
		}
		for(int j=2; i*j<maxN+1; ++j){
			isPrime[i*j] = false;
		}
	}

	// like numberの累積和を求めておく
	vector<int> likes;
	likes.resize(maxN, 0);
	int buf=0;
	for(int i=0; i<maxN+1; ++i){
		if(isPrime[i] && isPrime[(i+1)/2]){
			likes[i] = buf + 1;
			buf = likes[i];
		}else{
			likes[i] = buf;
		}
	}

	// 入力
	int Q; cin >> Q;
	vector<int> L, R;
	L.resize(Q, 0); R.resize(Q, 0);
	rep(i, Q){
		cin >> L[i] >> R[i];
	}

	rep(i, Q){
		cout << likes[R[i]]-likes[L[i]-1] << endl;
	}

	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll a[200005];
ll _root(ll x)
{
    while(a[x]!=x)
    x=a[x];
    return x;
}
void add(ll x,ll y)
{
    ll xx=_root(x);
    ll yy=_root(y);
    a[yy]=xx;
}
int main() {
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++)
    a[i]=i;
    ll q;
    cin>>q;
    while(q--)
    {
        ll t;
        cin>>t;
        ll x,y;
        cin>>x>>y;
        if(t==0)
        {
        if(_root(x)!=_root(y))
        {
            add(x,y);
        }
        }
        else
        {
            if(_root(x)==_root(y))
            cout<<1<<endl;
            else
            cout<<0<<endl;
        }
    }

}


Measured memory_bytes: 4936
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cstring>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
#define repd(i,x,y) for (int i=x; i>=y; --i)
using namespace std;

typedef long long LL;
const int p=1000000007;
int n,a[100100],in[100100],cnt[100100],ans,fac[100100],inv[100100],len[100100],flag[100100],clk;
bool cyc[100100];
struct edge
{
    int v;
    edge *nxt;
} pool[100100],*tp=pool,*fst[100100];

int getint()
{
    char ch;
    while (!isdigit(ch=getchar()));
    int x=ch-'0';
    for (; isdigit(ch=getchar()); x=x*10+ch-'0');
    return x;
}

int power(int x,int k)
{
    int ret=1;
    for (; k; k>>=1,x=LL(x)*x%p)
        if (k&1)
            ret=LL(ret)*x%p;
    return ret;
}

int calc(int n,int m)
{
    return LL(fac[n])*inv[m]%p*inv[n-m]%p;
}

int get(int x)
{
    if (in[x]==1)
        return 0;
    int ret=1;
    x=cyc[fst[x]->v]?fst[x]->nxt->v:fst[x]->v;
    for (; fst[x]; x=fst[x]->v,++ret)
        if (in[x]>1)
        {
            puts("0");
            exit(0);
        }
    return ret;
}

int dp(int n)
{
    static int f[100100],sum[100100];
    memset(f,0,sizeof(int)*(n+10)),f[n+1]=1,len[n+1]=len[1];
    repu(i,1,n)
        sum[i]=sum[i-1]+len[i];
    if (!sum[n])
        return 1+((n&1) && n>1);
    repd(i,n+1,2)
        if (len[i])
        {
            if (i-len[i] && !(sum[i-1]-sum[i-len[i]]))
                (f[i-len[i]]+=f[i])%=p;
            if (i-len[i]-1 && !(sum[i-1]-sum[i-len[i]-1]))
                (f[i-len[i]-1]+=f[i])%=p;
        }
        else
            (f[i-1]+=f[i])%=p;
    return f[1];
}

int main()
{
    n=getint(),ans=1;
    repu(i,1,n)
    {
        if (++in[a[i]=getint()]>2)
        {
            puts("0");
            return 0;
        }
        *tp=(edge){i,fst[a[i]]},fst[a[i]]=tp++;
    }
    repu(i,1,n)
        if (!in[i])
        {
            int j=i,tot;
            for (++clk; !flag[j]; flag[j]=clk,j=a[j]);
            if (flag[j]!=clk)
            {
                if (!cyc[j])
                {
                    puts("0");
                    return 0;
                }
                continue;
            }
            for (; !cyc[j]; cyc[j]=1,j=a[j]);
            len[tot=1]=get(j);
            for (int k=a[j]; k!=j; len[++tot]=get(k),k=a[k]);
            ans=LL(ans)*dp(tot)%p;
        }
    repu(i,1,n)
        if (!flag[i])
        {
            int tot=0;
            for (int j=i; !flag[j]; flag[j]=1,j=a[j],++tot);
            ++cnt[tot];
        }
    fac[0]=fac[1]=inv[0]=inv[1]=1;
    repu(i,2,n)
        inv[i]=LL(p-p/i)*inv[p%i]%p;
    repu(i,2,n)
    {
        fac[i]=LL(fac[i-1])*i%p;
        inv[i]=LL(inv[i-1])*inv[i]%p;
    }
    memset(len,0,sizeof(len));
    repu(i,1,n)
        if (cnt[i])
        {
            int w=dp(i),sum=0,t=1;
            repu(j,0,cnt[i]/2)
            {
                sum=(sum+LL(t)*calc(cnt[i],j*2)%p*power(i,j)%p*power(w,cnt[i]-j*2))%p;
                t=LL(j*2+1)*t%p;
            }
            ans=LL(ans)*sum%p;
        }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 5760
class Ruiseki2D:
    """二次元累積和を構築する"""
    def __init__(self, matrix):
        self.h = len(matrix)
        self.w = len(matrix[0])
        self.ru = [[0] * (self.w + 1) for _ in range(self.h + 1)]

        for i in range(self.h):
            for j in range(self.w):
                self.ru[i + 1][j + 1] = self.ru[i + 1][j] + matrix[i][j]
        for i in range(self.h):
            for j in range(self.w):
                self.ru[i + 1][j + 1] += self.ru[i][j + 1]

    def get_sum(self, hl, hr, wl, wr):
        """[hl, hr), [wl, wr) で囲まれた部分の和を求める"""
        return (self.ru[hr][wr] + self.ru[hl][wl]
                - self.ru[hr][wl] - self.ru[hl][wr])


n, m, q = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]
query = [list(map(int, input().split())) for i in range(q)]

matrix = [[0] * (n + 1) for i in range(n + 1)]
for l, r in info:
    matrix[l][r] += 1
ru = Ruiseki2D(matrix)

for l, r in query:
    ans = ru.get_sum(l, r + 1, l, r + 1)
    print(ans)

Measured memory_bytes: 111576
import sys
import re
import math
import collections
import decimal
import bisect
import itertools
import fractions

import copy

# import heapq
# from collections import deque
# import decimal

sys.setrecursionlimit(10000001)
INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    a = na()

    c = collections.Counter(a)

    ans = 0
    for k, v in c.items():
        if k < v:
            ans += v - k
        if k > v:
            ans += v

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 19940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    string s;
    cin>>s;
    int mid = n/2;
    int flag=0;
    if(n&1){cout<<"No"<<"\n";}
    else{
        for(int i=0; i<mid; i++){
            if(s[i]!=s[mid+i]){flag=1; break;}
        }

    if(flag&1){cout<<"No"<<"\n";}
    else{cout<<"Yes"<<"\n";}
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int a, b, c, t;
    scanf("%d %d %d", &a, &b, &c);
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    if (b > c){
        t = c;
        c = b;
        b = t;
    }
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}


Measured memory_bytes: 2028
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

int main() {

	int n;
	int h[101];
	int r=0;
	ll total=0;

	cin>>n;

	int x=0;
	rep(i,n){
		cin>>h[i];
		r=max(r,h[i]);
		if(h[i]==0)x++;
	}
	int f=0;
	rep(i,r+1){
		f=0;
		rep(j,n){
			if(h[j]>0){
				h[j]--;
				f=1;
				if(h[j]==0)x++;
			}else{
				if(f==1){
					f=0;
					total++;
				}
			}
		}
		if(f==1)total++;
		if(x==n){
			cout<<total<<endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
import heapq

n, m = map(int, input().split())
ab = sorted([list(map(int, input().split())) for i in range(n)])
c = [[]] * m
a, b = ab[0]
last = a
ad = [b]
for i in range(1, n):
    a, b = ab[i]
    if a == last:
        ad.append(b)
    else:
        if last <= m:
            c[last - 1] = ad
        ad = [b]
    last = a
if a <= m:
    c[a - 1] = ad
choice = []
heapq.heapify(choice)
ans = 0
for i in range(m):
    for j in c[i]:
        heapq.heappush(choice, -j)
    if choice:
        ans -= heapq.heappop(choice)
print(ans)


Measured memory_bytes: 34368
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>
using namespace std;

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

#define max_n 100

long long N;

int main() {

	cin >> N;



	long long ans = 0;
	rep(i,N)
	{
		ans += i;
	}

	

	cout << ans <<endl;

	return 0;	
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF (1LL<<60)
#define MOD 1000000007

int N;
int A[400000];
long long L[400000], R[400000];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  rep(i, 3*N) cin >> A[i];

  {
    priority_queue<int, vector<int>, greater<int> > pq;
    long long s = 0;
    for (int i=0; i<3*N; i++) {
      s += A[i];
      pq.push(A[i]);
      if (pq.size() > N) {
        s -= pq.top();
        pq.pop();
      }
      if (pq.size() == N) L[i] = s;
      else L[i] = -INF;
    }
  }
  {
    priority_queue<int> pq;
    long long s = 0;
    for (int i=3*N-1; i>=0; i--) {
      if (pq.size() == N) R[i] = s;
      else R[i] = -INF;

      s += A[i];
      pq.push(A[i]);
      if (pq.size() > N) {
        s -= pq.top();
        pq.pop();
      }
    }
  }
  long long m = -INF;
  rep(i, 3*N) {
    long long l = L[i], r = R[i];
    if (l == -INF || r == -INF) continue;
    m = max(m, l-r);
  }
  cout << m << "\n";
  return 0;
}


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

int main ()
{
  double n,ans;

  scanf("%lf", &n);

  if((int)n%2 == 0)
    ans = n / (n*2) ;
  else
    ans = 1-(n-1)/(2*n);

  printf("%lf",ans );
  return 0;
}


Measured memory_bytes: 1704
#include <bits/stdc++.h>
#define fin ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define w(t) while(t--)
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
const double E = 1e-9;
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
int main(){
    //freopen("in","r",stdin);
    //freopen("out","w",stdout);
    fin;
    int n, k;
    cin >> n >> k;
    int idx;
    fore(i, 0, n){
        int x;cin >> x;
        if(x == 1)
            idx = i + 1;
    }  
    if(n == k){
        cout << 1 << '\n';
    }
    else{
        n--;k--;
        cout <<  n / k + (n % k != 0) << '\n';
    }
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}   

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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int (i)=0; (i)<n; ++(i))
#define rep1(i,n) for(int (i)=1; (i)<=n; ++(i))
#define repU(i,bottom,ceiling) for(int (i) = (bottom); (i) <= (ceiling); ++(i))
#define repD(i,ceiling,bottom) for(int (i) = (ceiling); (i) >= (bottom); --(i))
#define pub push_back
#define pob pop_back
#define prf printf
#define scf scanf
#define mkp make_pair
#define fir first
#define sec second
#define clr(a) memset((a),0,sizeof(a))

typedef long long ll;
typedef double db;

const vector<pair<int,int>> DIR = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF = -1 + (1<<30);
const int MOD = (int)1e9 + 7;

template<typename T> inline T gcd(T a,T b){ if(a % b){ return gcd(b,a % b); }else{ return b; } }

template<typename T> inline T lcm(T a,T b){ return a / gcd(a,b) * b; }

inline long long Pow(const long long n,long long m,const int mod = MOD){
	long long res = 1,pow = n;
	while(m) {
		if(m & 1) res = (res * pow) % mod;
		pow = (pow * pow) % mod;
		m >>= 1;
	}
	return res;
}

inline vector<long long> Frac(const int range,const int mod = MOD){
	vector<long long> frac;
	frac.push_back(1);
	for(int i = 1; i <= range; ++i) frac.push_back((long long)frac.back() * i % mod);
	return frac;
}

inline long long Comb(const int n,const int m,const int mod = MOD){
	if(n < m || m < 0) return 0;
	vector<long long> frac(Frac(n,mod));
	long long rev = Pow((long long)frac[m] * frac[n-m] % mod,mod-2,mod);
	return rev * frac[n] % mod;
}

template<typename T> inline bool v_find(const vector<T> v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) { return true; }
	return false; 
}

template<typename T> inline bool v_erase(vector<T> &v,const T obj){
	auto itr = find(v.begin(), v.end(), obj);
	size_t index = distance(v.begin(),itr);
	if (index != v.size()) {
		v.erase(itr);
		return true;
	}
	return false;	
}

template<class T,class U> inline auto LB(const T v,const U in){ return lower_bound(v.begin(),v.end(),in); }

template<class T,class U> inline auto UB(const T v,const U in){ return upper_bound(v.begin(),v.end(),in); }

inline unsigned long long nextsub(unsigned long long sub){
	unsigned long long tem = sub + (sub & -sub);
	unsigned long long btm = (~(tem) & sub) / (sub & -sub);
	return btm | tem;
}


inline void solve(){
	string s; cin>>s;
	int len=s.size();
	bool lop=true;
	while(lop){
		len-=2;
		rep(i,len/2){
			if(s[i]!=s[i+len/2]){
				break;
			}
			if(i==len/2-1) lop=false;
		}
	}
	cout<<len;
	return;
}

inline void input(){

	return;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	input();
	solve();
	return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, T;
  cin >> n >> T;
  int ans = INF;
  rep(i,n) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      chmin(ans, c);
    }
  }
  if (ans != INF) cout << ans << endl;
  else puts("TLE");
  return 0;
}

Measured memory_bytes: 256
class Main{
    public static void main(String[] a){
    	int total = 0;
    	for(int i = 1; i < 10; i++){
    		for(int j = 1; j < 10; j++){
    			total = i * j;
    			System.out.println(i + "x" + j + "=" + total);
    		}
    	}
    }
}

Measured memory_bytes: 24348
import sys

N = int(input())
A = input().split(" ")

for i in range(N):
    if A[i] == "1":
        break
    elif i == N-1:
        print("-1")
        sys.exit()

counter = "1"
ans = 0
for i in range(N):
    if A[i] != counter:
        ans +=1
    else:
        counter = str(int(counter) + 1)

print(str(ans)) 

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

int main(){
    int n, max = 0, idx;
    cin >> n;
    vector<int> a(n);
    rep(i,n){
        cin >> a[i];
        if(a[i] > max){
            max = a[i];
            idx = i;
        }
    }
    sort(a.begin(), a.end());
    rep(i,n){
        if(i != idx) cout << max << endl;
        else cout << a[n-2] << endl;
    }
}

Measured memory_bytes: 4052
from sys import stdin

def main():
    N, M = map(int, input().split())
    A = [tuple(map(int, input().split())) for _ in [0] * N]

    ans = set(A[0][1:])
    for a in A:
        ans &= set(a[1:])
    print(len(ans))

input = lambda: stdin.readline()
main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

const int N = 3001;
ll dp[N][N];
int v[N];

ll f(int i, int j) {
    if (i == j) return v[i];
    ll &r = dp[i][j];
    if (r != -1) return r;
    ll a = v[i] - f(i+1, j);
    ll b = v[j] - f(i, j-1);
    return r = max(a, b);
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    
    int n;
    cin >> n;
    forn(i, 0, n) {
        cin >> v[i];
    }
    
    memset(dp, -1, sizeof dp);
    cout << f(0, n-1) << endl;
}


Measured memory_bytes: 74164
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<long long int>
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vb vector<bool>
#define vvl vector<vector<ll> >
#define vvi vector<vector<int> >
#define pl pair<ll,ll>
#define pb push_back
#define PI 3.14159265
#define mod 998244353
#define pb push_back
#define mp make_pair
#define fri(s,n) for(int i=s;i<n;i++)
#define frj(s,n) for(int j=s;j<n;j++)
#define T(i) int i=1;cin>>i;while(i--)
#define vsi vector<set<int> >
#define pii pair<int,int>
#define inf 1e9
#define vpii vector<pair<int,int> >


ll power(ll a,ll b){
    if(b==0)
        return 1;
    if(b&1)
        return a*power(a,b-1);
    ll temp=power(a,b/2);
    return temp*temp;
    }
ll mycompare(ll a,ll b){
    return a>b;
    }

ll max_value(int n,vvl &wv,int w,vvl &dp){
    if(n==-1 || w==0)
        return 0;
    if(dp[n][w]!=-1)
        return dp[n][w];
    if(wv[n][0]<=w)
        return dp[n][w]=max(wv[n][1]+max_value(n-1,wv,w-wv[n][0],dp),max_value(n-1,wv,w,dp));
    else
        return dp[n][w]=max_value(n-1,wv,w,dp);
    }
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    fast;
    ll n,w;
    cin>>n>>w;
    vvl wv(n,vl(2));
    fri(0,n)
        cin>>wv[i][0]>>wv[i][1];
    vvl dp(n,vl(w+1,-1));
    cout<<max_value(n-1,wv,w,dp);
    }


Measured memory_bytes: 82364
#!/usr/bin/env ruby

n = gets.strip.to_i

n.times do
  snake = gets.strip
  if snake =~ /^>'(=+)#(=+)~$/ and $1.length == $2.length
    puts 'A'
  elsif snake =~ /^>\^(?:Q=)+~~$/
    puts 'B'
  else
    puts 'NA'
  end
end

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

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

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

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

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

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

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

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

macro_rules! stdin {
    () => ({
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    })
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    )
}

// End Snippets

fn main() {
    println!("{}", solve(stdin!()));
}

fn solve(src: String) -> String {
    input!{
        source = src,
        a: i32, b: i32,
    }
    let mut a = a;
    let mut b = b;
    let mut ans = if a > b {
        let ret = a;
        a -= 1;
        ret
    } else {
        let ret = b;
        b -= 1;
        ret
    };
    ans += if a > b {
        a
    } else {
        b
    };
    ans.to_string()
}

test! {
    "5 3" => "9",
    "3 4" => "7",
    "6 6" => "12",
}


Measured memory_bytes: 4352
s=list(map(int,list(input())))
ans0=0
ans1=0
pre=s[0]
for si in s[1:]:
  if si==pre:
    ans0+=1
    pre=not si
  else:
    pre=si

pre=s[-1]
for si in s[:-1][::-1]:
  if si==pre:
    ans1+=1
    pre=not si
  else:
    pre=si
print(min(ans0,ans1))


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

int main(){
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >> y;

	int ans = __INT_MAX__;
	for(int i = 0; i <= max(x,y); i++){
		ans = min(ans, 2*c*i + max(x-i, 0)*a + max(y-i, 0)*b);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N;
  cin >> N;
  vector<P> p(N);
  for(int i = 0; i < N; i++){
    p.at(i).second = i;
    cin >> p.at(i).first;
  }
  sort(ALL(p));
  int right = 0;
  int m = 0;
  for(int left = 0; left < N; left++){
    while(right + 1 < N && p[right].second < p[right+1].second) right++;
    chmax(m, right - left + 1);
    if(right == left) right++;
  }
  cout << N - m << endl;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0141

"""
import sys
from sys import stdin
input = stdin.readline


M = []
def guruguru(n):
    global M
    dirs = [(0, -1), (1, 0), (0, 1), (-1, 0)] #  x, y???????????? (???????????????????????????)

    M = [[' '] * n for _ in range(n)] #  ??????????????¨?????????????????§?????????
    cx = 0                      #  ??????????????°???
    cy = n - 1
    line = 0                    #  ???????????§??????????????????n??¨???????????°??????????????¨??????

    while line < n:
        dx, dy = dirs[line % 4]
        line += 1
        while True:
            M[cy][cx] = '#'

            nx = cx + dx        #  ?¬???????????????¨???????????????
            if not 0 <= nx < n: #  ??????????????????????????????????????§???????????¢?????????
                break
            ny = cy + dy
            if not 0 <= ny < n:
                break
                
            nnx = nx + dx       #  ?¬?????¬???????????????¨???????????????
            nny = ny + dy
            if 0 <= nny < n and 0 <= nnx < n:
                if M[nny][nnx] != ' ': #  ??????????????????????????????????????¢??????????????????????????£??????????????´??????????????¢?????????
                    break
            cx = nx
            cy = ny

    # ?????????????????????????????????
    for l in M:
        print(''.join(l))


def main(args):
    n = int(input())
    for i in range(n):
        size = int(input())
        guruguru(size)
        if i != (n - 1):        #  ????????\?????????????????????????????????????????\??????
            print()


if __name__ == '__main__':
    main(sys.argv[1:])
    

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

ll M,K;

int main(){
    cin >> M >> K;
    if(K >= (1<<M)){
        cout << -1 << endl;
        return 0;
    }
    if(K==0){
        for(int i=(1<<M)-1;i>=0;i--){
            cout << i << " ";
        }
        for(int i=0;i<(1<<M);i++){
            if(i != (1<<M)-1) cout << i << " ";
            else cout << i << endl;
        }
        return 0;
    }
    if(M == 1 && K == 1){
        cout << -1 << endl;
        return 0;
    }
    for(int i=(1<<M)-1;i>=0;i--){
        if(i == K) continue;
        cout << i << " ";
    }
    cout << K << " ";
    for(int i=0;i<(1<<M);i++){
        if(i == K) continue;
        cout << i << " ";
    }
    cout << K << endl;
    return 0;
}

Measured memory_bytes: 1792
import numpy as np
import sys
import math
read = sys.stdin.readline

X = int(input())


for a in range(1,1000):
    for b in range(0,1000):
        a4 = a ** 4
        b4 = b ** 4
        a3 = a ** 3
        b3 = b ** 3
        a2 = a ** 2
        b2 = b ** 2
        if ( (a-b)*( a4 + (a3*b) + (a2 * b2) + (b3 * a) + b4) ) == X:
            print(a,b)
            sys.exit()

        b = -1 * b
        b3 = -1 * b3
        if ( (a-b)*( a4 + (a3*b) + (a2 * b2) + (b3 * a) + b4) ) == X:
            print(a,b)
            flag = 1
            sys.exit()
        


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

int main() {
  int A, B, K;
  cin >> A >> B >> K;

  for (int i = A; i <= B; i++) {
    if (i < A+K) {
      cout << i << endl;
    } else if (B-K < i) {
      cout << i << endl;
    }
  }
  return 0;
}

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

const int mod = 1e9 + 7;
const long long INF = 1LL<<60;
using ll = long long;
using P = pair<int,int>;



class UnionFind{
public:

    //親の番号を格納する. Parentだった場合は−(the size)とする
    vector<int> Parent;
    
    //作るときはParentの値を全て-1にする
    //こうすると, すべての頂点が根となる
    UnionFind(int N){
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A){
        if (Parent[A] < 0) return A; //自分のグループにいる
        return Parent[A] = root(Parent[A]); //親をつなぎ替える
    }
    
    //size関数を作る
    //自分の所属するグループの頂点数を調べる
    long long size(int A){
        return -Parent[root(A)]; //親をとりたい
    }
    
    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接繋がない
        //root(A) に root(B)をくっつける　
        //リーダー同士をくっつける
        
        A = root(A);
        B = root(B);
        
        if (A == B){
            return false; //すでにくっついてる
        }
            
        //大きい方に小さい方をくっつけたい
        //大小が逆だったらひっくり返す
            
        if(size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        
        //BのParentをAに変更する
        Parent[B] = A;
        
        return true; //くっついた
    }
    
};


int main(){
    long long n, m;
    cin >> n >> m;
    
    vector<long long> A(m), B(m);
    
    rep(i, m){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    
    vector<long long> ans(m);
    ans[m-1] = n * (n-1) / 2;
    
    UnionFind Uni(n);
    
    for (int i = m-1; i >= 1; i--){
        
        ans[i-1] = ans[i];
        
        if (Uni.root(A[i]) != Uni.root(B[i])){
            
            ans[i-1] = ans[i] - (long long)Uni.size(A[i]) * Uni.size(B[i]);
            Uni.connect(A[i], B[i]);
        }
        
    }
    
    rep(i, m){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 4096
# -*- coding: utf-8 -*-
import copy
from operator import itemgetter

[N, M] = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
BC = []
for m in range(M):
    BC.append([int(i) for i in input().split()])

# Aをソートする
A.sort()

# BCをCが大きい順にソートする
sorted_BC = sorted(BC, key=itemgetter(1, 0), reverse=True)

new_A = []
for [B, C] in sorted_BC:
    # もしAの最小値がCを超えていたらもうやる意味ないので終了
    if A[0] > C:
        break

    # 小さいほうからB枚のカードをCに変える
    # ただし変えるのは元の数字より大きい時だけ
    I = 0
    for i in range(B):
        I = i
        if len(A) <= i:
            I -=1
            break
        if A[i] > C:
            I -=1
            break
        new_A.append(C)
        #print(new_A)

    # 変えた分はリストから除外する
    #print(A)
    #print(I)
    del A[:I+1]
    if len(A) == 0:
        break

    #print(A)

if len(A) != 0:
    new_A.extend(A)

print (sum(new_A))


Measured memory_bytes: 35532
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  copy_n(istream_iterator<int>(cin), N, H.begin());
  const char* result = "Yes";
  for (int i = N - 1; 0 < i; --i) {
    if (H[i - 1] - 1 <= H[i]) {
      H[i - 1] -= (H[i - 1] > H[i]);
    } else {
      result = "No";
      break;
    }
  }
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 640
import math
a, b, x = map(int, input().split())
if a * a * b >= 2 * x:
  print(math.degrees(math.atan((a * b * b) / (x * 2.0))))
else:
  v = a * a * b - x
  print(math.degrees(math.atan((2.0 * v) / (a * a * a))))

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

using namespace std;

int main() {
	int n, m, k; cin >> n >> m >> k;
	vector<int> a(n), b(m);
	for (int& e : a) cin >> e;
	for (int& e : b) cin >> e;
	vector<long long> as(n + 1), bs(m + 1);
	for (int i = 0; i < n; ++i) as[i + 1] = as[i] + a[i];
	for (int i = 0; i < m; ++i) bs[i + 1] = bs[i] + b[i];
	int ans = 0;
	for (int i = 0; i <= n; ++i) {
		long long sum = as[i];
		if (sum > k) continue;
		int t = distance(bs.begin(), upper_bound(bs.begin(), bs.end(), k - sum)) - 1;
		ans = max(ans, t + i);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 8008
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
    int a, b, c; scan(a, b, c);
    int k; scan(k);

    int ans = a + b + c + max(a, b, c) * (2^^k - 1);
    writeln(ans);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll MOD=INF;
 
int main() {
    int n,m,x;
    cin >> n >> m >> x;
    vector<int> d(n);
    vector<vector<int>> e(n,vector<int>(m));
    rep(i,n){
        cin >> d[i];
        rep(j,m){
            cin >> e[i][j];
        }
    }
    int u=pow(2,n),ans=inf;
    rep(i,u){
        vector<int> a(m,0);
        int c=i,s=0;
        rep(j,n){
            if (c%2==0){
                s+=d[j];
                rep(k,m){
                    a[k]+=e[j][k];
                }
            }
            c/=2;
        }
        bool t=true;
        rep(j,m){
            if (a[j]<x) t=false;
        }
        if (t) ans=min(ans,s);
    }
    if (ans==inf) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 4108
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  int left=1,right=n;
  for(int i=0;i<n;i++){
    int a,b;
    cin>>a>>b;
    left=max(left,a);
    right=min(right,b);
  }
  cout<<max(right-left+1,0)<<endl;
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  		long double a,b,h,m;
  		cin>>a>>b>>h>>m;
  		long double pi = 3.14159265358979;
  		long double angleA = (pi/6.0)*(h) + (pi/360.0)*(m);
  		long double angleB = (pi/30.0)*(m);
  		long double diff = abs(angleA-angleB);
  		long double ans = sqrt(a*a + b*b - 2*a*b*cos(diff));
  		cout<<fixed<<setprecision(10)<<ans;
	}	


Measured memory_bytes: 4068
n, m = gets.split(' ').map(&:to_i)
arr = []

if n == 1
  puts gets.split(' ').length - 1
else
  n.times.with_index do |i| 
    k = gets.split(' ').map(&:to_i)
    k.shift
    arr << k
  end
  result = 0
  (arr.length-1).times.with_index do |i|
    result = arr[i] & arr[i+1]
    arr[i+1] = result
  end
  puts result.length
end


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<vector>
#include<stack>
using namespace std;

const int NN=1e5+10;
int a[NN];
int n;

int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int num;
    int sum=0;
    for(int i=0;i<n;i++){
        scanf("%d",&num);
        if(a[i]-num>0){
            sum+=(a[i]-num);
        }
    }
    printf("%d\n",sum);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define mk make_pair


int main()
{

  string s;
  cin>>s;
  if(s[0]>='A'&&s[0]<='Z')
  cout<<"A"<<endl;
  else
  cout<<"a"<<endl;

}


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

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a,b;
	cin>>a>>b;
	cout << (b-a)*(b-a+1)/2-b << endl;

	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep2(i,a,n) for(int i = (a);i < (n);i++)
#define rep(i,n) rep2(i,0,n)
#define INF (1LL << 60)
#define itn int

int main(void){
    ll w,h,x,y;
    cin >> w >> h >> x >> y;
    
    int cnt = 0;
    if(h == y*2 && w == x*2)cnt++;
    cout << (double(w) * double(h) / 2) << " " << cnt << endl;
}


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 1e6 + 5;

int n, m;
vi wek;
int arr[maxN];

ll solve() {
	REP(i, n)
		if (arr[i] != wek[i]) return 0;
	
	ll ans = 1;
	REP(i, n / 2)
		ans = (ans * 2) % inf;
	return ans;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin>>n;
	REP(i, n) cin>>arr[i];
	sort(arr, arr + n);
	if (n % 2 == 1) {
		wek.pb(0);
		RI(i, n / 2) {
			wek.pb(i * 2);
			wek.pb(i * 2);
		}
	} else {
		for (int i = 1; i <= n; i += 2) {
			wek.pb(i);
			wek.pb(i);
		}
	}
	cout<<solve();
	return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using db = double;
#define pb push_back

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using rset = tree<T, null_type, less<T>,
	rb_tree_tag, tree_order_statistics_node_update>;

ll n, k;
ll a[200006];
rset<pair<ll,ll>> s;

int main() {
	cin >> n;
	cin >> k;
	
	for (int i = 1; i <= n; ++i)
		scanf("%lld", &a[i]);
	partial_sum(a, a + n + 1, a);
	
	ll ans = 0;
	
	ll id = 0;
	for (int i = 0; i <= n; ++i) {
		a[i] -= k * i;
		s.insert({a[i], ++id});
		ans += s.order_of_key({a[i], id});
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 14336
#define MOD 1000000007
#define PI 3.14159265358979323846
#define inf 100000000000000
#define pb push_back
#define pf push_front
//#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define sz(V) (int)V.size()
//#define int long long
#define _ <<" "<<
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#include <bits/stdc++.h>
 
 
using namespace std;

typedef long long int ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;

typedef vector<ii> vii;
#define int double 
//#define PI 3.14159265

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    cout.tie(0);
   // freopen("test.txt","r",stdin); 
    int a,b,x;
    cin>>a>>b>>x;

    int full = a * a * b;

    int mid = full / 2;

    if(x == mid)
    {
        cout<<45.000000000;
    }
    else if(x > mid)
    {
        int dif  = full - x;
        int foo = a*a*a;
        dif = dif / foo;
        dif =dif * 2;
        int lol = atan(dif) * 180;
        lol /= PI;
        cout<<setprecision(10)<<lol;
    }
    else
    {
        int foo = 2 * x;
        full = a * b * b;
        foo /= full;
        //cout<<foo<<"AD"<<endl;
        int lol = atan(foo) * 180;
        lol /= PI;

        //cout<<lol<<endl;
        int ans = 90 - lol;
        cout<<setprecision(10)<<ans;
    }

}
    




Measured memory_bytes: 256
'use strict';

const pipe=Symbol();

Function.prototype[pipe]=function(nextFunc){
  const that=this;
  return function(I){
    return nextFunc(that(I));
  }
}

function pre0(input){
  return input.
  split(/\n|\r/).
  map(
    str=>str.split(/\s+/).
    map(x=>x-0)
  );
}

function pre1(Arr){
  const NMX=Arr.shift();
  return [NMX,Arr];
}

String.prototype.zeroFill=function(N){
  return (new Array(N-this.length)).
  fill('0').
  join('')+this;
}

function choice(N,num){
  return num.
  toString(2).
  zeroFill(N).
  split('').
  map(x=>x-0);
}

function test(I,c){
  const [N,M,X]=I[0];
  const Arr=I[1];
  const testCase=new Array(M+1).fill(0);
  Arr.forEach(function(arr,i){
    if(c[i])
      arr.forEach(function(x,j){
        testCase[j]+=x;
      });
  });
  //console.log(c,testCase);
  const cost=testCase.shift();
  const safe=testCase.
  reduce(
    (acc,crr)=>Boolean(acc&&(crr>=X)),
    true
  );
  return safe?cost:Infinity;
}

function testAll(I){
  const N=I[0][0];
  const nmax=Math.pow(2,N);
  
  const choices=new Array(nmax).
  fill(0).
  map((z,i)=>choice(N,i));
  
  const cost=choices.
  reduce(
    (acc,crr,ind)=>Math.min(acc,test(I,crr)),
    Infinity
  );
  return cost;
}

function result(cost){
  console.log(isFinite(cost)?cost:-1);
}


pre0[pipe](
  pre1
)[pipe](
  testAll
)[pipe](
  result
)(require('fs').readFileSync('/dev/stdin','utf8'));


Measured memory_bytes: 36080
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int main(void)
{
	int a, b, c;

	int sum = 0;

	int x;

	scanf("%d %d %d", &a, &b, &c);

	for (x = a; x <= b; x++) {
		if (c%x == 0)
			sum += 1;
	}
	printf("%d\n", sum);

	return 0;
}


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

int main(){
  int n = 5;
  vector<int> wait;
  vector<int> next_order;

  int max_dif = 0;
  for(int i = 0; i < n; ++i) {
    int temp; cin >> temp;
    wait.push_back(temp);
    next_order.push_back( (wait[i]%10) ? (wait[i]/10 + 1)*10 :(wait[i]/10)*10 );
    max_dif = max(max_dif, next_order[i] - wait[i]);
  }
  //sort(wait.begin(), wait.end());
  //sort(next_order.begin(), next_order.end());

  int ans = 0;
  for(int i = 0; i < n; ++i){
   // cout << "next_order "<<next_order[i]<<endl;
   // cout << "wait "<<wait[i]<<endl;
    ans += next_order[i];
  }
  ans -= max_dif;
  cout << ans << endl;
  
}

Measured memory_bytes: 256
ar = list(input())
while True:
    a = len(ar)
    if a == 0:
        print("YES")
        break
    if "".join(ar[a-5:a]) == "dream" or "".join(ar[a-5:a]) == "erase":
        del ar[a-5:a]
    elif "".join(ar[a-6:a]) == "eraser":
        del ar[a-6:a]
    elif "".join(ar[a-7:a]) == "dreamer":
        del ar[a-7:a]
    else:
        print("NO")
        break

Measured memory_bytes: 3956
N,M = map(int,input().split())
S = input()

pos = N
res = []
while pos > 0:
  flg = False
  for move in range(M, 0, -1):
    if pos-move < 0:
      continue
    elif S[pos-move] == "0":
      pos -= move
      res.append(move)
      flg = True
      break
    elif S[pos-move] == "1":
      continue
  else:
    print(-1)
    exit()

print(" ".join(map(str, reversed(res))))

Measured memory_bytes: 49968
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D ,L ,R;
  cin >> A >> B >> C >> D;
  L = A + B;
  R = C + D;
    
  if (L > R){
    cout << "Left" << endl;
  }
    else if (L == R) { 
      cout << "Balanced" << endl;
      }
        else { cout << "Right" << endl;
          }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <queue>
#include <map>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <functional>
using namespace std;

int main(void)
{
	string a, b;
	cin >> a >> b;
	int len;
	if (a.length() > b.length())len = a.length();
	else len = b.length();
	for (int i = 0; i < len; ++i) {
		if(a[i]!='\0')cout << a[i];
		if(b[i]!='\0')cout << b[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [input().split() for i in range(n)]

for i in range(n):
  a[i][1] = int(a[i][1])
  a[i].append(i+1)
  
a.sort(key = lambda x: x[1], reverse = True)
a.sort(key = lambda x: x[0])

for j in range(n):
  print(a[j][2])

Measured memory_bytes: 3060
n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
b=[0]*n
c=[0]*n
b[0]=a[0]
c[-1]=a[-1]
for i in range(1,n):b[i]=gcd(b[i-1],a[i])
for i in range(n-2,-1,-1):c[i]=gcd(c[i+1],a[i])
ans=max(c[1],b[-2])
for i in range(1,n-1):ans=max(ans,gcd(b[i-1],c[i+1]))
print(ans)

Measured memory_bytes: 14460