akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////


int main(){fastio
    ll n;cin>>n;
    ll last=0;
    ll m=0;
    rep(i,1,n){
        if(i*(i+1)/2>=n){
            last=i;
            m=i*(i+1)/2-n;
            break;
        }
    }
    rep(i,1,last){
        if(i==m)continue;
        cout<<i<<endl;
    }
    
    return 0;
}



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

Measured memory_bytes: 14208
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cctype>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(k,a,b) for(int k=(a); k < (b); k++)
#define FORE(k,a,b) for(int k=(a); k <= (b); k++)
#define REP(k,a) for(int k=0; k < (a); k++)

#define ALL(c) (c).begin(), (c).end()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define RANGE(lb, x, ub) ((lb) <= (x) && (x) < (ub))

#define dump(x) cerr << #x << ": " << (x) << endl;

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int INF = 1000000000;
const double EPS = 1e-10;
const double PI = acos(-1.0);

bool is_palind(string s) {
  if (s.size() <= 1) return true;
  return (s[0] != s[s.size()-1]) ? false : is_palind(s.substr(1, s.size()-2));
}

int main(void) {
  string s; cin >> s;
  int n = s.size();
  cout << ((is_palind(s) && is_palind(s.substr(0, n/2)) && is_palind(s.substr((n+3)/2-1, n/2))) ? "Yes" : "No") << endl;

    return 0;
}


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

int main()
{
    int a,b,k;cin>>a>>b>>k;
    if(b-a+1<=2*k){
        for(int i= a;i<=b;i++) cout << i << endl;
    }else{
        for(int i = a; i< a+k; i++) cout << i<<endl;
        for(int i = b - k +1; i<=b; i++) cout << i << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ll long long
#define ld long double
#define pq priority_queue
#define ff first
#define ss second
#define pb push_back
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MOD1 998244353
#define MOD2 1000000007

typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

int power(ll a,ll b,ll m)
{
ll ans=1;
while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;}
return ans;
}


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

    int n;
    cin>>n;
    string s;
    cin>>s;

    if(s.length()<=n) cout<<s<<endl;
    else
    {
        for(int i=0;i<n;i++) cout<<s[i];
        cout<<"..."<<endl;
    }

}


Measured memory_bytes: 3612
/*************************************************\
           In the name of almighty ALLAH
                 MD.Faysal Hasan
                Comilla Univesity
\*************************************************/

#include<bits/stdc++.h>
using namespace std;

#define     ikarus_101  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef     long long             ll;
typedef     long double           ld;
typedef     unsigned long long    ull;
typedef     vector<ll>            vll;
typedef     pair<ll,ll>           pll;
typedef     vector<pll>           vpl;
typedef     map<ll,ll>            mll;
typedef     multiset<ll>          msl;
typedef     multimap<ll,ll>       Mll;
using pqboro=priority_queue<ll,vll,less<ll>>;
using pqchoto=priority_queue<ll,vll,greater<ll>>;

#define    all(str)       str.begin(),str.end()
#define    sajo(str)      sort(str.begin(),str.end())
#define    rev(str)       reverse(str.begin(),str.end())
#define    usajo(str)     sort(str.rbegin(),str.rend())
#define    vin(a)         for(auto &it : a) cin>>it
#define    vout(a)        for(auto it:a) cout<<it<<' ';cout<<nn
#define    vmax(a)        *max_element(all(a))
#define    vmin(a)        *min_element(all(a))
#define    pb             push_back
#define    eb             emplace_back
#define    mkp(x,y)       make_pair(x,y)
#define    F              first
#define    S              second
#define    yes            cout<<"YES"<<nn
#define    no             cout<<"NO"<<nn
#define    nn             "\n" ///endl
#define    rep(i,n)       for (i=0;i<n;++i )
#define    rep1(i,n)      for (i=1;i<=n;++i )

#define    min3(a,b,c)    min(a,min(b,c))
#define    max3(a,b,c)    max(a,max(b,c))
#define    sqr(x)         ((x)*(x))
#define    pi             2*acos(0.0)
#define    gcd(a,b)       __gcd(a,b)
#define    lcm(a,b)       (a/gcd(a,b))*b
#define    mem(a,b)       memset(a,b,sizeof (a))
#define    dec(x)         cout<<fixed<<setprecision(x)
#define    none(n)         __builtin_popcountll(n)

template < typename T > string toString ( T Number ) { stringstream ss ; ss << Number ; return ss.str() ; }
template < typename T > ll toll ( T str ) { stringstream ss ; ss << str ; ll num ; ss >> num ; return num ; }
ll power(ll n , ll k) { if(k == 0) return 1 ; if(k&1) return n*sqr(power(n,k/2)) ; else return sqr(power(n,k/2)); }

const   int  N   =   2e5+7;
const   int  M   =   1e9+7;
const   ll  inf  =   0x7f7f7f7f7f7f7f7f;
const   int dx[] =   {+1,+2,+2,+1,-1,-2,-2,-1};
const   int dy[] =   {-2,-1,+1,+2,+2,+1,-1,-2};

int main() {ikarus_101

    ll n,m,i,j,k,x;

    ll t;
    cin>>n>>x>>t;
    k = (n+x-1)/x;
    cout << k * t << endl;













    return 0;
}


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

int main() {
	ll k,x;
	cin>>k>>x;
	ll n=-1000000,m=1000000;
	ll MIN=max(n,x-k+1);
	ll MAX=min( m,x+k-1);
	for(ll i=MIN;i<=MAX;i++){
		cout <<i << " ";
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    static void Main()
    {
        var abc = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

        var count = abc[1] / abc[0];
        if (count >= abc[2])
        {
            Console.WriteLine(abc[2]);
        }
        else
        {
            Console.WriteLine(count);
        }
    }
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;


int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n;
    cin >> n;


    vector < int > v(n);

    f0(i,n){
        cin >> v[i];
    }

    sort(all(v));

    int mid = n/2;

    if(v[mid-1]==v[mid]){
        cout <<"0"<< endl;
        return 0;
    }

    int ans = v[mid]-v[mid-1];

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 640
#include <stdio.h>

#define N 200000

int main(){
  int n, i, j, maxv = 0, minv = 0;
  int a[N];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  minv = a[0];
  maxv = a[1] - a[0];
  for(j = 1; j < n; j++){
    if(maxv < (a[j] - minv)) maxv = a[j] - minv;
    if(minv > a[j]) minv = a[j];
  }

  printf("%d\n", maxv);

  return 0;
}

Measured memory_bytes: 1376
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define SIZE_OF_ARRAY(a) (sizeof(a)/sizeof(a[0]))



int main(){
    //int ans;
    string ans = "No";
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int M;
    cin >> M;
    string S;
    cin >> S;
    int a[N];
    int b[M];
    for(int i = 0;i < N;i++){
    a[i] = S.at(i) - 48;
    if(a[i] < 0)
        goto solve;
   // cout << a[i] << endl;
    }
    char C;
    C = S.at(N);
    //cout << C << endl;
    for(int i = 0;i < M;i++){
        b[i] = S.at(N + 1 + i) - 48;
        if(b[i] < 0){
            goto solve;
        }
      //  cout << b[i] << endl;
    }

    if(C != '-' )
        goto solve;
    for(int i = 0;i < N;i++){
        if(a[i] - 10 <= 0){
            ans = "Yes";
        }else{
            ans = "No";
            goto solve;
        }
    }
    for(int i = 0;i < M;i++){
        if(b[i] - 10 <= 0){
            ans = "Yes";
        }else{
            ans = "No";
            goto solve;
        }
    }
    solve :
    cout << ans << endl;
}


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

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << a << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

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

    int sum = 0;
    int n; cin >> n;
    while (n--) {
        int x; cin >> x;
        sum += x&1;
    }
    cout << (sum%2 ? "NO" : "YES") << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

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

    printf("\n");

    return 0;
}



Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int inf = 1001001001;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    int res = 0;
    for (int i = 0; i < N; i++) {
        int cnt = 0;
        for (int j = i; j < N; j++) {
            char s = S[j];
            if (s == 'A' || s == 'C' || s == 'G' || s == 'T') {
                cnt++;
            } 
           else {
                break;
            }
        }
        res = max(res, cnt);
    }
    
  cout << res << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

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

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

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

ll digit__(ll num){
    ll cnt=1;
    while(num > 10){
        cnt ++;
        num /= 10;
    }
    return cnt;
}


int main(){
    int N;
    cin >> N;
    string s;
    unordered_map<string, int > mp;
    ll cnt = 0;
    rep(i,N){
        cin >> s;
        sort(s.begin(), s.end());
        if (mp[s] > 0) cnt += mp[s];//cnt+
        mp[s] ++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 10660
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	double ans=0;
	int i,N;
	cin>>N;
	vector<double> money(N);
	vector<string> kind(N);
	for(i=0;i<N;i++){
		cin >>money[i] >>kind[i];
		if(kind.at(i)=="JPY"){
			ans+=money.at(i);
		}else{
			ans+=money.at(i)*380000;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import numpy as np


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A, L=60, MOD=10**9+7):
    A = np.array(A, dtype=np.int64)
    modsum = 0
    for j in range(L):
        B = (A >> j) & 1
        count_ones = np.count_nonzero(B)
        count_zeros = N - count_ones
        # MODは一度にとる
        modsum +=  (1<<j) * count_zeros * count_ones
        modsum %= MOD
    return modsum


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))


Measured memory_bytes: 48808
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <tuple>
#include <algorithm>
#include <array>
using namespace std;
using ll = long long;
#define rep(i,n) for(decltype(n) i=0; i<n; ++i)
inline constexpr ll Inf = (1ULL << 62) -1;

int main() {
    ll a;
    cin >> a;

    ll ans=a+a*a+a*a*a;
    cout << ans << endl;
    return 0;
}


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

static const int NMAX = 100000;

typedef struct stack {
    int n = NMAX;
    int buf[NMAX];
    int top;

    void init(void) {
        top = 0;
    }
    bool isEmpty() {
        return top == 0;
    }
    bool isFull() {
        return top == n-1;
    }
    void push(int a) {
        if (isFull()) {
            printf("Error!! stack is full!!\n");
        }
        buf[top] = a;
        top++;
    }
    int pop() {
        if (isEmpty()) {
            printf("Error!! stack is empty!!\n");
        }
        top--;
        return buf[top];
    }
} Stack;

int main (void) {

    Stack s; 
    char c[16];
    int a, b;
    char op;

    s.init();

    while (scanf("%s", c) != EOF) {
        if (c[0] == '\n') break;
        switch (c[0]) {
            case '+':
                a = s.pop();
                b = s.pop();
                a = a + b;
                s.push(a);
                break;
            case '-':
                a = s.pop();
                b = s.pop();
                a = b - a;
                s.push(a);
                break;
            case '*':
                a = s.pop();
                b = s.pop();
                a = a * b;
                s.push(a);
                break;
            default:
                a = atoi(c);
                s.push(a);
                break;
        }
    }
    printf("%d\n",s.pop());
}



Measured memory_bytes: 2736
n = gets.to_i
v = gets.split.map &:to_f
while v.count >= 2
  x = v.min
  i = v.index x
  v.delete_at i 
  y = v.min
  i = v.index y
  v.delete_at i 
  v << (x + y) / 2
end
puts v


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
/*#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define int ll
#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    int n;
    cin>>n;
    int a[n];
    int freq[62] = {0};
    f(i, n) {
        cin>>a[i];
        for(int j = 0; j < 62; j++) {
            if(a[i] & (1ll << j)) freq[j]++;
        }
    }
    int ans = 0;
    f(i, n - 1) {
        for(int j = 0; j < 62; j++) {
            if(a[i] & (1ll << j)) {
                int to = n - i - freq[j];
                ans = add(ans, mul(to, power(2ll, j)));
                freq[j]--;
            }
            else {
                int to = freq[j];
                ans = add(ans, mul(to, power(2ll, j)));
            }
         }
    }
    cout<<ans;
    return 0;
}

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;cin>>n>>m;
    if(n==m)cout<<"Yes";
    else cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long lint;
int a,b;
int gcd(int a,int b) {
    if(b==0) return a;
    return gcd(b,a%b);
}
int main() {
#ifdef debug
    freopen("in.txt","r",stdin);
#endif
    int g;
    while(scanf("%d %d",&a,&b)!=EOF) {
        g=gcd(a,b);
        printf("%d %lld\n",g,(lint)a*b/g);
    }
}

Measured memory_bytes: 2516
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        public static void Main()
        {
            string[] KN = Console.ReadLine().Split(' ');
            int K = int.Parse(KN[0]);
            int N = int.Parse(KN[1]);
            string[] ainput = Console.ReadLine().Split(' ');
            int[] A = new int[N];
            for(int i = 0; i < N; i++)
            {
                A[i] = int.Parse(ainput[i]);
            }

            int longth = (K - A[N-1]) + A[0]; //最後から最初

            for(int i = 0; i < N - 1; i++)
            {
                if (longth < A[i+1] - A[i])
                {
                    longth = A[i + 1] - A[i];
                }
            }

            int ans = K - longth;

            Console.WriteLine(ans);
    
            

        }
    }
}

Measured memory_bytes: 32220
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int r;
  cin >> r;
  if(r < 1200) cout << "ABC" << endl;
  else if(r < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
  return 0;
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
a,b,c = readInts()
if a < c < b or b < c < a:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 10464
import math
s = input()
n = len(s)
cr, cl = 1, 0
ans = [0]*n
isRL = False
bp = 0

for i in range(1, n):
    cr += 1 if s[i] == "R" else 0
    cl += 1 if s[i] == "L" else 0
    if  isRL:
        if s[i] == "R" or i == n-1:
            cr -= 1 if i != n-1 else 0
            ans[bp-1] = math.ceil(cr/2) + int(cl/2)
            ans[bp] = int(cr/2) + math.ceil(cl/2)
            cr, cl, isRL = 1, 0, False
    else:
        if s[i-1] == "R" and s[i] == "L":
            bp = i
            isRL = True
            if i == n-1:
                ans[bp-1] = math.ceil(cr/2) + int(cl/2)
                ans[bp] = int(cr/2) + math.ceil(cl/2)
            
for a in ans:
    print(a, end=" ")


Measured memory_bytes: 4864
#include<bits/stdc++.h>
#include<stdio.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
typedef pair<int , int > pii;
#define MOD 1000000007
#define MOD1 998244353
#define ff first
#define ss second
#define bn cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define sz(a) (a).size()
#define o(a) cout << a
#define MAX6 1000006
#define int ll
#define all(x) x.begin(), x.end()
#define ppii pair<int,pii>
#define vi vector<int>
#define vii vector<pii>
#define viii vector<ppii>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define MAX5 300005
#define MAX7 10000007
#define rep(i,a,b)  for (__typeof((b)) i=(a);i<=(b);i++)
#define nrep(i,b,a)  for (__typeof((b)) i=(b);i>=(a);i--)
#define mem(a) memset(a,0,sizeof(a))
#define memneg(a) memset(a,-1,sizeof(a))
//#define se second
#define LN 14
#define LIM 22
#define MAX_ALPHA 26
const long long INF64 = 1e18;
const ll INF = 1e9;
const double PI = acos(-1);
#define ld long double
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
inline void max_self(ll &a, ll b)
{
  a = max(a,b);
}
 
inline void min_self(ll &a,ll b)
{
  a = min(a,b);
}
 
inline void add_self(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
 
inline void sub_self(int &a, int b) {
  a -= b;
  if (a < 0) a += MOD;
}
 
inline int mul(int a, int b) {
  return (int) ( a * b % MOD);
}
 
 
ll gcd(ll a,ll b)
{
  if(b == 0)
    return a;
  else 
    return gcd(b, a%b);
}
 
 
int countDigits(int x)
{
  int cnt = 0;
  while(x)
  {
    x /= 10;
    cnt++;
  }
  return cnt;
}
 
 
ll binExpo(ll a,ll b)
{
  ll res = 1;
  while(b)
  {
    if(b&1)
      res = (res * a)%MOD;
    a = (a * a)%MOD;
    b /= 2;
  }
  return res%MOD;
}
 
int sum(int a) {
    int result = 0;
    while (a > 0) {
        result += a % 10;
        a /= 10;
    }
    return result;
}

const int nax = 1e5 + 5;

vector<int > edges[nax];

pair<int,int > dfs(int node, int par)
{

  int all_white = 1;
  int sth_is_black = 0;


  for(int child : edges[node])
  {
    if(child != par){
      pair<int,int > p = dfs(child, node);
      int memo_all_white = all_white;
      all_white = mul(all_white , p.second);

      sth_is_black = (mul(memo_all_white , p.first) +
         mul(sth_is_black , p.first + p.second)) % MOD;
    }
  }

  //do something here

  return {all_white, (all_white + sth_is_black)%MOD};
}

void solve(){
  int n;
  cin>>n;
  rep(i, 0, n-2){
    int a, b;
    cin>>a>>b;
    edges[a].pb(b);
    edges[b].pb(a);
  }

  pair<int,int > ans = dfs(1, -1);

  cout<<(ans.ff + ans.ss) % MOD<<endl;
}


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

  int t = 1;
  //cin>>t;
  while(t--) solve();
  return 0;
}















Measured memory_bytes: 12672
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
using lint = long long;

using namespace std;

int main(void) {
  int q;
  cin >> q;
  vector<int> t(q), a(q), b(q);
  rep(i, q) {
    cin >> t[i];
    if (t[i] == 1) cin >> a[i] >> b[i];
  }
  multiset<int, greater<int>> l;
  multiset<int> r;
  int lmax = -INF, rmin = INF;
  lint lsum = 0, rsum = 0, bsum = 0;
  int mid;
  bool mid_ava = false;
  rep(i, q) {
    if (t[i] == 1) {
      if (mid_ava) {
        if (a[i] < mid) {
          r.insert(mid);
          rmin = mid;
          rsum += mid;
          l.insert(a[i]);
          lmax = max(lmax, a[i]);
          lsum += a[i];
        } else {
          l.insert(mid);
          lmax = mid;
          lsum += mid;
          r.insert(a[i]);
          rmin = min(rmin, a[i]);
          rsum += a[i];
        }
      } else {
        if (a[i] < lmax) {
          l.erase(l.begin());
          mid = lmax;
          l.insert(a[i]);
          lmax = *l.begin();
          lsum += a[i] - mid;
        } else if (a[i] > rmin) {
          r.erase(r.begin());
          mid = rmin;
          r.insert(a[i]);
          rmin = *r.begin();
          rsum += a[i] - mid;
        } else {
          mid = a[i];
        }
      }
      mid_ava = !mid_ava;
      bsum += b[i];
    } else {
      cout << (mid_ava ? mid : lmax) << " " << rsum - lsum + bsum << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 12032
#include <bits/stdc++.h>
int main(){
	char s[12];
	scanf("%s",s);
	int i,j,k,l=strlen(s),t=0;
	if(s[0]!='A'){printf("WA");
	return 0;
	} 
 for(i=1;i<l;i++){
if(s[i]=='C'){
if((i<2)||(i>l-2)){printf("WA");
	return 0;
}

t++;
 }
else if(s[i]<'a'){printf("WA");
	return 0;
}
}
if(t==1)printf("AC");
else printf("WA");
return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		List<int[]> list = new ArrayList<>();
		for(int i=0;i<n;i++) {
			int[] tmp = {in.nextInt(),in.nextInt()};
			list.add(tmp);
		}
		list.sort((x1,x2)->x1[0]-x2[0]);
		
		long ans = Long.MAX_VALUE;
		for(int i=0;i<n-k+1;i++) {
			for(int j=i+k-1;j<n;j++) {
				int[] y = new int[j-i+1];
				for(int l=0;l<j-i+1;l++) {
					y[l] = list.get(l+i)[1];
				}
				Arrays.sort(y);
				int yWidthMin = y[k-1] - y[0];
				for(int l=1;l+k-1<j-i+1;l++) {
					yWidthMin = Math.min(yWidthMin, y[l+k-1]-y[l]);
				}
				int xWidth = list.get(j)[0] - list.get(i)[0];
				ans = Math.min(ans, (long)xWidth*yWidthMin);
			}
		}
		
		System.out.println(ans);
		in.close();
		

	}

}


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

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            
            int ans = 0;
            string ope = "";

            for (int bit = 0; bit < (1 << (str.Length - 1)); bit++)
            {
                ans = int.Parse(str[0].ToString());
                ope = str[0].ToString();
                for (int i = 1; i < str.Length; i++)
                {
                    if ((bit & (1 << i - 1)) == (1 << i - 1))
                    {
                        ans += int.Parse(str[i].ToString());
                        ope += "+";
                    }
                    else
                    {
                        ans -= int.Parse(str[i].ToString());
                        ope += "-";
                    }
                    ope += str[i].ToString();
                }
                ope += "=7";
                if (ans == 7)
                {
                    Console.WriteLine(ope);
                    return;
                }
            }
        }
    }
}


Measured memory_bytes: 13140
import sys
import math

#https://atcoder.jp/contests/agc008/submissions/15248942
sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

a,b,c,d = inm()

mul = []
mul.append(a*c)
mul.append(a*d)
mul.append(b*c)
mul.append(b*d)

print(max(mul))


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> to(n);
  rep(i,m) {
    int s, t;
    cin >> s >> t;
    --s; --t;
    to[s].push_back(t);
  }
  vector<double> dp(n);
  // dp[n-1] = 0;
  for (int v = n-2; v >= 0; --v) {
    double now = 0;
    for (int u : to[v]) {
      now += dp[u];
    }
    now /= to[v].size();
    now += 1;
    dp[v] = now;
  }
  double ans = dp[0];
  for (int nv = 0; nv < n-1; nv++) {
    if (to[nv].size() == 1) continue;
    int nu = to[nv][0];
    for (int u : to[nv]) {
      if (dp[nu] < dp[u]) nu = u;
    }

    double now = [&]{
      vector<double> dp(n);
      for (int v = n-2; v >= 0; --v) {
        double now = 0;
        for (int u : to[v]) {
          if (v == nv && u == nu) continue;
          now += dp[u];
        }
        int deg = to[v].size();
        if (v == nv) deg--;
        now /= deg;
        now += 1;
        dp[v] = now;
      }
      return dp[0];
    }();
    ans = min(ans, now);
  }

  printf("%.10f\n", ans);
  return 0;
}


Measured memory_bytes: 1408
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

vector<long long> KnapsackProblemWithLimitations(vector<long long> v, vector<long long> w, vector<long long> m, long long W) {
  
  size_t n = v.size();
  vector<long long> dp(W + 1, 0);
  for(size_t i = 0; i < n; i++) {
    for(long long k = 0; m[i] > 0; k++) {
      long long key = min(m[i], (long long)(1 << k));
        m[i] -= key;
        for(long long j = W; j >= key * w[i]; j--) {
        dp[j] = max(dp[j], dp[j - key * w[i]] + key * v[i]);
      }
    }
  }

  return dp;
}

int main(){
  
  lnt n, W; cin >> n >> W;
  vector<lnt> v(n);
  vector<lnt> w(n);
  vector<lnt> m(n);

  for(int i = 0; i < n; i++) cin >> v[i] >> w[i] >> m[i];
  auto dp = KnapsackProblemWithLimitations(v, w, m, W);
  lnt ans = 0;
  for(auto x : dp) ans = max(ans, x);
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3228
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1e18 ;
const ll Inf = 1e18 + 1e17;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n) {
        if(a[i] == 0) {
            cout << 0 << endl;
            return;
        }
    }
    int ans = 1LL; ld res = 1.0;
    rep(i, n) {
        ans *= a[i];
        res *= (ld)a[i];
        if(res > Inf) {
            cout << -1 << endl;
            return;
        }
    }
    if(ans > INF) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3992
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <string.h>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
int GCD(int a, int b) {
	return b ? GCD(b, a%b) : a;
}
//sort(a, a + N, greater<int>())   // descend
//sort(a, a+N)                    //  ascend

using ll = long long;
using namespace std;

int wh = 0;



int main() {
	string s, t;
	cin >> s >> t;
	bool ppy = false;
	bool ppx = false;
	int x = s.length() - t.length();

	for (int i = 0; i < s.length(); i++) {
		if (s.substr(i, t.length()) == t) {
			ppy = true;
			break;
		}
	}

	if (ppy == false) {
	for (int i = x; i >= 0; i--) {
		int p = i;
		int h = 0;
		wh = i;
		ppx = true;
		while (p < i + t.length()) {
			if (s[p] == t[h] || s[p] == '?') {
				p++;
				h++;
			}
			else {
				ppx = false;
				break;
			}
		}
		if (ppx) break;
	}
}

	string ans1 = s;
	for (int i = 0; i < s.length(); i++) {
		if (ans1[i] == '?') ans1[i] = 'a';
	}

	string ans2 = ans1;

	ans2.replace(wh, t.length(), t);

	if(ppy) cout << ans1;
	else if (ppx) cout << ans2;
	else cout<< "UNRESTORABLE";

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(a))
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int n,m,l,r;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	cin>>n>>m;
	l=0;r=n;
	fo(i,0,m){
		int x,y;
		cin>>x>>y;
		l=max(l,x);
		r=min(r,y);
	}
	cout<<max(0,r-l+1)<<endl;
	return 0;
}


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

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

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    VI sunuke(n, 0);
    REP(i, k) {
        int d;
        cin >> d;
        REP(j, d) {
            int a;
            cin >> a;
            sunuke[a - 1]++;
        }
    }

    int ans = 0;
    REP(i, n) if (sunuke[i] == 0) ans++;
    cout << ans << ln;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n) {
        int l,r;
        cin >> l >> r;
        ans += r-l+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import math
a,b,x = map(int, input().split())
if x < (b*a**2)/2:
    c = (2*x) / (a*b)
    print(90 - math.degrees(math.atan(c/b)))
else:
    x2 = x - b*a**2
    c = (2*x2) / (a*a)
    print(-math.degrees(math.atan(c/a)))

Measured memory_bytes: 3316
import math
x = int(input())

sq_x = int(x ** 0.5)
ans = 1
for i in range(2, sq_x + 1):
    t = i
    while t <= x:
        ans = max(ans, t)
        t *= i

print(ans)

"""
最初は
p = int(math.log(x, i))
でいけるかと思ったが
math.log(1000,10)のとき 2.999..みたいな値になってしまい，誤差がある
"""

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

int main(){

  string s;
  
  cin>>s;
  
  vector<int> v;
  rep(i,s.length()){

    if(s[i]=='0')v.push_back(0);
    else if(s[i]=='1')v.push_back(1);

    else if(!v.empty())v.pop_back();
  }
  
  rep(i,v.size())cout<<v[i];

}


Measured memory_bytes: 256
#include <iostream>
typedef long long ll;
using namespace std;
ll memo[90]={};
ll luca (ll n) {
  if(n == 0) return 2;
  if(n == 1) return 1;
  if(memo[n]!=0) return memo[n];
  memo[n] = (luca(n-1) + luca(n-2));
  return memo[n];
}

int main(void) {
  int n;
  cin >> n;
  cout << luca(n) << endl;
}


Measured memory_bytes: 256
//include tourist
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
 
int main(){ 
  ll n, a, b;
  cin >> n >> a >> b;
  ll l = b - a;
  if (l & 1) {
    cout << min((n - b + (l + 1) / 2), (a - 1 + (l + 1) / 2)) << endl;
  } else {
    ll c = l / 2;
    cout << c << endl;
  }
  return 0;
} 

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

int main()
{
    int n;
    long long m_n = 0, a_n = 0, r_n = 0, c_n = 0, h_n = 0;
    char name[15];
    scanf("%d", &n);
    while(n--)
    {
        scanf("%s", name);
        if(name[0] == 'M' || name[0] == 'm')
            m_n++;
        else if(name[0] == 'A' || name[0] == 'a')
            a_n++;
        else if(name[0] == 'R' || name[0] == 'r')
            r_n++;
        else if(name[0] == 'C' || name[0] == 'c')
            c_n++;
        else if(name[0] == 'H' || name[0] == 'h')
            h_n++;
    }
    long long ans = 0;
    ans += m_n * a_n * (r_n+c_n+h_n);
    ans += m_n * r_n * (c_n+h_n);
    ans += m_n * c_n * h_n;
    ans += a_n * r_n * (c_n+h_n);
    ans += a_n * c_n * h_n;
    ans += r_n * c_n * h_n;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

struct unionfind {
  vector<int> group;

  unionfind(int n) {
    group = vector<int>(n);
    for (int i = 0; i < n; i++) group[i] = i;
  }

  int root(int x) {
    if (group[x] == x) return x;
    return group[x] = root(group[x]);
  }

  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    group[rx] = ry;
  }

  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

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

  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  for (auto &x: h) cin >> x;
  vector<vector<int> > edge(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    edge[a-1].push_back(b-1);
    edge[b-1].push_back(a-1);
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    bool good = true;
    for (auto &x: edge[i]) {
      if (h[i] <= h[x]) {
        good = false;
        break;
      }
    }
    if (good) ans++;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8744
#include <iostream>
#define REP(i, a, n) for(int i = a; i <= n; i++)
using namespace std;


const int SIZE = 20001;
int N;
long p[SIZE];
long a[SIZE];
long b[SIZE];

int main(void) {
  cin >> N;
  REP(i, 1, N) {
    cin >> p[i];
  }

  REP(i, 1, N) {
    a[i] = i * N;
    b[i] = (N + 1 - i) * N;
  }

  int q = p[1];
  REP(i, 2, N) {
    if(p[i] < q) {
      b[p[i]] += i - 1;
    } else {
      a[p[i]] += i - 1;
    }
  }

  REP(i, 1, N) {
    cout << a[i];
    if(i != N) cout << " ";
  }
  cout << endl;

  REP(i, 1, N) {
    cout << b[i];
    if(i != N) cout << " ";
  }
  cout << endl;

  // REP(i, 1, N) {
  //   cout << a[p[i]] + b[p[i]];
  //   if(i != N) cout << " ";
  // }
  // cout << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int n;
void dfs(int i, string s, char c){
    if(i == n) {
        printf("%s\n", s.c_str());
    }
    else{
        for (char j = 'a'; j <= c + 1; j++)
        {
            string t = s + j;
            dfs(i+1,t,max(c,char(j)));
        }
        
    }
}


int main(){
    cin >> n;
    dfs(1,"a",'a');
}

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

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0;i < N;++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0;i < N - 1;++i) {
		ans += a[i + 1] - a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256