akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T, class U>bool chmax(T& a, U&& b) { return a < b ? a = b, 1 : 0; }
template<class T, class U>bool chmin(T& a, U&& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vv<int> A = vvec(N, N, 0);
    rep(i, N) rep(j, N) cin >> A[i][j];

    vector<ll> sub(1 << N);
    vector<int> tmp;
    rep(bit, 1 << N) {
        tmp.resize(0);
        rep(i, N) if (bit >> i & 1) tmp.push_back(i);

        rep(i, tmp.size() - 1) rep(j, i + 1, tmp.size()) {
            sub[bit] += A[tmp[i]][tmp[j]];
        }
    }

    vector<ll> dp(1 << N, -LINF);
    dp[0] = 0;
    rep(bit, 0, (1 << N) - 1) {
        for (int s = (bit + 1) | bit; s < 1 << N; s = (s + 1) | bit) {
            dp[s] = max(dp[s], dp[bit] + sub[s ^ bit]);
        }
    }

    write(dp[(1 << N) - 1]);
}

Measured memory_bytes: 1280
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
int n,m,c,s,g;
ll d[22][105][105];
ll D[105][105];
int p[22];
ll q[22][55],r[22][55];
ll culc(int com,ll dist){
	ll res = 0ll;
	for(int i=0;i<p[com];i++){
		if(q[com][i+1]>dist){
			res += r[com][i]*(dist-q[com][i]);
			break;
		}
		else res += r[com][i]*(q[com][i+1]-q[com][i]);
	}
	return res;
}
int solve(){
	scanf("%d %d %d %d %d",&n,&m,&c,&s,&g);
	if(n+m+c+s+g==0)return 1;
	s--;g--;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i==j)D[i][j]=0ll;
			else D[i][j]=LLINF;
		}
	}
	for(int i=0;i<c;i++){
		for(int j=0;j<n;j++){
			for(int k=0;k<n;k++){
				if(j==k)d[i][j][k]=0ll;
				else d[i][j][k]=LLINF;
			}
		}
	}
	for(int i=0;i<m;i++){
		int x,y,com;
		ll dist;
		scanf("%d %d %lld %d",&x,&y,&dist,&com);
		x--;y--;com--;
		d[com][x][y]=min(d[com][y][x],dist);
		d[com][y][x]=min(d[com][y][x],dist);	
	}
	for(int i=0;i<c;i++)scanf("%d",&p[i]);
	for(int i=0;i<c;i++){
		q[i][0]=0ll;
		for(int j=1;j<p[i];j++)scanf("%lld",&q[i][j]);
		q[i][p[i]]=(ll)INF;
		for(int j=0;j<p[i];j++)scanf("%lld",&r[i][j]);
	}
	for(int C=0;C<c;C++){
		for(int k=0;k<n;k++){
			for(int i=0;i<n;i++){
				for(int j=0;j<n;j++){
					d[C][i][j]=min(d[C][i][j],d[C][i][k]+d[C][k][j]);
				}
			}
		}
	}
	/*for(int C=0;C<c;C++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(d[C][i][j]==LLINF)printf("-1 ");
				else printf("%lld ",d[C][i][j]);
			}
			printf("\n");
		}
		printf("\n");
		printf("\n");
	}
	for(int C=0;C<c;C++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(d[C][i][j]==LLINF)printf("-1 ");
				else printf("%lld ",culc(C,d[C][i][j]));
			}
			printf("\n");
		}
		printf("\n");
		printf("\n");
	}*/
	for(int C=0;C<c;C++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(d[C][i][j]!=LLINF)D[i][j]=min(D[i][j],culc(C,d[C][i][j]));
			}
		}
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(D[i][j]==LLINF)printf("-1 ");
			else printf("%lld ",D[i][j]);
		}
		printf("\n");
	}*/
	for(int k=0;k<n;k++){
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
			}
		}
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(D[i][j]==LLINF)printf("-1 ");
			else printf("%lld ",D[i][j]);
		}
		printf("\n");
	}*/
	
	if(D[s][g]==LLINF)printf("-1\n");
	else printf("%lld\n",D[s][g]);
	return 0;
}
int main(){
	while(!solve()){}	
	return 0;
}

Measured memory_bytes: 5028
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int a, b;
    cin >> a >> b;
    if(a*b%2 == 0){
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int gcd(int a, int b);

int main(void)
{
  int a, b;
  scanf(" %d %d", &a, &b);
  printf("%d\n", gcd(a, b));
  return 0;
}

// gcd finds the GCD of a and b.
int gcd(int a, int b)
{
  int i;
  if (b > a)
    {
      i = a;
      a = b;
      b = i;
    }
  while (a % b != 0)
    {
      i = a % b;
      a = b;
      b = i;
    }
  return b;
}



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

int main(){
    int n, h; cin >> n >> h;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }
    sort(a.begin(), a.end(), greater<int>());
    sort(b.begin(), b.end(), greater<int>());
    int max = a[0];
    ll ans = 0;
    for(int i = 0; i < n; i++){
        int mid = b[i];
        if(h <= 0){
            break;
        }
        if(mid < max){
            break;
        }
        h -= mid;
        ans++;
    }
    if(h <= 0){
        cout << ans << endl;
        return 0;
    }
    if(h % max == 0){
        ans += (h / max);
    }else{
        ans += (h/max) + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define x first
#define y second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ve vector
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define sz(a) (int)(a.size())
//using namespace __gnu_pbds;
using namespace std;

// // // functions: find_by_order  & order_of_key
// typedef tree<
// int,
// null_type,
// less<int>,
// rb_tree_tag,
// tree_order_statistics_node_update>
// ordered_set;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

const int inf=(int)2e9;
const long long mod=1000000007; //1E9+7
int dx[]={1,-1,0,0},dy[]={0,0,1,-1};

ll powmod(ll a,ll p){
	ll ans=1;
	while(p){
		if(p&1) ans*=a;
		p/=2;a*=a; ans%=mod;a%=mod;
	}
	return ans;
}
ll mdinv(ll a){return powmod(a,mod-2); }

signed main(){
	IOS
	int n;cin>>n;
	int k;cin>>k;
	vi DP(k+2,0),DP_new(k+2);
	DP[0]=1;
	for(int i=0;i<n;i++){
		int a;cin>>a;
		for(int x=1;x<k+2;x++){
			DP[x]+=DP[x-1];
			if(DP[x]>=mod)
				DP[x]-=mod;
		}
		for(int x=0;x<k+2;x++){
			int r=x;int l=max(x-a,0ll);
			DP_new[x]=DP[r];
			if(l){
				DP_new[x]-=DP[l-1];
				if(DP_new[x]<0)
					DP_new[x]+=mod;
			}
		}
		swap(DP,DP_new);
	}
	cout<<DP[k];
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char a[101][101];
int main() {
    std::ios::sync_with_stdio(false);
    int w, b;
    cin >> w >> b;
    int countw = 0;
    int countb = 1;
    
    bool isbreak = false;
    int i = 0;

    if(countw < w - 1) {
        for(i = 0; i < 100; i++) {
            if(countw < w - 1){
                for(int j = 0; j < 99;) {
                    if(i%2 == 0){
                        if(countw == w - 1){
                            isbreak = true;
                            a[i][j] = '.';
                            a[i][j+1] = '.';
                            j+=2;
                        }
                        else {
                            countw++;
                            a[i][j + 1] = '.';
                            a[i][j] = '#';
                            j+=2;

                        }
                    }
                    else {
                        a[i][j] = '#';
                        a[i][j+1] = '#';
                        j++;
                    }
                }
                if(isbreak == true){
                    i++;
                    break;
                }
            }
            else {
                break;
            }
            
        }

    }
    for(int p = 0; p < 100; p++) {
        a[i][p] = '#';
    }
    i++;
    
    for(int p = 0; p < 100; p++) {
        a[i][p] = '.';
    }
    countw++;
    cout << endl;
    i++;
    int d = i;
    

    if(countb < b){
        isbreak = false;
        for( ;i < 100; i++) {
            if(countb < b){
                for(int j = 0; j < 99;) {
                    if(i%2 == d%2) {
                        if(countb == b){
                            isbreak = true;
                            a[i][j] = '#';
                            a[i][j+1] = '#';
                            j+=2;
                        }
                        else {
                            countb++;
                            a[i][j] = '.';
                            a[i][j+1] = '#';
                            j+=2;

                        }
                    }
                    else {
                        a[i][j] = '.';
                        a[i][j+1] = '.';
                        j++;
                    }
                }
                if(isbreak == true){
                    i++;
                    break;
                }
            }
            else {
                break;
            }
        }

    }
    assert(i <= 100);
    cout << i << " " << 100 << endl;
    for(int k = 0; k < i; k++) {
        for(int j = 0; j < 100; j++) {

            cout << a[k][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
// constexpr long long int INF = LLONG_MAX;
#define int long long int
vector<int> x;
vector<int> v;
int n, c;

int S(int x) {
  int res = 0;
  while (x != 0) {
    res += x % 10;
    x /= 10;
  }
  return res;
}

signed main() {
  cin >> n >> c;
  x.resize(n + 2);
  v.resize(n + 2);
  x[0] = 0;
  v[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> v[i];
  }
  x[n + 1] = c;
  v[n + 1] = 0;

  vector<int> max_a(n + 1);
  int mx = 0;
  int total = 0;
  for (int i = 0; i <= n; i++) {
    total += v[i];
    mx = max(mx, total - x[i]);
    max_a[i] = mx;
  }

  vector<int> max_b(n + 1);
  mx = 0;
  total = 0;
  for (int i = 0; i <= n; i++) {
    total += v[n + 1 - i];
    mx = max(mx, total - (c - x[n + 1 - i]));
    max_b[i] = mx;
  }

  int ans = 0;
  for (int i = 0; i < max_a.size(); i++) {
    ans = max(ans, max_a[i] - x[i] + max_b[n - i]); // あやしい
  }

  for (int i = 0; i < max_b.size(); i++) {
    ans = max(ans,
              max_b[i] - (c - x[n + 1 - i]) + max_a[n - i]); // あやしい
  }
  cout << ans << endl;
}


Measured memory_bytes: 3456
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

using namespace std;
#define int long long
#define k 10001

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0); //この2行はより速度を向上させる
    int n;
    cin >> n;
    vector<int> A(n), B(n);
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    vector<int> C(k);
    for(int i=0;i<k;i++) C[i]=0;
    for(int j=0;j<n;j++) C[A[j]]++;
    for(int i=1;i<k;i++) C[i]=C[i]+C[i-1];
    for(int j=n-1; j>=0; j--){
        B[C[A[j]]-1]=A[j];
        C[A[j]]--;
    }
    for(int i=0;i<n;i++) cout << B[i] << " \n"[i==n-1];
    return 0;
}



Measured memory_bytes: 34348
(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
      (cons (subseq str 0 pos)
            (split x (subseq str (+ pos size))))
      (list str))))

(defparameter lst (mapcar #'parse-integer (split " " (read-line))))
(defparameter N (nth 0 lst))
(defparameter K (nth 1 lst))
(defparameter S (nth 2 lst))

(if (= S (expt 10 9))
    (progn
      (loop repeat K
            do (format t "~A " S))
      (loop repeat (- N K)
            do (format t "~A " 1)))
    (progn
      (loop repeat K
            do (format t "~A " S))
      (loop repeat (- N K)
            do (format t "~A " (1+ S)))))

Measured memory_bytes: 7528
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
15 6
1 2 7 8 12 50

output:
2
"""

import sys


def solve():
    rec[0] = 0
    for i in range(c_num):
        for j in range(coins[i], money + 1):
            rec[j] = min(rec[j], rec[j - coins[i]] + 1)

    return rec


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    money, c_num = map(int, _input[0].split())
    coins = list(map(int, _input[1].split()))
    # assert len(coins) == c_num
    rec = [float('inf')] * (money + 1)
    ans = solve()
    print(ans.pop())

Measured memory_bytes: 9572
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := 0
	for i := 1; i*i < n; i++ {
		if n%i == 0 && n%(n/i-1) == i {
			ans += n/i - 1
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#pragma region header
#include <bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() {
    int n;cin>>n;
    vi a(n),b(n),c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    sort(all(a));sort(all(b));sort(all(c));
    int ans = 0;
    rep(i, n) ans+=(lower_bound(all(a),b[i])-a.begin())*(c.end()-upper_bound(all(c),b[i]));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define MP make_pair
#define PB push_back
#define PII pair<int,int>
typedef long long LL;
const LL P = 1e9+7;
const int N = 2e3;
const double pi = acos(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m,sum,a[N],b[N],mod[N];
LL k;

int main(){
	cin>>n>>k;
	rep(i,1,n)cin>>a[i],sum+=a[i];
	for(int i=1;i*i<=sum;++i)if(sum%i==0){
		b[++m] = i;
		if(i*i!=sum)b[++m] = sum/i;
	}
	sort(b+1,b+m+1);
	int ans = 0;
	rep(j,1,m){
		LL s1 = 0, s2 = 0;
		int x = b[j];
		rep(i,1,n)mod[i] = a[i]%x;
		sort(mod+1,mod+n+1);
		int l=1,r=n;
		while(l<=r){
			if(s1<=s2) s1 += mod[l++];
			else s2 += (x - mod[r--]);
		}
		//cout<<b[j]<<" "<<s1<<" "<<s2<<endl;
		if(s1<=k) ans = b[j];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(x) for x in input().split()]
b = []

for i in range(n + 1):
  if i == 0:
    b.append(abs(a[i]))
  elif i == n:
    b.append(abs(a[i - 1]))
  else:
    b.append(abs(a[i] - a[i - 1]))
  

sd = sum(b)

for j in range(n):
  if j == 0:
    print(sd - b[j] - b[j + 1] + abs(a[j + 1]))
  elif j == n - 1:
    print(sd - b[j] - b[j + 1] + abs(a[j - 1]))
  else:
    print(sd - b[j] - b[j + 1] + abs(a[j + 1] - a[j - 1]))

Measured memory_bytes: 14048
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

    a,b,c,d,e = map(int, input().split())
    if d >= b:
        res = (c-a)*60 + d-b
        print(res-e)
    else:
        res = (c-a-1)*60 + d-b+60
        print(res-e)

if __name__ == '__main__':
    main()

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

int main() {
  
  long long n,k,clr = 1;
  cin >> n >> k;
  
  clr *= k;
  
  for ( int i = 1; i < n; i++){
    clr *= ( k - 1);
  }
  
  cout << clr << endl; 
  
}


Measured memory_bytes: 256
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e3 + 10;
void solve() {
    int x, y;
    while(cin >> x) {
        cin >> y;
        if(x == 1) x += 13;
        if(y == 1) y += 13;
        if(x > y) puts("Alice");
        else if(x < y) puts("Bob");
        else puts("Draw");
    }
}
int main() {
    //freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


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

coin = [0] * N
for i in range(len(coin)):
    cnt = 0
    v = i + 1
    while v < K:
        cnt += 1
        v *= 2
    coin[i] = cnt
    
ans = 0
for v in coin:
    ans += 0.5 ** v
print(ans / N)


Measured memory_bytes: 39536
"use strict";

function Main(input) {
  let N = input.trim().split(' ').map(x => x*1);
  let sum = 0;
  N.forEach(elm => sum += elm);
  if(sum <= 21){
  	console.log('win');
  } else {
    console.log('bust');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i64 = int64_t;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= a; i--)
#define RF0(i,b) RFO(i,0,b)
#define F first
#define S second

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


  int N, M;
  cin >> N >> M;
  int sum = 0;
  F0R(i, M) {
    int a;
    cin >> a;
    sum += a;
  }

  int res = N - sum;
  if (res < 0) {
    res = -1;
  }

  cout << res;
}


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

int main()
{
	ll n,rem,flag=0;
	cin>>n;
	while(n)
	{
		rem=n%10;
		n=n/10;
		if(rem==7)
		{
			flag=1;
			break;
		}
	}
	if(flag==1)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((ll)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
typedef long long ll;
ll INF = 1e18;
using namespace std;

int main(){
  ll K,X;
  cin >> K >> X;

  ll low = X - K + 1;
  ll upper = K + X - 1;
  
  ll i = low;
  while(1){
    if(i>upper)break;
    cout << i;
    cout << " ";
    i += 1;
  }
  
  cout << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;


int main(){
    int X;
    
    cin >> X;
    
    if (X==3 or X==5 or X==7) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using LL = long long;

LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}

LL lcm(LL a, LL b) {
    return a / gcd(a, b) * b;
}

int main() {
    int a, b;
    while (cin >> a >> b) {
        cout << gcd(a, b) << ' ' << lcm(a, b) << endl;
    }
}


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

int main() {
    long long x, y;
    cin >> x >> y;
    int sum = 1;
    while(x <= y) {
        if(x * 2 <= y) sum++;
        x *= 2;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin>>n;
  string s;
  cin>>s;
  vector<bool> z(n,true);
  rep(i,n){
    if(z[i]&&s[i]=='('){
      for(ll j=i+1;j<n;j++){
        if(z[j]&&s[j]==')'){
          z[i]=false;
          z[j]=false;
          break;
        }
      }
    }
    else if(z[i]&&s[i]==')'){
      for(ll j=i-1;j>=0;j--){
        if(z[j]&&s[j]=='('){
          z[i]=false;
          z[j]=false;
          break;
        }
      }
    }
  }
  ll count1=0,count2=0;
  rep(i,n){
    if(z[i]&&s[i]=='('){
      count1++;
    }
    else if(z[i]&&s[i]==')'){
      count2++;
    }
  }
  rep(i,count2){
  s.insert(0,"(");
  }
  rep(i,count1){
    s.pb(')');
  }
  print(s);
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int n,t;cin>>n>>t;
    vector<pair<ll,ll>> p(n);
    rep(i,n){
        cin>>p[i].first>>p[i].second;
    }
    sort(p.begin(),p.end());
    vector<ll> dp(10000,-1);
    dp[0]=0;
    ll res=0;
    
    rep(i,n){
        int a=p[i].first,b=p[i].second;
        for(int j=t-1;j>=0;j--){
                chmax(dp[j+a],dp[j]+b);
        }
    }
    rep(i,t+3001){
        chmax(res,dp[i]);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 3736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
    ll n;
    cin >> n;
    vector<ll> v(n+1);
    REP(i, n){
        cin >> v[i+1];
    }

    ll ans = 1;
    ll tmp = v[1];
    bool ok = false;

    REP(i, n){
        if(tmp == 2){
            ok = true;
            break;
        }
        tmp = v[tmp];
        ans++;
    }
    if(ok) cout << ans << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 1024
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
using namespace std;

int inf = 2147483647;
int64_t inf64 = 9223372036854775807;
int mod = 1e+7;

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

  int n;
  cin >> n;
  vector<int> above(n+1, 0);
  vector<int> below(n+1, 0);

  reps(i,1,n+1) {
    int a;
    cin >> a;
    above[i] = above[i-1]+a;
  }

  reps(i,1,n+1) {
    int a;
    cin >> a;
    below[i] = below[i-1]+a;
  }

  int res = -1;
  reps(i,1,n+1) {
    int candy = 0;
    candy += above[i];
    candy += below[n]-below[i-1];
    res = max(res, candy);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

    int n;
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++)
            cin>>a[i];
    if(a[n]>2)
    {
        cout<<-1;
        return 0;
    }
    int l=2,r=3;
    int x,y;
    x=2;
    y=3;
    for(int i=n-1;i>=1;i--)
    {
        r-=r%a[i];
        if(r<x)
        {
            cout<<-1;
            return 0;
        }        
        r+=a[i]-1;
        l=l+(a[i]-l%a[i])%a[i];
        if(l>y)
        {
            cout<<-1;
            return 0;
        }
        if(l>r)
        {
            cout<<-1;
            return 0;
        }
        x=l;
        y=r;
    }
    cout<<l<<" "<<r;
} 


Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    vector<int> a(5);
    for(int i=0; i<5; ++i)
        cin >> a[i];
    sort(a.rbegin(), a.rend());

    cout << a[0];
    for(int i=1; i<5; ++i)
        cout << ' ' << a[i];
    cout << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, long long M)
{
    if (N == 1 && M == 1)
    {
        cout << 1 << endl;
        return;
    }
    else if (N == 1)
    {
        cout << M - 2 << endl;
        return;
    }
    else if (M == 1)
    {
        cout << N - 2 << endl;
        return;
    }
    else
    {
        cout << (N-2) * (M-2) << endl;
        return;
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long M;
    scanf("%lld", &M);
    solve(N, M);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,n) for(int i=1;i<(int)(n);i++)

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { //最大公約数
  if (b==0) return a;
  else return gcd(b, a%b);
}

ll lcm(ll a, ll b) { //最小公倍数
  return a * b / gcd(a, b);
}

ll digit_sum(ll a){ //10進桁和
  ll ans=0;
  while(a>0){
    ans+=a%10;
    a/=10;
  }
  return ans;
}



int main()
{
  ll n,k;
  cin>>n>>k;
  if(n%k==0){
    cout<<0<<endl;
  }else{
    cout<<1<<endl;
  }
  return 0;
}


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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int main() {
	int a, b;
	cin >> a >> b;
	
	if(a + b >= 10) { cout << "error" << endl; } else { cout << a + b << endl; }
	
	return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	mp := map[byte]int{}
	for i := 0; i < N; i++ {
		l := sc.NextLine()
		switch l[0] {
		case 'M', 'A', 'R', 'C', 'H':
			mp[l[0]]++
		}
	}
	tup := make([]int, 5)
	i := 0
	for _, v := range mp {
		tup[i] = v
		i++
	}

	ans := 0
	for i := 0; i < 5; i++ {
		for j := i + 1; j < 5; j++ {
			for k := j + 1; k < 5; k++ {
				ans += tup[i] * tup[j] * tup[k]
			}
		}
	}
	fmt.Println(ans)

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
int n,m,x,y,z,f[100005],w[100005];
void find(int x){
	if (f[x]==x) return;
	find(f[x]); w[x]+=w[f[x]]; f[x]=f[f[x]];
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;++i) f[i]=i;
	for (int i=1;i<=m;++i){
		scanf("%d%d%d",&x,&y,&z);
		find(x); find(y);
		if (f[x]==f[y]){
			if (w[x]+z!=w[y]){
				puts("No"); return 0;
			}
		}else{
			w[f[y]]=w[x]+z-w[y];
			f[f[y]]=f[x];
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

void printVec(vector<int> v){
    int size = v.size()-1;
    REP(i,size){
        if(i==v.size()) cout << v[i];
        else cout << v[i] << " " ;
    }
    cout << v[size] << endl;
}

void insertionSort(vector<int> vector, int n){ // N個の要素を含む0-オリジンの配列A
//   for i が 1 から N-1 まで
    FOR(i,0,n){
//      v = A[i]
        int v = vector[i];
//      j = i - 1
        int j = i-1;
//      while j >= 0 かつ A[j] > v
        while(j>=0 && vector[j]>v){
//        A[j+1] = A[j]
            vector[j+1] = vector[j];
            //printVec(vector);
//        j--
            j--;
        }

//      A[j+1] = v
        vector[j+1] = v;
        printVec(vector);
    }

}

signed main(){
    int n;
    cin >> n;

    vector<int> v;
    REP(_,n){
        int temp;
        cin >> temp;
        v.push_back(temp);
    }

    insertionSort(v, n); 
    
}


Measured memory_bytes: 3124
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
long long n;
int m_i_n(int a,int b){
	int qaq=max(a,b);
	int sum=0;
	while(qaq!=0){
		qaq/=10;
		sum++;
	}
	return sum;
}

int main(){
	cin>>n;
	long long bz=sqrt(n);
	for(long long i=bz;i>=1;--i){
		if(n%i==0){
			cout<<m_i_n(i,n/i);
			return 0;
		}
	}
}

Measured memory_bytes: 384
A, B, C, X, Y = map(int, input().split())

a = A*X+B*Y
b = max(X, Y) * 2 * C

if X > Y:
    c = Y*2 * C + (X-Y) * A
else:
    c = X*2 * C + (Y-X) * B

print(min(a, b, c))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,string>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    ll N;
    cin >> N;   
    ll X;
    cin >> X;
    ll Y;
    cin >> Y;
    vector<ll> counter(N,0);
    for(ll i=1;i<=N-1;i++){
     for(ll j=i+1;j<=N;j++){
         counter[min(min(j-i,1+llabs(i-X)+llabs(j-Y)),1+llabs(j-X)+llabs(i-Y))]++
     ;}
    ;}
    for(ll i=1;i<N;i++){
        cout<<counter[i]<<endl
    ;}

return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define N 100
int main () {
        int n, a[N];
        cin >> n;
        for (int i = 0; i < n; i++) cin >> a[i];
        sort(a, a+n, greater<int>() );
        int alice = 0, bob = 0;
        for (int i = 0; i < n; i+=2) alice += a[i];
        for (int i = 1; i < n; i+=2) bob += a[i];
        cout << alice - bob << endl;
        return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
c_lst = [list(map(str, input().split())) for _ in range(h)]

new_lst = []
for i in range(h):
    new_lst.append(c_lst[i])
    new_lst.append(c_lst[i])

for i in range(len(new_lst)):
    new = new_lst[i][0]
    print(new)

Measured memory_bytes: 9156
import sys
#input = sys.stdin.readline
from collections import Counter

def main():
    n =  int(input( ))
    for i in range(1,10):
        for j in range(1,10):
            if n == i * j:
                print('Yes')
                exit()
    else:
        print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

struct UnionFind {
    vector<int> par, rank;

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

    int find(int x) {
        if (par[x] == -1) return x;
        else return par[x] = find(par[x]);
    }

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

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

    vector<int> roots(){
        vector<int> d;
        rep(i,par.size()){
            if(par[i]<0) d.emplace_back(i);
        }
        return d;
    }

    int size(int x){
        return rank[find(x)];
    }

    int count_group(){
        return roots().size();
    }
};

int main(){
    int n,k,l;
    cin >> n >> k >> l;
    UnionFind uf(n);
    UnionFind ufr(n);
    rep(i,k){
        int p,q;
        cin >> p >> q;
        p--; q--;
        uf.merge(p,q);
    }
    rep(i,l){
        int r,s;
        cin >> r >> s;
        r--;
        s--;
        ufr.merge(r,s);
    }
    vector<pair<int,int>> c;
    rep(i,n){
        c.emplace_back(pair<int,int>(uf.find(i),ufr.find(i)));
    }
    map<pair<int,int>,int> count;
    for(auto a: c){
        if(count.count(a)==0){
            count[a] = 1;
        }
        else{
            count[a]++;
        }
    }
    rep(i,n){
        if(i==n-1){
            cout << count[c[i]] << endl;
            return 0;
        }
        cout << count[c[i]] << " ";
    }
}

Measured memory_bytes: 16624
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPR(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=m; i<n; i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

using mint = modint998244353;

struct S{
  mint a;
  int size;
};

struct F{
  mint a,b;
};

S op(S l, S r){
  return S{l.a + r.a, l.size + r.size};
}

S e(){
  return S{0, 0};
}

S mapping(F l, S r){
  return S{r.a * l.a + r.size * l.b , r.size};
}

F composition(F l, F r){
  return F{r.a * l.a, r.b * l.a + l.b};
}

F id(){
  return F{1, 0};
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,q; cin >> n >> q;
  vector<S> a(n);
  REP(i,n){
    int x; cin >> x;
    a[i] = S{x, 1};
  }

  lazy_segtree<S, op, e, F, mapping, composition, id> seg(a);

  while(q--){
    int t; cin >> t;
    if(t==0){
      int l,r,c,d;
      cin >> l >> r >> c >> d;
      seg.apply(l, r, F{c, d});
    }else{
      int l,r; cin >> l >> r;
      cout << seg.prod(l, r).a.val() << '\n';
    }
  }

  return 0;
}


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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int tc = 1;
    // cin >> tc;
    while(tc--) {
        // int n;
        // cin >> n;
        // vector<int> a(n);
        // for(int i=0; i<n; i++) {
        //     cin >> a[i];
        // }
        char a;
        cin >> a;
        if(isupper(a)) cout << 'A' << endl;
        else cout << 'a' << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int INF=INT_MAX,MOD=1e9+7;

int main(){
    int d,w;
    while(cin>>d>>w&&d){
        int e[d][w]; rep(i,d)rep(j,w) cin>>e[i][j];
        int volume=0;

        for(int i=0;i<d-2;i++){
            for(int j=0;j<w-2;j++){
                for(int k=i+2;k<d;k++){
                    for(int l=j+2;l<w;l++){
                        int outmin=INF,inmax=0,edge=0;
                        for(int a=i;a<=k;a++){
                            for(int b=j;b<=l;b++){
                                if(a==i||a==k||b==j||b==l){
                                    outmin=min(outmin,e[a][b]);
                                }
                                else{
                                    inmax=max(inmax,e[a][b]);
                                    //cout<<inmax<<endl;
                                    edge+=e[a][b];
                                }
                            }
                        }
                        //cout<<outmin<<" "<<inmax<<" "<<edge<<endl;
                        if(outmin>inmax){
                            volume=max(volume,outmin*(k-i-1)*(l-j-1)-edge);
                        }
                    }
                }
            }
        }
        cout<<volume<<endl;
    }

    return 0;
}



Measured memory_bytes: 2972