akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	char a;
	cin>>a;
	if(a=='a'||a=='i'||a=='e'||a=='o'||a=='u'){
		ce("vowel")
	}else{
		ce("consonant")
	}
	
	
}

Measured memory_bytes: 256
import math
n = int(input())
a = [2]
inf = (10 ** 9) + 7
for i in range(3, n+1, 2):
    ans = 'y'
    for j in range(3, i//2, 2):
        if i % j == 0:
            ans = "n"
            break
    if ans == "y":
        a.append(i)
k = math.factorial(n)
ans = 1
for aa in a:
    t = 0
    while (k % aa == 0):
        if k % aa == 0:
            k = k // aa
            t += 1
    ans = (ans * (t+1)) % inf
print(ans)

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
import heapq
import sys
from collections import defaultdict

input = sys.stdin.buffer.readline
INF = 2**62-1


def read_int_n():
    return list(map(int, input().split()))


def read_str_n():
    return list(map(str, input().split()))


def Dijkstra(g, s):
    d = defaultdict(lambda: INF)
    d[s] = 0
    q = []
    heapq.heappush(q, (d[s], s))

    prev = {}
    done = set()
    while q:
        c, u = heapq.heappop(q)
        if u in done:
            continue
        done.add(u)
        for v in g[u]:
            alt = g[u][v] + d[u]
            if d[v] > alt:
                d[v] = alt
                prev[v] = u
                heapq.heappush(q, (d[v], v))
    return d

def slv(N, M, S, UVAB, CD):
    g = defaultdict(dict)
    V = {}
    for u, v, a, b in UVAB:
        g[u][v] = (a, b)
        g[v][u] = (a, b)

    for i, (c, d) in enumerate(CD, 1):
        V[i] = (c, d)

    MA = (N-1)*max(a for u, v, a, b in UVAB)
    S = min(S, MA)
    d = [[INF] * (MA+1) for _ in range(N+1)]
    d[1][S] = 0
    q = []

    def p(q, u, m, alt):
        if m >= 0 and d[u][m] > alt:
            d[u][m] = alt
            heapq.heappush(q, (d[u][m], (u, m)))

    heapq.heappush(q, (d[1][S], (1, S)))
    while q:
        c, (u, s) = heapq.heappop(q)
        if d[u][s] < c:
            continue
        c, dd = V[u]
        p(q, u, min(MA, s+c), d[u][s] + dd)

        for v in g[u]:
            a, b = g[u][v]
            p(q, v, s-a, b + d[u][s])

    for i in range(2, N+1):
        print(min(d[i]))


def main():
    N, M, S = read_int_n()
    UVAB = [read_int_n() for _ in range(M)]
    CD = [read_int_n() for _ in range(N)]
    (slv(N, M, S, UVAB, CD))


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;


const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)


int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  ll n,m;
  cin >> n >> m;
  vll p(m);
  vector<string> s(m);
  vector<bool> flag(n,false),num(n,false);
  ll a=0,w=0;
  rep(i,0,m) {
    cin >> p[i] >> s[i];
    p[i]--;
    if(s[i]=="AC") flag[p[i]]=true;
  }
  rep(i,0,m){
   if(flag[p[i]]&&!num[p[i]]){ 
    if(s[i]=="AC") a++,num[p[i]]=true;
    else if(s[i]=="WA") w++;
   }
  }
  
 
  cout << a << " " << w << endl;
}


Measured memory_bytes: 6528
n,x,y=map(int,input().split())

ans=[0]*n

tree=[[] for _ in range(n)]

for i in range(1,n):
    tree[i-1].append(i)
    tree[i].append(i-1)

tree[x-1].append(y-1)
tree[y-1].append(x-1)

from collections import deque

ans=[0]*n
for i in range(n):
    checked=[-1]*n
    stack=deque([i])
    checked[i]=0
    while len(stack)>0:
        tmp=stack.popleft()
        for item in tree[tmp]:
            if checked[item]==-1:
                checked[item]=checked[tmp]+1
                stack.append(item)
    for item in checked:
        ans[item]+=1

for item in ans[1:]:
    print(item//2)





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

using namespace std;
int EuclidianAlgorithm(int a,int b){
    if(a < b) swap(a,b);
    if(a%b == 0) return b;
    int r = a%b;
    return EuclidianAlgorithm(b,r);
}

int main(){
    int x,y;
    cin >> x >> y;
    int d = EuclidianAlgorithm(x,y);
    cout << d << "\n";

    return 0;   
}


Measured memory_bytes: 3112
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
    int s;
    scanf("%d",&s);
    printf("%d:%d:%d\n",s/3600,(s-(s/3600)*3600)/60,s-(s/3600)*3600-((s-(s/3600)*3600)/60)*60);
}

Measured memory_bytes: 1184
#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 a, b = 0;
    cin >> a;
    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            if (i * j == a)
            {
                cout << "Yes" << endl;
                b = 1;
                return 0;
            }
        }
    }
    if (b == 0)
    {
        cout << "No" << endl;
    }

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    
    if (s == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (i == N - 1) {
      cout << "Three" << endl;
    }
  }
}


Measured memory_bytes: 256
n, m, k = map(int, input().split())
w = []
for _ in range(n):
    w.append(input())

sol = 0
for rm in range(1<<n):
    for cm in range(1<<m):
        x = 0
        for i in range(n):
            for j in range(m):
                if (rm & (1<<i)) and (cm & (1<<j)) and w[i][j] == '#':
                    x += 1
        if x == k:
            sol += 1

print(sol)

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var << endl;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}

void solve() {
	string s, t; cin >> s >> t;
	reverse(t.begin(), t.end());
	if (s == t) cout << "YES";
	else cout << "NO";
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


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

using State = string::const_iterator;

string expr(State &itr, int mode){
    string res = "";
    res.push_back(*itr);
    ++itr;
    if(mode==0){
        res[0] = toupper(res[0]);
    }else{
        res[0] = tolower(res[0]);
    }
    while(1){
        if(islower(*itr)){
            res.push_back(*itr);
            ++itr;
        }else{
            break;
        }
    }
    if(mode==0 || mode==1){
        if(*itr == '_') ++itr;
    }else{
        if(isalpha(*itr)) res.push_back('_');
    }
    return res;
}

int main(){
    string s;
    char op;
    while(cin >> s >> op){
        if(op == 'X') break;
        string ans = "";
        int m;
        if(op == 'U') m = 0;
        if(op == 'L') m = 1;
        if(op == 'D') m = 2;
        State begin = s.begin();
        while(begin != s.end()){
            ans += expr(begin,m);
            if(m==1) m = 0;
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3056
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

using ll = long long;
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> t(N);
    vector<pair<int, int>> xy(N);
    REP(i, N) {
        cin >> t[i];
        cin >> xy[i].first >> xy[i].second;
    }

    int cur = 0;
    pair<int, int> pos{ 0,0 };
    for (int i = 0; i < N; i++) {
        int len = abs(xy[i].first - pos.first) + abs(xy[i].second - pos.second);
        int delta = t[i] - cur;
        if (delta >= len && (len - delta) % 2 == 0) {
            cur = t[i];
            pos = xy[i];
        }
        else {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll A, B, C, D;
    cin >> A >> B >> C >> D;
    ll count = 0;
    while (A > 0 && C > 0)
    {
        if (count % 2 == 0) C -= B;
        else A -= D;
        count++;
    }
    string ans;
    if (A <= 0) ans = "No";
    else ans = "Yes";

    cout << ans << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll> 
#define P pair<ll,ll>
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  lvector x(n,0),y(n,0),v_(n,0);
  rep(i,n) cin>>x[i]>>y[i];
  map<P,vector<P>> mp;
  for(ll i=0;i<n;++i) {
    for(ll j=i+1;j<n;++j) {
      ll x_=x[i]-x[j], y_=y[i]-y[j];
      mp[P(x_,y_)].emplace_back(P(i,j));
      mp[P(-x_,-y_)].emplace_back(P(i,j));
    }
  }
  ll mx=0;
  for(auto i:mp) mx=max(mx, (ll)(i.second).size());
  print(n-mx);
  return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, C, ans;
int a, b, c;
vector<int> in[N];
ii m[N];
int cnt[N];
int k;

int main() {
    cin >> n >> C;
    for (int i = 0; i < n; ++i) {
        cin >> a >> b >> c;
        in[i] = {c, a, b};
    }
    sort(in, in + n);
    vector<int> &last = in[0];
    for (int i = 1; i < n; ++i) {
        vector<int> &cur = in[i];
        if (cur[0] == last[0] && cur[1] == last[2]) {
            last[2] = cur[2];
        } else {
            m[k++] = {last[1], last[2]};
            last = cur;
        }
    }
    m[k++] = {last[1], last[2]};
    sort(m, m + k);
    for (int i = 0; i < k; ++i) {
        int start = m[i].first;
        int end = m[i].second;
        ++cnt[start];
        --cnt[end + 1];
    }
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        sum += cnt[i];
        ans = max(ans, sum);
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  int n;
  cin>>n;
  ll ans = 0;
  rep(i,n){
    int a;
    cin>>a;
    a--;
    ans+=a;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <tuple>

#include <set>
//#include <unordered_map>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF 21474836

int a,b;


int main() {

	cin >> a >> b;

	if (a > b)swap(a, b);

	string ans = "";
	rep(i, b)ans += to_string(a);

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


Measured memory_bytes: 256
n = int(input())
ss = input()
al = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
ans = ''
for s in ss:
  ind = al.index(s)
  if ind + n >= 26:
    ans += al[ind + n - 26]
  else:
    ans += al[ind + n]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){

	int H,W;
	cin >> H >> W;

	int a[H][W];
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> a[i][j];
		}
	}

	int h=0, w=0, count=0;
	vector<int> bh,nh,bw,nw;
	for(int i=0;i<H*W-1;i++){
		if(h%2==0){
			if(w+1<W){
				if(a[h][w]%2==1){
					bh.push_back(h+1); nh.push_back(h+1);
					bw.push_back(w+1); nw.push_back(w+2);
					//cout << h+1 << " " << w+1 << " " << h+1 << " " << w+2 << endl;
					a[h][w]--;
					a[h][w+1]++;
					count++;
				}
				w++;
			}else{
				if(a[h][w]%2==1){
					bh.push_back(h+1); nh.push_back(h+2);
					bw.push_back(w+1); nw.push_back(w+1);
					//cout << h+1 << " " << w+1 << " " << h+2 << " " << w+1 << endl;
					a[h][w]--;
					a[h+1][w]++;
					count++;
				}
				h++;
			}
		}else{
			if(w-1>=0){
				if(a[h][w]%2==1){
					bh.push_back(h+1); nh.push_back(h+1);
					bw.push_back(w+1); nw.push_back(w);
					//cout << h+1 << " " << w+1 << " " << h+1 << " " << w << endl;
					a[h][w]--;
					a[h][w-1]++;
					count++;
				}
				w--;
			}else{
				if(a[h][w]%2==1){
					bh.push_back(h+1); nh.push_back(h+2);
					bw.push_back(w+1); nw.push_back(w+1);
					//cout << h+1 << " " << w+1 << " " << h+2 << " " << w+1 << endl;
					a[h][w]--;
					a[h+1][w]++;
					count++;
				}
				h++;
			}
		}		
	}
	cout << count << endl;
	for(int i=0;i<count;i++){
		cout << bh[i] << " " << bw[i] << " " << nh[i] << " " << nw[i] << endl;
	}
}






Measured memory_bytes: 5220
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {

    int N;
    cin >> N;
    vector<int> X(N);
    rep(i,N) cin >> X[i];

    long long minimum = LINF;

    for (int i = 1; i <= 100; i++) {
        long long sum = 0;
        rep(j,N) sum += (X[j] - i) * (X[j] - i);
        minimum = min(minimum, sum);
    }

    cout << minimum << endl;
    
    return 0;
}

Measured memory_bytes: 256
/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define endl "\n"
#define oo 0x3f3f3f3f3f3f3f3fLL
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define setdp memset(dp,-1,sizeof(dp))
#define db(x) cout<<" LOOK "<<(#x)<<" = "<<x <<'\n'
#define NumofDigits(n)   ((long long)log10(n)+1)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=2e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};*/
inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}
int dp[maxn]={};
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    //File();
    string s;
    cin >> s;
    ll ans=0;
    for(int i=sz(s)-2; i >= 0; i--)
    {
        if(s[i] == 'B' and s[i+1] == 'C')
            dp[i] = dp[i+2] + 1;
        else if(s[i]=='A')
            dp[i] = dp[i+1],ans += dp[i];
    }
    cout<<ans;
}


Measured memory_bytes: 4564
// By Shreehari Bodas

#include <bits/stdc++.h>

using namespace std;

int main(){

	int n; cin>>n;
	int h[n+1];
	
	for(int i=1;i<=n;i++) cin>>h[i];

	int dp[n+1];
	dp[n]=0;
	dp[n-1]=abs(h[n-1]-h[n]);

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

	cout<<dp[1]<<endl;

	return 0;
} 

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define F first
#define S second
#define ll long long
using namespace std;
int n;
string s;
vector<string> v;
vector<pair<int,string> > st;
map<string,int> mp;
int main(){
	int i;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>s;
		if(mp[s]==0)
		{
			mp[s]=1;
			v.push_back(s);
		}
		else
		{
			mp[s]++;
		}
	}
	for(i=0;i<v.size();i++)
	{
		st.push_back(make_pair(-mp[v[i]],v[i]));
	}
	sort(st.begin(),st.end());
	for(i=0;i<st.size();i++)
	{
		if(st[i].F!=st[0].F)
		{
			break;
		}
		cout<<st[i].S<<endl;
	}
	return 0;
}

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

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

int main() {
	int N;
	cin >> N;
	vector<int> b(N);
	for (int i = 0; i < N; ++i) { cin >> b[i]; }

	vector<int> res;
	bool can = true;
	for (int i = N - 1; i >= 0; --i) {
		vector<int> tmp(N, 0);
		for (int j = i; j >= 0; --j) {
			if (b[j] == j + 1) {
				res.push_back(b[j]);
				int idx = 0;
				for (int k = 0; k < N; ++k) {
					if (k == j) { continue; }
					tmp[idx++] = b[k];
				}
				b = tmp;
				break;
			}
		}
	}

	if (res.size() != N) {
		cout << -1 << endl;
	} else {
		for (int i = 0; i < res.size(); ++i) {
			cout << res[res.size() - i - 1] << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
N = int(input())
rank = 0
if N >= 400 and 599 >= N:
    rank = 8
elif N >= 600 and 799 >= N:
    rank = 7
elif N >= 800 and 999 >= N:
    rank = 6
elif N >= 1000 and 1199 >= N:
    rank = 5
elif N >= 1200 and 1399 >= N:
    rank = 4
elif N >= 1400 and 1599 >= N:
    rank = 3
elif N >= 1600 and 1799 >= N:
    rank = 2
elif N>= 1800 and 1999 >= N:
    rank = 1
print(rank)

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


template< typename T >
T extgcd(T a, T b, T &x, T &y) {
  T d = a;
  if(b != 0) {
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}

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

  int a,b,x,y;
  cin>>a>>b;
  extgcd(a,b,x,y);
  cout<<x<<' '<<y<<endl;


}


Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>

using namespace std;
using ll = long long;

bool dfs(vector<int>&a, int acc, int goal, int k){
  if(k == a.size()){
    if(acc == goal) return true;
    else return false;
  }
  else return dfs(a, acc, goal, k+1) || dfs(a, acc+a[k], goal, k+1);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n, q;
  cin >> n;
  vector<int> a(n);
  for(auto &i:a) cin >> i;
  cin >> q;
  for(int i = 0; i < q; i++){
    int mi; cin >> mi;
    if(dfs(a, 0, mi, 0)) cout << "yes" << endl;
    else cout << "no" << endl;
  }

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}



Measured memory_bytes: 3140
var main = function(input) {
input = input.split(' ').map(x=>parseInt(x));
var a = input[0];
var b = input[1];
var N =  b-a;
    var tall = 0;
for(var i=1;i<N;i++){
    tall += i;
    }
    var yuki = tall-a;
    
    console.log(yuki);
    return 0; 
}

main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define debug(val) cerr << "The value of " << #val << " is = " << val << '\n';
typedef long long ll;
typedef long double ld;
const ld pi = 4*atan((ld)1);
const ll mod = 1e9 + 7;
const ll inf = 922337203685477;
const ll nax = 0;

string s;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	cin >> s;
	ll ret = 0;
	for(ll i = 0; i < s.size(); i++){
		ret += s[i] - '0';
	}
	if(ret % 9 == 0){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}
}



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

ll s(ll dat) {
	ll ans = dat%4==1 || dat%4==2;
	for (ll i = 1; i < 60; i++) {
		if ((dat>>i)&1ll) ans |= (ll)(!(dat&1ll)) << i;
	}
	return (ans);
}

void Main() {
	ll A, B; cin >> A >> B;
	cout << (s(B) ^ s(A-1)) << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 3652
#include<stdio.h>

int main(){
    int a,b,c;
    int i,j,k;

    scanf("%d %d %d",&a,&b,&c);

    if(c-a+b >0){
        printf("%d\n",c-a+b);
    } else {
        printf("0\n");
    }


    return 0;
}

Measured memory_bytes: 128
// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
//
// See the bottom of file for solution.
// -----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

const P: i64 = 1_000_000_007;

fn main() {
    let N = read!(usize);
    let A = read![[i32]; N];

    // dp[m][s] = (男性 0..m と集合 s に含まれる女性を使ってできるペアの個数)
    // dp[m][s] = sum[f in 0..N] dp[m-1][s \ f]

    let mut dp = Vec::with_capacity(1 << N);
    dp.resize(1 << N, 0);
    dp[0] = 1;

    for m in 0..N {
        for s in 0..(1 << N) {
            let mut pop_count = 0;
            for i in 0..N {
                if s & (1 << i) != 0 {
                    pop_count += 1;
                }
            }
            if pop_count != m {
                continue;
            }

            for f in 0..N {
                if (s & (1 << f)) != 0 {
                    continue;
                }
                if A[m][f] == 0 {
                    continue;
                }

                dp[s | (1 << f)] += dp[s];
                dp[s | (1 << f)] %= P;
            }
        }
    }

    println!("{}", dp[(1 << N) - 1])
}


Measured memory_bytes: 20732
class UnionFind:
    def __init__(self, n):
        self.v = [-1 for _ in range(n)]

    def find(self, x):
        if self.v[x] < 0:
            return x
        else:
            self.v[x] = self.find(self.v[x])
            return self.v[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if -self.v[x] < -self.v[y]:
            x, y = y, x
        self.v[x] += self.v[y]
        self.v[y] = x

    def root(self, x):
        return self.v[x] < 0

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.v[self.find(x)]


N, M = map(int, input().split())
uf = UnionFind(N * 2)
for _ in range(M):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1

    if z & 1:
        uf.unite(x + N, y)
        uf.unite(x, y + N)
    else:
        uf.unite(x, y)
        uf.unite(x + N, y + N)
print(sum(1 for i in range(N) if uf.root(i)))


Measured memory_bytes: 7940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B, j;
  cin >> N;
  vector<int> card (N);
  for(int i = 0;i < N;i++){
  cin >> card.at(i);
  }
  sort(card.begin(), card.end());  
   
  for(int i = 0;i < N;i++){
  A = A + card.at(i);
  i++; 
    if(i >= N){
    break;
    }
  B = B + card.at(i);
  } 
  
  
  if(A > B){
  cout << A - B << endl;
  }
  else{
  cout << B - A << endl;
  }
}

Measured memory_bytes: 256
%:pragma GCC optimize(2)
%:pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define lll __int128
#define dd double
#define _i int
#define RE register
#define rep(i, l, r) for (RE int i = l; i <= r; i++)
#define req(i, l, r) for (RE int i = l; i >= r; i--)
#define range(i, l, r) rep(i, l, r - 1)
#define Be(s, t) memset(s, t, sizeof(s))
#define poly vector <int>
#define pii pair <int, int>
template <typename T> void read(T &x) { x = 0; int FF = 1; char op = getchar(); while (!isdigit(op)) { if (op == '-') FF = -1; op = getchar(); } while (isdigit(op)) { x = (x << 1) + (x << 3) + op - '0'; op = getchar(); } x *= FF; }
template <typename T> void print(T x) { if (x < 0) { putchar('-'); x = -x; } if (x < 1) return ; print(x / 10); putchar(x % 10 + '0'); }
template <typename T> void print(T x, char _tab) { print(x); putchar(_tab); }

const int N = 200005;
ll ans = 0, sum = 0;
int a[N], n, l = 1;
 
int main() {
  read(n);
  rep(i, 1, n) scanf("%d", &a[i]);
  
  rep(r, 1, n) {
    while ((sum ^ a[r]) != sum + a[r]) {
      sum ^= a[l++];
    }
    sum ^= a[r];
    ans += (r - l + 1);
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

int main() {
    int n, amax=-1;
    static int A[2000001], B[2000001], C[10001]={};
    std::cin >> n;
    for (int i=0; i<n; i++) {
        std::cin >> A[i];
        C[A[i]] += 1;
        if (A[i] > amax) {
            amax = A[i];
        }
    }
    for (int i=1; i<=amax; i++) {
        C[i] = C[i]+C[i-1];
    }

    for (int i=n-1; i>=0; i--) {
        B[C[A[i]]-1] = A[i];
        C[A[i]] -= 1;
    }

    for (int i=0; i<n-1; i++) {
        std::cout << B[i] << " ";
    }
    std::cout << B[n-1] << std::endl;

    return 0;
}


Measured memory_bytes: 18672
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
#include<vector>
using namespace std;
int main(){

    int n,m,x;
    cin>>n>>m>>x;
    int ryo[m];
    for(int i=0;i<m;i++)cin>>ryo[i];
    int ans=0;
    int left=0,right=0;;
    for(int i=0;i<m;i++){
        if(ryo[i]<x){
            left++;
        }else{
            right++;
        }
    }
    
    cout<<min(left,right)<<endl;
 
return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

//#define debug(x) ;
#define debug(x) cerr << #x << " = " << x << "\n";

ostream& operator<<(ostream& cerr, vector<ll> aux) {
    cerr << "[";
    for (auto e : aux) cerr << e << ' ';
    cerr << "]";
    return cerr;
}

const int maxN = 300011;
const ll mod = 998244353;

int n;
char s[maxN];
vector<int> R, G, B;
int tp[maxN];
int cnt[10];
ll answer;

int main()
{
    //freopen("test.in","r",stdin);

    answer = 1;
    scanf("%d\n%s", &n, s);
    for (int i = 0; i < n * 3; i++) {
        if (s[i] == 'R')
            R.pb(i);
        if (s[i] == 'G')
            G.pb(i);
        if (s[i] == 'B')
            B.pb(i);
    }

    for (int i = 0; i < n; i++) {
        tp[min(R[i], min(G[i], B[i]))] = 1;
        tp[max(R[i], max(G[i], B[i]))] = 2;
    }

    cnt[0] = n;
    for (int i = 0; i < n * 3; i++) {
        if (tp[i] == 1) {
            answer = (answer * cnt[0]) % mod;
            cnt[0]--; cnt[1]++;
        } 

        if (tp[i] == 0) {
            answer = (answer * cnt[1]) % mod;
            cnt[1]--; cnt[2]++;
        }

        if (tp[i] == 2) {
            answer = (answer * cnt[2]) % mod;
            cnt[2]--; cnt[3]++;
        }
    }

    cout << answer;


    return 0;
}


Measured memory_bytes: 3056
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;



void solve(long long N, std::vector<long long> W){
    vector<ll> ruisekiwa;
    ruisekiwa.push_back(0);
    ll ans;
    REP(i,1,N+1) {
        // ruisekiwa[i] = ruisekiwa[i-1] + W[i];
        ruisekiwa.push_back(ruisekiwa[i-1] + W[i-1]);
    }
    // rep(i,N+1) cout << ruisekiwa[i] << endl;
    ll hanbun = ruisekiwa[N]/2;
    REP(i,1,N+1) {
        if (ruisekiwa[i-1] <= hanbun && ruisekiwa[i] >= hanbun) {
            ll left = abs(ruisekiwa[N] - ruisekiwa[i-1] * 2);
            ll right = abs(ruisekiwa[N] - ruisekiwa[i] * 2);

            ans = min({left, right});
        }
    }

    cout << ans << endl;
    
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> W(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&W[i]);
    }
    solve(N, std::move(W));
    // return 0;
}


Measured memory_bytes: 256
_, _, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 1e9
for i in range(m):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1]+b[y-1]-c)
ans = min(ans, min(a)+min(b))
print(ans)

Measured memory_bytes: 18608
#include <bits/stdc++.h>
//#define int long long
using namespace std;

int main() {
    string s;
    int a = 0, b = 0;
    cin >> s;
    for(int i = 0; i < 3; i++){
        if(s[i] == 'A')
            a++;
        else
            b++;
    }
    if(a == 0 || b == 0)
        cout << "No";
    else
        cout << "Yes";
    
    return 0;
}

Measured memory_bytes: 256
(let* ((n (read))
       (arr (make-array n
                        :element-type 'fixnum
                        :initial-element 0))
       (ans 0))

  (loop for a from 0 to (1- n)
        do (setf (aref arr a) (1- (read))))

  (defun f (k)
    (cond ((< n ans) (princ "-1"))
          ((= k 1) (princ ans))
          (t (incf ans) (f (aref arr k)))))

  (f 0))



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

int main()
{
    int n;
    cin>>n;
    int x_i[n],max=0;
    for(int i=0;i<n;i++)
    {
        cin>>x_i[i];
        max+=x_i[i];
    }
    double max_p=max*1.0/n;
    int max_pi=(int)max_p;
    if(max_p-max_pi>0.5)
        max_pi++;
    int num=0;
    for(int i=0;i<n;i++)
    {
        num+=(max_pi-x_i[i])*(max_pi-x_i[i]);
    }
    cout<<num<<endl;
    return 0;
}


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

#define FASTIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;

const int MOD = 1e9+7;
const ll INF = 1e16;

int main() {
    FASTIO

    string s;
    cin >> s;
    
    if(s[s.size()-1] == 's') cout << s+"es" << "\n";
    else cout << s+"s" << "\n";
    
    return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

#define rep(i, n) for (int i = 0; i < n; i++)

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

    ll n, m;
    cin >> n >> m;

    if (m > n) {
        ll t = m;
        m = n;
        n = t;
    }

    ll cnt = 1;

    if (n - m > 1) {
        cout << 0 << endl;
    } else if ((n - m) == 1) {
        for (ll i = n; i >= 1; i--) {
            cnt *= i;
            cnt %= mod;
        }
        for (ll i = m; i >= 1; i--) {
            cnt *= i;
            cnt %= mod;
        }
        cout << cnt << endl;
    } else if ((n - m) == 0) {
        for (ll i = n; i >= 1; i--) {
            cnt *= i;
            cnt %= mod;
        }
        for (ll i = m; i >= 1; i--) {
            cnt *= i;
            cnt %= mod;
        }
        cnt *= 2;
        cnt %= mod;

        cout << cnt << endl;
    }
}

Measured memory_bytes: 3628
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let v : Vec<i32> = vec![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];
    let n : usize = get_one();
    println!("{}", v[n-1])
}


Measured memory_bytes: 4476
A,B,C=gets.split.map(&:to_i)
ary = [A,B,C].sort
x, y, z = ary
cnt = 0
while x < z do
    if y < z
        x += 1
        y += 1
    else
        x += 2
    end
    cnt += 1
end
cnt += 1 if x > z || y > z
puts cnt

Measured memory_bytes: 1788
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <stdio.h>
#include <string.h>
using ll = long long;

//LLONG_MAX
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
using namespace std;

priority_queue<double> q;

int N, M;
//int A[100001];

signed main()
{
	cin >> N >> M;
	REP(i, N)
	{
		int a;
		cin >> a;
		q.push(a);
	}

	REP(i, M)
	{
		double a = q.top();
		q.pop();
		a /= 2.0;
		q.push(a);
	}

	int sum = 0;
	REP(i, N)
	{
		double a = q.top();
		q.pop();
		sum += (int)a;
	}

	cout << sum << endl;
}




Measured memory_bytes: 1400
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
void ModuloSummation() {
	int N;
	cin >> N;
	i64 sum = 0;
	
	for (size_t i = 0; i < N; i++)
	{
		i64 a;
		cin >> a;
		sum += a;
	}

	cout << (sum - N);
}
int main() {
	ModuloSummation();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

class Cube{
    public:
        int f[6];
        Cube(){}
        void roll_z(){roll(1, 2, 4, 3);}
        void roll_y(){roll(0, 2, 5, 3);} // to W
        void roll_x(){roll(0, 1, 5, 4);} // to N
        void roll(int i, int j, int k, int l){
            int tmp = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = tmp;
        }
};

bool eq(Cube c1, Cube c2){
    for(int i = 0; i < 6; i++){
        if(c1.f[i] != c2.f[i]){
            return false;
        }
    }
    return true;
}

bool equal(Cube c1, Cube c2){
    for(int i = 0; i < 6; i++){
        for(int j = 0; j < 4; j++){
            if(eq(c1, c2)){
                return true;
            }
            c1.roll_z();
        }
        if(i%2 == 0){
            c1.roll_y();
        }else{
            c1.roll_x();
        }
    }
    return false;
}
    
Cube C[100];
int n;

bool chec(){
    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            if(equal(C[i], C[j])){
                return false;
            }
        }
    }
    return true;
}

int main(){
    cin >> n;
    for(int j = 0; j < n; j++){
        for(int i = 0; i < 6; i++){
            cin >> C[j].f[i];
        }
    }

    if(chec()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}




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

ll MOD = 1000000007;

ll mod_pow(ll x, ll n)
{
  ll ret = 1;
  while (n > 0)
  {
    if (n & 1)
      ret = ret * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return ret;
}

vector<ll> fact;
vector<ll> ifact;

void mod_ifact(ll n)
{
  fact.resize(n + 1);
  fill(fact.begin(), fact.end(), 1);
  ifact.resize(n + 1);
  fill(ifact.begin(), ifact.end(), 0);
  for (ll i=1; i<n+1; i++)
    fact[i] = fact[i-1] * i % MOD;
  ifact[n] = mod_pow(fact[n], MOD - 2);
  for (ll i=n; i>0; i--)
    ifact[i-1] = ifact[i] * i % MOD;
}

ll mod_comb(ll n, ll k)
{
  if (k < 0 || k > n)
    return 0;
  return fact[n] * ifact[k] % MOD * ifact[n-k] % MOD;
}

int main()
{
  int n, k;
  cin >> n >> k;
  mod_ifact(n);
  for (int i=1; i<=k; i++)
    printf("%lld\n", mod_comb(k - 1, i - 1) * mod_comb(n - k + 1, i) % MOD);
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include<map>
#include<tuple>
using namespace std;
#define INF 1LL<<62
#define MAX 1100000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<pair<int,int>,int> p;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
//__builtin_popcount(S)

//https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035

bool flag[410][410];
ll S[410],a[410];
ll dp[410][410];

ll f(int l,int r){
    if(flag[l][r]) return dp[l][r];
    flag[l][r]=true;
    if(l==r) return 0;
    ll fans=INF;
    for(int m=l;m<r;m++){
        fans=min(fans,f(l,m)+f(m+1,r));
    }
    return dp[l][r]=fans+S[r]-S[l-1];
}

int main(){
    for(int i=0;i<410;i++){
        for(int j=0;j<410;j++) flag[i][j]=false;
    }
    int N; cin>>N;
    for(int i=1;i<=N;i++) cin>>a[i];
    for(int i=1;i<=N;i++){
        S[i]=S[i-1]+a[i];
    }
    ll ans=f(1,N);
    cout<<ans<<endl;
}



Measured memory_bytes: 1664
n = int(input())
l = input().split()
for i in range(n):
    l[i] = int(l[i])
l.sort()

c = 0
if n < 3:
    print(0)
else:
    for i in range(len(l)-2):
        x = l[i]
        for j in range(i+1, len(l)-1):
            y = l[j]
            for k in range(j+1, len(l)):
                z = l[k]
                if x != y and y != z and z != x:
                    if x + y > z and y + z > x and z + x > y:
                        c += 1
    print(c)


Measured memory_bytes: 9204
N,P=list(map(int,input().split()))

def factorization(n):
    if n==1:
        return [[1,1]]
    temp=n
    ans=[]
    for i in range(2, int(n**0.5+1.01)):
        if temp % i ==0:
            ct=0
            while temp % i == 0:
                temp //= i
                ct += 1
            ans.append([i, ct])
    if temp != 1:
        ans.append([temp, 1])
    return ans

L=factorization(P)
ans=1
for i in range(len(L)):
  k=L[i][1]//N
  ans*=L[i][0]**k
print(ans)

Measured memory_bytes: 63400
import java.util.Scanner;
import java.io.*;
import java.util.Arrays;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int x = sc.nextInt();
		
		x /= 100;
		if(x < 6) {
			System.out.println(8);
		}else if(x < 8) {
			System.out.println(7);
		}else if(x < 10) {
			System.out.println(6);
		}else if(x < 12) {
			System.out.println(5);
		}else if(x < 14) {
			System.out.println(4);
		}else if(x < 16) {
			System.out.println(3);
		}else if(x < 18) {
			System.out.println(2);
		}else if(x < 20) {
			System.out.println(1);
		}
	}
	
}


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

int bs()
{
    int n;
    n = 10;
    int lo=0,hi=n;
    int key;
    key = 100;
    int arr[n] = {9,24,56,99,102,244,654,765,999,1002};
    while(lo < hi)
    {
        int md = (hi+lo)/2;//lo+(hi-lo)/2; lo+(hi-lo+1)/2;
        if(arr[md] > key)
        {
            hi = md-1;
        }
        else if(arr[md] < key)
        {
            lo = md+1;
        }
        else
        {
            return cout<<md<<endl,0;
            //hi = md;
            //lo = md;
        }
    }
}
int main()
{
    string s;
    cin>>s;
    if(s == "Sunny")
    {
        cout<<"Cloudy";
    }
    else if(s == "Cloudy")
    {
        cout<<"Rainy";
    }
    else
    {
        cout<<"Sunny";
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


#define MOD 998244353

int N, S;
int A[3000];

int dp[3001][3001];



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

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

	long long ans = 0;
	rep(i, N) {
		dp[i + 1][A[i]] = i + 1;
		for (int j = 1; j < S; j++) {
			(dp[i + 1][j] += dp[i][j]) %= MOD;
			if (j + A[i] <= S) (dp[i + 1][j + A[i]] += dp[i][j]) %= MOD;
		}

		ans += (long long)dp[i + 1][S] * (N - i);
		ans %= MOD;
	}

	cout << ans << endl;



	return 0;
}

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

int n, m, cnt;
int f[10010];
struct Point{
	int x, y, id;
}point[10010];

struct Edge{
	int form, to;
	double dis;
}edge[10010 * 10010];

int Find(int x){
	return f[x] == x ? x : f[x] = Find(f[x]);
}

void Union(int x, int y){
	int fx = Find(x);
	int fy = Find(y);
	if(fx != fy)
	f[fy] = fx;
}
void Addedge(int form, int to, double dis){
	edge[cnt].form = form;
	edge[cnt].to = to;
	edge[cnt++].dis = dis;
}

double dis(Point x, Point y){
	return sqrt(1.0*(x.x - y.x)*(x.x - y.x) + 1.0 * (x.y - y.y)*(x.y - y.y));
}
bool cmp1(Edge a, Edge b){
	return a.dis > b.dis;
}

bool cmp2(double a, double b){
	return a < b;
}

double Kruskal(){
	sort(edge, edge + cnt, cmp1);
	for(int i = 1; i <= n; i++)
	f[i] = i;
	double sum = 0;
	int tot = 0;
	int i;
	for(i = 0; i < cnt; i++){
		if(Find(edge[i].form) == Find(edge[i].to)){
			sum += edge[i].dis;
			continue;	
		} 
		Union(edge[i].form, edge[i].to);
	}
	return sum;
}
int main(){
	while(~scanf("%d%d", &n, &m)){
		cnt = 0;
		for(int i = 1; i <= n; i++){
			cin>>point[i].x>>point[i].y;
			point[i].id = i;
		}
		for(int i = 1; i <= m; i++){
			int a, b;
			double w;
			cin>>a>>b;
			w = dis(point[a], point[b]);
			Addedge(a, b, w);
		}
		printf("%.3f\n", Kruskal());	
	}
	return 0;
}


Measured memory_bytes: 3852