akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
  int D,N,k;
  long ans = 1;
  scanf("%d%d", &D, &N);
  for (k = 0; k < D; k++){
    ans *= 100;
  }
  if (N != 100){
    ans = ans*N;
  }else{
    ans = ans*101;
  }
  printf("%ld", ans);
  return 0;
}


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

using namespace std;
using ll = long long;

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

    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> a(n), b(m);
    ll i1 = 0, i2 = 0;
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        if(i) {
            a[i] += a[i-1];
        }
        if(a[i] <= k) {
            i1 = i+1;
        }
    }
    for(int i = 0; i < m; ++i) {
        cin >> b[i];
        if(i) {
            b[i] += b[i-1];
        }
        if(b[i] <= k) {
            i2 = i+1;
        }
    }

    ll ans = max(i1, i2);

    ll i = 0, j = i2-1;
    for(; i < i1; ++i) {
        while(a[i] + b[j] > k) {
            --j;
        }
        ans = max(ans, i+j+2);
    }

//    for(ll i = i1-1; i >= 0; --i) {
//        ll st = 0, dr = i2-1, mij;
//        ll index = -2;
//        while(st < dr) {
//            mij = (st + dr) / 2;
//            if(a[i] + b[mij] <= k) {
//                st = mij+1;
//                index = mij;
//            }
//            else if(a[i] + b[mij] > k) {
//                dr = mij;
//            }
//        }
//        if(index+1 < i2 && a[i] + b[index+1] <= k) {
//            ++index;
//        }
//        ans = max(ans, i + index + 2);
//    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 6360
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    string S;
    cin >> S;
    if (S.length() == 3)
    {
        rrep(i, 2, 0)
        {
            cout << S[i];
        }
        cout << endl;
    }
    else
    {
        cout << S << endl;
    }
}


Measured memory_bytes: 256
import java.io.*;

public class Main
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s;
        while((s = br.readLine()) != null)
        {
            int count = 0;
            int n = Integer.parseInt(s);
            if(n <= 36)
            {
                if (n > 18) n = 36 - n;
                count = (n + 1) * (n + 2) * (n + 3) / 6;
                if (n > 9) count -= 2 * (n - 9) * (n - 8) * (n - 7) / 3;

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


Measured memory_bytes: 24144
#include<iostream>
#include<vector>
#include<algorithm>
#include<string.h>
#include<complex>
using namespace std;
typedef long long int llint;
int main(){
	int n;
	cin >> n;
	int ans = 0;
	while (n > 0){
		ans += n % 10;
		n /= 10;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#ifndef ONLINE_JUDGE
    #include "debug.cpp"
#endif

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ar array

const int MOD = 1000000007;

void add_self(int& a, int b){
	a += b;
	if(a >= MOD){
		a -= MOD;
	}
}

void solve(){
	int h, w;
	cin >> h >> w;
	vector<string> vecs(h);
	for(int i = 0;i < h; i++){
		cin >> vecs[i];
	}
	vector<vector<int>> dp(h,vector<int>(w,0));
	dp[0][0] = 1;
	for(int row = 0; row < h; row++){
		for(int col = 0; col < w; col++){
			for(int r2 : {row,row+1}){
				int c2 = col;
				if(r2==row){
					c2 = col+1;
				}
				if(r2 < h && c2 < w && vecs[r2][c2]=='.'){
					add_self(dp[r2][c2],dp[row][col]);
				} 
			}	
		}
	}
	cout << dp[h-1][w-1] << "\n";
}

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

    int TC = 1;
    while(TC--)
        solve();

    return 0;
}



Measured memory_bytes: 12136
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()


int main() {
	int n;
	cin >> n;
	int nn = n;
	int sum = 0;
	int m = log10(n);
	rep(i, m+1) {
		sum += n % 10;
		n /= 10;
	}
	if (nn%sum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}





Measured memory_bytes: 512
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main(void) {
  int n;
  int arr[40] = {0};
  cin >> n;
  for (int i = 1; i <= sqrt(n); i++) {
    for (int j = 1; j < 10; j++) {
      if (pow(i, j) == n) {
        cout << n << endl;
        return 0;
      }
      if (pow(i, j) > n&&pow(i,j-1)<n) {
        arr[i] = pow(i, j - 1);
      }
    }
  }
  int max = *std::max_element(arr, arr + 40);
  
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
#define pb push_back
#define sx 200007
int vis[sx];
int main()
{
    int d,t,s;
    cin>>d>>t>>s;
    if(s*t>=d)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

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


const ll INF = 1e18;

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  vector<ll> f(n);
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>f[i];
  sort(a.begin(),a.end());
  sort(f.rbegin(),f.rend());

  ll l=0;
  ll r=1000000000001;
  while(l+1<r){
    ll c=(l+r)/2;
    ll cost=0;
    rep(i,n){
      ll temp=(c-1)/f[i];
      ll x=a[i]-temp;
      if (x>0)cost+=x;
    }
//    cout<<cost<<" "<<c<<endl;
    if (cost<=k)r=c;
    else l=c;
  }
cout<<l;
}


Measured memory_bytes: 6428
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<n; i++)
#define sz(v) (int)(v).size()
using vi = vector < int >;
using vii = vector < vi >;
using pii = pair < int , int >;
using vpii = vector < pii >;
const char nwl = '\n';

string prt(vii &ans, string &s, int i, int j) {
	if (!i or !j) return "";
	else if (ans[i][j] ==  1) {

		//cout << i << nwl;
		return prt(ans, s, i - 1, j - 1) + s[i - 1];
	} else if (ans[i][j] == 2) {
		return prt(ans, s, i - 1, j);
	} else if (ans[i][j] == 3) {
		return prt(ans, s, i, j - 1);
	}
}

string lcs(string s1, string s2) {
	int n1 = sz(s1), n2 = sz(s2);
	vii res(n1 + 1, vi (n2 + 1));
	vii ans(n1 + 1, vi (n2 + 1));
	for (int i = 1; i < n1 + 1; i++) {
		for (int j = 1; j < n2 + 1; j++) {
			if (s1[i - 1] == s2[j - 1]) {
				res[i][j] = res[i - 1][j - 1] + 1;
				ans[i][j] = 1;
			}
			else if (res[i - 1][j] > res[i][j - 1]) {
				res[i][j] = res[i - 1][j];
				ans[i][j] = 2;
			} else {
				res[i][j] = res[i][j - 1];
				ans[i][j] = 3;
			}
		}
	}
	// cout << "\nTotal Length of LCS: " << res[n1][n2] << nwl;
	// cout << "\nLCS from given two strings is: ";
	return prt(ans, s1, n1, n2);
	//cout << nwl;
}


int main() {
// #ifndef ONLINE_JUDGE
// 	if (fopen("input.txt", "r")) {
// 		freopen("input.txt", "r", stdin);
// 		freopen("output.txt", "w", stdout);
// 	}
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s1, s2;
	//cout << "Enter string-1: ";
	cin >> s1 >> s2;
	//cout << "Enter string-2: ";
	//cin >> s2;
	cout << lcs(s1, s2);
	return 0;
}


Measured memory_bytes: 71168
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let () =
  Scanf.scanf "%d" @@ fun n ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" ((+) 0)) in
  let l = Array.init n (fun i -> a.(i)) in
  for i = 1 to n-1 do l.(i) <- gcd a.(i) l.(i-1) done;

  let r = Array.init n (fun i -> a.(i)) in
  for i = n-2 downto 0 do r.(i) <- gcd a.(i) r.(i+1) done;

  Array.init n (fun i -> 
    if i = 0 then r.(1) else if i = n-1 then l.(n-2)
    else gcd l.(i-1) r.(i+1))
  |> Array.fold_left max 0
  |> Printf.printf "%d\n"


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

using namespace std;

const int N = 100005;

char s[N];

int main() {

    scanf("%s", s);

    int score = 0;

    bool rock = true;

    for (int i = 0; s[i]; i++) {
        if (rock) {
            if (s[i] == 'p') score--;
        }
        else {
            if (s[i] != 'p') score++;
        }
        rock = !rock;
    }

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


Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;



int main(void){
	ll N,x,a[100010]={},ans=0;
	scanf("%lld",&N);
	rep(i,N){
		scanf("%lld",&x);
		if(x>N){
			ans++;
			continue;
		}
		a[x]++;
	}
	reg(i,1,N){
		if(a[i]>=i){
			ans+=a[i]-i;
		}else{
			ans+=a[i];
		}
	}
	printf("%lld\n",ans);
	return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}
int main(){
  int n; cin >> n;
  vector<int> a(n),b(n); cin >> a >> b;
  ll x=0,y=0;
  for(int i = 0; i < n; ++i){
    if(a[i] > b[i])x += a[i] - b[i];
    else y += (b[i] - a[i])/2;
  }
  cout << (x <= y ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3708
#include<iostream>

using namespace std;

int main()
{
		int a,b,c,x;
		cin >> a;
		cin >> b;
		cin >> c;
		cin >> x;
		int ans = 0;

		for (int i = 0; i <= a; i++) {
				for (int j = 0; j <= b; j++) {
						for (int k = 0; k <= c; k++) {
								int tmp = i * 500 + j * 100 + k * 50;
								if (tmp == x) ans++;
						}
				}
		}
		cout << ans << endl;						
		return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int N;
  int S=0;
  char str[100];
  scanf("%d",&N);
  scanf("%s",str);
  if(N%2==1){
    printf("No");
  }
  if(N%2==0){
  for(int i=0; i<N/2; i++){
    if(str[i]==str[N/2+i]){
      S++;
    }
    if(str[i]!=str[N/2+i]){
      S=S+0;
    }
  }
  if(S==N/2){
    printf("Yes");
  }
  if(S!=N/2){
    printf("No");
  }
  }
}


Measured memory_bytes: 128
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;


void main() {
    int n;
    scan(n);

    int t, a;
    scan(t, a);
    t *= 1000;
    a *= 1000;

    auto h = readln.split.to!(int[]);

    int ans = -1;
    int dif = 10^^9;

    foreach (i ; 0 .. n) {
        if (dif > abs(t - 6*h[i] - a)) {
            ans = i;
            dif = abs(t - 6*h[i] - a);
        }
    }

    writeln(ans + 1);
}









void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 380
while l = gets do
  c1,c2,c3 = l.split.map(&:to_i)
  cards = (1..10).to_a
  cards.delete(c1)
  cards.delete(c2)
  cards.delete(c3)
  rest = 20-(c1+c2)
  puts cards.select{|x| x>rest}.size > 3 ? "NO" : "YES"
end

Measured memory_bytes: 14000
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static ConsoleApp.Util;
using static System.Math;

namespace ConsoleApp
{
    class Program
    {

        static void Main(string[] args)
        {
            var n = int.Parse(ReadLine());
            var s = ReadLine();
            
            int c = 0;
            for (int i = 0; i < n-2;i++)
            {
                if(s[i] == 'A' && s[i+1] == 'B' && s[i+2 ] == 'C'){
                    c++;

                }
            }
            WriteLine(c);
        }

    }


    static class Util
    {
        public static void ChMin(ref int a, int b)
        {

            if (a > b)
            {
                a = b;
            }
        }


        public static void ChMax(ref long a, long b)
        {
            if (a < b)
            {
                a = b;
            }
        }




    }
}


Measured memory_bytes: 13140
def main():
    N = int(input())
    F = []
    for i in range(N):
        f = list(map(int, input().split()))
        F.append(f)

    P = []
    for i in range(N):
        p = list(map(int, input().split()))
        P.append(p)


    B = []
    # 全部0はありえない
    for i in range(1, 2 ** 10):
        b = format(i, 'b').zfill(10)
        B.append(b)

    # print(N)
    # print(F)
    # print(P)
    # print(B)

    profits = []
    for bi in B:
        profit = 0
        for i, fi in enumerate(F):
            c = 0
            for j in range(10):
                if bi[j] == '1' and fi[j] == 1:
                    c += 1
            profit += P[i][c]
        profits.append(profit)
    print(max(profits))





if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

int main(){
    ll n; cin >> n;
    if(n%2==0) cout << n/2 << endl; else cout << (n+1)/2 << endl;
}

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

int main(){
  int s;cin >> s;
  int o = s/100;
  int t = s%100;
  if(o > 12 && t > 12)cout << "NA" << endl;
  else if(o <= 12 && t <= 12){
    if(o != 0 && t == 0)cout << "MMYY" << endl;
    else if(o == 0 && t != 0)cout << "YYMM" << endl;
    else if(o == 0 && t == 0)cout << "NA" << endl;
    else cout << "AMBIGUOUS" << endl;
  } else if(o > 12 && t <= 12 && t != 0)cout << "YYMM" << endl;
  else if(o <= 12 && t > 12 && o != 0)cout << "MMYY" << endl;
  else cout << "NA" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  string s;
  cin >> s;
  ll ans = -INF;

  for (int i = 0; i < s.size(); i++) {
    int cnt = 0;
    for (int j = i; j < s.size(); j++) {
      if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') cnt++;
      else break;
    }
    ans = max(ans, (ll)cnt);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3596
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define all(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<ll,ll>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


int a, b, c, d;


int main() {
	cin >> a >> b >> c >> d;

	for (int i = 0;; i++) {
		if (i % 2 == 1) {
			a -= d;
		}
		else {
			c -= b;
		}
		if (a <= 0) {
			cout << "No" << endl;
			return 0;
		}
		if (c <= 0) {
			cout << "Yes" << endl;
			return 0;
		}

	}

	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define pci pair <char, int>
#define pld pair <ld, ld>
#define ppld pair <pld, pld>
#define ppll pair <pll, pll>
#define pldl pair <ld, ll>
#define vll vector <ll>
#define vvll vector <vll>
#define vpll vector <pll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define mll map <ll, ll>
#define fastmap gp_hash_table
#define cd complex <double>
#define vcd vector <cd>
#define PI 3.14159265358979
#define ordered_set tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update>
#pragma 03
using namespace std;
using namespace __gnu_pbds;
vll o;
vpll edges;
void term(){
	cout << -1 << endl; exit(0);
}
int main(){
	string s; cin >> s;
	ll n = s.length();
	for (ll i = 0; i < n; i++) if (s[i] == '1') o.pb(i);
	if (s[0] == '0') term();
	if (s[n - 1] == '1') term();
	for (ll i = 0; i < n - 1; i++){
		if (s[i] != s[n - 2 - i]) term(); 
	}
	ll k = o.size();
	ll cv = k + 1;
	for (ll i = 0; i < k; i++) edges.pb(mp(i, i + 1));
	for (ll i = 1; i < k; i++){
		for (ll j = 0; j < o[i] - o[i - 1] - 1; j++){
			edges.pb(mp(i, cv)); cv++;
		}
	} 
	for (ll i = 0; i < edges.size(); i++) cout << edges[i].fi + 1 << " " << edges[i].se + 1 << endl;
}

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

while True:
    n = int(input())
    if n == 0:
        break
    l = list(map(int, input().split()))
    l.sort()
    l.reverse()
    min = 10**10
    for i in range(n-1):
        dif = l[i] - l[i+1]
        if dif < min:
            min = dif
    print(min)




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

public class Test
{
	public static void Main()
	{
		// my code goes here
		
		int n = int.Parse(Console.ReadLine());
		int counter = 0;
		if(n>81){
			Console.WriteLine("No");
		}else if(n<10){
			Console.WriteLine("Yes");
		}else{
			
			for(int i=1;i<10;i++){
				if(n%i==0){
					if(n/i<10){
						counter++;
					}
				}
			}
			
			if(counter==0){
				Console.WriteLine("No");
			}else{
				Console.WriteLine("Yes");
			}
			
		}
		
	}
}

Measured memory_bytes: 13140
H, W = map(int, input().split())
S = [input() for _ in range(H)]
result = []
for h in range(H):
    for w in range(W):
        if S[h][w] == "#":
            result.append("#")
        else:
            count = 0
            for h2 in range(h - 1, h + 2):
                for w2 in range(w - 1, w + 2):
                    if 0 <= h2 < H and 0 <= w2 < W:
                        if S[h2][w2] == "#":
                            count += 1
            result.append(str(count))
    print("".join(result))
    result.clear()
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REPF(i, a, n) for (int i = (a); i < (int)(n); i++)
#define REP(i, n) REPF(i, 0, n)
#define ALL(x) begin(x),end(x)
#define SZ(x) (int)(x.size())

signed main() {
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    REP(i, M) cin >> A[i];
    
    int ans = 0;
    REP(i, M) {
        if (A[i] > M) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>

int main(int argc, char *argv[])
{
    long long N, h[100], k[100] = {0};
    long long i, l, r, ans = 0;

    scanf("%lld", &N);
    for (i = 0; i < N; i++) {
        scanf("%lld", &h[i]);
    }

    for (;;) {
        for (l = 0; l < N; l++) {
            if (k[l] < h[l]) break;
        }
        
        for(r = l; r < N; r++) {
            if (k[r] == h[r]) break;
        }

        if (l == N && r == N) break;

        for (i = l; i < r; i++) k[i]++;

        ans++;
    }

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

    return 0;
}


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

int main(void){
    int a,b;
    cin>>a>>b;
    cout<<a/b<<" "<<a%b<<" ";
    double c,d;
    c = a;d = b;
    cout << fixed << setprecision(6) <<c/d<<endl;
}



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

int main(){
  int n; cin >> n;
  int d[100010];
  for (int i = 0; i < n; i++){
    cin >> d[i];
  }
  sort(d, d + n);
  cout << d[n / 2] - d[n / 2 - 1] << endl;
}

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

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 入力
        int n = sc.nextInt();
        int[] t = new int[n+1];
        int[] x = new int[n+1];
        int[] y = new int[n+1];
        // 初期値
        t[0] = 0;
        x[0] = 0;
        y[0] = 0;
        // 入力値
        for (int i = 1; i <= n; i++) {
            t[i] = sc.nextInt();
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        boolean can = true;
        for (int i = 0; i < n; i++) {
            int dt = t[i+1] - t[i];
            int dist = Math.abs(x[i+1] - x[i]) + Math.abs(y[i+1] - y[i]);
            if (dt < dist || (dist % 2 != dt % 2)) {
                can = false;
            }
        }

        if (can) {
            // 出力
            System.out.println("Yes");
        } else {
            // 出力
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 90708
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
int t(long long a){
	int ret=0;
	while(a){
		ret+=a%10;a/=10;
	}
	return ret;
}
int main(){
	long long a;scanf("%lld",&a);
	int ret=t(a);
	int cnt=0;
	long long tmp=a/10;
	while(tmp){
		tmp--;
		cnt++;
		ret=max(ret,t(tmp)+cnt*9);
		tmp/=10;
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
N, Z, W = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

if N == 1:
    print(abs(A[0] - W))
else:
    print(max(abs(A[N-1] - W), abs(A[N-2] - A[N-1])))






Measured memory_bytes: 38640
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long> A(X);
    vector<long> B(Y);
    vector<long> C(Z);
    for (int i = 0; i < X; i++) cin >> A[i];
    for (int i = 0; i < Y; i++) cin >> B[i];
    for (int i = 0; i < Z; i++) cin >> C[i];
    vector<long> D(X * Y);
    for (int i = 0; i < X; i++) {
        for (int j = 0; j < Y; j++) {
            D[i * Y + j] = A[i] + B[j];
        }
    }
    sort(D.begin(), D.end());
    int k = (K > X * Y)? X * Y: K;
    vector<long> newD(k);
    for (int i = 0; i < k; i++) newD[i] = D[X * Y - 1 - i];
    vector<long> D2(k * Z);
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < Z; j++) {
            D2[i * Z + j] = newD[i] + C[j];
        }
    }
    sort(D2.begin(), D2.end());
    for (int i = k * Z - 1; i >= k * Z - K; i--) cout << D2[i] << "\n";
    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>bool chmin(T&a,const T&b){return a>b?(a=b,1):0;}
template<class T>bool chmax(T&a,const T&b){return a<b?(a=b,1):0;}

void rev(vector<ll> &a) {
  int N = (int)a.size();
  REP(i, N) a[i]--;
  *min_element(ALL(a)) += N+1;
}

vector<ll> solve(ll K) {
  int N = 50;
  vector<ll> a(N);
  REP(i, N) a[i] = N - 1 + K/N;
  for (int i = K % 50; i --> 0; )
    rev(a);
  return a;
}

int main2() {
  ll K; cin >> K;
  vector<ll> a = solve(K);
  int N = (int)a.size();
  cout << N << endl;
  REP(i, N) {
    if (i > 0) cout << " ";
    cout << a[i];
  }
  cout << endl;

  return 0;
}

int check(vector<ll> a) {
  int N = a.size();
  int step = 0;
  for (step = 0; ; step++) {
    auto p = max_element(ALL(a));
    if (*p <= N - 1) break;
    REP(i, N) a[i]++;
    *p -= N + 1;
  }
  return step;
}

int main() {
  main2();
  // for (int k = 0; k <= 1000; k++) {
  //   vector<ll> a = solve(k);
  //   ll kk = check(a);
  //   if (k != kk) {
  //     cout << k << " vs " << kk << endl;
  //     pv(ALL(a));
  //   }
  // }
  return 0;
}



Measured memory_bytes: 256
import sys
N,Y=map(int,input().split())

total = 0

for a in range(N+1):
    for b in range(N+1):
        c = N - (a + b)
        if c < 0:continue
        total = 10000 * a + 5000 * b + 1000 * c
        if total == Y and a + b + c == N:
            print(a,b,c)
            sys.exit()
print(-1,-1,-1)

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))

typedef long long lint;
typedef pair<int, int> pii;

int H, W;
string pict[55];

bool item[30];
int l[30], t[30], r[30], b[30];
int collision[30];

bool look[30];

bool rec(int i) {
	if (look[i]) return false;
	
	look[i] = true;
	
	int col = collision[i];
	for_(j,0,26) {
		if (col >> j & 1) {
			if (!rec(j)) return false;
		}
	}
	
	look[i] = false;
	
	return true;
}

bool is_safe() {
	minit(collision, 0);
	
	for_(alph,0,26) {
		if (!item[alph]) continue;
		
		char ALPH = 'A' + alph;
		
		for_(y,t[alph],b[alph] + 1) for_(x,l[alph],r[alph] + 1) {
			if (pict[y][x] == '.') return false;
			
			if (pict[y][x] != ALPH) {
				int p = (int)(pict[y][x] - 'A');
				collision[alph] |= 1 << p;
			}
		}
	}
	
	for_(alph,0,26) {
		if (!item[alph]) continue;
		minit(look,0);
		if (!rec(alph)) return false;
	}
	
	return true;
}

void solve() {
	minit(item,0);
	fill(l, l + 30, W);
	fill(t, t + 30, H);
	fill(r, r + 30, 0);
	fill(b, b + 30, 0);
	
	for_(i,0,H) for_(j,0,W) {
		char c = pict[i][j];
		if (c == '.') continue;
		int ci = (int)(c - 'A');
		
		item[ci] = true;
		l[ci] = min(l[ci], j);
		t[ci] = min(t[ci], i);
		r[ci] = max(r[ci], j);
		b[ci] = max(b[ci], i);
	}
	
	if (is_safe()) cout << "SAFE" << endl;
	else cout << "SUSPICIOUS" << endl;
}

int main() {
	int T; cin >> T;
	while (T--) {
		cin >> H >> W;
		for_(i,0,H) cin >> pict[i];
		solve();
	}
	return 0;
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,ans,x;
    x=0;
    ans=0;
    cin>>n;
    vector<char> s(n);
    for(int i=0;i<n;i++){
      cin>>s[i];
      if(s[i]=='I'){
        x++;
      }else{
        x--;
      }
      ans=max(x,ans);
    }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        K, S = map(int, input().split())
        ans = 0
        for i in range(K + 1):
            for j in range(K + 1):
                Z = S - i - j
                if 0 <= Z <= K:
                    ans += 1
        print(ans)


if __name__ == '__main__':
    AtCoder().main()

Measured memory_bytes: 40940
#include <algorithm>
#include <cctype>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CLOOP        while (true)
#define FLOOP(i, n)  for (int i = 0; i < (n); i++)
#define FOR(i, f, l) for (int i = (f); i < (l); i++)
#ifdef DEBUG
#define DUMP(var)   cerr << "[DEBUG] " << #var << ": " << var << endl
#else
#define DUMP(var)
#endif

#define LL long long

using namespace std;

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

    double d, t, s, a;
    cin >> d >> t >> s;

    a = d / s;
    if (a <= t) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


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

class Program
{
    static void Main()
    {
        int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int A = n[0];
        int B = n[1];
        if (A + B < 10)
        {
            Console.WriteLine(A + B);
        }
        else
        {
            Console.WriteLine("error");
        }
    }
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

  	int A, B, K, C; 
  
  	cin >> A >> B >> K, C = min(A,B); 

  	while(A % C or B % C or --K)
      	C--;
          
  	cout << C; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n,x) for(int i=n;i<x;i++)
#define rem(i,n,x) for(int i=n;i>x;i--)
#define SORT(x) sort(x.begin(),x.end())
#define rev(x) reverse(x.begin(),x.end())
#define all(x) x.begin(),x.end()
#define pb push_back
#define setp(x) setprecision(x)
using ll = long long;
using ull = unsigned long long;

int main() {
	int n;
	cin >> n;
	vector<int> p(n);
	rep(i, 0, n) cin >> p[i];

	int count = 0;
	rep(i, 0, n) {
		if (p[i] != (i + 1)) {
			p[i] = i + 1;
			count++;
		}
	}

	if (count <= 2) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ALL(obj) (obj).begin(), (obj).end()

int main() {
  int X,Y;
  cin >> X >> Y;
  int crane, turtle;
  crane = 2*X - Y/2;
  turtle = Y/2 - X;

  if (Y%2==0 && crane>=0 && turtle>=0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
const MOD: usize = 1e9 as usize + 7;
fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let x: Vec<usize> = sc.vec(n);
    let mut stack = 0;
    let mut ans = 1;
    for x in x.into_iter() {
        if stack * 2 <= x {
            stack += 1;
            if (stack - 1) * 2 == x {
                ans *= stack;
                ans %= MOD;
                stack -= 1;
            }
        } else {
            ans *= stack;
            ans %= MOD;
        }
    }
    for i in 0..stack {
        ans *= i + 1;
        ans %= MOD;
    }
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4476
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
const string YES = "Yes";
const string NO = "No";

void solve(long long X, long long Y){
    if(Y % 2){
        cout<<NO<<endl; return;
    }
    if( Y < 2*X || Y > 4*X) {cout<<NO<<endl; return;}
    cout<<YES<<endl;
}
int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);
    solve(X, Y);
    return 0;
}


Measured memory_bytes: 3760
# Author: cr4zjh0bp
# Created: Thu Mar 12 19:09:40 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

A, B, K = na()

for i in range(A, min(A + K, B + 1)):
    print(i)

for i in range(max(B - K + 1, A + K), B + 1):
    print(i)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define big 1000000007
vector<vector<ll>> memo(200000, vector<ll>(3));
vector<vector<ll>> done(200000, vector<ll>(3));
ll n;
vector<ll>a, b, c;
ll dp(int m, int p)
{ //(基本的にpは0,1,2で前の状態をあら合わす。)
    if (m == n)
    {
        return 0;
    }
 if (p != -1)
    {
        if (done[m][p] == 1)
        {
            //    cout <<"dakfa";
            return memo[m][p];
        }
    }
    ll res = -1;
    /*ll count;
    for (int i = 0; i < 3; i++)
    {
        if (i == p)
        {
            continue;
        }
        count = data[m][i] + dp(m + 1, i, data);
        if (res == -1)
        {
            res = count;
        }
        else
        {
            res = max(res, count); //とりあえず
        }
    }*/
    ll res1 = 0, res2 = 0, res3 = 0;
	if (p != 0) res1 = dp(m + 1, 0) + a[m];
	if (p != 1) res2 = dp(m + 1, 1) + b[m];
	if (p != 2) res3 = dp(m + 1, 2) + c[m];
   res= max({ res1, res2, res3 });
    if (p != -1)
    {
        memo[m][p] = res;
        done[m][p] = 1;
    }

    return res;
}
int main()
{

    cin >> n;
   a.resize(n); b.resize(n); c.resize(n);
	rep(i, n) cin >> a[i] >> b[i] >> c[i];
    memo.resize(n);
	rep(i, memo.size()) memo[i].resize(3, 0);memo.resize(n);
	rep(i, memo.size()) done[i].resize(3, 0);
    cout << dp(0, -1) << endl; //前の状態が指定された時の今後の最大値
                                     /* rep(i,n){
  rep(j,3){
  cout <<done[i][j];
  
  }
  }*/
}


Measured memory_bytes: 30720
#!/usr/bin/env python3
#ABC137 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

k,x = LI()
ans = []
for i in range(x-k+1,x+k):
    ans.append(i)
print(*ans)


Measured memory_bytes: 38384
N, K = map(int, input().split())
A = list(map(int, input().split()))
AS = [0]
for i in range(N):
    AS += [AS[i] + A[i]]
AN = []
for i in range(N):
    for j in range(i, N):
        AN += [AS[j + 1] - AS[i]]
ans = 0
for i in range(41, -1, -1):
    c = 0
    p = ans + 2 ** i
    for x in AN:
        if p & x == p:
            c += 1
    if c >= K:
        ans += 2 ** i
print(ans)


Measured memory_bytes: 65984
#include <iostream>
#include <algorithm>
#include <map>

int main() {
  using namespace std;

  int N, M;
  cin >> N;

  std::map<string, int> m;
  for (int i=0; i<N; i++) {
    string s;
    cin >> s;
    auto it = m.find(s);
    if (it == m.end()) {
      m.emplace(s, 0);
    }
    m[s]++;
  }

  cin >> M;
  for (int i=0; i<M; i++) {
    string s;
    cin >> s;
    auto it = m.find(s);
    if (it == m.end()) {
      m.emplace(s, 0);
    }
    m[s]--;
  }

  int n = -1000;
  for (auto& a : m) {
    n = max(n, a.second);
  }

  cout << ((0 < n) ? n : 0) << endl;

  return 0;
}

Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<iostream>
using namespace std;
int m,jinzhi;
void change(int a){
	int k=a%jinzhi;
	a/=jinzhi;
	if(k<0){
		k-=jinzhi;
		a++;
	}
	if(a!=0)
		change(a);
	if(k>9)
		printf("%c",k-10+'A');
	else
		printf("%d",k);
}
int main()
{
	scanf("%d",&m);
	jinzhi=-2;
	change(m);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const long long MOD = 998244353;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())
constexpr auto PI = 3.14159265358979323846264338327950L;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    long long ans=0;
    int N = (int)S.size();
    for(int bit=0;bit<(1<<(N-1));++bit){
        long long sum = 0;
        long long a = S[0] - '0';
        for(int j=0; j<N-1;++j){
            if(bit&(1<<j)){
                sum+=a;
                a=0;
            }
            a=a*10+S[j+1]-'0';
        }
        sum +=a;
        ans+=sum;
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) 
	{
		Scanner s =new Scanner(System.in);
		int n = s.nextInt();
		int number[] = new int[n];
		long sum = 0;
		for(int i = 0 ; i<n; i++)
		{
			number[i] = s.nextInt();
			sum = sum  + number[i];
		}
		System.out.println(sum - n);
	
	}

}


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

int main(int argc, char *argv[]){
  int N, M;
  cin >> N >> M;
  
  int oddcount = 0;
  int odd[2];
  int A[M];
  int i;
  int r;
  for(i=0; i<M; ++i){
    cin >> r;
    if(r%2 != 0){
      if(oddcount > 1){
        cout << "Impossible" << endl;
        return 0;
      }else{
        odd[oddcount] = r;
        ++oddcount;
      }
    }else{
      A[i-oddcount] = r;
    }
  }
  if(oddcount == 0){
    for(i=0; i<M; ++i){
      cout << A[i] << " ";
    }
    cout << endl;
    if(A[0] == 2){
      cout << M+1 << endl;
      cout << "1 ";
      for(i=1; i<M; ++i){
        cout << A[i] << " ";
      }
      cout << "1" << endl;
    }else{
      cout << M+2 << endl;
      cout << A[0]-2 << " 1 ";
      for(i=1; i<M; ++i){
        cout << A[i] << " ";
      }
      cout << "1" << endl;
    }
  }else if(oddcount == 1){
    for(i=0; i<M-1; ++i){
      cout << A[i] << " ";
    }
    cout << odd[0] << endl;
    if(odd[0] == 1){
      cout << M << endl;
      cout << "1 ";
      for(i=0; i<M-1; ++i){
        cout << A[i] << " ";
      }
      cout << endl;
    }else{
      cout << M+1 << endl;
      cout << "1 ";
      for(i=0; i<M-1; ++i){
        cout << A[i] << " ";
      }
      cout << odd[0]-1 << endl;
    }
  }else if(oddcount == 2){
    cout << odd[0] << " ";
    for(i=0; i<M-2; ++i){
      cout << A[i] << " ";
    }
    cout << odd[1] << endl;
    if(odd[1] == 1){
      cout << M-1 << endl;
      cout << odd[0]+1 << " ";
      for(i=0; i<M-2; ++i){
        cout << A[i] << " ";
      }
      cout << endl;
    }else{
      cout << M << endl;
      cout << odd[0]+1 << " ";
      for(i=0; i<M-2; ++i){
        cout << A[i] << " ";
      }
      cout << odd[1]-1 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#include <cstdio>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<LL,LL> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

const int maxn=2e5+5;
LL K,n;
double a[maxn],eps=1e-6;

bool can(double len)
{
    LL tot=0;
    REP(i,1,n)
    {
        LL x=a[i]/len;
        if(fabs(a[i]-len*x)>eps) x++;
        tot+=x-1;
        if(tot>K) return 0;
    }
    return 1;
}

int main()
{
    n=read(),K=read();
    REP(i,1,n) a[i]=read();
    double l=1e-5,r=1e9,mid;
    while(l<r-0.000001)
    {
        mid=(l+r)/2;
        if(can(mid)) r=mid;
        else l=mid;
    }
    LL x=r+1-eps;
    cout<<x;

    return 0;
}


Measured memory_bytes: 5180
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
	string a;
	cin>>a;
	int cnt=0;
	for(int i=0;i<a.length();i++){
		if(a[i]=='2'){
			cnt++;
		}
	}
	cout<<cnt; 
	return 0;
}

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

template<uint32_t N = 10'000'000>
struct Sieve_of_Eratosthenes{
  using u32 = uint32_t;
  std::vector<u32> factor;
  Sieve_of_Eratosthenes(){
    factor.resize(N+1);
    for(u32 p=2;p<=N;++p){
      if(factor[p])continue;
      factor[p] = p;
      for(u32 x=p+p;x<=N;x+=p){
        if(factor[x])continue;
        factor[x] = p;
      }
    }
  }
  std::vector<u32> prime_factor(u32 x){
    std::vector<u32> pf;
    while(factor[x]){
      pf.push_back(factor[x]);
      while(factor[x]==pf.back())x/=factor[x];
    }
    return pf;
  }
};

signed main(){
  using namespace std;
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& ai:a)cin>>ai;

  constexpr int a_max = 1e6;
  Sieve_of_Eratosthenes ushi;

  map<int,int> mp;
  bool pairwise_coprime = true;
  bool setwise_coprime = accumulate(begin(a),end(a),0,[](auto a,auto b){return gcd(a,b);}) == 1;

  for(auto const& ai:a){
    for(auto const& p:ushi.prime_factor(ai)){
      if(mp.count(p)){
        pairwise_coprime = false;
        goto loopend;
      }
      mp[p]++;
    }
  }
loopend:

  if(pairwise_coprime){
    cout<<"pairwise coprime"<<endl;
  }
  else if(setwise_coprime){
    cout<<"setwise coprime"<<endl;
  }
  else{
    cout<<"not coprime"<<endl;
  }


}

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

int main()
{
    int N;
    cin >> N;
    
    
    vector<char> s(N);
    vector<vector<int>> data(10);
    for(int i=0;i<N;i++)
    {
        cin >> s[i];
        int a = s[i] - '0';
        data[a].push_back(i);
    }
    
    int ans = 0;
    for(int i=0;i<10;i++)
    {
        if(data[i].size() == 0)
        {
            continue;
        }
        for(int j=0;j<10;j++)
        {
            if(data[j].size() == 0)
            {
                continue;
            }
            for(int k=0;k<10;k++)
            {
                if(data[k].size() == 0)
                {
                    continue;
                }
                bool ok = false;
                if(data[i][0] > data[k][data[k].size()-1])
                {
                    continue;
                }
                for(int t =0;t<data[j].size();t++)
                {
                    if(data[i][0] < data[j][t] && data[j][t] < data[k][data[k].size()-1])
                    {
                        ok = true;
                        break;
                    }
                }
                if(ok)
                {
                    ans++;
                }
            }
        }
    }
   
   
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N;
    string s, t;
    cin >> N >> s >> t;
    for (int i = 0; i < N; i++)
        cout << s[i] << t[i];
    cout << '\n';
}


Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n) for(int i=k;i<n;i++)
int main (){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] = (char)(s[k-1]+32);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 384
def solve():
    N = int(input())
    dfs("", 0, N)

def dfs(cur, n_type, N):
    if len(cur) == N:
        print(cur)
        return
    
    for offset in range(n_type+1):
        next_chr = chr(ord('a') + offset)
        next_n_type = n_type + 1 if offset==n_type else n_type
        dfs(cur+next_chr, next_n_type, N)
    
    return
if __name__ == '__main__':
    solve()

Measured memory_bytes: 54104