akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using vec = vector<ll>;
using vec2 = vector<vector<ll>>;
ll inf = pow(2, 62);

int main()
{
    ll h, w, k;
    cin >> h >> w >> k;
    vector<string> masu(h);
    rep(i, h)
    {
        cin >> masu[i];
    }
    ll ans = 0;
    rep(is, 1 << h)
    {
        rep(js, 1 << w)
        {
            ll cnt = 0;
            rep(i, h)
            {
                rep(j, w)
                {
                    if (is >> i & 1)
                    {
                        continue;
                    }
                    if (js >> j & 1)
                    {
                        continue;
                    }
                    if (masu[i][j] == '#')
                    {
                        cnt++;
                    }
                }
            }
            if (cnt == k)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

void bfs(const vvi& g, vi& ds, int i) {
    int n = g.size();

    vector<bool> seen(n, false);
    queue<int> queue;
    queue.push(i);
    ds[i] = 0;
    seen[i] = true;

    while (!queue.empty()) {
        int v = queue.front();
        queue.pop();

        for (auto itr = g[v].begin(); itr != g[v].end(); ++itr) {
            if (!seen[*itr]) {
                queue.push(*itr);
                ds[*itr] = ds[v] + 1;
                seen[*itr] = true;
            }
        }
    }

    rep(i, 0, n) {
        if (!seen[i]) { ds[i] = -1; }
    }
}

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

    int n;
    cin >> n;

    vvi g(n);
    rep(i, 0, n) {
        int u, k;
        cin >> u >> k;

        rep(j, 0, k) {
            int v;
            cin >> v;
            g[u - 1].push_back(v - 1);
        }
    }

    vi ds(n, 0);

    bfs(g, ds, 0);
    rep(i, 0, n) {
        cout << i + 1 << " " << ds[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3148
n = input()
a = list(map(int,input().split()))
d = False
for i in a:
    if(i%2 == 0):
        if((i%3 == 0) or (i%5 == 0)):
            pass
        else:
            print('DENIED')
            d = True
            break

if(not d):
    print('APPROVED')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll fun(vector<ll>&a,vector<ll>&b,ll k){
        ll ans=0;
    ll finans=0;
    auto it=upper_bound(a.begin(),a.end(),k);
    if(it==a.begin()){
        auto it1=upper_bound(b.begin(),b.end(),k);
        if(it1==b.begin()){
            ans=0;
        }else{
            it1--;
            ans+=it1-b.begin()+1;
            finans=max(ans,finans);
        }
    }else{
        it--;
        ans=0;
        for(ll i=0;i<=it-a.begin();i++){
            ans=0;
            auto it1=upper_bound(b.begin(),b.end(),k-a[i]);
            if(it1==b.begin()){
                ans+=i+1;
            }else{
                it1--;
                ans+=i+1+it1-b.begin()+1;
            }
            finans=max(ans,finans);
        }
    }
    return finans;
}
int main()
{
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll>a(n),b(m);
    for(ll i=0;i<n;i++){
        cin>>a[i];
    }
    for(ll i=0;i<m;i++){
        cin>>b[i];
    }
    for(ll i=1;i<n;i++){
        a[i]+=a[i-1];
    }
    for(ll i=1;i<m;i++){
        b[i]+=b[i-1];
    }
    cout<<max(fun(a,b,k),fun(b,a,k))<<endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  vector<int> h(n);
  for(int i = 0; i < n; i++) cin >> h.at(i);
  for(int i = 0; i < n; i++) {
    if(h.at(i) >= k) ans++;
  }
  cout << ans << endl;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/4;
    public static final int inf = Integer.MAX_VALUE/4;

    static void solve(InputReader in, PrintWriter out){
        int a = in.ni(), b = in.ni();
        int count = 0;
        for (int i = a; i <= b; i++) {
            StringBuilder sb = new StringBuilder();
            sb.append(i);
            sb.reverse();
            if(Integer.toString(i).equals(new String(sb))) count++;
        }
        out.println(count);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 38356
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a[] = new int[3];
		Scanner sc = new Scanner(System.in);
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		sc.close();
		Arrays.sort(a);
		if(a[0]==a[1] && a[1]==a[2]) System.out.println("1");
		else if(a[0]==a[1] || a[1]==a[2])System.out.println("2");
		else System.out.println("3");
	}

}


Measured memory_bytes: 9808
#include <iostream>
#include <string>
using namespace std;
using ll = long long;

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

  string::size_type pos = 0;
  while((pos = s.find("BC", pos)) != string::npos) {
    s.replace(pos, 2, "D");
    pos += 1;
  }
  // cout << s << endl;
  ll ans = 0;
  ll na = 0;
  for(int i = 0; i < s.size(); ++i) {
    if(s[i] == 'A') {
      na++;
    } else if(s[i] == 'D') {
      ans += na;
    } else {
      na = 0;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int n, k, q;
	cin >> n >> k >> q;
	int A[n] = {};
	for (int i = 0; i < q; ++i) {
		int a;
		cin >> a;
		A[--a]++;
	}
	for (int i = 0; i < n; ++i)
		if (q - A[i] >= k)
			cout << "No\n";
		else
			cout << "Yes\n";
	
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll fmemo[100002];
ll imemo[100002];
ll ifmemo[100002];

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

ll fact(ll n){
    if(n == 0) return 1;
    if(fmemo[n]) return fmemo[n];
    return fmemo[n] = n * fact(n - 1) % MOD;
}

ll ifact(ll n){
    if(n == 0) return 1;
    if(ifmemo[n]) return ifmemo[n];
    return ifmemo[n] = imemo[n] * ifact(n - 1) % MOD;
}

ll per(ll n, ll k){
    if(k > n) return 0;
    return fact(n) * ifact(n - k) % MOD;
}

int main()
{
    for(ll i = 1; i <= 100001; i++){
        imemo[i] = modpow(i, MOD - 2);
    }
    int n, k;
    cin >> n >> k;
    int a[100002], b[100002];
    vector<int> v[100002];
    for(int i = 0; i < n - 1; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        v[a[i]].push_back(b[i]);
        v[b[i]].push_back(a[i]);
    }
    int used[100002] {0};
    ll ans = k;
    used[0] = 1;
    queue<int> que;
    int l = v[0].size();
    ans = ans * per(k - 1, l) % MOD;
    for(int i = 0; i < l; i++) que.push(v[0][i]);
    while(que.size()){
        int now = que.front();
        que.pop();
        used[now] = 1;
        l = v[now].size();
        ans = ans * per(k - 2, l - 1) % MOD;
        for(int i = 0; i < l; i++){
            if(used[v[now][i]] == 0) que.push(v[now][i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 13176
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] b = new int[n-1];

    for(int i=0; i<b.length; ++i)
      b[i] = sc.nextInt();

    int ans = 0;

    // a[0]とa[n]に入るであろう値を加算
    ans = b[0] + b[b.length-1];

    // a[1]~a[n-1]に入るであろう値を加算
    for(int i=1; i<b.length; ++i) {
      ans += Math.min(b[i-1],b[i]);
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 21460
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

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

    ll cnt1 = 0, cnt2 = 0, cnt4 = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        if(a%4 == 0) {
            cnt4++;
        }
        else if(a%2 == 0) {
            cnt2++;
        }
        else {
            cnt1++;
        }
    }

    if(cnt2 == 0) {
        if(cnt4 + 1 >= cnt1) {
           out("Yes");
        }
        else {
            out("No");
        }
    }
    else {
        if(cnt4 >= cnt1) {
            out("Yes");
        }
        else {
            out("No");
        }
    }

    re0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
    int a, b;

    for(;sc.hasNext();){
      a = sc.nextInt();
      b = sc.nextInt();
      System.out.println(gcd(a, b));
    }

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }

  private static int gcd(int a, int b){
    if(a % b == 0)return b;
    else return gcd(b, (a % b));
  }
}

Measured memory_bytes: 17172
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nk = InputNumList();
            var n = nk[0];
            var k = nk[1];
            var a = InputNumList();
            var b = new int[n + 1];
            for (int i = 0; i < n; i++)
            {
                b[a[i]]++;
            }
            Array.Sort(b);
            Array.Reverse(b);
            int sum = 0;
            for (int i = 0; i < k; i++)
            {
                sum += b[i];
            }
            WriteLine(n - sum);
        }

        static int InputNum()
        {
            return int.Parse(ReadLine());
        }
        static List<int> InputNumList()
        {
            return ReadLine().Split(' ').Select(int.Parse).ToList();
        }
    }
}

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

vector<char> alphabets = 
{
  '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'
};

int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  
  for(int i=0;i<S.length();i++){
    for(int j=0;j<26;j++){
      if(S[i] == alphabets[j]) cout << alphabets[(j+N)%26];
    }
  }
  
  cout << endl;
  
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
  #include <vector>
  #include <string.h>
  #include <stack>
  #include <queue>
  #include <algorithm>
  #include <climits>
  #include <cmath>
  #include <map>
  #include <set>
  #include <assert.h>
  #include <stdio.h>
  #define REP(i,n) for(ll i=0;i<(n);i++)
  #define MOD 1000000007
  #define int long long
  #ifdef int
  const long long INF = LLONG_MAX / 10;
  #else
  const int INF = 1010101010;
  #endif
  using namespace std;
  typedef long long ll;
  typedef vector<vector<ll> > mat;
  typedef pair<int, int> P;
  //typedef pair<double, double> P;
  const int dx[9] = {-1, 0, 0, 1, -1, -1, 1, 1, 0};
  const int dy[9] = {0, -1, 1, 0, -1, 1, -1, 1, 0};
  
  // string s;
  int x, y;
  const int Z = 8003;
  const int N = 2 * Z + 1;
  bool dp[2][2][N];
  char s[N];

  signed main() {
    // cin >> s;
    scanf("%s", s);
    // cin >> x >> y;
    scanf("%lld%lld", &x, &y);
    // int n = s.length();
    int n = strlen(s);

    dp[0][0][Z] = dp[1][0][Z] = 1;

    int pos = 0;
    while (pos < n && s[pos] == 'F') {
      pos++;
      x--;
    }

    int t = 0;
    while (pos < n) {
      pos++;
      t ^= 1;
      int L = 0;
      while (pos < n && s[pos] == 'F') {
        pos++;
        L++;
      }
      REP(i,N) dp[t][1][i] = 0; //1の方は計算結果
      REP(i,N) {
        if (!dp[t][0][i]) continue;
        dp[t][1][i-L] = dp[t][1][i+L] = 1;
      }
      REP(i,N) dp[t][0][i] = dp[t][1][i];
    }

    if (dp[0][0][Z+x] && dp[1][0][Z+y]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }

    return 0;
  }

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
const int N = 100010;

int n, idx, res[6], a[N];

int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; ++i)
        scanf("%d", &a[i]);
    sort(a, a + n);
    for(int i = n - 1; i > 0; --i)
    {
        if(a[i] == a[i - 1])
        {
            res[idx++] = a[i];
            if(idx == 2) break;
            --i;
        }
    }
    if(idx == 2)
        cout << 1ll * res[0] * res[1];
    else
        cout << 0;
    return 0;
}


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

// constexpr int MOD = 1000000007;
constexpr int MOD = 998244353;
vector<long> fact, inv;

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b /= 2;
  }
  return res;
}

long com(long n, long r) {
  long x = 1, y = 1;
  for (int i = 1; i <= r; i++) {
    x = x * (n - i + 1) % MOD;
    y = y * i % MOD;
  }
  return x * mpow(y, MOD - 2) % MOD;
}

void init(int n) {
  fact.push_back(1);
  inv.push_back(1);
  for (int i = 0; i < n; i++) {
    fact.push_back(fact.at(i) * (i + 1) % MOD);
    inv.push_back(mpow(fact.at(i + 1), MOD - 2));
  }
}

long qcom(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * inv.at(r) % MOD * inv.at(n - r) % MOD;
}

int main() {
  ios::sync_with_stdio(false);
  init(200000);
  long N, M, K;
  cin >> N >> M >> K;
  long ans = 0;
  for (int i = 0; i <= K; i++) {
    long tmp = qcom(N - 1, i);
    tmp *= M;
    tmp %= MOD;
    tmp *= mpow(M - 1, N - i - 1);
    tmp %= MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 6576
import collections

h, w = map(int, input().split())
s = [[""]*(w+2)]
for _ in range(h):
    _s = list(input())
    _s.append("")
    _s.insert(0, "")
    s.append(_s)
s.append([""]*(w+2))

blacks = 0
for i in range(h+2):
    for j in range(w+2):
        if s[i][j] == "#":
            blacks += 1

dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]

visited = [[float("inf")]*(w+2) for _ in range(h+2)]
visited[1][1] = 1

q = collections.deque([[1, 1]])
while 0 < len(q):
    cy, cx = q.pop()
    for _dx, _dy in zip(dx, dy):
        x = cx + _dx
        y = cy + _dy
        if s[y][x] == "." and visited[y][x] == float("inf"):
            visited[y][x] = visited[cy][cx] + 1
            q.appendleft([y, x])

if visited[h][w] == float("inf"):
    print(-1)
else:
    print(h*w - visited[h][w] - blacks)


Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
 
using namespace std;
 
int V,E;
int map[15][15];
int dp[1<<15][15];
 
int saiki(int vis,int pos){
 
    int r = 1<<28;
    if(dp[vis][pos] != -1) return dp[vis][pos];
    if(pos == 0 && vis == (1<<V)-1){
        return 0;
    }
    for(int i=0;i<V;i++){
    if(map[pos][i] != -1 && !(vis & (1<<i)) ){
        r = min(r,saiki( vis | (1<<i) ,i) + map[pos][i]);
     
    }
    }
 
    return dp[vis][pos] = r;
}
int main(){
 
    int s,t;
    cin >> V >> E;
    fill(&map[0][0],&map[15][0],-1);
    for(int i=0;i<E;i++){
    cin >> s >> t;
    cin >> map[s][t];
    }
    fill(&dp[0][0],&dp[1<<15][0],-1);
 
    int res = saiki(0,0);
 
    if(res >= 1<<28) res = -1;
    cout << res << endl;
 
    return 0;
}

Measured memory_bytes: 5036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
typedef pair<string, string> pss;
#define pb push_back
#define PI acos(-1.0)
#define EPS 1e-4
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fout(S,x)            cout<<fixed<<setprecision(x)<<(S)<<endl
#define present(c,x) ((c).find(x) != (c).end())
#define T() ll t;cin>>t;while(t--)
#define mem(input,b) memset(input,b,sizeof(input))
#define ff first
#define ss second
#define fread(input) freopen("input","r",stdin)
#define fwrite(b) freopen("b","w",stdout)
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define FOREACH(i,c) for (__typeof ((c).begin()) i = (c).begin() ; i != (c).end() ; i++)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::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...);
}
const int maxn=1e5+5;
const int mod=1e9+7;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;  } return 0;  }
int main(){
    fastio;
    int n;
    cin>>n;
    ll dp[305][305];
    for(int i=0;i<305;++i)
        for(int j=0;j<305;++j)
            dp[i][j] = 1e9;
    for(int i=0;i<n;++i)
        for(int j=0;j<n;++j)
            cin>>dp[i][j];
    ll ans = 0;
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            bool flg = true;
            for(int k=0;k<n;++k){
                if(i==k||j==k)
                    continue;
                if(dp[i][j]>dp[i][k]+dp[k][j]){
                    cout<<-1<<endl;
                    return 0;
                }
                if(dp[i][j] == dp[i][k]+dp[k][j])
                    flg=false;
            }
            if(flg)
                ans += dp[i][j];
        }
    }
    cout<<ans/2<<endl;
    return 0;
}    


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

int main()
{
  string s;
  cin>>s;
  string p1,p2;//p1=01 p2=10
  rep(i,s.size())
  {
    if(i%2==0)
    {
      p1+="0";
      p2+="1";
    }
    else
    {
      p1+="1";
      p2+="0";
    }
  }
  int ans1=0,ans2=0;
  rep(i,s.size())
  {
    if(p1[i]!=s[i])ans1++;
    if(p2[i]!=s[i])ans2++;
  }
  cout<<min(ans1,ans2)<<endl;

  return 0;
}


Measured memory_bytes: 768
#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;
typedef long long int ll;
 
 
 ll N = 1000005;
const ll mod = 998244353;
const long long int inf = 1e10+5;
#define pp pair<ll,ll>
 
typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
void fastIO(void);
 
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);

 




int main(){
   
   ll n;
   cin>>n;
   string a,b,c;
   cin>>a>>b;
   rep(i,n){
       c.push_back(a[i]);
       c.push_back(b[i]);
   }
   cout<<c<<endl;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}
 

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <cmath>
#include <utility>
#include <map>

using namespace std;
typedef long long ll;
#define rep(i,a,b) for(int i=(a);i<(b);++i)

bool isSame(string S) {
	char c = S[0];
	for (int i = 0; i < S.size(); i++) {
		if (S[i] != c)
			return false;
	}
	return true;
}

int main() {
	long long N, M;
	cin >> N >> M;

	ll ans = 0;
	if (N*2 >=  M) {
		cout << M / 2;
		return 0;
	}
	if (M < 2) {
		cout << 0;
		return 0;
	}
	ans += N;
	M -= 2 * N;
	ans += M / 4;
	cout << ans;

	return 0;
}

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

string i2s(int num){
  stringstream ss;
  ss<<num;
  return ss.str();
}

int main(){
  int n;
  char c;
  string s="";
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>c;
    s+=c;
  }
  for(int value=0,digit=i2s(value).size();;value++,digit=i2s(value).size()){
    bool find=false;
    for(int i=0;i<n-digit+1;i++){
      if(s.substr(i,digit)==i2s(value)){
	find=true; break;
      }
    }
    if(!find){
      cout<<value<<endl; break;
    }
  }
}


Measured memory_bytes: 1232
import sys
input = sys.stdin.buffer.readline

def main():
	
	# SegmentTree Class
	class SegmentTree:
		
		# 初期化
		def __init__(self, size, default):
			self.size = 2**(size-1).bit_length()
			self.default = default
			self.seg = [default]*(2*self.size-1)

		# function(max, min, plus, minus, etc...)
		def segfunc(self,x,y):
			return max(x,y)

		# update
		def update(self,k,x):
			k += self.size-1
			self.seg[k] = x
			while k:
				k = (k-1)//2
				self.seg[k] = self.segfunc(self.seg[2*k+1],self.seg[2*k+2])

		# query([p,q)のsegfunc)
		def query(self,p,q):
			if q <= p:
				return self.default
			p += self.size-1;q += self.size-2
			ret = self.default
			while q-p > 1:
				if p&1 == 0:
					ret = self.segfunc(ret,self.seg[p])
				if q&1 == 1:
					ret = self.segfunc(ret,self.seg[q])
					q -= 1
				p = p//2
				q = (q-1)//2
			ret = self.segfunc(self.segfunc(ret,self.seg[p]),self.seg[q])
			return ret

		# seg確認用
		def seg_print(self):
			print(self.seg)
		
	N = int(input())
	a = list(map(int,input().split()))
	ans=[i+1 for i in range(N)]
	left_seg = SegmentTree(N, 0)
	for i, num in enumerate(a):
	    ans[num-1] *= i + 1 - left_seg.query(0,num)
	    left_seg.update(num-1, i+1)
	right_seg = SegmentTree(N, 0)
	for i, num in enumerate(a[::-1]):
	    ans[num-1] *= i + 1 - right_seg.query(0,num)
	    right_seg.update(num-1, i+1)
	
	print(sum(ans))

if __name__ == "__main__":
	main()


Measured memory_bytes: 73152
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    H, W, N = map(int, input().split())
    sr, sc = map(int, input().split())
    sr = H + 1 - sr
    S = input()[::-1]
    T = input()[::-1]

    left, right = 1, W
    bottom, up = 1, H
    for s, t in zip(S, T):
        if t == "R":
            left -= 1
            left = max(1, left)
        elif t == "L":
            right += 1
            right = min(W, right)
        elif t == "U":
            bottom -= 1
            bottom = max(1, bottom)
        elif t == "D":
            up += 1
            up = min(H, up)

        if s == "R":
            right -= 1
        elif s == "L":
            left += 1
        elif s == "U":
            up -= 1
        elif s == "D":
            bottom += 1

        if left > right or bottom > up:
            print("NO")
            exit()

    print("YES" if left <= sc <= right and bottom <= sr <= up else "NO")


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9752
#include<bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
#define all(x) x.begin(), x.end()
#define skip continue
#define NAME "code"
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
void faster(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MAXN = 3e5 + 123;
const ld EPS = 1e-12;
const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

ll n, m, k;

void solve(){
	cin >> n >> m >> k;
	cout << (k + max(n, m) - 1) / max(n, m);
}

int main(){

	faster();
 
	int T = 1;
	// cin >> T;
	
	while(T--){
		solve();
	}
 
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

string left_or_right(char word)
{
	string left="qwertasdfgzxcvb";
	string right="yuiophjklnm";
	
	if(right.find(word) != string::npos){
		return "R";
	}
	else{
		return "L";
	};

}

int main() {
	
	string word;
	string hand="";

	while(cin >> word)
	{
		if(word == "#"){ break; }
		
		int count=0;
			string tmp = left_or_right(word[0]);
		REP(i,1,word.length()){
			hand =  left_or_right(word[i]);
			if(hand != tmp){count++;}
			tmp = hand;
		}
		cout << count << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author lstd
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
#include <complex>
#include <algorithm>
#include <utility>
#include <functional>
#include <cmath>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

#define sqr(x) ((x)*(x))
#define mp make_pair
#define pb push_back
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define RE(i, n) FOR(i,1,n)
#define REP(i,n) FOR(i, 0, (int)(n)-1)
#define fst first
#define snd second

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;

string to_string(string s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string) s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}



void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

int XMOV[4] = {0, 0, 1, -1};
int YMOV[4] = {1, -1, 0, 0};

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

using namespace std;

#define MAXN 200005

vector<int> t[MAXN];
int cnt[MAXN], visited[MAXN];

void dfs(int s) {
    visited[s] = 1;
    for (int i = 0; i < t[s].size(); i++){
        if (!visited[t[s][i]]) {
            cnt[t[s][i]] += cnt[s];
            dfs(t[s][i]);
        }
    }
}

class DKi {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n,q;
		memset(cnt, 0, sizeof(cnt));
		memset(visited, 0, sizeof(visited));

		in >> n >> q;
		int a, b;
		for (int i = 0; i < n-1; i++)
			in >> a >> b, t[a].pb(b);

		int p,x;
		for (int i = 0; i < q; i++)
		    in >> p >> x, cnt[p] += x;

		dfs(1);

		for (int i = 1; i <= n; i++)
		    out << cnt[i] << " ";
	}
};

int main() {
	DKi solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 24320
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;



int main()
{
    int n,m;
    vector<pair<int,int> > p;
    int a,b;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        p.push_back(make_pair(a,b));
    }
    cin >> m;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        p.push_back(make_pair(a,b));
    }
    sort(p.begin(),p.end());
    if(p[0].second<10)
            cout << p[0].first << ":" << 0 << p[0].second ;
        else
            cout << p[0].first << ":" << p[0].second ;
    for(int i=1;i<n+m;i++){
        if(p[i-1]==p[i]) continue;
        if(p[i].second<10)
            cout <<" " << p[i].first << ":" << 0 << p[i].second ;
        else
            cout <<" " << p[i].first << ":" << p[i].second ;
    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3108
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a =sc.nextInt();
        int b =sc.nextInt();
        int c = 2*a+2*b;
        System.out.println(a*b+" "+c);
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String line = br.readLine();
    }
}



Measured memory_bytes: 26148
#include <bits/stdc++.h>
#include <sys/types.h>
#include <unistd.h>

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

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	ll r,d,x;
	cin >> r >> d >> x;
	rep(i, 10){
		x = 1LL * r * x - d;
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 256
data = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b,f,r,v = map(int, input().split())
    data[b-1][f-1][r-1] += v

for bild in range(4):
    for floor in range(3):
        ans = " ".join(map(str, data[bild][floor]))
        print(" "+ans)
    if bild != 3:
        print("####################")



Measured memory_bytes: 5604
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
//	ios_base::sync_with_stdio(0); cin.tie(0);
	#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	uint64_t ans = 0;
	ans +=k;
	int i;
	for(i=1;i<n;i++)
	{
		ans*=(k-1);
	}
	cout<<ans<<'\n';
	return 0;
}	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll n, k;
	cin >> n >> k;
	
	cout << min(n % k, k - n % k) << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 *    author        : Saurav Paul 
 *    created       : August 15, 2020 12:08 AM
 *    Problem Name  : L - Deque
 *    Problem Limit : 2000 ms , 1024 MB
 *    Problem Url   : https://atcoder.jp/contests/dp/tasks/dp_l
 *    @genarated by : ai-virtual-assistant
**/

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

using ll = long long int ;

void solve(){
    
    int N ;
    cin >> N ;
    vector<int> v(N+1) ;
    for(int i = 1 ; i <= N ; i++) cin >> v[i];

    vector<vector<ll>>dp(N+2,vector<ll>(N+2)) ;

    for(int L = N ; L > 0 ; L--){
        for(int R = L ; R <= N ; R++){
            if(L == R) dp[L][R] = v[L] ;
            else 
                dp[L][R] = max( v[L] - dp[L+1][R] ,  v[R] - dp[L][R-1] ) ;
        }
    }
    
    cout << dp[1][N] << endl ;
}

int main(){
    ios_base::sync_with_stdio(false);

    int testcases = 1;
    for(int i = 1 ; i <= testcases ; i ++){
        solve();
    }

    return 0 ;
}


Measured memory_bytes: 73748
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n;
	while(cin >> n) {
		vector<LL> a(n);
		vector<LL> b(n);
		REP(i, n) cin >> a[i];
		REP(i, n) cin >> b[i];
		vector<LL> d(n);
		LL msum = 0;
		int mc = 0;
		REP(i, n) {
			if(a[i] - b[i] > 0) {
				d[i] = a[i] - b[i];
			} else {
				msum += b[i] - a[i];
				if(a[i] - b[i] != 0) mc++;
			}
		}
		sort(ALL(d));
		reverse(ALL(d));
		int ans = -1;
		if(msum == 0) {
			ans = 0;
		} else {
			REP(i, n) {
				msum -= d[i];
				if(msum <= 0) {
					ans = i+1;
					break;
				}
			}

		}
		if(ans != -1) {
			ans += mc;
		}
		cout << ans << endl;
	}
	return 0;
}


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

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

int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N), c(N);
  int dp[N+100][3] = {};
  rep(i, N) cin >> a.at(i) >> b.at(i) >> c.at(i);

  dp[0][0] = a.at(0);
  dp[0][1] = b.at(0);
  dp[0][2] = c.at(0);
  for (int i = 0; i < N-1; ++i){
    for (int j = 0; j < 3; ++j){
      int happiness = (j == 0) ? max(dp[i][1], dp[i][2]) + a.at(i+1) :
                      (j == 1) ? max(dp[i][0], dp[i][2]) + b.at(i+1) : max(dp[i][0], dp[i][1]) + c.at(i+1);
      dp[i+1][j] = happiness;
    }
  }
  int mx = max(dp[N-1][0], dp[N-1][1]);
  mx = max(mx, dp[N-1][2]);
  cout << mx << endl;
  return 0;
}

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

int main(){
	int i, Slen, ans=0;
	int digit = 1;//10^nに当たる部分。適宜mod2019して用いる
	char S[200001];//文字列として数字を確保
	int T[200001];//n桁目までのmod2019の値を保存
	int R[2019] = {0};//累積和のmod2019の値それぞれの個数をカウント

	scanf("%s", S);
	Slen = strlen(S);

	T[Slen] = 0;//総和ゼロのとき（DPの初期化）
	R[0]++;//総和ゼロのときの分(mod2019=0)を先にカウントしておく

	for(i=Slen-1; i>=0; i--){
		T[i] = (T[i+1] + digit * (S[i]- '0')) % 2019;
		R[T[i]]++;
		digit = digit *10 %2019;
	}

	for(i=0; i<2019; i++){
		ans += ((R[i])*(R[i] - 1)) / 2;//nC2
	}

	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 2708
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long gcd(T1 a, T2 b){return a % b ? gcd(b , a % b) : b;}
template<class T1, class T2> void reduce(T1 &a, T2 &b){ll g = gcd(a, b); a /= g; b /= g; return;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

int D;
vector<int> c(26);
int ss[365][26];
vector<int> ans(0);

double powyabai = 1.2;
double cyabaipow = 1.2;
double uresisapow = 1;
int akanC = 90;

double evaluate(int day, int kind){
    double yabasa = 0;
    int s = ans.size();
    int idx;
    for(idx = s - 1; 0 <= idx; idx--){
        if(ans[idx] == kind) break;
    }
    yabasa = pow(day - idx, powyabai) * pow(c[kind], cyabaipow);
    double uresisa = pow(ss[day][kind], uresisapow);
    return yabasa + uresisa;
}

int main(){
    cin >> D;
    rep(i, 26) cin >> c[i];
    rep(i, D)rep(j, 26) cin >> ss[i][j];
    rep(i, D){
        double max_eva = -inf;
        double choice = 0;
        rep(j, 26){
            if(c[j] < akanC && chmax(max_eva, evaluate(i, j))) choice = j;
        }
        ans.push_back(choice);
    }
    rep(i, D) pt(ans[i] + 1);
}

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

using namespace std;

int main()
{
    int N;
    unsigned int a[10000];
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> a[i];
    unsigned int cnt = 0;
    for(int i = 0; i < N; ++i){
        while(true){
            if(a[i] % 2 == 0){
                cnt++;
                a[i] /= 2;
            }
            else{
                break;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int M,D;
  cin>>M>>D;
  int p,ans = 0;
  for(int i = 1;i<=M;i++){
    for(int k = 1;k<=D;k++){
      p = (k%10)*(k/10);
      if(i == p && (k%10)>1 && (k/10)>1){
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
const int INF = 1<<28;
const ll MOD = 1000000007;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

struct order {
	string name;
	char com;
	int price;
	bool operator < (const order &a) const {
		return price < a.price;
	}
};

struct comodity {
	int min, max, sum, cnt;
};

void addCom(map<char, comodity> &m, int v, char name) {
	if(!m.count(name)) {
		comodity c;
		c.min = c.max = c.sum = v;
		c.cnt = 1;
		m[name] = c;
	}
	else {
		m[name].min = min(m[name].min, v);
		m[name].max = max(m[name].max, v);
		m[name].sum += v;
		m[name].cnt++;
	}
}

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

	int n;
	while(cin >> n, n) {
		vector<order> buy, sell;
		map<string, pi> ppl;
		map<char, comodity> m;
		REP(i, n) {
			order o; string in;
			cin >> o.name >> in >> o.com >> o.price;
			if(!ppl.count(o.name))
				ppl[o.name] = mp(0,0);
/*
			cout << "-----" << i << endl;
			cout << o.name << ' ' << in << ' ' << o.com << ' ' << o.price << endl;
			cout << "-----BUY" << endl;
			REP(i, buy.size())
				cout << buy[i].name << ' ' << buy[i].com << ' ' << buy[i].price << endl;
			cout << "-----SELL" << endl;
			REP(i, sell.size())
				cout << sell[i].name << ' ' << sell[i].com << ' ' << sell[i].price << endl;
*/
			bool flg = false;
			int v, pnt;
			if(in == "SELL") {
				REP(j, buy.size()) {
					if(o.com == buy[j].com && o.name != buy[j].name && o.price <= buy[j].price) {
						v = (o.price + buy[j].price) / 2;
						addCom(m, v, o.com);
						flg = true;
						pnt = j;
						break;
					}
				}
				if(flg) {
					ppl[buy[pnt].name].first += v;
					ppl[o.name].second += v;
					buy.erase(buy.begin() + pnt);
				}
				else {
					sell.pb(o);
					stable_sort(sell.begin(), sell.end());
				}
			}
			else if(in == "BUY") {
				REP(j, sell.size()) {
					if(o.com == sell[j].com && o.name != sell[j].name && o.price >= sell[j].price) {
						v = (o.price + sell[j].price) / 2;
						addCom(m, v, o.com);
						flg = true;
						pnt = j;
						break;
					}
				}
				if(flg) {
					ppl[o.name].first += v;
					ppl[sell[pnt].name].second += v;
					sell.erase(sell.begin() + pnt);
				}
				else {
					buy.pb(o);
					stable_sort(buy.rbegin(), buy.rend());
				}
			}
		}
		for(auto i : m)
			cout << i.first << ' ' << i.second.min << ' ' << i.second.sum / i.second.cnt << ' ' << i.second.max << endl;
		cout << "--" << endl;
		for(auto i : ppl)
			cout << i.first << ' ' << i.second.first << ' ' << i.second.second << endl;
		cout << "----------" << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const ll LINF = 1001001001001001;
const int MOD = 1000000007;

template <typename T>
void print(const T &v);

int main()
{
    int n;
    string s;
    cin >> n >> s;
    // 境界線より右の白と，境界線より左の黒をカウントする
    int black = 0, white = 0;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == '.')
        {
            ++white;
        }
    }
    // cout << black << ':' << white << endl;
    int mini = black + white;
    for (int i = 0; i < n; i++)
    {
        if (s[i] == '.')
        {
            --white;
        }
        else
        {
            ++black;
        }
        // cout << black << ':' << white << endl;
        mini = min(mini, black + white);
    }
    cout << mini << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << ' ';
        cout << v[i];
    }
    cout << endl;
}

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

int main()
{
	int a, b,i=0;
	string s;
	cin >> s;
	while(i<s.length()){
		if (s[i] == 'A') {
			a = i;
			break;
		}
		i++;
	}
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'Z') b = i;
	}
	cout << b - a+1 << endl;

}



Measured memory_bytes: 640
#include <iostream>
#include <map>

using namespace std;

int main()
{
    map<string, bool> buf;
    int n;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        string input;
        cin >> input;
        buf[input] = true;
    }

    cout <<  buf.size() << endl;

    return 0;
}

Measured memory_bytes: 19224