akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define int         long long
#define uint        unsigned int
#define ld          long double
#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define FOR(i,a,b)  for(int i=a;i<b;++i)
#define RFOR(i,a,b) for(int i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        200005
#define all(v)      v.begin(),v.end()
#define sz(x)       (int)x.size()
#define mod         1000000007
#define pqueue      priority_queue<int>
#define pdqueue     priority_queue< pii,vector<pii> ,greater< pii >>

using namespace std;


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

/*int power(int a,int n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
    return power((a*a)%mod,n/2)%mod;
}*/
//const int md = 998244353;


signed main()
{
    showoff;
    int n,ans = 0;
    cin >> n;
    FOR(i,0,n){
        int x;
        cin >> x;
        ans = __gcd(ans,x);
    }
    cout << ans << "\n";
    return 0;
}


//*->for large size of matrix take int not long long ......

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const int MAXN = 200000;

int N, M;

struct Edge {
    int to;
    int weight;
    int next;
};

vector<Edge> edges(MAXN);
vector<int> head(MAXN, -1);
vector<int> matchingx(MAXN, -1);
vector<int> matchingy(MAXN, -1);
vector<bool> check(MAXN);
vector<int> dis(MAXN);
vector<bool> vis(MAXN, false);

int cnt = 1;

void addEdge(int from, int to, int weight) {
    edges[cnt].to = to;
    edges[cnt].weight = weight;
    edges[cnt].next = head[from];
    head[from] = cnt++;
}

bool dfs(int u) {
    for (int i = head[u]; i != -1; i = edges[i].next) {
        int v = edges[i].to;
        if (!check[v]) {
            check[v] = true;
            if (matchingy[v] == -1 || dfs(matchingy[v])) {
                matchingy[v] = u;
                matchingx[u] = v;
                return true;
            }
        }
    }
    return false;
}

int hungarian() {
    int ans = 0;
    fill(matchingx.begin(), matchingx.end(), -1);
    fill(matchingy.begin(), matchingy.end(), -1);
    for (int u = 1; u <= N; ++u) {
//        if (matchingx[u] == -1) {
        {
            fill(check.begin(), check.end(), false);
            if (dfs(u)) {
                ++ans;
            }
        }
    }
    return ans;
}

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<>> que;
    fill(dis.begin(), dis.end(), INF);
    dis[s] = 0;
    que.push(P(0, s));
    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int u = p.second;
        if (vis[u]) continue;
        vis[u] = true;
        for (int i = head[u]; i != -1; i = edges[i].next) {
            int v = edges[i].to;
            if (dis[v] > dis[u] + edges[i].weight && !vis[v]) {
                dis[v] = dis[u] + edges[i].weight;
                que.push(P(dis[v], v));
            }
        }
    }
}

int main() {
    string s;
    cin >> s;
    string delimiter = "/";
    vector<string> tokens;
    size_t pos;
    while ((pos = s.find(delimiter)) != string::npos) {
        string token = s.substr(0, pos);
        tokens.push_back(token);
        s.erase(0, pos + delimiter.length());
    }
    tokens.push_back(s);
    int year = stoi(tokens[0]);
    int month = stoi(tokens[1]);
    int day = stoi(tokens[2]);
    if (year < 2019) {
        cout << "Heisei" << endl;
    } else if (year == 2019 && month <= 4) {
        cout << "Heisei" << endl;
    } else if (year == 2019 && month == 4 && day <= 30) {
        cout << "Heisei" << endl;
    } else {
        cout << "TBD" << endl;
    }
    return 0;
}

Measured memory_bytes: 5760
# %%time
def gcd(a, b):
    if a < b :
        a, b = b, a
    while True:
        a, b = b, a % b
        if b == 0:
            return a
        
k =  int(input())
s = 0
dic = {}
for i in range(1, k+1):
    for j in range(i + 1, k+1):
        a = gcd(i, j)
        for l in range(1, k+1):
            s += gcd(a, l)
            
s = s* 2
for i in range(1, k+1):
    j = i
    a = gcd(i, j)
    for l in range(1, k+1):
        s += gcd(a, l)
print(s)

Measured memory_bytes: 9244
#pragma GCC optimize("O3")   //
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 eng(seed);

uniform_int_distribution<> DD(0, (1ll << 31));

ll random2(){
    return (ll(DD(eng))*(1ll << 31) + ll(DD(eng))) & ((1ll << 62ll)-1);
}

ll n,m,k,q,T;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 200001;



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

    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);

    ll a,b,c,d,e;
    cin >> n;
    set<string> S;
    rep(c1,0,n){
        string s;
        cin >> s;
        S.insert(s);
    }
    cout << sz(S) << "\n";

    return 0;
}


Measured memory_bytes: 19280
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));

int main() {
	int n, a;
	cin >> n >> a;
	int m = n % 500;
	if (m <= a)cout << "Yes";
	else cout << "No";
	return 0;
}





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

using namespace std;

const int MAX_N = 6e3 + 5;

string s;
int posa [MAX_N];
int posb [MAX_N];
int idx [MAX_N];
int dead [MAX_N];
int dp [MAX_N];

vector<string> sol;

string sfr (int sta) {
  string ans;

  int bal = 0;
  for (int i = sta; true; i++) {
    if (!dead[i]) {
      if (s[i] == 'b') {
        bal++;
        ans += 'b';
      } else {
        if (posb[idx[i]] >= sta) {
          bal--;
          ans += 'a';
        }
      }
    }
    
    if (bal == 0) break;
  }

  return ans;
}

int process (int sta) {
  string ans;

  int bal = 0;
  for (int i = sta; true; i++) {
    if (!dead[i]) {
      if (s[i] == 'b') {
        bal++;
        ans = max(ans, sfr(i));
      } else {
        bal--;
      }
    }
    
    if (bal == 0) {
      sol.push_back(ans);
      return i + 1;
    }
  }
}

int main () {
  int n;
  cin >> n;

  cin >> s;

  int ca = 0, cb = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] == 'a') {
      posa[ca] = i;
      idx[i] = ca;
      ca++;
    } else {
      posb[cb] = i;
      idx[i] = cb;
      cb++;
    }
  }

  int m = 0; // the length of the first half
  for (int i = 0; i < n; i++) {
    if (posb[i] < posa[i]) {
      m = max(m, posa[i] + 1);
    }
  }

  for (int i = 0; i < n; i++) {
    if (posa[i] < posb[i] && posb[i] < m) {
      dead[posa[i]] = 1;
      dead[posb[i]] = 1;
    }
  }

  int curp = 0;
  while (curp < m) {
    curp = process(curp);
  }

  string suffmx;
  for (int i = (int) sol.size() - 1; i >= 0; i--) {
    if (sol[i] >= suffmx) {
      suffmx = sol[i];
    } else {
      sol[i].clear();
    }
  }

  for (int i = 0; i < (int) sol.size(); i++) {
    cout << sol[i];
  }
  
  // second half with dp
  // number of independent pairs 'ab'
  int sc = 0;
  for (int i = m + 1; i < 2 * n; i++) {
    if (s[i] == 'b') {
      dp[i] = max(1 + dp[posa[idx[i]]], dp[i - 1]);
    } else {
      dp[i] = dp[i - 1];
    }
    sc = max(sc, dp[i]);
  }

  for (int i = 0; i < sc; i++) {
    cout << "ab";
  }
  cout << endl;
}


Measured memory_bytes: 3836
#include<stdio.h>
int main(void)
{
	int ban;
	double tai,sin,BMI;
	while(scanf("%d,%lf,%lf",&ban,&tai,&sin)!=EOF) {
		BMI=tai/(sin*sin);
		if(BMI>=25.0){
			printf("%d\n",ban);
		}
	}
	return 0;
}

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

public class Main{
    static public void main(String[] args) throws Exception{
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ")
        Main main = new Main();
        main.solve();
//        System.out.println(main.solve());
    }
    int solve(){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), m = sc.nextInt();
        int[] WARec = new int[n];
        boolean[] hasAc = new boolean[n];
        for(int i=0;i<m;i++){
            int p = sc.nextInt()-1;
            String res = sc.next();
            if(res.equals("AC")){
                hasAc[p] = true;
            } else{
                if(hasAc[p]) continue;
                WARec[p] += 1;
            }
        }
        int acNum = 0, penalty = 0;
        for(int i=0;i<n;i++) {
            acNum += hasAc[i] ? 1 : 0;
            penalty += hasAc[i]? WARec[i]:0;
        }
        System.out.println(acNum+" "+penalty);
        return 0;
    }
}



Measured memory_bytes: 64996
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int>a;
    for(int i=0;i<n;i++){
        int temp;
        cin>>temp;
        a.push_back(temp);
    }
    int ans=0,x=0;
    int j=0;
    while(x<=k and j<n+1){
        ans++;
        x=x+a[j];
        j++;
    }
    cout<<ans;

}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;
using namespace std;
using Graph = vector<vector<int>>;
using Field = vector<string>;
using DGraph = vector<vector<pair<int, int>>>;

const long long INF = 1LL << 60;
//---//

int main() {
	INT a, b, n,ans=0; cin >> a >> b >> n;

	if (b - 1 <= n)n = max(n % b, b - 1);
	else n = n % b;

	ans = (a * n) / b - (n / b) * a;
	
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3632
// Problem : C - Sum of product of pairs
// Contest : AtCoder - AtCoder Beginner Contest 177
// URL : https://atcoder.jp/contests/abc177/tasks/abc177_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define start ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(z, x, y) for(int z=x;z<=y;++z)
#define repd(z, x, y) for(int z=x;z>=y;--z)
typedef long long ll;
const int maxn = (ll) 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
using namespace std;
long a[maxn];

int main() { 
	start;
	int n;cin>>n;
	long long sum = 0,ans = 0 ;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		sum %= mod;
	}
	rep(i,0,n-1){
		sum -= a[i];
		if(sum<0) sum += mod;
		ans += sum*a[i];
		ans %= mod;
	}
	
	cout<<ans;
	
	return 0; 
}

Measured memory_bytes: 5180
#include <bits/stdc++.h>
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007; // 998244353
using ll = long long;
using namespace std;

int main(){
	int x; cin >> x;
	if( x == 0 ) cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 3600
#Partition
import math
N,M = map(int,input().split())
n = 1
rootM = int(math.sqrt(M))+1
for i in range(rootM):
    if M % (i+1) == 0 and N*(i+1) <= M:
        if N*(M/(i+1)) <= M and n <= (M/(i+1)):
            n = M/(i+1)
        elif n <= i+1:
            n = i+1
        else:
            continue
print(int(n))

Measured memory_bytes: 3064
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
 
// ------------------------------------------------------------------------------------------------

ll a, b;

void func() {
    cin >> a >> b;
    cout << max(a * b, max(a + b, a - b)) << endl;
}

int main() {
    fast_io; cout_precision;
    ll t = 1; // cin >> t;
    for (ll i = 0; i < t; i++) {
        func();
    }
}

Measured memory_bytes: 256
lis = list(map(int,input().split()))
Anum = min(lis[0],lis[3])
Bnum = max(min(lis[1],lis[3]-Anum),0)
Cnum = max(min(lis[2],lis[3]-Anum-Bnum),0)
print(Anum - Cnum)

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

int main(){
    ll n,k;
    cin >> n >> k;
    ll cnt = 0;
    for(ll i=k; i<=n+1; ++i){
        cnt += (2*n-i+1)*i/2- i*(i-1)/2 + 1;
    }
    cout << cnt%1000000007 << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<utility>
#include<string>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include <map>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define all(u) u.begin(),u.end()
#define pl pair<ll,ll>
#define fi first
#define se second
#define inf 1000000007

ll N;
ll dp[100010] = {inf};




int main() {
    cin >> N;
    dp[0] = 0;
    repi(i,1,100001){
        ll temp = inf;
        temp = min(temp,dp[i-1]+1);
        repi(j,1,8){
            if (i < pow(6,j)) continue;
            else temp = min(temp,dp[i-(ll)pow(6,j)]+1);
        }
        repi(j,1,7){
            if (i < pow(9,j)) continue;
            else temp = min(temp,dp[i-(ll)pow(9,j)]+1);
        }
        dp[i] = temp;
    }
    cout << dp[N] << endl;
   
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

int main()
{
        int x1, y1, x2, y2;
        std::cin >> x1 >> y1 >> x2 >> y2;

        int y3 = y2 + (x2 - x1);
        int x3 = x2 - (y2 - y1);
        int y4 = y3 - (y2 - y1);
        int x4 = x3 - (x2 - x1);
        std::cout << x3 << " " << y3 << " " << x4 << " " << y4 << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;


int N,M;
int A[112345],B[112345];
ll ans;
P drink[112345];
signed main(){
    cin>>N>>M;
    rep(i,N)cin>>drink[i].first>>drink[i].second;

    sort(drink,drink+N);

    int idx=0;
    while(M>0){
        if(drink[idx].second==0)idx++;
        ans+=drink[idx].first;
        drink[idx].second--;
        M--;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,i,j,k;
	cin>>n;
	n%=10;
	if(n==0||n==1||n==6||n==8)cout<<"pon";
	else if(n==3)cout<<"bon";
	else cout<<"hon";
}

Measured memory_bytes: 3624
import sys
import io, os
input = sys.stdin.buffer.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n = int(input())
#XY = [0]*n
Z = [0]*n
W = [0]*n
for i in range(n):
    x, y = map(int, input().split())
    #XY[i] = (x, y)
    Z[i] = x+y
    W[i] = x-y

Z.sort()
W.sort()
#print(Z)
#print(W)
maxz = Z[-1]-Z[0]
maxw = W[-1]-W[0]
ans = max(maxw, maxz)
print(ans)


Measured memory_bytes: 75848
#include <stdio.h>
#define DEB 100000

int main()
{
	int n;
	int deb = DEB;
	
	scanf("%d", &n);
	for(; n>0; n--){
		deb += deb * 0.05;
		deb = (deb-1) - (deb-1)%1000 + 1000;
	}
	printf("%d\n", deb);
	
	return 0;
}

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

int main()
{
  char c;
  cin >> c;
  
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u' )
  {
    cout << "vowel" << endl;
  }
  else
  {
    cout << "consonant" << endl;
  }

  return 0;
}

Measured memory_bytes: 3540
import numpy as np
 
N = int(input())
A = input().split()
A = np.array([int(val) for val in A])
 
A_even = set(A[A%2==0])
A_three = set(A[A%3==0])
A_five = set(A[A%5==0])
 
A_approve = A_even & (A_three | A_five)
 
if A_even == A_approve:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 23348
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define INF 100000000000L

int main(void) {
	long long N=0, M=0;
	
	
	std::cin >> N >> M;
	
	std::vector<std::pair<long long, long long>> AB;
	long long a, b;
	for (int i = 0; i < N; i++) {
		std::cin >> a >> b;
		AB.push_back(std::make_pair(a, b));
	}
	std::sort(AB.begin(), AB.end());

	//for (int i = 0; i < N; i++) {
	//	std::cout << AB[i].first << ' ' << AB[i].second << std::endl;
	//}

	long long sum = 0;
	long long all_money = 0;
	for (int i = 0; i < N; i++) {
		
		if (AB[i].second < (M-sum)) {
			sum += AB[i].second;
			all_money += AB[i].first * AB[i].second;
		}
		else {
			all_money += (M-sum) * AB[i].first;
			sum += (M - sum);
			break;
		}
	}
	std::cout << all_money << std::endl;
}

Measured memory_bytes: 2420
void main()
{
    long k = rdElem;
    long a, b;
    rdVals(a, b);

    foreach (i; a .. b+1)
    {
        if (i % k == 0)
        {
            "OK".writeln;
            return;
        }
    }

    "NG".writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;
enum double eps = 1.0e-9;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.mathspecial;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;
import core.bitop;

Measured memory_bytes: 2704
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        string N;
        cin >> N;
        int ans = 0;
        rep(i, 3)
        {
                if (N[i] == '1')
                        ans++;
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#define ll long long
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;


struct UnionFindTree{
	vl par;
	vl mem;
	ll groups;

	//最初はすべて親
	UnionFindTree(ll n) :par(n),mem(n,1),groups(n){
		rep(i, n) par[i] = i;
	}

	//おおもとを探す
	ll root(ll x){
		if (par[x] == x) return x;
		par[x] = root(par[x]);
		return par[x];
	}

	//親(グループ)を同じにする
	void unite(ll x, ll y){
		ll rx = root(x);
		ll ry = root(y);
		if (rx == ry) return;
		groups--;
		mem[ry] += mem[rx];
		par[rx] = ry;
	}

	//同じグループか
	bool same(ll x, ll y){
		return root(x) == root(y);
	}

	//同じグループの人数
	ll member(ll x){
		return mem[root(x)];
	}
};

int main(){
	ll n, m; cin >> n >> m;
	UnionFindTree uft(n);
	vector<pair<ll, ll> > bridge(m);
	rep(i, m){
		ll a, b; cin >> a >> b;
		a--; b--;
		bridge[m-1-i].first = a;
		bridge[m-1-i].second = b;
	}
	ll ans = (n*(n-1)) / 2;
	vl anss;
	anss.push_back(ans);
	rep(i, m){
		if (!uft.same(bridge[i].first, bridge[i].second)){
			ans -= uft.member(bridge[i].first)*uft.member(bridge[i].second);
		}
		ans = max(ans, 0LL);
		anss.push_back(ans);
		uft.unite(bridge[i].first, bridge[i].second);
	}
	rep(i, m){
		cout << anss[m-1-i] << endl;
	}

	return 0;
}

Measured memory_bytes: 5364
#include<bits/stdc++.h>
using namespace std;
int F[11451419];
#define EPS 1e-14
bool prime(int p){
    if(F[p]==0)return false;
    if(F[p]==1)return true;
     
    for(int i=2;i*i<=p;i++){
    	if(F[i]==0)continue;
        if(p%i==0){
	        F[p]=0;
	        return false;
        }
    }
    F[p]=1;
    return true;
}
int main()
{
for(int i=1;i<=10000000;i++)F[i]=-1;
    while(true){
        int N;
        scanf("%d",&N);
        if(N==0)break;
        if(N>=13&&N<=18){
            printf("13\n");
            continue;
        }
        while(true){
            if(N%10!=9){
                N--;
                continue;
            }
            if(N%3!=1){
            	N--;
            	continue;
            }
            if(prime(N)&&prime(N-2)&&prime(N-6)&&prime(N-8)){
                printf("%d\n",N);
                break;
            }
            else N-=10;
        }
    }
    return 0;
}

Measured memory_bytes: 42152
import sys

N,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

mod=10**9+7
MAX=N*M+100
g1=[1,1]
g2=[1,1]
for i in range(2,MAX+1):
    num_1=g1[-1]*i%mod
    g1.append(num_1)
    g2.append(pow(num_1,mod-2,mod))
def H(n,r):
    return g1[n]*g2[n-r]%mod

data=[]
for i in range(N):
    data.append([a[i],i,0])
for i in range(M):
    data.append([b[i],i,1])
data.sort()
for i in range(N+M-3):
    if data[i][0]==data[i+2][0]:
        print(0)
        sys.exit()
    if data[i][0]==data[i+1][0] and data[i][2]==data[i+1][2]:
        print(0)
        sys.exit()
count=[0,0]
lll=[M,N]
cnt=0
flag=[[0]*N,[0]*M]
i=0
ans=1
while i<N+M:
    m,num,d=data[i]
    if i+1<N+M and data[i+1][0]==m:
        m,num2,d2=data[i+1]
        qqq=N+M-1-sum(count)
        if d!=d2 and flag[d][num]==flag[d2][num2]==0 and m-cnt>=qqq:
            flag[d2][num2]=1
            flag[d][num]=1
            ans=ans*H(m-cnt-1,qqq-1)%mod
            cnt+=qqq
            count[0]+=1
            count[1]+=1
        else:
            ans*=0
        i+=2
    else:
        qqq=lll[d]-count[(d+1)%2]
        if flag[d][num]==0 and m-cnt>=qqq:
            flag[d][num]=1
            ans=ans*qqq*H(m-cnt-1,qqq-1)%mod
            cnt+=qqq
            count[d]+=1
        else:
            ans*=0
        i+=1
print(ans)    

Measured memory_bytes: 110732
using System;
//using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace solution
{
  class Class1
  {
    static void Main()
    {
      while (true)
      {
        List<char> s;

        if ((s = Console.ReadLine().ToList<char>())[0] == '-') break;
        int h = int.Parse(Console.ReadLine());

        for (int i = 0; i < h; i++)
        {
          int k = int.Parse(Console.ReadLine());
          for (int j = 0; j < k; j++)
          {
            s.Add(s[0]);
            s.Remove(s[0]);
          }
        }
        foreach (var c in s)
        {
          Console.Write(c);
        }
        Console.Write("\n");
      }
    }
  }
}


Measured memory_bytes: 9608
N = map(int, raw_input().split())
num_min = min(N)
num_max = max(N)
num_middle = 0
for i in N:
    num_middle = num_middle + i
num_middle = num_middle - num_max - num_min

ret = num_max - num_middle
buff = num_max - num_min - ret
ret = ret + (buff // 2) + (buff % 2) * 2

print ret


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

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

    s += s;

    if(s.find(p) != string::npos) {
        cout << "Yes" << endl;
        
    } else {
        cout << "No" << endl;
        
    }
    return 0;
}



Measured memory_bytes: 3212
#include <iostream>
using namespace std;
int main() {
    int N, H[20];
    cin >> N >> H[0];
    int cnt = 1, highest = H[0];
    for (int i = 1; i < N; i++) {
        cin >> H[i];
        if (H[i] >= highest) {
            cnt++;
            highest = H[i];
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int cmp(const char *a,const char *b){
  return *a-*b;
}
int main(){
  char s[11];
  scanf("%s",s);
  if(s[0]=='A'&&s[1]>='a'&&s[strlen(s)-1]>='a'){
    qsort(s,strlen(s),sizeof(s[0]),cmp);
    if(s[1]=='C'&&s[2]>='a'){
      puts("AC");
      return 0;
    }
  }
  puts("WA");
  return 0;
}

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

int main() {
  int N, M, R;
  long long ans = 100100100100100100;
  cin >> N >> M >> R;
  vector<int> r(R);
  for(int i=0;i<R;i++) {
    cin >> r[i];
    r[i]--;
  }
  vector<vector<long long>> d(N, vector<long long>(N));
  for(int i=0;i<N;i++) for(int j=0;j<N;j++) {
    if(i == j) d[i][j] = 0;
    else d[i][j] = 100100100100100100;
  }
  for(int i=0; i < M; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;b--;
    d[a][b] = c;
    d[b][a] = c;
  }
  for(int k=0;k<N;k++) for(int i=0;i<N;i++) for(int j=0;j<N;j++) {
    if(d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j];
  }
  sort(r.begin(), r.end());
  do {
    long long total = 0;
    for(int i=0;i<R-1;i++) {
      total += d[r[i]][r[i+1]];
    }
    if(total < ans) ans = total;
  } while(next_permutation(r.begin(), r.end()));

  cout << ans << endl;
}


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

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b)
{
	return b ? gcd(b, a % b) : a;
}
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

void printVec(vector<int> &vec)
{
	for (auto &e : vec)
	{
		cout << e << " ";
	}
	cout << endl;
}

int main()
{
	int n;
	int m;
	cin >> n >> m;
	if (n == m)
	{
		cout << "Yes"
				 << endl;
	}
	else
	{
		cout << "No"
				 << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

// https://atcoder.jp/contests/abc162/tasks/abc162_a
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		sc.close();

		String str = n.replace("7", "");

		if(str.length()!=3) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}
}


Measured memory_bytes: 35764
n, m = map(int, input().split())
p = [0 for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    p[a - 1] += 1
    p[b - 1] += 1
flag = True
for i in range(n):
    if p[i] % 2 == 1:
        flag = False
        break
if flag == True:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9868
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define DEBUG
#define PI 3.141592653589793238462643383279

#define _GLIBCXX_DEBUG
#ifdef DEBUG
#define s(...) show(__VA_ARGS__);
#define sl(...) show(__VA_ARGS__);cout<<endl;
#else
#define s(...)
#define sl(...)
#endif
void show() {}
template <class Head,class... Args>void show(Head t,Args... args){std::cout<<t<<" ";show(args...);}
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define REPR(i, n) for(ll i = n; i >= 1; i--)
#define FOR(i, m, n) for(ll i = m; i <= n; i++)
#define INF 1e9+123
#define VEC(type,A,N) vector<type> A(N+10)
#define VECi(type,A,N,i) vector<type> A(N+10,i)
#define VEC2(type,A,N,M) vector<vector<type>> A(N+10,vector<type>(M+10))
#define VEC2i(type,A,N,M,i) vector<vector<type>> A(N+10,vector<type>(M+10,i))
#define ALL(v) v.begin()+1, v.end()-9
ll frac(ll k){
    int s = 1;
    for (ll i=1; i<=k; ++i)s *= i;
    return s;
}
ll gcd(ll a, ll b){
   if (a%b==0)return(b);
   else return(gcd(b, a%b));
}
ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}
ll antidiv(ll N,ll C,ll D){
    return N-floor(N/C)-floor(N/D)+floor(N/lcm(C,D));
}
vector<ll> yakusuu(ll N){
    vector<ll> ret;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i == 0) {
            ret.push_back(i);
            if (i * i != N) ret.push_back(N / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}
int main(){
    ld H;
    cin>>H;
    
    cout<<fixed<<setprecision(15)<<ceil(H/2)/H;
    //cout<<fixed<<setprecision(15)<<m;
    //sort(ALL(C),[](auto& a, auto& b) {return a[2] < b[2];});
    //if(equal(D.begin(), D.end()-1, K.begin()))cout<<"Yes";else cout<<"No";
    cout<<endl;
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

/*
GF(p)
inverse:O(log p) based on Fermat's little theorem (a^(p-1)=1 mod p)
*/

template<int32_t mod>
struct ModInt{
	int32_t a;
	inline int32_t normalize(int64_t x){
		x%=mod;
		if(x<0)x+=mod;
		return x;
	}
	ModInt(const int64_t a=0):a(normalize(a)){}

	ModInt& operator+=(const ModInt &x){
		a+=x.a;
		if(a>=mod)a-=mod;
		return *this;
	}
	ModInt& operator-=(const ModInt &x){
		a-=x.a;
		if(a<0)a+=mod;
		return *this;
	}
	ModInt& operator*=(const ModInt &x){
		a=(int64_t)a*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt x){return ModInt(*this)+=x;}
	ModInt operator-(const ModInt x){return ModInt(*this)-=x;}
	ModInt operator*(const ModInt x){return ModInt(*this)*=x;}
	ModInt operator/(const ModInt x){return ModInt(*this)/=x;}
	bool operator==(const ModInt x){return a==x.a;}
	bool operator!=(const ModInt x){return a!=x.a;}

	ModInt operator-(){return ModInt(0)-ModInt(*this);}
	ModInt pow(int64_t ex)const{
		int64_t x=a;
		int64_t res=1;
		while(ex){
			if(ex&1)res=res*x%mod;
			x=x*x%mod;
			ex>>=1;
		}
		return ModInt(res);
	}
	ModInt inv()const{return pow(mod-2);}
};

template<int32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<int32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}

using mint=ModInt<998244353>;


template<class Mint>
struct Combinations{
	int N;
	vector<Mint>facts,finvs,invs;
	Combinations(int n):N(n),facts(n),finvs(n),invs(n){
		facts[0]=finvs[0]=1;
		for(int i=1;i<N;i++){
			facts[i]=facts[i-1]*i;
			invs[i]=Mint(i).inv();
			finvs[i]=finvs[i-1]*invs[i];
		}
	}
	inline Mint fact(int n){return facts[n];}
	inline Mint finv(int n){return finvs[n];}
	inline Mint inv(int n){return invs[n];}
	inline Mint binom(int n,int k){return facts[n]*finvs[k]*finvs[n-k];}
};
Combinations<mint>C(555555);


signed main(){	
	int N,M;
	cin>>N>>M;

	vector<mint>poN(555555),poM(555555);
	poN[0]=1;
	poM[0]=1;
	for(int i=1;i<555555;i++){
		poN[i]=poN[i-1]*(N+1);
		poM[i]=poM[i-1]*(M+1);
	}

	mint ans=0;

	for(int i=0;i<=N&&i<=M;i++){
		auto tmp=C.binom(N,i);
		tmp*=C.fact(M)*C.finv(M-i);
		tmp*=poM[N-i];
		tmp*=poN[M-i];
		if(i&1)ans-=tmp;
		else ans+=tmp;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11136
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string S, T;
    cin >> S >> T;

    int ans = 0;
    rep(i, S.size())
    {
        if (S[i] != T[i]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3832
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int[] x = new int[3];

		for(int i = 0;i < 3;i++)	x[i] = scan.nextInt();

		for(int i = 0;i < 3;i++){
			int tmp = x[i];
			int j;
			for(j = i;j > 0 && x[j-1] > tmp;j--)
				x[j] = x[j-1];
			x[j] = tmp;
		}

		System.out.println(x[0] + " " + x[1] + " " + x[2]);
	}
}

Measured memory_bytes: 17164
A,B,C,D = map(int,input().split())

def gcd(C,D):
    while D != 0:
        C,D = D,C%D
    return C

def lcm(C,D):
    return C*D//gcd(C,D)

CD_lcm = lcm(C,D)

C_A = (A-1) // C
C_B = B // C
div_C = C_B - C_A

D_A = (A-1) // D
D_B = B // D
div_D = D_B - D_A

lcm_A = (A-1) // CD_lcm
lcm_B = B // CD_lcm
div_lcm = lcm_B - lcm_A

print(B-A-(div_C+div_D-div_lcm)+1)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

int tm, d[101], f[101], n;
bool a[101][101];

void dfs(int p)
{
  d[p] = tm++;

  int i;
  for(i = 1; i <= n; ++i)
    if(d[i] == 0 && a[p][i])
      dfs(i);

  f[p] = tm++;
}

int main()
{
  int u, k, i, j;

  while(scanf("%d", &n)!=EOF){
    memset(a, false, sizeof(a));
    memset(d, 0, sizeof(d));
    memset(f, 0, sizeof(f));

    for(i = 0; i < n; ++i){
      scanf("%d %d", &u, &k);

      while(0 < k--){
	scanf("%d", &j);
	a[u][j] = true;
      }
    }
    for(i = 1; i <= n; ++i)
      a[0][i] = true;

    tm = 0;
    dfs(0);

    for(i = 1; i <= n; ++i)
      printf("%d %d %d\n", i, d[i], f[i]);
  }

  return 0;
}

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




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t,sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;


map<string, int> memo;

using P=pair<int, int>;




/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}


int main() {
	ll n, m,ans;
	cin >> n >> m;
	vector<ll> a(m),l;
	rep(i, m) cin >> a[i];
	sort(a.begin(), a.end());
	for (ll i = 1; i < m; i++) {
		l.push_back(a[i] - a[i - 1]);
	}
	sort(l.rbegin(), l.rend());
	ans = a[m -1] - a[0];
	for (ll i = 0; i < min((ll)l.size(), n - 1); i++)ans -= l[i];
	cout << ans;
	return 0;
}












Measured memory_bytes: 2168
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        n:i64,
        a:i64,
        b:i64,
    }
    let ans = if a * n > b {
        b
    } else {
        a * n
    };
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <list>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/

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

	int s;
	cin >> s;

	// 月をみる
	// 死も二けた
	int a = 0;
	a += s % 10;
	s /= 10;
	a += (s % 10) * 10;
	s /= 10;
	int b = 0;
	b += s % 10;
	s /= 10;
	b += (s % 10) * 10;

	bool canb = true;
	bool cana = true;
	if (b >= 13 || b == 0) canb = false;
	if (a >= 13 || a == 0) cana = false;

	if (cana && canb) {
		cout << "AMBIGUOUS" << endl;
		return 0;
	}
	else if (cana && !canb) {
		cout << "YYMM" << endl;
		return 0;
	}
	else if (!cana && canb) {
		cout << "MMYY" << endl;
		return 0;
	}
	else {
		cout << "NA" << endl;
		return 0;
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,count = 0;
string s[200001];
cin >> n;
for (int i = 0;i < n;i ++) cin >> s[i];
sort(s,s+n);
for (int i = 0;i < n;i++){
    if(s[i] != s[i+1])
        count++;
}
cout << count << endl;

}

Measured memory_bytes: 9876
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn mat_chars(&mut self, row: usize) -> Vec<Vec<char>> {
        (0..row).map(|_| self.chars()).collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

const MOD: usize = 1000000007;

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let K: usize = sc.get();
    let mut ans = 0;
    for k in K..N+2 {
        let l = 0;
        let r = l + k - 1;
        let lower = k * (l + r) / 2;
        let r = N;
        let l = r + 1 - k;
        let upper = k * (l + r) / 2;
        ans += upper - lower + 1;
        ans %= MOD;
    }
    println!("{}", ans);
}


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

namespace IO
{
char gc()
{
#ifdef FREAD
	static char buf[1<<21], *P1 = buf, *P2 = buf;
	if(P1 == P2)
	{
		P1 = buf;
		P2 = buf + fread(buf, 1, 1<<21, stdin);
		if(P1 == P2) return EOF;
	}
	return *(P1++);
#else
	return getchar();
#endif
}
template<typename Tp> bool get1(Tp &x)
{
	bool neg = 0;
	char c = gc();
	while( c != EOF && (c < '0' || c > '9') && c != '-' ) c = gc();
	if(c == '-') c = gc(), neg = 1;
	if(c == EOF) return false;
	x = 0;
	for(; c>='0' && c<='9'; c = gc()) x = x*10 + c - '0';
	if(neg) x = -x;
	return true;
}
template<typename Tp> void printendl(Tp x)
{
	if(x<0)putchar('-'),x=-x;
	static short a[40], sz;
	sz = 0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
	puts("");
}
} // namespace IO
using IO::get1;
using IO::printendl;
#define get2(x,y) get1(x) && get1(y)
#define get3(x,y,z) get2(x,y) && get1(z)
#define get4(x,y,z,w) get3(x,y,z) && get1(w)
#define pb push_back
#define mp std::make_pair
#define ff first
#define ss second
typedef long long LL;
typedef unsigned long long uLL;
typedef std::pair<int,int> pii;
const int inf = 0x3f3f3f3f;
const LL Linf = 1ll<<61;

const int maxn = 1000111;
char s[maxn];
int n;
int main()
{
	get1(n);
	scanf("%s", s+1);
	for(int i=1; i<=n; i++) s[i]--;
	int val = 0;
	for(int i=1; i<=n; i++) if((n-1&i-1) == i-1) val ^= (s[i]-'0');
	if(val & 1)
	{
		puts("1");
		return 0;
	}
	int cnt = 0;
	for(int i=1; i<=n; i++) if(s[i] == '1') cnt++;
	if(cnt)
	{
		puts("0");
		return 0;
	}
	val >>= 1;
	if(val & 1) puts("2");
	else puts("0");
	return 0;
}

Measured memory_bytes: 1280