akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main()
{
    int i,y,z=0,n,m;
    scanf("%d %d", &n,&m);
    int x[100000];
    for(i=0;i<n;i++)
    {
        scanf("%d",&x[i]);
        z=z+x[i];

    }

    int d=0,j;
    for(i=0;i<n;i++)

    {
        for(j=i+1;j<n;j++)
        {
           if(x[i]<x[i+1])
        {
            d=x[i];
            x[i]=x[i+1];
            x[i+1]=d;
        }
        }

    }
    y=(1.0/(4*m))*z;
    if(z%(4*m)!=0)
    {
        y++;
    }
    //printf("%d\n",y);
    int c=0;
        for(i=0;i<n;i++)
        {
            if(x[i]>=y)
            {

                c++;

            }


        }

        if(c>=m)
            printf("Yes\n");

        else
          printf("No\n");
          return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod2 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 1e18


int  main()
{
    int te;
    cin >> te;
    for(int w=0;w<te;w++)
    {
        int n;
        cin >> n;
        vector<pair<int,pair<int,int> > >v(n);
        for(int i=0;i<n;i++)
            cin >> v[i].first >> v[i].second.first >> v[i].second.second;
        for(int i=0;i<n;i++)
            v[i].first-=1;
        lli sum=0;
        vector<vector<int> >vl(n),vr(n);
        set<int>vis;
        for(int i=0;i<n;i++)
        {
            int a=v[i].second.first,b=v[i].second.second,ind=v[i].first;
            if(a>=b)
                vl[ind].push_back(i);
            else
            {
                if(ind==n-1)
                    continue;
                vr[ind+1].push_back(i);
            }
        }
        set<pair<int,int> >s1,s2;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<vl[i].size();j++)
            {
                int a=v[vl[i][j]].second.first,b=v[vl[i][j]].second.second;
                if(s1.size()<i+1)
                    s1.insert({a-b,vl[i][j]});
                else
                {
                    set<pair<int,int> >:: iterator it=s1.begin();
                    if(it->first<a-b)
                    {
                        s1.erase(it);
                        s1.insert({a-b,vl[i][j]});
                    }   
                }
            }
        }
        for(int i=n-1;i>-1;i--)
        {
            for(int j=0;j<vr[i].size();j++)
            {
                int a=v[vr[i][j]].second.second,b=v[vr[i][j]].second.first;
                if(s2.size()<n-i)
                    s2.insert({a-b,vr[i][j]});
                else
                {
                    set<pair<int,int> >:: iterator it=s2.begin();
                    if(it->first<a-b)
                    {
                        s2.erase(it);
                        s2.insert({a-b,vr[i][j]});
                    }   
                }
            }
        }
        set<pair<int,int> >:: iterator it;
        for(it=s1.begin();it!=s1.end();it++)
        {
            int a=it->second;
            sum+=v[a].second.first;
            vis.insert(a);
        }
        for(it=s2.begin();it!=s2.end();it++)
        {
            int a=it->second;
            sum+=v[a].second.second;
            vis.insert(a);
        }
        for(int i=0;i<n;i++)
        {
            int a=v[i].second.first,b=v[i].second.second;
            if(vis.find(i)==vis.end())
                sum+=min(a,b);
        }
        cout << sum << endl;
    }
}

Measured memory_bytes: 38304
// Minimal Backgammon
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int t = scanner.nextInt();
			int l = scanner.nextInt();
			int b = scanner.nextInt();
			if ((n | t | l | b) == 0)
				break;
			double[][] dp = new double[n + 1][t + 1];
			for (int i = 0; i < n + 1; i++)
				for (int j = 0; j < t + 1; j++)
					dp[i][j] = 0;
			boolean[] lose = new boolean[n + 1];
			boolean[] back = new boolean[n + 1];
			Arrays.fill(lose, false);
			Arrays.fill(back, false);
			for (int i = 0; i < l; i++)
				lose[scanner.nextInt()] = true;
			for (int i = 0; i < b; i++)
				back[scanner.nextInt()] = true;
			dp[0][0] = 1.0;
			for (int i = 0; i < t; i++) {
				for (int j = 0; j < n + 1; j++) {
					if (j == n) {
						dp[j][i + 1] += dp[j][i];
						continue;
					}
					for (int d = 1; d < 7; d++) {
						int next = j + d;
						if (next > n) {
							int a = next - n;
							next = n - a;
						}
						if (lose[next] && i < t - 1) {
							dp[next][i + 2] += dp[j][i] / 6.0;
						} else if (back[next]) {
							dp[0][i + 1] += dp[j][i] / 6.0;
						} else {
							dp[next][i + 1] += dp[j][i] / 6.0;
						}
					}
				}
			}
			System.out.printf("%.6f", dp[n][t]);
			System.out.println();
		}
		scanner.close();
	}
}

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

using namespace std;

const int N = 505;
const int inf = 1e9;

struct Edge {
  int u, v, cost;
  Edge(int u, int v, int cost) : u(u), v(v), cost(cost) {}
  bool operator==(const Edge& e) const {
    return e.u == u && e.v == v && e.cost == cost;
  }
  bool operator<(const Edge& e) const {
    return cost < e.cost;
  }
};

int par[N];
int n, m;

int find(int u) {
  return par[u] = (par[u] == u? u : find(par[u]));
}

void merge(int u, int v) {
  u = find(u);
  v = find(v);
  par[u] = v;
}

int mst(vector<Edge>& edges, vector<Edge>& used, Edge non) {
  int cost = 0;
  for (int i = 0; i < N; i++) par[i] = i;
  int done = 0;
  for (auto it : edges) {
    if (it == non) continue;
    if (find(it.u) != find(it.v)) {
      merge(it.u, it.v);
      cost += it.cost;
      done++;
      used.push_back(it);
    }
    if (done + 1 == n) break;
  }
  if (done + 1 != n) return inf;
  return cost;
}

int main() {
  scanf("%d %d", &n, &m);
  vector<Edge> edges;
  for (int i = 0; i < m; i++) {
    int u, v, cost;
    scanf("%d %d %d", &u, &v, &cost);
    edges.push_back(Edge(u, v, cost));
  }
  sort(edges.begin(), edges.end());
  vector<Edge> used;
  int mst_cost = mst(edges, used, Edge(-1, -1, -1));
  int ans = 0, cost = 0;
  for (auto it : used) {
    vector<Edge> tmp;
    if (mst_cost < mst(edges, tmp, it)) {
      ans++;
      cost += it.cost;
    }
  }
  printf("%d %d\n", ans, cost);
  return 0;
}

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

public class Program{
    public static void Main(){
        string[] line = Console.ReadLine().Trim().Split();
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        string s = Console.ReadLine();
        char[] c = s.ToCharArray();
        c[k - 1] = Char.ToLower(c[k - 1]);
        s = new string(c);
        
        Console.WriteLine("{0}", s);
    }
}


Measured memory_bytes: 13140
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskC {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = in.nextLong();
			}
			long ans = Long.MAX_VALUE;
			if (a[0] == 0) {
				ans = Math.min(ans, 1 + solve(n, a, +1));
				ans = Math.min(ans, 1 + solve(n, a, -1));
			} else {
				ans = solve(n, a, a[0]);
				ans = Math.min(ans, Math.abs(a[0]) + 1 + solve(n, a, -Long.signum(a[0])));
			}
			out.println(ans);
		}

		private long solve(int n, long[] a, long sum) {
			long res = 0;
			for (int i = 1; i < n; i++) {
				long x = a[i];
				long nx = x;
				if (Long.signum(sum) + Long.signum(sum + nx) != 0) {
					nx = -sum;
					if (sum > 0) {
						--nx;
					} else {
						++nx;
					}
				}
				sum += nx;
				res += Math.abs(nx - x);
			}
			return res;
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

	}
}



Measured memory_bytes: 37816
#include <iostream>

using namespace std;

int main() {
  int N, v[100002]{}, ans{}, s;
  cin >> N;
  while (cin >> s) ++v[s];
  s = v[0] + v[1];
  for (int i = 0; i != 100000; ++i) {
    s += v[i + 2];
    ans = ans < s ? s : ans;
    s -= v[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 4040
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef double dd;
const int N = 1e5+5;
const dd eps = 1e-8;
const int mod = 1e9+7;

bool haveans = false;
int k,a,b;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>k>>a>>b;
  for(int i = a;i <= b;i++){
    if(i%k == 0) haveans = true;
  }
  if(haveans) cout<<"OK"<<endl;
  else cout<<"NG"<<endl;
  return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#define LL long long 
LL H, W, A, B;
LL mod = 1000000007;
LL mul[200010];
LL dis[200010];
LL ans;
LL fermat(LL x, LL y) {
	//std::cout << y << std::endl;
	if (y == 0) return 1;
	if (y == 1)	return x;
	if (y % 2 == 1) {
		LL F = fermat(x, y / 2);
		F *= F;
		F%=mod;
		return F*x%mod;
	}
	if (y % 2 == 0) {
		LL F = fermat(x, y / 2);
		F *= F;
		return F%mod;
	}
}

int main() {
	std::cin >> H >> W >> A >> B;
	mul[1] = 1;
	mul[0] = 1;
	for (LL i = 1; i <= H + W - 2; i++) {
		mul[i] = mul[i - 1] * i;
		mul[i]%=mod;
	}
	dis[H + W - 2] = fermat(mul[H + W - 2], mod - 2);
	for (LL i = H + W - 3; i > 0; i--) {
		dis[i] = dis[i + 1] * (i + 1);
		dis[i] %= mod;
	}
	dis[0] = 1;
	for (LL i = B; i < W; i++) {
		LL plus = mul[H - A + i - 1];
		plus %= mod;
		plus *= dis[i];
		plus %= mod;
		plus *= dis[H - A - 1];
		plus %= mod;
		plus *= mul[W + A - i - 2];
		plus %= mod;
		plus *= dis[A - 1];
		plus %= mod;
		plus *= dis[W - i - 1];
		plus %= mod;
		ans += plus;
		ans %= mod;
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;

int main(){
  ll n,m,x,y,sum=0;
  cin >> n >> m;
  vector<pair<ll,ll>> vec;
  for(int i=0;i<n;i++){
    cin >> x >> y;
    vec.push_back(make_pair(x,y));
  }
  sort(vec.begin(),vec.end());
  for(int i=0;i<n;i++){
    if(vec[i].second < m){
      sum += vec[i].first*vec[i].second;
      m -= vec[i].second;
      //cout << sum << endl;
    }else{
      sum += vec[i].first*m;
      break;
      //cout << sum << endl;
    }
  }
  cout << sum;
}


Measured memory_bytes: 2420
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String s = in.readLine();
		int n = Integer.parseInt(s);
		s = in.readLine();
		int[] a = new int[n];
		String[] as = s.split(" ");
		for(int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(as[i]);
		}
		s = in.readLine();
		int q = Integer.parseInt(s);
		int[] t = new int[q];
		s = in.readLine();
		as = s.split(" ");
		for(int i = 0; i < q; i++) {
			t[i] = Integer.parseInt(as[i]);
		}
		int count = 0;
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n-1;
			int mid = (left + right) / 2;
			while (left <= right) {

				if(a[mid] == t[i]) {
					count++;
					break;
				} else if(a[mid] < t[i]) {
					 left = mid+1;
					 mid = (left + right) / 2;
				} else if(a[mid] > t[i]) {
					right = mid-1;
					mid = (left + right) / 2;
				}
			}
		}
		System.out.println(count);
	}
	
	
}


Measured memory_bytes: 52476
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    
    vector<int> dp(n+1);
    vector<int> coins(m);
    for (int i = 0; i < m; ++i) {
        int coin;
        cin >> coin;
        coins[i] = coin;
    }

    dp[0] = 0;

    for (int val = 1; val <= n; ++ val) {
        int min = numeric_limits<int>::max();
        for (auto coin : coins) {
            if (val >= coin) {
                min = dp[val-coin] < min ? dp[val-coin] : min;
            }
        }
        dp[val] = 1 + min;
    }
    cout << dp[n] << endl;
}



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

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		StringTokenizer st = new StringTokenizer(str, " ");
		int a = Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		int d = a / b;
		int r = a % b;
		double f = (double)a / (double)b;

		System.out.printf("%d %d %.5f", d, r, f);

	}
}

Measured memory_bytes: 24672
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vii vector<vi>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
	int a,s;
    cin>>a>>s;
    cout<<6-a-s;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int n;
  cin >> n;
  vi x(n);
  for (int i = 0; i < n; i++) cin >> x.at(i);
  vi y = x;
  sort(y.begin(), y.end());
  int ym1 = y.at(n / 2 - 1), ym2 = y.at(n / 2);
  for (int i = 0; i < n; i++) {
    if (x.at(i) <= ym1) cout << ym2 << endl;
    else cout << ym1 << endl;
  }
}

Measured memory_bytes: 3712
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriterSize(os.Stdout, 1000000)
)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer writer.Flush()
	n := scanInt()
	b := scanInts(n - 1)

	if n == 2 {
		fmt.Println(b[0] * 2)
		return
	}

	min := func(n ...int) int {
		ret := math.MaxInt64
		for _, v := range n {
			if v < ret {
				ret = v
			}
		}
		return ret
	}

	ans := b[0] + b[n-2]
	for i := 1; i < n-1; i++ {
		ans += min(b[i-1], b[i])
	}

	fmt.Println(ans)
}

func scanInt() int {
	i, _ := strconv.Atoi(scanString())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanString() string {
	scanner.Scan()
	return scanner.Text()
}

func scanStrings(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanString()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

// greatest common divisor(最大公約数)
func gcd(a, b int) int {
	for {
		mod := a % b
		if mod == 0 {
			return b
		}
		a, b = b, mod
	}
}

// latest common multiple(最小公倍数)
func lcm(a, b int) int {
	return (a / gcd(a, b)) * b
}

func fact(n int) int {
	ret := 1
	for i := 1; i <= n; i++ {
		ret *= i
	}
	return ret
}

func perm(n, r int) int {
	ret := 1
	for i := 0; i < r; i++ {
		ret *= n
		n--
	}
	return ret
}

func isPrimeNum(n int) bool {

	if n <= 1 {
		return false
	}

	l := int(math.Sqrt(float64(n)) + 1.)
	for i := 2; i < l; i++ {
		if n%i == 0 {
			return false
		}
	}

	return true
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll N;
	cin >> N;
	cout << N * (N - 1) / 2 << endl;

	return 0;
}



Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926

typedef long long int ll;

//ll num[ten52];
//ll num[10][10];
//set<ll> sll;

int main(void)
{
    long long int sum=0,range=0,ceiling;
    double ans=0.0,d;
    long long int m,n,o,i,j,k=0,money;
    long long int a,a1=0,a2=0,a3=0,ar,as,at1;
    char c;
    a=a1=a2=a3=0;
    //vector <int> v;
    //float f,g,h;
    //int c,d,big=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a;
        if(a%2==1) continue;
        if(a%3!=0&&a%5!=0)
        {
            cout<<"DENIED";
            return 0;
        }
    }
    cout<<"APPROVED";
    return 0;
}





Measured memory_bytes: 256
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <set> 
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1e9;

set<string>S;
string s;
int k;

int main(){
	ios::sync_with_stdio(false);
	cin>>s>>k;int n=s.size();
	for(int i=0;i<n;i++)
		for(int k=0;k<=4;k++){
			int j=i+k;if(j==n)break;
			S.insert(s.substr(i,j-i+1));
//			cout<<s.substr(i,j-i+1)<<endl;
		}
	int cur=0;
	while(S.size()){
		if(++cur == k)return cout<<*S.begin(), 0;
		S.erase(S.begin());
//		cout<<"  "<<*S.begin()<<endl;
	}

	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define ceil(a, b) a / b + !!(a % b)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)

int main() {
    int a, b, c;
    while (cin >> a >> b >> c) {
        if (a == 0 && b == 0 && c == 0) break;
        int in[a]; rep(i, a) cin >> in[i];
        int table[a - 1]; rep(i, a - 1) table[i] = in[i] - in[i + 1];
        //rep(i, a - 1) cout << table[i] << " "; cout << endl;
        int ans = 0, num = 0;
        rrep(i, b - 1, c) {
            if (table[i] == 0) continue;
            if (table[i] >= ans) {
                ans = table[i];
                num = i;
            }
        }
        cout << num + 1 << endl;
    }
}



Measured memory_bytes: 3040
#include <iostream>
#include <math.h>
#include<iomanip>
#include <string>
using namespace std;

struct Card {
    char suit;
    int value;
};

void BubbleSort(struct Card A1[], int N){
    for (int i = 0; i < N; i++) {
        for (int j = N - 1; j > i; j--) {
            if (A1[j].value < A1[j-1].value) {
                Card t = A1[j];
                A1[j] = A1[j - 1];
                A1[j - 1] = t;
            }
        }
    }
}

void SelectionSort(struct Card A2[], int N) {
    for (int i = 0; i < N; i++) {
        int minj = i;

        for (int j = i; j < N; j++)
            if(A2[j].value < A2[minj].value) minj = j;
        Card t = A2[i];
        A2[i] = A2[minj];
        A2[minj] = t;
    }
}

int main() {
    int N;
    Card A1[36], A2[36];
    int a1[36], a2[36], a3[36], b[13] = {};

    cin >> N;
    for (int i = 0; i < N; i++) cin >> A1[i].suit >> A1[i].value;
    for (int i = 0; i < N; i++) A2[i] = A1[i];
    BubbleSort(A1, N);
    SelectionSort(A2, N);
    for (int i =0; i < N; i++) {
        if (i) cout << " ";
        cout << A1[i].suit << A1[i].value;
    }
    cout << endl;
    cout << "Stable\n";

    for (int i= 0; i < N; i++) {
        if (i) cout << " ";
        cout << A2[i].suit << A2[i].value;
    }
    cout << endl;
    for (int i = 0; i < N; i++) {
        if (A2[i].suit != A1[i].suit) {
            cout << "Not stable\n";
            break;
        }
        if (i == N - 1) cout << "Stable\n";
    }

    return 0;
}

Measured memory_bytes: 3088
import sys
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def main():
    N = int(input())

    Ss = {}
    for x in range(N):
        tmp = ''.join(sorted(input()))

        if tmp in Ss:
            Ss[tmp] += 1

        else:
            Ss[tmp] = 1


    ans = 0
    for i in Ss.values():
        if i != 1:
            ans += combinations_count(i, 2)

    print(ans)

main()

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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];
		ll res=0,cur=0;
		for(int i=0,j=0;i<n;i++){
			for(;j<n&&!(cur&a[j]);j++)
				cur^=a[j];
			cur^=a[i];
			res+=j-i;
		}
		cout<<res<<endl;
	}
}


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

int main() {
  long long N,M,K;
  cin >> N >> M >> K;
  long long ans = 0;
  long long Ki = 1;
  long long perKi;
  for (int i=2; i<K+1; i++) {
    Ki *= i;
    Ki %= 1000000007;
  }
  long long moto;
  perKi = Ki;
  for (int i=0; i<9; i++) {
    moto = perKi;
    for (int i=0; i<9; i++) {
      perKi *= moto;
      perKi %= 1000000007;
    }
  }
  for (int i=0; i<5; i++) {
    perKi *= Ki;
    perKi %= 1000000007;
  }
  long long ansN = 0;
  long long ansM = 0;
  for (int i=1; i<N; i++) {
    ansN += i*(N-i);
    ansN %= 1000000007;
  }
  ansN *= M;
  ansN %= 1000000007;
  ansN *= M * 2;
  ansN %= 1000000007;
  
  for (int i=1; i<M; i++) {
    ansM += i*(M-i);
    ansM %= 1000000007;
  }
  ansM *= N;
  ansM %= 1000000007;
  ansM *= N * 2;
  ansM %= 1000000007;
  
  ans = ansN + ansM;
  
  long long KC2 = K * (K-1) / 2;
  KC2 %= 1000000007;
  ans *= KC2;
  ans %= 1000000007;
  cerr << ans << endl;
  
  for (int i=0; i<K-2; i++) {
    ans *= (N*M-i-2);
    ans %= 1000000007;
  }
  cerr << ans << endl;
  cerr << perKi << endl;
  ans *= perKi;
  ans %= 1000000007;
  cout << ans << endl;
  
  return 0;
}

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

int main()
{
	double a;
	while (cin >> a)
	{
		double ans = a;
		for (int i = 0; i < 9; i++)
		{
			if (i % 2 == 0) a *= 2;
			else a /= 3;
			ans += a;
		}
		cout << fixed << setprecision(10) << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1276
x, y = list(map(int, input().split()))
if y == 0:
    print(abs(x) + (x > 0))
elif x < y < 0:
    print(y - x)
elif 0 < y < x:
    print(x - y + 2)
else:
    print(abs(abs(y) - abs(x)) + (x < 0) + (y < 0))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

vector<ll>a;
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		a.push_back(x);
	}
	sort(a.begin(),a.end());
	ll now=a[0];ll ans=0;
	for(int i=1;i<n;i++){
		if(now*2>=a[i]){
			ans++;
		}
		else{
			ans=0;
		}
		now+=a[i];
	}
	cout <<ans+1;
	return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
long long n,a,b;
int main (){
	cin>>n>>a>>b;
	if(n>1&&b>=a||n==1&&a==b){
		cout<<(b-a)*(n-2)+1<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	int a, b;
	cin >> a >> b;

	if ((a >= 1) && (a <= 9) && (b >= 1) && (b <= 9)) cout << a * b << "\n";
	else cout << "-1\n";

	return 0;
}


Measured memory_bytes: 256
import sys
from collections import Counter

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def vanish(p, details=False):
    while p:
        if details:
            print(p)
        n = len(p)
        q = [x for x in p if x != n]
        if len(q) == len(p):
            return False
        p = q[:]
    return True


def check(n):
    if n == 3:
        for i in range(1, n + 1):
            for j in range(i, n + 1):
                for k in range(j, n + 1):
                    p = [i, j, k]
                    if vanish(p):
                        print(p)
                        # print()
                        # vanish(p, details=True)
    if n == 5:
        for i in range(1, n + 1):
            for j in range(i, n + 1):
                for k in range(j, n + 1):
                    for l in range(k, n + 1):
                        p = [i, j, k, l]
                        if vanish(p):
                            print(p)
                            # print()
                            # vanish(p, details=True)
    if n == 5:
        for i in range(1, n + 1):
            for j in range(i, n + 1):
                for k in range(j, n + 1):
                    for l in range(k, n + 1):
                        for m in range(l, n + 1):
                            p = [i, j, k, l, m]
                            if vanish(p):
                                print(p)
                                # print()
                                # vanish(p, details=True)


def solve_small():
    # check(3)
    # check(4)
    # check(5)
    n, m = read_int_list()
    a = read_int_list()
    p = [read_int_list() for _ in range(m)]
    c = Counter(a)
    res = []
    for x, y in p:
        c[a[x - 1]] -= 1
        a[x - 1] = y
        c[a[x - 1]] += 1
        covered = set(range(n))
        for i, ni in c.items():
            for j in range(i - ni, i):
                if j in covered:
                    covered.remove(j)
        r = len(covered)
        res.append(r)
    return '\n'.join(map(str, res))


def solve():
    n, m = read_int_list()
    a = read_int_list()
    p = [read_int_list() for _ in range(m)]
    c = Counter(a)
    covered = Counter({i: 0 for i in range(n)})
    for i, ni in c.items():
        for j in range(i - ni, i):
            if 0 <= j:
                covered[j] += 1
    r = 0
    for i, v in covered.items():
        if 0 <= i:
            if v == 0:
                r += 1
    res = []
    for x, y in p:
        x -= 1
        i = a[x] - c[a[x]]
        covered[i] -= 1
        if 0 <= i:
            if covered[i] == 0:
                r += 1
        c[a[x]] -= 1
        a[x] = y
        c[a[x]] += 1
        i = a[x] - c[a[x]]
        if 0 <= i:
            if covered[i] == 0:
                r -= 1
        covered[i] += 1
        res.append(r)
    return '\n'.join(map(str, res))


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


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

using System.Collections;

class Program
{
    static void Main()
    {
        int[] nt = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        int N = nt[0];
        int T = nt[1];

        var routeList = Enumerable.Range(0, N)
            .Select(n => Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray())
            .Select(arr => new { c = arr[0], t = arr[1] })
            .ToArray();

        var routeCand = routeList.Where(route => route.t <= T);

        if (routeCand.Any())
        {
            Console.WriteLine(routeCand.Min(route => route.c));
        }
        else
        {
            Console.WriteLine("TLE");
        }
    }
    
}

Measured memory_bytes: 13524
package main

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

var graph [2*1e5 + 1][]int

func main() {
	var N, Q int
	Scan(&N, &Q)
	ans := make([]int, N+1)

	for i := 1; i < N; i++ {
		var a, b int
		Scan(&a, &b)
		graph[a] = append(graph[a], b)
		graph[b] = append(graph[b], a)
	}

	for q := 0; q < Q; q++ {
		var p, x int
		Scan(&p, &x)
		ans[p] += x
	}

	dfs(1, -1, ans)
	for i := 1; i <= N; i++ {
		fmt.Printf("%d ", ans[i])
	}
}

func dfs(v int, p int, ans []int) {
	for _, t := range graph[v] {
		if t == p {
			continue
		}
		ans[t] += ans[v]
		dfs(t, v, ans)
	}
}

func Println(xs ...int) {
	vs := make([]interface{}, len(xs))
	for i := 0; i < len(xs); i++ {
		vs[i] = xs[i]
	}
	fmt.Println(vs...)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}


Measured memory_bytes: 49456
#include <iostream>
#include <list>
#include <cstdio>

using namespace std;

int main() {
	int cnt;
	int num;
	char command[15];
	list<int> ls;
	list<int>::iterator itr;
	cin >> cnt;


	while ( cnt ) {
		scanf( "%s", command );
		if ( command[0] == 'i' ) {
			scanf( "%d", &num );
			ls.push_front( num );
		} else if ( command[6] == 'F' ) {
			ls.pop_front();
		} else if ( command[6] == 'L' ) {
			ls.pop_back();
		} else if ( command[0] == 'd' ) {
			scanf( "%d", &num );
			for ( itr = ls.begin() ; itr != ls.end() ; itr++ ) {
				if ( *itr == num ) {
					ls.erase( itr );
					break;
				}
			}
		}
		cnt--;
	}

	cnt = ls.size();
	itr = ls.begin();
	for ( int i = 0 ; i < cnt ; i++ ) {
		if ( i == cnt-1 ) {
			cout << *itr << endl;
		} else {
			cout << *itr << " ";
		}
		itr++;
	}

	return 0;
}



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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class WarshallFloyd {
public:
    int n;
    vector<vector<ll>> dist;
    WarshallFloyd(int n):n(n){
        dist.assign(n, vector<ll>(n, inf));
    }

    void add(int from, int to, ll cost){
        dist[from][to] = cost;
        dist[to][from] = cost;
    }

    void build(){
        rep(k, n){
            rep(i, n){
                rep(j, n){
                    chmin(dist[i][j], dist[i][k] + dist[k][j]);
                }
            }
        }
    }
};

class DJoisinosTravel {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n, m, R;
        in >> n >> m >> R;
        WarshallFloyd wf(n);
        vector<int> r(R, 0);
        rep(i, R) {
            in >> r[i];
            r[i]--;
        }
        int a, b;
        ll c;
        rep(i, m){
            in >> a >> b >> c;
            a--; b--;
            wf.add(a, b, c);
        }

        wf.build();

        ll mi = inf;
        function<void(int, int, ll, vector<int>)> dfs = [&](int u, int cnt, ll d, vector<int> visit){
            if(cnt == R){
                chmin(mi, d);
                return;
            }
            visit[u] = 1;
            rep(j, R){
                if(visit[j]) continue;
                dfs(j, cnt+1, d + wf.dist[r[u]][r[j]], visit);
            }
        };

        vector<int> visit;
        rep(i, R){
            visit.assign(R, 0);
            dfs(i, 1, 0, visit);
            //cout << i sp mi << endl;
        }

        out << mi << endl;
	}
};


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


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

int main() {
  
int n;
cin>>n;
vector <int> vec(n);
for(int i=0;i<n;i++){
    cin>>vec[i];
}
int x=1,count=0;
bool a=true;
for(int i=0;i<n;i++){
    count++;
    x=vec[x-1];
    if(x==2){
        cout<<count<<endl;
        a=false;
        break;
    }

    }
    if(a){
        cout<<-1<<endl;
    }



}


Measured memory_bytes: 768
from collections import deque 
H, W = map(int, input().split())
graph = [list(input()) for _ in range(H)]
dist = [[-1] * W for _ in range(H)]
q = deque([(0,0)])
dist[0][0] = 1
while q:
  x, y = q.popleft()
  if(x >= 1):
    if(dist[x-1][y] < 0 and graph[x-1][y] == '.'):
      dist[x-1][y] = dist[x][y] + 1
      q.append((x-1, y))
  if(x <= H-2):
    if(dist[x+1][y] < 0 and graph[x+1][y] == '.'):
      dist[x+1][y] = dist[x][y] + 1
      q.append((x+1, y))
  if(y >= 1):
    if(dist[x][y-1] < 0 and graph[x][y-1] == '.'):
      dist[x][y-1] = dist[x][y] + 1
      q.append((x, y-1))
  if(y <= W-2):
    if(dist[x][y+1] < 0 and graph[x][y+1] == '.'):
      dist[x][y+1] = dist[x][y] + 1
      q.append((x, y+1))
      
cnt = 0
if(dist[H-1][W-1] == -1):
  print(-1)
else:
  for i in range(H):
    for j in range(W):
      if(graph[i][j] == '#'):
        cnt += 1
  print(H*W-cnt-dist[H-1][W-1])

Measured memory_bytes: 40176
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  int n, m, a = 0, b;
  cin >> n >> m;
  rep(i,m)
  {
    cin >> b;
    a += b;
  }
  cout << (n >= a ? n - a : -1);
  return 0;
}


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

int main() {
	string S; cin >> S;
	bool T = true;
	for (int i = 0; i < S.size()/2; i++)
	{
		if (S[i] != S[S.size()-1-i])T = false;
	}
	for (int i = 0; i < (S.size()-1)/2; i++)
	{
		if (S[i] != S[(S.size() - 1) / 2 - 1 - i])T = false;
	}
	for (int i = (S.size()+3)/2; i < S.size(); i++)
	{
		if (S[i] != S[S.size() - 1 - i])T = false;
	}
	if (T)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdlib>
#include<vector>
using namespace std;
using ll=long long;
ll gcd(ll a, ll b){
    if(a==0)return b;
    return gcd(b%a, a);
}
ll lcm(ll a, ll b){
    return a/gcd(a,b)*b;
}
int main(){
    ll N, M;
    cin>>N>>M;
    string S, T;
    cin>>S;
    cin>>T;
    ll l=lcm(N,M);
    ll g=gcd(N,M);
    bool ok=true;
    for(ll i=0;i<g;i++){
        if(S[i*(N/g)]==T[i*(M/g)]){
            continue;
        }
        ok=false;
        break;
    }
    cout<<(ok?lcm(N,M):-1)<<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
const long long e=1e9+7;
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    if(abs(n-m)>1)
        printf("0\n");
    else{
        long long ans=1;
    for(int i=1;i<=n;i++)
        {ans*=i;
            ans%=e;
        }
       for(int i=1;i<=m;i++)
        {
            ans*=i;
            ans%=e;
        }
        if(n==m)
        {
            ans*=2;
            ans%=e;
        }
         printf("%lld\n",ans);
    }
}


Measured memory_bytes: 256
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/
 
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x
 
using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;
 
const ll MODBASE = 1000000007LL;
const int MAXN = 200010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int n, a, b;
ll f[MAXN], rev[MAXN];

ll mul(ll a, ll b) {
    return a * b % MODBASE;
}

ll add(ll a, ll b) {
    return (a + b) % MODBASE;
}

ll sub(ll a, ll b) {
    return (a - b + MODBASE) % MODBASE;
}

ll binPowMod(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1LL) res = res * a % MODBASE;
        a = a * a % MODBASE;
        b >>= 1LL;
    }
    return res;
}

ll C(int n, int k) {
    ll res = 1;
    FOR(i,n-k+1,n) res = mul(res, i);
    res = mul(res, rev[k]);
    return res;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    cin >> n >> a >> b;
    f[0] = 1;
    rev[0] = binPowMod(f[0], MODBASE-2);
    FOR(i,1,200000) {
        f[i] = mul(f[i-1], i);
        rev[i] = binPowMod(f[i], MODBASE-2);
    }
    ll res = binPowMod(2, n);
    res = sub(res, 1);

    res = sub(res, C(n, a));
    res = sub(res, C(n, b));
    cout << res;
    return 0;
}


Measured memory_bytes: 3328
#include<iostream>

using namespace std;

int main(){
  int N;
  cin>>N;
  bool f=false;
  int y=0,x=0,t=0;
  for(int i=0;i<N;i++){
    int ti,xi,yi;
    cin>>ti>>xi>>yi;
    auto d=abs(y-yi)+abs(x-xi);
    auto td=ti-t;
    f|=td<d||d-td&1;
    t=ti;
    y=yi;
    x=xi;
  }
  cout<<(f?"No":"Yes")<<endl;
}



Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int Aval, Bval;

        // int loop = (int) Math.min(A / 0.08, B / 0.1);
        // System.out.println(loop);
        for (int i = 1; i <= 1000; i++) {
            Aval = (int) (i * 0.08);
            Bval = (int) (i * 0.1);
            //System.out.println(Aval+" "+Bval);
            if (A == Aval && B == Bval) {
                // System.out.println("i*0.08 = "+(int)(i * 0.08)+"i*0.1 = "+(int)(i * 0.1));
                System.out.println(i);
                System.exit(0);
            }
        }
        System.out.println(-1);
        sc.close();
    }
}

Measured memory_bytes: 23252
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
	int d, t, s;
	cin >> d;
	cin >> t;
	cin >> s;
	if (t * s >= d)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3640
N, M = map(int,input().split())
AB = sorted([list(map(int,input().split())) for _ in range(N)])

money = 0

for a,b in AB:
    if M <= 0:
        break
    if M-b >= 0:
        money += a*b 
        M -=b 
    else:
        money += a*M
        M -=M

print(money)

Measured memory_bytes: 61672
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif
    // int T;cin>>T;while(T--) 
    {
        int x, n, t;
        cin>>x>>n;
        int has[301]={0};
        ifr(i, 0, n) cin>>t, has[t+150] = 1;
        ll ans = -150,dif = abs(ans - x);
        for(int i=-150; i<=150; i++) {
            if(has[i+150]) continue;
            if(abs(i-x) < dif) {
                dif = abs(i-x);
                ans = i;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAXS 2000100
#define MAXT 5243000

PLL tree[MAXT]; //{max,nakl}

vector<PLL> zb[MAXS];
vector<LL> mk[MAXS];

LL wyn=0;
int n,m;

void upd(int v,int a,int b,int l,int r,LL val){
	
	if(a>r||b<l||v>=MAXT)
		return;
		
	if(l<=a&&b<=r){
		tree[v].ST+=val;
		tree[v].ND+=val;
		return;
	}

	tree[v*2].ND+=tree[v].ND;
	tree[v*2+1].ND+=tree[v].ND;
	tree[v*2].ST+=tree[v].ND;
	tree[v*2+1].ST+=tree[v].ND;
	tree[v].ND=0;
	
	int sr=(a+b-1)/2;
	upd(v*2,a,sr,l,r,val);
	upd(v*2+1,sr+1,b,l,r,val);
	
	tree[v].ST=max(tree[2*v+1].ST,tree[2*v].ST);	
}

LL query(int v,int a,int b,int l,int r){
	
	if(a>r||b<l||v>=MAXT)
		return LONG_LONG_MIN;
	
	if(l<=a&&b<=r)
		return tree[v].ST;
	
	tree[v*2].ND+=tree[v].ND;
	tree[v*2+1].ND+=tree[v].ND;
	tree[v*2].ST+=tree[v].ND;
	tree[v*2+1].ST+=tree[v].ND;
	tree[v].ND=0;
	
	int sr=(a+b-1)/2;
	return max(query(v*2,a,sr,l,r),query(v*2+1,sr+1,b,l,r));	
}



int main(){ 
	
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>m;
	
	int szer=1;
	while(szer<=n)
		szer*=2;
	szer*=2;
		
	REP(I,m){
		int t1,t2,a1;
		cin>>t1>>t2>>a1;
		zb[t2].PB({t1,a1});
		mk[t1].PB(a1);
	}
	
	LL wyn=0;
	
	FOR(i,1,n){
		
		for(auto x:mk[i])
			upd(1,0,szer-1,0,i-1,x);
			
		LL val=query(1,0,szer-1,0,i-1);
		wyn=max(wyn,val);
		upd(1,0,szer-1,i,i,val);
		
		for(auto x:zb[i]) 
			upd(1,0,szer-1,0,x.ST-1,-x.ND);
		
	}
	
	cout<<tree[1].ST;
		
	return 0;
}


Measured memory_bytes: 119296
//In the name of God:)
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long int
#define fast  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int MAXN = 1e5 + 10;

bool checkPalindrome(string str){
    int n = str.size();
    for(int i = 0 ; i < n/2 ; i++){
        if(str[i] != str[n - i - 1]) return 0;
    }
    return 1;
}

int main(){
    fast
    string str;
    cin>>str;
    int n = str.size();
    if(checkPalindrome(str) && checkPalindrome(str.substr(0 , n/2)) && checkPalindrome(str.substr((n + 3) / 2 - 1 , n/2))){
        cout<<"Yes"<<'\n';
    }
    else{
        cout<<"No"<<'\n';
    }
}


Measured memory_bytes: 256