akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define forn(i, s, f) for (int i = s; i < f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

vector <int> tr;
vector <int> to_add;

int merge(int a, int b) {
    return min(a, b);
}

void push(int v, int vl, int vr) {
    if (vr - vl != 1) {
        to_add[2 * v] = min(to_add[2 * v], to_add[v]);
        to_add[2 * v + 1] = min(to_add[2 * v + 1], to_add[v]);
    }
    tr[v] = min(tr[v], to_add[v]);
    to_add[v] = INT_MAX;
}

void upd(int v, int vl, int vr, int l, int r, int x) {
    push(v, vl, vr);
    if (vr <= l || r <= vl) 
        return;
    if (l <= vl && vr <= r) {
        to_add[v] = min(to_add[v], x);
        push(v, vl, vr);
        return;
    }
    int vm = vl + vr >> 1;
    upd(2 * v, vl, vm, l, r, x), upd(2 * v + 1, vm, vr, l, r, x);
    tr[v] = merge(tr[2 * v], tr[2 * v + 1]);
}

int get(int v, int vl, int vr, int l, int r) {
    push(v, vl, vr);
    if (vr <= l || r <= vl)
        return INT_MAX;
    if (l <= vl && vr <= r)
        return tr[v];
    int vm = vl + vr >> 1;
    return merge(get(2 * v, vl, vm, l, r), get(2 * v + 1, vm, vr, l, r));
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector <vector <int>> a(n, vector <int> (3));
    forn (i, 0, n) {
        cin >> a[i][0] >> a[i][1] >> a[i][2];
        a[i][0] -= a[i][2], a[i][1] -= a[i][2];
    }
    vector <int> b(q);
    forn (i, 0, q)
        cin >> b[i];
    tr.resize(4 * q, INT_MAX), to_add.resize(4 * q, INT_MAX);
    forn (i, 0, n) {
        a[i][0] = lower_bound(all(b), a[i][0]) - b.begin();
        a[i][1] = --lower_bound(all(b), a[i][1]) - b.begin();
        //cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << "\n";
        upd(1, 0, q, a[i][0], a[i][1] + 1, a[i][2]);
    }
    forn (i, 0, q) {
        int t = get(1, 0, q, i, i + 1);
        if (t == INT_MAX)
            cout << -1;
        else 
            cout << t;
        cout << "\n";
    }
    return 0;
}

Measured memory_bytes: 19840
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D - Knapsack Queries on a tree
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int K = 9;
const int KBITS = 1 << K;
const int MAX_N = 1 << 18; // = 262144
const int MAX_L = 100000;

/* typedef */

/* global variables */

int vs[MAX_N], wis[MAX_N], vvs[K], wws[K];
int ds[MAX_N], dp[KBITS][MAX_L + 1];
int vsums[KBITS], wsums[KBITS];

/* subroutines */

inline void setmax(int &a, int b) { if (a < b) a = b; }

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", vs + i, wis + i);

  ds[0] = 0;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      int pi = (i - 1) / 2;
      ds[i] = ds[pi] + 1;
      if (ds[i] < K) memcpy(dp[i], dp[pi], sizeof(dp[pi]));
    }
    if (ds[i] < K) {
      for (int l = MAX_L - wis[i]; l >= 0; l--)
	setmax(dp[i][l + wis[i]], dp[i][l] + vs[i]);
    }
  }
  
  int qn;
  scanf("%d", &qn);
  while (qn--) {
    int u, l;
    scanf("%d%d", &u, &l);
    u--;

    if (ds[u] < K)
      printf("%d\n", dp[u][l]);
    else {
      int m = ds[u] - (K - 1), mbits = 1 << m;

      int up = u;
      for (int i = 0; ds[up] >= K; i++, up = (up - 1) / 2)
	vvs[i] = vs[up], wws[i] = wis[up];
      int maxd = dp[up][l];

      for (int bits = 1, msb = 1, bi = 0; bits < mbits; bits++) {
	if ((msb << 1) <= bits) msb <<= 1, bi++;
	vsums[bits] = vsums[bits ^ msb] + vvs[bi];
	wsums[bits] = wsums[bits ^ msb] + wws[bi];

	if (wsums[bits] <= l)
	  setmax(maxd, dp[up][l - wsums[bits]] + vsums[bits]);
      }

      printf("%d\n", maxd);
    }
  }
  return 0;
}


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

int main()
{
	int w, h;

	while( cin >> h >> w && !( h == 0 && w == 0 ) ){
		char* field = new char[ h * w ]();
		int x, y; x = y = 0;
		bool advance = true;
		for( int i = 0; i < h; ++i ){
			for( int j = 0; j < w; ++j ){
				cin >> field[ i * w + j ];
			}
		}
		while( advance ){
			char tile = field[ y * w + x ];
			field[ y * w + x ] = '*';
			switch( tile ){
				case '^': --y; break;
				case '>': ++x; break;
				case 'v': ++y; break;
				case '<': --x; break;
				case '*': advance = false; cout << "LOOP" << endl; break;
				case '.': advance = false; cout << x << " " << y << endl; break;
			}
		}
		delete[] field;
	}

	return 0;
}

Measured memory_bytes: 0
def GCD(a, b):
	if b > a:
		return GCD(b, a)
	elif a % b == 0:
		return b
	return GCD(b, a % b)
		
def LCM(a, b):
	return a * b // GCD(a, b)

import sys
L = sys.stdin.readlines()
for line in L:
	x, y = list(map(int, line.split()))
	print(GCD(x, y), LCM(x, y))

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

using namespace std;
typedef long long int ll;

int main()
{
    ll n,points=0;
    cin>>n;
    
    vector <ll> A(n),B(n),C(n);

    for(int i=0;i<n;i++)
        cin>>A.at(i);
 
    for(int i=0;i<n;i++)
        cin>>B.at(i);
    
    for(int i=0;i<n-1;i++)
        cin>>C.at(i);

    for(int i=0;i<n;i++)
    {
        points += B.at(A.at(i)-1);
        
        if(i!=0)
        {
            if(A.at(i)-1==A.at(i-1))
                points += C.at(A.at(i-1)-1);
        }
    }

    cout<<points<<"\n";

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int x=sc.nextInt();
    int[] a=new int[n];
    for(int i=0;i<n;i++){
      a[i]=sc.nextInt();
    }
    long ans=0;
    if(a[0]>x){
      ans=ans+a[0]-x;
      a[0]=x;
    }
    for(int i=1;i<n;i++){
      if(a[i-1]+a[i]>x){
        ans=ans+a[i-1]+a[i]-x;
        a[i]=x-a[i-1];
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 50528
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ESumEqualsXor solver = new ESumEqualsXor();
        solver.solve(1, in, out);
        out.close();
    }

    static class ESumEqualsXor {
        public static int MOD = 1_000_000_007;
        public long[] tmp = new long[100002];

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            tmp[0] = 1;
            for (int i = 1; i < tmp.length; i++) {
                tmp[i] = 3 * tmp[i - 1];
                tmp[i] %= MOD;
            }
            String l = in.next();
            long res = solveMe(l);
            out.println(res);


        /*for (int i=0; i<=100; i++) {
            out.println("i= " + Integer.toBinaryString(i) + " ; s = " + solveMe("" + Integer.toBinaryString(i)));
            out.println(solveMeSimple(i));
        }*/
        }

        private long solveMe(String l) {
            int pos = l.length() - 1;
            for (int i = 0; i < l.length(); i++)
                if (l.charAt(i) == '1') {
                    pos = i;
                    break;
                }
            return solveMeRec(l, pos);
        }

        private long solveMeRec(String l, int pos) {
            if (l.length() - 1 == pos)
                return l.charAt(pos) == '0' ? 1 : 3;
            long res = tmp[l.length() - pos - 1];

            int pos2 = l.length() - 1;
            for (int i = pos + 1; i < l.length(); i++)
                if (l.charAt(i) == '1') {
                    pos2 = i;
                    break;
                }
            long res2 = solveMeRec(l, pos2);
            res2 *= (l.charAt(pos) == '0' ? 1 : 2);
            res2 %= MOD;
            res += res2;
            res %= MOD;
            return res;

        }

    }
}



Measured memory_bytes: 42192
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

int main(void)
{
  long long int K, msum = 0, num = 7, mod, i, j;
  scanf("%lld", &K);
  mod = num % K;
  for (i = 0; i < K; i++)
  {
    msum = (msum + mod);
    if ((msum % K) == 0)
    {
      printf("%lld\n", (i + 1));
      break;
    }
    else if (i == (K - 1))
    {
      printf("-1");
    }
    mod = (mod * 10) % K;
  }
  return 0;
}


Measured memory_bytes: 1712
#include<stdio.h>
#include<string.h>
int main()
{
	int i,n,a,r,m=10000000;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		r=0;
		while(a%2==0){
			a/=2;
			r++;
		}
		if(r<m)m=r;
	}
	printf("%d\n",m);
	return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    int s[M], c[M];
    for(int i = 0; i < M; ++i){
        cin >> s[i];
        cin >> c[i];
    }
    int ans = -1;
    map<int,int> m;
    string S;
    bool OK;

    for(int i = 0; i < 1000; ++i){
        S = to_string(i);

        if(S.size() != N) continue;

        OK = true;
        for(int j = 0; j < M; ++j){
            if(S[s[j]-1] != ('0'+c[j])) OK = false;
        }
        
        if(OK){
            ans = i;
            break;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
n = int(input())

g = [[] for i in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append((b, i))
    g[b].append((a, i))

k = 0

memo = [-1] * (n-1)
used = [0] * n


q = deque([(0, 0)])
used[0] = 1
while q:
    v, used_number = q.popleft()
    mark = 1
    for nv, i in g[v]:
        if used[nv] > 0:
            continue
        if mark == used_number:
            mark += 1
        k = max(k, mark)
        used[nv] = 1
        memo[i] = mark
        q.append((nv, mark))
        mark += 1
        

print(k)
for m in memo:
    print(m)
        



Measured memory_bytes: 74272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int x;
    cin >> x;
    int tmp = x/500;
    
    cout << tmp * 1000 + (x-tmp*500)/5 * 5 << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n, x, y, m, counter = 0, count = 0;
    cin >> n;
    int a[n], b[n];

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

    // for (int i = 0; i < n; i++)
    // {
    // 	cout << b[i] << " ";
    // }
    // cout << endl;

    for (int i = 0; i < n - 1; i++)
    {
    	for (int j = i+1; j < n; j++)
    	{
    		counter = 0;
    		// cout << a[i] << " " << a[j] <<endl;
    		x = a[j];
    		a[j] = a[i];
    		a[i] = x;
    		// cout << endl << counter << endl;
    		for (int k = 0; k < n; k++)
    		{
    			if (a[k] == b[k])
    			{
    				counter ++;
    			}
    		}
    		if (counter == n)
    		{
    			// cout << endl;
    			// for (int i = 0; i < n; i++)
    			// {
    			// 	cout << a[i] << " ";
    			// }
    			// cout << endl;
    			// cout << i << " " << a[i] << " " << j << " " << a[j] << "YES" << counter << endl;
    			cout << "YES";
    			exit(0);
    			y = a[j];
    			a[j] = a[i];
    			a[i] = y;
    			// exit(0);
    		}
    		else if (counter != n)
    		{
    			y = a[j];
    			a[j] = a[i];
    			a[i] = y;
    			count ++;
    		}
    	}
    }

    // for (int i = 0; i < n; i++)
    // {
    // 	cout << b[i] << " ";
    // }

    // cout << endl;

    // for (int i = 0; i < n; i++)
    // {
    // 	cout << a[i] << " ";
    // }
    counter = 0;
    for (int i = 0; i < n; i++)
    {
    	if (a[i] == b[i])
    	{
    		counter++;
    	}
    }

    if (counter == n)
    {
    	cout << "YES";
    	exit(0);
    }

    m = (n*(n-1))/2;
    // cout << endl << m << endl << count << endl;

    if (count == m)
    {
    	cout << "NO";
    }

    return 0;
}

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

int main()
{
	string O, E; 
	cin >> O;
	cin >> E;

	string l, s;
	l = O;
	s = E;
	// if(O.length() >= E.length()){
	// 	l = O;
	// 	s = E;
	// }else{
	// 	l = E;
	// 	s = O;
	// }

	string ans;
	int lengths = l.length() + s.length();
	for(int i = 0; i < lengths; i++){
		if(!(i % 2)){
			ans.push_back(l[0]);
			l.erase(0, 1);
		}else{
			ans.push_back(s[0]);
			s.erase(0, 1);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> G[100500];
int mod = 1e9 + 7;
long long dp[100500][2];
void dfs(int node, int prev)
{
	dp[node][0] = dp[node][1] = 1;
	vector<int> can_go = G[node];
	for(int i=0;i<can_go.size();i++)
	{
		if(can_go[i] == prev)
			continue;
		else
		{
			dfs(can_go[i],node);
			dp[node][0] *= (dp[can_go[i]][0] + dp[can_go[i]][1]) % mod;
			dp[node][1] *= (dp[can_go[i]][0]);
			dp[node][0] %= mod;
			dp[node][1] %= mod;
		}
	}
	
}
int main()
{
	int n;
	cin>>n;
	for(int i = 0; i<n-1;i++)
	{
		int a, b;
		cin>>a>>b;
		G[a-1].push_back(b-1);
		G[b-1].push_back(a-1);
	}
	
	memset(dp,0,sizeof(dp));
	dp[0][0] = 1;
	dp[0][1] = 1;
	dfs(0,-1);
	cout<<(dp[0][0] + dp[0][1]) % mod<<endl;
	return 0;
}

Measured memory_bytes: 15616
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,c;
  cin >> n >> m >> c;
  int b[m],a[m];
  int ans = 0;
  int goukei = 0;
  rep(i,m) cin >> b[i];
  rep(j,n){
  rep(i,m) {
    cin >> a[i];
    goukei += a[i]*b[i];
    if(i==m-1){
      if((goukei+c)>0){
        ans++;
        
      }
      goukei = 0;
    }
  }
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long
#define ull unsigned long long
#define loop(i, n) for(int i = 0; i < n; i++)
#define sloop(i, s, n) for (int i = s; i < n; i++)
#define rloop(i, n) for (int i = n - 1; i >= 0; i--)

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll x, org, count = 0, z, ans = 0;
    cin >> x;
    org = x;
    if(x == 1) {
        cout << 0 << endl;
        return 0;
    }
    for(ll i = 2; i*i <= org; i++) {
        z = i;
        count = 0;
        while(!(x%z)) {
            x /= z;
            count++;
        }
        if(count) {
            int start = 1, end = count/2 + 1, mid, temp, temp_ans;
            while(start <= end) {
                mid = (start + end)/2;
                temp = (mid*(mid+1))/2;
                if(temp <= count) {
                    temp_ans = mid;
                    start = mid+1;
                } else {
                    end = mid-1;
                }
            }
            // cout << i << " " << temp_ans << endl;
            ans += temp_ans;
        }
    }
    if(x > 1) ans++;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
import sys,math
#DEBUG=True
DEBUG=False
if DEBUG:
    f=open("202007_2nd/C_input.txt")
else:
    f=sys.stdin
# Find the number of triples of integers (x,y,z) such that
# (x+y)**2 + (y+z)**2 + (x+z)**2 = 2*N
N=int(f.readline().strip())
ans=[0 for _ in range(N)]
I=int(math.sqrt(N))
for __ in range(I):
    A2=N-((__+1)**2)
    if A2<=0:
        break
    I2=int(math.sqrt(A2))
    for ___ in range(I2):
        A3=A2-((___+1)**2)
        if A3<=0:
            break
        I3=int(math.sqrt(A3))
        for ____ in range(I3):
            tmp=((__+___+2)**2)+((___+____+2)**2)+((__+____+2)**2)
            if tmp<=2*N:
                ans[int(tmp/2)-1]+=1
            else:
                break
for _ in range(N):
    print(ans[_])
f.close()

Measured memory_bytes: 9252
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	lli N;
	cin >> N;

	cout << (N % 2 ? N * 2 : N) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include "boost/multiprecision/cpp_int.hpp"
using ll = long long;
using ull = unsigned long long;
namespace mp = boost::multiprecision;

int main() {

	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	int N; std::cin >> N;

	int ans = 0;

	for (int i = 0; i < N; i++) {
		int l, r; std::cin >> l >> r;
		ans += (r - l + 1);
	}

	std::cout << ans;

	return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
int min(int x, int y) { return x < y ? x : y; }
int main() {
	int n, k, x, ans = 0;
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		ans += min(x, k - x) * 2;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    int n; ll k; cin >> n >> k;
    std::vector<ll> a(n);
    std::vector<ll> s(n+1, 0);

    rep(i,n) cin >> a[i];
    rep(i,n) s[i+1] = (s[i]+a[i]);
    rep(i,n+1) s[i] = (s[i]-i)%k;

    // rep(i,n+1) cout << s[i] << " ";
    // cout << '\n';

    ll ans = 0LL;

    map<ll,int> counts;
    queue<int> past_items;

    rep(i,n+1){

        //cout << i << " " << s[i] << " " << counts[s[i]] << endl;
        ans += counts[s[i]];
        counts[s[i]]++;

        past_items.push(s[i]);
        
        if(i >= k-1){
            counts[past_items.front()]--;
            past_items.pop();
        }
    }

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

Measured memory_bytes: 16768
#include <iostream>
#include <algorithm>

int N;
long long ar[200001];

int main() {
  std::cin>>N;
  for (int i = 0; i < N; ++i) {
    long long x;  std::cin>>x;
    ar[i] = x - (i+1);
  }
  std::sort(ar, ar+N);

  long long md = ar[N/2];
  long long ans = 0;
  for (int i= 0; i < N; ++i) {
    ans += std::abs(md-ar[i]);
  }
  std::cout<<ans<<"\n";

  return 0;
}


Measured memory_bytes: 1792
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let mut seq = vec![0; n];
    let mut ans = 0;
    for i in 0..n {
        seq[i] = read::<usize>();
        ans += seq[i] - 1;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;
typedef long long ll;

int h1,m1,h2,m2,k,ans;

int main()
{
	cin>>h1>>m1>>h2>>m2>>k;
	int t2=h2*60+m2;
	int t1=h1*60+m1;
	
	for(int i=t2;i>=t1;i--)
	{
		if(i-t1>k) ans++;
		else break;
	}
	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize ("-O3")
    #include <bits/stdc++.h>  
     
    using namespace std;
     
    typedef long long ll;
    typedef long double ld;
    typedef pair<int,int> p32;
    typedef pair<ll,ll> p64;
    typedef pair<double,double> pdd;
    typedef vector<ll> v64;
    typedef vector<int> v32;
    typedef vector<vector<int> > vv32;
    typedef vector<vector<ll> > vv64;
    typedef vector<vector<p64> > vvp64;
    typedef vector<p64> vp64;
    typedef vector<p32> vp32;
    ll MOD = 998244353;
    #define forn(i,e) for(ll i = 0; i < e; i++)
    #define forsn(i,s,e) for(int i = s; i < e; i++)
    #define rforn(i,s) for(ll i = s; i >= 0; i--)
    #define rforsn(i,s,e) for(ll i = s; i >= e; i--)
    #define ln "\n"
    #define dbg(x) cout<<#x<<" = "<<x<<ln
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define INF 1e18
    #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
    #define all(x) (x).begin(), (x).end()
    #define sz(x) ((ll)(x).size())
     
    ll mpow(ll a, ll b){
        if(b >= (MOD-1)) b %= (MOD-1);
        if(b==0) return 1;
        ll t1 = mpow(a,b/2);
        t1 *= t1;
        t1 %= MOD;
        if(b%2) t1 *= a;
        t1 %= MOD;
        return t1;
    }
     
    ll mpow(ll a, ll b, ll p){
        if(b==0) return 1;
        ll t1 = mpow(a,b/2,p);   t1 *= t1;
        t1 %= p;
        if(b%2) t1 *= a;
        t1 %= p;
        return t1;
    }
    ll modinverse(ll a, ll m){
        ll m0 = m; 
        ll y = 0, x = 1; 
        if (m == 1) return 0; 
        while (a > 1){
            ll q = a / m; 
            ll t = m; 
            m = a % m, a = t; 
            t = y; 
            y = x - q * y; 
            x = t; 
        }
        if (x < 0) x += m0; 
        return x; 
    }
    ll range(ll l, ll r){
        return l + rand()%(r-l+1);
    }
    ll cost[15];
    ll arr[15][15];
    ll inf = pow(10,9)+7;
    ll solve(vector<int>know , int x, int ci, int n , int cst)
    {
        
        bool fg = false;
        for(int i=0;i<know.size();i++)
        {
            if(know[i]<x)fg=true;
        }
        if(!fg)return cst;
        else if(ci>=n)return inf;
        else 
        {
            vector<int>tknow(know.size());
            for(int i =0;i<know.size();i++)
            {
                tknow[i] = know[i]+arr[ci][i];
            }
            return min(solve(tknow,x,ci+1,n,cst+cost[ci]) , solve(know,x,ci+1,n,cst));
        }
        
    }

    int main()
    {
        ll n,m,x;
        cin>>n>>m>>x;
        
        for(int i=0;i<n;i++)
        {
            cin>>cost[i];
            for(int j=0;j<m;j++)cin>>arr[i][j];
        }
        vector<int>know(m,0);
        ll ans = solve(know,x,0,n,0);
        if(ans>=inf)cout<<-1<<endl;
        else cout<<ans<<endl;
        return 0;
    }

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>

using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) {return (n==0)?1:10*TEN(n-1);}

string YES = "Possible";
string NO = "Impossible";

int main() {
    int n;
    scanf("%d", &n);
    vector<int> a(n);
    vector<vector<int>> v(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &(a[i]));
        v[a[i]].push_back(i);
    }
    if (n == 2) {
        //corner case
        cout << YES << endl;
        return 0;
    }


    int ma = -1;
    for (int i = 0; i < n; i++) {
        ma = max(ma, a[i]);
    }
    bool f = true;

    bool single = (ma % 2 == 0);
    int r = (ma+1)/2; //r
    /*
     single(false) : 2, 2+, 2+, ..., ma
     single(true)  : 1, 2+, 2+, ..., ma
     */
    for (int i = 1; i < r; i++) {
        if (v[i].size()) f = false;
    }
    if (single) {
        if (v[r].size() != 1) f = false;
    } else {
        if (v[r].size() != 2) f = false;
    }
    for (int i = r+1; i <= ma; i++) {
        if (v[i].size() < 2) f = false;
    }
    if (!f) {
        cout << NO << endl;
        return 0;
    }
    cout << YES << endl;
    return 0;
}


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

using namespace std;


void solve()
{
	int caseCount = 1;
	int n;
	while (cin >> n, n)
	{
		cout << "Case " << caseCount << ":" << endl;
		vector< vector<int> > field(n, vector<int>(n));
		int cnt = 1;
		field[0][0] = cnt;
		++cnt;
		int x = 0;
		int y = 0;
		int dx = 1;
		int dy = -1;
		while (!(x == n - 1 && y == n - 1))
		{
			if (n <= x + dx)
			{ 
				++y; 
				field[y][x] = cnt; 
				++cnt;
				dx = -1; 
				dy = 1; 
				continue; 
			}
			else if (n <= y + dy)
			{ 
				++x; 
				field[y][x] = cnt;
				++cnt;
				dx = 1; dy = -1; 
				continue; 
			}
			else if (y + dy < 0)
			{ 
				++x; 
				field[y][x] = cnt;
				++cnt;
				dx = -1; 
				dy = 1; 
				continue; 
			}
			else if (x + dx < 0)
			{ 
				++y; 
				field[y][x] = cnt;
				++cnt;
				dx = 1; 
				dy = -1; 
				continue; 
			}
			x += dx;
			y += dy;
			field[y][x] = cnt;
			++cnt;
		}
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				printf("%3d", field[i][j]);
			}
			cout << endl;
		}
		++caseCount;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
// #include <bits/stdtr1c++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;


/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")*/

/// Typedef
typedef long long           ll;
typedef unsigned long       ul;
typedef unsigned long long  ull;
typedef vector<int>         vi;
typedef vector<ll>          vl;
typedef vector<vi>          vvi;
typedef vector<ll>          vll;
typedef pair<int,int>       pii;
typedef pair<ll,ll>         pll;

#define pb                  push_back
#define ppb                 pop_back
#define MP                  make_pair
#define ff                  first
#define ss                  second
#define sf                  scanf
#define pf                  printf
#define loop(i, y)          for(int i=0; i<int(y); i++)
#define FOR(i, x, y)        for(int i=int(x); i<int(y); i++)
#define ROF(i, x, y)        for(int i=int(x); i>=int(y); i--)
#define all(c)              c.begin(), c.end()
#define sz(c)               int(c.size())
#define clr(x, y)           memset(x, y, sizeof(x))
#define si(x)               scanf("%d", &x)
#define sii(x, y)           scanf("%d %d", &x, &y)
#define siii(x, y, z)       scanf("%d %d %d", &x, &y, &z)
#define sl(x)               scanf("%lld", &x)
#define sll(x, y)           scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       scanf("%lld %lld %lld", &x, &y, &z)
#define MAX                 10005
#define MOD                 1000000009
#define base                1000000007
#define eps                 1e-9
#define INF                 1llu<<61    // 2,305,843,009,213,693,952
#define inf                 1<<29       // 536,870,912
#define PI                  acos(-1.0)  // 3.1415926535897932
// #define INF              0x3f3f3f3f3f3f3f3f
// #define inf              0x3f3f3f3f

struct info
{
    string name;
    int s,id;
}ara[MAX];
bool cmp(info a,info b){
    if(a.name == b.name)return a.s>b.s;
    return a.name<b.name;
}
int main(){
    #ifdef VAMP
        clock_t tStart = clock();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int n;
    si(n);
    FOR(i,0,n){
        string str;
        int x;
        cin>>str>>x;
        ara[i].name = str;
        ara[i].s = x;
        ara[i].id= i;
    }sort(ara,ara+n,cmp);
    FOR(i,0,n){
        cout<<ara[i].id+1<<endl;    
    }
    #ifdef VAMP
       printf("\n>>Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
    #endif

    return 0;
}

Measured memory_bytes: 384
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String args[]) {

		try (Scanner sc = new Scanner(System.in)) {

			sc.nextInt();
			sc.nextLine();

			String[] s = sc.nextLine().split(" ");

			Set<String> set = new HashSet<>(Arrays.asList(s));

			System.out.println(set.size() == 3 ? "Three" : "Four");

		}

	}

}


Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;

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

    map<char, long long> map_s;
    map<char, long long> map_t;

    bool ok = true;
    for(long long i = 0; i < s.size(); i++){
        if(map_s.find(s[i]) != map_s.end()){
            if(map_s[s[i]] != t[i]){
                ok = false;
            }
        }
        if(map_t.find(t[i]) != map_t.end()){
            if(map_t[t[i]] != s[i]){
                ok = false;
            }
        }

        map_s[s[i]] = t[i];
        map_t[t[i]] = s[i];
    }

    if(ok == true){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 776
#include <iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<numeric>
#include<algorithm>

using namespace std;

int Euclid(int a,int b){
    int k;
    if(a>b){
        k=b;
        b=a;
        a=k;
    }
    int r=1;
    while(r!=0){
        r=b%a;
        k=a;
        a=r;
        b=k;
    };
    return b;
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N,0);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int ans=A[0];
    for(int i=1;i<N;i++){
        ans=Euclid(ans,A[i]);
    }
    cout << ans << endl;
    return 0;
}


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

bool primeFlg[1000000];

void makePrime(){
  memset(primeFlg, true, sizeof(primeFlg));
  primeFlg[0] = primeFlg[1] = false;
 
  for(int i = 2; i * i <= 1000000; i++){
    if(primeFlg[i]){
      for(int j = i + i; j < 1000000; j += i){
        primeFlg[j] = false;
      }
    }
  }
}

int main(){
  makePrime();

  int n;

  while(cin >> n, n){
    int answer = 0;

    for(int i = 2; i < n; i++){
      int j = n - i;

      if(i <= j && primeFlg[i] && primeFlg[j]){
        answer++;
      }
    }

    cout << answer << endl;
  }
}

Measured memory_bytes: 2144
#include <stdio.h>

int main(){

    int n, k, x = 1;

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

    for (int i = 1; i <= n; i++) {

        if (x*2 < x+k)
            x = x*2;

        else if (x+k < x*2)
            x = x+k;

        else
            x = x+k;
    }

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

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include<string>
#include<utility>
#include<iterator>
#include<regex>
#include<math.h>

#define lli long long
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define rep0(i,j) for(lli i=0;i<j;i++)
#define rep1(i,j) for(lli i=1;i<=j;i++)
#define rep0d(i,j) for(lli i=j-1;i>=0;i--)
#define MAX 1000000007
typedef struct tree Tree;

using namespace std;

bool cmpf(pair<lli, lli> left, pair<lli, lli> right) {
	return left.first < right.first;
}
bool cmp(pair<lli, lli> left, pair<lli, lli> right) {
	if (left.first != right.first)return left.first < right.first;
	else return left.second < right.second;
}

int main() {
	lli dv[2][26], n;
	rep0(i, 2)rep0(j, 26)dv[i][j] = 0;
	string s;
	cin >> n >> s;
	vector<lli> ans(n);
	rep0(i, n) dv[0][(int)(s[i] - 'a')]++;
	rep0(i, n) {
		dv[1][(int)(s[i] - 'a')]++;
		dv[0][(int)(s[i] - 'a')]--;
		rep0(j, 26)if (dv[1][j] > 0 && dv[0][j] > 0)ans[i]++;
	}
	sort(rall(ans));
	cout << ans[0];
}


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n+1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    int t = 1;
    int ans = 0;
    int f = 0;
    while(ans < n){
        t = a[t];
        ans++;
        if(t == 2)break;
        //if(t == a[t]){f = 1; break;}
    }
    if(ans < n)cout << ans;
    else cout << -1;

}

Measured memory_bytes: 3712
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <assert.h>
#define IOS ios::sync_with_stdio(false)
using namespace std;
#define inf (0x3f3f3f3f)
typedef long long int LL;


#include <iostream>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <bitset>
const int maxn = 2e5 + 20;
int fa[2][maxn];
int getFa(int u, int which) {
    if (fa[which][u] == u) return u;
    else return fa[which][u] = getFa(fa[which][u], which);
}
void toMerge(int x, int y, int which) {
    x = getFa(x, which);
    y = getFa(y, which);
    fa[which][y] = x;
}
map<pair<int, int>, int>al;
void work() {
    int n, k1, k2;
    scanf("%d%d%d", &n, &k1, &k2);
    for (int i = 1; i <= n; ++i) {
        fa[0][i] = fa[1][i] = i;
    }
    for (int i = 1; i <= k1; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        toMerge(u, v, 0);
    }
    for (int i = 1; i <= k2; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        toMerge(u, v, 1);
    }
    for (int i = 1; i <= n; ++i) {
        al[make_pair(getFa(i, 0), getFa(i, 1))]++;
    }
    for (int i = 1; i <= n; ++i) {
        cout << al[make_pair(getFa(i, 0), getFa(i, 1))] << " ";
    }
}

int main() {
#ifdef local
    freopen("data.txt", "r", stdin);
//    freopen("data.txt", "w", stdout);
#endif
    work();
    return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;

int main ()
{
    char la [4] = {'A' , 'C' , 'G' , 'T'} , l ;
    cin >> l ;

    if (l == la[0] )
        cout << la[3] << endl ;
    else if (l == la [3] )
        cout << la[0] << endl ;
    else if (l == la [1])
        cout << la[2] << endl ;
    else if (l == la [2])
        cout << la[1] << endl ;

    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //printf(f,##__VA_ARGS__),fflush(stdout)

typedef long long ll;

const int N=55;

/*
int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
*/

ll f[2],n,p;

int main(int argc,char *argv[]){
#ifdef CCURIOUSCAT
	freopen("dat.in","r",stdin);
	freopen("my.out","w",stdout);
#endif
	cin>>n>>p;	
	f[0]=1,f[1]=0;
	rep(i,1,n){
		ll x;
		cin>>x;
		ll u[2];
		u[0]=f[0],u[1]=f[1];
		
		Pr("%lld,%lld\n",f[0],f[1]); 
		if(x%2)f[0]+=u[1],f[1]+=u[0];
		else f[1]+=u[1],f[0]+=u[0];
		Pr("%lld,%lld\n",f[0],f[1]); 
	}
	cout<<f[p]<<endl;
	return 0;
}

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

void Main() {
    int n, v;
    cin >> n;
    vector<int> A(n);
    for (auto &e : A) {
        cin >> e;
    }
    rep(i, n) { cout << A.at(i) << (i != n - 1 ? " " : "\n"); }
    for (int i = 1; i < n; i++) {
        v = A.at(i);
        int j = i - 1;
        while (j >= 0 && A[j] > v) {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        rep(k, n) { cout << A.at(k) << (k != n - 1 ? " " : "\n"); }
    }
}
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


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

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long x = sc.nextInt();
		int cnt = 0;
		
		long[] nums = new long [N];
		long sum = 0;
		for(int i=0; i<N; i++) {
			nums[i] = sc.nextLong();
			sum += nums[i];
		}
		Arrays.sort(nums);
		
		if (x>sum) {
			System.out.println(N - 1);
		} else if (x == sum ) {
			System.out.println(N);
		} else {
			for(int i=0; i<N; i++) {
				if(nums[i] <= x) {
					x = x - nums[i];
					cnt++;
				}
			}
			System.out.println(cnt);
		}
		
	}
	
}


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

int N, M;  
cin >> N >> M;
vector<int> a(N);
rep(i,N){cin >> a.at(i);}

int temp, max;
max = 0;

rep (i,M){max += a.at(i);}
temp = max;

rep(i,N-M){
	temp = temp - a.at(i) + a.at(i+M);
  if (temp > max){max = temp;}
  }
long double ans = 0;
ans = (max+M)/2.0 ;
  
	cout<<fixed<<setprecision(10)<<ans<<endl;

  

}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int n;

int main()
{
    cin >> n;
    if(n % 10 == 7 || n / 10 % 10 == 7 || n / 100 % 10 == 7)
        cout << "Yes" << '\n';
    else
        cout << "No" << '\n';
    return 0;
}


Measured memory_bytes: 3636
import sys
from math import pi
# import bisect
# from collections import deque

Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
 
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 998244353


# for _ in range(int(ri())):
n,k  =Ri()
a = Ri()
summ = sum(a)
if summ > n : 
    print(-1)
else:
    print(n-summ)

Measured memory_bytes: 67916
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
	if(!x){putchar('0');return;}
	int top=0;
	while(x)stack[++top]=x%10,x/=10;
	while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
char ss[15][1010];
int top,sta[15],sum[15];
int main()
{
    //freopen("a.in","r",stdin);
    //freopen("a.out","w",stdout);
   	int n=read(),m=read(),K=read();
   	for(int i=1;i<=n;i++)scanf("%s",ss[i]+1);
   	int ans=n*m;
   	for(int k=0;k<(1<<n);k++)
   	{
   		bool bk=true;int cnt=0;
   		for(int j=1;j<=m;j++)
   		{
   			top=1;
   			for(int i=1;i<=n;i++)
   			{
   				sta[top]+=ss[i][j]-'0';
   				if(k>>i&1)
				{
				   top++;
				   if(j==1)cnt++;
				}
   			}
   			bool pd=true;
   			for(int i=1;i<=top;i++)
   			{
   				if(sta[i]>K)bk=false;
   				if(sum[i]+sta[i]>K)pd=false;
   			}
   			if(pd==false)
			{
				cnt++;
   				for(int i=1;i<=top;i++)sum[i]=sta[i];
   			}
   			else for(int i=1;i<=top;i++)sum[i]+=sta[i];
			for(int i=1;i<=top;i++)sta[i]=0;
			if(j==m)for(int i=1;i<=top;i++)sum[i]=0;
   		}if(bk==true)ans=min(ans,cnt);
   	}pr2(ans);
    return 0;
}

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

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

#define REP(_i, _a) for(int _i = 0; _i < (int)_a; ++_i)
#define FOR(_i, _a, _b) for(int _i = (int)_a; _i <= (int)_b; ++_i)
#define FORD(_i, _a, _b) for(int _i = (int)_a; _i >= (int)_b; --_i)
#define RESET(_a, _value) fill_n(_a,sizeof(_a)/sizeof(_a[0]),_v)
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

// DEBUG UTIL
#define DEBUG(args...) { cerr << "> "; \
						 string _s = #args; \
						 replace(_s.begin(), _s.end(), ',', ' '); \
						 stringstream _ss(_s); istream_iterator<string> _it(_ss); \
						 err(_it, args); }

void err(istream_iterator<string> it) { cerr << endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << ": " << a << " ";
	err(++it, args...);
}

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

string format(const string& s, ...) {
    va_list args;
    va_start (args, s);
    size_t len = vsnprintf(NULL, 0, s.c_str(), args);
    va_end (args);
    std::vector<char> vec(len + 1);
    va_start (args, s);
    vsnprintf(&vec[0], len + 1, s.c_str(), args);
    va_end (args);
    return &vec[0];
}

const double PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

int D, N;

void read() {
	cin >> D >> N;
}

void solve() {
	if (D == 0) D = 1;
	else if (D == 1) D = 100;
	else D = 10000;
	if (N != 100)  cout << D * N << endl;
	else if (N == 100) cout << D * N + D << endl;
}

int main() {
	FAST_IO();

	int TC = 1;
	// cin >> TC;
	FOR(tc, 1, TC) {
		read();
		solve();
	}

	return 0;
}


Measured memory_bytes: 256
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n;
  cin >> n;
  vll a(n);
  rep(i, n){
    cin >> a[i];
  }
  a.emplace_back(0);
  ll m = 1000, k = 0;
  rep(i, n){
    if(a[i] <= a[i+1]){
      k += m/a[i];
      m %= a[i];
    }else{
      m += k*a[i];
      k = 0;
    }
  }
  print(m);
}


Measured memory_bytes: 3588
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let n: usize = scan(tokens);
    let m: usize = scan(tokens);
    if n == m {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
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; }
 
ll MOD = 1000000007;
ll INF =1<<30;



int main(){
   ll h,w;
   cin >> h >>w;
   ll ans;
   if(h==1||w==1) {
       cout <<1 <<endl;
       return 0;
   }
   if(h%2==1&&w%2==1) {
       ans = h*w/2+1;
       cout << ans <<endl;
   }
   else {
       ans = w*h/2;
       cout << ans <<endl;
   }
}

Measured memory_bytes: 3572
#include <stdio.h>
#include <iostream>
#include <climits>
#include <map>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <vector>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <utility>
#include <queue>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define fr first
#define sc second
#define scl(n) scanf("%lld", &n)
#define scd(n) scanf("%lf", &n)
#define scc(n) scanf(" %c", &n)
#define scs(n) scanf(" %s", n)
#define pll pair<ll, ll>
#define bigprime 9867589359258017
#define pbase 925943
#define pmod 1351782499
#define pi acos(-1.0)

int main()
{
    ll n, m, i, j;
    while(1)
    {
        scl(n);
        scl(m);
        if(n==0 && m==0)
            break;
        for(i=1; i<=n; i++)
        {
            for(j=1; j<=m; j++)
            {
                if(i%2==1)
                {
                    if(j%2==1)
                        printf("#");
                    else
                        printf(".");
                }
                else
                {
                    if(j%2==0)
                        printf("#");
                    else
                        printf(".");
                }
            }
            cout<<endl;
        }
        cout<<endl;

    }


}










Measured memory_bytes: 3156
#include <stdio.h>

int main(int argc, const char * argv[])
{

    int data[100] = {0};
    int i, n, max = 0;
    
    while (scanf("%d", &n) != EOF) {
        data[n]++;
    }
    
    for (i = 0; i < 100; i++) {
        if (max < data[i]) {
            max = data[i];
        }
    }
    
    for (i = 0; i< 100; i++) {
        if (max == data[i]) {
            printf("%d\n", i);
        }
    }
    
    
    return 0;
}

Measured memory_bytes: 596