akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long
#define pb push_back
#define It set<node>::iterator
#define endl '\n'
#define fastio ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int maxn=2e5+10;
const int inf=0x3f3f3f3f;

struct seg{
	int l,r,dat;
}t[4*maxn];

int n,k,c;
string s;
int f1[maxn],f2[maxn],f3[maxn],f4[maxn],max1[maxn],max2[maxn];
vector<int> v;

inline void push_up(int x){
	t[x].dat=max(t[x<<1].dat,t[x<<1|1].dat);
} 

inline void build(int l,int r,int x){
	t[x].l=l,t[x].r=r,t[x].dat=0;
	if(l==r) return ;
	int mid=(l+r)>>1;
	build(l,mid,x<<1);
	build(mid+1,r,x<<1|1);
	push_up(x);
}

inline void addval(int pos,int d,int x){
	if(t[x].r<pos||t[x].l>pos) return ;
	if(t[x].l==t[x].r){
		t[x].dat=max(t[x].dat,d);
		return ;
	}
	int mid=(t[x].l+t[x].r)>>1;
	if(pos<=mid) addval(pos,d,x<<1);
	if(pos>mid) addval(pos,d,x<<1|1);
	push_up(x);
}

inline int query(int l,int r,int x){
	if(l>r) return 0;
	if(t[x].l>=l&&t[x].r<=r) return t[x].dat;
	int mid=(t[x].l+t[x].r)>>1,res=0;
	if(l<=mid) res=max(res,query(l,r,x<<1));
	if(r>mid) res=max(res,query(l,r,x<<1|1));
	return res; 
} 

signed main(){
	cin>>n>>k>>c>>s;
	for(int i=n;i>=1;--i) if(s[i-1]=='o'){
		f1[i]=max1[min(n+1,i+c+1)]+1;
		max1[i]=max(max1[i],f1[i]);
	}else max1[i]=max1[i+1];
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f3[i]=max1[min(n+1,i+1)];
	}
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f2[i]=max2[max(0ll,i-c-1)]+1;
		max2[i]=max(max2[i],f2[i]);
	}else max2[i]=max2[i-1];
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f4[i]=max2[max(0ll,i-1)];
	}
/*	build(1,n,1);
	for(int i=n;i>=1;--i) if(s[i-1]=='o'){
		f1[i]=query(min(n+1,i+c+1),n,1)+1;
		addval(i,f1[i],1);
	}
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f3[i]=query(min(n+1,i+1),n,1);
	}
	build(1,n,1);
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f2[i]=query(1,max(0,i-c-1),1)+1;
		addval(i,f2[i],1);
	}
	for(int i=1;i<=n;++i) if(s[i-1]=='o'){
		f4[i]=query(1,max(0,i-1),1);
	}*/
	for(int i=1;i<=n;++i){
		if(s[i-1]=='x') continue;
		int val1=f1[i]+f2[i]-1,val2=f3[i]+f4[i];
//		if(val1>k||val2>k) return 0;
		if(val1==k&&val2<k) v.pb(i); 
	//	if(val2<k) v.pb(i);
	}
	for(int i=0;i<v.size();++i) cout<<v[i]<<endl;
	return 0;
}

Measured memory_bytes: 13556
#include <iostream>

using namespace std;

int main()
{
    int n,fl=1,i,j,k,l;
    string str;
    cin >> str;
    n = str.length();
    for(i=0;i<n/2;i++){
        if(str[i] != str[(n-1)-i]) fl =0; 
    }
    //cout << fl << endl; 
    if(fl == 1){
        for(j=0;j<(n-1)/4;j++){
            if(str[j] != str[(((n-1)/2)-1)-j]) fl =0; break;
        
        }
    }
    if (fl==1){
        for(k=(n+1)/2,l=0;l<(n-1)/4;k++,l++){
            if(str[k] != str[(n-1)-l]) fl =0; break;
        }
    }
    //cout << n;
    if(fl==1) cout<<"Yes";
    if(fl==0) cout<<"No";
    return 0;
}


Measured memory_bytes: 256
n=int(input())
s = [0] * (n+1)

print(0)
a = input()
if a=='Vacant':
    exit()
s[0]=a
s[n]=a

l = 0
r = n
while True:
    m = (r+l)//2
    print(m)
    a = input()
    if a=='Vacant':
        exit()
    s[m]=a
    if s[l]==s[r]:
        if s[l]==s[m]:
            if (m-l)%2==1:
                r = m
            else:
                l = m
        else:
            if (m-l)%2==1:
                l = m
            else:
                r = m
    else:
        if s[l]==s[m]:
            if (m-l)%2==1:
                r = m
            else:
                l = m
        else:
            if (m-l)%2==1:
                l = m
            else:
                r = m


Measured memory_bytes: 4424
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
#include<vector>
#include<cstring>
#define ll long long int
#define mod 1000000007
#define lp(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
ll max(ll a,ll b){
    return a>b?a:b;
}
int main(){
    ll t;
  //  cin>>t;
    t=1;
    while(t--)
    {
        ll h,w;
        cin>>h>>w;
        bool a[h][w];
    //    cout<<h<<w<<endl;
        lp(i,h)
        {
            string b;
            cin>>b;
         //   cout<<endl<<b<<endl;
            lp(j,w){
            if(b[j]=='.')
            a[i][j]=true;
            else
            {
              //  cout<<"hu";
                a[i][j]=false;
            }
            }

        }
        int dp[h][w];
        
        memset(dp,0,sizeof(dp));
        dp[0][0]=1;
        lp(i,h)
        lp(j,w)
        {
            if(i>0&&a[i-1][j]==true)
            dp[i][j]+=dp[i-1][j]%mod;
            dp[i][j]%=mod;
            if(j>0&&a[i][j-1]==true)
            dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;

        }
        // lp(i,h){
        // lp(j,w)
        // cout<<dp[i][j]<<" ";
        // cout<<endl;
        // }
        cout<<dp[h-1][w-1]<<endl;


    }
    
    return 0;
}

Measured memory_bytes: 5120
n, m, c = map(int, input().split())
b = [int(s) for s in input().split()]
cnt = 0
for _ in range(n):
    a = [int(s) for s in input().split()]
    if sum([a[i] * b[i] for i in range(len(a))]) + c > 0:
        cnt += 1
print(cnt)


Measured memory_bytes: 3060
#include <stdio.h>
   
   int main(void){
           while(1){
                   int count;int x=10,y=10;
                   int locate[40]={0};
                   int mission,sum=0,i,o,p;
                   char hougaku;int kyori;
                 scanf("%d",&count);
                  if(count==0)
                          break;
                        for(i=0;i<count*2;i++)
                                  scanf("%d",&locate[i]);
                          scanf("%d",&mission);
                         for(i=0;i<mission;i++){
                                  scanf("%s%d",&hougaku,&kyori);
                                  for(p=0;p<kyori;p++){
                                  if(hougaku == 'N')
                                          y++;
                                  if(hougaku== 'E')
                                          x++;
                                  if(hougaku == 'S')
                                         y--;
                                 if(hougaku == 'W')
                                          x--;
                                  for(o=0;o<=count*2-2;o+=2){
                                          if(locate[o]==x){
                                                  if(locate[o+1]==y){
                                                          locate[o]=-1;
                                                          locate[o+1]=-1;
                                                          sum++;
                                                  }       
                                          }       
                                  }       
                          }       
                          }       
  if(sum!=count)          printf("No\n");
  else printf("Yes\n");   
          }
          return 0;
  }       

Measured memory_bytes: 584
#define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	int n;
	int a,b,c,d;
	cin>>n;
	vector<int> sum(n+1,0);
	vector<int> rank(n+1);
	sum[0]=-999999;
	for(int i=0;i<n*(n-1)/2;i++){
		cin>>a>>b>>c>>d;
		if(c>d){
			sum[a]+=3;
		}
		else if(c<d)
			sum[b]+=3;
		else{
			sum[a]++;
			sum[b]++;
		}	
	}
	int k=0;
	int o=0;
	for(int i=0;i<n;i++){
		vector<int>::iterator it=find(sum.begin(),sum.end(),*max_element(sum.begin(),sum.end()));
		int j=it-sum.begin();
		if(k==0){
			k=1;
			o=sum[j];
			rank[j]=1;
		}
		else if(o==sum[j]){
			rank[j]=k;
		}
		else{
			k=i+1;
			o=sum[j];
			rank[j]=k;
		}
		sum[j]=-999999;
	}
	
	for(int i=1;i<=n;i++)
		cout<<rank[i]<<endl;
	
	
	
	
}

Measured memory_bytes: 3096
from collections import deque
N,M,Q = map(int,input().split())
l = []
for i in range(Q):
  l.append(list(map(int,input().split())))

ls = deque([[1]])
while True:
  v = ls.popleft()
  if len(v) == N+1:
    ls.append(v)
    break
  matubi = int(v[-1])
  for i in range(matubi,M+1):
    ls.append(v+[i])

def check(s):
  karid = 0
  for i in range(Q):
    a,b,c,d = l[i]
    if int(s[b]) - int(s[a]) == c:
      karid += d
  return karid

ans = 0
for i in range(len(ls)):
  s = ls[i]
  ans = max(check(s),ans)
print(ans)  

Measured memory_bytes: 24500
n = gets.to_i
card = Array.new(52,1)

for i in 1..n do
  a,b = gets.split
  b = b.to_i
  card[b-1] = 0 if a == "S"
  card[b+12] = 0 if a == "H"
  card[b+25] = 0 if a == "C"
  card[b+38] = 0 if a == "D"
end

for i in 1..52 do
  if card[i-1] == 1 && i<14
     puts "S #{i}"
  elsif card[i-1] ==1 && i<27
     puts "H #{i-13}" 
  elsif card[i-1] ==1 && i<40
     puts "C #{i-26}" 
  elsif card[i-1] ==1
     puts "D #{i-39}"
  end
end



Measured memory_bytes: 8892
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		if(scan.next().equals("ABC")) {
			System.out.println("ARC");
		}else {
			System.out.println("ABC");
		}
		
		scan.close();
	}

}

Measured memory_bytes: 35692
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    int ans = 1;
    
    REP(i, 2, min(32, x)) {
        rep(j, 100) {
            if (pow(i*1.0, j*1.0) > x) break;
            ans = max(ans, (int)(pow((float)(i), (float)(j))));
            // cout << i << " " << j << " " << ans <<  endl;
        }
    }
    // ans = int(pow(31*1.0, 2*1.0));
    cout << ans << endl;
}


Measured memory_bytes: 384
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
n = int(input())
counter = 0
for i in range(1,n+1):
  if i %2 == 1 and len(make_divisors(i)) == 8:
    counter += 1
    
print(counter)

Measured memory_bytes: 3060
n, x = map(int, input().split())
l = [int(i) for i in input().split()]
cnt = 1
i = 0
now = 1
ans = [1]*(x+l[-1])
sum = 0
for i in range(n):
    for j in range(sum + l[i], x+l[-1]):
        ans[j] += 1
    sum += l[i]
print(ans[x])

Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dump(X) cout << #X << ' ' << X << endl
#define pe(X) cout << X << endl
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}

#define MOD 1000000007ll // prime
// How to devide :
// ModInt a(6ll);
// ModInt b(2ll);
// a *= b.exp(MOD-2ll);  -> a/=b;  result: a = 3
struct ModInt{
	ll val;
	ModInt():val(0ll){}
	ModInt(ll v):val(((v%MOD)+MOD)%MOD){}
	ModInt exp(ll y)const{
		if(!y)return ModInt(1ll);
		ModInt a = exp(y/2ll);
		a *= a;
		if(y&1)a*=(*this);
		return a;
	}
	bool operator==(const ModInt& x)const{return val==x.val;}
	inline bool operator!=(const ModInt& x)const{return !(*this==x);}
	bool operator<(const ModInt& x)const{return val<x.val;}
	bool operator>(const ModInt& x)const{return val>x.val;}
	inline bool operator>=(const ModInt& x)const{return !(*this<x);}
	inline bool operator<=(const ModInt& x)const{return !(*this>x);}
	ModInt& operator+=(const ModInt& x){if((val+=x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator-=(const ModInt& x){if((val+=MOD-x.val)>=MOD)val-=MOD;return *this;}
	ModInt& operator*=(const ModInt& x){(val*=x.val)%=MOD;return *this;}
	ModInt operator+(const ModInt& x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt& x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt& x)const{return ModInt(*this)*=x;}
};
istream& operator>>(istream&i,ModInt&x){i>>x.val;return i;}
ostream& operator<<(ostream&o,const ModInt&x){o<<x.val;return o;}
ModInt pow(ModInt a,ll x){
	ModInt res = ModInt(1ll);
	while(x){
		if(x&1)res *= a;
		x >>= 1;
		a = a*a;
	}
	return res;
}
const int SIZE = 100100;
ModInt inv[SIZE+10],fac[SIZE+10],facinv[SIZE+10];
// notice: 0C0 = 1 
ModInt nCr(int n,int r){
	assert(!(n<r));
	assert(!(n<0||r<0));
	return fac[n]*facinv[r]*facinv[n-r];
}
ModInt nPr(int n,int r){
	if(n<r)return ModInt(0ll);
	return fac[n]*facinv[n-r];
}
void init(){
	fac[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)fac[i]=fac[i-1]*ModInt(i);
	inv[1]=ModInt(1ll);
	for(int i=2;i<=SIZE;i++)inv[i]=ModInt(0ll)-ModInt(MOD/i)*inv[MOD%i];
	facinv[0]=ModInt(1ll);
	for(int i=1;i<=SIZE;i++)facinv[i]=facinv[i-1]*inv[i];
	return;
}

int N,K;
vector<int> g[100100];
ModInt dfs(int v,int p,int d){
	int ch=0;
	ModInt res = ModInt(1ll);
	for(int i=0;i<g[v].size();i++){
		int u = g[v][i];
		if(u==p)continue;
		ch++;
		res *= dfs(u,v,d+1);
	}
	if(d==0){
		res *= nPr(K,ch+1);
	}else{
		res *= nPr(K-2,ch);
	}
	//cout << v << ' ' << res << endl;
	return res;
}
int main(){
	init();
	cin >> N >> K;
	for(int i=0;i<N-1;i++){
		int a,b;
		cin >> a >> b;
		a--;b--;
		g[a].pb(b);
		g[b].pb(a); 
	}
	cout << dfs(0,-1,0) << endl;
	return 0;
}

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

int main(){
    ll H,W;
    cin >> H >> W;
    vector<vector<ll>> A(H, vector<ll>(W));
    vector<vector<ll>> c(10, vector<ll>(10));
    vector<ll> d(10,1e10);
    vector<ll> e(10,0);
    rep(i,10){
        rep(j,10){
            cin >> c[i][j];
        }
    }

    d[1] = 0;
    priority_queue<pair<ll,ll>, vector<pair<ll,ll>>, greater<pair<ll,ll>>> que;
    que.push(make_pair(0,1));
    while(!que.empty()){
        auto p = que.top();
        ll mp = p.first;
        ll v = p.second;
        que.pop();
        if(e[v] == 1) continue;
        d[v] = min(d[v], mp);
        rep(i,10){
            if(i == v) continue;
            que.push(make_pair(mp+c[i][v],i));
        }
        e[v] = 1;
    }
    /*rep(i,10){
        cout << d[i] <<" ";
    }*/
    //cout << endl;
    ll sum = 0;
    rep(i,H){
        rep(j,W){
            cin >> A[i][j];
            if(A[i][j] != -1){
                sum += d[A[i][j]];
            }
        }
    }
    cout << sum << endl;

    
}

Measured memory_bytes: 512
N = int(input())
A = list(map(int, input().split()))
flag = True
for i in A:
   if i % 2 == 0:
      if i % 3 == 0 or i % 5 == 0:
         pass
      else:
         flag = False

if flag:
   print('APPROVED')
else:
   print('DENIED')

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

using namespace std;

long long inf=1000000007;

int main(){
	long long n,m;
	cin>>n>>m;
	vector<vector<long long>> light(m);
	vector<long long> p(m);

	for(long long i=0;i<m;i++){
		long long k;
		cin>>k;
		for(long long j=0;j<k;j++){
			long long hoge;
			cin>>hoge;
			light.at(i).push_back(hoge);
		}
	}

	for(long long i=0;i<m;i++){
		cin>>p.at(i);
	}

	long long ans=0;

	for(long long tmp=0;tmp<(1<<n);tmp++){
		bitset<10> bits=tmp;
		long long cnt=0;

		for(long long i=0;i<m;i++){
			long long pre=0;
			for(auto a:light.at(i)){
				if(bits.test(a-1)) pre++;
			}

			if(pre%2==p.at(i)) cnt++;
		}

		if(cnt==m) ans++;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS

int main(int argc, char const *argv[])
{
	int n,m,cnt,max = 0;
	char s[107][17],t[107][17];
	scanf("%d",&n);
	for(int i = 0; i < n; ++i)	scanf("%s",s[i]);
	scanf("%d",&m);
	for(int i = 0; i < m; ++i)	scanf("%s",t[i]);
	for(int i = 0; i < n; ++i){
	    cnt = 0;
	    for(int j = i; j < n; ++j){
				if(strcmp(s[i],s[j]) == 0) ++cnt;
	    }
	    for(int j = 0; j < m; ++j){
	        if(strcmp(s[i],t[j]) == 0) --cnt;
	    }
	    if(max < cnt) max = cnt;
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 128
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val (n, a, b) = sc.intList()
        val s = sc.next()

        val sb = StringBuilder()
        var cnt = 0
        var cnt2 = 0
        for (i in 0 until n) {

            val f = when (s[i]) {
                'a' -> {
                    if (cnt < a + b) {
                        cnt++
                        true
                    } else {
                        false
                    }
                }
                'b' -> {
                    if (cnt < a + b && cnt2 < b) {
                        cnt++
                        cnt2++
                        true
                    } else {
                        false
                    }
                }
                else -> {
                    false
                }
            }
            sb.appendln(if (f) "Yes" else "No")
        }

        println(sb.toString())

    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 42024
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
    int N;
    ll a;
    int count = 0;
    cin >> N;
    REP(i, N) {
        cin >> a;
        while(a%2==0) {
            count++;
            a /= 2;
        }
    }
    cout << count;
    /*
    int D, N;
    cin >> D >> N;
    int count = 0;
    if(D == 0) {
        cout << N;
    } else if(D== 1) {
        cout << 100 * N;
    } else {
        cout << 10000 * N;
    }
*/
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

int main(){
  int A, B;
  std::cin >> A >> B;
  if(A >= 13) std::cout << B << std::endl;
  else if(A < 13 && A >= 6) std::cout << B / 2 << std::endl;
  else std::cout << 0 << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int n;
    long int m=0,a=0,r=0,c=0,h=0;
    string now;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>now;
        switch(now[0]){
            case 'M':
                m++;
                break;
            case 'A':
                a++;
                break;
            case 'R':
                r++;
                break;
            case 'C':
                c++;
                break;
            case 'H':
                h++;
                break;
        }
    }
    cout<<m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h;
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
from math import factorial
def combination(n, r):
    if n >= r and n >= 0 and r >= 0:
        return int(factorial(n) // (factorial(r) * factorial(n - r)))
    else:
        return 0
N, K = map(int, input().split())
mod = 10**9 + 7

for i in range(1, K+1):
    print(combination(N-K+1, i) * combination(K-1, i-1)%mod)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define Maxn 5007
using namespace std;
pair<int,int> a[Maxn];
long long f[Maxn];
int n;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i].second,&a[i].first);
		a[i].first+=a[i].second;
	}
	sort(a+1,a+n+1);
	for (int i=1;i<=n;i++)
		a[i].first-=a[i].second;
	for (int i=1;i<=n;i++)
		f[i]=1000000000000000000LL;
	for (int i=1;i<=n;i++)
		for (int j=i;j;j--)
			if (a[i].second>=f[j-1]) f[j]=min(f[j],f[j-1]+a[i].first);
	int ans=0;
	for (int i=1;i<=n;i++)
		if (f[i]<1000000000000000000LL) ans=i;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[n]={},b[n]={};
ll ca=0,cb=0,cc=0;
for(ll i=0; i<n; i++){
cin>>a[i];}
for(ll i=0; i<n; i++){
cin>>b[i];}
for(ll i=0; i<n; i++){
if(a[i]>b[i]){
ca+=a[i]-b[i];}
else{
cc+=(b[i]-a[i]+1)/2;
cb+=b[i]-a[i];}}
if(-ca+cb>=cc){
cout <<"Yes" << endl;}
else{
cout << "No" << endl;}}


Measured memory_bytes: 3752
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int[] dx = new int[] { 0, 0, 1, -1 };
    static int[] dy = new int[] { 1, -1, 0, 0 };

    static void Solve()
    {
        var a = sc.Int();
        var b = sc.Int();

        var cnt = 0;

        for (int i = a; i <= b; i++)
            if (i.ToString() == string.Join("", i.ToString().Reverse()))
                cnt++;
        
        pr.WriteLine(cnt);
    }

    static int[,] Mul(int[,] a, int[,] b)
    {
        var ret = new int[a.GetLength(0), b.GetLength(1)];
        for (int i = 0; i < a.GetLength(0); i++)
            for (int j = 0; j < b.GetLength(1); j++)
                for (int k = 0; k < a.GetLength(1); k++)
                    ret[i, j] += a[i, k] * b[k, j];

        return ret;
    }

    static int[,] Pow(int[,] a, int n)
    {
        var b = new int[a.GetLength(1), a.GetLength(0)];

        var f = n % 2 == 1;

        for (int i = 0; i < a.GetLength(0); i++)
            b[i, i] = 1;

        while (n > 0)
        {
            if (n % 2 == 1)
                b = Mul(a, b);


            n >>= 1;
        }

        return b;
    }

    class Coord
    {
        public int x;
        public int y;
    }

    static void Main(string[] args)
    {
        // pr.AutoFlush = true;
        Solve();
        pr.Flush();
        // Console.ReadKey();
    }

    static Scanner sc = new Scanner();
    static Printer pr = new Printer();
}

#region IO
class Scanner
{
    private int _i = 0;
    private string[] line = new string[0];

    private T[] Enumerate<T>(int n, Func<T> f)
    {
        T[] ret = new T[n];
        for (int i = 0; i < n; i++)
            ret[i] = f();
        return ret;
    }

    public string Str()
    {
        if (line.Length <= _i)
        {
            line = Console.ReadLine().Split(' ');
            _i = 0;
        }

        return line[_i++];
    }

    public int Int() => int.Parse(Str());
    public long Long() => long.Parse(Str());
    public double Double() => double.Parse(Str());
    public int[] Int(int n) => Enumerate(n, Int);
    public long[] Long(int n) => Enumerate(n, Long);
    public double[] Double(int n) => Enumerate(n, Double);
    public string[] Str(int n) => Enumerate(n, Str);
}

class Printer : StreamWriter
{
    public Printer() : base(Console.OpenStandardOutput())
    {
        AutoFlush = false;
    }
}
#endregion

Measured memory_bytes: 15428
n, k = map(int,input().split())

# kが奇数ならa,b,cはkの倍数
# kが偶数ならa,b,cはk/2の倍数

if k % 2 == 1:
  print((n//k)**3)
else:
  k_1 = (n//k)**3 #a,b,cが全てkの倍数
  k_2 = ((2*n)//k - n//k)**3 #a,b,cがk/2の奇数倍
  print(k_1+k_2)

Measured memory_bytes: 2940
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);

			int n = sc.nextInt();
			int[] p = new int[n];
			int[] q = new int[n];
			
			for(int i=0;i<n;i++) {
				p[i]=sc.nextInt();
			}
			
			for(int i=0;i<n;i++) {
				q[i]=sc.nextInt();
			}
			
			System.out.println(Math.abs((calc(n,p))-(calc(n,q))));
			
		}
		
		
		
		public static int calc(int n,int[] x) {
			int ret =0;
			Set<Integer> memo = new HashSet<>();
			for(int i=0;i<n;i++) {
				
				
				memo.add(x[i]);
				int count = 0;
				for(int j=1;j<=x[i];j++) {
					if(!(memo.contains(j))) {
						count++;
					}
				}
				ret+=(count)*factorial(n-i-1);
			}
			
			return ret;
		}
		
		
		static int  factorial(int n){
			  if(n == 0){
			    return 1;
			  }
			  return n * factorial(n-1);
			}

	}
	

	

Measured memory_bytes: 23124
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            print("Bad")
            quit()
    print("Good")
    return

#B
def B():
    n,l = LI()
    a = [i+l for i in range(n)]
    ans = sum(a)
    m = n+l-1
    for i in a[::-1]:
        if i < 0:break
        m = min(m,i)
    ans -= m
    print(ans)
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()


Measured memory_bytes: 39024
/*
　　　　　　 ＿＿
　　　　　／＞　　 フ
　　　　　|   _　 _l  
　 　　　／` ミ＿x ノ   Zzz..
　　 　 /　 　 　 |   コード見ちゃだめ！！
　　　 /　 ヽ　　  ﾉ
　 　 │　　|　|  |   
　／￣|　　 |　|  |
　| (￣ヽ＿_ヽ_)_ _)
　＼二つ
*/

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) reverse((a).begin(),(a).end())
#define REP(i, n) for(int i = 0; i < n; i++)
const int MOD = 1e9+7;
typedef long long ll;


int main(){
    int n; cin>>n;
    vector<int>a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    SORT(a);
    a.push_back(0);
    int count=0;
    int total=0;
    for(int i=0;i<a.size();i++){
        if(a[i]==a[i+1]) count++;
        else{
            if(count+1-a[i]>=0)total+=min(count+1-a[i],count+1);
            else total+=count+1;
            count=0;
        }
        
    }
    cout<<total<<endl;

}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef vector<ll> vel;
typedef vector<str> ves;
#define REP(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define rep(i, b) REP(i, 0, b)
const ll mod = 1000000007;
const double pi = 3.14159265358979; 
const ll inf = 1001001001;

ll expo(ll a, ll b){
    ll ex = 1;
    rep(i, b){
        ex *= a;
    }
    return ex;
}

ll fact(ll a){
    ll fc = 1;
    REP(i, 1, a+1){
        fc *= i;
    }
    return fc;
}

int main() {
    ll n, m, x;
    cin >> n >> m >> x;
    ll ans = inf;
    vel c(n);
    vector<vector<ll>> a(n, vector<ll>(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) {
            cin >> a[i][j];
        }
    }
    rep(l, 1<<n) {
        ll cst = 0;
        bool jdg = true;
        vel skl(m, 0);
        rep(i, n) {
            if (l >> i & 1) {
                cst += c[i];
                rep(j, m) {
                    skl[j] += a[i][j];
                }
            }
        }
        rep(i, m) {
            if(skl[i] < x) {
                jdg = false;
            }
        }
        if(jdg) {
            ans = min(ans, cst);
        }
    }
    if (ans == inf) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }
}

Measured memory_bytes: 3636
while True:
    H, W = list(map(int, input().split()))
    if H == 0 and W == 0:
        break
    for h in range(H):
        for w in range(W):
            if (h+w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')
        print()
    print()


Measured memory_bytes: 7004
#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4244) // 最悪をします
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <sstream>
#define BIT(nr) (1UL << (nr))
#define int long long
//#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
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; }


using namespace std;

//デバッグ用カッコの有無
#ifdef DEBUG
template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	o << "{"; for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? ", " : "") << v[i]; o << "}"; return o;
}
#endif // DEBUG

template <class T>ostream &operator<<(ostream &o, const vector<T>&v)
{
	for (int i = 0; i<(int)v.size(); i++)o << (i>0 ? " " : "") << v[i]; return o;
}

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

int dxp[4] = { 0, 1 }; // x軸方向への変位(正のみ)
int dyp[4] = { 1, 0 }; // y軸方向への変位(負のみ)

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;

	// libalgo のものに追加、メンバを追加するだけなので互換性は崩さないはず、逆辺のG[e.dstの]インデックスを保持
	int rev;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph& g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph& g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int G[15][15];

int nC2(int n) {
	return n * (n - 1) / 2;
}

signed main() {
	int N;
	cin >> N;
	int nodeNum = -1;

	rep(i, 100010) {
		int cal = nC2(i);

		if (cal == N) {
			nodeNum = i;
		}
	}

	if (nodeNum == -1) {
		cout << "No\n";
		return 0;
	}
	
	vector<vector<int>> ans(nodeNum, vector<int>());

	int now = 1;
	rep(i, nodeNum) {
		REP(j, i + 1, nodeNum) {
			ans[i].push_back(now);
			ans[j].push_back(now);
			now++;
		}
	}

	cout << "Yes\n";
	cout << ans.size() << "\n";

	for (auto v : ans) {
		cout << v.size() << " ";
		cout << v << "\n";
	}

	return 0;
}


Measured memory_bytes: 5172
#include <iostream>
#include <vector>

int search_range(std::vector<std::vector<int> > map, int s, int t, int i, int j) {
    int count = 0;
    for (int m = 0; m < t; m++) {
        for (int n = 0; n < s; n++) {
            if (map[i + m][j + n] == 1) {
                count++; 
            }
        }
    }
    return count;
}

int tree_count(std::vector<std::vector<int> > map, int s, int t)  {
    int max_count = 0;
    int count;
    for (int i = 0; i <= map.size() - t; i++) {
        for (int j = 0; j <= map[i].size() - s; j++) {
            count = search_range(map, s, t, i, j);    
            if (max_count < count) {
                max_count = count;
            }
        }
    }
    return max_count;
}

int main(void) {
    int n;
    int w;
    int h;
    int x;
    int y;
    int s;
    int t;

    while (1) {
        std::cin >> n;
        if (n == 0) {
            break;
        }
        std::cin >> w >> h;
        std::vector<std::vector<int> > map(h, std::vector<int>(w, 0));
        for (int i = 0; i < n; i++) {
            std::cin >> x >> y;   
            map[y - 1][x - 1] = 1;
        }

        std::cin >> s >> t;

        std::cout <<  tree_count(map, s, t) << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3196
#include<iostream>
#include<string>

using namespace std;

int main(){
  string Tcard, Hcard;
  int Tsccore = 0, Hsccore = 0;
  int n;
  cin >> n;
  while(n > 0){
    cin >> Tcard >> Hcard;
    if(Tcard == Hcard){
      Tsccore++;
      Hsccore++;
    }
    else if(Tcard < Hcard){
      Hsccore += 3;
      // cout << Hcard << endl;
    }else{
      Tsccore += 3;
      // cout << Tcard << endl;
    }
    n--;
  }
  cout << Tsccore << " " << Hsccore << endl;
}


Measured memory_bytes: 3228
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 3010

char c[SIZE][SIZE];

set<pair<int,int>> ss;

int main(){
  int H, W;

  scanf("%d%d", &H, &W);

  for (int i=0; i<H; i++) {
    scanf("%s", c[i]);

    int l = INF, r = -1;
    for (int j=0; j<W; j++) {
      if (c[i][j] == 'B') {
        l = min(l, j);
        r = max(r, j);
      }
    }

    if (l != INF) {
      ss.insert({i, l});
      ss.insert({i, r});
    }
  }

  for (int j=0; j<W; j++) {
    int u = INF, d = -1;
    for (int i=0; i<H; i++) {
      if (c[i][j] == 'B') {
        u = min(u, i);
        d = max(d, i);
      }
    }
    if (u != INF) {
      ss.insert({u, j});
      ss.insert({u, j});
    }
  }

  int ans = 0;

  for (auto p1 : ss) {
    for (auto p2 : ss) {
      ans = max(ans, abs(p1.first-p2.first) + abs(p1.second-p2.second));
    }
  }

  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 6024
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

int n, m;
vector<char> v; // dfsで訪問済みか 二部グラフ判定用の色も兼ねる
vector<int> f; // 最初の辺
vector<pair<int, int>> e; // もう片方の端点と次の辺
int c, b;

void add_edge(int u, int v) {
    e[c] = { v, f[u] }; // お尻に足していく
    f[u] = c;
    c++;
}

void dfs(int i, int d) {
    v[i] = d;
    c++;
    d ^= 3;
    for (int k = f[i]; k >= 0; k = e[k].second) {
        int j = e[k].first;
        if (v[j]) b |= v[j] ^ d; else dfs(j, d);
    }
}

int main() {
    cin >> n >> m;
    v = vector<char>(n);
    f = vector<int>(n, -1);
    e = vector<pair<int, int>>(m * 2);
    c = 0;
    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--; v--;
        add_edge(u, v);
        add_edge(v, u);
    }

    int64_t k[3] = {};
    for (int i = 0; i < n; i++) {
        if (v[i]) continue;
        c = b = 0;
        dfs(i, 1);
        k[(c > 1) + (b != 0)]++;
    }

    k[2] += k[1];
    int64_t r = k[0] * (n * 2 - k[0]) + k[2] * k[2] + k[1] * k[1];

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
long long n,x,a[2010],b[2010],ans,tmp;
int main(){
    scanf("%lld%lld",&n,&x);
    for(int i=0;i<n;i++)scanf("%lld",&a[i]);
    ans=1e14;memset(b,0x3f,sizeof(b));
	for(int i=0;i<n;i++){
        tmp=0;for(int j=0;j<n;j++)b[j]=min(b[j],a[(j-i+n)%n]),tmp+=b[j];
        ans=min(ans,i*x+tmp);
    }printf("%lld\n",ans);
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
list = []
ans = 0
list.append(a - b)
list.append(a - c)
list.append(a - d)
list.append(a - e)
list.append(b - c)
list.append(b - d)
list.append(b - e)
list.append(c - d)
list.append(c - e)
list.append(d - e)
#print(list)

for i in range(10):
    if abs(list[i]) <= k:
        ans += 1
if ans == 10:
    print("Yay!")
else:
    print(":(")

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

#define mod 1000000007

ll mod_pow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll f(ll len,ll alp){
  if(len<=0)return 0;
  if(len%2==0){
    return mod_pow(alp,len/2);
  }else{
    return mod_pow(alp,len/2)*alp%mod;
  }
}

ll n,k;
set<ll> ds;
map<ll,ll> dp;

int main(){
	cin>>n>>k;
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      ds.insert(i);
      ds.insert(n/i);
    }
  }
  ll res=0;
  for(ll d : ds){
    ll cnt=f(d,k);
    for(ll d_ : ds){
      if(d_==d)break;
      if(d%d_!=0)continue;
      cnt=(cnt-dp[d_]+mod)%mod;
    }
    dp[d]=cnt;
    if(d%2==0)cnt=cnt*mod_pow(2,mod-2)%mod;
    (res+=(cnt*d)%mod)%=mod;
  }
  cout<<res<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main()
{
	int a1,a2,b1,b2;
	scanf("%d%d%d%d",&a1,&a2,&b1,&b2);
	int both=0;
	a1=a1>=b1?a1:b1;
	a2=a2<=b2?a2:b2; 
	if(a2-a1<0)
		printf("%d",0);
	else printf("%d",a2-a1);
	return 0;
}

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<bool>a(n,false);
  rep(i,k){
    int d;
    cin >> d;
    rep(j,d){
      int t;
      cin >> t;
      t--;
      a[t] = true;
    }
  }
  int ans = 0;
  rep(i,n){
    if(!a[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
	char ch;
	int counter[256] = { 0 };
	int  i;

	while (cin>>ch) {

		if ('a' <= ch && ch <= 'z') {
			counter[ch - 'a']++;
		}
		else if ('A' <= ch && ch <= 'Z') {
			counter[ch - 'A']++;
		}
		//if (ch = '\n')break;
	}
	
	for (i = 0; i < 26; i++) {
		printf("%c : %d\n", i+'a', counter[i]);
	}
    return 0;
}




Measured memory_bytes: 3212
#include <iostream>

using namespace std;

int main() {
    char c[4];

    for (int i=0; i<4; i++) cin >> c[i];

    if (c[0] == c[1] && c[0] != c[2] && c[2] == c[3]) {
        cout << "Yes" << endl;
    }else if (c[0] == c[2] && c[0] != c[3] && c[3] == c[1]) {
        cout << "Yes" << endl;
    }else if (c[0] == c[3] && c[0] != c[1] && c[1] == c[2]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    private static final int MOD = 1000000007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        final long[][] table = createPascalsTriangle(n);

        for (int i = 1; i < k + 1; i++) {
            if (i == 1) {
                System.out.println(n - k + 1);
                continue;
            }

            final long blueSplitCombination = table[k - 1][i - 1] % MOD;
            final long redSplitCombination = table[n - k + 1][i] % MOD;

            System.out.println((blueSplitCombination * redSplitCombination) % MOD);

        }
    }

    private static long[][] createPascalsTriangle(final int scale) {
        final long[][] table = new long[scale + 1][scale + 1];
        table[0][0] = 1;
        for (int i = 1; i <= scale; i++) {
            for (int j = 0; j <= i; j++) {
                if (j == 0 || j == i) {
                    table[i][j] = 1;
                    continue;
                }

                table[i][j] = (table[i - 1][j] + table[i - 1][j - 1]) % MOD;
            }
        }

        return table;
    }

    /*
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        for (int i = 1; i < k + 1; i++) {
            if (i == 1) {
                System.out.println(n - k + 1);
                continue;
            }

            final int hashi0K = kumiawase(k - 1, i - 1);
            final int hashi0R = recursive(1, i - 1, n - k);
            final int hashi1R = recursive(1, i, n - k);
            final int hashi2R = recursive(1, i + 1, n - k);

            final int res = (hashi0K * hashi0R + 2 * hashi0K * hashi1R + hashi0K * hashi2R) % MOD;
            System.out.println(res);
        }
    }

    private static int recursive(final int depth, final int selectable, final int amount) {
        if (selectable == 1) {
            return 1;
        }

        if (depth == selectable - 1) {
            return amount - 1;
        }

        final int nokori = selectable - depth + 1;
        if (amount < nokori) {
            return 0;
        }

        int accum = 0;
        for (int i = 1; i < amount; i++) {
            accum += recursive(depth + 1, selectable, amount - i);
            accum %= MOD;
        }

        return accum;
    }

    private static int kumiawase(final int a, final int b) {
        int ue = 1;
        int sita = 1;

        for (int i = 0; i < b; i++) {
            ue *= a - i;
            ue %= MOD;
            sita *= i + 1;
            sita %= MOD;
        }

        return ue / sita;
    }

     */
}


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

#define rep(i,a,b) for(int i=int(a);i<=int(b);++i)
#define nrep(i,a,b) for(int i=int(a);i>=int(b);--i)
#define trv(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define watch(x) cout<<"\n"<<#x<<" is "<<x<<"\n"
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define ZERO(box) memset(box, 0, sizeof(box));
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define chkbit(s, b) (s & (1<<b))
#define leadzero(a) __builtin_clz(a) // count leading zeroes
#define trailzero(a) __builtin_ctz(a) // count trailing zeroes
#define bitcount(a) __builtin_popcount(a) // count set bits (add ll)
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1e9+7;


void solve(){
	int n,l;
    cin>>n>>l;
    vector<string> s(n);
    rep(i,0,n-1) cin>>s[i];
    sort(s.begin(),s.end());
    rep(i,0,n-1) cout<<s[i];
    cout<<"\n";
}


int main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();	
	}	
}
/*input
3 3
zxx
bxx
axx
*/

Measured memory_bytes: 256
using System;

namespace insertionSort
{
	class Program
	{
		public static void Main(string[] args)
		{
			int num=int.Parse(Console.ReadLine());
			string data = Console.ReadLine();
			string[] numbers=data.Split();
			int [] targetData=new int[num];
				
			for(int i=0;i<num;i++)
			{
				targetData[i]=int.Parse(numbers[i]);
			}
					//????????¶??????????????????????????????????????????????????????????????????
					Console.Write(targetData[0]);
					for(int k=1;k<num;k++)
					{
						Console.Write(" "+targetData[k]);
					}
					Console.Write("\r\n");
			for(int i=1;i<num;i++)
			{
				int v=targetData[i];
				int j=i-1;
				while(j>=0&&targetData[j]>v)
				{
					targetData[j+1]=targetData[j];
					j--;
					targetData[j+1]=v;
				
				}
					//????????¶??????????????????????????????????????????????????????????????????
					Console.Write(targetData[0]);
					for(int k=1;k<num;k++)
					{
						Console.Write(" "+targetData[k]);
					}
					Console.Write("\r\n");
			}
		}
	}
}

Measured memory_bytes: 9340
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int power(int x, unsigned int y, int p) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
int mx[1000005];
int fr[1000005];
int mod=1e9+7;
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

// -------------------------------------Code starts here---------------------------------------------------------------------     

   int n,m;
   cin>>n>>m;
   if(n==m)
   {
      cout<<"Yes";
   }
   else
   {
      cout<<"No";
   }
   

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 256