akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main()
{ 
	LL n,k;
	cin>>n>>k;
	map<LL,LL>m;
	while(k--)
	{
	LL d;
	cin>>d;
	for(LL i=0; i<d; i++)
	{
		LL t;
		cin>>t;
		m[t]++;
	}
	}
	LL count=0;
	for(LL i=1; i<=n; i++)
	{
		if(m[i]==0)
		count++;
	}
	cout<<count<<"\n";
	
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long ans = 0;
  cin >> n;
  long long vec[2 * n];
  for (int i = 0; i < 2 * n; i++){
    cin >> vec[i];
  }
  for (int i = 2 * n - 1; i >= 1; i -= 2) {
    vec[i - 1] += ans;
    ans += ((vec[i] + vec[i - 1] - 1) / vec[i] * vec[i] - vec[i - 1]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200003,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;cin>>N>>M;
    cout<<N*(N-1)/2+M*(M-1)/2<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
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)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;cin>>n;
    vector<ll> l(2*n);rep(i,2*n)cin>>l[i];
    sort(ALL(l));
    ll ans = 0;
    for(int i=0; i<n; i++){
        ans += min(l[2*i+1],l[2*i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll n,a[maxn];
ll L[maxn],R[maxn];
int main()
{
    fastio();
    cin>>n;
    rep(i,0,n) cin>>a[i];
    int flag = 1;
    per(i,n,0){
        L[i]=(L[i+1]+1)/2,R[i]=R[i+1];
        ll mx = INF;
        if(i<=60) mx = 1LL<<i;
        if(L[i]>mx-a[i]) {flag=0;break;}
        R[i] = min(R[i],mx-a[i]);
        L[i]+=a[i],R[i]+=a[i];
        //show2(L[i],R[i]);
    }
    if(!flag) {cout<<-1<<endl;return 0;}
    ll ans = 0;
    rep(i,0,n){
        if(R[i]<L[i]) {flag=0;break;}
        ans += R[i];
        R[i+1] = min(R[i+1],(R[i]-a[i])*2);
    }
    if(!flag) {cout<<-1<<endl;return 0;}
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5968
#include <bits/stdc++.h>
#define int long long
#define zmrl(x) (int)((x).size())
#define ahen(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
const int mod = 998244353;

int pw10[200200], psum[200200];
int tree[200200<<2], lazy[200200<<2];

void prop(int node, int st, int en) {
    if (lazy[node]) {
        tree[node] = ((psum[en]-psum[st-1])%mod+mod)%mod*lazy[node]%mod;
        if (st != en) {
            lazy[node<<1] = lazy[node];
            lazy[node<<1|1] = lazy[node];
        }
        lazy[node] = 0;
    }
}

void update(int node, int st, int en, int le, int ri, int val) {
    prop(node, st, en);
    if (st > ri || en < le) return;
    if (le <= st && en <= ri) {
        tree[node] = ((psum[en]-psum[st-1])%mod+mod)%mod*val%mod;
        if (st != en) {
            lazy[node<<1] = val;
            lazy[node<<1|1] = val;
        }
        return;
    }
    update(node<<1, st, (st+en)/2, le, ri, val);
    update(node<<1|1, (st+en)/2+1, en, le, ri, val);
    tree[node] = (tree[node<<1] + tree[node<<1|1])%mod;
}

int solve(int node, int st, int en, int le, int ri) {
    prop(node, st, en);
    if (st > ri || en < le) return 0;
    if (le <= st && en <= ri) return tree[node];
    return (solve(node<<1, st, (st+en)/2, le, ri) + solve(node<<1|1, (st+en)/2+1, en, le, ri))%mod;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n,q; cin>>n>>q;
    psum[0] = pw10[0] = 1;
    for (int i=1; i<=n; i++) {
        pw10[i] = pw10[i-1]*10%mod;
        psum[i] = (psum[i-1]+pw10[i])%mod;
    }
    update(1, 0, n-1, 0, n-1, 1);
    while (q--) {
        int le, ri, d; cin>>le>>ri>>d;
        int l = n-ri, r = n-le;
        update(1, 0, n-1, l, r, d);
        cout << solve(1, 0, n-1, 0, n-1) << '\n';
    }
    return 0;
}

Measured memory_bytes: 14976
n = int(input())
a = [0] + list(map(int, input().split()))
b = [0]*(n+1)
b[-1] = a[-1]
ans = []
for i in range(n, 0, -1):
    cnt = 0
    bi = i
    i += bi
    while i <= n:
        cnt += b[i]
        i += bi

    if (cnt%2) == a[bi]:
        b[bi] = 0
    else:
        b[bi] = 1
        ans.append(bi)

print(len(ans))
if ans:
    print(*ans)

Measured memory_bytes: 17716
#include <stdio.h>

int main(void)
{
    int num1, num2, add;

    scanf("%d %d", &num1, &num2);

    add = num1 * num2;

    if(add % 2 == 0)
    {
        printf("Even");
    }

    else
    {
        printf("Odd");
    }

    return (0);
}


Measured memory_bytes: 128
// 解説放送 わかればそれはそうすぎた
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;

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

Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>
#include <iomanip>

using namespace std;

#define FOR(i, a, b) for(int (i)=(a);(i)<(b);(i)++)
#define IFOR(i, a, b) for(int (i)=(a);(i)<=(b);(i)++)
#define RFOR(i, a, b) for(int (i)=(a);(i)>=(b);(i)--)
#define REP(i, n) FOR((i), 0, (n))

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class T>
void print_container(T &container, string delim=" ") {
    bool first = true;
    for(auto &t: container){
        if(!first){
            cout << delim;
        }
        first = false;
        cout << t;
    }
    cout << endl;
}


struct BIT{
    int n;
    vector<int> bit;
    BIT(int N){
        bit.resize(N + 1);
        n = N;
    }
    void add(int a, int w){
        for (int x = a; x <= n; x += x&-x)
            bit[x] += w;
    }
    int sum(int a){
        int ret = 0;
        for (int x = a; x > 0; x -= x&-x)
            ret += bit[x];
        return ret;
    }
};



int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    REP(i, n){
        cin >> a[i];
    }
    REP(i, n){
        cin >> b[i];
    }

    // ソートして合わせるのが一番確実
    vector<int> ca(a), cb(b);
    sort(ca.begin(), ca.end());
    sort(cb.begin(), cb.end());
    bool ng = false;
    REP(i, n)
        if(ca[i] > cb[i])
            ng = true;
    if(ng){
        cout << "No" << endl;
        return 0;
    }

    bool ok = false;
    REP(i, n-1){
        if(ca[i] == ca[i+1] || ca[i+1] <= cb[i]){
            ok = true;
            break;
        }
    }
    if(ok){
        cout << "Yes" << endl;
        return 0;
    }

    // 最後に、元の列がn-2回で達成できるかチェック
    vector<pair<int,int>> retua(n), retub(n);

    REP(i, n){
        retua[i] = make_pair(a[i], i);
        retub[i] = make_pair(b[i], i);
    }
    sort(retua.begin(), retua.end());
    sort(retub.begin(), retub.end());
    vector<int> ord(n);
    REP(i, n){
        ord[retua[i].second] = retub[i].second;
    }

    vector<int> pos(n);
    REP(i, n){
        pos[ord[i]] = i;
    }
    int cnt = 0;
    REP(i, n){
        if(ord[i] == i)
            continue;
        int to = pos[i];
        pos[ord[i]] = to;
        pos[ord[to]] = i;
        swap(ord[i], ord[to]);
        cnt++;
    }
    if(cnt <= n-2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4096
while True :
    A, B = map(int, input().split())
    if(A == 0) :
        break
    else :
        C = [0, 0, 0]
        s = B - A
        C[2] = s // 1000
        C[1] = (s - C[2] * 1000) // 500
        C[0] = (s - (C[2] * 1000 + C[1] * 500)) // 100
        
        print(C[0], C[1], C[2])
        


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

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

  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];

  double inv = 0;
  for(int j = 0; j < N; j++){
    inv += 1. / A[j];
  }

  double ans = 1. / inv;

  cout << setprecision(7) << ans;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[ohara][20];
ll dat[20][20];

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>s;
    if(s[0]=='?'){
        rep(i,10)dp[0][i]=1;
    }
    else{
        dp[0][(s[0]-'0')]=1;
    }
    rep(i,10)dat[i][0]=i;
    rep(i,10){
        rrep(j,1,13){
            dat[i][j]=( dat[i][j-1]-3<0 ? dat[i][j-1]+13-3 : dat[i][j-1]-3 );
        }
    }

    rrep(i,1,Size(s)){
        if(s[i]!='?'){
            rep(j,13){
                (dp[i][dat[(s[i]-'0')][j]]+=dp[i-1][j])%=MOD;
            }
        }
        else{
            rep(k,10){
                rep(j,13){
                    (dp[i][dat[k][j]]+=dp[i-1][j])%=MOD;
                }
            }
        }
    }
    Cout(dp[Size(s)-1][5]%MOD);
    return 0;
}


Measured memory_bytes: 16848
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<cstdlib>
#include<algorithm>
using namespace std;

int cheak(int x)
{
    for(int i=2; i<=sqrt(x); i++)
        if(x%i==0) return 0;
    return 1;
}

int main()
{
    int t=0,h=0,ch[50000],gh[100];
    for(int i=3; i<55555; i++)
        if(cheak(i)) ch[t++]=i;
    for(int i=0; i<t; i++)
    {
        if((ch[i]-1)%5==0) gh[h++]=ch[i];
        if(h==60) break;
    }
    int n;
    scanf("%d\n",&n);
    for(int i=0; i<n-1; i++)
        printf("%d ",gh[i]);
    printf("%d\n",gh[n-1]);
    return 0;
}




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

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> V(n), C(n);
    for (int i = 0; i < n; i++) cin >> V[i];
    for (int i = 0; i < n; i++) cin >> C[i];
    int sum = 0;
    for (int i = 0; i < n; i++){
        sum += max(0, V[i] - C[i]);
    }

    cout << sum << endl;
}

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

public class Main{
	
	static long mod=(long)1e9+7;
	
	public static void main(String[] args) throws IOException {
		Writer out=new Writer(System.out);
		Reader in=new Reader(System.in);
		int ts=1;
		
		outer: while(ts-->0) {	
			int n=in.nextInt();
			int d=in.nextInt();
			int count=0;
			for(int i=0; i<n; i++) {
				int x=in.nextInt();
				int y=in.nextInt();
				if((long)x*x+(long)y*y<=(long)d*d) count++;
			}
			out.println(count);
		}
		out.close();		
		
	}

	static boolean tri(int a, int b, int c) {
		if(c<a+b && c>abs(a-b)) return true;
		return false;
	}
	
	
/*********************************** UTILITY CODE BELOW **************************************/	
		
	static int abs(int a) {
		return a>0 ? a : -a;
	}
	
	static int max(int a, int b) {
		return a>b ? a : b;
	}
	
	static int pow(int n, int m) {
		if(m==0) return 1;
		int temp=pow(n,m/2);
		long res=(((long)temp*temp)%mod);
		if(m%2==0) return (int)res;
		return (int)((res*n)%mod);
	}
	
	static class Pair{
		int u, v;
		
		Pair(int u, int v){this.u=u; this.v=v;}
		
		static void sort(Pair [] coll) {		
			List<Pair> al=new ArrayList<>(Arrays.asList(coll));
			Collections.sort(al,new Comparator<Pair>() {
				public int compare(Pair p1, Pair p2) {
					return p1.u-p2.u;
				}	
			});
			for(int i=0; i<al.size(); i++) {
				coll[i]=al.get(i);
			}
		}
		
	}
	
	static void sort(int[] a) {
		ArrayList<Integer> list=new ArrayList<>();
		for (int i:a) list.add(i);
		Collections.sort(list);
		for (int i=0; i<a.length; i++) a[i]=list.get(i);
	}
	
	static int [] array(int n, int value) {	
		int a[]=new int[n];
		for(int i=0; i<n; i++) a[i]=value;
		return a;
	}
	
	static class Reader{
		
		BufferedReader br;
		StringTokenizer to;
		
		Reader(InputStream stream){
			br=new BufferedReader(new InputStreamReader(stream));
			to=new StringTokenizer("");
		}
		
		String next() {
			while(!to.hasMoreTokens()) {
				try {
					to=new StringTokenizer(br.readLine());	
				}catch(IOException e) {}
				
			}
			return to.nextToken();
			
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		int [] readArray(int n) {
			int a[]=new int[n];
			for(int i=0; i<n ;i++) a[i]=nextInt();
			return a;
		}
		long [] readLongArray(int n) {
			long a[]=new long[n];
			for(int i=0; i<n ;i++) a[i]=nextLong();
			return a;
		}
		
	}
	
	static class Writer extends PrintWriter{
		Writer(OutputStream stream){
			super(stream);
		}
		void println(int [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
		void println(long [] array) {
			for(int i=0; i<array.length; i++) {
				print(array[i]+" ");
			}
			println();
		}
	}
	
}

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

int main(void){
    long long a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    bool can = false;
    if(v <= w){
        cout << "NO" << endl;
    }else{
        int d = abs(b-a);
        if((v-w)*t >= d){
            cout << "YES" << endl;
        }else{
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define maxn 100050
#define inf 0x3f3f3f3f
#define LL long long
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mm(a,b) memset(a,b,sizeof(a))
#define mp(a,b) make_pair(a,b)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
const double eps = 1e-6;
const LL mod=1e9+7;
const LL INF=(LL)1e18;
using namespace std;
LL gcd(LL a,LL b){return b==0?a:gcd(b,a%b);}
LL qpow(LL x,LL y){LL re=1,base=x%mod;while(y){if(y&1)re=(re*base)%mod;base=(base*base)%mod;y>>=1;}return re;}
int main(){
//	freopen("input.txt","r",stdin);
//	freopen("ouput.txt","w",sdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int n; cin>>n;
	int cnt1=0,cnt2=0;
	for(int i=1;i<=n;i++){
		int x; cin>>x;
		if(x%4==0) cnt1++;
		else if(x%2==0) cnt2++;
	}
	int pos=2*cnt1+1+(cnt2/2)*2;
	if(pos>=n) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m; readV(n, m);
  int[] a; readA(n, a);

  auto ca = new int[](n+1);
  foreach (i; 0..n) ca[i+1] = (ca[i]+a[i])%m;

  int[int] h;
  auto r = 0L;
  foreach_reverse (l; 0..n+1) {
    auto k = ca[l];
    if (k in h) r += h[k];
    ++h[k];
  }

  writeln(r);
}


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

int main(){
    int n,x;
    int A[10001] ={0};
    cin >> n;

    for (int i = 0; i < n ; ++i) {
        cin >> x;
        A[x]++;
    }
    bool s = false;
    for (int i = 0; i <= 10000 ; ++i) {
        for (int j = 0; j < A[i] ; ++j) {
            if(s) cout << " ";
            else s = true;
            cout << i;
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<math.h>
#include <cstdio>
#include<iomanip>
#include <stdio.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,m,n) for(int i=m;i<(int)(n);i++)
const int inf = 10e9 + 7;
using namespace std;
int a[100010];
int b[100010];
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
signed main() {
	int n, m, ans = 0;
	cin >> n>>m;
	rep(i, n)cin >> a[i];
	ans = abs(m - a[0]);
	loop(i, 1, n) {
		ans = gcd(ans, abs(a[i] - m));
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
string s;
int main(){
  while(cin>>s){
    if(s=="0"){
      break;
    }
    int c=0;
    for(int i=0;i<s.size();i++){
      c+=s[i]-'0';
    }
     cout << c << endl;
  }
}


Measured memory_bytes: 3172
///not today

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

#define SZ(x) (int)(x).size()
#define pb push_back
#define ll long long
#define xmax(x, y) (x) = max((x), (y))
#define xmin(x, y) (x) = min((x), (y))
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
#define int long long
#define pipii pair< int, pair<int, int> >
#define plpll pair< ll, pair<ll, ll> >

using namespace std;

int32_t main(){
      int a, b;
      cin >>a >>b;
      cout <<max(a + b, max(a* b, a - b)) <<endl;
      return false;
}


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

using namespace std;


int main() {
    string s;
    cin >> s;
    if(s.size() == 2) {
        cout << s << "\n";
    } else {
        reverse(s.begin(), s.end());
        cout << s << "\n";
    }
    return 0;
}

Measured memory_bytes: 3580
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int main() {
	int t, n, k;
	int x[100010];
	int table[100010];
	long ans;

	cin >> t;
	for(int _i = 0; _i < t; _i++) {
		cin >> n >> k;
		for(int i = 0; i < n; i++)
			scanf("%d", &x[i]);

		for(int i = 0; i < n - 1; i++) {
			table[i] = x[i + 1] - x[i];
		}

		sort(table, table + n - 1);
		ans = 0;

		for(int i = 0; i < n - k; i++) {
			ans += table[i];
		}

		printf("%ld\n", ans);
	}
}

Measured memory_bytes: 2024
N=int(input())
*A,=sorted(map(int,input().split()))

def f(x):
 for i in range(x,N,2):
  if A[i-1]!=i or A[i]!=i:
    return 0
 return 1   
    
a=1
if N%2==0:a=f(1)
else: a=A[0]==0 and f(2)
print(2**(N//2)%(10**9+7)*a)

Measured memory_bytes: 20476
def solution(a):
    cnt = 0
    for x in a:
        while (x & 1) == 0:
            x >>= 1
            cnt += 1
    return cnt

def main():
    n = int(raw_input().strip())
    a = [int(i) for i in raw_input().strip().split()]
    print solution(a)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3460
import java.util.Scanner;

public class Main {
	public void solve() {
		Scanner in = new Scanner(System.in);
		in.nextInt();
		String s = in.next();
		in.close();
		
		int r = 0;
		int b = 0;
		
		for (int i=0; i<s.length(); i++) {
			if (s.charAt(i) == 'R') {
				r++;
			} else {
				b++;
			}
		}
		
		if (r > b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}
}


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

static long gcd(long a, long b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

long long int facctorialMethod(int k){//階乗
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

long long int tousasum(long long int n){//等差数列
    return n*(n+1)/2;
}

unsigned GetDigit(unsigned num){//桁数
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}

bool IsPrime(int num)//素数判定
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

map< long long int, long long int > prime_factor(long long int n) {//素因数分解
    map< long long int, long long int > ret;
    for(long long int i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main() {

    int A,B,C;
    cin >> A >> B >> C;

    cout << C-min(C,A-B) << endl;



}








Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <cmath>
#include <map>
using namespace std;

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

    int ca=0, cb=0, cc=0;
    for(char c: S){
        if (c == 'a') ca++;
        else if (c == 'b') cb++;
        else if (c == 'c') cc++;
    }
    if (ca == 1 && cb == 1 && cc == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
    int h, m, s;
    cin >> s;
    
    h = s / 3600;
    s %= 3600;
    
    m = s / 60;
    s %= 60;
    
    cout << h << ':' << m << ':' << s << endl;
}


Measured memory_bytes: 3116
#include<bits/stdc++.h> 
#define ll long long 
#define pb push_back
#define vec vector<int>
#define fo(i,n) for (int i = 0; i < n; i++)
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
using namespace std;  




int main()
{
  int n,x,t;
  cin>>n>>x>>t;
   
          cout<<((n+x-1)/x)*t;
    

}



   

Measured memory_bytes: 3556
#include <iostream>
#include <cstdio>
#define LL long long
using namespace std;
LL h;
LL Gets(LL x) {
	if (x == 1) return (LL)1;
	else return Gets(x / 2) * (LL)2 + (LL)1;
}
int main() {
	scanf("%lld", &h);
	printf("%lld", Gets(h));
	return 0;
}

Measured memory_bytes: 256
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = (lambda: (sys.stdin.readline()).rstrip())
    input_list = (lambda: input().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A,B = input_number_list()
    print(A*B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 998244353;

template<class M> class DualSegmentTree {
public:
	using T = typename M::value_type;
private:
	int m;
	int n;
	vector<T> data;

	void rec(int l, int r, int node, int node_l, int node_r, const T& val) {
		if(node_r <= l || node_l >= r)return;
		if(node_l >= l && node_r <= r){data[node] = M::upd(data[node], val); return;}
		int mid = (node_l + node_r) / 2;
		rec(l, r, node * 2, node_l, mid, val);
		rec(l, r, node * 2 + 1, mid, node_r,val);
	}

public:
	DualSegmentTree(vector<T> a) {
		m = a.size();
		for(n = 1; n < (int)a.size(); n <<= 1);
		data.resize(n<<1, M::id);
		for(int i = 0; i < (int)a.size(); i++)data[i + n] = a[i];
	}
 
	void update(int l, int r, T val) {
		rec(l, r, 1, 0, n, val);
	}
 
	T get(int index) {
		T ret = data[index += n];
		while(index /= 2) {
			ret = M::op(ret, data[index]);
		}
		return ret;
	}
 
	T operator[] (int i){
		return data[i + n];
	}
};

//区間加算・一点取得
template<class T> class RAQ { public:
using value_type = T;
	static T op(T l, T r){ return (l + r) % mod; }
	static T upd(T node, T val){ return (node + val) % mod; }
	static constexpr T id = 0;
};template <class T> constexpr T RAQ<T>::id;

int main()
{
	int n, k; cin >> n >> k;
	vector<ll> a(n);
	vector<pair<int,int>> sg(k);
	for(int i = 0; i < k; i++)cin >> sg[i].first >> sg[i].second, sg[i].second++;
	a[0] = 1;
	DualSegmentTree<RAQ<ll>> tree(a);

	for(int i = 0; i < n; i++) {
		ll cur = tree.get(i) % mod;
		for(int j = 0; j < k; j++) {
			tree.update(min(n, i + sg[j].first), min(n, i + sg[j].second), cur);
		}
	}
	cout << tree.get(n - 1)%mod << endl;

}

Measured memory_bytes: 10332
#include <iostream>
#include <cmath>

#define MAX 10000

int main(int argc,char* argv[]){
  int n;

  std::cin >> n;
  
  int count = 0;
  for(int i = 0; i < n; i++){
    int num;
    std::cin >> num;

    bool flag = true;
    int sqrt = std::sqrt(num) + 0.5;
    for(int j = 2; j <= sqrt; j++){
      if((num % j) == 0){
	flag = false;
	break;
      }
    }

    if(flag){
      count++;
    }
  }

  std::cout << count << std::endl;

  return 0;  
}

Measured memory_bytes: 1160
H,W,K = [int(n) for n in input().split()]
memo = [[0 for _ in range(W)] for __ in range(H+1)]
memo[0][0] = 1
MOD = 10**9 + 7
for h in range(1,H+1):
    for pt in range((1 << W-1)):#1 == 線あり 0 == 線なし　とする
        # pts = bin(pt)[2:]
        # pts = pts[::-1]#反転
        if "11" in bin(pt): continue
        #各パターンの時の各線の計算
        goto = [i for i in range(W)]
        for i in range(W):
            if (1 << i) & pt:
                goto[i], goto[i + 1] = goto[i + 1], goto[i]
        for i in range(W):
            memo[h][goto[i]] += memo[h-1][i]
            memo[h][goto[i]] %= MOD


print(memo[H][K-1])


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define st first
#define nd second
#define PQ priority_queue

using ll = long long ;
using namespace std;
using pii = pair<int,int>;

int main(){
	int n;
	ll sum = 0;
	scanf("%d", &n);
	int x, pre = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d", &x);
		if(x < pre){
			sum += pre - x;
			x = pre;
		}
		pre = x;
	}
	printf("%lld", sum);


}

Measured memory_bytes: 3840
INF = float('inf')

def merge(lst,left,middle,right):
    cnt = 0 

    left_lst  = lst[left:middle]+[INF]
    right_lst = lst[middle:right]+[INF]

    i,j = 0,0
    for k in range(left,right):
        if left_lst[i] <= right_lst[j]:
            lst[k] = left_lst[i]
            i += 1
        else:
            lst[k] = right_lst[j]
            j += 1
            cnt += (len(left_lst)-1)-i
    return cnt

def merge_sort(lst,left,right):
    while left+1 < right:
        middle = (left+right)//2
        left_cnt  = merge_sort(lst,left,middle)
        right_cnt = merge_sort(lst,middle,right)
        return merge(lst,left,middle,right)+left_cnt+right_cnt
    return 0

n = int(input())
n_lst = list(map(int,input().split()))
ans = merge_sort(n_lst,0,n)
print(ans)



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

long long get_rev(long long x) {
	long long nx = 0;
	while (x) nx = nx * 10 + x % 10, x /= 10;
	return nx;
}

long long get_rev(long long x, int len) {
	long long nx = 0;
	while (len--) nx = nx * 10 + x % 10, x /= 10;
	return nx;
}

int cnt;

long long solve(long long d, long long len) {
	long long tmp = len >> 1, pw = 1;
	while (tmp--) pw *= 10;
	long long ans = 0;
	for (int i = 0; i < pw; i++) {
		long long tmp = (d + i) % pw;
		tmp = get_rev(tmp, len >> 1);
		if (len & 1) tmp = tmp * 10;
		long long n = tmp * pw + i;
		if ((cnt ? get_rev(n, len) : get_rev(n)) == n + d) ans++;
	}
	if (len & 1) ans *= 10;
	return ans;
}

int main () {
	int d; cin >> d;
	cnt = 0;
	while (d % 10 == 0) d /= 10, cnt++;
	int len = 0, D = d;
	while (D) len++, D /= 10;
	long long ans = solve(d, len) + solve(d, len + 1) + solve(d, len + 2) + solve(d, len + 3) + solve(d, len + 4) + solve(d, len + 5) + solve(d, len + 6);
	if (cnt) cnt--, ans *= 9;
	while (cnt--) ans *= 10;
	cout << ans << endl;
	return 0;
}


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

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

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N, M; cin >> N >> M;
  ll A[M]; rep(i,M) cin >> A[i];
  ll sum = 0; rep(i,M) sum += A[i];
  ll result = max((ll)-1,N-sum);
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;



int main() {
    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    int k, x;
    cin >> k >> x;
    cout << (k * 500 >= x ? "Yes" : "No");

}

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

int main() {
	string str;

	cin >> str;

	if (str.at(2) == str.at(3) && str.at(4) == str.at(5)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<int>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout << "Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
 
typedef long long ll;
typedef pair<int,int> P;
//typedef long long T;
const int INF = 2000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
std::vector<ll> fib(51,-1);
ll ffib(int i){
    if(fib[i]==-1)fib[i]=ffib(i-1)+ffib(i-2);
    else return fib[i];
}
int main(){
    int n;
    std::cin >> n;
    fib[0]=1;fib[1]=1;
    ffib(50);
    std::cout << fib[n] << std::endl;
}


Measured memory_bytes: 3164
import sys
input = sys.stdin.readline

import numpy as np

N = int(input())
A = np.array([int(input()) for _ in range(N)])

from_left = np.maximum.accumulate(A)
from_right = np.maximum.accumulate(A[::-1])[::-1]

from_left, from_right

from_left = [0] + from_left.tolist()[:-1]
from_right = from_right[1:].tolist() + [0]

for x,y in zip(from_left, from_right):
    print(x if x > y else y)

Measured memory_bytes: 33928
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;





signed main() {
    ll n, q;
    cin >> n >> q;
    
    string s;
    cin >> s;
    
    vll cs(n);
    cs[0] = 0;
    ll sum = 0;
    
    rrep(i, n-1) {
        if (s[i-1] == 'A' && s[i] == 'C') {
            sum ++;
            
        }
        cs[i] = sum;
    }
    
    ll l, r;
    rep(i, q) {
        cin >> l >> r; l--; r--;
        mes(cs[r]-cs[l]);
    }
    
    
    
    
    
    
    
}

Measured memory_bytes: 4256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1ll<<60;

struct range_edge_graph {
    int n;
    struct edge { int to; ll weight; };
    vector<vector<edge>> g;
    
    range_edge_graph(int n) : n(n) {
        g.resize(n*4);
        for (int i = 1; i < n; i++) {
            int c1 = i*2, c2 = i*2+1;
            g[i].push_back({c1, 0ll});
            g[i].push_back({c2, 0ll});
            g[c1+2*n].push_back({i+2*n, 0ll});
            g[c2+2*n].push_back({i+2*n, 0ll});
        }
        for (int i = n; i < 2*n; ++i) g[i].push_back({i+2*n, 0ll});
    }

    // range edge : from [l1, r1) to [l2, r2) 
    void add_edge(int l1, int r1, int l2, int r2, ll w) {
        int id = g.size();
        for (l1 += n, r1 += n; l1 < r1; l1 /= 2, r1 /= 2) {
            if (l1 & 1) g[l1+2*n].push_back({id, 0ll}), l1++;
            if (r1 & 1) --r1, g[r1+2*n].push_back({id, 0ll});
        }
        vector<edge> node;
        for (l2 += n, r2 += n; l2 < r2; l2 /= 2, r2 /= 2) {
            if (l2 & 1) node.push_back({l2, w}), l2++;
            if (r2 & 1) --r2, node.push_back({r2, w});
        }
        g.push_back(node);
    } // 非再帰セグメント木

    vector<ll> dijkstra(int s) {
        s += n;
        vector<ll> dist(g.size(),INF); dist[s] = 0;
        using P = pair<ll,ll>;
        priority_queue<P,vector<P>,greater<P>> que;
        que.push(make_pair(0,s));
        while (!que.empty()) {
            P p = que.top(); que.pop();
            int v = p.second;
            if (dist[v] < p.first) continue;
            for (edge e : g[v]) {
                if (dist[e.to] > dist[v] + e.weight) {
                    dist[e.to] = dist[v] + e.weight;
                    que.push(make_pair(dist[e.to],e.to));
                }
            }
        }
        vector<ll> res(n);
        for(int i = 0; i < n; i++)  res[i] = dist[n+i];
        return res;
    }
};

int main() {
    int n, m; cin >> n >> m;
    range_edge_graph g(n);
  
    for (int i = 0; i < m; i++) {
        int l, r, c;  cin >> l >> r >> c; l--; r--;
        g.add_edge(l, r+1, l, r+1, c);
    }
    auto dist = g.dijkstra(0);
    cout << (dist[n-1] == INF ? -1 : dist[n-1]) << endl;
}

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

int main()
{
	int i, j;
	string s[8];
	for (i = 0; i < 8; i++) getline(cin,s[i]);
	cout<<"90"<<endl;
	for (i = 0; i < 8; i++) {
		for (j = 7; j >= 0; j--) cout<<s[j][i];
		cout<<endl;
	}
	cout<<"180"<<endl;
	for (i = 7; i >= 0; i--) {
		for (j = 7; j >= 0; j--) cout<<s[i][j];
		cout<<endl;
	}
	cout<<"270"<<endl;
	for (i = 7; i >= 0; i--) {
		for (j = 0; j < 8; j++) cout<<s[j][i];
		cout<<endl;
	}
	return 0;
}

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

int main()
{
    ll n;
    cin>>n;
    int * arr = new int[n+1];
    for(int i=1;i<=n;i++)
    {
        arr[i] = 1;
    }
    ll val = n;
    ll sum = n*(n+1)/2;
    while( sum!= n)
    {
        if( sum - val >= n)
        {
            sum -= val;
            arr[val] =0;
        }
        val--;
    }
    for(int i=1;i<= n;i++)
    {
        if( arr[i])
            cout<<i<<"\n";
    }
}


Measured memory_bytes: 42696
import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int N, W;
    scan(N, W);
    auto w = new int[](N);
    auto v = new int[](N);
    iota(N).each!(i => scan(w[i], v[i]));

    auto dp = new long[](W + 1);
    foreach (i ; 0 .. N) {
        foreach_reverse (j ; w[i] .. W + 1) {
            chmax(dp[j], dp[j - w[i]] + v[i]);
        }
    }

    auto ans = dp[W];
    writeln(ans);
}



void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 3068
n,k = gets.chomp.split(" ").map(&:to_i)

m = n*(n-1)/2 -k

if m >= n-1
    puts m
    cnt = 1
    for i in 1..n-1 do
        for j in i+1..n do
            print i," ",j,"\n"
            cnt += 1
            if cnt > m
                break
            end
        end
        if cnt > m
            break
        end
    end
else
    puts "-1"
end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,i,j,k;
  long ans=0;
  string s;
  vector<long> l(6,0);
  cin >> n;
  for (i=0;i<n;i++){
    cin >> s;
    if (s.at(0)=='M') l.at(0)++;
    else if (s.at(0)=='A') l.at(1)++;
    else if (s.at(0)=='R') l.at(2)++;
    else if (s.at(0)=='C') l.at(3)++;
    else if (s.at(0)=='H') l.at(4)++;
  }
  for (i=0;i<3;i++) for (j=i+1;j<4;j++) for (k=j+1;k<5;k++) ans+=l.at(i)*l.at(j)*l.at(k);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
int main(){
  int n, m;
  cin >> n >> m;
  priority_queue<ll> que;
  REP(i,n){
  	int k;
    cin >> k;
    que.push(k);
  }
  REP(i,m){
  	int k = que.top();
    que.pop();
    k /= 2;
    que.push(k);
  }
  ll ans = 0;
  REP(i,n){
  	int k = que.top();
    que.pop();
    ans += k;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1400
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	int area1=A*B;
	int area2=C*D;
	if (area1>=area2){
		cout<<area1<<endl;
	}else{
		cout<<area2<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n,k;
int a[100006];
int t;
int ans;
int main()
{
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	rep(i,n)
	{
		if(a[i]==1)t=i;
	}
	while(1)
	{
		if(ans*(k-1)+1>=n)
		{
			break;
		}
		ans++;
	}
	cout<<ans<<endl;
}

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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

  int x; read(x);
  write(8 - x / 200 + 2);
}


Measured memory_bytes: 3684
N = int(input())
L = list(map(int, input().split()))

tmp = [[0, i+1] for i in range(N)]

for i in range(N):
    tmp[i][0] = L[i]

tmp.sort()

res = ''

for i in range(N):
    res += str(tmp[i][1])

    if i != N -1:
        res += ' '

print(res)


Measured memory_bytes: 22116
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FOR(i, a, b) for (ll i = a; i < b; ++i)
#define RFOR(i, b, a) for (ll i = b; i >= a; --i)
#define ALL(x) x.begin(), x.end()
#define DEBUG(args...) { string _s = #args; replace(ALL(_s), ' ', '\0');\
replace(ALL(_s), ',', ' ');\
stringstream _ss(_s); istream_iterator<string> _it(_ss); _debug(_it, args);}
#define endl "\n"
#define F first
#define S second
#define pb(x) push_back(x)a
#define mp(x, y) make_pair(x, y)

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void _debug(istream_iterator<string>) {}
template<typename T, typename... Args>
void _debug(istream_iterator<string> it, T first, Args... args) {
    cerr << ">> " << *it << " : " << first << endl; _debug(++it, args...);
}
template <typename T1, typename T2>
inline ostream& operator << (ostream& out, const pair<T1, T2>& p) {
    return out << "(" << p.F << ", " << p.S << ")";
}
template<typename T>
inline ostream& operator << (ostream& out, const vector<T>& v) {
    if (v.empty()) return out << "[]";
    else { out << '['; for (auto& e : v) { out << e << ", "; } return out << "\b\b]"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const set<T>& s) {
    if (s.empty()) return out << "{}";
    else { out << '{'; for (auto& e : s) { out << e << ", "; } return out << "\b\b}"; }
}
template<typename T>
inline ostream& operator << (ostream& out, const unordered_set<T>& s) {
    return out << set<T>(ALL(s));
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const map<T1, T2>& m) {
    if (m.empty()) return out << "{}";
    out << '{'; for (auto& p : m) { out << p << ", "; } return out << "\b\b}";
}
template<typename T1, typename T2>
inline ostream& operator << (ostream& out, const unordered_map<T1, T2>& m) {
    return out << map<T1, T2>(ALL(m));
}
template<typename T>
inline ostream& operator << (ostream& out, const ordered_set<T>& s) {
    return out << set<T>(ALL(s));
}

typedef long long ll;
typedef long double ld;
typedef vector<long long> vll;
typedef pair<ll, ll> pll;
typedef vector<pair<ll, ll>> vpll;
typedef unordered_map<ll, ll> STll;
/************************************** MAIN PROGRAM ********************************************/

int main()
{
    //freopen("input.txt", "r", stdin);
    SPEED
    ll a;
    cin >> a;
    cout << (a + a * a + a * a * a);
}
/************************************** END OF PROGRAM ******************************************/
/** Stuff you should look for:
 * int overflow, array bounds, over-counting
 * special cases (n=1?), set/unordered_set TLE, multi-set/set error
 * do something instead of nothing and stay organized
 */


Measured memory_bytes: 3660