akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

//{ START
using namespace std;
#define int int64_t
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define reps(i, a, n) for (int i = (n - 1); i > (a - 1); --i)
#define arep(i, x) for (auto &&i : (x))
#define irep(i, x) for (auto i = (x).begin(); i != (x).end(); ++i)
#define rirep(i, x) for (auto i = (x).rbegin(); i != (x).rend(); ++i)
//降順はgreater<T>()
#define all(x) (x).begin(), (x).end()
#define rv(s) reverse((s).begin(), (s).end())
// gcd lcmはそのままok
#define gcd(a, b) __gcd(a, b)
#define bits(n) (1LL << (n))
#define pcnt(x) __builtin_popcountll(x)
//配列内等要素削除
#define Unique(x) (x).erase(unique((x).begin(), (x).end()), (x).end())
#define Fixed(n) fixed << setprecision(n)
//総和
#define sowa(n) (((n) * ((n) + 1)) / 2)
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).push_front(a)
#define eb(x, a) (x).emplace_back(a)
#define cauto const auto &
using P = pair<int, int>;
using Graph = vector<vector<P>>;
template <class T>  //昇順
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <class T>  //降順
using max_heap = priority_queue<T>;
template <class A, class B>
using umap = unordered_map<A, B>;
template <class A>
using uset = unordered_set<A>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {  //多次元初期化
  std::fill((T *)array, (T *)(array + N), val);
}
template <class A, class B>
bool chmax(A &a, const B &b) {  //最大値更新 返り値はbool
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class A, class B>
bool chmin(A &a, const B &b) {  //最小値更新 返り値はbool
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, 1, 1, -1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr int LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9 + 7;
constexpr int mod2 = 998244353;
//} END

/* BIT: 区間和の更新や計算を行う構造体
初期値は a_1 = a_2 = ... = a_n = 0
add(i,x): a_i += x とする
sum(i): a_1 + a_2 + ... + a_i を計算する
計算量は全て O(logn)
*/
template <typename T>
struct BIT {
  int n;          // 配列の要素数(数列の要素数+1)
  vector<T> bit;  // データの格納先
  BIT(int n_) : n(n_ + 1), bit(n, 0) {}

  void add(int i, T x) {
    for (int idx = i; idx < n; idx += (idx & -idx)) bit[idx] += x;
  }

  T sum(int i) {
    T s(0);
    for (int idx = i; idx > 0; idx -= (idx & -idx)) s += bit[idx];
    return s;
  }
};

signed main(void) {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n, q;
  cin >> n >> q;
  vector<int> a(n + 1), v(n + 1, -1), res(q);
  vector<tuple<int, int, int>> querys;
  BIT<int> seg(n + 5);
  rep(i, 1, n + 1) cin >> a[i];
  rep(i, 0, q) {
    int l, r;
    cin >> l >> r;
    querys.emplace_back(r, l, i);
  }
  sort(all(querys));
  int R = 1;
  for (auto &&[r, l, query_num] : querys) {
    for (; R <= r; ++R) {
      if (v[a[R]] != -1) {
        seg.add(v[a[R]], -1);
      }
      v[a[R]] = R;
      seg.add(R, 1);
    }
    res[query_num] = seg.sum(r) - seg.sum(l - 1);
  }
  arep(i, res) cout << i << '\n';
  return 0;
}

Measured memory_bytes: 31304
#include<stdio.h>
int main()
{
	int n,max=-1;
	scanf("%d",&n);
	int sum=0;
	for(int i=0;i<n;i++)
	{
		int add;
		scanf("%d",&add);
		sum+=add;
		max=max>add?max:add;
	}
	printf("%d",sum-max/2);
}

Measured memory_bytes: 128
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}


void func(void)
{
//DEBUG_OUT("----\n");
    uint32 N;
    cin >> N;
    vector<uint32> A(N);
    for(uint32 i=0; i<N; i++){
        cin >> A[i];
    }

    sort(A.begin(), A.end(), greater<uint32>());
    uint64 edge1 = 0;
    uint64 edge2 = 0;
    for(uint32 i=0; i<N-1; i++){
        if(edge1 == 0){
            if(A[i] == A[i+1]){
                edge1 = A[i];
                i++;
            }
        }else{
            if(A[i] == A[i+1]){
                edge2 = A[i];
                break;
            }
        }
    }

    uint64 size = edge1 * edge2;
    cout << size << endl;

    return;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long a[3];
int main()
{
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<((a[0]&1&a[1]&1&a[2]&1)?a[0]*a[1]:0)<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


NABC=list(map(int, input().split()))
l = [int(input()) for _ in range(NABC[0])]
l.sort(reverse=True)
done = [0]*NABC[0]

ans = 1e+8
for i in range(4**NABC[0]):
    A=0
    B=0
    C=0
    A_count=-1
    B_count=-1
    C_count=-1
    i_tmp = i
    for j in range(NABC[0]):
        bit = i_tmp%4
        i_tmp = i_tmp//4
        if bit == 0: 
            A += l[j]
            A_count += 1
        if bit == 1:
            B += l[j]
            B_count += 1
        if bit == 2:
            C += l[j]
            C_count += 1
    if A_count==-1 or B_count==-1 or C_count==-1: continue
    tmp = abs(A-NABC[1])+abs(B-NABC[2])+abs(C-NABC[3])+max(0,A_count*10)+max(0,B_count*10)+max(0,C_count*10)
    if tmp < ans:
        ans = tmp
print(ans)




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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  ll N, K;
  cin >> N >> K;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
    A[i]--;
  }
  int cnt = 0;
  int a = 0;
  map<int, int> m;
  int p, q;
  while(1) {
    m[a] = cnt;
    a = A[a];
    cnt++;
    if (m.count(a)) {
      p = cnt - m[a];
      q = m[a];
      break;
    }
  }
  // cout << p << ' ' << q << endl;
  // cout << cnt << endl;
  int s = 0;
  if (K < q) {
    rep(i, (int)K) {
      s = A[s];
    }
    cout << s+1 << endl;
  }
  else {
    int t = (K-q)%p;
    s = a;
    rep(i, (int)t) {
      s = A[s];
    }
    cout << s+1 << endl;
  }

}


Measured memory_bytes: 13208
n = int(input())
A = [list(map(int,input().split())) for i in range(n)]

out=0
A.sort(key=lambda x:x[1])
t = 0
for i in range(n):
    if t+A[i][0] > A[i][1]:
        out = 1
    else:
        t += A[i][0]
if out==1:
    print("No")
else:
    print("Yes")


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

using namespace std;

vector<string> split_string(string);

// Complete the acmTeam function below.


int main(){
    int n;
    cin >> n;
    vector< pair< pair < string , int >, int >  > rest(n);
    for(int i = 0;i < n;i++){
        cin >> rest[i].first.first;
        cin >> rest[i].first.second;
        rest[i].first.second*=-1;
        rest[i].second = i;
    }
    sort(rest.begin(),rest.end());
    for(int i = 0;i < n;i++){
        cout << rest[i].second+1 << endl;
    }

    return 0;
}




Measured memory_bytes: 256
#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 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;
}

long long n, ta, mu;

signed main() {
	cin >> n;
	rep(i, n) {
		int a;
		cin >> a;
		if (a >= 1)mu += a;
		else {
			ta += mu / 2;
			mu = 0;
		}
	}
	ta += mu / 2;
	cout << ta << endl;
	ggr
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

li M=1e9+7;

vi fact(500001),invfact(500001);

li init()
{
    fact[0]=1;

    f(i,1,500000)
    {
        fact[i]=(fact[i-1]*i)%M;
    }

    invfact[500000]=fastpow(fact[500000],M-2,M);

    fr(i,499999,0)
    {
        invfact[i]=(invfact[i+1]*(i+1))%M;
    }
}

li ncr(li n,li r)
{
    return (((fact[n]*invfact[n-r])%M)*invfact[r])%M;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n,k;

    cin>>n>>k;

    init();

    li tp=min(k,n-1);

    li ans=0;

    f(i,0,tp)
    {
        ans+=((ncr(n,i)*ncr(i+n-i-1,i))%M);
        ans%=M;
    }

    cout<<ans;

    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define RANGE(i,n) for(int i=0;i<n;i++)
typedef long long ll;
struct P{
    ll var1;
    ll var2;
};
bool operator< ( const P &one, const P &two){
    return one.var1 < two.var1;
};
bool operator> ( const P &one, const P &two){
    return one.var1 > two.var1;
};

using namespace std;

ll num_yaku(ll bottom, ll top, ll e){
    return (top / e) - ((bottom -1) / e);
}

ll euclidean_gcd(ll a, ll b) {
  if(a < b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

signed main() {
    ll A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << (B - A +1) - (num_yaku(A, B, C) + num_yaku(A,B,D) - num_yaku(A,B, C*D / euclidean_gcd(C,D))) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int,int> mypair;
int main(void){
	int n,w,d;
	while(1){
	cin>>n>>w>>d;
	if(n==0&&w==0)break;
	vector<mypair> a;
//	mypair size;
	a.push_back(mypair(w,d));
	for(int i=0;i<n;i++){
		int p,s;
		cin>>p>>s;
	//	size=a[p-1];
		int b,c,e;
		b=a[p-1].first;
		c=a[p-1].second;
		a.erase(a.begin()+p-1);
		//remove(a,p-1)
		e=s%(b+c);
		if(e>b){
			e-=b;
			if(e>c-e)e=c-e;
			a.push_back(mypair(b,e));
			a.push_back(mypair(b,c-e));
		}else{
			if(e>b-e)e=b-e;
			a.push_back(mypair(e,c));
			a.push_back(mypair(b-e,c));
		}
		for(int j=0;j<a.size();j++){
		//	cout<<a[j].first<<' '<<a[j].second<<' ';
		}
		//cout<<endl;
	}
	priority_queue<int,vector<int>,greater<int> > q;
for(int i=0;i<a.size();i++){
	q.push(a[i].first*a[i].second);
}
while(q.size()!=1){
	cout<<q.top()<<' ';
	q.pop();
}
cout<<q.top()<<endl;
}
	return 0;
}

Measured memory_bytes: 3060
#include <bits/stdc++.h>    
#define pb push_back

#define FOR(x,to) for(int x=0;x<(to);x++)
#define F0R(x,in,to) for(int x=(in);x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))

typedef long long ll;
using namespace std;
ll MOD = 998244353;

typedef pair<int,int> ii;
typedef struct {int a,b,c;}iii;
typedef vector<int> vi;

void mosA(vector<ll> a){
	for(int i=0; i<a.size(); i++) printf("%lld ",a[i]);
	printf("\n");
}
void mosP(vector<ii> a){
	for(int i=0; i<a.size(); i++) printf("%d %d\n",a[i].first,a[i].second);
	printf("\n");
}

ll min_especial(ll a, ll b){
  if(a!=-1 && b!=-1) return min(a,b);
  else return max(a,b);
}
/*
bool ord(ii a, ii b){
	if(a.first == b.first){
		return a.second < b.second;
	}
	return a.first < b.first;
}*/

bool ord(ll a, ll b){
	return a>b;
}

ll ans = 0;
int a,n,w,t,k,m,z,q,l,r,x,b;
ll A[200005];
char S[200005];



int main(){
	scanf("%s",S);
	int l = (S[0]-'0')*10 + (S[1]-'0');
	int r = (S[2]-'0')*10 + (S[3]-'0');

	
	if(r<=12 && r>0 && l<=12 && l>0) return !printf("AMBIGUOUS\n");
	if(r<=12 && r>0) return !printf("YYMM\n");
	if(l<=12 && l>0) return !printf("MMYY\n");
	return !printf("NA\n");


}




// REVISATE ESTO:
// - memset(A,-1,SIZEOF()*n)
// - (x-y+MOD)%MOD
// - int o ll?

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>

#define iter(n) for(int iter_var = 0; iter_var < n; iter_var += 1)
#define rep(i, s, n) for(int i = s; i < n; i += 1)
#define lli long long int
#define INF 1e9
#define MOD 1000000007

using namespace std;

int main(){

  int n, m; cin >> n >> m;
  vector<vector<int>> connect(n, vector<int>(0));
  iter(m){
    int x, y; cin >> x >> y;
    connect[x - 1].push_back(y - 1);
    connect[y - 1].push_back(x - 1);
  }

  vector<int> ans(n, INF);
  ans[0] = 0;
  queue<int> q;

  q.push(0);
  while(!q.empty()){
    int x = q.front(); q.pop();
    int sz = connect[x].size();
    rep(i, 0, sz) if(ans[connect[x][i]] == INF){
      ans[connect[x][i]] = x;
      q.push(connect[x][i]);
    }
  }

  cout << "Yes" << endl;
  rep(i, 1, n) cout << ans[i] + 1 << endl;
}


Measured memory_bytes: 10088
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define                          ll                          long long int
ll gcd(int a,int b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}

#define                          in(x)                       scanf("%lld",&x)
#define                          in2(x,y)                    scanf("%lld %lld",&x,&y)
#define                          in3(x,y,z)                  scanf("%lld %lld %lld",&x,&y,&z)
#define                          out(x)                      printf("%lld\n",x)
#define                          cy                          printf("YES\n")
#define                          cn                          printf("NO\n")
#define                          inf                         1e18
#define                          neg                         -1e18
#define                          mx                          2111111
#define                          fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define                          fi                          frist
#define                          si                          second
#define                          ce                          cout<<endl
#define                          pb                          push_back
#define                          vc(x)                       x.begin(),x.end()
#define                          pb                          push_back
#define                          pi                          pair<ll,ll>
#define                          debug                       printf("ok\n");
#define                          pg                          pair<ll,ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> >
#define                          mod                        1000000007


int main(){
    fast

     ll i,n,j,ans=0,m,s=0,sum=0,x=0;
     in(n);
     ll a[n+9];
     for(i=0;i<n;i++){
        in(a[i]);
        s+=a[i];
     }
     for(i=0;i<n;i++){
        s-=a[i];
      ans+=((s%mod)*a[i]%mod)%mod;
      ans%=mod;
     }
   cout<<ans<<endl;
}


Measured memory_bytes: 5168
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB") cout << "No" << endl;
	else cout << "Yes" << endl;
}

Measured memory_bytes: 3624
import scala.collection.mutable
import scala.collection.immutable

object Main extends App {
  def AttackSurvival(nn: Int, kk: Int, qq: Int, im: immutable.Map[Int, Int]): immutable.IndexedSeq[String] = {
    val d = qq - kk //正解数がこの値以下なら負け
    val x = (1 to nn).map(i => {
      val score = im.getOrElse(i, 0)
      if (score > d) "Yes"
      else "No"
    })
    x
  }
  val sc = new java.util.Scanner(System.in)
  val n, k, q = sc.nextInt
  val m = mutable.Map[Int, Int]()
  (1 to q).foreach(_ => {
    val ai = sc.nextInt
    val v = m.getOrElse(ai, 0)
    m += (ai -> (v + 1))
  })
  AttackSurvival(n, k, q, m.toMap).foreach(str => println(str))
}


Measured memory_bytes: 81000
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<int>
#define ll long long
using namespace std;


int main() {
    int n; cin >> n;
    int b[n-1];
    rep(i, 0, n-1) cin >> b[i];

    int ans = b[0] + b[n-2];
    rep(i, 0, n-2){
        ans += min(b[i], b[i+1]);
    }

    cout << ans << "\n";
} 


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

s = sum(A)
B = [0]
for i in range(N):
    B.append(B[i] + A[i])

ans = float('inf')
for i in range(1, N):
    _ans = ans
    ans = min(ans, abs(B[i] - (s - B[i])))
    if ans > _ans:
        break

print(ans)


Measured memory_bytes: 100300
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    char S[N + 2];
    int cnt;
    for (int i = 0; i < N; i++)
    {
        cin >> S[i];
        if (S[i] == 'Y')
        {
            cout << "Four" << '\n';
            return 0;
        }
    }
    
    cout << "Three" << '\n';
    
    return 0;
}


Measured memory_bytes: 256
/**
 * TODO: delete this line
 */


import java.math.BigInteger;
import java.util.Scanner;

/**
 * TODO: Rename to Main
 */
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] as = new int[N];

        for (int i = 0; i < N; i++) {
            as[i] = scanner.nextInt();
        }

        BigInteger lcm = BigInteger.valueOf(1);
        for (int a : as) {
            lcm = lcm(lcm, BigInteger.valueOf(a));
        }

        BigInteger sum = BigInteger.valueOf(0);
        for (int a : as) {
            sum = sum.add((lcm.subtract(BigInteger.valueOf(1))).mod(BigInteger.valueOf(a)));
        }
        System.out.println(sum);
    }

    private static BigInteger lcm(BigInteger m, BigInteger n) {
        return m.multiply(n).divide(gcd(m, n));
    }

    private static BigInteger gcd(BigInteger m, BigInteger n) {
        return m.gcd(n);
    }
}

Measured memory_bytes: 48628
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += sc.nextLong();
		}

		System.out.println(sum - n);
		sc.close();
	}

}


Measured memory_bytes: 25784
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class arc097c {
public:
    void solve(istream& in, ostream& out) {
        string s;
        in >> s;
        int K;
        in >> K;
        set<string> v;
        int n = s.size();
        for (int i = 0; i < n; ++i) {
            for (int j = 1; j <= K && i + j <= n; ++j) {
                v.insert(s.substr(i, j));
            }
        }
        vector<string> res(begin(v), end(v));
        out << res[K - 1] << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	arc097c solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long int;
int main()
{
    ll n, a, b;
    cin >> n >> a >> b;

    ll ans = (n / (a + b)) * a + min((n % (a + b)), a);
    cout << ans << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <bits/stdc++.h>
#include <sstream>
#define PI 3.14159265358979323846264338327950L
#define ll long long
using namespace std;

int main(){
    ll n, d, a, b;
    cin >> n >> d;
    d*=d;
    ll ans = 0;
    for(ll i=0; i<n; i++){
        cin >> a >> b;
        if(a*a + b*b <= d){
            ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 3612
#include"bits/stdc++.h"
using namespace std;

void Main() {
  int n;
  cin >> n;
  int c[10][10];
  memset(c, 0, sizeof(c));

  for (int i = 1; i <= n; i++) {
    string numStr;
    numStr = to_string(i);
    c[numStr[0] - '0'][numStr[numStr.size() - 1] - '0']++;
  }

  long long int ans = 0;
  for (int i = 1; i < 10; i++) {
    for (int j = 1; j < 10; j++) {
      ans += c[i][j] * c[j][i];
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int p(int a,int b){
	int k=1;
	for(int i=0;i<b;i++)
	    k*=a;
	return k;
}
int main(){
    int x,max=1;
    cin>>x;
    for(int i=2;i<=int(sqrt(x));i++)
        for(int j=2;j<=10;j++)
            if(p(i,j)<=x&&p(i,j)>max)
                max=p(i,j);
    cout<<max;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll
#define INF 1e16
#define mod 1000000007
ll a,b,k;
int main(){
    cin>>a>>b>>k;
    if(a+b<=k){
        cout<<0<<" "<<0<<endl;
    } else if(k-a>=0){
        cout<<0<<" "<<b-(k-a)<<endl;
    } else {
        cout<<a-k<<" "<<b<<endl;
    }
    return 0;
    }

Measured memory_bytes: 256
import sys
# If available, use C implementation
try:
    from _heapq import heapify, heappushpop
except ImportError:
    from heapq import heapify, heappushpop
try:
    from _heapq import _heapreplace_max
except ImportError:
    pass
try:
    from _heapq import _heapify_max as heapify_max
except ImportError:
    from heapq import _heapify_max as heapify_max
try:
    from _heapq import _siftup_max
except ImportError:
    from heapq import _siftup_max


def heappushpop_max(heap, item):
    if heap and heap[0] > item:
        item, heap[0] = heap[0], item
        _siftup_max(heap, 0)
    return item


fin = sys.stdin.readline
N = int(fin())
a_list = [int(elem) for elem in fin().split()]

left_pq = a_list[:N]
right_pq = a_list[2 * N:]
heapify(left_pq)
heapify_max(right_pq)

left_sum = [sum(left_pq)]
right_sum = [sum(right_pq)]
for k in range(N, 2 * N):
    left_item = a_list[k]
    right_item = a_list[-k - 1]
    left_sum.append(left_sum[-1] - heappushpop(left_pq, left_item) + left_item)
    right_sum.append(right_sum[-1] - heappushpop_max(right_pq, right_item) + right_item)

max_sum = max(map(sum, zip(left_sum, [-item for item in right_sum[::-1]])))
print(max_sum)


Measured memory_bytes: 39516
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    class Program
    {
        private const int MODULO = 1000000007;
        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); }

        class Node<T>
        {
            private int m_height;
            private Node<T> m_parent;
            public T Item { get; private set; }
            public Node(T item)
            {
                m_height = 0;
                m_parent = this;
                Item = item;
            }
            public Node<T> Find()
            {
                if (m_parent == this) { return this; }

                Node<T> parent = m_parent.Find();
                m_parent = parent;
                return parent;
            }
            public static void Unite(Node<T> a, Node<T> b)
            {
                Node<T> p = a.Find();
                Node<T> q = b.Find();
                if (p.m_height < q.m_height)
                {
                    p.m_parent = q;
                    q.m_height = Math.Max(p.m_height + 1, q.m_height);
                }
                else
                {
                    q.m_parent = p;
                    p.m_height = Math.Max(q.m_height + 1, p.m_height);
                }
            }
        }
        static int Solve(int N, int M, Tuple<int, int>[] paths)
        {
            int count = 0;
            for (int i = 0; i < M; ++i)
            {
                var nodes = Enumerable.Range(0, N).Select(j => new Node<int>(j)).ToArray();
                for (int j = 0; j < M; ++j)
                {
                    if (i != j)
                    {
                        int a = paths[j].Item1;
                        int b = paths[j].Item2;
                        Node<int>.Unite(nodes[a], nodes[b]);
                    }
                }
                var parents = new HashSet<int>();
                foreach (int j in nodes.Select(node => node.Find().Item)) { parents.Add(j); }
                if (parents.Count > 1) { ++count; }
            }
            return count;
        }
        static void Main(string[] args)
        {
            int[] v1 = ReadInts();
            int N = v1[0];
            int M = v1[1];
            var paths = new Tuple<int, int>[M];
            for (int i = 0; i < M; ++i)
            {
                var v2 = ReadInts();
                paths[i] = new Tuple<int, int>(v2[0] - 1, v2[1] - 1);
            }
            Console.WriteLine(Solve(N, M, paths));
        }
    }
}


Measured memory_bytes: 13532
N,A,B,C=map(int,input().split())
l=[]
for i in range(N):
    l.append(int(input()))
from itertools import product

ans=1e10
for p in product([0,1,2,3],repeat=N):
    m=[-1,-1,-1]
    mp=0
    for i in range(N):
        if p[i]!=3:
            if m[p[i]]==-1:
                m[p[i]]=l[i]
            else:
                mp+=10
                m[p[i]]+=l[i]
    mp+=abs(m[0]-A)+abs(m[1]-B)+abs(m[2]-C)
    if min(m)>=0:
        ans=min(mp,ans)
print(ans)


Measured memory_bytes: 50140
#include <iostream>

using namespace std;

int main()
{

    int length;     cin >> length;

    int order[1000000], student;
    for (int i = 0; i < length; i++){
        cin >> student;
        order[student-1] = i + 1;
    }

    for (int i = 0; i < length; i++){
        cout << order[i] << " ";
    }

    return 0;
}


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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << SP; } cout << BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << BR;

int main() {
  ll A, B, C;
  cin >> A >> B >> C;

  int ans = C - (A - B);
  ans = max(ans, 0);
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <string>

int main() {
    std::string s;
    std::cin >> s;
    
    int count = 0;
    
    for(int i = 0; i < 3; i++){
        if(s[i] == '1'){
            count++;
        }
    }
    std::cout << count;
}


Measured memory_bytes: 256
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
template <usize N, class T, class... Args, std::enable_if_t<N==0, int> = 0>
auto mkvec(Args... args) {
    return T(args...);
}
template <usize N, class T, class... Args, std::enable_if_t<N!=0, int> = 0>
auto mkvec(usize sz, Args... args) {
    using value_type = std::decay_t<decltype(mkvec<N-1, T>(args...))>;
    return vec<value_type>(sz, mkvec<N-1, T>(args...));
}
int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n, m;
    std::cin >> n >> m;
    auto g = mkvec<2, usize>(n, n);
    while (m--) {
        usize u, v;
        std::cin >> u >> v;
        u--, v--;
        g.at(u).at(v) = true;
        g.at(v).at(u) = true;
    }

    vec<usize> ord(n);
    std::iota(ALL(ord), usize{0});
    u32 ans = 0;
    do {
        bool ng = false;
        for (usize i=0; i<n-1; i++) {
            if (!g.at(ord.at(i)).at(ord.at(i+1))) {
                ng = true;
                break;
            }
        }
        ans += !ng;
    } while (std::next_permutation(ord.begin() + 1, ord.end()));

    std::cout << ans << '\n';
}


Measured memory_bytes: 256
#include <stdio.h>

int d[55];

int main() {

	int N;

	scanf("%d",&N);

	int i,j;

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

	int ans = 0;

	for (i = 0; i < N; i++) {
		for (j = i + 1; j < N; j++) {
			ans += d[i] * d[j];
		}
	}

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

	return 0;
}

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

    if(n%k == 0) ans = 0;
    else{
        n %= k;
        ans = min(n,abs(n-k));
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
a,b,c = map(int,input().split())
haiku = {5:2,7:1}
haiku[a] -=1
haiku[b] -=1
haiku[c] -=1
flag = True
for val in haiku.values():
  if val==0:
    continue
  else:
    flag = False
    
print('YES' if flag else 'NO')

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

int main()
{
    string a,b;
    int x,y;
    cin>>a>>b>>x>>y;
    string temp;
    cin>>temp;
    if(temp==a)
        x--;
    if(temp==b)
        y--;
    cout<<x<<" "<<y<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

int a[101];

int main(void) {
    int n, avg = 0;
    cin >> n;
    for(int i=0; i<n; i++) {
        scanf("%d", a+i);
        avg += a[i];
    }

    avg /= n;
    int ans1 = 0, ans2 = 0;
    for(int i=0; i<n; i++) {
        ans1 += (a[i] - avg) * (a[i] - avg);
        ans2 += (a[i] - avg - 1) * (a[i] - avg - 1);
    }

    return !printf("%d\n", min(ans1, ans2));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef vector<double> Vec;
typedef vector<Vec> Mat;
typedef pair<ll,ll> P;
typedef pair<double,ll> Pd;
typedef pair<double,double> PD;
typedef priority_queue<P,vector<P>,greater<P> > P_queue;
typedef priority_queue<Pd,vector<Pd>,greater<Pd> > Pd_queue;

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
const double DEL=1e-6;

#define _GLIBCXX_DEBUG
#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

void Add(ll &a, ll b){
    a=(a+b)%mod;
    return;
}

void Pro(ll &a, ll b){
    a=(a*b)%mod;
    return;
}

struct Kai{
    ll left; ll right; ll sa; ll cost;
    Kai(ll l, ll r, ll s, ll c) : left(l), right(r), sa(s), cost(c) {}
};

vector<Kai> D;

vec hen(vec x){
    vec ret;
    ll Count=0;
    rep(i,x.size()){
        if(!x[i]) Count++;
        else ret.pb(Count);
    }
    return ret;
}

int main(){
    ll N,M,Q; cin>>N>>M>>Q;
    rep(i,Q){
        ll a,b,c,d; cin>>a>>b>>c>>d;
        a--; b--;
        Kai kari(a,b,c,d);
        D.pb(kari);
    }
    vec x={};
    rep(i,M-1) x.pb(0);
    rep(i,N) x.pb(1);
    
    ll ans=-INF;
    do{
        vec f=hen(x);
        //for(auto e: x) cout<<e<<' ';
        //cout<<endl;
        //for(auto e: f) cout<<e<<' ';
        ll Count=0;
        for(auto e : D) {
            if(f[e.right]-f[e.left]==e.sa) Count+=e.cost;
        }
        //cout<<':'<<Count<<endl;
        ans=max(Count,ans);
    }while(next_permutation(ALL(x)));
    cout<<ans<<endl;

}


Measured memory_bytes: 3644
import re

I = input().split()
S = []

for i in range(len(I)) :
    I[i] = re.split("[,.]", I[i])
    if 2 < len(I[i][0]) and len(I[i][0]) < 7 :
        S.append(I[i][0])

for i in range(len(S)) :
    if i == len(S) - 1 :
        print(S[i])
    else :
        print(S[i], " ", sep = "", end = "")


Measured memory_bytes: 6528
from bisect import bisect_right, bisect_left

N,K = map(int,input().split())
A = sorted(map(int,input().split()))

t0 = bisect_left(A,0)
t1 = bisect_right(A,0)
pos = A[t1:]
neg = [-v for v in reversed(A[:t0])]
zeros = t1-t0
offset_negative = len(pos)*len(neg)
offset_zero = zeros*(N-zeros) + zeros*(zeros-1)//2
offset = offset_zero + offset_negative

def bisect2(ng, ok, judge):
    while abs(ng-ok) > 1:
        m = (ng+ok)//2
        if judge(m):
            ok = m
        else:
            ng = m
    return ok

def count1(l,n):
    j = len(l)
    cnt = 0
    for i,a in enumerate(l):
        v = n//a
        while j > i and l[j-1] > v:
            j -= 1
        if j <= i:
            break
        else:
            cnt += j-i-1
    return cnt

def count2(l1,l2,n):
    j = len(l2)
    cnt = 0
    for i,a in enumerate(l1):
        v = n//a
        while j > 0 and l2[j-1] > v:
            j -= 1
        cnt += j
    return cnt


def cnt(n):
    if n > 0:
        cnt = count1(pos,n-1) + count1(neg,n-1) + offset
    else:
        cnt = offset_negative - count2(pos,neg,-n)
    return cnt


if offset_negative < K <= offset:
    print(0)
else:
    temp = max(abs(a) for a in A)**2
    print(bisect2(temp, -temp, lambda n: cnt(n) <= K-1))

# from itertools import combinations
# s = sorted(a*b for a,b in combinations(A,2))
# for i,v in enumerate(s):
#     print(cnt(v),i,v)

Measured memory_bytes: 96596
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#define mem(a,b) memset(a,b,sizeof (a))
#define gcd(a,b) __gcd(a,b)
#define all(a) a.begin(),a.end()
#define sz(s) s.size()
#define endl '\n'
#define pb push_back
typedef long long ll;
const int maxn=200010;
const int inf=1e9;
const ll mod=998244353;
const double pi=3.14159265358979;
const double ep=0.0;
using namespace std;
int a[2*maxn],b[maxn],c[2*maxn];
int main()
{
    int n;
    cin>>n;
    int xora=0,xorb=0;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i+n]=a[i];
        xora^=a[i];
    }
    for (int i=0;i<n;i++)
    {
        cin>>b[i];
        xorb^=b[i];
    }
    c[0]=a[0];
    for (int i=1;i<2*maxn;i++)
        c[i]=c[i-1]^a[i];
    vector<pair<int,int>>vec;
    for (int i=0;i<n;i++)
    {
        set<int>se;
        int t=20,r=xora^xorb;
        while (t--)
        {
            int x=rand()%n;
            se.insert(x);
        }
        map<int,int>ma;
        for (auto j:se)
        {
            ma[a[i+j]^b[j]]++;
            if (sz(ma)>1)
                break;
        }
        if (sz(ma)==1&&r==0)
            vec.pb(make_pair(i,(*(ma.begin())).first));
        else if (sz(ma)==1&&(*(ma.begin())).first==r)
            vec.pb(make_pair(i,r));
    }
    for (auto i:vec)
        cout<<i.first<<' '<<i.second<<endl;
    return 0;
}


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

int main() {
  int64_t a = 0, b = 0, x = 0;
  std::cin >> a >> b >> x;

  std::cout << b / x + 1 - (a == 0 ? 0 : (a - 1) / x + 1) << std::endl;
  return 0;
}

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

int main(void) {
  int a, b;
  cin >> a >> b;

  int n = 0;
  for (int i = 1; i <= b-a; i++) {
    n += i;
  }
  cout << n - b << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long H = in.nextLong();
            HashMap<Long, Long> memo = new HashMap<>();
            long res = countAttacks(H, 0, memo);
            out.println(res);
        }

        public long countAttacks(long H, long res, HashMap<Long, Long> memo) {
            if(H == 1)
                return res + 1;

            if(memo.containsKey(H))
                return memo.get(H);

            long res1 = countAttacks(H/2, res, memo);
            long res2 = countAttacks(H/2, res, memo);
            memo.put(H/2, res1);
            return res1 + res2 + 1;

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() { return Long.parseLong(next()); }

    }
}



Measured memory_bytes: 22868
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int hh = sc.nextInt();
        int www = sc.nextInt();
        int a = h - hh;
        int b = w - www;
        System.out.println(a * b);
        sc.close();
    }
}

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

const vector<char> m = {'S', 'H', 'C', 'D'};

signed main() {
	int n;
	cin >> n;
	char c;
	int num;
	map<char, vector<bool>> a;

	for (int i = 0; i < 4; ++i) {
		a[m[i]].resize(13);
	}

	for (int i = 0; i < n; ++i) {
		cin >> c >> num;
		a[c][num - 1] = true; 
	}

	for (int mark = 0; mark < 4; ++mark) {
		for (int i = 0; i < 13; ++i) {
			if (!a[m[mark]][i]) {
				cout << m[mark] << ' ' << i + 1 << endl;
			}
		}
	}
}



Measured memory_bytes: 3080
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int a, b, h, c, d;
	cin >> a >> b >> h >> c >> d;
	int ans;
	if (c >= d) ans = d * h * 2 + (c - d)*a;
	else ans = c * h * 2 + (d - c)*b;

	int aans;
	if (c >= d) aans = c * 2 * h;
	else aans = d * 2 * h;
	int bans = min(aans, ans);
	cout << min(a*c + b * d, bans) << endl;
}


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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    unsigned long long l = 0;
    for (int i = 1; i < b - a; i++) {
        l += i;
    }
    cout << l - a << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
  long long n;
  cin >>n;
  string s;
  cin>>s;
  map<char,long long>mp;
  for(long long i=0;i<n;i++){
    mp[s[i]]++;
  }
  mint kotae=1;
  long long kazu=0;
  auto begin=mp.begin(),end=mp.end();
  for(auto iter=begin;iter!=end;iter++){
    kazu=iter->second;
    kotae*=(kazu+1);
  }  
  kotae-=1;
  cout<<kotae<<endl;
  return 0;
}

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int a, p; cin >> a >> p;

	cout << ((a * 3) + p) / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {

	int a, b;
	cin >> a >> b;
	if (1 <= a && a <= 9 && 1 <= b && b <= 9) {
		cout << a * b << endl;
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}

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

using namespace std;

int main(void)
{
    int a[5]; int ans;
    for (int i = 0; i < 5; i++)
        cin>>a[i];
    ans= a[3]-a[1]+60*(a[2]-a[0])-a[4];
    if (ans<0) ans=0;
    cout<<ans;

    return 0;
} 

Measured memory_bytes: 3672
#include <stdio.h>
#define MODULUS 1000000007LL

int main() {
    long long m, n, accumulator, powm;
    scanf("%lld %lld ", &m, &n);
    powm = m;
    accumulator = 1LL;
    while (n) {
        if (n & 1) accumulator = (accumulator * powm) % MODULUS;
        powm = (powm * powm) % MODULUS;
        n >>= 1;
    }
    printf("%lld\n", accumulator);
    return 0;
}



Measured memory_bytes: 2088
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
using namespace std;

void sol(){
    double x1,y1,x2,y2,x3,y3;
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    double b=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
    double c=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    double s=(a+b+c)/2;
    double ss=sqrt(s*(s-a)*(s-b)*(s-c));
    double sina=2*ss/b/c;
    double r=a/sina/2;
    a*=a;
    b*=b;
    c*=c;
    double px=(a*(b+c-a)*x3+b*(a+c-b)*x2+c*(a+b-c)*x1)/16/(ss*ss);
    double py=(a*(b+c-a)*y3+b*(a+c-b)*y2+c*(a+b-c)*y1)/16/(ss*ss);
    printf("%.3lf %.3lf %.3lf\n",px,py,r);

}

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        sol();
    }
    return 0;
}

Measured memory_bytes: 1232
#include<iostream>
using namespace std;
int main()
{
	int n,m;
	int sum = 1;
	long long ans=0;
	int yado[100001],
		cum[100001];
	cin >> n >> m;
	for (int i = 1;i < n;i++)
	{
		cin >> yado[i];
	}
	for (int i = 1;i <= m;i++)
	{
		cin >> cum[i];
		if (cum[i] > 0)
		{
			for (int j = 0;j < cum[i];j++)
			{
				ans += yado[sum];
				sum++;
			}
		}
		else
		{
			for (int j = cum[i];j < 0;j++)
			{
				sum--;
				ans += yado[sum];
			}
		}
	}
	cout << ans % 100000 << endl;
	return 0;
}

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

int main(){
	int second;
	int h,m,s;
	int amari1, amari2;

	cin >> second;

	h = second/3600;
	amari1 = second%3600;
	m = amari1/60;
	amari2 = amari1%60;
	s = amari2;

	cout << h << ":" <<  m << ":" << s << endl;


}

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

long long a, v, b, w, t;
int main() {
	cin >> a >> v >> b >> w >> t;
	cout << (v>w && abs(b-a)<=t*(v-w) ? "YES" : "NO");
	return 0;
}


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

int main() {
  vector<int> vec1(3);
  vector<int> vec2(3);
  vector<int> vec3(3);
  bool chk = true;
  
  cin >> vec1.at(0) >> vec1.at(1) >> vec1.at(2);
  cin >> vec2.at(0) >> vec2.at(1) >> vec2.at(2);
  cin >> vec3.at(0) >> vec3.at(1) >> vec3.at(2);
  
  if(vec1.at(1) - vec1.at(0) != vec2.at(1) - vec2.at(0) || vec1.at(1) - vec1.at(0) != vec3.at(1) - vec3.at(0)){
    chk = false;
  }
  if(vec1.at(2) - vec1.at(1) != vec2.at(2) - vec2.at(1) || vec1.at(2) - vec1.at(1) != vec3.at(2) - vec3.at(1)){
    chk = false;
  }
  
  if(chk == true){
    cout << "Yes";
  }else{
    cout << "No";
  }
}


Measured memory_bytes: 256