akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int H,W,K;
    cin >> H >> W >> K;
    ll dp[H+1][W][W] = {};//i回目、jからkに行く通り数
    rep(i,0,W)dp[0][i][i] = 1;
    rep(i,0,H){
        //線を引く全てのパターン
        rep(j,0,1 << (W-1)){
            int mask = 0b11;
            bool flag = 0;
            rep(k,0,W){
                //cout << bitset<8>(j & mask) << endl;
                //cout << bitset<8>(mask) << endl;
                if((j & mask) == mask){
                    //線が隣り合っているのでループを抜ける
                    flag = 1;
                    break;
                }
                mask <<= 1;
            }
            if(flag)continue;
            //cout << bitset<8>(j) << endl;
            //cout  << endl;
            rep(k,0,W-1){
                //k,k+1の間に線がある
                if(j & (1 << k)){
                    rep(l,0,W)swap(dp[i][k][l], dp[i][k+1][l]);
                }
            }
            rep(k,0,W)rep(l,0,W){
                dp[i+1][k][l] += dp[i][k][l];
                dp[i+1][k][l] %= MOD;
            }
            rep(k,0,W-1){
                //k,k+1の間に線がある
                if(j & (1 << k)){
                    rep(l,0,W)swap(dp[i][k][l], dp[i][k+1][l]);
                }
            }
        }
    }
    cout << dp[H][0][K-1] << endl;
    //cout  << endl;
    rep(i,0,W)rep(j,0,W){
        //cout << dp[H][i][j] << " \n"[j==W-1];
    }
}

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

int main() {
    string s; cin >> s;
    if (s[0] == s[1] && s[1] == s[2]) cout << "Yes" << endl;
    else if (s[1] == s[2] && s[2] == s[3]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 1234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int ans[] = { 0,1,3,1,2,1,2,1,1,2,1,2,1 };
int x, y;

int main()
{
     in >> x >> y;
     out << (ans[x] == ans[y] ? "Yes" : "No") << std::endl;
     return 0;
}

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

using namespace std;

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

    vector<long long> b(n);
    vector<long long> bc(n);

    for(int i=0;i<n;i++){
        cin>>b.at(i);
        bc.at(i) = b.at(i);
    }

    sort(b.begin(),b.end());

    long long f,s;
    long double fv,sv;
    f = n/2;
    s = (n/2)-1;
    fv = b.at(f);
    sv = b.at(s);
    long double stn;
    f = n/2;
    s = (n/2)-1;
    stn = (fv + sv)/2;

    for(int i=0;i<n;i++){
        if(bc.at(i)>=stn){
            cout<<b.at(s)<<endl;
        }else{
            cout<<b.at(f)<<endl;
        }
    }




}

Measured memory_bytes: 5376
#include<iostream>
#include<unordered_set>
using namespace std;
int main()
{
  int n,k;
  cin >> n >> k;
  unordered_set<int> s;
  int d;
  int have = 0;
  for(int i = 0; i < k; i++)
  {
    cin >> d;
    int temp;
    for(int i = 0; i < d; i++)
    {
      cin >> temp;
      if(s.count(temp) == 0)
      {
        s.insert(temp);
        have++;
      }
    }
  }
  cout << n - have << '\n';
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <vector>
#include <climits>
using namespace std;

int main()
{
	unsigned long long N, K;
	cin >> N >> K;

	vector<unsigned long long> A(N);
	for (auto i = 0; i < N; ++i)
	{
		cin >> A[i];
	}

	auto sum = 0llu;
	auto sumBit = 0llu;
	for (auto i = 63; i >= 0; --i)
	{
		auto bit = 1llu << i;
		auto sum1 = 0llu;
		auto sum2 = 0llu;

		for (auto j = 0; j < N; ++j)
		{
			auto target = A[j] & bit;
			sum1 += target;
			sum2 += target ^ bit;
		}

		if ((sumBit + bit) > K || sum1 > sum2)
		{
			sum += sum1;
		}
		else
		{
			sum += sum2;
			sumBit += bit;
		}
	}

	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#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)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
int dx[9] = {0,0,1,1,1,0,-1,-1,-1};
int dy[9] = {0,1,1,0,-1,-1,-1,0,1};

int main(){
    map<PII,ll> f;
    ll H,W,N;
    cin >> H >> W >> N;
    REP(i,N){
        int a,b;
        cin >> a >> b;
        REP(j,9){
            PII p = MP(a+dx[j],b+dy[j]);
            f[p] = f[p] + 1;
        }
    }

    ll ans[10] = {};

    for(pair<PII, ll> p:f){
        int a = (p.first).first;
        int b = (p.first).second;

        if ((a <= 1) or (b <= 1) or (a >= H) or (b >= W)) continue;
        ans[p.second]++;

		//cout << p.first << " " << p.second << endl;
	}
    
    ll em = 0;
    FORq(i,1,9){
        em += ans[i];
    }


    PRINTLLD((H-2)*(W-2)-em);
    FORq(i,1,9){
        PRINTLLD(ans[i]);
    }

}

Measured memory_bytes: 56448
#include<stdio.h>
int s[5];
int top=0;
void push(int x){
  top ++;
  s[top]=x;
}
int pop(){
  top--;
  return s[top+1];
}
 
int main(){
  char a[8];
  int c,b;
  while(scanf("%s",a)!=EOF){
    if(a[0]=='+')push(pop()+pop());
    else if(a[0]=='-'){
      c=pop();
      b=pop();
      push(b-c);}
    else if(a[0]=='*')push(pop()*pop());
    else push(atoi(a));
  }
  printf("%d\n",pop());
  return 0;
}


Measured memory_bytes: 2136
S = list(input())

def is_same(S):
    if len(S) % 2 != 0:
        return False
    mid = len(S) // 2
    S1 = S[:mid]
    S2 = S[mid:]
    for s1, s2 in zip(S1, S2):
        if s1 != s2:
            return False
    return True

for i in range(len(S)):
    S.pop()
    if is_same(S):
        print(len(S))
        break

Measured memory_bytes: 3064
#include<stdio.h>

int main(void)
{
  int i=0,j;
  char str[11],ans[11];
  scanf("%s",str);
  while(str[i] != '\0')
    {
      if(str[i] == 'B')
	{
	  j=i;
	  while(str[j] != '1' && str[j] != '0')
	    {
	      if(j<0)
		{
		  break;
		}
	      j--;
	    }
	  str[j] = '-';
	}
      i++;
    }
  i=0;
  while(str[i] != '\0')
    {
      if(str[i] == '1' || str[i] == '0')
	{
	  printf("%c",str[i]);
	}
      i++;
    }
  printf("\n");
  return 0;
}


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

int main(){
    int minP, minD, tmp;
    cin >>tmp;
    minP = tmp;
    for(int i = 0; i < 2; i++){
        cin >>tmp;
        if(minP > tmp) minP = tmp;
    }
    cin >>tmp;
    minD = tmp;
    cin >>tmp;
    if(minD > tmp) minD = tmp;
    cout <<minP + minD - 50 <<endl;
    return 0;
}

Measured memory_bytes: 0
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  console.log(' ' + buildMaxHeap(lines.shift().split(' ').map(Number)).join(' '));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest = i;
    left = 2 * i + 1;
    right = 2 * i + 2;
    if (left >= n && right >= n) return;
    if (left < n && arr[left] > arr[largest]) largest = left;
    if (right < n && arr[right] > arr[largest]) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
  return arr;
}



Measured memory_bytes: 110724
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 1e6+1;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;

  if(n < 0){// n < 0 にも対応
    n *= -1;
    x = inv[x];
  }

  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n /= 2;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }

  return ret;
}

vi MP(string s){
  vi A(s.size()+1);
  A[0] = -1;
  int j = -1;
  rep(i,s.size()) {
    while(j >= 0 && s[i] != s[j]) j = A[j];
    j++;
    A[i+1] = j;
  }
  return A;
}

vi Manacher(string s){
  vi R(s.size());
  int i = 0, j = 0;
  while(i < s.size()){
    while(i-j >= 0 && i+j < s.size() && s[i-j] == s[i+j]) ++j;
    R[i] = j;
    int k = 1;
    while(i-k >= 0 && i+k < s.size() && k+R[i-k] < j) R[i+k] = R[i-k], k++;
    i += k; j -= k;
  }
  return R;
}

vi Z_algorithm(string &s){
  vi Z(s.size());
  Z[0] = s.size();
  int i = 1, j = 0;
  while(i < s.size()){
    while(i+j < s.size() && s[j] == s[i+j]) j++;
    Z[i] = j;
    if(j == 0){++i; continue;}
    int k = 1;
    while(i+k < s.size() && k+Z[k] < j) Z[i+k] = Z[k], ++k;
    i += k; j -= k;
  }
  return Z;
}

int main(){
  string s; cin >> s;
  int cnt = 0;
  int q; cin >> q;
  while(q--){
    int t,f; string c;
    cin >> t;
    if(t == 1){
      cnt++;
    }
    else{
      cin >> f >> c;
      if((f == 1 && cnt%2 == 0) || (f == 2 && cnt%2 == 1)){
        s.insert(0,c);
      }
      else{
        s.push_back(c[0]);
      }
    }
  }
  if(cnt%2 == 1) reverse(all(s));
  cout << s << endl;
}


Measured memory_bytes: 900
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import Counter 
from collections import defaultdict
def main():
    n = int(readline())
    a = [int(i) for i in readline().split()]
    odd = Counter(a[::2]).most_common(2)
    even = Counter(a[1::2]).most_common(2)
    odd.append((-1, 0))
    even.append((-1, 0))
    if odd[0][0] == even[0][0]:
        print(min(n-odd[1][1]-even[0][1], n-odd[0][1]-even[1][1])) 
    else:
        print(n-odd[0][1]-even[0][1])
if __name__ == '__main__':
    main()


Measured memory_bytes: 16216
def count_baisuu(a, b):
  return b - (a % b)
  
def main():
  n = int(input())
  alist = []
  blist = []
  ab = []
  for i in range(n):
    a, b = input_list()
    ab.append((a, b))
    alist.append(a)
    blist.append(b)
  
  s = 0
  res = 0
  for i in range(n-1, -1, -1):
    alist[i] += res
    
    if alist[i] % blist[i] == 0:
      continue
    res += blist[i] - (alist[i]%blist[i])
  print(res)
  exit()
  dp = [0]*n
  i = n - 1
  res = 0
  for a, b in reversed(ab):
    if i != n-1:
      res += dp[i]
    a += res
    if a % b == 0:
      continue
    if a < b:
      dp[i] = b - a
    else:
      dp[i] = count_baisuu(a, b)
    i -= 1
  print(dp)
  
  

import math
import fractions
from functools import reduce


def input_list():
  return map(int, input().split())

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
main()

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

const int INF = 1001001001;

int x[110];
int y[110];

int func(int y){
  int sum=0;
  int x=y;
  while(x!=0){
    sum+=x%10;
    x/=10;
  }
  return sum;
}
int main() {
 int N,K;
 cin>>N>>K;
 vector<int>l(N);
 for(int i=0;i<N;i++){
   cin>>l.at(i);}
 sort(l.begin(),l.end());
 reverse(l.begin(),l.end());
 int ans=0;
 for(int i=0;i<K;i++){
  ans+=l.at(i);
 }
 cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()
S = S + "8"

a = []
f = S[0]
l = 0
for i in range(1, N+1):
    if f != S[i]:
        a.append(i-l)
        l = i
        f = S[i]
        

if S[0] == '0':
    a = [0] + a

SUM = sum(a[0:0+2*K+1])

MAX = max(0, SUM)
for i in range(2, len(a)):
    if i % 2 == 0:
        try:
            SUM = SUM - (a[i-2]+a[i-1]) + (a[i+2*K-1]+a[i+2*K])
        except:
            try:
                SUM = SUM - (a[i-2]+a[i-1]) + (a[i+2*K-1])
            except:
                break
        
        MAX = max(MAX, SUM)


print(MAX)

Measured memory_bytes: 4980
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
	var s = next();
	var t = next();
	for(var i = 0; i < s.length; i++){
		if(s[i] != t[i]){
			myout("No");
			return;
		}
	}
	myout("Yes");
}


Measured memory_bytes: 29984
#include <stdio.h>
#include <string.h>
#define LEN 100005
 
typedef struct pp {
  char name[100];
  int t;
} P;
 
P Q[LEN];
int head, tail, n;
 
void enqueue(P x) {
  Q[tail] = x;
  tail = (tail + 1) % LEN;
}
 
P dequeue() {
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}
 
int min(int a,int b) {
  return a < b ? a : b; 
}
 
int main() {
  int elaps = 0, c;
  int i, q;
  P u;
  
  scanf("%d %d",&n ,&q);
  for(i=1; i<=n; i++) {
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1; tail = n + 1;
 
  while(head != tail) {
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if(u.t > 0) enqueue(u);
    else {
      printf("%s %d\n",u.name,elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 11896
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmp = 0;
double tmpd = 0.0;


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

    Int w[100000];
    Int ws[10000];
    Int n;
    cin >> n;
    for(Int i=0; i<n; i++){
        cin >> w[i];
        if(i==0){
            ws[i] = w[i];
            continue;
        }
        ws[i] = ws[i-1] + w[i];
    }

    Int min = 10000000;
    Int sum = ws[n-1];
    for(Int i=0; i<n; i++){
        min = abs(sum-2*ws[i]) < min ? abs(sum-2*ws[i]) : min;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
int N,K;
int f(int X,vi &A,vi &B){//負
  int ret=0;
  rep(i,0,N){
    if(A[i]<0){
      int Y=(-X-A[i]-1)/-A[i];
      int Z=dislow(A,Y);
      ret+=N-Z;
    }
    else if(A[i]>0){
      int Y=(-X+A[i]-1)/A[i];
      int Z=dislow(B,Y);
      ret+=N-Z;
    }
  }
  return ret/2;
}
int g(int X,vi &A,vi &B){//正
  int ret=0;
  rep(i,0,N){
    if(A[i]<0){
      int Y=X/-A[i];
      int Z=disup(B,Y);
      ret+=Z;
      if(A[i]*A[i]<=X) ret--;
    }
    else if(A[i]>0){
      int Y=X/A[i];
      int Z=disup(A,Y);
      ret+=Z;
      if(A[i]*A[i]<=X) ret--;
    }
    else ret+=N-1;
  }
  return ret/2;
}
signed main(){
  cin>>N>>K;
  vi A(N);
  rep(i,0,N) cin>>A[i];
  sort(ALL(A));
  A.pb(INF);
  vi B(N);
  rep(i,0,N) B[i]=-A[i];
  sort(ALL(B));
  B.pb(INF);
  int P=dislow(A,0),Q=disup(A,0),R=P*(N-Q),S=R+(Q-P)*(N-Q+P)+(Q-P)*(Q-P-1)/2;
  if(R>=K){
    int left=-INF,right=-1;
    while(left+1<right){
      int mid=(left+right)/2;
      if(f(mid,A,B)>=K) right=mid;
      else left=mid;
    }
    int ans=right;
    if(f(left,A,B)>=K) ans=left;
    cout<<ans<<endl;
  }
  else if(S>=K){
    cout<<0<<endl;
  }
  else{
    int left=1,right=INF;
    while(left+1<right){
      int mid=(left+right)/2;
      if(g(mid,A,B)>=K) right=mid;
      else left=mid;
    }
    int ans=right;
    if(g(left,A,B)>=K) ans=left;
    cout<<ans<<endl;
  }
  }



Measured memory_bytes: 6500
from collections import Counter


def main():
    H, W = map(int, input().split())
    a = ""
    for _ in range(H):
        a += input()
    c = Counter(a)
    cnt = [0] * 4
    for _, v in c.items():
        cnt[v % 4] += 1

    if cnt[3] > 0:
        cnt[1] += 1
        cnt[2] += 1
        cnt[3] -= 1

    if H % 2 == 1 and W % 2 == 1:
        if cnt[3]:
            return "No"
        if cnt[1] != 1:
            return "No"
        if cnt[2] > (H - 1) // 2 + (W - 1) // 2:
            return "No"
        return "Yes"
    elif H % 2 == 0 and W % 2 == 0:
        if cnt[1] or cnt[2] or cnt[3]:
            return "No"
        else:
            return "Yes"
    else:
        # Hが奇数，Wが偶数
        if W % 2 == 1:
            tmp = W
            W = H
            H = tmp
        if cnt[1] or cnt[3]:
            return "No"
        if cnt[2] > W // 2:
            return "No"
        return "Yes"


print(main())


Measured memory_bytes: 3316
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	cout<<b+min(a+b+1,c)<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n, m, x, y;
    cin >> n >> m >> x >> y;

    vector<ll> a(n), b(m);

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
    }

    sort(a.begin(), a.end());
    sort(b.begin(), b.end());

    for (int z = x + 1; z <= y; z++)
    {
        if (z > *a.rbegin() && z <= *b.begin())
        {
            cout << "No War" << endl;
            return 0;
        }
    }

    cout << "War" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int X;
    cin >> X;
    int k=1;
    while(X>k*(k+1)/2){
        k++;
    }
    cout << k << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int n,x;
    cin>>n>>x;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    
    int sum=0,c=1;
    for(int i=0;i<n;i++)
    {
        sum+=a[i];
        if(sum<=x)
            c++;
    }
    cout<<c<<endl;
}

Measured memory_bytes: 256
# 20/5/28
from collections import deque

N, Q = [int(x) for x in input().split()]
AL = [[] for _ in range(N + 1)]
for i in range(1, N):
    a, b = [int(x) for x in input().split()]
    AL[a].append(b)
    AL[b].append(a)

cnt = [0] * (N + 1)
for j in range(Q):
    p, x = [int(x) for x in input().split()]
    cnt[p] += x

visited = [False] * (N + 1)
stk = deque([1])
while stk:
    root = stk.pop()
    visited[root] = True
    for v in AL[root]:
        if not visited[v]:
            cnt[v] += cnt[root]
            stk.append(v)

s = " ".join(map(str, cnt[1:]))
print(s)

Measured memory_bytes: 67172
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define MAX 200005
#define INF 200005

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  vector<int> L(n);
  rep(i, n){
    cin >> L[i];
  }
  sort(L.begin(), L.end());
  int ans=0;
  for(int i=n-1; i>=2; i--){
    for(int j=i-1; j>=1; j--){
      int num=upper_bound(L.begin(), L.begin()+j, L[i]-L[j])-L.begin();
      num=j-num;
      ans+=num;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
listT = []
index=0
while index < n:
    h = int(input())
    listT.append(h)
    index+=1
listT.sort()
if n == k:
    print(listT[len(listT)-1]-listT[0])
else:
    mini=1000000000
    index =0
    while index < n-k+1:
        if listT[index+k-1]-listT[index] < mini:
            mini = listT[index+k-1]-listT[index]
        index+=1
    print(mini)


Measured memory_bytes: 7384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  for(int i=0; i< s.size(); i++){
    s[i] = (s[i] - 'A' + n)%26 + 'A'; 
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <string.h>
using namespace std;

int main() {
   char s[5];
   cin >> s;
   
   int price = 700;
   for (int i = 0; i < 3; i++) {
       if (s[i] == 'o') price += 100;
   }
   cout << price << endl;
}

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

int main(){
  int N;cin>>N;
  int T[N];
  int all=0;
  for(int i=0;i<N;i++){
    cin>>T[i];
    all+=T[i];
  }
  int M;cin>>M;
  int P[M],X[M];
  for(int i=0;i<M;i++) cin>>P[i]>>X[i];
  for(int i=0;i<M;i++) cout<<all-T[P[i]-1]+X[i]<<endl;
}

Measured memory_bytes: 3632
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

N, S = map(int,input().split())
x = list(map(int,input().split()))
x.append(S)
x = sorted(x)
t = x[1]-x[0]

for k in range(N):
    t = gcd(t,x[k+1]-x[k])

print(t)

Measured memory_bytes: 14252
from collections import Counter

N,M=map(int,input().split())
mod = 10**9+7

factorial=[1 for i in range(10**6)]
for i in range(2,10**6):
    factorial[i] = factorial[i-1]*i % mod

def comb(n,k):
    return (factorial[n]*pow(factorial[n-k]*factorial[k], -1, mod))%mod

def factorize(n):
    out=[]
    i = 2
    while 1:
        if n%i==0:
            out.append(i)
            n //= i
        else:
            i += 1
        if n == 1:break
        if i > int(n**.5+3):
            out.append(n)
            break
    
    return out
  
c = Counter(factorize(M))

ans = 1
for k in c.keys():
  ans *= comb(c[k]+N-1,N-1)
  ans %= mod
  
print(ans)

Measured memory_bytes: 49168
n = int(input())
s = list(input())
ans = 0
for i in range(n-2):
    if s[i] =="A":
        a = s[i] + s[i+1] + s[i+2]
        if a=="ABC":
            ans +=1
        else:
            continue
    else:
        continue
print(ans)

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

using namespace std;

int main()
{
    int N;
    cin >> N;
    int a[N];
    int b[N] = {0};
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        if (i % 2 == 0)
        {
            b[0] += a[i];
        }
        else
        {
            b[0] -= a[i];
        }
    }
    b[0] /= 2;
    for (int i = 1; i < N; i++)
    {
        b[i] = a[i - 1] - b[i - 1];
    }

    for (int i = 0; i < N; i++)
    {
        cout << b[i] * 2;
        if (i != N - 1)
        {
            cout << ' ';
        }
        else
        {
            cout << endl;
        }
    }
}

Measured memory_bytes: 2048
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if (a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}


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

using namespace std;

int a, b, c;
int x, y, minn;

int main()
{
  minn = INT_MAX;
  cin >> a >> b >> c >> x >> y;
  for (int i = 0; i <= 2 * max(x, y); i++) {
    int s = i * c + max(0, x - i / 2) * a + max(y - i / 2, 0) * b;
    if (s < minn)
      minn = s;
  }
  cout << minn;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=int(input())
res = 0
for i in range(2,int(N**0.5)+1):
    tmp = N
    tmp2 = 0
    while tmp > 0:
        tmp2 += tmp%i
        tmp = tmp // i
    if tmp2==S:
        res = i
        break
if res == 0:
    for i in range(int(N**0.5)+1,0,-1):
        b = (N-S)//i + 1
        if i*(b-1)+S != N:
            continue
        tmp = N
        tmp2 = 0
        if b<=1:
            continue
        while tmp > 0:
            tmp2 += tmp % b
            tmp = tmp // b
        if tmp2 == S:
            res = b
            break
if N==S:
    print(N+1)
elif res==0 or N<S:
    print(-1)
else:
    print(res)

Measured memory_bytes: 3188
// E - Sequence Sum
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
pair<ll,ll> divmod(ll p,ll m){return {p/m, p%m};}

int main(){
	ll n; int x, m; cin>>n>>x>>m;
	vector<int> X(m, -1);
	vector<int> P;
	ll sum_p = 0;
	while(X[x] < 0){ // preset
		X[x] = P.size(); // pre length
		P.push_back(sum_p); // pre sum_p
		sum_p += x; // now sum_p
		x = (ll)x*x % m;
	}
	ll cyc_times, nxt_len;
	tie(cyc_times, nxt_len) = divmod(n - X[x], P.size() - X[x]);
	ll cyc = (sum_p - P[X[x]]) * cyc_times;
	ll remain = P[X[x] + nxt_len];
	cout<< cyc + remain <<endl;
}


Measured memory_bytes: 3956
N=int(input())
A=list(map(int, input().split()))
B=[]
for i in range (N):
    if A[i]%2==0:
        B.append(A[i])
count=0
for j in range(len(B)):
    if B[j]%3==0 or B[j]%5==0:
        count=count+1

if count==len(B):
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3064
#include <iostream>
#include <string.h>

using namespace std;

int main(int argc, char const *argv[])
{
    string s;
    cin >> s;

    long long cnt01 = 0, cnt10 = 0;

    for (size_t i = 0; i < s.size(); i++)
    {
        if (i%2==0) {
            if (s[i] == '0') {
                cnt10++;
            }
            else cnt01++;
        }
        else {
            if (s[i] == '0') {
                cnt01++;
            }
            else cnt10++;
        }
    }

    cout << min(cnt01, cnt10) << endl;
    
    return 0;
}


Measured memory_bytes: 512
import decimal

temp = input().split()

A, B = [int(num) for num in temp]
# print(A, B)

tax_rate_A = decimal.Decimal("0.08")
tax_rate_B = decimal.Decimal("0.10")


def calc_price_list(tax, tax_rate):
    temp = tax / tax_rate
    price_l = temp.to_integral_value(rounding=decimal.ROUND_UP)
    
    temp = (tax + 1) / tax_rate
    price_u = temp.to_integral_value(rounding=decimal.ROUND_UP)

    return list(range(int(price_l), int(price_u)))


price_A_list = calc_price_list(A, tax_rate_A)
# print(price_A_list)
price_B_list = calc_price_list(B, tax_rate_B)
# print(price_B_list)

price_set = set(price_A_list) & set(price_B_list)
# print(price_set)

if len(price_set) == 0:
    print("-1")
else:
    price_list = sorted(list(price_set))
    price = price_list[0]
    print(price)

Measured memory_bytes: 5076
import math


def sosu(N):
    tbl = [0] * (N + 1)
    tbl[0] = 1
    tbl[1] = 1
    lim = math.ceil(math.sqrt(N))
    for i in range(2, lim + 1):
        if tbl[i] == 0:
            for j in range(2, N + 1):
                tmp = i * j
                if tmp > N: break
                tbl[tmp] = 1
    return tbl


ptbl = sosu(10 ** 5)

memo = [0] * (10 ** 5 + 1)
for i in range(2, len(memo)):
    memo[i] = memo[i - 1]
    if ptbl[i] == 1: continue
    if ptbl[(i + 1) // 2] == 0:
        memo[i] += 1

#
for _ in range(int(input())):
    l, r = [int(_) for _ in input().split()]
    print(memo[r] - memo[l - 1])

Measured memory_bytes: 5108
n,q=map(int,input().split())
e=[[] for i in range(n)]
for i in range(n-1):
  a,b=map(lambda x:int(x)-1,input().split())
  e[a].append(b)
  e[b].append(a)
ps=[0 for i in range(n)]
for i in range(q):
  p,x=map(int,input().split())
  ps[p-1]+=x

s=[-1 for i in range(n)]
sc=[0]
s[0]=0
while sc:
  nsc=[]
  for i in sc:
    s[i]+=ps[i]
    for j in e[i]:
      if s[j]==-1:
        nsc.append(j)
        s[j]=s[i]
  sc=nsc


print(" ".join(map(str,s)))

Measured memory_bytes: 161812
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my $s = <STDIN>);
my @p;
for my $i (0..length($s)-1) {
  push @p, $i if "W" eq substr($s, $i, 1);
}
my $ans = 0;
for my $i (0..@p-1) {
  $ans += $p[$i] - $i;
}
say $ans;

Measured memory_bytes: 7424
n, *v = map(int, open(0).read().split())
o, e = v[::2], v[1::2]
o.sort();e.sort()

on = []
prev = 0
cnt = 0
for i in o:
  if i==prev: cnt += 1
  else: on.append([prev,cnt]);cnt=1
  prev = i
on.append([prev,cnt])
on.sort(key=lambda x:x[1])


en = []
prev = 0
cnt = 0
for i in e:
  if i==prev: cnt += 1
  else: en.append([prev,cnt]);cnt=1
  prev = i
en.append([prev,cnt])
en.sort(key=lambda x:x[1])

if on[-1][0]==en[-1][0]:
  o=list(zip(*on))[1]
  e=list(zip(*en))[1]
  ans = sum(o)+sum(e)
  print(ans-max(o[-2]+e[-1],o[-1]+e[-2]))
else:
  o=list(zip(*on))[1]
  e=list(zip(*en))[1]
  print(sum(o)+sum(e)-o[-1]-e[-1])


Measured memory_bytes: 22692
using System;
using System.Collections.Generic;
using System.Linq;
using static Scanner;

class Program
{
    static void Main() => new Program().Solve();

    public void Solve()
    {
        int x = ReadInt();
        int a = x;
        int c = 1;
        while (a != 0)
        {
            a += x;
            a %= 360;
            c++;
        }
        Console.WriteLine(c);
    }
}


static class Scanner
{
    static Queue<string> que = new Queue<string>();

    public static string Read()
    {
        if (!que.Any()) foreach (var s in Console.ReadLine().Split()) que.Enqueue(s);
        return que.Dequeue();
    }
    public static int ReadInt() => int.Parse(Read());
    public static long ReadLong() => long.Parse(Read());
    public static double ReadDouble() => double.Parse(Read());
    public static decimal ReadDecimal() => decimal.Parse(Read());

    public static IEnumerable<string> Read(long n)
    {
        for (long i = 0; i < n; i++) yield return Read();
    }
    public static IEnumerable<int> ReadInt(long n) => Read(n).Select(int.Parse);
    public static IEnumerable<long> ReadLong(long n) => Read(n).Select(long.Parse);
    public static IEnumerable<double> ReadDouble(long n) => Read(n).Select(double.Parse);
    public static IEnumerable<decimal> ReadDecimal(long n) => Read(n).Select(decimal.Parse);
}

Measured memory_bytes: 28276
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

list<int> lst;
list<int>::iterator it;
int ans[400000];
void A(){
	it++;
	if(it == lst.end())it = lst.begin();
}
void B(){
	if(it == lst.begin())it = lst.end();
	it--;
}

signed main(){
	int n, m, q;
	scanf("%lld%lld%lld", &n, &m, &q);
	rep(i,n)lst.push_back(i);
	it = lst.begin();
	rep(i,m){
		int x;
		scanf("%lld", &x);
		rep(j,x)x%2 == 0 ? A() : B();
		ans[*it] = 1;
		it = lst.erase(it);
		if(it == lst.end())it = lst.begin();
	}
	rep(i,q){
		int x;
		scanf("%lld", &x);
		printf("%lld\n", (int)!ans[x]);
	}
	return 0;
}








Measured memory_bytes: 11028
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
int count = 0;
for(int i = 1 ;i < n+1;i+=2){
  count = 0;
  for(int j = 1;j < i+1;j++){
    if(i%j==0){
      count++;
    }
   
  }
   if(count == 8){
      ans++;
    // cout<<i <<endl;
    }
  count = 0;
}

cout<<ans <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
//cout << fixed << setprecision(0)
int main() { 
  int n,ans;bool d[100];
  cin >> n;
  rep(i,100){
    d[i] = false;
  }
  rep(i,n){
    int a;cin >> a;a--;
    if(!d[a]){
      d[a] = true;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A=sc.nextInt();
		int B=sc.nextInt();
		if(A<=8&&B<=8) {
			System.out.println("Yay!");
		}else {
			System.out.println(":(");
		}
	}

}


Measured memory_bytes: 23764
# 115b

def atc_115b(N: int, Pi_input: int) -> int:
    Pi_input = sorted(Pi_input)
    max_price = Pi_input.pop()
    return int(sum(Pi_input) + max_price / 2)

N_input_value = int(input())
Pi_input_value = []
for i in range(0, N_input_value):
    Pi_input_value.append(int(input()))
print(atc_115b(N_input_value, Pi_input_value))


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define P pair<int,int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define ll long long

const ll mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
mint table[2200000];
void fact(){
    table[0] = table[1] = 1;
    for(ll i = 2; i < 2200000; i++){
        table[i] = table[i-1] * i;
    }
}

int main() {
    int X, Y;
    cin >> X >> Y;
    if (X > Y) swap(X, Y);
    int tot = (X + Y) / 3;
    int r = -1;
    for(int i = 0; i <= tot; i++){
        int t1 = i + (tot - i) * 2;
        int t2 = i * 2 + (tot - i);
        if(t1 > t2) swap(t1,t2);
        if(t1 == X && t2 == Y){
            r = i;
            break;
        }
    }
    if(r == -1){
        cout << 0 << endl;
        return 0;
    }
    fact();
    mint ans = table[tot];
    ans /= table[r];
    ans /= table[tot - r];
    cout << ans.x << endl;
}


Measured memory_bytes: 17408
#include<bits/stdc++.h>
using namespace std;
using li = long int;
const int MAX = 1000000007;

int N, i, j, k;
vector<int> h(200010), dp(200010, MAX);

int main(){
    cin >> N;
    
    for(int i = 1; i <= N; i++) cin >> h[i];

    dp[1] = 0, dp[2] = abs(h[2] - h[1]);
    for(i = 2; i < N; i++){
        for(j = 1; j <= 2; j++){
            int k = min(i + j, N);
            dp[k] = min(dp[k-1]+abs(h[k]-h[k-1]), 
                        dp[k-2]+abs(h[k]-h[k-2]));
        }
    }

    cout << dp[N] << endl;
    return 0;
}

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

X_int = int(X, 2)
cnt1 = bin(X_int).count('1')
pcXi01 = cnt1 + 1
pcXi10 = cnt1 - 1
zero_idx = N + 5
if cnt1 == 1:
  for i in range(N):
    if X[i] == '1':
      zero_idx = i

if pcXi10 < 1:
  pcXi10 = 1
Xmod01 = X_int % pcXi01
Xmod10 = X_int % pcXi10

tmp01 = [1]
tmp10 = [-1]
for i in range(N - 1):
  tmp01.append(tmp01[i]*2 % pcXi01)
  tmp10.append(tmp10[i]*2 % pcXi10)

init_n = [0] * N
next_n = [0] * N
for i in range(N):
  if X[i] == '0':
    next_n[i] = (Xmod01 + tmp01[N - 1 - i]) % pcXi01
  else:
    next_n[i] = (Xmod10 + tmp10[N - 1 - i]) % pcXi10

for i in range(N):
  fn = 0
  if i == zero_idx:
    print(0)
    continue

  n = next_n[i]
  fn += 1
  while n != 0:
    n = n % bin(n).count('1')
    fn += 1
  
  print(fn)
  

Measured memory_bytes: 34652
import itertools
from dataclasses import dataclass, field
from typing import List


@dataclass
class Cell:
    i: int
    j: int
    color: str

    def to_red(self):
        return Cell(self.i, self.j, color='R')


@dataclass
class Board:
    cells: List[Cell] = field(default_factory=list)
    count: int = 0

    @classmethod
    def create(cls, H: int, W: int, C: List[List[str]]):
        cells = []
        for i in range(H):
            for j in range(W):
                cell = Cell(i + 1, j + 1, C[i][j])
                cells.append(cell)

        return Board(cells)

    def count_black(self) -> int:
        return len([c for c in self.cells if c.color == '#'])

    def paint_row(self, row: int):
        new_cells = []

        for cell in self.cells:
            if cell.i == row:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)

    def paint_col(self, col: int):
        new_cells = []

        for cell in self.cells:
            if cell.j == col:
                new_cells.append(cell.to_red())
            else:
                new_cells.append(cell)

        return Board(new_cells)


def actual(H, W, K, C):
    count = 0

    patterns = list(itertools.product(range(2), repeat=H + W))

    for pattern in patterns:
        board = Board.create(H, W, C)

        row_info = pattern[:H]
        col_info = pattern[H:]

        for row_idx, row in enumerate(row_info, start=1):
            if row == 1:
                board = board.paint_row(row_idx)

        for col_idx, col in enumerate(col_info, start=1):
            if col == 1:
                board = board.paint_col(col_idx)

        if board.count_black() == K:
            count += 1

    return count

H, W, K = map(int, input().split())
C = [list(input()) for _ in range(H)]

print(actual(H, W, K, C))  

Measured memory_bytes: 11436
a, b = gets.chomp.split(" ").map(&:to_i)
(1..100000).each do |i|
    hachi = i * 8 / 100
    zyuu = i *10 / 100
    if hachi.floor == a && zyuu.floor == b
        puts i
        exit
    end
end
puts "-1"


Measured memory_bytes: 14312
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
A = readInts()

ans = 1000
money = 1000
kabu = 0
for i in range(1,n):
    if A[i-1] < A[i]:
        kabu = money // A[i-1]
        money -= kabu * A[i-1]
        money += kabu * A[i]
        kabu = 0
print(money)


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

int main(void)
{
  
int n,a[9],b[10],i;
for(i=0;i<9;i++){
    scanf("%d",&a[i]);
}
scanf("%d",&n);
for(i=0;i<n;i++){
  scanf("%d",&b[i]);
}
//処理
for(i=0;i<9;i++){
  for(int j=0;j<n;j++){
    if(a[i]==b[j]){
      a[i]=0;
    }
  }
}

if(a[0]==a[1] && a[0]==a[2] && a[1]==a[2])printf("Yes");
else if(a[3]==a[4] && a[3]==a[5] && a[4]==a[5])printf("Yes");
else if(a[6]==a[7] && a[6]==a[8] && a[7]==a[8])printf("Yes");
else if(a[0]==a[3] && a[0]==a[6] && a[3]==a[6])printf("Yes");
else if(a[1]==a[4] && a[1]==a[7] && a[4]==a[7])printf("Yes");
else if(a[2]==a[5] && a[2]==a[8] && a[5]==a[8])printf("Yes");
else if(a[0]==a[4] && a[0]==a[8] && a[4]==a[8])printf("Yes");
else if(a[2]==a[4] && a[2]==a[6] && a[4]==a[6])printf("Yes");
else printf("No");

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <string.h>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int n;
ll a[101];

#define MAX_V 110
#define INF 1e9+10
struct edge {ll to,cap,rev;};

vector<edge> G[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,ll cap){
  G[from].push_back((edge){to,cap,(ll)G[to].size()});
  G[to].push_back((edge){from,0,(ll)G[from].size()-1});
}

ll dfs(int v,int t,ll f){
  if(v==t) return f;
  if(f==0) return 0;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      ll d=dfs(e.to,t,min(f,(ll)e.cap));
      if(d>0){
        e.cap-=d;
        G[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

ll max_flow(int s,int t){
  ll flow=0;
  for(;;){
    memset(used,0,sizeof(used));
    ll f=dfs(s,t,INF);
    if(f==0) return flow;
    flow+=f;
  }
}


int main(){
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n;i++){
    cin>>a[i];
    if(a[i]>=0){
      add_edge(i,101,a[i]);
      ans+=a[i];
    }else add_edge(0,i,-a[i]);
  }

  for(int i=1;i<=n;i++){
    for(int j=2;i*j<=n;j++){
      add_edge(i,i*j,INF);
    }
  }

  ans=ans-max_flow(0,101);
  cout<<ans<<endl;

  return 0;
}


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

sys.setrecursionlimit(1000000)
mod = 1000000007
#1_A
"""
import math

n = int(input())
m = n
ans = []
i = 2
k = math.sqrt(n)
while i <= k:
    if n%i == 0:
        n = n//i
        ans.append(i)
        i -= 1
        if n == 1:
            break
    i += 1
if len(ans) == 0 or n != 1:
    ans.append(n)
print(m,end = ": ")
for i in range(len(ans)-1):
    print(ans[i], end = " ")
print(ans[-1])
"""

#1_B
"""
m,n = map(int, input().split())
b = bin(n)[2:]
num = [m]
for i in range(len(b)-1):
    num.append(num[-1]**2%1000000007)
ans = 1
for i in range(len(b)):
    ans *= num[i] if b[len(b)-1-i] == "1" else 1
    ans %= 1000000007
print(ans)
"""

#1_C
"""
import math

l = int(input())
a = list(map(int, input().split()))
dict = {}
for n in a:
    ans = []
    i = 2
    k = math.sqrt(n)
    dic = {}
    while i <= k:
        if n%i == 0:
            n = n//i
            ans.append(i)
            i -= 1
            if n == 1:
                break
        i += 1
    if len(ans) == 0 or n != 1:
        ans.append(n)
    for i in ans:
        if i in dic:
            dic[i] += 1
        else:
            dic[i] = 1
    for i in dic.keys():
        if i in dict:
            dict[i] = max(dict[i], dic[i])
        else:
            dict[i] = dic[i]
sum = 1
for x,y in dict.items():
    sum *= x**y
print(sum)
"""

#1_D
"""
import math

n = int(input())
m = n
ans = []
i = 2
k = math.sqrt(n)
dic = {}
while i <= k:
    if n%i == 0:
        n = n//i
        ans.append(i)
        i -= 1
        if n == 1:
            break
    i += 1
if len(ans) == 0 or n != 1:
    ans.append(n)
ans = list(set(ans))
sum = m
for i in ans:
    sum *= (1-1/i)
print(int(sum))
"""

#1_E
"""
def gcd(a,b):
    if a==0:
        return b
    return gcd(b%a,a)
a,b = LI()
g = gcd(a,b)
a//=g
b//=g
if b == 1:
    print(0,1)
    quit()
if b < 4:
    f = b-1
else:
    p = []
    x = 2
    m = b
    while x**2 <= b:
        if not m%x:
            p.append(x)
            while not m%x:
                m//=x
        x += 1
    if m != 1:p.append(m)
    f = b
    for i in p:
        f *= (1-1/i)
    f = int(f)
x_ = pow(a,f-1,b)
y_ = (1-a*x_)//b
ans = [x_,y_,abs(x_)+abs(y_)]
for i in range(-10000,10000):
    s = -b*i+x_
    t = a*i+y_
    m = abs(s)+abs(t)
    if m < ans[2]:
        ans = [s,t,m]
    elif m == ans[2] and s <= t:
        ans = [s,t,m]
print(ans[0],ans[1])
"""

#2
#2_A
"""
a,b = LI()
print(a+b)
"""

#2_B
"""
a,b = LI()
print(a-b)
"""

#2_C

a,b = LI()
print(a*b)



Measured memory_bytes: 8172