akhauriyash/Code-Regression huggingface dataset:
/**Bismillahir Rahmanir Rahim.**/
/*
         Md.Fagun Molla
         18ICTCSE006
         BSMRSTU(SHIICT)
*/
#include <bits/stdc++.h>
using namespace std;


#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  ll               long long
#define  vi               std::vector<int>
#define  pb               push_back
#define  MAX              100007
#define  End              return 0;
#define  pi               acos(-1)


int main () {
    ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
    ll n;
    double an;
    cin>>n;
    an=n/3.0;
    printf("%.12lf\n",an*an*an);
    End
}
/* pray for me
Do before die
*/


Measured memory_bytes: 256
X, Y = map(int, input().split())
ans = 0
for z in [X,Y]:
  if z == 3:
    ans += 10**5
  elif z == 2:
    ans += 2*10**5
  elif z == 1:
    ans += 3*10**5
if X == Y == 1:
  ans += 4*10**5
print(ans)


Measured memory_bytes: 2940
N, M = map(int, input().split())
requires = [tuple(map(int, input().split())) for _ in range(M)]
requires.sort()
cnt = 0
last = 0
for require in requires:
  if last <= require[0]:
    cnt += 1
    last = require[1]
  last = min(last, require[1])
print(cnt)

Measured memory_bytes: 19008
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <queue>
#include <map>
#include <fstream>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define INF 1e9 
typedef long long ll;
typedef long double ld;
int main(){
    ll n;
    cin>>n;
    ll d=1e9+7;
    ll a=1,b=1,c=1;
    REP(i,n){
        a*=10;
        a=a%d;
        b*=9;
        b=b%d;
        c*=8;
        c=c%d;
    }
    ll ans=(a-b*2+c)%d;
    cout<<((ans>=0)?ans:ans+d)<<endl;
    return 0;
}


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

typedef long long ll;

vector<int> v(5);
vector<int> mod(5);

int main(){
    for(int i = 0; i < 5; i++){
        cin >> v[i];
        mod[i] = v[i]%10;
    }

    int index = -1;
    int mi = 150;
    for (int i = 0; i< 5; i++){
        if (mod[i] < mi && mod[i] != 0){
            index = i;
            mi = mod[i]; 
        }
    }

    for (int i = 0; i < 5; i++){
        if (i != index && mod[i] != 0){
            v[i] += (10 - mod[i]);
            //cout << v[i] << endl;
        }
    }    

    int res = 0;
    for (int i = 0; i < 5; i++){
        res += v[i];
    }

    cout << res << endl;
}

Measured memory_bytes: 256
n = int(input())
k = int(input())
c = 0
r = 1
for i in [1, 2, 4, 8, 16]:
    if i <= k: c += 1
for i in range(n):
    if i <= (c-1):
        r *= 2
    else:
        r += k
print(r)


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

int main(){
  int N,t=0;
  cin>>N;
  for(int i=0;i<N;i++){
    int p;
    cin>>p;
    if(p-1!=i){
      t++;
    }
  }
  if(t==0||t==2){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
  return 0;
}

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

int main(){
    int a,b,c;
    cin >> a >> b;
    vector<int> vec(3);
    vec.at(0) = a + b;
    vec.at(1) = a - b;
    vec.at(2) = a * b;
    sort(vec.begin(),vec.end());
    cout << vec.at(2) <<  endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main()
{
  int n;
  cin >> n;
  vector<pair<int, int>> d(n);
  rep(i, n)
  {
    cin >> d[i].first >> d[i].second;
  }
  bool ok = false;
  rep(i, n - 2)
  {
    if (d[i].first == d[i].second && d[i + 1].first == d[i + 1].second && d[i + 2].first == d[i + 2].second)
    {
      ok = true;
      break;
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N, C;
map<int, vector<Pii>> chan;
map<int, vector<Pii>> newchan;
map<int, int> evu;
map<int, int> evd;

int main() {
  cin >> N >> C;
  rep(i, 0, N) {
    int s, t, c;
    cin >> s >> t >> c;
    chan[c].push_back(Pii(s, t));
  }

  for (auto e : chan) {
    sort(e.second.begin(), e.second.end());
    if (e.second.size() == 0) {
      continue;
    }

    int s = e.second[0].first;
    int t = e.second[0].second;
    for (int i = 1; i < e.second.size(); ++i) {
      if (t != e.second[i].first) {
        newchan[e.first].push_back(Pii(s, t));
        s = e.second[i].first;
        t = e.second[i].second;
      } else {
        t = e.second[i].second;
      }
    }
    newchan[e.first].push_back(Pii(s, t));
  }

  for (auto e : newchan) {
    for (auto v : e.second) {
      evu[v.first]++;
      evd[v.second]++;
    }
  }

  int ans = 0;
  int sum = 0;
  repe(i, 1, 100000) {
    sum += evu[i];
    chmax(ans, sum);
    sum -= evd[i];
    chmax(ans, sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 14956
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        String ans = "No";
        for (int k = 1, x; (x = k * (k - 1) / 2) <= N; k++) {
            if (x == N) {
                StringBuilder sb = new StringBuilder("Yes\n");
                sb.append(k).append('\n');

                for (int i = 1; i < k; i++) {
                    sb.append(k - 1).append(' ');

                    int t = 1 + i * (i - 1) / 2;
                    for (int j = 1; j < i; j++) {
                        sb.append(t++).append(' ');
                    }

                    for (int j = i; j < k; j++) {
                        sb.append(t).append(' ');
                        t += j;
                    }
                    sb.append('\n');
                }

                sb.append(k - 1).append(' ');
                int t = 1;
                for (int i = 2; i <= k; i++) {
                    sb.append(t).append(' ');
                    t += i;
                }

                ans = sb.toString();
            }
        }

        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 40712
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	ll n;
	cin >> n;
	vector<ll> a(n+1);
	for(ll x=1; x*x+x<= n; x++){
		for(ll y=1; y*y+y<=n; y++){
			for(ll z=1; z*z+z<=n; z++){
				ll cnt = x*x+y*y+z*z+x*y+y*z+z*x;
				if(cnt > n) continue;
				a[cnt]++;
			}
		}
	}
	loop(i, 1, n+1){
		cout << a[i] << endl;
	}
	return 0;
}


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

int main()
{
    string s;
    while(cin>>s)
    {
        if(s=="-")break;
        int m;
        cin>>m;
        REP(i,m)
        {
            int n;
            cin>>n;
            string k=s.substr(0,n);
            s.erase(s.begin(),s.begin()+n);
            s+=k;
        }
        cout<<s<<endl;
    }
}


Measured memory_bytes: 3196
import itertools
from copy import deepcopy
import itertools

h, w, kk = map(int, input().split())
c = [list(input()) for i in range(h)]

ite = list(itertools.product([0, 1], repeat=h+w))

ans = 0

for d in ite:
    c2 = deepcopy(c)
    for i in range(h):
        if d[i] == 1:
            for j in range(w):
                c2[i][j] = 'R'
    for k in range(h,h+w):
        if d[k] == 1:
            for l in range(h):
                c2[l][k-h] = 'R'
    c3 = list(itertools.chain.from_iterable(c2))
    if c3.count('#') == kk:
        ans += 1

print(ans)

Measured memory_bytes: 9648
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int>L(110);
    for(int i=0;i<N;i++)cin>>L[i];
    sort(L.begin(),L.end());
    reverse(L.begin(),L.end());
    int ans=0;
    for(int i=1;i<N+1;i++){
       ans+=L[i];
    }
   
    if(L[0]<ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

    class Program
    {
        static void Main(string[] args)
        {
            List<string> inputList = new List<string>();
            int num = int.Parse(Console.ReadLine());
            string strInput = Console.ReadLine();
            string[] strInputArray = strInput.Split(' ');
            int[] inputArray = Array.ConvertAll<string, int>(strInputArray, delegate(string value) { return int.Parse(value); });
            string strMin = inputArray.Min().ToString();
            string strMax = inputArray.Max().ToString();
            long strSum = 0;
            for (int i = 0; i < num; i++)
            {
                strSum = strSum + inputArray[i];
            }
            
            string output = strMin + " " + strMax + " " + strSum;
            Console.WriteLine(output);

            Console.ReadLine();
        }
    }


Measured memory_bytes: 18304
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(a+b>c+d)cout << "Left" << endl;
  else if(a+b==c+d)cout << "Balanced" << endl;
  else cout << "Right" << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            String strData = Console.ReadLine();

            if (strData.Equals("-"))
            {
                break;
            }

            int countShuffle = int.Parse(Console.ReadLine());

            for (int i = 0; i < countShuffle; i++)
            {
                int shuffleNumber = int.Parse(Console.ReadLine());

                String upData = strData.Substring(0, shuffleNumber);
                String downData = strData.Substring(shuffleNumber);

                strData = downData + upData;

            }

            Console.WriteLine(strData);
        }
    }
}

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

int main() {
  int N, K, sum;
  cin >> N >> K;
  
  sum = 1;
  int i = 0;
  while(i < N){
    if (sum * 2 > sum + K) {
      sum += K;
    } else {
      sum *= 2;
    }
    i++;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n,d;
    cin>> n >> d;
    vector<vector<double>> x(n,vector<double>(d,0));

    rep(i,n){
        rep(j,d){
            cin >> x[i][j];
        }
    }

    int cnt = 0;
    rep(i,n){
        rep(j,n){
            if(i==j) continue;
            double dist = 0;
            rep(k,d){
                dist+=pow(abs(x[i][k]-x[j][k]),2);
            }
            dist=sqrt(dist);
            if(floor(dist)==dist) cnt++;
        }
    }

    cout << cnt/2 <<endl;
    return 0;


}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string s[10],t[10];
int main(){
    int i,j,k,l,r,h,w,ans = 0;
    cin >> h >> w >> k;
    for(i=0;i<h;i++){
        cin >> s[i];
    }
    for(i=0;i<(1<<h);i++){
        for(j=0;j<(1<<w);j++){
            for(l=0;l<h;l++){
                t[l] = s[l];
            }
            for(l=0;l<h;l++){
                if((1<<l) & i){
                    for(r=0;r<w;r++){
                        t[l][r] = 'a';
                    }
                }
            }
            for(r=0;r<w;r++){
                if((1<<r) & j){
                    for(l=0;l<h;l++){
                        t[l][r] = 'a';
                    }
                }
            }
            int cnt = 0;
            for(l=0;l<h;l++){
                for(r=0;r<w;r++){
                    if(t[l][r]=='#') cnt++;
                }
            }
            if(cnt==k) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
import std;

alias Node = Tuple!(int, "val", int, "prev");

void calc(int n, int[][] adj) {

    auto used = new int[n];
    used[] = -1;

    auto q = DList!Node();
    q.insertBack(Node(0, 0));
    while (!q.empty) {
        auto node = q.front; q.removeFront();

        if (used[node.val] != -1) continue;
        used[node.val] = node.prev;

        foreach (e; adj[node.val]) {
            q.insertBack(Node(e, node.val));
        }
    }

    if (used.all!(e => e != -1)) {
        writeln("Yes");
        foreach (e; used[1..$]) writeln(e + 1);
    }
    else writeln("No");
}

void main() {
    int n, m; scan(n, m);
    int[][] adj;
    foreach (_; 0..n) adj ~= [[]];
    foreach (_; 0..m) {
        int a, b; scan(a, b);
        a--; b--;
        adj[a] ~= b;
        adj[b] ~= a;
    }
    calc(n, adj);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;


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

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

	if(N % 10 == 2 || N % 10 == 4 || N % 10 == 5 || N % 10 == 7 || N % 10 == 9){
		cout << "hon" << endl;
	}else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8){
		cout << "pon" << endl;
	}else{
		cout << "bon" << endl;
	}
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void print_YES_NO(bool answer){cout<<(answer?"YES":"NO")<<endl;}
void print_Yes_No(bool answer){cout<<(answer?"Yes":"No")<<endl;}
void print_POSSIBLE_IMPOSSIBLE(bool answer){cout<<(answer?"POSSIBLE":"IMPOSSIBLE")<<endl;}

int t[3][2];

LL check3(int p,LL n){
	LL a,b,c;
	LL i,j,k;
	LL s=0;
	for(i=0;i<=n;i++){
		if((a=i*t[0][p])>n)break;
		for(j=0;a<=n;j++,a+=t[1][p]){
			b=(n-a)/t[2][p];
			c=n-a+b*(t[2][1-p]-t[2][p])+i*t[0][1-p]+j*t[1][1-p];
			if(s<c)s=c;
		}
	}
	return s;
}
			
LL check2(int p,int x,int y,LL n){
	LL a,b,c;
	LL i,j,k;
	LL s=0;
	a=0;
	for(i=0;a<=n;i++,a+=t[x][p]){
		b=(n-a)/t[y][p];
		c=n-a+b*(t[y][1-p]-t[y][p])+i*t[x][1-p];
		if(s<c)s=c;
	}
	return s;
}			

LL check(int p,LL a,LL b,LL n){
	LL x,y,z;
	if(a==0)return n;
	if(a==1){
		if(b==4)b=2;
		else b--;
		x=n/t[b][p];
		return n+x*(t[b][1-p]-t[b][p]);
	}
	if(a==3)return check3(p,n);
	if(b==3)return check2(p,0,1,n);
	if(b==5)return check2(p,0,2,n);
	if(b==6)return check2(p,1,2,n);
	
}

int main(){
	LL n,m;
	int i,j,k;
	LL a,b,c;
	cin>>n;
	for(i=0;i<2;i++){
		for(j=0;j<3;j++){
			cin>>t[j][i];
		}
	}
	a=0,b=0;
	for(i=0;i<3;i++){
		if(t[i][0]<t[i][1])b+=(1<<i),a++;
	}
	n=check(0,a,b,n);
	a=0,b=0;
	for(i=0;i<3;i++){
		if(t[i][0]>t[i][1])b+=(1<<i),a++;
	}
	n=check(1,a,b,n);
	cout<<n<<endl;
}


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


Measured memory_bytes: 3920
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long ll;

#define F first
#define S second
#define PB push_back
#define MP make_pair

int N, M;
unordered_map<int, vector<int>> G;

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

  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    G[A].PB(B);
    G[B].PB(A);
  }
  queue<int> q;
  vector<int> visit(N, -1);

  q.push(0);
  visit[0] = 0;

  while (!q.empty()) {
    int u = q.front();
    q.pop();

    for (int v : G[u]) {
      if (visit[v] >= 0)
        continue;
      visit[v] = u;
      q.push(v);
    }
  }
  bool found = false;
  for (int i = 0; i < N; i++) {
    if (visit[i] < 0) {
      found = true;
    }
  }
  if (found) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
    for (int i = 1; i < N; i++) {
      cout << 1 + visit[i] << endl;
    }
  }
}

Measured memory_bytes: 14448
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl

using namespace std;
using ll = long long;
using P = pair<int, int>;



int main() {
    int n, m; cin >> n >> m;
    priority_queue<ll> a;
    rep(i, n) {
        ll num; cin >> num;
        a.push(num);
    }

    while (m > 0) {
        ll k = a.top();
        a.pop();
        k >>= 1; 
        --m;
        a.push(k);
    }

    vector<ll> b;
    while (!a.empty()) {
        b.push_back(a.top());
        a.pop();
    }

    cout << accumulate(all(b), 0ll) << endl;
}

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

int main() {
  int N,K;
  string S;
  cin>>N>>S>>K;
  char e=S[K-1];
  for(int i=0;i<N;i++){
    if(S[i]!=e)  S[i]='*';
  }
cout<<S<<endl;
}


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

int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  int64_t res = 0;
  for (int i = 0; i < N; ++i) res += (int64_t) (i + 1) * (N - i);
  for (int i = 0; i + 1 < N; ++i) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    if (x > y) swap(x, y);
    res -= (int64_t) (x + 1) * (N - y);
  }

  cout << res << endl;

  return 0;
}



Measured memory_bytes: 3640
#include <cstdio>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string.h>
using namespace std;
const int INF = 1147483647;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,start,end) for(int i=(start);i<(end);++i)
#define pint(i) printf("%d\n",(i))
#define pint2(i,j) printf("%d %d",(i),(j))
#define pint3(i,j,k) printf("%d %d %d",(i),(j),(k))
#define gint(i) scanf("%d",&(i))
#define gint2(i,j) scanf("%d %d",&(i),&(j))
#define gint3(i,j,k) scanf("%d %d %d",&(i),&(j),&(k))
#define gchar(i) scanf("%c",&(i))
#define init(tar,val) memset((tar),(val),sizeof((tar)))
#define show(tar,len) for(int i=0;i<(len);++i) \
	cout<<tar[i]<<' ';\
	cout<<endl;




class bignum{
public:
	bignum(int size = 4) :len(size){
	}
	~bignum(){
	}
	int size()const{
		return len;
	}
	//int get(int id)const{
	//	return num[id];
	//}
	friend ostream &operator<<(ostream &output, const bignum &b){
		bool stu = false;
		for (int i = int(b.len - 1); i >= 0; --i){
			if (stu)
				printf("%09d", b.num[i]);
			else if (b.num[i] > 0){
				printf("%d", b.num[i]);
				stu = true;
			}
		}
		if (stu == false)
			printf("0");
		return output;
	}
	const bignum& operator+=(const bignum&right){
		int add = 0;
		for (int i = 0; i < len; ++i){
			int tmp = 0;
			if (i < right.size()){
				tmp = right.num[i] + num[i] + add;
			}
			else{
				tmp = num[i] + add;
			}
			num[i] = tmp%gap;
			add = tmp / gap;
		}
		return *this;
	}
	const bignum& operator=(const bignum&right){
		for (int i = 0; i <len; ++i){
			num[i] = right.num[i];
		}
		return *this;
	}
	void set(int a){
		for (int i = 0; i <len; ++i){
			num[i] = a%gap;
			a /= gap;
		}
	}
private:
	int  num[4];
	int len;
	static const int gap = 1000000000;
};


//inline int id(int i){
//	return i & 1;
//}
//
//inline int last(int i){
//	return (i - 1) & 1;
//}
//
//void myshow(int i){
//	rep(j, 0, ){
//		cout << dp[id(i)][j] << ' ';
//	}
//	cout << endl;
//}


//#define my_debug

const int MAX_N = 100005;
int all[MAX_N];
bool stu[MAX_N];

int n, q;

void solve(){

}

int get_f(int i){
	if (stu[i])
		return i;
	int out = all[i];
	if (stu[out])
		return out;
	else
		return get_f(out);
}


int main(){
#ifdef my_debug
	freopen("a.in", "r", stdin);
#endif
	while (gint2(n,q) != EOF){
		ll out = 0;
		if (n == 0 && q == 0)
			break;
		init(all, 0);
		init(stu, 0);
		stu[1] = true;
		all[1] = 1;
		rep(i, 2, (n + 1)){
			gint(all[i]);
		}
		rep(i, 0, q){
			char c;
			int tmp;
			gchar(c);
			gchar(c);
			gint(tmp);
			if (c == 'Q'){
				out += (ll)get_f(tmp);
			}
			else if (c == 'M'){
				stu[tmp] = true;
			}
		}
		//pint(out);
		cout << out << endl;
	}
	return 0;
}

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

#define MAXN (100010)
#define ll long long

int n;
ll a[MAXN];

bool check(int x){
	ll ret = 0;
	for(int i = 1; i <= x; ++ i){
		ret += a[i];
	}
	for(int i = x + 1; i <= n; ++ i){
		if(a[i] <= 2 * ret){
			ret += a[i];
		}
		else{
			return false;
		}
	}
	return true;
}

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; ++ i){
		scanf("%lld", a + i);
	}
	std::sort(a + 1, n + a + 1);
	int l = 1, r = n, ans;
	while(l <= r){
		int mid = l + r >> 1;
		if(check(mid)){
			ans = mid;
			r = mid - 1;
		}
		else{
			l = mid + 1;
		}
	}
	printf("%d\n", n + 1 - ans);
	return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<vector>
#include<queue>
#include<ctime>
#include<algorithm>
#include<cstdlib>
#include<stack>
#include<cstring>
#include<cmath>
using namespace std;

typedef long long LL;
typedef double DL;

const int INF = 2147483647;
const int maxn = 100010;

int n,ans,a[maxn];
int cnt[10][maxn],now[10][10];

inline LL getint()
{
	LL ret = 0,f = 1;
	char c = getchar();
	while (c < '0' || c > '9')
	{
		if (c == '-') f = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9')
		ret = ret * 10 + c - '0',c = getchar();
	return ret * f;
}

int main()
{
	#ifdef AMC
		freopen("AMC1.txt","r",stdin);
	#endif
	n = getint();
	for (int i = 1; i <= n; i++) a[i] = getint();

	for (int i = 1; i <= n; i += 2) ++cnt[1][a[i]];
	for (int i = 2; i <= n; i += 2) ++cnt[2][a[i]];

	for (int i = 1; i <= n; i += 2)
	{
		if (now[1][2] == a[i] || now[1][1] == a[i]) continue;
		if (cnt[1][a[i]] > cnt[1][now[1][1]])
		{
			now[1][2] = now[1][1];
			now[1][1] = a[i];
		}
		else 
			if (cnt[1][a[i]] > cnt[1][now[1][2]]) now[1][2] = a[i];
	}
	
	for (int i = 2; i <= n; i += 2)
	{
		if (now[2][2] == a[i] || now[2][1] == a[i]) continue;
		if (cnt[2][a[i]] > cnt[2][now[2][1]])
		{
			now[2][2] = now[2][1];
			now[2][1] = a[i];
		}
		else 
			if (cnt[2][a[i]] > cnt[2][now[2][2]]) now[2][2] = a[i];
	}
	
	for (int i = 1; i <= 2; i++)
		for (int j = 1; j <= 2; j++)
		{
			if (now[1][i] == now[2][j]) continue;
			ans = max(cnt[1][now[1][i]] + cnt[2][now[2][j]],ans);
		}

	printf("%d",n - ans);
	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>

/*

#include <ext/pb_ds/assoc_container.hpp> //required
#include <ext/pb_ds/tree_policy.hpp>     //required
using namespace __gnu_pbds;              //required
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ordered_set<int> s;
// special `tree` functions:
cout << s.order_of_key(3) << endl;	// the number of elements in s less than 3 (in this case, 0-based index of element 3)
out << *s.find_by_order(1) << endl; // 1-st elemt in s (in sorted order, 0-based)

*/

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}; // trick to explore an implicit 2D grid
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; // S,SE,E,NE,N,NW,W,SW neighbors  //GO FOR EVEN FOR 4 moves

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
        }
        base = base * base;
        y = y >> 1;
    }
    return ans;
}

int main()
{
    fastinput;
    LL n,i,j,k,t,temp,tc;
    LL arr[33]={-1,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};
cin>>k;
cout<<arr[k]<<endl;



    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	vector<int> box;
	int n,x,temp;
	while(cin>>n,n){
		for(int i=0;i<n;i++){
			cin>>x;
			box.push_back(x);
		}
		temp=-1;
		box.push_back(0);
		for(int i=0;i<n;i++){
			if(temp==-1){
				cout<<box[i];
				temp=-2;
			}
			if(temp==0){
				cout<<' '<<box[i];
				temp=-2;
			}
			if(box[i-1]+1==box[i]&&box[i]+1!=box[i+1]){
				cout<<'-'<<box[i];
				temp=0;
			}else if(box[i-1]+1!=box[i]&&box[i]+1!=box[i+1])
				temp=0;
		}
		
		
		
		
		box.clear();
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream> 
#include <algorithm> 
#include <cstring> 
#include <cstdio>
#include <vector> 
#include <queue> 
#include <cstdlib> 
#include <iomanip>
#include <cmath>
#include <cassert>
#include <ctime> 
#include <map> 
#include <set> 
using namespace std; 
#define lowbit(x) (x&(-x)) 
#define max(x,y) (x>y?x:y) 
#define min(x,y) (x<y?x:y) 
#define MAX 100000000000000000 
#define MOD 1000000007
#define pi acos(-1.0) 
#define ei exp(1) 
#define PI 3.141592653589793238462
#define ios() ios::sync_with_stdio(false)
#define INF 1044266558
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
const int maxn=1e6+7;
char a[55],b[55];
int flag,i,n;
ll ans;
int main()
{
	while(scanf("%d %s %s",&n,a,b)!=EOF)
	{
		ans=1,i=0;
		if(a[i]==b[i]) i++,ans=ans*3%MOD,flag=1;
		else i+=2,ans=ans*6%MOD,flag=0;
		while(i<n)
		{
			if(a[i]==b[i])
			{
				if(flag) ans=ans*2%MOD,i++;
				else flag^=1,i++;
			}
			else
			{
				if(flag) ans=ans*2%MOD,flag^=1,i+=2;
				else ans=ans*3%MOD,i+=2;
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,j,n) for(int i = (int)(j); i < (int)(n); i++)
#define mrep(i,n) for (int i = (int)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll modn = 998244353;

int main() {
	string s; cin >> s;
	int ans=0;
	if(s=="SSS") cout << 0 << endl;
	else if(s=="RRR") cout << 3 << endl;
	else if(s=="RSR"||s=="RSS"||s=="SSR") cout << 1 << endl;
	else if(s=="RRS"||s=="SRR") cout << 2 << endl;
	else cout << 1 << endl;
}

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

int main(){
    int n;
    cin>>n;
    vector<int>ls(n);
    rep(i,n) cin>>ls.at(i);
    sort(ls.begin(),ls.end());
    int ans=0;
    rep(b,n) rep(a,b){
        int ab=ls[a]+ls[b];
        int r=lower_bound(ls.begin(),ls.end(),ab)-ls.begin(); //イテレーターから添え字
        int l=b+1;
        ans+=max(0,r-l);

    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
  int money;
  int happy1;
  int happy2;
  int nokori;
  
  scanf("%d", &money);
  happy1 = money / 500 * 1000;
  nokori = money  % 500;
  happy2 = nokori / 5 * 5;
  
  printf("%d", happy1 + happy2);
  
  return 0;
}

Measured memory_bytes: 128
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii> 
using vec = vector<T>;

const ll INF = numeric_limits<ll>::max(),
         MOD = 1e9 + 7;

const int INF_i = numeric_limits<int>::max(),
          MAX = 1e6;

struct DSU {
    vector<int> parent, set_size;
    set<int> roots;
    DSU(int n) {
        parent.resize(n);
        set_size.resize(n);
        iota(parent.begin(), parent.end(), 0);
        roots.insert(parent.begin(), parent.end());
        fill(set_size.begin(), set_size.end(), 1);
    }

    int root(int x) {
        vector<int> v;

        while (x != parent[x]) {
            v.emplace_back(x);
            x = parent[x];
        }

        for (int e : v)
            parent[e] = x;

        return x;
    }

    bool join(int a, int b) {
        a = root(a), b = root(b);
        if (a == b) return false;
        if (set_size[a] < set_size[b])
            swap(a, b);
        roots.erase(b);
        set_size[a] += set_size[b];
        parent[b] = a;
        return true;
    }

    bool check(int a, int b) {
        return root(a) == root(b);
    }
};

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);
    
    int n, m;
    cin >> n >> m;
    DSU d(n);
    vec<pii> v(m);
    for (auto &e : v) {
        cin >> e.first >> e.second;
        e.first--, e.second--;
    }
    vll res(m);
    res.back() = (ll(n) * ll(n - 1)) / 2;
    for (int i = m - 2; i >= 0; i--) {
        int a = v[i + 1].first, b = v[i + 1].second;
        res[i] = res[i + 1];
        if (!d.check(a, b)) {
            res[i] -= d.set_size[d.root(a)] * d.set_size[d.root(b)];
            d.join(a, b);
        }
    }
    for (ll e : res) {
        cout << e << '\n';
    }
}

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

int		main(void)
{
	int n;
	cin >> n;
	Vec a(n);
	for (int i = 0; i < n; i++)
		cin >> a.at(i);
	int broke = 0;
	int j = 1;
	for (auto i = a.begin(); i != a.end(); i++)
	{
		if (*i == j)
			j++;
		else
			broke++;
	}
	if (j == 1)
		cout << -1 << endl;
	else
		cout << broke << endl;
}




Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

using Weight = int;
struct Edge {
	int s, d; Weight w;
	Edge(int s, int d, Weight w = 1) : s(s), d(d), w(w) {};
	bool operator<(const Edge &e)const { return w < e.w; }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

//lowest common ancestor (??????????????° + dfs?????°)
//?§????O(NlogN) ?????¨???O(logN)
struct LowestCommonAncestor {
	const int n, log2_n;
	vector<vector<int>> parent;
	vector<int> depth;
	const Graph &g;
	LowestCommonAncestor(const Graph &g, int root)
		:g(g), n(g.size()), log2_n(log2(n) + 1), parent(log2_n, vector<int>(n)), depth(n) {
		dfs(root, -1, 0);
		for (int k = 0; k + 1 < log2_n; k++) {
			for (int v = 0; v < n; v++) {
				if (parent[k][v] < 0)
					parent[k + 1][v] = -1;
				else
					parent[k + 1][v] = parent[k][parent[k][v]];
			}
		}
	}
	void dfs(int s, int p, int d) {
		parent[0][s] = p;
		depth[s] = d;
		for (auto &e : g[s]) {
			if (e.d == p)continue;
			dfs(e.d, s, d + 1);
		}
	}
	int get(int u, int v) {
		if (depth[u] > depth[v]) swap(u, v);
		for (int k = 0; k < log2_n; k++) {
			if ((depth[v] - depth[u]) >> k & 1) {
				v = parent[k][v];
			}
		}
		if (u == v) return u;
		for (int k = log2_n - 1; k >= 0; k--) {
			if (parent[k][u] != parent[k][v]) {
				u = parent[k][u];
				v = parent[k][v];
			}
		}
		return parent[0][u];
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	Graph g(n);
	rep(i, 0, n) {
		int k; cin >> k;
		rep(j, 0, k) {
			int c; cin >> c;
			g[i].emplace_back(i, c);
		}
	}
	int q; cin >> q;
	LowestCommonAncestor lca(g, 0);
	rep(i, 0, q) {
		int u, v; cin >> u >> v;
		cout << lca.get(u, v) << endl;
	}
	return 0;
}

Measured memory_bytes: 18296
let readInt () = stdin.ReadLine() |> int
let readCharArray () = stdin.ReadLine().ToCharArray()

readInt ()
|> fun x ->
    readCharArray ()
    |> fun y ->
        if Array.length y > x then
            y
            |> Array.take x
            |> System.String
            |> printfn "%s..."
        else
            y |> System.String |> printfn "%s"


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(obj) obj.begin(), obj.end()

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

const int iINF = 1e9;
const long long llINF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool is_same(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { return -par[root(x)]; }
};

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> A(M), B(M), C(K), D(K);
    REP(i, M) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    REP(i, K) {
        cin >> C[i] >> D[i];
        C[i]--;
        D[i]--;
    }
    UnionFind uf(N);
    vector<int> cnt(N);
    REP(i, M) {
        uf.merge(A[i], B[i]);
        cnt[A[i]] += 1;
        cnt[B[i]] += 1;
    }
    REP(i, K) {
        if (uf.is_same(C[i], D[i])) {
            cnt[D[i]] += 1;
            cnt[C[i]] += 1;
        }
    }

    REP(i, N) { cout << uf.size(i) - cnt[i] - 1 << " "; }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll long long
#define int long long int
#define MOD 1000000007
#define mkp make_pair
#define maxN 100005
#define pb push_back
#define ff first
#define ss second
#define debug1(a) cout<<a<<endl;
#define debug2(a,b) cout<<a<<' '<<b<<endl;
#define debug3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,a,b) for(int i=a;i<b;i++)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp map<int,int>
#define ump unordered_map<int,int>
#define  vi vector<int>
#define st set<int>
#define mst multiset<int>
#define pq priority_queue
#define mpq priority_queue<int,vector<int>,greater<int> >
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define in cin>>
#define out cout<<
using namespace std;
const int infi=1e9+7;
void printVector(vector<int> v){
    for(int i=0;i<(int)v.size();i++)
        cout<<v[i]<<" ";
    out endl;
}

void printArray(int arr[],int n)
{
   for(int i=0;i<n;i++)cout<<arr[i]<<' ';
cout<<endl;
}
 set<pair<int,int>> primeset;
 vi prime_number;
void SieveOfEratosthenes(int n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
        for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
    for (int p=2; p<=n; p++)
       if (prime[p])
           primeset.insert(mkp(p,1));
}
ll modExp(ll base, ll power) {
    if (power == 0) {
        return 1;
    } else {
        ll cur = modExp(base, power / 2); cur = cur * cur; cur = cur % MOD;
        if (power % 2 == 1) cur = cur * base;
        cur = cur % MOD;
        return cur;
    }
}
int32_t main()
{
fastio;
int t=1;
//in t;
while(t--){
int n;in n;
int a;in a;
int b;in b;
int part=(n)/(a+b);
int rem=n%(a+b);
int ans=part*a+min(rem,a)+0;
cout<<ans<<endl;
}
#ifndef ONLINE_JUDGE
	cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n, r;
    cin >> n >> r;
    if(n < 10)cout << r + 100 * (10 - n) << endl;
    else cout << r << endl;
 }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int W, H, N;
  cin >> W >> H >> N;
  vector<vector<int>> color(H, vector<int>(W,0));
  int x, y, a;
  int area=0;
  for(int i=0; i<N; i++){
    cin >> x >> y >> a;
    if(a==1){
      for(int j=0; j<x; j++){
        for(int k=0; k<H; k++){
          color.at(k).at(j)=1;
        }
      }
    }else if(a==2){
      for(int j=x; j<W; j++){
        for(int k=0; k<H; k++){
          color.at(k).at(j)=1;
        }
      }
    }else if(a==3){
      for(int j=0; j<W; j++){
        for(int k=0; k<y; k++){
          color.at(k).at(j)=1;
        }
      }
    }else if(a==4){
      for(int j=0; j<W; j++){
        for(int k=y; k<H; k++){
          color.at(k).at(j)=1;
        }
      }
    }else{
      cout << "error" <<endl;
    }
  }
  for(int j=0; j<W; j++){
    for(int k=0; k<H; k++){
      if(color.at(k).at(j)==0){
        area++;
      }
    }
  } 
  cout << area << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

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

struct Combination{
	vector<mint> fact, ifact;
	Combination(int n):fact(n+1),ifact(n+1){
		assert(n < mod);
		fact[0] = 1;
		for(int i = 1; i <= n; i++) fact[i] = fact[i-1]*i;
		ifact[n] = fact[n].inv();
		for(int i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i;
	}
	mint operator()(int n, int k){
		if(k < 0 || k > n) return 0;
		return fact[n]*ifact[k]*ifact[n-k];
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, k;
    cin >> n >> m >> k;
    Combination comb(n+1);
    mint ans = 0, M = 1;
    for(ll x = n-1; x >= 0; x--){
        mint add = comb(n-1, x) * m * M;
        if(x <= k) ans += add;
        M *= m-1;
    }
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 6336
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


int h[110];

int main(){
  int N;
  cin >> N;
  int ans = 0;
  rep(i,N) cin >> h[i];
  rep(i,N){
    while(h[i]){
      int pos = i;
      while(h[pos]){
	h[pos]--;
	pos++;
      }
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
using System;    
     
class sample12{    
    static void Main(string[] args){
        int i ;
        int count = 0;
        int[] compared_number = new int[3];
        string[] str_number = Console.ReadLine().Split(' '); 
        
        //入力された数字をintへ変換
        for(i = 0 ; i < 3; i++){
                    compared_number[i] = int.Parse(str_number[i]);
        }
        
        //バリデーション
        if(compared_number[0] > compared_number[1]){ 
                    Console.WriteLine("bにはa以上の数字を入力してください。"); 
                    Environment.Exit(0);
                    
        }else if(compared_number[0] < 1 || compared_number[1] < 1 || compared_number[2] < 1 || compared_number[0] > 10000 || compared_number[1] > 10000 || compared_number[2] > 10000 ){
            
                    Console.WriteLine("入力した値は範囲外です。");
                    Environment.Exit(0);
        } 
                
        //約数ならカウントする
        for(i = compared_number[0]; i < (compared_number[1]+ 1); i++){
            if(compared_number[2] %i == 0){
                count++;
            }
        }
        Console.WriteLine(count);
    }    
}   


Measured memory_bytes: 17940
#include <iostream> // cout, endl, cin
using namespace std;

int main(){
    int N,A,B,hoge,s,sum,output;
    cin>>N>>A>>B;
    output=0;
    for(int i=1;i<=N;i++){
        sum=0;
        s=0;       
        hoge=i;
        while(hoge!=0){
            s=hoge%10;
            hoge=hoge/10;
            sum=sum+s;
        }
        if(A<=sum & sum<=B){
            output=output+i;
        }
    }
    cout<<output<<endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <math.h> //円周率はM_PI
#include <map>
#include <bitset>
using namespace std;


int main() {
	int n, k;
	cin >> n >> k;
	
	int a[100][100];
	int d[100];
	bool flag[100];

	for (int i = 0; i < 100; i++) {
		flag[i] = false;
	}

	for (int i = 0; i < k; i++) {
		cin >> d[i];
		for (int j = 0; j < d[i]; j++) {
			cin >> a[i][j];
			flag[a[i][j] - 1] = true;
		}
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (flag[i] == false)ans++;
	}
	cout << ans << endl;
	

}

Measured memory_bytes: 3640