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

int main(void)
{
    string n;

    cin >> n;

    ll sur = 0;

    for (auto &&i : n)
    {
        sur += i - '0';
        sur %= 9;
    }

    if (sur == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


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

using namespace std;

#define all(container)     (container).begin(), container.end()
#define rall(container)    (container).begin(), container.end()
#define sz(container)      (int) (container).size()

using ll = long long;

#ifdef LOCAL_DEFINE
    #include "DEBUG.hpp"
#else
    #define debug(...) 0
#endif
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

int main(void) {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int k, x;
    cin >> k >> x;
    if (500 * k >= x)
        cout << "Yes\n";
    else 
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())

if b-a <= k:
  for i in range(a, b+1):
    print(i)
else:
  ans = []
  for i in range(a, a+k):
    if i not in ans:
      ans.append(i)
      print(i)
  for j in range(b-k+1, b+1):
    if j not in ans:
      print(j)

Measured memory_bytes: 9124
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  long long int x;
  cin>>x;
  long long int pre=x/11;
  pre*=2;
  if(x%11!=0){
  if(x%11<=6){
    pre+=1;
  }else{
    pre+=2;
  }
  }
  cout<<pre<<endl;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
if n<=1 and m<=1:
  ans=0
if n<=1 and m>=2:
  ans=m*(m-1)//2
if m<=1 and n>=2:
  ans=n*(n-1)//2
if m>=2 and n>=2:
  ans= n*(n-1)//2+(m*(m-1)//2)
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int nn=n,tot=0;
    while(nn)
    {
        tot=tot+nn%10;
        nn=nn/10;
    }
    if(n%tot==0)printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 128
import java.io.IOException;
import java.util.Scanner;

/**
 * Created on 2017/10/20 7:06.
 */
public class Main {
    public static void main(String[] args) throws IOException {
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(System.in);

        int[] dx = {-1, 0, 1, -1, 1, -1, 0, 1};
        int[] dy = {-1, -1, -1, 0, 0, 1, 1, 1};

        while (sc.hasNextInt()) {
            int H = sc.nextInt();
            int W = sc.nextInt();
            char[][] t = new char[H][W];
            for (int i = 0; i < H; i++) {
                t[i] = sc.next().toCharArray();
            }
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if (t[i][j] == '#') {
                        continue;
                    }
                    t[i][j] = '0';
                    for (int k = 0; k < 8; k++) {
                        int tx = j + dx[k];
                        int ty = i + dy[k];
                        if (0 <= tx && tx < W && 0 <= ty && ty < H && t[ty][tx] == '#') {
                            t[i][j]++;
                        }
                    }
                }
            }
            for (int i = 0; i < H; i++) {
                System.out.println(String.valueOf(t[i]));
            }
        }
    }
}

Measured memory_bytes: 23764
#include <stdio.h>

#define max 100
#define inf 100000000
#define white 0
#define gray 1
#define brack 2

int A[max][max],d[max];

void dijkstra(int);

int main(){
  int i,j,k,c,u,v,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      A[i][j] = inf;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d %d",&v,&c);
      A[u][v] = c;
    }
  }
  dijkstra(n);
  
  
}

void dijkstra(int n){
  int p[max],i,u=-1,v,mincost,color[max];
  for(u=0;u<n;u++){
    color[u] = white;
    d[u] = inf;
  }
  d[0] = 0;
  p[0] = -1;

  while(1){
    mincost = inf;
    for(i=0;i<=n-1;i++){
      if(color[i] != brack && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }

      if(mincost == inf) break;

      color[u] = brack;

      for(v=0;v<=n-1;v++){
	if(color[v] != brack && A[u][v] != inf){
	  if(d[u] + A[u][v] < d[v]){
	    d[v] = d[u] + A[u][v];
	    p[v] = u;
	    color[v] = gray;
	  }
	}
      }
  }
      for(i=0;i<n;i++){
	printf("%d %d\n",i,(d[i] == inf ? -1 : d[i]));
      }
  
}
      



Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
const double EPS = 1e-9;
int W,H,N;

double dot(P a, P b){ return a.real() * b.real() + a.imag() * b.imag(); }
double cross(P a, P b){ return   a.real() * b.imag() - a.imag() * b.real(); }

P crossPoint(L l, L m){
  double A = cross(l.second - l.first, m.second - m.first);
  double B = cross(l.second - l.first, l.second - m.first);
  if(fabs(A) < EPS && fabs(B) < EPS) return m.first;
  else if(fabs(A) >= EPS) return m.first + B / A * (m.second - m.first);
}

int countupper( L l, const vector<P>& ps ){
  int cnt = 0;
  int kc = 0;
  for( int i=0;i<N;i++ ){
    P p = ps[i];
    L nl = L( p, p + P(0,1) );
    P x = crossPoint( l, nl );
    if( x.imag()+EPS < p.imag() ) cnt++;
    else if( x.imag()-EPS < p.imag() ) kc++;
  }
  while( kc && cnt < N/2 ) { cnt++; kc--; }
  return cnt;
}


double getareaY(double ty, vector<P> ps ){
  double miy=H,may=0.0;
  for( P p : ps ){
    if( p.real() < EPS ) continue;
    L l = L( P(0,ty), p );
    if( countupper( l, ps ) == N/2 ) {
      //cout << l.first << " - "<< l.second<< " is ok " << endl;
      P mp = crossPoint( l, L(P(W,0),P(W,H) ) );
      miy = min( mp.imag(), miy );
      may = max( mp.imag(), may );
    }
  }
  miy = max( 0.0, miy );
  may = min( (double)H, may );
  //cout << ty << " "<< may<< " " <<miy << endl;
  return max( 0.0, may -miy );
}

int main(){
  while( ~scanf("%d%d%d",&W,&H,&N) && (W|H|N) ){
    vector<P> p;
    N*=2;
    for(int i=0;i<N;i++){
      int x,y; cin >> x >> y;
      p.push_back( P(x,y) );
    }
    p.push_back( P(0,0) );
    p.push_back( P(0,H));
    p.push_back( P(W,0) );
    p.push_back( P(W,H) );

    vector<double> vl; vl.push_back(0.0); vl.push_back(H);
    for(int i=0;i<(int)p.size();i++){
      for(int j=i+1;j<(int)p.size();j++){
        if( abs(p[i].real() - p[j].real()) < EPS ) continue;
        L line = L( p[i], p[j] );
        if( countupper( line, p ) == N/2 ){          
          P p = crossPoint( line, L(P(0,0),P(0,H)) );
          vl.push_back( p.imag() );
        }
      }
    }

    sort( vl.begin(), vl.end() );
    vl.erase( unique(vl.begin(),vl.end()), vl.end() );
    
    double sum = 0.0;
    for(int i=0;i+1<(int)vl.size();i++){
      double y1 = vl[i];
      double y2 = vl[i+1];
      if( y1 < 0.0-EPS ) continue;
      if( y2 > H+EPS ) continue;
      double ty = (y2+y1)/2.0;      
      //cout << "getarea "<<getareaY( ty,p ) << endl;
      sum += (y2-y1) * getareaY( ty, p );
    }
    //    cout << sum << " "<< H*H << endl;
    printf("%.9lf\n",sum/(H*H));
  }  
}

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

using namespace std;
#define rep(i, N) for(int i=0;i<int(N);++i)
#define rep1(i, N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << "{" << p.first << ", " << p.second << "}";
    return os;
}

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

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

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

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N, M;
    cin >> N >> M;
    vvec<l_l> G(N);
    for (int i = 0; i < N - 1; ++i) {
        G[i + 1].push_back({i, 0});
    }
    for (int i = 0; i < M; ++i) {
        int l, r;
        ll c;
        cin >> l >> r >> c;
        l--, r--;
        G[l].push_back({r, c});
    }
    priority_queue<l_l,
            vector<l_l>,
            greater<>> pq;
    vector<ll> dist(N, INFLL);
    dist[0] = 0;
    pq.push({0, 0});
    while(!pq.empty()){
        auto tmp = pq.top();
        pq.pop();
        int from = tmp.second;
        ll d = tmp.first;
        for(auto e: G[from]){
            int to = e.first;
            int cost = e.second;
            if(dist[from] + cost < dist[to]){
                dist[to] = dist[from] + cost;
                pq.push({dist[to], to});
            }
        }
    }
    cout << ((dist[N-1] == INFLL)? -1: dist[N-1]) << endl;
}

Measured memory_bytes: 10112
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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


int dfs(int v, std::vector<std::vector<int>>& G, std::vector<int>& d){
    int ret(v), a;
    for(int u: G[v]){
        if(d[u] != INF) continue;
        d[u] = d[v] + 1;
        a = dfs(u, G, d);
        if(d[a] > d[ret]) ret = a;
    }
    return ret;
}


int main(){
    std::string s; std::cin >> s;
    int l(0), r(s.length()-1), cnt(0);
    while(l < r){
        if(s[l] == s[r]){
            ++l; --r;
        }else{
            if(s[l] == 'x') ++l;
            else if(s[r] == 'x') --r;
            else{
                std::cout << -1 << std::endl;
                return 0;
            }
            ++cnt;
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#define ll long long
#define rep(i,j,k) for (i=j;i<=k;i++)
using namespace std;
const int N=1e5+5;
int n,m,i,u,v,tot,flg,E;
int En,fst[N],to[N*2],sgn[N*2],nxt[N*2],vis[N],cnt[3],col[N];
ll ans;
void add(int u,int v,int SGN) {
	En++; nxt[En]=fst[u]; fst[u]=En; to[En]=v; sgn[En]=SGN;
}
int inc(int x) {return (x+1)%3;}
int dec(int x) {return (x+2)%3;}
void dfs(int x)
{
	int j,v,dc;
	vis[x]=1; tot++; cnt[col[x]]++;
	for (j=fst[x];j;j=nxt[j])
	{
		E++;
		if (sgn[j]==1) dc=inc(col[x]);
		else dc=dec(col[x]);
		v=to[j];
		if (vis[v]) {
			if (dc!=col[v]) flg=1;
		}
		else {
			col[v]=dc;
			dfs(v);
		}
	}
}
int main()
{
//	freopen("blackout.in","r",stdin);
//	freopen("blackout.out","w",stdout);
	scanf("%d%d",&n,&m);
	rep(i,1,m)
	{
		scanf("%d%d",&u,&v);
		add(u,v,1); add(v,u,-1);
	}
	rep(i,1,n)
		if (!vis[i])
		{
			flg=tot=E=0; cnt[0]=cnt[1]=cnt[2]=0;
			dfs(i); E/=2;
			if (flg) ans+=(ll)tot*tot;
			else if (cnt[0] && cnt[1] && cnt[2]) ans+=(ll)cnt[0]*cnt[1]+(ll)cnt[1]*cnt[2]+(ll)cnt[2]*cnt[0];
			else ans+=E;
		}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define inf 10000000000000007
#define vsort(vec) sort(vec.begin(),vec.end())
#define vreverse(vec) reverse(vec.begin(),vec.end())
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

string s, t;
vector<char> ta, mu;

signed main() {
	cin >> s >> t;
	
	rep(i, s.size())ta.push_back(s[i]);
	rep(i, t.size())mu.push_back(t[i]);
	vsort(ta);
	vsort(mu);
	vreverse(mu);
	if (ta < mu)cout << "Yes" << endl;
	else cout << "No" << endl;
	ggr
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    ll n, a, b, c, d;
    bool ans = false;
    cin >> n >> a >> b >> c >> d;

    for (ll m = 0; m < n; m++)
    {
        if (c * (n - 1 - m) - d * m <= b - a)
            if (d * (n - 1 - m) - c * m >= b - a)
            {
                ans = true;
                break;
            }
    }

    cout << (ans ? "YES" : "NO") << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.D_Challenge
{
    class ABC_060
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nw = ReadLongs();
            var wv = new long[nw[0]][];
            for (int i = 0; i < nw[0]; i++)
            {
                wv[i] = ReadLongs();
            }

            var dict = new Dictionary<long, long>();
            dict.Add(0, 0);
            for(int i = 0; i < nw[0]; i++)
            {
                var tempDict = new Dictionary<long, long>();
                foreach(long key in dict.Keys)
                {
                    long w = key + wv[i][0];
                    long v = dict[key] + wv[i][1];
                    if (w <= nw[1])
                    {
                        tempDict.Add(w, v);
                    }
                }
                foreach(long key in tempDict.Keys)
                {
                    if (dict.ContainsKey(key))
                    {
                        if (dict[key] < tempDict[key])
                        {
                            dict[key] = tempDict[key];
                        }
                    }
                    else
                    {
                        dict.Add(key, tempDict[key]);
                    }
                }
            }

            long res = 0;
            foreach(long key in dict.Keys)
            {
                res = Math.Max(res, dict[key]);
            }
            Console.WriteLine(res);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 15968
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 300010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
string S;

void solve() {
	cin >> N >> K; K--;
	cin >> S;
	if(S[K] == 'A') S[K] = 'a';
	if(S[K] == 'B') S[K] = 'b';
	if(S[K] == 'C') S[K] = 'c';
	cout << S << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		if (a+b<c){
        	System.out.print("No");
        }else{
        	System.out.print("Yes");
        }

    }
}

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

int main()
{
	int n, m;
	cin >> n >> m;
	int cnt = 0;
	cnt+= (n - m) * 100;
	cnt += m * 1900;
	for (int i = 0; i < m; i++) {
		cnt *= 2;
	}
	cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define int ll
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) range(i,0,b)
#define rangei(i,a,b) for(ll a=a;i<=ll(b);i++)
#define repi(i,b) rangei(i,1,b)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
template<class T> ostream & operator << (ostream &os, vector<T> const &);
template<int n, class...T>
typename enable_if<(n>=sizeof...(T))>::type
_ot(ostream &, tuple<T...> const &){}
template<int n, class...T>
typename enable_if<(n< sizeof...(T))>::type
_ot(ostream &os, tuple<T...> const &t){
    os << (n==0?"":" ") << get<n>(t); _ot<n+1>(os, t);
}
    template<class...T>
    ostream & operator << (ostream &os, tuple<T...> const &t){
        _ot<0>(os, t); return os;
    }
template<class T, class U>
ostream & operator<<(ostream &os, pair<T,U> const &p){
    return os << "(" << p.first << ", " << p.second << ") ";
}
template<class T>
ostream & operator<<(ostream &os, vector<T> const &v){
    rep(i,v.size()) os << v[i] << (i+1==(int)v.size()?"":" "); return os;
}
#ifdef DEBUG
#define dump(...) (cerr << #__VA_ARGS__ << " = " << mt(__VA_ARGS__) \
                   << " [" << __LINE__ << "]" << endl)
#else
#define dump(...)
#endif
void fastios(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#define endl '\n'
}
template<class T>
size_t uniq(vector<T> &v){
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    return v.size();
}
template<class T>
size_t uniq(T *l, size_t n){
    sort(l,l+n);
    return unique(l,l+n) - l;
}
#define mems(arr,val) memset(arr,val,sizeof(arr));
int const mod = 1000000007;
int const inf = numeric_limits<int>::max();

// RMQ
template<class T>
struct SegmentTree {
    int n;
    vector<T> dat;
    SegmentTree(int n_ = 0) : n(n_){
        n = 1;
        while(n < n_) n <<= 1;
        dat.resize(n*2, inf);
    }
    T query(int v, int w, int l, int r){
        if(r <= l || w == 0) return inf;
        if(r - l == w){
            assert(l == 0 && r == w);
            return dat[v];
        }
        T res = inf;
        res = std::min(res, query(v*2, w/2, l, min(r, w/2)));
        res = std::min(res, query(v*2+1, w/2, max(0, l-w/2), r-w/2));
        return res;
    }
    void update(int i, T x){
        i += n;
        dat[i] = x;
        while(i != 1){
            dat[i>>1] = min(dat[i], dat[i^1]);
            i /= 2;
        }
    }
    T query(int l, int r){
        return query(1,n,l,r);
    }
    size_t size() const {
        return n;
    }
};

int main(){
    fastios();
    int n, q;
    while(cin >> n >> q){
        SegmentTree<int> st(n);
        rep(i,q){
            char c;
            int x, y;
            cin >> c >> x >> y;
            if(c == '0'){
                st.update(x,y);
            } else {
                cout << st.query(x,y+1) << endl;
            }
        }
    }
}

Measured memory_bytes: 2052
import math
import functools
from operator import add

def main():
    h,w,k = tuple([int(t)for t in input().split()])

    s = [[int(i) for i in list(input())] for _ in range(h)]
    
    cusum = [accumelist(s_) for s_ in s]

    candidates = []

    for i in range(1<<(h-1)):
        subcu = divide(cusum,i)
        subs = divide(s,i)

        subcusum = []

        rowsum = []

        for sub_ in subcu:
            subcusum.append(functools.reduce((lambda a,b:list(map(add,a,b))),sub_))

        for sub_ in subs:
            rowsum.append(functools.reduce((lambda a,b:list(map(add,a,b))),sub_))


        cutnum = 0

        temp = [0]*len(subcusum)

        for j in range(w):
            for l in range(len(subcusum)):
                if subcusum[l][j]-temp[l]>k:
                    if rowsum[l][j]>k:
                        cutnum+=10000
                    temp = [x[j-1] for x in subcusum]
                    cutnum+=1
                    break
        
        candidates.append(cutnum+bin(i).count('1'))

    print(min(candidates))
            
def divide(s,i):
    subs = []
    counter = 0
    pos = 0
    while i!= 0:
        counter +=1
        if i%2==1:
            subs.append(s[pos:counter])
            pos = counter
        i >>=1
 
    subs.append(s[pos:])
    return subs

def accumelist(s):
    if s == []:
        return []
    res = [s[0]]
    for i in range(1,len(s)):
        res.append(res[i-1]+s[i])

    return res

def _add_(a,b):
    return map(add,a,b)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 4228
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll N;
    cin >> N;
    vec cnts(400, 0);
    vector<pair<ll, ll>> nums(N);
    Rep (i, N) {
        long double a;
        cin >> a;
        a += 1e-12;
        ll b = a * 1e9;
        ll cnt2 = -9, cnt5 = -9;
        while (b % 2 == 0) {
            cnt2++;
            b /= 2;
        }
        chmin(cnt2, (ll)9);
        while (b % 5 == 0) {
            cnt5++;
            b /= 5;
        }
        chmin(cnt5, (ll)9);
        cnts[cnt2*20+cnt5+200]++;
        nums[i] = {cnt2, cnt5};
    }

    // Rep (i, N) {
    //     cout << nums[i].first << " " << nums[i].second << "\n";
    // }

    ll ans = 0;
    Rep (i, N) {
        ll cnt2 = nums[i].first;
        ll cnt5 = nums[i].second;
        cnts[cnt2*20+cnt5+200]--;

        for (ll j = -cnt2; j <= 9; j++) {
            for (ll k = -cnt5; k <= 9; k++) {
                ans += cnts[j*20+k+200];
            }
        }
    }

    cout << ans << endl;    
}

Measured memory_bytes: 6312
#include<iostream>
#include<algorithm>
#include<cstdio>

using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1010;

int p[N];

int f[N][N];

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)	scanf("%d%d", &p[i - 1], &p[i]);
	
	for(int len = 2; len <= n; len++)
	{
		for(int i = 1; i + len - 1 <= n; i++)
		{
			int j = i + len - 1;
			
			f[i][j] = INF;
			
			for(int k = i; k < j; k++)
			{
				f[i][j] = min(f[i][j], f[i][k] + f[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}
	
	
	printf("%d\n", f[1][n]);
	
	return 0;
}




Measured memory_bytes: 3516
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-10;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)


//ここから編集

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int N; cin >> N;
  vector<ll> A(N);
  REP(i,N) cin >> A[i];

  sort(all(A));
  reverse(all(A));

  ll ans = 0;
  if(N%2 == 0){
    ans += A[0];
    for(int i=1; i<N/2; i++){
      ans += A[i]*2;
    }
  }else{
    ans += A[0];
    for(int i=1; i<N/2; i++){
      ans += 2*A[i];
    }
    ans += A[N/2];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

struct Node {
  int p, l, r;
};

void preorder(vector<Node> &T, int u) {
  if (u == -1) return;
  cout << " " << u;
  preorder(T, T[u].l);
  preorder(T, T[u].r);
}

void inorder(vector<Node> &T, int u) {
  if (u == -1) return;
  inorder(T, T[u].l);
  cout << " " << u;
  inorder(T, T[u].r);
}

void postorder(vector<Node> &T, int u) {
  if (u == -1) return;
  postorder(T, T[u].l);
  postorder(T, T[u].r);
  cout << " " << u;
}

int main() {
  int n, root;
  cin >> n;
  vector<Node> T(n);
  REP(i, n) T[i].p = -1;
  REP(i, n) {
    int id, l, r;
    cin >> id >> l >> r;
    T[id].l = l;
    T[id].r = r;
    if (l != -1) T[l].p = id;
    if (r != -1) T[r].p = id;
  }
  REP(i, n)  if (T[i].p == -1) root = i;
 
  cout << "Preorder" << endl;
  preorder(T, root);
  cout << endl << "Inorder" << endl;
  inorder(T, root);
  cout << endl << "Postorder" << endl;
  postorder(T, root);
  cout << endl;
}


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

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(ulong.Parse).ToArray();
            var count = 0UL;
            foreach(var currenta in a)
            {
                var x = currenta;
                while (x % 2 == 0)
                {
                    x /= 2;
                    count++;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include <math.h>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if(a + b + c >= 22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

Measured memory_bytes: 256
public class Main {

    public static void main(String[] args) {
        final String line = readLine();
        System.out.println(calc(line));
    }

    protected static String calc(String input) {
        final int[] ia = split(input);

        int W = ia[0];
        int H = ia[1];
        int x = ia[2];
        int y = ia[3];
        int r = ia[4];

        int xMax = x + r;
        int yMax = y + r;
        int xMin = x - r;
        int yMin = y - r;

        if (xMax > W || yMax > H || xMin < 0 || yMin < 0) {
            return "No";
        }

        return "Yes";
    }

    private static int[] split(String s) {
        final String[] s0 = s.split(" ");
        int[] ia = new int[s0.length];

        for (int i = 0; i < s0.length; i++) {
            ia[i] = Integer.parseInt(s0[i]);
        }

        return ia;
    }

    private static String readLine() {
        java.util.Scanner s = null;
        try {
            s = new java.util.Scanner(System.in);
            return s.nextLine();
        } finally {
            if (s != null) {
                s.close();
            }
        }
    }
}

Measured memory_bytes: 17324
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")

const long long mod=2*1e5+3, mod2=119218851371;
int n;
int pos[mod+3];
long long ans=0;

// cp-algo's FFT

typedef complex<double> cd;
const double pi=acos(-1);

void fft(vector<cd> &a,bool invert){
	int n=a.size();
	if (n==1) return;
	vector<cd>odd(n/2), even(n/2);
	for (int i=0;2*i<n;i++){
		even[i]=a[2*i];
		odd[i]=a[2*i+1];
	}
	fft(even,invert);
	fft(odd,invert);
	double ang=2*pi/n*(invert ? 1 : -1);
	cd w(1), wn(cos(ang),sin(ang));
	for (int i=0;2*i<n;i++){
		a[i]=even[i]+w*odd[i];
		a[i+n/2]=even[i]-w*odd[i];
		if (invert){
			a[i]/=2;
			a[i+n/2]/=2;
		}
		w*=wn;
	}
}

vector<long long> convolute(vector<long long>&a, vector<long long>&b){
	vector<cd>fa(a.begin(),a.end()), fb(b.begin(),b.end());
	int n=1;
	while (n<a.size()+b.size()) n<<=1;
	fa.resize(n);
	fb.resize(n);
	fft(fa,0);
	fft(fb,0);
	for (int i=0;i<n;i++) fa[i]*=fb[i];
	fft(fa,1);
	vector<long long>ret(n);
	for (int i=0;i<n;i++) ret[i]=round(fa[i].real());
	return ret;
}

long long modpow(long long x, long long y){
	long long ret=1;
	for (;y>0;y>>=1){
		if (y&1){
			ret*=x;
			ret%=mod2;
		}
		x*=x;
		x%=mod2;
	}
	return ret;
}

long long modinv(long long x){
	return modpow(x,mod2-2);
}

void init(){
	// fill pos for input values [1..p-1]
	int tmp=1;
	pos[1]=0;
	for (int i=1;i<mod-1;i++){
		tmp<<=1;
		tmp%=mod;
		pos[tmp]=i;
	}
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	init();
	cin >> n;
	vector<long long>cnt(mod+1,0);
	for (int i=0;i<n;i++){
		long long a;
		cin >> a;
		if (a!=0) cnt[pos[a]]++;
		ans-=(a*a)%mod;
	}
	vector<long long>cnt2=convolute(cnt,cnt);
	for (int i=0;i<mod-1;i++) cnt2[i]+=cnt2[i+mod-1];
	long long tmp=1;
	for (int i=0;i<mod-1;i++){
		ans+=tmp*cnt2[i];
		tmp<<=1;
		tmp%=mod;
	}
//	ans*=modinv(2);
//	ans%=mod2;
	cout << ans/2 << "\n";
}

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

int main()
{
  int k; cin >> k;
  int arr[32] = {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};
  cout << arr[k-1] << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		// 入力値の取得
		int K = sc.nextInt();
		String S = sc.next();

		// 結果の出力
		if (S.length() <= K) {
			System.out.println(S);
		}
		else {
			System.out.println(S.substring(0, K) + "...");
		}

		sc.close();
	}
}


Measured memory_bytes: 27076
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := ri(), ri()
	ors := make([]int, 0, 31)
	ors = append(ors, k)
	for i := 0; i <= 30; i++ {
		m := 1 << uint(i)
		if k&(m) != 0 {
			ors = append(ors, (k^m)|(m-1))
		}
	}
	sums := make([]int, len(ors))
	for i := 0; i < n; i++ {
		a, b := ri(), ri()
		for j, w := range ors {
			if w|a == w {
				sums[j] += b
			}
		}
	}
	max := sums[0]
	for _, v := range sums {
		if v > max {
			max = v
		}
	}
	fmt.Println(max)
}


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


int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 8 && B <= 8) {
		cout << "Yay!" << endl;
	}
	else cout << ":(" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <bitset>
#include <limits>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define FLOAT setprecision(16)
#define INSIDE(i,j,H,W) ((i) >= 0 && (i) < (H) && (j) >= 0 && (j) < (W))
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
// all_of

#if 1234567891
#include <array>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
template<class T>
struct IsIterable {
private:
	template<class Iterable>
	static auto Is_iterable(Iterable subject) -> decltype(std::begin(subject), std::end(subject), std::true_type()) {}
	static auto Is_iterable(...) -> decltype(std::false_type()) {}
public:
	typedef decltype(Is_iterable(std::declval<T>())) type;
	static bool const value = type::value;
};
template <class Container>
typename std::conditional<true, std::ostream&, typename std::enable_if<IsIterable<Container>::value>::type>::type
operator<<(ostream& ost, const Container& container) {
	for (auto it = begin(container); it != end(container); ++it) {
		if (it != begin(container)) ost << ' ';
		ost << *it;
	}
	return ost;
}
#endif

#if _DEBUG
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#endif

LL X, Y;
int main() {
	cin >> X >> Y;
	cout << (abs(X - Y) > 1 ? "Alice" : "Brown") << endl;
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
	string word;
	cin >> word;
	string text;
	int count = 0;
	while (true)
	{
		cin >> text;
		if (cin.fail())
			break;
		for (int i = 0; i < text.length(); i++)
			text[i] = tolower(text[i]);
		if (text == word)
			count++;
	}
	cout << count << endl;
}


Measured memory_bytes: 3156
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

#define ALL(V) (V).begin(),(V).end()

using namespace std;

typedef pair<int,int> ii_t;

int ones[70] = {0};
int zeros[70] = {0};

int main() {
    int n;
    long long num;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> num;
        for (int i=0;i<60;i++) {
            if (num & (1LL<<i)) {
                ones[i] ++;
            } else {
                zeros[i] ++;
            }
        }
    }
    long long answer = 0;
    for (int i=0;i<60;i++) {
        long long x = (1LL<<i);
        x %= 1000000007LL;
        x *= ones[i];
        x %= 1000000007LL;
        x *= zeros[i];
        x %= 1000000007LL;
        // cerr << "x=" << x << endl;
        answer += x;
        answer %= 1000000007LL;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>//小数点以下表示
#include<map>
using namespace std;
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 long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    string a;
    cin>>a;
    if(a.at(0)=='A'&&a.at(1)=='A'&&a.at(2)=='A'){
        cout<<"No"<<endl;
    }
    else if(a.at(0)=='B'&&a.at(1)=='B'&&a.at(2)=='B'){
        cout<<"No"<<endl;
    }
    else {
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
num = [None] * (N)
ans = ''
for _ in range(M):
    x, y = map(int, input().split())
    if num[x-1] == None:
        num[x-1] = str(y)
    elif num[x-1] != str(y):
        ans = -1
        break

if ans == -1:
    print(ans)
elif len(num) >= 2 and num[0] == '0':
    print(-1)
elif len(num) >= 2 and num[0] == None:
    for i in range(N):
        if i == 0:
            ans += '1'
        else:
            if num[i] == None:
                ans += '0'
            else:
                ans += num[i]
    print(ans)
else:
    for i in num:
        if i == None:
            ans += '0'
        else:
            ans += i
    print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define prArr(Arr,n) for(int _=0;_<n;_++)   cout<<(Arr)[_]<<" ";
#define f first
#define s second
using namespace std;
const int INF=(int)0x3f3f3f3f;
const int MOD=(int)1e9+7;
const double eps=1e-9;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int sum;
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
        sum+=s[i]-'0';
    cout<<(sum%9?"No":"Yes");
    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
 
using namespace std;
 
int main(){
  int s;
 
  cin >> s;
  int h = s / 3600; s %= 3600;
  int m = s / 60; s %= 60; 
  cout << h << ":" << m << ":" << s << endl;
 
  return 0;
}

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

using namespace std;
typedef long long ll;

const int MAX = 10005;
int n;
int a[MAX];

int main() {
  int sum = 0;
  scanf("%d", &n);
  for (int i=0; i<n; i++) {
    scanf("%d", &a[i]);
    sum += (a[i] - 1);
  }

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

  return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

constexpr array<int, 4> dy = {0, 1, 0, -1};
constexpr array<int, 4> dx = {1, 0, -1, 0};

void solve(const vec<vec<char>> &s, int H, int W) {
  bitset<50 * 50> stamped;
  REP(y, H) {
    REP(x, W) {
      if (s[y][x] == '.') {
        continue;
      }
      REP(i, 4) {
        const auto nx = x + dx[i], ny = y + dy[i];
        if (0 <= nx && nx < W && 0 <= ny && ny < H && s[ny][nx] == '#') {
          stamped.set(y * W + x);
          stamped.set(ny * W + nx);
        }
      }
    }
  }

  REP(y, H) {
    REP(x, W) {
      if (s[y][x] == '#' && !stamped[y * W + x]) {
        cout << "No" << endl;
        return;
      }
    }
  }
  cout << "Yes" << endl;
}

int main() {
  int H, W;
  cin >> H >> W;
  vec<vec<char>> s(H, vec<char>(W));
  REP(y, H) REP(x, W) cin >> s[y][x];

  solve(s, H, W);
  return 0;
}


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

import sys

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')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def build_grid(H, W, intv, _type, space=True, padding=False):
    # 入力がスペース区切りかどうか
    if space:
        _input = lambda: input().split()
    else:
        _input = lambda: input()
    _list = lambda: list(map(_type, _input()))
    # 余白の有無
    if padding:
        offset = 1
    else:
        offset = 0
    grid = list2d(H+offset*2, W+offset*2, intv)
    for i in range(offset, H+offset):
        row = _list()
        for j in range(offset, W+offset):
            grid[i][j] = row[j-offset]
    return grid

def bfs(grid, src):
    """ BFS(グリッド、重みなし) """
    from collections import deque

    H, W = len(grid), len(grid[0])
    h, w = src
    directions = ((1, 0), (-1, 0), (0, 1), (0, -1))
    que = deque([(h, w, 0)])
    dist = list2d(H, W, -1)
    dist[h][w] = 0
    while que:
        h, w, c = que.popleft()
        for dh, dw in directions:
            h2 = h + dh
            w2 = w + dw
            if grid[h2][w2] == '#':
                continue
            if dist[h2][w2] != -1:
                continue
            dist[h2][w2] = c + 1
            que.append((h2, w2, c+1))
    return dist

H, W = MAP()
grid = build_grid(H, W, '#', str, space=0, padding=1)

ans = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if grid[i][j] != '#':
            # 有効な全マスから最短距離試す
            res = bfs(grid, (i, j))
            for k in range(1, H+1):
                for l in range(1, W+1):
                    # 一番遠い場所
                    ans = max(ans, res[k][l])
print(ans)


Measured memory_bytes: 3828
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (ll)1e9+7
#define LLINF (ll)1e30
// #define int ll
using namespace std;
const int MOD = 1e9 +7;

ll n,c[101010],sum=0,ans[101010]={};
vector<ll> E[101010];
priority_queue<ll> que;

void dfs(ll a){
    ans[a]=que.top();
    que.pop();
    for(ll x :E[a]){
        if(ans[x]==0){
            dfs(x);
        }
    }
    return;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    rep(i,n-1){
        ll a,b;
        cin>>a>>b;
        E[a].push_back(b);
        E[b].push_back(a);
    }
    rep(i,n){
        cin>>c[i];
        sum+=c[i];
        que.push(c[i]);
    }
    sort(c,c+n);
    sum -=c[n-1];
    dfs(1);
    cout<<sum<<endl;
    rep2(i,1,n+1){
        cout<<ans[i]<<' ';
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <sstream>
// #include <cmath>
// #include <map>
// #include <set>
// #include <deque>
// #include <stack>
// #include <vector>
using namespace std;
#define debug freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
// #define PI acos(-1)
typedef long long ll;
const ll mod=1e9+7;


ll mypow(ll x,ll y)
{
	ll ans=1;
	while(y)
	{
		if(y&1) ans=(ans*x)%mod;
		x=(x*x)%mod;
		y>>=1; 
	}
	return ans;
}

int main()
{
	//debug;
	ios;
	ll a;
	cin>>a;
	cout<<((mypow(10,a)+mod+mypow(8,a)+mod-mypow(9,a)*2)%mod+mod)%mod;
	return 0;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String as = sc.next();
		String bs = sc.next();
		
		String s = as + bs;
		int ab = Integer.parseInt(s);
		int count = 0;
		
		for(int i = 1; i <= ab; i++) {
			if(ab % i == 0) {
				count++;
			}
		}
		
		if(count % 2 == 0) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 21844