akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;



Int n, q, x;


int main(){
    cin >> n >> q;
    vector<Int> qs = {n};
    for(int i = 0;i < q;i++){
        cin >> x;
        while(!qs.empty() && qs.back() > x)qs.pop_back();
        qs.push_back(x);
    }

    reverse(qs.begin(), qs.end());
    map<Int, Int> cnts;
    for(auto q: qs){
        if(cnts.empty()){
            cnts[q]++;
            continue;
        }
        while(cnts.rbegin()->first > q){
            auto p = *cnts.rbegin();
            Int last = p.first, cnt = p.second;
            cnts.erase(prev(cnts.end()));
            cnts[last % q] += cnt ;
            cnts[q] += cnt* (last / q);
        }
    }

    for(int i = n;i >= 1;i--){
        cnts[i] += cnts[i+1];

    }
    for(int i = 1;i <= n;i++){
        cout << cnts[i] << endl;
    }
    
    return 0;
}

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

int main() {
  int A, B, C, X;
  cin >> A >> B >> C >> X;
  int answer = 0;
  for (int i=0; i <= A; i++) {
    for (int j=0; j <= B; j++) {
      for (int k=0; k <= C; k++) {
        if (500*i + 100*j + 50*k == X) {
          answer += 1;
        }
      }
    }
  }
  cout << answer << endl;
}

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

#define start long long t;cin>>t;while(t--)
#define in(x) cin >> x
#define in2(x, y) cin >> x >> y
#define in3(x, y, z) cin >> x >> y >> z
#define in4(x, y, z, o) cin >> x >> y >> z >> o
#define biggestFactor (n)      for (ll j = 2; j <= sqrt(n); j++){if (n % j == 0){cout << n / j << "\n";break;}}
                               //First find smallest factor and then divide that factor and the answer itself is biggest factor
                          
using namespace std;


int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, x, k;
    cin >> n >> x >> k;
    ll an =(n * k) / x;
    ll ans = ceil((float)an / k);
    cout << ans * k;
    	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

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

    int num = stoi(a + b);
    int x = sqrt(num);
    if (x * x == num)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAX = 1001;
int H, W, K;
int J[MAX][MAX], O[MAX][MAX], I[MAX][MAX];
char field[MAX][MAX];

int main(void) {
  while(cin >> H >> W >> K) {
    memset(J, 0, sizeof(J));
    memset(O, 0, sizeof(O));
    memset(I, 0, sizeof(I));
    
    for(int i = 1; i <= H; i++){
      cin >> &field[i][1];
      for(int j = 1 ; j <= W ; j++){
        J[i][j] = J[i - 1][j] + J[i][j - 1] - J[i - 1][j - 1];
        O[i][j] = O[i - 1][j] + O[i][j - 1] - O[i - 1][j - 1];
        I[i][j] = I[i - 1][j] + I[i][j - 1] - I[i - 1][j - 1];
	
        if(field[i][j] == 'J')      J[i][j]++;
        else if(field[i][j] == 'O') O[i][j]++;
        else if(field[i][j] == 'I') I[i][j]++;
      }
    }
    
    for(int i = 0 ; i < K ; i++) {
      int px, py, qx, qy;
      cin >> px >> py >> qx >> qy;
      int ansJ, ansO, ansI;
      ansJ = J[qx][qy] - J[px-1][qy] - J[qx][py-1] + J[px-1][py-1];
      ansO = O[qx][qy] - O[px-1][qy] - O[qx][py-1] + O[px-1][py-1];
      ansI = I[qx][qy] - I[px-1][qy] - I[qx][py-1] + I[px-1][py-1];
      printf("%d %d %d\n", ansJ, ansO, ansI);
    }
  }
}

Measured memory_bytes: 13000
#include<iostream>
using namespace std;
#define int long long int
int32_t main()
{
	int n;
	cin>>n;
	int answer=0;
	int j;
	for(j=1;j<=n;j++)
	{
		if(j%3!=0&&j%5!=0)
		{
			answer+=j;
		}
	}
	cout<<answer<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

using namespace std;

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

    cout << count(s.begin(), s.end(), '+') - count(s.begin(), s.end(), '-') << endl;

    return 0;
}


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

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

int n, m;
vector<int> d;
vector<vector<int>> g;

void solve() {
	cin >> n >> m;
	d.resize(n);
	vector<P> p(n);
	rep(i, n) {
		cin >> d[i];
		p[i] = {d[i], i};
	}
	sort(all(p));
	g.assign(n, vector<int>());
	map<P, int> mp;
	rep(i, m) {
		int u, v; cin >> u >> v;
		-- u, -- v;
		g[u].pb(v);
		g[v].pb(u);
		mp[{u, v}] = i;
		mp[{v, u}] = i;
	}
	vector<int> c(m, 1e9);
	vector<int> s(n, -1);
	rep(i, n) {
		bool ok = 0;
		int v = p[i].sc;
		cerr << v << endl;
		if(s[v] != -1) continue;
		for(int nv: g[v]) {
			if(d[v] == d[nv]) {
				if(s[nv] == -1) {
					s[nv] = 1, s[v] = 0;
					c[mp[{v, nv}]] = d[v];
				} else {
					s[v] = 1 - s[nv];
					c[mp[{v, nv}]] = d[v];
				}
				ok = 1;
				break;
			} else if(d[v] > d[nv]) {
				s[v] = s[nv];
				c[mp[{v, nv}]] = d[v] - d[nv];
				ok = 1;
				break;
			}
		}
		if(!ok) {
			cout << -1 << endl;
			return;
		}
	}
	// output
	rep(i, n) {
		cout << (s[i] == 0 ? 'B' : 'W');
	}
	cout << endl;
	rep(i, m) {
		cout << c[i] << endl;
	}
}

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

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

#define MAX 200005
const ll mod = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void Com_init(){ //##O(MAX)##
    fac[0] = fac[1] = 1; // x!
    finv[0] = finv[1] = 1; // (x!)^-1
    inv[1] = 1; //x^-1
    for(int i=2;i<MAX;i++){
        fac[i] = (fac[i-1] * i) % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}
int Combination(int n, int k){ //calc nCk, ##O(1)##
    if(n<k || (n<0||k<0))return 0;
    ll ans = 1;
    for(ll i=1; i<=k; i++){
        ans *= i+n-k;
        ans %= mod;
        ans *= inv[i];
        ans %= mod;
    }
    return ans%mod;
}
ull modpow(ull p, ull q, ull m=mod){
    ull ans = 1;
    p = p % m;
    for(ull i = 1ULL<<(sizeof(ull)*8-1); i>0; i>>=1){
        if(q&i) ans *= (ans*p)%m;
        else ans *= ans;
        ans %= m;
    }
    return ans;
}

int main(){
    ll n,a,b;
    cin >>n>>a>>b;
    Com_init();
    ll sum=modpow(2, n, mod);
    sum -= Combination(n,a);
    sum -= Combination(n,b);
    sum-=1;
    cout<<(sum+3*mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 4992
#include<cstdio>
using namespace std;
int main(void){
    int d;
    scanf("%d",&d);
    if(d==25){
        printf("Christmas");
    }
    if(d==24){
        printf("Christmas Eve");
    }
    if(d==23){
        printf("Christmas Eve Eve");
    }
    if(d==22){
        printf("Christmas Eve Eve Eve");
    }
    return 0;
}


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

int n;

struct Node
{
  int key;
  Node *parent, *left, *right;
};

// rootの初期化はしなくていいの?
Node *root, *NIL;

void insert(int key)
{
  // zの親を格納する
  Node *y = NIL;
  Node *x = root;

  // zの生成
  Node *z = (Node *)malloc(sizeof(Node));
  z->key = key;
  z->left = NIL;
  z->right = NIL;

  while (x != NIL)
  {
    y = x;
    if (key < x->key)
    {
      x = x->left;
    }
    else
    {
      x = x->right;
    }
  }

  // yにはzの親が格納されている
  z->parent = y;

  if (y == NIL)
  {
    root = z;
  }
  else if (key < y->key)
  {
    y->left = z;
  }
  else
  {
    y->right = z;
  }
}

void inorder(Node *u)
{
  // ベースケース
  if (u == NIL)
  {
    return;
  }
  // 再帰ステップ
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u)
{
  // ベースケース
  if (u == NIL)
  {
    return;
  }
  // 再帰ステップ
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main()
{
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    string com;
    cin >> com;
    if (com.at(0) == 'i')
    {
      // 入力
      int key;
      cin >> key;
      insert(key);
    }
    else
    {
      // 出力
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
}


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

int main(){
  int n;
  cin>>n;
  int ing,ans[n];
  string str;
  memset(ans,0,sizeof(ans));
  for(int i=0;i<n;i++){
    int out=0;
    int hit=0;
    while(1){
      if(out==3)break;
      cin>>str;
      if(str=="HIT"){
	hit++;
	if(hit==4)ans[i]+=1;
	if(hit>3)hit=3;
      }
      else if(str=="OUT"){
	out++;
      }
      else if(str=="HOMERUN"){
	ans[i]+=1+hit;
	hit=0;
      }
    }
  }
  for(int i=0;i<n;i++){
    cout<<ans[i]<<endl;
  }
}

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


int main(){


    string n;
   

    cin >> n;


    if( n.at(0) == '9' || n.at(1) == '9' ){

        cout << "Yes" << endl;

        }


    else cout << "No" << endl;


    return 0;

    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Network{
	private:
	int V;
	struct edge{
		int to,cap,rev;
	};
	vector<vector<edge> > g;
	int DFS(int v,int t,int f,vi& iter,vi level){
		if(v==t) return f;
		for(int &i=iter[v];i<g[v].size();i++){
			edge &e=g[v][i];
			if(e.cap>0&&level[v]<level[e.to]){
				int d=DFS(e.to,t,min(f,e.cap),iter,level);
				if(d>0){
					e.cap-=d;
					g[e.to][e.rev].cap+=d;
					return d;
				}
			}
		}
		return 0;
	}
	void BFS(int s,vi& level){
		level=vi(V,-1);
		queue<int> que;
		level[s]=0;
		que.push(s);
		while(!que.empty()){
			int v=que.front();
			que.pop();
			for(int i=0;i<g[v].size();i++){
				edge &e=g[v][i];
				if(e.cap>0&&level[e.to]<0){
					level[e.to]=level[v]+1;
					que.push(e.to);
				}
			}
		}
	}
	public:
	Network(int v){
		V=v;
		g=vector<vector<edge> >(v);
	}
	void add_edge(int s,int t,int c){
		g[s].push_back(edge{t,c,(int)g[t].size()});
		g[t].push_back(edge{s,0,(int)g[s].size()-1});
	}
	int Dinic(int s,int t){
		int res=0;
		while(1){
			vi iter(V),level;
			BFS(s,level);
			if(level[t]<0) return res;
			int f;
			while((f=DFS(s,t,inf,iter,level))>0) res+=f;
		}
	}
};

int n,m;
string s;
vi a;

int main(){
	cin>>n>>m>>s;
	Network nt(n+2);
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		nt.add_edge(n,i,(s[i]=='L'?0:x));
		nt.add_edge(i,n+1,(s[i]=='L'?x:0));
	}
	for(int i=0;i<m;i++){
		int u,v,c;
		cin>>u>>v>>c;
		u--;v--;
		if(u>v) swap(u,v);
		nt.add_edge(u,v,c);
	}
	cout<<nt.Dinic(n,n+1)<<endl;
}


Measured memory_bytes: 3236
#include <stdio.h>
#include <string>
#include <math.h>
#include <iostream>
using namespace std;
#define N 1000
void push(int x);	//
int pop(void);		//
int isEmpty(void);	//
int isFull(void);
void initialize(void);
static int S[N], top = 0;
int main(void)
{
	char op[13];
	int x,a, b, cou = 0;
	while(scanf("%s",op) != EOF){
		switch (op[0]) {
			case '+': a = pop(); b = pop(); push(b + a); break;
			case '-': a = pop(); b = pop(); push(b - a); break;
			case '*': a = pop(); b = pop(); push(b * a); break;
			case '/': a = pop(); b = pop(); push(b / a); break;
			default: sscanf(op, "%d", &x); push(x);
		}
	}
	printf("%d\n", pop());
}
void push(int x)
{
	if (!(isFull())) {
		top++;
		S[top] = x;
	}
}
int pop(void)
{
	if (!(isEmpty())) {
		top--;
		return (S[top + 1]);
	}
}
int isEmpty(void) 
{
	if (top == 0) return 1;
	else return 0;
}
int isFull(void)
{
	if (top >= N - 1) return 1;
	else return 0;
}
void initialize(void)
{
	top = 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair < int, int >
#define pll pair < ll, ll >
using namespace std;

int main()
{
    int s, w;

    cin >> s >> w;

    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;

    return 0;
}


Measured memory_bytes: 3656
#include <algorithm>
#include <boost/optional.hpp>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <numeric>
#include <queue>
#include <sstream>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>

#define REP(i, n) for(int i = 0, i##_MACRO = (n); i < i##_MACRO; i++)
#define RANGE(i, a, b) for(int i = (a), i##_MACRO = (b); i < i##_MACRO; i++)
#define EACH(e, a) for(auto&& e : a)
#define ALL(a) (a).begin(), (a).end()
#define AALL(a, n) (a), ((a) + (n))
#define FILL(a, n) memset((a), n, sizeof(a))
#define FILLZ(a) FILL(a, 0)
#define MODNUM (static_cast<int>(1e9 + 7))
#define MOD(x) ((x) % MODNUM)

using namespace std;

using ll = long long;
using VI = vector<int>;
using VI2D = vector<vector<int>>;

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

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};

template <typename T>
int sign(T x) {
	return x < 0 ? -1 : x > 0 ? 1 : 0;
}

template <>
int sign(double x) {
	return x < -EPS ? -1 : x > EPS ? 1 : 0;
}

template <typename T>
T square(T x) {
	return x * x;
}

inline int toInt(string s) {
	int v;
	istringstream sin(s);
	sin >> v;
	return v;
}

int main() {
	int k, x;
	scanf("%d %d", &k, &x);
	printf("%s\n", k * 500 >= x ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
flag=True
ans=0
B=[0 for i in range(N+1)]
for i in range(N+1):
  if(i==0):
    if(A[i]==0):
      B[i]=1
    if((A[i]==1 and N>0) or (N==0 and A[i]>1)):
      flag=False
  else:
    B[i]=B[i-1]*2-A[i]
  if(B[i]<0):
    flag=False
    break
x=B[N]#層の葉でない頂点数
y=A[N]#層の頂点数
ans=A[N]
for i in range(N):
  if(x>B[N-1-i]*2):
    flag=False
    break
  else:
    x=min(y,B[N-1-i])
    y=x+A[N-1-i]
    ans+=y
if flag:
  print(ans)
else:
  print(-1)

Measured memory_bytes: 668724
n,m = map(int,input().split())
if m != 0:
    l = [list(input().split()) for i in range(m)]
    p,s = [list(i) for i in zip(*l)]
t = [0] * n
ac = 0
wa = 0
for i in range(m):
    if s[i] == 'WA' and t[int(p[i])-1] != 'AC':
        t[int(p[i])-1] += 1
    elif s[i] == 'AC' and t[int(p[i])-1] != 'AC':
        ac += 1
        wa += t[int(p[i])-1]
        t[int(p[i])-1] = 'AC'
    else:
        pass
print(ac,wa)

Measured memory_bytes: 38904
#include<stdio.h>
int main()
{
    int a,b,c,d,res1,res2,counta,countc;

    scanf("%d %d %d %d",&a,&b,&c,&d);

    counta=0;
    countc=0;
    while(1)
    {
        res1=a-d;
        a=res1;
        counta++;
        if(res1<=0)
        {
        break;
        }
    }

    while(1)
    {
        res2=c-b;
        c=res2;
        countc++;
        if(res2<=0)
        {
        break;
        }
    }
    if(counta<countc)
    {
    printf("No\n");
    }
    else
    {
    printf("Yes\n");
    }

    return 0;
}


Measured memory_bytes: 1640
#include<stdio.h>

int main()
{
	int a, b, c,d;
	scanf("%d %d %d",&a,&b,&c);
	if (a >= b) {
		d = a;
		a = b;
		b = d;
	}
	if (b >= c) {
		d = b;
		b = c;
		c = d;
	}
	printf("%d", a + b);
    return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;

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

    map<long long, long long> T;
    long long a;
    long long A[n];
    for(long long i = 0; i < n; i++){
        cin >> a;
        A[i] = a;
        if(T.find(a) == T.end()){
            T[a] = 1;
        }
        else{
            T[a] += 1;
        }
    }

    map<long long, long long>::iterator it;

    long long sum = 0;
    for(it = T.begin(); it != T.end(); it++){
        if(it->second >= 2){
            sum += it->second*(it->second-1)/2;
        }
    }
    
    for(long long i = 0; i < n; i++){
        long long ans;
        ans = sum - T[A[i]]*(T[A[i]]-1)/2;
        T[A[i]] -= 1;
        if(T[A[i]] >= 2){
            ans = ans + T[A[i]]*(T[A[i]]-1)/2;
        }
        
        printf("%lld\n", ans);
        T[A[i]] += 1;
        
    }

    return 0;

}

Measured memory_bytes: 11008
#include <cstdio>
 
typedef long long LL;
const int MN = 100005;
 
int N, s, x[MN]; LL p[MN];
 
LL calc(int l, int r, int t) {
	if (s < x[l]) return x[r] - s;
	if (x[r] < s) return s - x[l];
	if (p[l] >= p[r]) return p[l] += p[r], calc(l, r - 1, l) + (t == r ? x[r] - x[l] : 0);
	else return p[r] += p[l], calc(l + 1, r, r) + (t == l ? x[r] - x[l] : 0);
}
 
int main() {
	scanf("%d%d", &N, &s);
	for (int i = 1; i <= N; ++i) scanf("%d%lld", &x[i], &p[i]);
	printf("%lld\n", calc(1, N, p[1] < p[N] ? 1 : N));
	return 0;
}

Measured memory_bytes: 7960
x, y, z, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
AB = [a + b for a in A for b in B]
AB.sort(reverse=True)
AB = AB[:k]
 
ABC = [ab + c for ab in AB for c in C]
ABC.sort(reverse=True)
ABC = ABC[:k]
 
print('\n'.join(map(str, ABC)))

Measured memory_bytes: 137868
#include<stdio.h>
int main(void){
	int a[100][100],b[100][100];
	long long int c=0;
	int i,t,r,n,m,j;
	scanf("%d %d %d",&n,&m,&j);
	for(i=0;i<n;i++){
		for(t=0;t<m;t++){
			scanf("%d",&a[t][i]);
			
		}
		
	}
	for(t=0;t<m;t++){
		for(r=0;r<j;r++){
			scanf("%d",&b[r][t]);
		}
		
	}
	for(i=0;i<n;i++){
		for(t=0;t<j;t++){
			for(r=0;r<m;r++){
				c+=a[r][i]*b[t][r];
			}
			if(t!=j-1){
				printf("%lld ",c);
				c=0;
			}else{
				printf("%lld",c);
				c=0;
		}
	}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 2836
#include <bits/stdc++.h>
using namespace std;
int main() {
    string a,b;
    cin>>a>>b;
    a=a+b;

    bool answer=false;

    int ab=atoi(a.c_str());

    for(int i=1;i<ab;i++){
        if(i*i==ab){
            answer=true;
            break;
        }
    }

    if(answer){
        cout<<"Yes"<<endl;
    }
    else {
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n;
    vector<int> t(n);
    int sum = 0;
    for(int i = 0;i < n;i++){
        cin >> t[i];
        sum += t[i];
    }    
    cin >> m;
    vector<vector<int>> px(m,vector<int>(2));
    vector<int> answer(m,0);
    for(int i = 0;i < m;i++)cin >> px[i][0] >> px[i][1];
    for(int i = 0;i < m;i++){
        answer[i] = sum - t[px[i][0]-1] + px[i][1];
        cout << answer[i] << endl;
    }
}

Measured memory_bytes: 256
using System;

class Myon{
	static void Main(){
    	Myon myon = new Myon();
    }
  
  	public Myon(){
    	int N = int.Parse(Console.ReadLine());
      
      	string[] input = Console.ReadLine().Split(' ');
      
      	int[] nums = new int[N];
      	for(int i = 0;i < N;i ++){
        	nums[i] = int.Parse(input[i]);
        }
      	int count = 0;
      	for(int i = 0;i < N;i ++){
        	int num = nums[i];	
          int max = 1;
          int amari = num % (int)Math.Pow(2,max);
          	while(amari == 0){
            	max ++;
              amari = num % (int)Math.Pow(2,max);
              	count ++;
              	
            }
        }
      	Console.WriteLine(count);
    }
}

Measured memory_bytes: 13792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
#define PI 3.14159265358979323846264338327950L
typedef unsigned long long uint64;
using namespace std;
using ll = long long;
string f(ll n){
    if(n==0) return "";
    n--;
    return f(n/26)+string(1,'a'+n%26);
}

int main(){
    ll n;
    cin >> n;
    cout << f(n) << endl;
    return 0;
    
}

Measured memory_bytes: 3620
N = int(input())
B = [input() for _ in range(N)]
M = int(input())
R = [input() for _ in range(M)]

Words = list(set(B)) + list(set(R))

ans = 0
for w in Words:
	ans = max(ans, B.count(w) - R.count(w))

print(ans)


Measured memory_bytes: 3060
while True :
    n = int(input())
    
    if(n == 0) :
        break
    
    else :
        S = [len(input()) for i in range(n)]
        T = [5, 7, 5, 7, 7]
        ans = 0
        
        for i in range(n) :
            s = 0
            w = 0
            for j in range(i, n) :
                s += S[j]
                if(s == T[w]) :
                    s = 0
                    w += 1
                    if(w == 5) :
                        ans = i + 1
                        break
                    else :
                        pass
                elif(s > T[w]) :
                    break
                else :
                    pass
            if(ans != 0) :
                break
            else :
                pass
        print(ans)
        


Measured memory_bytes: 5616
#include <iostream>

using namespace std;

int main(int argc, char** argv){
  int a, b;
  cin >> a >> b;
  if(a>b){
    cout << "a > b" << endl;
  }else if(a==b){
    cout << "a == b" << endl;
  }else{
    cout << "a < b" << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=1e5+5;
const int MAXB=65;
typedef long long ll;
int n;
ll a[MAXN],p[MAXN],sum;
bool vis[MAXB];
void ins(ll x){
	for (ll i=60;i>=0;i--){
		if (!vis[i]) continue;
		if (x&(1ll<<i)){
			if (!p[i]) p[i]=x;
			x^=p[i];
		}
	}
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		sum^=a[i];
	}
	for (int i=0;i<=60;i++){
		if (!(sum&(1ll<<i))) vis[i]=1;
	}
	for (int i=1;i<=n;i++) ins(a[i]);
	ll res=0;
	for (int i=60;i>=0;i--){
		if (vis[i]&&(!(res&(1ll<<i)))) res^=p[i];
	}
	printf("%lld\n",res+(sum^res));
	return 0;
}


Measured memory_bytes: 1024
use std::io::Read;
use std::cmp::max;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = Vec::new();
    let mut b: Vec<usize> = Vec::new();
    let mut c: Vec<usize> = Vec::new();
    for _ in 0..n {
        a.push(iterator.next().unwrap().parse().unwrap());
        b.push(iterator.next().unwrap().parse().unwrap());
        c.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut dp: Vec<Vec<usize>> = vec![vec![0; 3]; n + 1];
    for i in 0..n {
        dp[i + 1][0] = max(dp[i][1] + a[i], dp[i][2] + a[i]);
        dp[i + 1][1] = max(dp[i][0] + b[i], dp[i][2] + b[i]);
        dp[i + 1][2] = max(dp[i][0] + c[i], dp[i][1] + c[i]);
    }
    let ans = max(dp[n][0], max(dp[n][1], dp[n][2]));
    return ans.to_string();
}


Measured memory_bytes: 17576
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
const int mod=1e9+7;

int main() {
  int64_t a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max({a*c,a*d,b*c,b*d})<<endl;
}

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

int main() {

    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<int>> M(H, vector<int>(W, 0));
    char s;
    rep(i, H) rep(j, W) {
        cin >> s;
        if (s == '#') M[i][j] = 1;
    }

    int ans = 0;
    rep(h, pow(2, H)) {
        rep(w, pow(2, W)) {
            vector<vector<int>> m = M;
            rep(i, H) {
                if ((h>>i)%2 == 1) {
                    rep(j, W) m[i][j] = 0;
                }
            }
            rep(j, W) {
                if ((w>>j)%2 == 1) {
                    rep(i, H) m[i][j] = 0;
                }
            }
            int cnt = 0;
            rep(i, H) rep(j, W) if(m[i][j] == 1) cnt++;
            if (cnt == K) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4104
using CompLib.Util;
using System;
using System.Linq;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        int r = sc.NextInt();
        if (n >= 10)
        {
            Console.WriteLine(r);
        }
        else
        {
            Console.WriteLine(r + 100 * (10 - n));
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In,' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var Number = new int[N];

            for(var i=0;i<N;i++){
                Number[i] = cin.ReadInt;
            }

            var ans = 0;
            for(var i=1;i<N-1;i++){
                if(Number[i-1] < Number[i] && Number[i] < Number[i+1]) ans++;
                if(Number[i-1] > Number[i] && Number[i] > Number[i+1]) ans++;
            }

            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream,char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if(inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for(int i = 0;i < tmp.Length;i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

}

Measured memory_bytes: 13268
ans (x:y:b:p:_) = 
  let a = x*b + y*p
      a'= ( x * (max b 5) + y * (max p 2) ) * 8 `div` 10
      c = if b >= 5 && p >= 2
          then a * 8 `div` 10
          else min a a'
  in
    c

main = do
  _ <- getLine
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = map ans i
  mapM_ print o

Measured memory_bytes: 4256
#include<stdio.h>
#define MAX 100000
int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}

int main(){
	int H, i, A[MAX+1];
	scanf("%d",&H);
	for(i = 1;i <= H;i++){
		scanf("%d",&A[i]);
	}
	for(i = 1;i <= H;i++){
		printf("node %d: key = %d, ",i,A[i]);
		if(parent(i)>=1){
			printf("parent key = %d, ",A[parent(i)]);
		}
		if(left(i)<=H){
			printf("left key = %d, ",A[left(i)]);
		}
		if(right(i) <= H){
			printf("right key = %d, ",A[right(i)]);
			
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2084
#include <stdio.h>
#define N 100
 
int main(){
  int n, num[N], i, j, tmp, count = 0;
   
  scanf("%d",&n);
   
  for(i = 0;i < n;i++) scanf("%d",&num[i]);
   
  j = 1;
  while(j){
    j = 0;
    for(i = n - 1;i > 0;i--){
      if(num[i] < num[i-1]){
      tmp = num[i];
      num[i] = num[i-1];
      num[i-1] = tmp;
      j = 1;
      count++;
      }
    }
  }
   
  for(i = 0;i < n - 1;i++) printf("%d ",num[i]);
  printf("%d\n%d\n",num[i],count);
   
  return 0;
}

Measured memory_bytes: 600
n = input()
line = input()
n = int(n)
a_list = line.split(" ")
a_list = [int(a) for a in a_list]

ans_list = [0 for i in range(n)]

for a in a_list:
    ans_list[a-1] = ans_list[a-1] + 1

for ans in ans_list:
    print(ans)

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

using namespace std;

const int INF = 1e9;

int n, w[105];

int main() {
	scanf("%d", &n);
	
	for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
	
	int sum = 0;
	
	for (int i = 1; i <= n; i++) sum += w[i];
	
	int res = INF;
	int cur = 0;
	
	for (int i = 1; i < n; i++) {
		cur += w[i];
		res = min(res, abs(cur - (sum - cur)));
	}
	
	printf("%d\n", res);
}


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

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

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

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUG_VEC(v)            \
    cerr << #v << ": ";         \
    REP(__i, (v).size())        \
    cerr << ((v)[__i]) << ", "; \
    cerr << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(), x.end()
#define MM << " " <<
int main()
{
    int K;
    cin >> K;
    int c = 7;
    int ans = -1;
    for (int i = 1; i <= K; i++)
    {
        if (c % K == 0)
        {
            ans = i;
            break;
        }
        else
        {
            c = c % K;
        }
        c = c * 10 + 7;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3684
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ld = long double;

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

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

ll n, k, a[250000], in, r;

int main() {
  cin >> n >> k;
  rep(i, n) {
    cin >> a[i + 1];
  }

  if (k < 250000) {
    ll cp = 1;
    rep(i, k) {
      cp = a[cp];
    }
    cout << cp << endl;
    return 0;
  }

  map<ll, ll> seen;
  ll cp = 1;
  rep(i, 250000) {
    cp = a[cp];
    if (seen[cp] != 0) {
      in = seen[cp];
      r = i + 1 - seen[cp];
      break;
    }
    seen[cp] = i + 1;
  }

  debug(r);
  debug(in);

  ll rm = (k - in) % r;

  debug(rm);

  rep(i, rm) {
    cp = a[cp];
  }
  cout << cp << endl;
}

Measured memory_bytes: 15152
/* Arpit Pandey*/ 

#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdint.h>
using namespace std;
 
#define int long long
#define pb push_back
#define in insert
#define F first
#define S second
#define mod 1000000007
#define endl '\n'
#define test(x) int x;cin>>x; while(x-->0)
#define memset(a,b) memset(a,b,sizeof(a))
#define debug(x) cout << "[ " << #x  << " : " << x << " ]" << endl;
 
void fast_io()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("error.txt", "w", stderr);
	freopen("output.txt", "w", stdout);
#endif
}

void sol()
{
	int n,x,k; cin>>n>>x>>k;
	int ans=0;
	// if(n>x)
	
		ans=(n/x)*k;
		
		if(n%x)
			{
				ans+=k;
			}
	
	// else
	// 	ans=k;

	
	cout<<ans;
	

}

int32_t main()
{
	fast_io();
	//test(t)
	sol();
	//cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	//cerr << sizeof(dp)*(1e-6) << " megabytes\n";
	return 0;
}


Measured memory_bytes: 3564
N=int(input())
s=input()

lc=0
rc=0
for brc in s:
    if brc=='(':
        lc+=1
    elif brc==')':
        if lc>0:
            lc-=1
        else:
            rc+=1
            
retVal=""
for i in range(rc):
    retVal+='('
retVal+=s
for i in range(lc):
    retVal+=')'
print(retVal)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(void)
{
  char a;
  char b;
  cin>>a>>b;
  if(a=='H' && b=='H')
    cout<<'H'<<endl;
  else if(a=='H' && b=='D')
    cout<<'D'<<endl;
  else if(a=='D' && b=='H')
    cout<<'D'<<endl;
  else
    cout<<'H'<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>

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

using namespace std;

string s;

int main() {
    cin >> s;
    int N = s.length();
    cout << s[0] << N - 2 << s[N - 1] << endl;
}


Measured memory_bytes: 256
from array import array
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = array("u", list(input()))

for i in range(k, n-1):
    if t[i] == t[i-k]:
        t[i] = "*"
        
if t[n-1] == t[n-1-k]:
    t[n-1] = "*"

ans = (t.count("r") * p +
       t.count("s") * r +
       t.count("p") * s)

print(ans)

Measured memory_bytes: 4408
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        var s = sc.next();
        var n = new int[s.Length];
        var m = new int[s.Length];
        for (int i = 0; i < s.Length; i++) n[i] = 1;

        int tmp = 0;
        int pos = 0;
        bool flag = false;
        for (int i = 0; i < s.Length; i++)
        {
            if (!flag && s[i] == 'L')
            {
                pos = i - 1;
                flag = true;
            }
            else if (flag && s[i] == 'R')
            {
                m[pos] = tmp;
                tmp = 0;
                flag = false;
            }

            if (i == s.Length - 1)
            {
                m[pos] = tmp + 1;
            }
            tmp++;
        }

        n = m;
        m = new int[s.Length];

        int l = 0;
        int r = 0;
        for (int i = 0; i < s.Length; i++)
        {
            if (n[i] != 0)
            {
                r = l + n[i] - 1;
                m[i] = 1 + (i - l) / 2 + (r - i) / 2;
                m[i + 1] = n[i] - m[i];
                l = r + 1;
            }
        }

        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        for (int i = 0; i < s.Length; i++)
        {
            Console.Write(m[i]);
            if (i != s.Length - 1) Console.Write(" ");
        }
        Console.Write("\n");
        Console.Out.Flush();
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


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

int main() {
  int n, d; cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  int ans = 0;
  rep(i,n) rep(j,d) {
    cin >> x[i][j];
  }

  rep(i,n-1) {
    for (int j = i+1; j<n; j++) {
      int sum = 0;
      rep(k,d) {
        int yz = x[i][k] - x[j][k];
        sum += yz*yz;
      }
      for (int p=1; p*p<=sum; p++) {
        if (p*p == sum) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

bool reachable(vector<int>& v){
  int n = (int)v.size();
  int sum = 0;
  for(int i = 0; i < n; i++) sum += v[i];
  if(sum & 1) return false;
  
  vector<vector<bool>> dp(n + 1, vector<bool>(sum + 1, false));
  dp[0][0] = true;
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= sum; j++){
      if(j - v[i] >= 0) dp[i + 1][j] = dp[i][j] | dp[i][j - v[i]];
      else dp[i + 1][j] = dp[i][j];
    }
  }
  
  return dp[n][(sum >> 1)];
}

int main(){
  string s;
  cin >> s;
  
  int x, y;
  cin >> x >> y;
  
  int direction = 0;
  int length = 0;
  string::iterator itr = s.begin();
  if(*itr == 'F'){
    while(itr != s.end() && *itr == 'F'){
      length++;
      itr++;
    }
    x = x - length;
    length = 0;
  }
  vector<vector<int>> move(2, vector<int>());
  move[0].push_back(abs(x));
  move[1].push_back(abs(y));
  for(; itr != s.end(); itr++){
    if(*itr == 'F') length++;
    else{
      move[direction].push_back(length);
      length = 0;
      if(direction) direction = 0;
      else direction = 1;
    }
  }
  move[direction].push_back(length);
  
  cout << (reachable(move[0]) & reachable(move[1]) ? "Yes" : "No") << endl;
  
  return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  ll N, tmp=1, cnt=0;
  cin >> N;
  ll a[N];
  rep(i, N){
    cin >> a[i];
  }
  rep(i, N){
    while(a[i] %2 ==0){
      a[i] /= 2 ;
      cnt += 1;
    }
  }
  cout << cnt << endl;
  
 }

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
//using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

// プロトタイプ宣言
// int myfunc(int, vvec);

// グローバル変数
// int N, M;
// vvec data(N, vec(M));
const int INF = 1001001001;

// 関数：
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int N, M; cin >> N >> M;
	vector<pair<int, int>> key;
	rep(i, M) {
		int a, b; cin >> a >> b;
		int s = 0;
		rep(j, b) {
			int c; cin >> c; --c;
			s |= 1<<c; //2^c:開く箱の番号をビットの位置で表示
		}
		key.emplace_back(s,a);
	}

	vec dp(1<<N, INF); //2^n
	dp[0] = 0;
	rep(s, 1<<N) {
		rep(i, M)	{
		int t = s | key.at(i).first;
		int cost = dp.at(s) + key.at(i).second;
		dp.at(t) = min(dp.at(t), cost);
		}
	}
	int ans = dp.back();
	if(ans == INF) ans = -1;
	cout << ans << endl;
	return 0;
}
// std::string str;
// str = std::to_string(int i);
// bitset<3> s(N);


Measured memory_bytes: 384
#include <bits/stdc++.h> 
using namespace std;
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vec vector<int>
#define vecll vector<ll>
#define vp vector<pair<int,int>>
#define MAX 2147483647
#define MIN -2147483647
#define mod 1000000007
//#define f first
//#define s second
void readtxt()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main()
{
    fast();
    //readtxt();
    ll a, b;
    cin >> a >> b;
    cout << a*b << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
using namespace std;
int main(){
  char a[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  string b;
  cin >> b;
  for(int i=0;i<26;++i) {
    if(a[i]==b[0]) {
      b = a[i+1];
      break;
    }
  }
  cout << b;
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(a>0 && c>0){
        c-=b;
        if(c<=0){
            cout << "Yes" << endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout << "No" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
typedef __int128 bi;
const bi MOD=1000000000000000003LL;
bi qp(bi a,bi b)
{
	bi x=1; a%=MOD;
	while(b)
	{
		if(b&1) x=x*a%MOD;
		a=a*a%MOD; b>>=1;
	}
	return x;
}
const bi g=233333,rg=qp(g,MOD-2);
pair<bi,bi> operator +
(pair<bi,bi> a,pair<bi,bi> b)
{return mp((a.fi+a.se*b.fi)%MOD,a.se*b.se%MOD);}
#define SZ 666666
int n; char str[SZ];
pair<bi,bi> sg[SZ],tg(0,1),qz[SZ];
ll ans=0;
int main()
{
	scanf("%d%s",&n,str+1);
	for(int i=1;i<=n;++i)
	{
		if(str[i]=='+') sg[i]=mp(1,1);
		else if(str[i]=='-') sg[i]=mp(MOD-1,1);
		else if(str[i]=='>') sg[i]=mp(0,g);
		else sg[i]=mp(0,rg); tg=tg+sg[i];
	}
	qz[0]=mp(0,1);
	for(int i=1;i<=n;++i) qz[i]=qz[i-1]+sg[i];
	map<ll,int> ms;
	for(int i=n;i>=0;--i)
	{ 
		//A.fi+tg.fi*A.se=C.fi
		ans+=ms[(qz[i].fi+tg.fi*qz[i].se)%MOD];
		++ms[qz[i].fi];
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 48128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define onen(i,n) for(int i=1;i<n+1;i++)

const int MAXN = 101, MAXK = 101;

int n,m,k,t,p,l;
bool joho[MAXN][MAXN];
bool still[MAXN];

int main()
{
    while(cin >> n && n)
    {
        memset(still, true, sizeof(still));
        memset(joho, false, sizeof(joho));
        int ans = -1;
        int num = 0;
        //for(int i=1;i<=n;i++)
        onen(i,n)
        {
            cin >> t;
            rep(j,t)
            {
                cin >> p;
                joho[i][p] = true;
            }
        }

        cin >> k;
        rep(j,k)
        {
            cin >> l;
            onen(i,n) still[i] = still[i] & joho[i][l];
        }

        onen(i,n)if(still[i])
        {
            ans = i;
            num++;
        }
        if(num>=2 || num == 0) {cout << -1 << endl; continue;}
        else cout << ans << endl;

    }

    return 0;
}

Measured memory_bytes: 872
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstdlib>
#include <vector>
#include <cstdint>
#include <numeric>

#define _rep_overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _rep_overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

#define _rrep_overload3(_1,_2,_3,name,...) name
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _rrep_overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)

using namespace std;

// Globals

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N;
  cin >> N;
  
  vector<int> p6s(N+1);
  //vector<int> p9s(N);
  
  rep (i, N+1) {
    int p6 = 0;
    for (int x=i; x>0; x/=6) {
      p6 += x%6;
    }
    p6s[i] = p6;

    //cout << i << " " << p6 << endl;
  }

  int ans = 1e9;
  for (int i=0; i<N+1; i+=9) {
    int p9 = 0;
    for (int x=i; x>0; x/=9) {
      p9 += x%9;
    }
    ans = min(ans, p9 + p6s[N-i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640