akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <numeric>

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...)
#endif
#define sz(x) ((int)(x).size())
#define forn(i, n) for (int i = 0; i < (n); i++)

#ifdef DEBUG
struct Timestamper {
  string msg;
  clock_t start;

  Timestamper(const string &_msg) : msg(_msg), start(clock()) {}
  ~Timestamper() {
    eprintf("[ %s ] Time=%.3lfs\n", msg.c_str(), (clock() - start) * 1.0 / CLOCKS_PER_SEC);
  }
} __timestamper("end");
#else
struct Timestamper {};
#endif

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;

const int inf = 1e9;

int main() {
  #ifdef DEBUG
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
  #endif

  int n;
  while (scanf("%d", &n) >= 1) {
    vi as(n), bs(n);
    for (int &x : as) scanf("%d", &x);
    for (int &x : bs) scanf("%d", &x);

    ll ca = 0, cb = 0;
    for (int i = 0; i < n; i++) {
      if (as[i] < bs[i]) {
        ll k = (bs[i] - as[i] + 1) / 2;
        eprintf("ca += %lld\n", k);
        as[i] += 2 * k;
        ca += k;
        if (as[i] > bs[i]) {
          cb++;
          eprintf("cb++\n");
          bs[i]++;
        }
        assert(as[i] == bs[i]);
      } else if (as[i] > bs[i]) {
        eprintf("cb += %lld\n", as[i] - bs[i]);
        cb += as[i] - bs[i];
      }
    }
    eprintf("%lld %lld\n", ca, cb);
    printf("%s\n", ca >= cb ? "Yes" : "No");
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1<<29;
const long double pi = 3.14159265358979323846;
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; }

// ****************************************CODE***************************************//


int n;
ll h[100010];
ll dp[100010];

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

    for(int i = 0; i < 100010; i++) dp[i] = inf;

    dp[0] = 0;

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

    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main(void){
    string s; cin >> s;
  int ans = 700;
  for(int i=0; i<3; i++){
  	if(s[i] == 'o') ans += 100;
  }
  cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3572
#include<stdio.h>
#include<string.h>
int main(void){
char s[10],t[10],u[10];
int sx,tx;
  scanf("%s",s);
  scanf("%s",t);
  scanf("%d",&sx);
  scanf("%d",&tx);
  scanf("%s",u);
  
if(strcmp(s,u)==0){
  sx=sx-1;
  }
 else if(strcmp(t,u)==0){
 tx=tx-1;
 }
 printf("%d ",sx);
 printf("%d",tx);
 return 0;
 }

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main() {
  ll n;
  cin >> n;
  vl a(n);
  rep(i,n){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  cout << a[n-1]-a[0] << 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 n = sc.nextInt();
        int k = sc.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int h = sc.nextInt();
            if (h >= k) {
                ans++;
            }
        }

        System.out.println(ans);

        sc.close();
    }
}


Measured memory_bytes: 48808
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define repreq(i,a,b) for(int i=a;i>=b;i++)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n,y,k;
  cin >> n >> y;
  y /= 1000;
  
  repeq(i,0,n){
    repeq(j,0,n-i){
      k = n - i - j;
      if(10*i + 5*j + k == y) {
        cout << i << ' ' << j << ' ' << k << endl;
        return 0;
      }
    }
  }
  
  cout << "-1 -1 -1" << endl;
  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

SENTINEL = 2000000000

def merge(a, left, mid, right)
  n1 = mid - left
  n2 = right - mid
  l = []
  r = []
  cnt = 0

  (0...n1).each do |i|
    l[i] = a[left + i]
  end
  (0...n2).each do |i|
    r[i] = a[mid + i]
  end

  l[n1] = r[n2] = SENTINEL
  i = j = 0

  (left...right).each do |k|
    if l[i] <= r[j]
      a[k] = l[i]
      i += 1
    else
      a[k] = r[j]
      j += 1
      cnt += n1 - i
    end
  end
  cnt
end

def merge_sort(a, left, right)
  if left+1 < right
    mid = (left + right) / 2
    v1 = merge_sort(a, left, mid)
    v2 = merge_sort(a, mid, right)
    v3 = merge(a, left, mid, right)
    v1 + v2 + v3
  else
    0
  end
end

puts merge_sort(a, 0, n)


Measured memory_bytes: 34296
#include<stdio.h>
#include<string.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
static inline char CH(void)
{
  static char buf[100000],*ptr1=buf,*ptr2=buf;
  return ptr1==ptr2&&(ptr2=(ptr1=buf)+fread(buf,1,100000,stdin),ptr1==ptr2)?EOF:*ptr1++;
}
static inline int IN(void)
{
  int x=0,f=0,c=CH();while(c<48||c>57){f^=c==45,c=CH();}
  while(c>47&&c<58){x=x*10+c-48,c=CH();}return f?-x:x;
}
static inline void OUT(int x){if(x>=10)OUT(x/10);putchar(x%10+48);}
static inline int Pow(int a,int b){return b?Pow(a*a,b>>1)*(b&1?a:1):1;}
int main()
{
  int N,now,len=0,A[531441],B[531441];char T[200001],S[200000];
  now=scanf("%d %s",&N,T);len=strlen(T);fflush(stdin);
  int pw3=Pow(3,N),x=Pow(3,N>>1),y=Pow(3,N-(N>>1));
  rep(i,pw3)B[i]=B[i/3]*3+(3-i%3)%3;
  rep(i,x)
  {
    int temp=i;now=0;
    rep(j,len)
    {
      if(T[j]=='S'){temp=B[temp];if(S[now]=='S')--now;else S[++now]='S';}
      else{++temp;if(temp==x)S[++now]='R',temp=0;}
    }
    rep(j,y)
    {
      int keep=j;
      rep(k,now)
      {
        if(S[k+1]=='S')keep=B[keep];
        else if(S[k+1]=='R')if((++keep)==y)keep=0;
      }
      A[i+j*x]=temp+keep*x;
    }
  }
  rep(i,pw3)OUT(A[i]),putchar(' ');
  return fflush(stdout),0;
}

Measured memory_bytes: 8260
n,k=map(int, input().split())
a_list=[int(i) for i in input().split()]

dic={}

for i in a_list:
    if i in dic:
        dic[i]+=1
    else:
        dic[i]=1

dic2=sorted(dic.items(), key=lambda x:x[1])

ans=0

if len(dic)>k:
    num=len(dic)-k
    for i in range(num):
        ans+=dic2[i][1]

    
print(ans)


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int a, b;
	cin >> a >> b;
	int ans = 0;
	if(a <= 5) ans = 0;
	else if(a <= 12) ans = b / 2;
	else ans = b;
	cout << ans << endl;
}


Measured memory_bytes: 3604
while True:
    x,y = map(int,raw_input().split())
    if x > y:
        print '%s %s' % (y,x)
    elif y > x:
        print '%s %s' % (x,y)
    elif x == 0 and y == 0:
        break
    else:
        print '%s %s' % (x,y)

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

// 💖 Hi, thanks for using ICIE! 💖
// 🔧 To use a custom code template, press Ctrl+Shift+P and select "ICIE Template configure" from the list 🔧
// 📝 If you spot any bugs or miss any features, create an issue at https://github.com/pustaczek/icie/issues 📝

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    int x[100005][3];
    int dp[100005][3];
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> x[i][0] >> x[i][1] >> x[i][2];
    }
    dp[0][0] = x[0][0];
    dp[0][1] = x[0][1];
    dp[0][2] = x[0][2];
    for (int i = 1; i < N; i++) {
        dp[i][0] = x[i][0] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = x[i][1] + max(dp[i - 1][2], dp[i - 1][0]);
        dp[i][2] = x[i][2] + max(dp[i - 1][0], dp[i - 1][1]);
    }
    cout << max(max(dp[N - 1][0], dp[N - 1][1]), dp[N - 1][2]);
}


Measured memory_bytes: 5972
an = [int(input()) for i in range(5)]
an2 = [i%10 for i in an]
an3 = [10 if i ==  0 else i for i in an2]

a=an[an3.index(min(an3))]
an.remove(a)
ans = a
for i in an:
     if i%10 == 0:
          ans += i
     else:
          ans += (i//10)*10+10
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int n, a, b, c, x; cin >> n >> a >> b >> c >> x;
    if(n == 0) break;
    vi y(n);
    for(int i=0;i<n;++i) {
      cin >> y[i];
    }
    int ans = -1;
    for(int i=0;i<n;++i) {
      while(1) {
        ans++;
        if(ans > 10000) break;
        if(x == y[i]) {
          x = (a * x + b) % c;
          break;
        } else {
          x = (a * x + b) % c;
        }
      }
    }
    if(ans > 10000) cout << -1 << endl;
    else cout << ans << endl;
  }
}



Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n;
    cin >> n;
    if(n) cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 3620
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================








int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================

	

	int N, R;
	cin >> N >> R;

	if (N >= 10) {
		cout << R;
		return 0;
	}
	else {
		cout << R  -(100 * N - 1000);
	}







}


Measured memory_bytes: 256
import collections
x=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':x.appendleft(b[7:])
    elif b[6]==' ':
        try:x.remove(b[7:])
        except:pass
    elif len(b)>10:x.popleft()
    elif len(b)>6:x.pop()
print(*x)


Measured memory_bytes: 69732
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvld;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).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; }

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

    int N;
    cin >> N;

    vll A(N);
    rep(i, N) cin >> A[i];

    ll ans = 0;

    rep(i, 60)
    {
        ll count = 0;
        rep(j, N)
        {
            count += A[j] % 2;
            A[j] /= 2;
        }

        ll tmp = 0;
        tmp += 1LL << i;
        tmp %= MOD;
        tmp *= count;
        tmp %= MOD;
        tmp *= (N - count);
        tmp %= MOD;

        ans += tmp;
        ans %= MOD;
    }

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

Measured memory_bytes: 5540
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;
const int MAXN=3e5+1e1;

int a[MAXN];
bool vis[MAXN];

int main(void)
{

	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

	int n,m,ans=0;

	scanf("%d%d",&n,&m);

	for(int i=1;i<=n;i++) a[i]=read<int>();

	for(int i=1;i<=m;i++)
	{
		int u=read<int>();
		int v=read<int>();
		if(a[u]<a[v]) vis[u]=true;
		if(a[u]>a[v]) vis[v]=true;
		if(a[u]==a[v]) vis[u]=vis[v]=true;
	}

	for(int i=1;i<=n;i++) if(!vis[i]) ++ans;

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

	return 0;

}


Measured memory_bytes: 4284
#E
from collections import deque
n = int(input())
matches = [list(a -1 for a in map(int,input().split()))
     for _ in range(n)]
q = deque(range(n))
depth = [0] * n
waiting = [-1] * n

while q:
    a = q.popleft()
    ma = matches[a]
    if not ma:
        continue
    # gyaku kara kanngaeteru
    b = ma.pop()
    if waiting[b] == a:
        depth[a] = depth[b] = max(depth[a],depth[b]) +1
        q.append(a)
        q.append(b)
    else:
        waiting[a] = b
if any(matches):
    print(-1)
else:
    print(max(depth))

Measured memory_bytes: 35364
# -*- coding: utf-8 -*-

N = int(input().strip())

if N == 0:
    ans_list=[0]
else:
    ans_list=[]

while N != 0:
    digit1 = abs( N%(-2) )
    ans_list += [digit1]
    N = (N - digit1) // (-2)
    
print( *ans_list[::-1], sep="" )


Measured memory_bytes: 3060
from math import ceil
d,g = map(int,input().split())
point = [list(map(int,input().split())) for _ in range(d)]
ans = 10**18
for i in range(2**d):
  l = []
  cnt = 0
  s = 0
  for j in range(d):
    if i >> j & 1:
      cnt += point[j][0]
      s += point[j][0]*100*(j+1) + point[j][1]
    else:
      l.append(j)
  if s >= g:
    ans = min(ans,cnt)
    continue
  for j in l:
    if g-s > 100*(j+1)*(point[j][0]-1):
      continue
    else:
      ans = min(ans,cnt+ceil((g-s)/(100*(j+1))))
print(ans)

Measured memory_bytes: 9248
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve(n, k, m):
    ans = 0
    for i in range(k, m):
        # i: 桁数
        if k == 1:
            ans += 9
        else:
            ans += pow(9, k)*comb(i-1, k-1)
    if k == 1:
        ans += int(n[0])
    elif k == 2:
        ans += (int(n[0])-1)*pow(9, k-1)*comb(m-1, k-1)
        j = 1
        while j < m and n[j] == '0':
            j += 1
        if j < m:
            ans += int(n[j]) + pow(9, k-1)*comb(m-1-j, k-1)
    else:
        while m >= k and n.count('0') > m - k:
            n = str(int(n)-1)

        if m > len(n):
            print(ans)
            return ans

        m = len(n)
        a = []
        for i in range(m):
            if len(a) < 3 and n[i] != '0':
                a.append(i)

        if len(a) == 3:
            ans += 1 + int(n[a[2]])-1 + 9*comb(m-1-a[2], 1)
            ans += (int(n[a[1]])-1)*9*comb(m-1-a[1], 1) + 9*9*comb(m-1-a[1], 2)
            ans += (int(n[a[0]])-1)*9*9*comb(m-1-a[0], 2)
    print(ans)
    return ans

def solve2(n, k, m):
    ans = 0
    for i in range(1, int(n)+1):
        if len(str(i)) - str(i).count('0') == k:
            ans += 1
    print(ans)
    return ans

if __name__ == '__main__':
    n = input()
    k = INT()
    m = len(n)

    solve(n,k,m)
    #solve2(n,k,m)
    #for i in range(10000):
    #    print(i)
    #    if solve(str(i), k, len(str(i))) != solve2(str(i), k, len(str(i))):
    #        break


Measured memory_bytes: 10248
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true){
			int b=sc.nextInt();
			int r=sc.nextInt();
			int g=sc.nextInt();
			int c=sc.nextInt();
			int s=sc.nextInt();
			int t=sc.nextInt();
			if(b==0&&r==0&&g==0&&c==0&&s==0&&t==0)break;
			int m=100;
			m+=b*15+r*15+(b*5+r*3)*16+g*7+c*2-(t-s)*3;
			System.out.println(m);
		}
	}
}

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

int main() {
	int T, n, k, r, sg = 0;
	for (scanf("%d", &T); T; --T, sg ^= n / k)
		for (scanf("%d%d", &n, &k); n % k; n -= (n % k + r - 1) / r * r)
			r = n / k + 1;
	puts(sg ? "Takahashi" : "Aoki");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define N 1000005
using namespace std;
typedef long long ll;
ll n, h[N], a[N], fen[N];

void up(ll x, ll y){
	for(; x <= n; x += x&-x)
		fen[x] = max(fen[x], y);
}

ll qu(ll x){
	ll top = 0;
	for(; x > 0; x -= x&-x)
		top = max(top, fen[x]);
	return top;
}

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%lld",&n);
	for(ll i = 1; i <= n; i++)
		scanf("%lld",h + i);
	for(ll i = 1; i <= n; i++)
		scanf("%lld",a + i);
	for(ll i = 1; i <= n; i++){
		ll al = qu(h[i] - 1);
		up(h[i], al + a[i]);
	}
	printf("%lld\n", qu(n));
	return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    int res = 1;
    
    while(b)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int x;
    cin >> x;
    
   int res = 0;
    int n = 100;
        
    while(n < x)
    {
        res++;
        n+=(n/100);
    }
     
    cout << res << endl;
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}

Measured memory_bytes: 3648
n,m = map(int, input().split())

A = []
for i in range(n):
    A.append(list(map(int, input().split())))

b = [0] * m
for i in range(m):
    b[i] = int(input())

c = [0] * n
for i in range(n):
    for j in range(m):
        c[i] += A[i][j] * b[j]
    print(c[i])

Measured memory_bytes: 7964
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll N,K;
   cin>>N>>K;
   cout<<N-K+1<<endl;



   return 0;
}

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

//素数判定
int IsPrime(int num)
{
    if (num < 2)
        return 1;
    else if (num == 2)
        return 2;
    else if (num % 2 == 0)
        return 2; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main()
{
    ll n;
    cin >> n;
    double x = sqrt(n);
    ll ans = n;
    string s, t;
    ll k = 10000000;
    int a, b;
    for (int i = 1; i <= x; i++)
    {
        if (n % i == 0)
        {
            ans = min(ans, abs(i - n / i));
            if (ans == abs(i - n / i))
            {
                s = to_string(i);
                t = to_string(n / i);
                a = s.size();
                b = t.size();
                k = max(a,b);
            }
        }
    }
    cout << k << endl;
}


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n;
  cin >> n;
  int64 a, b;
  cin >> a >> b;
  for (int i = 0; i < n - 1; i++) {
    int64 x, y;
    cin >> x >> y;
    int64 k = max((a + x - 1) / x, (b + y - 1) / y);
    a = k * x;
    b = k * y;
  }
  cout << a + b << endl;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> ii;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vii;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<vector<ld>> vvld;
typedef vector<bool> vbl;
typedef vector<vbl> mbl;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(s) (s).begin(), (s).end()
const ll MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n, a, b;
    cin >> n >> a >> b;
    cout << a * (n / (a + b)) + min(a, n % (a+b));
    return 0;
}

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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ABCDEF = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var A = ABCDEF[0];
            var B = ABCDEF[1];
            var C = ABCDEF[2];
            var D = ABCDEF[3];
            var E = ABCDEF[4];
            var F = ABCDEF[5];

            var sw = 0;
            var s = 0;
            var maxNoudo = -1d;
            for (var numA = 0; numA * 100 * A <= F; numA++)
            {
                var maxWater = F - 100 * A * numA;
                for (var numB = 0; numB * 100 * B <= maxWater; numB++)
                {
                    var water = 100 * A * numA + 100 * B * numB;
                    var maxSuger = Math.Min(F - water, water / 100 * E);
                    for (var numC = 0; numC * C <= maxSuger; numC++)
                    {
                        for (var numD = 0; numD * D <= maxSuger - C * numC; numD++)
                        {
                            var sugar = C * numC + D * numD;
                            var waterSugar = water + sugar;
                            var noudo = 100d * sugar / waterSugar;

                            if (noudo > maxNoudo)
                            {
                                sw = waterSugar;
                                s = sugar;
                                maxNoudo = noudo;
                            }
                        }
                    }
                }
            }

            var output = sw + " " + s;
            Console.WriteLine(output);
        }

        static int NumberOfDigits(long x)
        {
            if (x < 10) return 1;

            var result = 0;
            while (x > 0)
            {
                result++;
                x /= 10;
            }

            return result;
        }

        static int SumOfDigits(int x)
        {
            var sum = 0;
            while (x > 0)
            {
                sum += x % 10;
                x /= 10;
            }

            return sum;
        }
    }
}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
//int dy[4] = {-1,0,0,1};
//int dx[4] = {0,1,-1,0};



int main(){

  int dy[8] = {1,1,1,0,0,-1,-1,-1};
  int dx[8] = {1,0,-1,1,-1,1,0,-1};
  int h,w;
  cin >> h >> w;
  vector<string> v(h);
  REP(i,h)cin >> v[i];
  REP(i,h)REP(j,w)if(v[i][j] == '.')v[i][j] = '0';
  REP(i,h){
    REP(j,w){
      if(v[i][j] == '#'){
        REP(k,8){
          int oy = i+dy[k],ox = j+dx[k];
          if(oy < 0 || oy >= h || ox  < 0|| ox >= w)continue;
          if(v[oy][ox] == '#')continue;
          v[oy][ox]++;
        }
      }
    }
  }
  REP(i,h)cout << v[i] << endl;


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>//printf("%.*f\n",*********);
#include<vector>//s.erase(n),vector
#include<algorithm>//next_permutation
#include<set>
#include<string>//char('a'=32+'A')
//to_string,string,substr
#include<sstream>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>//min,max
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)//start==1
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)//end==1
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define Yay(ans) if(ans)cout<<"Yay!"<<rt;else cout<<":("<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(a,n) rep(i,n)cin>>a[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//昇順
#define reve(s) reverse(s.begin(),s.end())//反転
#define please return
#define AC 0
#define rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define pi 3.1415926535897932384626//pi
#define nine 1000000000//10^9

using namespace std;
typedef vector<int> vint;
typedef long double ldouble;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef vector<double> vdouble;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int KETA(int n) { //Sum of Each Digit
	int sum = 0;
	while (n > 0) {
		sum += n % 10; n /= 10;
	}
	return sum;
}

unsigned ND(unsigned num) {//Number of Digits
	return std::to_string(num).length();//outmax=10
}

bool KIBN(string s) {
	rep(i, s.size() / 2) {
		if (s[i] != s[s.size() - 1 - i])return false;
	}
	return true;
}

bool inte(double n) {//整数かどうかの判定
	if (ceil(n) == floor(n)) {//切り上げ関数,切り下げ関数
		return true;
	}
	else return false;
}

// (char)toupper(a[n])=文字列のn文字目を大文字で出力

// pow(a,b)=aのb乗

//グローバル関数
int a = 0, n = 0, x = 0, y = 0, ans = 0, cnt = 0, sum = 0;
string s="";

int main(void) {

	int n;
	cin >> n;
	vstr s(n);
	vcin(s, n);
	sort(s);
	int cnt = 0;
	rep(i, n - 1) {
		if (s[i] != s[i+1]) {
			cnt++;
		}
	}
	cout << cnt+1 << rt;

	please AC;
}

//参考：---;

Measured memory_bytes: 9600
#include <stdio.h>

int main(){
    int K,S;
    scanf("%d %d",&K,&S);
    int i,j,k;
    int count=0;
    for( i=0;i<=K;i++){
        for(j=0;j<=i;j++){
            for(k=0;k<=j;k++){
                if (i+j+k==S){
                    if((j==k)&&(i==j)){
                        count++;
                    }else if((j!=k)&&(i!=j)){
                        count+=6;
                    }else{
                        count+=3;
                    }
                }
            }
        }
    }
    printf("%d",count);
    return 0;
}

Measured memory_bytes: 256
/* {{{ Shinobu kawaii */
/*
  ______   __        _                  __                 
.' ____ \ [  |      (_)                [  |                
| (___ \_| | |--.   __   _ .--.   .--.  | |.--.   __   _   
 _.____`.  | .-. | [  | [ `.-. |/ .'`\ \| '/'`\ \[  | | |  
| \____) | | | | |  | |  | | | || \__. ||  \__/ | | \_/ |, 
 \______.'[___]|__][___][___||__]'.__.'[__;.__.'  '.__.'_/ 

*/
// clang-format off
/* }}} */

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

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {
  REP(i, v.size()) print(v[i]);
}
template <typename T> inline void print(const vector<T>& v, string s = " ") {
  REP(i, v.size()) {
    if (i != 0) cout << s;
    cout << v[i];
  }
  cout << '\n';
}
// clang-format on
/* }}} */

int r, c;
bool flg[10], table[10][10000];
int ans = -INF;

int colres() {
  int ret = 0;
  REP(i, c) {
    int cnt = 0;
    REP(j, r) {
      if (((int)flg[j] + (int)table[j][i]) % 2 == 0) {
        ++cnt;
      }
    }
    if (r / 2 >= cnt) {
      ret += (r - cnt);
    } else {
      ret += cnt;
    }
  }

  return ret;
}

void dfs(int i = 0, bool rev = false) {
  if (i == r) {
    chmax(ans, colres());
    return;
  }

  flg[i] = rev;
  dfs(i + 1, true);
  dfs(i + 1, false);
}

signed main() {
  while (cin >> r >> c, r || c) {
    ans = -INF;
    REP(i, r) REP(j, c) cin >> table[i][j];
    dfs();
    print(ans);
  }

  return 0;
}

Measured memory_bytes: 3224
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll modx= 1e9+7;
int main()
{
    ll n;
    while(~scanf("%I64d",&n))
    {
        ll sum=1;
        for(int i=1; i<=n; i++)
        {
            sum*=i;
            sum=sum%(modx);
        }
        printf("%I64d\n",sum);
    }
}


Measured memory_bytes: 128
#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 = 1 << 29;
 
int main() {
	string s;
	cin >> s;
	int n = s.size();
	int smallCnt = 0;
	bool ok1 = s[0] =='A';
	bool ok2 = false, ok3 = false;
	rep(i, n) {
		if (i >= 2 && i <= n-2 && s[i] == 'C') ok2 = true;
		if (islower(s[i])) smallCnt++;
	}
	if (smallCnt == n-2) ok3 = true;
	if (ok1 && ok2 && ok3) cout << "AC" << endl;
	else cout << "WA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef double ld;

using namespace std;

ll mod = 1e9+7;

int main()
{
	ll n,m; cin>>n>>m;
	int A[n], B[m];

	for(int i=0;i<n;i++)
	{
		cin>>A[i];
	}
	for(int j=0;j<m;j++)
		cin>>B[j];

	long long  dp[n+1][m+1];
	memset(dp, 0, sizeof(0));

	for(int i=0;i<=n;i++)
	{
		dp[i][0] = 1;
	}
	for(int j=0;j<=m;j++)
		dp[0][j] = 1;

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			dp[i][j] = dp[i-1][j]+ dp[i][j-1] - dp[i-1][j-1];
			if(A[i-1] == B[j-1])
			{
				dp[i][j]+=dp[i-1][j-1];
			}

			dp[i][j]+=mod;
			dp[i][j]%=mod;
		}
	}
	

	
	cout<<dp[n][m]<<endl;
}

Measured memory_bytes: 31488
n = int(input())
a = [int(i) for i in input().split()]

count = 1
state = 'none'
b = [a[0]]

for i in range(1,n):
    if state=='none':
        before=b.pop()
        now = a[i]
        if before<now:
            b.append(now)
            state='incr'
        elif before>now:
            b.append(now)
            state='decr'
        else:
            b.append(now)
    elif state=='incr':
        before=b.pop()
        now = a[i]
        if before<=now:
            b.append(now)
        else:
            b=[now]
            state='none'
            count+=1
    elif state=='decr':
        before=b.pop()
        now = a[i]
        if before>=now:
            b.append(now)
        else:
            b=[now]
            state='none'
            count+=1
print(count)


Measured memory_bytes: 14480
#include<bits/stdc++.h>
using namespace std;
long long n,a,b,k,zs,sum;
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		k=i;
		zs=0;
		for(;k>0;k/=10) zs=zs+k%10;
		if(a<=zs&&zs<=b) sum+=i;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 256
//-----------------------
// author : xyqkoala
// time : 2020-08-16
//-----------------------

#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve();


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


void solve(){
	int n;
	cin>>n;
	vector<int> nums(n,0);
	for(int i=0;i<n;i++) cin>>nums[i];
	auto check = [](int a,int b,int c){
		return (a+b)>c && (a+c)>b && (b+c)>a;
	};
	int res = 0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(nums[i]!=nums[j] && nums[i] != nums[k] && nums[j] != nums[k]  && check(nums[i],nums[j],nums[k])){
					res++;
				}
			}
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3680
import java.util.Scanner;

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

    char[] s = sc.next().toCharArray();
    char[] t = sc.next().toCharArray();

    int ret = 0;
    for (int i = 0; i < s.length; i++) {
      if (s[i] != t[i]) {
        ret++;
      }
    }
    System.out.println(ret);
  }
}

Measured memory_bytes: 41920
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
	cin.tie(NULL);
	cout.tie(NULL);
	string s,t;
	cin>>s;
	cin>>t;
	ll cnt=0;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!=t[i])
		cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 3852
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;

int a, b, c;

int main() {
    cin >> a >> b >> c;
    int arr[] = {a, b, c};
    sort(arr, arr + 3);

    cout << arr[0] + arr[1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  int n, m;
  cin >> n >> m;
  string tmp;
  cin >> tmp;
  string s(m, '1');
  s.append(tmp);
  auto itr = s.rbegin();

  vector<int> ans;
  ll sum = 0;

  while (sum < n) {
    bool flag = false;
    for (int i = m; i > 0; i--) {
      if (*(itr + i) == '0') {
        ans.push_back(i);
        sum += i;
        itr += i;
        flag = true;
        break;
      }
    }
    if (!flag) {
      cout << -1 << endl;
      return 0;
    }
  }

  for (auto itr = ans.rbegin(); itr != ans.rend(); itr++) {
    cout << *itr << " ";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 1224
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var sum = 0.0;
            for (var i = 0; i < n; i++)
            {
                var xv = Console.ReadLine().Trim().Split(' ').ToArray();
                sum += (xv[1] == "JPY" ? double.Parse(xv[0]) : double.Parse(xv[0]) * 380000.0);
            }
            Console.WriteLine(sum);
        }
    }
}


Measured memory_bytes: 11604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var B = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var C = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int count = 0;
            for(int i=0; i < N-1; i++)
            {
                if (A[i]+1 == A[i +1])
                {
                    count = count + C[A[i]-1];
                }
            }

            int ans = B.Sum() + count;

            Console.WriteLine(ans);

        }
    }
}


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

int main(void) {
  int N;
  cin >> N;

  long backet[100];
  for (int i = 0; i <= N; i++) {
    if (i == 0) {
      backet[i] = 2;
      continue;
    }
    if (i == 1) {
      backet[i] = 1;
      continue;
    }
    backet[i] = backet[i - 2] + backet[i - 1];
  }

  cout << backet[N] << endl;

  return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        BigDecimal A = sc.nextBigDecimal();
        double B = sc.nextDouble();

        BigDecimal ans = A.multiply(BigDecimal.valueOf(B));
        System.out.println(ans.longValue());
    }
}


Measured memory_bytes: 37656
// 入力マクロ
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        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_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)*}
    };
}
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")
    };
}


fn main() {
    input! {
        x: i64,
    }

    let mut left = 0;
    let mut right = 6 * 10i64.pow(15) + 1;

    while right - left > 1 {
        let mid = (right + left) / 2;
        let s = sum_die(mid);
        if s >= x {
            right = mid;
        } else {
            left = mid;
        }
    }

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

fn sum_die(x: i64) -> i64 {
    if x % 2 == 0 {
        x / 2 * 11
    } else {
        x / 2 * 11 + 6
    }
}


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

int main() {
  int a;
  string s;
  cin >> a >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;
  return 0;
}


Measured memory_bytes: 3616
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N,K; cin >> N >> K;
    string S; cin >> S;

    vector<pii> A;
    int cnt = 1;
    for (int i = 1; i < N; i++) {
        if (S[i] != S[i-1]) {
            A.emplace_back(cnt,S[i-1]-'0');
            cnt = 1;
        } else cnt++;
    }
    A.emplace_back(cnt,S[N-1]-'0');
    int M = A.size();
    cnt = 0;
    int length = 0;
    int j = 0;
    int ans = 0;
    for (int i = 0; i < M;) {
        while (i < M && (cnt<K || A[i].second==1)) {
            length += A[i].first;
            if (A[i].second==0) cnt++;
            i++;
        }
        chmax(ans,length);
        if (A[j].second==0) cnt--;
        length -= A[j].first;
        j++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1528