akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define null NULL
#define mp make_pair
#define pb(a) push_back(a)
#define sz(a) ((int)(a).size())
#define all(a) a.begin() , a.end()
#define fi first
#define se second
#define relaxMin(a , b) (a) = min((a),(b))
#define relaxMax(a , b) (a) = max((a),(b))
#define SQR(a) ((a)*(a))
#define PI 3.14159265358979323846
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
typedef unsigned int uint;

const int BITS = 28;
const int HALF = BITS / 2;
const uint MSK = (1 << HALF) - 1;

int n;
vi a, b;

uint Lower(uint v){
  return v & MSK;
}

uint Higher(uint v){
  return v >> HALF;
}

uint ans = 0;
bitset<(1 << HALF)> lop;
bitset<(1 << HALF)> nums;

bitset<2 * (1 << HALF) + 1> high_res;
bitset<2 * (1 << HALF) + 1> high[1 << HALF];

void ExecuteOp(int pos, int add){
  high_res ^= (high[pos] << add);
}

int main(){
  scanf("%d", &n);
  a.resize(n);
  b.resize(n);

  //for(int& e : a) e = (rand() % 1024) << 10;
  //for(int& e : b) e = (rand() % 1024) << 10;
  for(int& e : a) scanf("%d", &e);
  for(int& e : b) scanf("%d", &e);

  for(int& e : b){
    int l = Lower(e);
    int h = Higher(e);
    nums.flip(l);
    high[l].flip(h);
  }

  for(int i = 1;i < (1 << HALF);++i)
    high[i] ^= high[i - 1];

  for(int& e : a){
    int l = Lower(e);
    int h = Higher(e);
    int lim = (1 << HALF) - l;

    lop.flip(l);

    if(0 < lim) ExecuteOp(lim - 1, h);

    if(lim < (1 << HALF)){
      ExecuteOp((1 << HALF) - 1, h + 1);
      if(lim) ExecuteOp(lim - 1, h + 1);
    }
  }

  for(int i = 0;i < (1 << HALF);++i)
    for(int j = 0;j < (1 << HALF);++j)
      if(lop[i] && nums[j])
        ans ^= ((i + j) & MSK);

  for(int i = 0;i < high_res.size();++i)
    if(high_res[i])
      ans ^= (i << HALF);

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 67456
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
using ll = long long int;
const ll INF = 1LL << 60;

template <typename Tp>
void chmax(Tp &A, Tp B) { A = max(A, B); }

template <typename Tp>
void chmin(Tp &A, Tp B) { A = min(A, B); }

ll rec[1010][1 << 12][2];

const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const string pat = "UDRL";

int solve_testcase() {
  ll HP_init, HP_max; cin >> HP_init >> HP_max;
  if(HP_init == 0 and HP_max == 0) return 1;

  int H, W; cin >> H >> W;
  vector<string> board(H);
  for(int i=0; i<H; i++) cin >> board[i];

  int T; cin >> T;
  vector<ll> damage(26);
  for(int i=0; i<T; i++) {
    char c; cin >> c;
    ll d; cin >> d;
    chmax(damage[c - 'A'], d);
  }

  int S; cin >> S;
  int N = 0;
  vector<int> op;
  for(int i=0; i<S; i++) {
    char c; cin >> c;
    int n; cin >> n;
    N += n;
    int id = pat.find(c);
    for(int j=0; j<n; j++) op.emplace_back(id); 
  }

  int P; cin >> P;
  vector<ll> p(P);
  for(int i=0; i<P; i++) cin >> p[i];

  fill(rec[0][0], rec[N+1][0], -INF);
  rec[0][0][0] = HP_init;

  // init
  for(int bit=0; bit<(1<<P); bit++) {
    for(int i=0; i<P; i++) {
      if(bit >> i & 1) continue;
      int nbit = bit | (1 << i);
      chmax(rec[0][nbit][0], min(rec[0][bit][0] + p[i], HP_max));
    }
  }

  int x = 0, y = 0;
  for(int i=0; i<N; i++) {
    // move
    x += dx[ op[i] ], y += dy[ op[i] ];
    ll dam = damage[ board[x][y] - 'A' ];
    for(int bit=0; bit<(1<<P); bit++) {
      // 0 -> 1
      {
        chmax(rec[i][bit][1], min(HP_max - dam, rec[i][bit][0] - dam));
      }
      // 1 -> 1
      {
        for(int k=0; k<P; k++) {
          if(bit >> k & 1) continue;
          int nbit = bit | (1 << k);
          chmax(rec[i][nbit][1], min(HP_max - dam, rec[i][bit][1] + p[k]));
        }
      }
      // 1 -> next 0
      if(rec[i][bit][1] > 0) {
        chmax(rec[i+1][bit][0], rec[i][bit][1]);
      }
      // fprintf(stderr, "rec[%d][%d][%d] = %lld\n", i, bit, 0, rec[i][bit][0]);
      // fprintf(stderr, "rec[%d][%d][%d] = %lld\n", i, bit, 1, rec[i][bit][1]);
    }
  }

  bool ok = false;
  for(int bit=0; bit<(1<<P); bit++) {
    ok |= (rec[N][bit][0] > 0);
    ok |= (rec[N][bit][1] > 0);
  }
  cout << (ok ? "YES" : "NO") << endl;
  return 0;
}

int main() {
  while(!solve_testcase());
  return 0;
}




Measured memory_bytes: 67196
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i < int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main(){
	int a[1010],b[1010],c[1010],dist[101][101];

	int N,M;
	cin >> N >> M;

	FOR(i,0,M){
		cin >> a[i] >> b[i] >> c[i];
		a[i]--;
		b[i]--;
	}

	FOR(i,0,N){
		FOR(j,0,N){
			if (i == j) dist[i][j] = 0;
			else dist[i][j] = 10000000;
		}
	}

	FOR(i,0,M){
		dist[a[i]][b[i]] = c[i];
		dist[b[i]][a[i]] = c[i];
	}

	FOR(k,0,N){
		FOR(i,0,N){
			FOR(j,0,N){
				dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}

	int ret = 0;

	FOR(k,0,M){
		bool isUsed = false;
		FOR(i,0,N){
			FOR(j,0,N){
				if (dist[i][j] == dist[i][a[k]] + c[k] +  dist[b[k]][j]) isUsed = true;
			}
		}
		if(!isUsed) ret++;
	}
	cout << ret << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
	char t[11],s[11],b[11];
	int n,r=0,i,j,k;
	scanf("%s%d",t,&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		for(j=0;j<10;j++){
			b[0]=s[9];
			for(k=0;k<9;k++){
				b[k+1]=s[k];
			}
			strcpy(s,b);
			if(strncmp(s,t,strlen(t))==0){
				r++;
				break;
			}
		}
	}
	printf("%d\n",r);
	return 0;
}

Measured memory_bytes: 616
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

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

using namespace std;

typedef long long ll;

int group(int n){
    if(n==2)
        return 2;
    else if(n==4 || n==6 || n==9 || n==11)
        return 1;
    else
        return 0;

}

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    ll a,b,x;
    cin >> a >> b >> x;
    ll ans = a==0? b/x+1:b/x-(a-1)/x;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    ll a[n];
    ll ma = 0;
    rep(i, 0, n){
        cin >> a[i];
        ma = max(ma, a[i]);
    }

    ll ans = -100000000000;
    rep(i, 0, n){
        if(a[i] == ma){
            continue;
        }else{
            if(abs(ma / 2.0 - a[i]) < abs(ma / 2.0 - ans)){
                ans = a[i];
            }
        }
    }

    cout << ma << " " << ans << endl;
    return 0;
}


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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,a,b; cin>>n>>a>>b;
  if(a%2==b%2){
    cout<<(b-a)/2<<endl;;
  }else{
    ll ans=a;
    ans+=(b-a-1)/2;
    ll tmp=n-b+1;
    tmp+=(n-(a+n-b+1))/2;
    cout<<min(ans,tmp)<<endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
int main()
{  int a,b;
   cin>>a>>b;
   if(a+b>=a-b)
   {
     if(a+b<=a*b)  cout<<a*b;
     else cout<<a+b;            
   }
   else 
   {
     if(a-b<=a*b)  cout<<a*b;
     else cout<<a-b;     
   }
   return 0;    
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().ToCharArray();
        var r = 0L; var g = 0L; var b = 0L;
        for (var i = 0; n > i; i++)
        {
            if (s[i] == 'R') r++;
            else if (s[i] == 'G') g++;
            else b++;
        }
        long res = r * g * b;
        for (var i = 0; n > i; i++)
        {
            for (var j = i + 1; n > j; j++)
            {
                var k = 2 * (j + 1) - (i + 1);
                if (k - 1 < n && s[i] != s[j] && s[i] != s[k - 1] && s[j] != s[k - 1]) res--;
            }
        }
        Console.WriteLine(res);
    }
}

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

class Range {
    public int from, to;
    public int color;
    Range(int from, int to, int color) {
        this.from = from;
        this.to = to;
        this.color = color;
    }
    @Override
    public String toString() {
        return "color: " + color + ", " + "from " + from + " to " + to;
    }
}

public class Main {
    Scanner sc;
    Stack<Range> stack;
    int n;

    Main() {
        sc = new Scanner(System.in);
    }

    public static void main(String[] args) {
        new Main().run();
    }

    boolean init() {
        n = sc.nextInt();
        if (n == 0) return false;
        stack = new Stack<Range>();
        stack.push(new Range(1, 1, 0));
        return true;
    }

    void println(Object s) {
        System.out.println(s);
    }

    void run() {
        while (init()) {
            int color;
            for (int i = 1; i <= n; i++) {
                color = sc.nextInt();
                if (i % 2 == 1) {
                    if (stack.peek().color == color) {
                        stack.peek().to++;
                    } else {
                        stack.push(new Range(i, i+1, color));
                    }
                } else {
                    if (stack.peek().color == color) {
                        stack.peek().to++;
                    } else {
                        Range r = stack.pop();
                        r.color = color;
                        if (stack.empty()) {
                            r.to++;
                            stack.push(r);
                        } else {
                            stack.peek().to = r.to+1;
                        }
                    }
                }
            }
            int count = 0;
            for (Range r : stack) {
//                System.out.println(r);
                if (r.color == 0) {
                    count += (r.to - r.from);
                }
            }

            System.out.println(count);
        }
    }
}

Measured memory_bytes: 12000
#include <iostream>
#include <climits>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define vb vector<bool>
#define vs vector<string>
#define px(x) cout << x << endl
#define pfi(x) printf("%d\n", x)
#define pfs(x) printf("%s\n", x)
#define sfi(x) scanf("%d", &x)
#define sfs(x) scanf("%s", x)

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

    vector<int> vec(n);
    for(auto &val : vec){
        cin >> val;
    }

    for(int i=0; i<n; i++){
        if(vec[i] % 2 == 0){
            if(vec[i]%3 == 0 || vec[i]%5==0){
                continue;
            }else{
                cout << "DENIED";
                return 0;
            }
        }
    }
    cout << "APPROVED";

	return 0;
}

Measured memory_bytes: 256
while True:
	try:
		data = map(int, raw_input().split())
		[a, b] = data
		m = a
		n = b
		
		while m % n != 0:
			hoge = m % n
			m = n
			n = hoge

		gcm = n
		lcm = a * b / gcm

		print gcm, lcm
	
	except EOFError:
		break


Measured memory_bytes: 4224
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
  int m,n;
  cin >> m >> n;
  if(m > 9 || n > 9) cout << "-1" << endl;
  else {
    cout << m * n << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int cost[1000]={300000,200000,100000};
int main(){
    int x,y;
    cin>>x>>y;
    if(x==1&&y==1)
        cout<<"1000000";
    else
    cout<<cost[x-1]+cost[y-1];

}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
double pi=3.1415926535898;
//double pi=acos(-1.0);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define pii        pair<int,int>
#define pis        pair<int,string>
#define vi         vector<int>
#define F          first
#define S          second
//#define max(a,b) a<b?b:a  __builtin_popcount;
//#define min(a,b) a<b?a:b
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 50500;
const int inf = INT_MAX;
const double eps = 1e-6;
//////////////////////    Hi    ^_^  hack me if you can :P

ll n,odd,x;
int main()
{
    cin>>n;
    lop(i,n)
    {
        cin>>x;
        if (x&1)
        {
            odd++;
        }
    }
    if (odd&1)
    {
        cout<<"NO";
    }
    else
    {
        cout<<"YES";
    }
    r0;
}
/*



https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)


*/


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0089
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[,] dp = new int[101, 51];

            int lineCount = 1;
            int beforeCol = 0;

            while (true)
            {

                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) break;

                int[] nums = Array.ConvertAll(line.Trim().Split(','), e => int.Parse(e));

                if (nums.Count() > beforeCol)
                {
                    for (int i = 0 ; i < nums.Count() ; i++)
                    {
                        dp[lineCount, i + 1] = nums[i] + Math.Max(dp[lineCount - 1, i], dp[lineCount - 1, i + 1]);
                    }

                }
                else
                {
                    for (int i = 0 ; i < nums.Count() ; i++)
                    {
                        dp[lineCount, i + 1] = nums[i] + Math.Max(dp[lineCount - 1, i + 2], dp[lineCount - 1, i + 1]);
                    }

                }

                lineCount++;
                beforeCol = nums.Count();
            }

            Console.WriteLine(dp[lineCount - 1, 1]);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 16172
#include <iostream>

using namespace std;
signed main(){
    int a,b,c;
    b = 0;
    c = 0;
    string ab;
    cin >> a;
    cin >> ab;
    for(int i = 0; i < a ; i++){
        if (ab[i] == 'R'){
            b++;
        }
        else{
            c++;
        }

    }
    if(b > c){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}


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

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 105;
int a, b, n, m;
char res[MX][MX];

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

	cin >> a >> b;

	n = 100, m = 100;
	forn (i, n) forn (j, m) res[i][j] = ".#"[j >= m / 2];

	a--, b--;
	forn (i, n) forn (j, m / 2 - 1) if (i % 2 && j % 2) {
		if (b) res[i][j] = '#', b--;
		if (a) res[i][j + m / 2] = '.', a--;
	}

	cout << n << " " << m << endl;
	forn (i, n) {
		forn (j, m) cout << res[i][j];
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, M, C; cin >> N >> M >> C;
	int B[M];
	for (int i = 0; i < M; i++)	cin >> B[i];
	
	int A[N][M];
	for (int i = 0; i < N; i++)
	{
		for (int j = 0; j < M; j++)
		{
			cin >> A[i][j];
		}
	}
	
	int res = 0;
	for (int i = 0; i < N; i++)
	{
		int sum = C;
		for (int j = 0; j < M; j++)
		{
			sum += A[i][j] * B[j];
		}
		if(sum > 0) res++;
	}
	
	cout << res << endl;
	return 0;
}


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

#define int long long

string S;

bool is(string s) {
    int n = s.size();
    for (int i = 0; i < n / 2; ++i) {
        char a = s[i];
        char b = s[n - i - 1];
        if (a != b) return false;
    }
    return true;
}

signed main() {
    cin >> S;
    int n = S.size();
    bool ans = true;
    if (!is(S)) ans = false;
    if (!is(S.substr(0, ((n - 1) / 2)))) ans = false;
    if (!is(S.substr((n + 3) / 2 - 1))) ans = false;
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
#endif


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;


int main(){
	long long n;
	scanf("%lld",&n);
	int minx=0x7fffffff;
	int sit1=0,sit2=0;
	int a,b,t;
	for(int i=1;i<=sqrt(n);i++){
		
		if(n%i==0){
			sit1=0,sit2=0;
			a=i,b=n/i;
			while(a){
				a/=10;
				sit1++;
			}
			while(b){
				b/=10;
				sit2++;
			}
			t=max(sit1,sit2);
			minx=min(minx,t);
		}
	}
	printf("%d\n",minx);
	return 0; 
}

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

int main(){
	vector<char> c(4);
	int ans = 0;
	for(int i = 0; i < 4; i++){
		cin >> c[i];
	}
	for(int i = 0; i < 4; i++){
		if(c[i] == '+'){
			ans++;
		} else {
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int N, Ma, Mb;

struct Chemical {
  int w, c;
};

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

  vector<Chemical> chems(N);
  rep(i, N) {
    int a, b;
    cin >> a >> b >> chems[i].c;
    chems[i].w = a * Mb - b * Ma;
  }

  sort(all(chems),
       [](const Chemical &a, const Chemical &b) { return a.w > b.w; });

  const int W = 4001;
  const int INF = 1e9;
  int dp[41][W];
  rep(i, N) rep(j, W) dp[i][j] = INF;
  dp[0][0] = 0;
  priority_queue<int, vector<int>, greater<int>> pq;
  rep(i, N) {
    rep(j, W) {
      if (dp[i][j] != INF) {
        int nj = j + chems[i].w;
        if (nj >= 0) dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + chems[i].c);
        if (nj == 0) pq.push(dp[i][j] + chems[i].c);
        dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      }
    }
  }

  cout << (pq.empty() ? -1 : pq.top()) << endl;

  return 0;
}


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

int main(){
    int D, T, S;
    cin >> D >> T >> S;

    if(D/double(S)<=T){
        cout<< "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
from itertools import accumulate
n, q = map(int, input().split())
st = input()
lr = [list(map(int, input().split())) for i in range(q)]

lst = [0]*n
for i in range(n-1):
    if st[i] == "A" and st[i+1] == "C":
        lst[i+1] = 1
ans = list(accumulate(lst))
for i in lr:
    print(ans[i[1]-1]-ans[i[0]-1])


Measured memory_bytes: 33036
import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int n = Integer.parseInt(sc.next()), ret = 0;
            
            if((n - 1) / 10000 != 0){
            	ret = (n - 1) / 10000;
            	n = (n - 10000 * ((n - 1) / 10000));
            	ret += n/10000;
            	n %= 10000;
            	ret += n/1000;
            	n %= 1000;
            	ret += n/100;
            	n %= 100;
            	ret += n/10;
            	n %= 10;
            	ret += n;
            }else if((n - 1) / 1000 != 0){
            	ret = (n - 1) / 1000;
            	n = (n - 1000 * ((n - 1) / 1000));
            	ret += n/1000;
            	n %= 1000;
            	ret += n/100;
            	n %= 100;
            	ret += n/10;
            	n %= 10;
            	ret += n;
            }else if((n - 1) / 100 != 0){
            	ret = (n - 1) / 100;
            	n = (n - 100 * ((n - 1) / 100));
            	ret += n/100;
            	n %= 100;
            	ret += n/10;
            	n %= 10;
            	ret += n;
            }else if((n - 1) / 10 != 0){
            	ret = (n - 1) / 10;
            	n = (n - 10 * ((n - 1) / 10));
            	ret += n/10;
            	n %= 10;
            	ret += n;
            }else if((n - 1) / 1 != 0){
            	ret = n;
            }
            
            System.out.println(ret);
            sc.close();
        }
    }
	

Measured memory_bytes: 22868
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    Fast;
    long long t,n,m,i,j,k,x=0,y=0,z;
    int a[5][5];
    for(int i=1;i<=3;i++){
        for(int j=1;j<=3;j++){
            cin>>a[i][j];
        }
    }
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>m;
        int ok=0;
        for(int j=1;j<=3;j++){
            for(int k=1;k<=3;k++){
                if(a[j][k]==m){
                    a[j][k]=-1;
                    ok=1;
                    break;
                }
            }
            if(ok==1){
                break;
            }
        }
    }
    for(int i=1;i<=3;i++){
            x=0;
        for(int j=1;j<=3;j++){
            if(a[i][j]==-1){
                x++;
            }
        }
    if(x==3){

        cout<<"Yes"<<endl;
        return 0;
    }
    }
    for(int i=1;i<=3;i++){
            x=0;
        for(int j=1;j<=3;j++){
            if(a[j][i]==-1){
                x++;
            }
        }
    if(x==3){

        cout<<"Yes"<<endl;
        return 0;
    }
    }
    if(a[1][1]==-1 && a[2][2]==-1 && a[3][3]==-1){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(a[1][3]==-1 && a[2][2]==-1 && a[3][1]==-1){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;






int main(){
    ll n;
    while(cin>>n){
        const ll E=1e10;
        if(n==0){break;}
        vector<ll> a(n);
        for(auto &i:a){cin>>i;}
        ll m;
        cin>>m;
        vector<pll> Sg,Ml;
            const ll mx=300000;
            const ll mx2=100000;
        for(int i=0;i<m;i++){
            string N,T;
            ll M,D;
            cin>>N>>M>>T>>D;
            if(D>mx2){D=mx2;}
            if(T=="Single"){Sg.push_back({D,M});}
            else if(T=="All"){Ml.push_back({D,M});}
        }
        vector<ll> dp1(mx,E),dp2(mx,E);
        dp1[0]=dp2[0]=0;
        for(auto &i:Sg){
            for(int t=0;t+i.F<mx;t++){
                dp1[t+i.F]=min(dp1[t+i.F],dp1[t]+i.S);
            }
            for(ll i=mx-2;i>=0;i--){
                dp1[i]=min(dp1[i],dp1[i+1]);
            }
        }
        for(auto &i:Ml){
            for(int t=0;t+i.F<mx;t++){
                dp2[t+i.F]=min(dp2[t+i.F],dp2[t]+i.S);
            }
            for(ll i=mx-2;i>=0;i--){
                dp2[i]=min(dp2[i],dp2[i+1]);
            }
        }
        ll ans=E;
        for(int i=0;i<=mx2;i++){
            ll count=dp2[i];
            for(int t=0;t<n;t++){
                if(a[t]>i){count+=dp1[a[t]-i];}
            }
            ans=min(ans,count);
        }
        cout<<ans<<endl;
    }
    
    
    return 0;
}



Measured memory_bytes: 7596
//正直者は確定
//不親切は、正直か嘘かも不明
//Nたったの15人なので、15人が正直、嘘、で仮定する
//2^15の処理くらいなら間に合う
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin>>N;
  vector<vector<int>> say(N+1,vector<int>(N+1,-1));
  //証言の保存。-1は審議不明。0は嘘、1は正直 
  for(int i=1; i<=N; i++){
    int A; cin>>A;
    for(int j=0; j<A; j++){//A個の証言をする
      int x,y; cin>>x>>y;
      say[i][x]=y;//iさんが、xさんのことをyと言う
    }
  }
  int ans=0;
  for(int i=1; i<(1<<N); i++){ //(1<<4)=10000=2^4=16未満まで探索
    vector<bool> check(N+1,false);//正直者の配列を用意。
    for(int k=0; k<N; k++)
      if(1&(i>>k)) check[k+1]=true;//演算子、ビット%。1と等しいかどうか。等しければtrue。
    bool finish=false;
    for(int m=1; m<=N; m++){
      for(int n=1; n<=N; n++){//正直者の発言が正しいかどうか探索。嘘ならその時点でbreak
        if(check[m]){
          if((say[m][n]==0 && check[n]==1)//正直と仮定したmがnを嘘というが、nが正直なとき
           ||(say[m][n]==1 && check[n]==0)){//正直と仮定したmがnを正直というが、nが嘘なとき
	          finish=true;
	          break;
	        }
         }
      }
      if(m==N && finish==false){
	    int temp=__builtin_popcount(i);
        ans=max(ans, temp);
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
 int W, H, x, y, r;
 scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);

 if (x - r < 0 || x + r > W || y - r < 0 || y + r > H) {
  printf("No\n");
 } else {
  printf("Yes\n");
 }

}

Measured memory_bytes: 2608
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include <math.h>
#include<algorithm>
#include<map>
#include<string>

using namespace std;

int main(int argc,char** argv)
{

	int n,T;
	cin  >> n >> T;
	int c[n],t[n];
	for(int i = 0; i < n; i++){
		cin >> c[i] >> t[i];
	}
	int cmin=1001;
	for(int i = 0; i < n; i++){
		if(c[i]<=cmin && t[i]<=T){
			cmin =c[i];
		}
	}
	if(cmin == 1001){
		cout << "TLE" <<endl;
	}
	else{
		cout << cmin <<endl;
	}

	return 0;

}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

#define ll long long
using vt = ll; //ここで数値の型を変えられる
#define rep(i, n) for (vt i = 0; i < (vt)(n); i++)
#define reps(i, s, n) for(vt i = (vt) (s); i < (vt) (n); i++) 
#define MOD 1000000007

int main() {
	int k, x;
	cin >> k >> x;
	if (x <= 500 * k) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

int w[100000];
int n,k;

int truck_num(long long int p){
    int i = 0;
    long long int truck = 1;
    long long int load = 0;
    for(i=0;i<n;i++){
        if(load+w[i]>p){
            truck++;
            load=w[i];
        }else{
            load+=w[i];
        }
    }
    return truck;
}

int slv(int k, int maxw){
    long long int l = maxw-1;
    long long int r = 100000*10000;
    long long int m;
    while((r-l)>1){
        m = (l+r)/2;
        if(truck_num(m)>k)l=m;
        else r=m;
    }
    return r;
}

int main(){
    int i;
    int maxw=0;
    scanf("%d %d",&n,&k);
    for(i=0;i<n;i++){
        scanf("%d",w+i);
        if(maxw<w[i])maxw=w[i];
    }
    printf("%d\n",slv(k,maxw));
    return 0;
}




Measured memory_bytes: 3112
class Point(object):
    __slots__ = ["x", "y"]

    def __init__(self, x, y):
        self.x = x
        self.y = y


class Vector(object):
    __slots__ = ["p1", "p2", "x", "y"]

    def __init__(self, p1: Point, p2: Point):
        self.p1 = p1
        self.p2 = p2
        self.x = p2.x - p1.x
        self.y = p2.y - p1.y

    def dot(self, other: "Vector"):
        return self.x * other.x + self.y * other.y

    def cross(self, other: "Vector"):
        return self.x * other.y - self.y * other.x


if __name__ == "__main__":
    import sys
    answer = []
    append = answer.append
    input()
    for x1, y1, x2, y2, x3, y3, x4, y4 in (map(int, l.split()) for l in sys.stdin):
        vector1 = Vector(Point(x1, y1), Point(x2, y2))
        vector2 = Vector(Point(x3, y3), Point(x4, y4))
        if vector1.dot(vector2) == 0:
            append(1)
        elif vector1.cross(vector2) == 0:
            append(2)
        else:
            append(0)

    print(*answer, sep="\n")


Measured memory_bytes: 5784
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	ll a[n+1];for(ll i=0;i<n;i++)cin>>a[i];
	ll cnt=0;
	for(ll i=0;i<n-2;i++)
	{
		ll p,x,y,z;
		p=i;
		x=a[p];
		y=a[p+1];
		z=a[p+2];
		if((y>x&&y<z)||(y>z&&y<x))cnt++;
	}
	cout<<cnt;
}


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

int main(){
  int n;
  cin >> n;
  vector<string> w(n);
  int count=0;
  for(int i=0;i<n;i++){
    cin >> w.at(i);
    if(i-1>=0){
      if(w.at(i-1).back()!=w.at(i).front()){
        count++;
        break;
      }
    }
  }
  sort(w.begin(),w.end());
  for(int i=0;i<n-1;i++){
    if(w.at(i)==w.at(i+1)){
      count++;
      break;
    }
  }
  if(count==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }   
}


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


int main()
{
	int n = 0;
	string word, sen;
	cin >> word;
	while (1) {
		cin >> sen;
		if (sen == "END_OF_TEXT")
			break;
		for (int i = 0;i < sen.size();i++) {
			if ('A' <= sen[i] && sen[i] <='Z')
				sen[i] = sen[i] + 32;
		}
		if (word==sen)
			n++;
	}
	cout << n << endl;
    return 0;
}


Measured memory_bytes: 3196
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n, f;
  cin >> n >> f;

  vector<vector<string>> v(n);
  REP(i,n){
    int tmp;
    cin >> tmp;
    REP(j,tmp){
      string s;
      cin >> s;
      v[i].pb(s);
    }
  }

  map<pair<string, string>, int> mp;

  REP(i,n){
    REP(j,v[i].size()){
      for(int k = j+1; k < v[i].size(); ++k){
        string s1, s2;
        s1 = v[i][j]; s2 = v[i][k];
        if(s1 > s2) swap(s1, s2);
        if(mp.find(MP(s1, s2)) == mp.end()){
          mp[MP(s1,s2)] = 0;
        }
        mp[MP(s1, s2)]++;
      }
    }
  }

  int ans = 0;
  REPI(itr, mp){
    if(itr->second >= f){
      ans++;
    }
  }

  cout << ans << endl;
  REPI(itr, mp){
    if(itr->second >= f){
      cout << itr->first.first << " " << itr->first.second << endl;
    }
  }
  return 0;
}




Measured memory_bytes: 3412
#pragma GCC optimize ("O3")
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
using namespace std;
using ll = __int64_t;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;
const ll mod=1e9+7;


int main(){
      int n;
      cin>>n;
      int b[n-1];
      rep0(i,n-1) cin>>b[i];
      ll ans=0;
      ans+=b[0];
      rep0(i,n-2){
            ans+=min(b[i],b[i+1]);
      }
      ans+=b[n-2];
      cout<<ans<<endl;

      return 0;
}


Measured memory_bytes: 256
import sys
from operator import itemgetter
input = sys.stdin.readline

n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(m)]

ans = 0
now = -1

li.sort(key = itemgetter(1))

for i in range(m):
    if li[i][0] <= now and li[i][1] > now:
        pass
    else:
        ans += 1
        now = li[i][1] - 1

print(ans)


Measured memory_bytes: 29124
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int H,W;
        while(true){
            H = sc.nextInt();
            W = sc.nextInt();
            if(H == 0 && W == 0){
                break;
            }
            else{
                for(int i = 0; i < H; i++){
                    for(int n = 0; n < W; n++){
                        if(i == H - 1 && n == W -1){
                        System.out.println("#\n");
                        }
                        else if(n == W - 1){
                            System.out.print("#\n");
                        }
                        else{
                            System.out.print("#");
                        }
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 33428
n = int(input())
s = input()

mp = ["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"]

res = ""

for c in s:
    num = 0
    for i in range(0,len(mp)):
        if mp[i] == c:
            num = i
            break
    res += mp[(num + n) % 26]
print(res)

Measured memory_bytes: 3064
from sys import exit
# A,B,C = [int(n) for n in input().split()]
N = int(input())
a = sorted([int(n) for n in input().split()], key=lambda x:-x)
ali = 0
bob = 0
for i in range(N):
    if i % 2 == 0:
        ali +=a[i]
    else:
        bob +=a[i]
print(ali-bob)
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
exit()


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
using namespace std;
#define ll long long
int main(){
	int n,k;
	cin>>n>>k;
	ll tmp=n/k,tmp2=n/k;
	if(k&1){
		cout<<tmp*tmp*tmp<<endl;
	}
    else{
    	if(n%k>=(k>>1)){
    		tmp2++;
		}
        cout<<tmp*tmp*tmp+tmp2*tmp2*tmp2;
    }
    return 0;
}


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

public class Main {

    Scanner sc = new Scanner(System.in);

    DecimalFormat df = new DecimalFormat("000");

    int[] ret = new int[3];

    char[] arr;

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        arr = sc.next().toCharArray();

//        System.out.println(arr[0]);

        int cnt = (int)Math.pow(2, 3);

        String[] s = new String[cnt];
        for (int i=0; i<cnt; i++) {
            s[i] = String.format("%3s", Integer.toBinaryString(i)).replace(" ", "0");
        }

//        System.out.println(s[5]);

        dfs("");

        StringBuilder sb = new StringBuilder();
        sb.append(arr[0]);

        for (int i=0; i<3; i++) {

            sb.append(ret[i] == '0' ? "+" : "-");
            sb.append(arr[i+1]);
        }
        sb.append("=");
        sb.append("7");
        System.out.println(sb.toString());

    }

    void dfs(String s) {
        if (s.length() == 3) {
            int sum = arr[0] - '0';
            for (int i=0; i<s.length(); i++) {
                if (s.charAt(i) == '0') {
                    sum += (arr[i+1] - '0');
                } else {
                    sum -= (arr[i+1] - '0');
                }
            }
//            System.out.println(sum);
//            System.out.println(s);
            if (sum == 7) {
//                System.out.println("yes");
                for (int i=0; i<3; i++) {
                    ret[i] = s.charAt(i);
                }
            }
        } else {
            for (int i=0; i<2; i++) {
                dfs(s + String.valueOf(i));
            }
        }

    }


}


Measured memory_bytes: 22740
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                     \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll A, long double B) {
  long double c = A * B;
  cout << (ll)floor(c) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll A;
  scanf("%lld", &A);
  long double B;
  scanf("%Lf", &B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 3856
#[macro_use]
pub mod basic_stdin {
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    use std::io::stdin;
    use std::io::Read;

    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed parsing")
}

}

#[macro_export]
macro_rules! test_function {
    (func = $func:expr, $($input:expr => $output:expr),* $(,)*) => {
        $(
            assert_eq!($func(std::io::Cursor::new($input)) , $output);
        )*
    };
}

#[macro_export]
macro_rules! input_macro {
    (string = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    (reader = $s:expr, $($r:tt)*) => {
        let reader = std::io::BufReader::new($s);
        let mut bytes = std::io::Read::bytes(reader);
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[macro_export]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[macro_export]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashSet;

fn main() {
    let stdin = std::io::stdin();
    let ret = solve(stdin.lock());

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

fn solve<T: std::io::Read>(reader: T) -> u32 {
    input_macro! {
        reader = reader,
        n: u32,
        vec: [u32; n],
    }

    let mut set: HashSet<u32> = HashSet::new();
    for x in vec {
        set.insert(x);
    }

    set.len() as u32
}

#[cfg(test)]
mod tests {

    #[test]
    fn test_solve_function() {
        atcorder::test_function! {
            func = super::solve,
            " 4 10 8 8 6" => 3,
            "3 15 15 15" =>1,
            "7 50 30 50 100 50 80 30" => 4,
        }
    }
}


Measured memory_bytes: 4352
N = int(input())
X = input()

n1 = X.count("1")
Xn = int(X, 2)

Xms = (Xn % (n1 - 1)) if n1 > 1 else 0
Xml = Xn % (n1 + 1)

p2s = [1]
p2l = [1]
s2 = 1
l2 = 1
for i in range(N - 1):
    s2 = (s2 * 2) % (n1 - 1) if n1 > 1 else 0
    l2 = (l2 * 2) % (n1 + 1)
    p2s.append(s2)
    p2l.append(l2)

for i in range(N):
    cnt = 0
    p2 = 2 ** (N - i - 1)
    Xim = 0

    if X[i] == "1" and n1 == 1:
        print(cnt)
        continue
    elif X[i] == "1":
        Xim = (
            Xms - p2s[-i - 1]
            if Xms - p2s[-i - 1] >= 0
            else ((n1 - 1) + (Xms - p2s[-i - 1]))
        )
    else:
        Xim = (
            Xml + p2l[-i - 1]
            if Xml + p2l[-i - 1] < (n1 + 1)
            else (Xml + p2l[-i - 1] - (n1 + 1))
        )

    cnt += 1
    while Xim > 0:
        Xim %= bin(Xim).count("1")
        cnt += 1
    print(cnt)



Measured memory_bytes: 96480
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

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

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};

int main(){
    int H,W;cin >> H >> W;
    vector<string> vec;
    for(int a = 0;a < H;a++){
        SCIN(str);
        vec.push_back(str);
    }
    vector<vector<int>> dp(H+1, vector<int>(W+1, 0));
    for(int a = 0;a < H;a++)
        if(vec[a][0]=='#')break;
        else dp[a][0]=1;
    for(int a = 0;a < W+1;a++)
        if(vec[0][a]=='#')break;
        else dp[0][a]=1;
    for(int a = 1;a < H;a++){
        for(int b = 1;b < W;b++){
            if(vec.at(a).at(b) !='#'){
                dp[a][b] = dp[a-1][b] + dp[a][b-1];
                dp[a][b]%=MOD;
            }
        }
    }
    /*
    for(int a = 0;a < H;a++){
        for(int b = 0;b < W;b++){
            cout<<dp[a][b]<<" ";
        }
        cout<<endl;
    }
    */
    cout<<dp[H-1][W-1]<<endl;
    return 0;
}


Measured memory_bytes: 5248