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

template<class T> ostream& operator<<(ostream &os, vector<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T> ostream& operator<<(ostream &os, set<T> V){
	os << "[ ";
	for(auto v  : V) os << v << " ";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, map<T , R> V){
	os << "[ ";
	for(auto v  : V) os << "(" << v.first << ":" << v.second << ")";
	return os << " ]";
}
template<class T , class R > ostream& operator<<(ostream &os, pair<T , R> V){
	return os << "(" << V.first << "," << V.second << ")";
}

#define cerr cout
#define TRACE
#ifdef TRACE
    #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
    clock_t clk=clock();
    #define checktime() cout<<"\nTime Elapsed : "<<float(clock()-clk)/CLOCKS_PER_SEC<<endl
#else
    #define trace(...);
    #define checktime();
#endif
/*---------------------------Defines----------------------*/
typedef long long int ll;
typedef long double ld;
#define pll pair<ll,ll>
#define pb push_back
#define F first
#define S second
#define I insert
#define vll vector<ll>
#define vbl vector<bool>
#define vvll vector<vll>
#define vld vector<ld>
#define vb vector<bool>
#define vc vector<char>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
/*-----------------------Modular Arithmetic---------------*/
inline ll add(ll x,ll y,ll mod){x+=y; if(x>=mod) return x-mod; return x;}
inline ll sub(ll x,ll y,ll mod){x-=y; if(x<0) return x+mod; return x;}
inline ll mul(ll x,ll y,ll mod){return (x*1ll*y)%mod;}
inline ll power(ll x,ll y,ll mod){ll ans=1; while(y){if(y&1) ans=mul(ans,x,mod); x=mul(x,x,mod); y>>=1;} return ans;}
inline ll inv(ll x,ll mod){return power(x,mod-2,mod);}
/*-----------------------------Code begins----------------------------------*/

const ll MOD = 998244353;

void solve(){
    ll n,s;cin>>n>>s;
    vll a(n+1);
    for(ll i=1;i<=n;i++){
        cin>>a[i];
    }
    // trace(n,s,a);
    vvll dp(n+1,vll(s+1,0));
    for(ll i=0;i<=n;i++) dp[i][0]=1LL;
    for(ll i=1;i<=n;i++){
        for(ll j=0;j<=s;j++){
            dp[i][j]=mul(dp[i-1][j],2,MOD);
        }
        for(ll j=s;j>=a[i];j--){
            dp[i][j]=add(dp[i][j],dp[i-1][j-a[i]],MOD);
            // trace(i,j,dp[i][j]);
        }
    }
    cout<<dp[n][s]<<"\n";
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<fixed<<setprecision(25);
    ll t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 73648
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n>>k;
	
	set<int> snukes_with_snacks;
	for(int i=1;i<=k;i++)
	{
		int d;
		cin>>d;
		for(int j =0;j<d;j++)
		{
			int p;
			cin>>p;
			snukes_with_snacks.insert(p);
		}

	}
	int ans = n- snukes_with_snacks.size();
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if((a==c&&b==a&&b==c)||(a!=c&&b!=a&&b!=c))
	printf("No");
	else
	printf("Yes");
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  int n;cin>>n;
  vector<int> a(n);
  int counter=-1;
  rep(i,n){
    cin>>a[i];
    if(a[i]==1 && counter==-1)counter=2;
    if(a[i]==counter)counter++;
  }
  if(counter==-1)cout<<-1;
  else cout<<n-counter+1;

  return 0;
}

Measured memory_bytes: 1024
object Main extends App {
	val pw = new java.io.PrintWriter(System.out)

	@scala.annotation.tailrec
	def loop(start: Int, end: Int)(f: Int => Unit): Unit =
		if (start <= end) {
			f(start)
			loop(start + 1, end)(f)
		}

	def isPalin(s: String): Boolean =
		if (s.size < 2) true
		else if (s.head == s.last) isPalin(s.init.tail)
		else false
	
	val s = Scanner.next()
	val n = s.size
	val t = s.slice(0, (n-1) / 2)
	val u = s.slice((n+2) / 2, n)
	
	pw.println(if (t == u && isPalin(t) && isPalin(u)) "Yes" else "No")

	pw.flush()
}

object Scanner {
	private val buf = new Array[Byte](1024); private var ptr = 0; private var len = 0

	@inline private def isPrintableChar(c: Int): Boolean = 33 <= c && c <= 126
	@inline private def hasNextByte(): Boolean = if (ptr >= len) { ptr = 0; len = System.in.read(buf); len > 0 } else true
	@inline private def hasNext(): Boolean = {
		while (hasNextByte() && !isPrintableChar(buf(ptr))) ptr += 1
		hasNextByte()
	}
	@inline private def readByte(): Byte = if (hasNextByte()) { val res = buf(ptr); ptr += 1; res } else -1

	def next(): String = {
		if(!hasNext()) ???
		val sb = new StringBuilder; var b = readByte()
		while (isPrintableChar(b)) { sb.append(b.toChar); b = readByte() }
		sb.toString
	}

	def nextInt(): Int = {
		val n = nextLong()
		if (n < Int.MinValue || Int.MaxValue < n) ???
		n.toInt
	}

	def nextLong(): Long = {
		if(!hasNext()) ???
		var minus = false; var b = readByte()
		if (b == '-') { minus = true; b = readByte() }

		@scala.annotation.tailrec
		def go (b: Byte, n: Long = 0): Long = if ('0' <= b && b <= '9') go(readByte(), n * 10 + b - '0') else if (minus) -n else n

		go(b)
	}

	def nextDouble(): Double = next().toDouble
}


Measured memory_bytes: 27196
using System;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = GettingStarted.CircleInARectangle();
            System.Diagnostics.Trace.WriteLine(result);
            Console.WriteLine(result);
        }
    }

    public static class GettingStarted
    {
        public static string CircleInARectangle()
        {
            var input = Console.ReadLine().Split(' ');
            var w = int.Parse(input[0]);
            var h = int.Parse(input[1]);
            var x = int.Parse(input[2]);
            var y = int.Parse(input[3]);
            var r = int.Parse(input[4]);

            if (x < r) return "No";
            if (y < r) return "No";
            if (w < x + r) return "No";
            if (h < y + r) return "No";
            return "Yes";
        }
    }
}

Measured memory_bytes: 5312
var n,i,wrong:longint;
    p:array[1..52]of longint;
begin
  readln(n);
  for i:=1 to n do read(p[i]);
  wrong:=0;
  for i:=1 to n do
  begin
    if p[i]<>i then inc(wrong);
  end;
  if wrong<3 then write('YES')
  else write('NO');
end.


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

int mark[21][2100000];
int arr[21][21];

int solve(int i,bool *visited,int n,int mask){
    if(i == n) return 1;
    if(mark[i][mask]!=-1) return mark[i][mask];
    int answer =0 ;
    foi(j,n){
        if(visited[j] == false && arr[i][j] == 1) {
            visited[j] = true;
            int temp = (1<<j);
            int x = (temp|mask);
            answer = (answer%mod + solve(i+1,visited,n,(x)))%mod;
            visited[j] = false;
        }
    }
    return mark[i][mask] = answer;
}


int main() {
    int n;
    cin >> n;
    foi(i,21){
        foi(j,2100000) mark[i][j] = -1;
    }
    foi(i,n){
        foi(j,n) cin >> arr[i][j];
    }
    bool visited[21];
    foi(i,21) visited[i] = false;
    cout << solve(0,visited,n,0);


}


Measured memory_bytes: 172544
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n,k,a[N];
    cin>>n>>k;
    rep(i,1,n) cin>>a[i];
    rep(i,k+1,n){
        cout<<(a[i]>a[i-k]?"Yes":"No")<<'\n';
    }
    return 0;
}


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

int main(){
	int w,h,x,y;
	cin>>w>>h>>x>>y;
	float ans1;
	int ans2;
	ans1=1.0*w*h/2;
	if (2*x==w&&2*y==h) {
		ans2=1;
	}else {
		ans2=0;
	}
	cout<<ans1<<" "<<ans2<<endl;
}

Measured memory_bytes: 256
def main(n: int, a: list):
    prev = [0, 0]
    ans = 0

    for _a in a:
        if _a == prev[0]:
            if prev[1] % 2 == 0:
                ans += 1

            prev[1] += 1
        else:
            prev = [_a, 0]

    print(ans)


if __name__ == '__main__':
    n = int(input())
    a = map(int, input().split())

    main(n, a)


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

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    if( a[a.size()-1] == b[0] && b[b.size()-1] == c[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    } 
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(int i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[4]={0,1,0,-1},mdy[4]={-1,0,1,0};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

string s;
int p;

int hash3(int t1){
	int a=(t1/1000);
	int b=(t1/100)%10;
	int c=(t1/10)%10;
	int d=t1%10;
	stack<int> stk;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='['||s[i]==']')continue;
		if(s[i]=='a')stk.push(a);
		if(s[i]=='b')stk.push(b);
		if(s[i]=='c')stk.push(c);
		if(s[i]=='d')stk.push(d);
		int x,y;
		if(s[i]=='+'||s[i]=='*'||s[i]=='^'){
			x=stk.top();stk.pop();y=stk.top();stk.pop();
		}
		if(s[i]=='+')stk.push(x|y);
		if(s[i]=='*')stk.push(x&y);
		if(s[i]=='^')stk.push(x^y);
	}
	return stk.top();
}	
int main(){
	while(1){
		cin>>s;
		if(s==".")break;
		cin>>p;
		int tt=hash3(p);
		cout<<tt<<" ";
		int ans=0;
		for(int i=0;i<10000;i++){
			if(tt==hash3(i))ans++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3176
#include  <stdio.h>

int main()
{
	int h,w;
	int i,j;

	while(1)
	{
		scanf("%d %d", &h, &w);

		if((h == 0)&&(w == 0))
		{
			break;
		}
		for(i=0; i<h; i++)
		{
			for(j=0; j<w; j++)
			{
				if( (i + j)% 2 == 0)
				{
					printf("#");
				}
				else
				{
					printf(".");
				}	
			}
			printf("\n");
		}
		printf("\n");
	}
	return  0;
}

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

int main()
{
    int a, b, k;
    cin >> a >> b >> k;

    if (b > a) swap(a, b);

    int d = 0;
    rep(i, b) {
        int c = b - i;
        if (a % c == 0 && b % c == 0) ++d;
        if (d == k) {
            cout << c << endl;
            return 0;
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main()
{
  long long i, n,min=10000000,max=-10000000,sum=0,a[10000];
  
  scanf("%lld", &n);

  for(i = 0;i < n; i++){
    scanf("%lld", &a[i]);
    if(a[i] < min){
      min = a[i];
    }
    if(a[i] > max){
      max = a[i];
    }
    sum = sum + a[i];
  }
  printf("%lld %lld %lld\n", min, max, sum);

    return 0;
  
}

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

int main()
{
    int x,y;
    cin >> x >> y;
    string ans = "No";
    rep(i,x+1){
        int a = i;
        int b = x-i;
        if(2*a+4*b == y){
            ans = "Yes";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
	int N;
	cin >> N;
	int a[N];
	int pair = 0;
	for(int i = 0; i < N; i++){
		int input;
		cin >> input;
		a[i] = input - 1;
	}
	for(int i = 0; i < N; i++){
		if(i == a[a[i]] && a[i] != -1){
			pair++;
			a[i] = -1;
			a[a[i]] = -1;
		}
	}
	cout << pair << endl;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	while(N){
		if((N%10==7)){
			out("Yes");
			return 0;
		}
		N/=10;
	}
	out("No");
	return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main(void){
  int n;
  string s,st1,st2;
  int i;
  int t1,t2;
  t1=t2=0;
  cin>>n;
  cin>>s;

  st1=st2="";
  for(i=0;i<n;i++){
    if(s[i]=='(') t1++;
    if(s[i]==')') t2++;
    if(t1<t2){
      st1+="(";
      t2--;
    }
  }
  s=st1+s;
  t1=t2=0;
  for(i=0;i<s.size();i++){
    if(s[i]=='(') t1++;
    if(s[i]==')') t2++;
  }
  for(i=0;i<t1-t2;i++){
    st2+=")";
  }
  cout<<s+st2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solvetask(){
    int n,x,t; cin >> n >> x >> t;
    cout << (n + x - 1)/x * t << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1; //cin >> t;
    while(t--) solvetask();
}

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

int main(){
    int n,k; cin>>n>>k;
    int x[n];
    int a=0;
    for(int i=0;i<n;i++){
        cin>>x[i];
        a+=(min(k-x[i],x[i]))*2;
    }
    cout <<a<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< long long > vll;
typedef pair< int,int > ii;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())
#define cpresent(c,x) (find(all(c),x) != c.end())
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define fo(i,n) for(ll i=0;i<n;i++)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define nl "\n"
ll gcd (ll a, ll b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}

unsigned long long factorial[1000004]; 
    /*factorial[0] = 1; 
    for (int i = 1; i <= n; i++) {
        factorial[i] = (factorial[i - 1] * i) % mod3; 
    }*/




unsigned long long power(unsigned long long x, 
                         int y, int p) 
{ 
    unsigned long long 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; 
} 



  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, int p) 
{ 
    return power(n, p - 2, p); 
} 
unsigned long long nc(unsigned long long n, 
                                 int r, int p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
 
  
    return (factorial[n]* modInverse(factorial[r], p) % p * modInverse(factorial[n - r], p) % p) % p; 
} 



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

    int n;
    cin>>n;
    cout<<1-n<<nl;
    

    


	return 0;
}


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

int main()
{
	string s,t;
	cin >> s >> t;
	sort(s.begin(),s.end());
	sort(t.rbegin(),t.rend());
	if(s<t)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 3612
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

n = int(input())
seq = [int(x) for x in input().split()]
s = sum(seq[1:])
ans = 0
m = 10**9 + 7
for i in xrange(n-1):
    ans = (ans + (seq[i] * s)) % m
    s -= seq[i+1]
print(ans)

Measured memory_bytes: 95288
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000;

typedef long long ll;
typedef unsigned long long ull;

ll gcd(ll a, ll b) {
  if (a + b == a || a + b == b) return a + b;
  if (b > a) return gcd(b, a);
  return gcd(b, a % b);
}

int main(void) {
  ll n; cin >> n;
  if (n % 2 == 1 || n <= 9) {
    cout << 0 << endl;
    return 0;
  }
  n /= 2;
  ll k = 5;
  ll ans = 0;
  while (n >= k) {
    ans += n / k;
    k *= (ll)5;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    C = [readline().strip() for _ in range(3)]

    print(C[0][0] + C[1][1] + C[2][2])

    return


if __name__ == '__main__':
    main()


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

constexpr int mod = 1e9 + 7;
constexpr int32_t inf = 1001001001;
constexpr int64_t infll = 1001001001001001001ll;
constexpr int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

// clang-format off
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

inline int64_t in() { int64_t x = 0; cin >> x; return x; }

template <typename T> void sort(vector<T> &v) { sort(all(v)); }
template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in();
  vector<int> a(n);
  cin >> a;

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    while (a[i] % 2 == 0) {
      a[i] /= 2;
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

struct edge {int from, to, dist, comp;};

int main()
{
	int n, m, c, s, g;
	const int INF = 9999999;

	while(true){
		scanf("%d %d %d %d %d\n",&n, &m, &c, &s, &g);
		if(n==0 && m==0 && c==0 && s==0 && g==0){return 0;}
		int* final_graph = new int[(n+1)*(n+1)]; //最終的なグラフ
		edge* es = new edge[m]; //入力グラフの辺
		int* p = new int[c]; //各社の折れ区間数
		int* cost_table = new int[c*(200*n)];//各社の料金表

		for(int i=0; i<n+1; i++){
			for(int j=0; j<n+1; j++){
				final_graph[i*(n+1)+j]=INF;
			}
		}
		for(int i=0; i<m; i++){//入力：辺の情報
			cin >> (&es[i])->from >> (&es[i])->to >> (&es[i])->dist >> (&es[i])->comp;
		}
		for(int i=0; i<c; i++){//入力：会社ごとの折れ区間数
			cin >> p[i];
		}
		/* 各会社の料金表の作成 */
		for(int i=0; i<c; i++){
			int count = 0;
			int* q = new int[p[i]]; //折れポイント
			int* r = new int[p[i]]; //区間料金増分
			for(int j=0; j < p[i]-1; j++){
				cin >> q[j];
			}
			q[p[i]-1] = -1;
			for(int j=0; j<p[i]; j++){
				cin >> r[j];
			}
			cost_table[i*(200*n)] = 0;
			for(int j=1; j<(200*n); j++){
				cost_table[i*(200*n)+j] = cost_table[i*(200*n)+(j-1)] + r[count];
				if(j == q[count]){count++;}
			}
			delete[] q;
			delete[] r;
		}
		/* 各社の最短路グラフから各社の最小コストグラフを作成し，全体の最小コスト経路を更新する． */
		for(int i=0; i<c; i++){
			int* cal_graph = new int[(n+1)*(n+1)]; //計算用グラフ
			for(int j=0; j<(n+1)*(n+1); j++){cal_graph[j]=INF;}
			for(int j=0; j<n+1; j++){cal_graph[j*(n+1)+j]=0;}
			for(int j=0; j<m; j++){
				if( ( (&es[j])->comp == i+1) && ((&es[j])->dist <  cal_graph[ ((&es[j])->from)*(n+1) + (&es[j])->to ]) ){
					cal_graph[ ((&es[j])->from)*(n+1) + (&es[j])->to ] = (&es[j])->dist;
					cal_graph[ ((&es[j])->to)*(n+1) + (&es[j])->from ] = (&es[j])->dist;
				}
			}
			/* 各キャリアごとの最短路計算 */
			for(int a=0; a<n+1; a++){
				for(int b=0; b<n+1; b++){
					for(int f=0; f<n+1; f++){
						cal_graph[b*(n+1)+f] = min(cal_graph[b*(n+1)+f], cal_graph[b*(n+1)+a]+cal_graph[a*(n+1)+f]);
					}
				}
			}
			/* 各キャリアごとの最小コストグラフに変換 */
			for(int a=0; a<n+1; a++){
				for(int b=0; b<n+1; b++){
					if( cal_graph[a*(n+1)+b] != INF ){
						cal_graph[a*(n+1)+b] = cost_table[ i*(200*n)+cal_graph[a*(n+1)+b] ];
					}
				}
			}
			/* 全体の最小コストグラフの更新 */
			for(int a=0; a<n+1; a++){
				for(int b=0; b<n+1; b++){
					final_graph[a*(n+1)+b] = min(final_graph[a*(n+1)+b],cal_graph[a*(n+1)+b]);
				}
			}
			delete[] cal_graph;
		}
		/* 全体の最小コスト経路計算 */
		for(int j=0; j<n+1; j++){final_graph[j*(n+1)+j]=0;}
		for(int a=0; a<n+1; a++){
			for(int b=0; b<n+1; b++){
				for(int f=0; f<n+1; f++){
					final_graph[b*(n+1)+f] = min(final_graph[b*(n+1)+f], final_graph[b*(n+1)+a]+final_graph[a*(n+1)+f]);
				}
			}
		}/////////////////////////////
		if(final_graph[s*(n+1)+g] == INF){cout << "-1" << endl;}
		else{cout << final_graph[s*(n+1)+g] << endl;}

		delete[] final_graph;
		delete[] es;
		delete[] p;
		delete[] cost_table;
	}
}

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

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

    int a, A, b, B;
    cin>>a>>A>>b>>B;

    long long t;
    cin>>t;

    if (B >= A) cout<<"NO"<<endl;
    else {
        int v = A-B;
        int d = abs(a-b);
        if (d <= t*v)   cout<<"YES"<<endl;
        else            cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 3652
import java.util.Scanner;

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

		int n = Integer.parseInt(sc.next());
		int w = Integer.parseInt(sc.next());

		int[][] table = new int[n][2];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 2; j++) {
				table[i][j] = Integer.parseInt(sc.next());
			}
		}

		long[][] dp = new long[n][w + 1];
		for (int i = table[0][0]; i <= w; i++) {
			dp[0][i] = table[0][1];
		}
		for (int i = 1; i < n; i++) {
			for (int j = 0; j <= w; j++) {
				if (table[i][0] > j) {
					dp[i][j] = dp[i - 1][j];
				} else {
					dp[i][j] = Math.max(dp[i - 1][j], dp[i - 1][j - table[i][0]] + table[i][1]);
				}
			}
		}

		System.out.println(dp[n - 1][w]);

		sc.close();
	}

}


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

int main(){
 	string s;
 	cin >>s;
 	bool ans =true;
 	sort(s.begin(),s.end());
 	for(int i=0;i<s.size()-1;i++){
 	    if(s.at(i)==s.at(i+1)){
 	        cout <<"no" <<endl;
 	        ans =false;
 	        break;
 	    }
 	}
 	if(ans){
 	    cout <<"yes" << endl;
 	}
 	}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int K,A,B,i=1,mul;
    scanf("%d %d %d",&K,&A,&B);
    while(mul<=B)
    {
 
       mul=K*i;
       i++;
if(mul>=A&&mul<=B)
    break;
    }
    if(mul>=A&&mul<=B)
       printf("OK\n");
       else
        printf("NG\n");
       return 0;
}

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


#define ll                      long long
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define eb                      emplace_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define all(x)                  x.begin(),x.end()
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(ll i=0; i<n;++i)
#define fr1(i, n)               for(ll i=1; i<=n; ++i)
#define rfr(i, n)			    for(ll i=n-1; i>=0; --i)
#define precise(x)              cout<<fixed<<setprecision(x)
#define wh						while
#define mp						make_pair
#define le						length()


ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

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

ll mulpow(ll x,ll y,ll p) 
{ ll res=1; x=x%p;
    while(y>0) 
    { if (y&1) res=(res*x)%p; 
      y=y>>1; x=(x*x)%p; } 
    return res; } 
    
bool inside(ll x,ll y,ll n,ll m)
{
	return(x>=0&&x<n&&y>=0&&y<=m);
}   

/*void dfs(int s)
{
		if(vis[s])return;
		
		vis[s]=true;
		nodes++;
		for(auto u:g[s])
		{
			if(!vis[u])
			{
				dfs(u);	
			}		
		}
}*/






void solve()
{	
	ll a;
	cin>>a;
	cout<<a+a*a+a*a*a<<endl;
	
}

int main()
{
//	int t;
//	cin>>t;
//	wh(t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
const int maxn=4e3+1;
const int q=1e9+7;
inline int Plus(int x,int y) {return (x+=y)>=q?x-q:x;}
inline void Pe(int &x,int y) {x=Plus(x,y);}
int n,m,k,l,mk,ans=0,f[maxn][maxn];
int main() {
	cin>>n>>m>>k,l=(n+m-1)/(k-1);
	mk=m%(k-1);
	for (int i=1;i<k;++i) f[1][i]=1;
	for (int i=2;i<=l;++i) for (int j=1;j<=m;++j) for (int x=0;x<k && x<=j;++x) Pe(f[i][j],f[i-1][j-x]);
	for (int i=1;i<=l;++i) for (int j=1;j<=m;++j) if (j%(k-1)==mk && (k-1)*i-j<n) Pe(ans,f[i][j]);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 61952
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int N, W;
  cin >> N >> W;
  vector<int> w(N);
  vector<long long> u(N);
  rep(i, N) cin >> w[i] >> u[i];
  
  vector<vector<long long>> table(N, vector<long long>(W + 1, 0));
  rep(i, N) {
    rep(j, W + 1) {
      if (i == 0) {
        if (j >= w[i]) table[i][j] = u[i];
      } else {
        if (j >= w[i]) table[i][j] = max(table[i - 1][j], table[i - 1][j - w[i]] + u[i]);
        else table[i][j] = table[i - 1][j];
      }
    }
  }
  
  cout << table[N - 1][W] << endl;
  return 0;
}

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

void solve(long long N, std::vector<long long> x, std::vector<long long> y, std::vector<long long> h){
    ll xt, yt, ht;
    for(ll i = 0; i < N; ++i){
        if(h[i] >= 1){
            ht = h[i];
            xt = x[i];
            yt = y[i];
        }
    }
    ll ph;
    for(ll px = 0; px <= 100; ++px){
        for(ll py = 0; py <= 100; ++py){
            ph = ht + abs(px - xt) + abs(py - yt);
            bool check = true;
            for(ll i = 0; i < N; ++i){
                if(h[i] != max(ph - abs(x[i] - px) - abs(y[i] - py), (ll)0)) check = false;
            }
            if(check){
                cout << px << " " << py << " " << ph << endl;
            }
        }
    }
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        scanf("%lld",&h[i]);
    }
    solve(N, std::move(x), std::move(y), std::move(h));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define maxn 200005
int main()
{
    string a;
    cin>>a;
    int ml=0,k=0,l=0;
    while(l<a.size())
    {
        if(a[l]=='A'||a[l]=='T'||a[l]=='C'||a[l]=='G')
          {
                l++,k++;
                ml=max(ml,k);
          }
        else
            k=0,l++;
    }
    printf("%d\n",ml);
    return 0;
}


Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    l = len(bin(max(max(A), K))) - 2
    L = [0] * l
    ans = 0
    k = 0
    for a in A:
        for j in range(l):
            if (a >> j) & 1 == 1:
                L[j] += 1
    for i, b in enumerate(L[::-1]):
        if b < N - b:
            if K >= k + 2 ** (l - i - 1):
                b = N - b
                k += 2**(l - i - 1)
        ans += b * (2**(l - i - 1))
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 87316
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long mod2 = 998244353;
const long long INF = 1LL << 60;
const int inf = pow(10, 9) + 7;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
template <class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

long long dist(long long x, long long s, long long t)
{
  long long d0 = abs(x - s) + abs(s - t);
  long long d1 = abs(x - t) + abs(t - s);
  return min(d0, d1);
}

int main()
{
  int A, B, Q;
  cin >> A >> B >> Q;
  vector<long long> s(A), t(B);
  for (int i = 0; i < A; i++) cin >> s.at(i);
  for (int i = 0; i < B; i++) cin >> t.at(i);
  
  s.push_back(-INF);
  s.push_back(INF);
  t.push_back(-INF);
  t.push_back(INF);
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  
  for (int i = 0; i < Q; i++)
  {
    long long x;
    cin >> x;

    auto itS = lower_bound(s.begin(), s.end(), x);
    int indS = itS - s.begin();
    auto itT = lower_bound(t.begin(), t.end(), x);
    int indT = itT - t.begin();

    long long ans = INF;
    for (int j = -1; j <= 1; j++)
    {
      for (int k = -1; k <= 1; k++)
      {
        long long s0 = INF, t0 = INF;
        if (0 <= indS + j && indS + j < s.size())
          s0 = s.at(indS + j);
        if (0 <= indT + k && indT + k < t.size())
          t0 = t.at(indT + k);

        if (s0 >= 0 && t0 >= 0) chmin(ans, dist(x, s0, t0));
      }
    }
    
    cout << ans << endl;
  }
}

Measured memory_bytes: 2912
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long


void solve(long long N, std::vector<long long> A){
    vector<int> B = A;
    sort(ALL(A));
    for(int i = 0; i < N; ++i) {
        if (B[i] == A[N - 1]) {
            cout << A[N - 2] << endl;
        } else {
            cout << A[N - 1] << endl;
        }
    }
}

signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4736
n=int(input())
a = list(map(int,input().split()))
ans=1
for i in range(n):
    ans*=a[i]
    if ans > 1000000000000000000:
        for q in range(n-i):
            if a[i+q] == 0:
                print(0)
                exit()
        print(-1)
        exit()
else:
    print(ans)


Measured memory_bytes: 84700
#include <bits/stdc++.h>
using namespace std;
using sint = int64_t;

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

template<class T> vector<T> read_vector(sint n) {
	vector<T> vs;
	for (sint i = 0; i < n; ++i) {
		vs.push_back(read<T>());
	}
	return vs;
}

inline void write() {
}

template<class T> void write(T const& t) {
	cout << t;
}

template<class T> void write(vector<T> const& ts) {
	if (ts.size() > 0) {
		cout << ts[0];
	}
	for (size_t i = 1; i < ts.size(); ++i) {
		cout << ' ' << ts[i];
	}
}

template<class T, class... Args> void write(T const& t, Args const&... args) {
	cout << t << ' ';
	write(args...);
}

template<class... Args> void writeln(Args const&... args) {
	write(args...);
	cout << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin .exceptions(ios_base::badbit | ios_base::failbit);
	cout.exceptions(ios_base::badbit | ios_base::failbit);
	cin .tie(nullptr);
	cout.tie(nullptr);
	cout.precision(16);
	void run();
	run();
	return 0;
}

void run() {
	auto const r = read<sint>();
	writeln(r * r);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=0;
  ans-=a[0];
  int x=1;
  if(n%2==0){
    rep(i,n/2){
      ans+=a[i]*2;
    }
  }else{
    rep(i,n/2+1){
      ans+=a[i]*2;
    }
    ans-=a[n/2];
  }
  cout<<ans;
}


Measured memory_bytes: 4824
#include<stdio.h>

int main(){
  
  int i, j;
  int hight[10];
  int tmp;

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

  for(i = 0; i < 10; i++){
    for(j = 0; j < 9; j++){
      if(hight[j] < hight[j + 1]){
	tmp = hight[j];
	hight[j] = hight[j + 1];
	hight[j + 1] = tmp;
      }
    }
  }

  for(i = 0; i < 3; i++){
    printf("%d\n", hight[i]);
  }

  return 0;
}

Measured memory_bytes: 0
def inpl(): return [int(i) for i in input().split()]

S = input()
T = input()
typeS = [0 for _ in range(1+len(S))]
typeT = [0 for _ in range(1+len(T))]
typeS[0] = typeT[0] = 0 
for i in range(len(S)):
    ctr = 2
    if S[i] == 'A':
        ctr = 1
    typeS[i+1] = (typeS[i] + ctr)%3
for i in range(len(T)):
    ctr = 2
    if T[i] == 'A':
        ctr = 1
    typeT[i+1] = (typeT[i] + ctr)%3
Q = int(input())
for _ in range(Q):
    a, b, c, d = inpl()
    if (typeS[b] - typeS[a-1])%3 == (typeT[d] -typeT[c-1])%3:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 5232
#include<iostream>
#include<string>
#define INF 1000
using namespace std;

int char_count[50][26];

int main() {
    int N;
    string S;
    cin >> N;
    for (int i = 0; i < N; i++) for (int j = 0; j < 26; j++) char_count[i][j] = 0;
    for (int i = 0; i < N; i++) {
        cin >> S;
        for (int j = 0; j < S.length(); j++) {
            char_count[i][S[j] - 'a']++;
        }
    }
    string ans;
    for (int i = 0; i < 26; i++) {
        int min_count = INF;
        char moji;
        if (i == 0) moji = 'a';
        else if (i == 1) moji = 'b';
        else if (i == 2) moji = 'c';
        else if (i == 3) moji = 'd';
        else if (i == 4) moji = 'e';
        else if (i == 5) moji = 'f';
        else if (i == 6) moji = 'g';
        else if (i == 7) moji = 'h';
        else if (i == 8) moji = 'i';
        else if (i == 9) moji = 'j';
        else if (i == 10) moji = 'k';
        else if (i == 11) moji = 'l';
        else if (i == 12) moji = 'm';
        else if (i == 13) moji = 'n';
        else if (i == 14) moji = 'o';
        else if (i == 15) moji = 'p';
        else if (i == 16) moji = 'q';
        else if (i == 17) moji = 'r';
        else if (i == 18) moji = 's';
        else if (i == 19) moji = 't';
        else if (i == 20) moji = 'u';
        else if (i == 21) moji = 'v';
        else if (i == 22) moji = 'w';
        else if (i == 23) moji = 'x';
        else if (i == 24) moji = 'y';
        else moji = 'z';
        for (int j = 0; j < N; j++) {
            if (min_count > char_count[j][i]) min_count = char_count[j][i];
        }
        for (int j = 0; j < min_count; j++) {
            ans.push_back(moji);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
	ll a,b,h;

cin>>a>>b>>h;

set<ll>s={a,b,h};
cout<<s.size(); 
}

		
	
	
	
	


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#define rep(i,x,n) for(int i=x;i<n;i++)
#define repd(i,x,n) for(int i=x;i<=n;i++)
#define pii pair<int,int>
#define pll pair<long long ,long long>
#define gbtb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MSC0(X) memset((X), '\0', sizeof((X)))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define gg(x) getInt(&x)
using namespace std;
typedef long long ll;
inline void getInt(int* p);
const int maxn=1000010;
const int inf=0x3f3f3f3f;
/*** TEMPLATE CODE * * STARTS HERE ***/

int dx[]={1,-1,0,0},dy[]={0,0,1,-1};
int n,m;
ll ans;
char s[1005][1005];
int tree[maxn],cnt[maxn],c[maxn];
int has(int x,int y){
    return x*400+y;
}

int findpar(int x){
    return x==tree[x]?x:tree[x]=findpar(tree[x]);
}

void Mergge(int x,int y){
    x=findpar(x),y=findpar(y);
    if(x!=y){
        tree[x]=y;
        cnt[y]+=cnt[x];
        c[y]+=c[x];
    }
}

int main()
{
    gg(n);
    gg(m);
    repd(i,0,maxn-1)
    {
        tree[i]=i,cnt[i]=1;
    }
    for(int i=1;i<=n;i++)
        scanf("%s",s[i]+1);

    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(s[i][j]=='#')
                c[has(i,j)]=1;

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            for(int k=0;k<4;k++){
                int x=i+dx[k];
                int y=j+dy[k];
                if(x>0&&x<=n&&y>0&&y<=m && s[i][j]!=s[x][y]){
                    Mergge(has(x,y),has(i,j));
                }
            }
        }
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            int h=findpar(has(i,j));
            if(cnt[h]>1){
                ans += 1ll*c[h]*(cnt[h]-c[h]);
                cnt[h] = -1;
            }
        }
    }
    printf("%lld\n",ans );

    return 0;
}
inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}


Measured memory_bytes: 11136
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl
#define CE cout<<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    a=0;b=0;
    cin>>n;
    for(int i=1;i<=n;i++){
        if(i%2)a++;
        else b++;
    }
    C a*b E;
}



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

#define         pb         push_back
#define         sf(x)      scanf("%d",&x)
#define         sfl(x)     scanf("%lld",&x)
#define         pf(x)      printf("%d\n",x)
#define         pfl(x)     printf("%lld\n",x)
#define         endl       '\n'
#define         pii        pair<int,int>
#define         mapii      map<int,int>
#define         mapll      map<ll,ll>
#define         mapci      map<char,int>
#define         mapcl      map<char,ll>
#define         mapsi      map<string,int>
#define         mapsl      map<string,ll>
#define         pll        pair<ll,ll>
#define         vi         vector<int>
#define         vl         vector<ll>
#define         vd         vector<double,double>
#define         all(c)     c.begin(),c.end()
#define         F          first
#define         S          second
#define         mp         make_pair
#define        ftc(x)      cerr << #x << ": " << x << " " << endl;
#define         PI         acos(-1)
#define         lcm(a,b)   ((a*b)/__gcd(a,b))
//   cout<<std::setprecision(12)<<

int main()
{
    int i,j,k,l,m,n,u,v;
    cin >> n >> m;
    vi ke[m+10];

    for(i=0; i<n; i++)
    {
        cin >> u >> v;
        if(u<=m)
        {
            ke[m-u].pb(v);
        }
    }

    priority_queue<int>q;

    int ans = 0;

    for(i=m-1; i>=0; i--)
    {
        if(ke[i].size())
            for(auto x : ke[i])
                q.push(x);

        if(!q.empty())
        {
            ans += q.top();
            q.pop();
        }
    }

    cout<<ans<<endl;

}


Measured memory_bytes: 5504
a=[]
for i in range(3):
	b=list(map(int,input().split()))
	a.append(b)
k=0	
for i in range(101):
	b1=a[0][0]-i
	for j in range(101):
		b2=a[1][1]-j
		for k in range(101):
			b3=a[2][2]-k
			if(3*i+b1+b2+b3==sum(a[0]) and 3*j+b1+b2+b3==sum(a[1]) and 3*k+b1+b2+b3==sum(a[2])):
				k=1
				break
		if(k==1):
			break
	if(k==1):
		break
if(k==1):
	print("Yes")
else:
	print("No")							


Measured memory_bytes: 3064
#include<iostream>

using namespace std;

int partition(int *a, int p, int r) {
	int x = a[r - 1];
	int cnt = p-1;
	for (int i = p;i < r;i++) {
		if (a[i] <= x) {
			cnt++;
			swap(a[cnt], a[i]);				
		}
	}
	return cnt;
}

int main() {
	int n;
	cin >> n;
	int* a = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> a[i];
	}
	int index = partition(a, 0, n);
	for (int i = 0;i < n;i++) {
		if (i == index) {
			cout << "[" << a[i] << "]";
		}
		else {
			cout << a[i];
		}
		if (i != n - 1)cout << " ";

	}
	cout << endl;
}


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

using namespace std;

int main(){
    int n;
    int m;
    cin >> n >> m;
    vector<int> a(m);
    for(int i = 0; i < m; i++){
        cin >> a[i];
    }
    int sum = 0;
    for(int i = 0; i < m; i++){
        sum += a[i];
    }
    if(n >= sum){
        cout << n - sum << endl;
    }
    else{
        cout << "-1" << endl;
    }
}

Measured memory_bytes: 3644
N = int(input())
A = list(map(int, input().split()))

reversed_cumsum = []
tmp = 0
for i in range(N):
    tmp += A[N - 1 - i]
    reversed_cumsum.append(tmp)
cumsum = reversed_cumsum[::-1]

ans = 0
for i in range(N - 1):
    ans = (ans + A[i] * cumsum[i + 1]) % (10 ** 9 + 7)
print(ans)


Measured memory_bytes: 31436
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

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

	vector<int> idx[10];
	for(int i=0; i<N; i++){
		idx[S[i]-'0'].push_back(i);
	}

	int ans = 0;
	for(int i=0; i<1000; i++){
		int a = i/100;
		int b = (i/10)%10;
		int c = i%10;
		if(idx[a].size()==0) continue;
		int ia = idx[a][0];
		auto ib = lower_bound(idx[b].begin(), idx[b].end(), ia+1);
		if(ib == idx[b].end()) continue;
		auto ic = lower_bound(idx[c].begin(), idx[c].end(), *ib+1);
		if(ic == idx[c].end()) continue;
		ans++;
	}

	cout << ans << endl;

	return 0;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  bool flag = false;
  if(a == b && a != c){
    flag = true;
  }
  else if(b == c && a != b){
    flag = true;
  }
  else if(c == a && a != b){
    flag = true;
  }
  if(flag) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;

int main() {
  ll x; cin >>x;
  ll out = x/11LL;
  ll res = x%11LL;
  out *= 2LL;
  if (res<=6LL && res>0LL){
    out += 1LL;
  } else if(res>6LL) {
    out += 2LL;
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 256