akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
       int a;
       int b;
       int c;
       cin>>a;
       cin>>b;
       cin>>c;
      if(a>b){
          swap(a,b);
      }
       if(b>c){
        swap(b,c);
      }
         if(a>b){
      swap(a,b);
      }  
      cout<<a<<" "<<b<<" "<<c<<endl;
}


Measured memory_bytes: 3084
H = int(input())
W = int(input())
N = int(input())

sum = 0
if H > W :
  sum = int(N / H) + ( 0 if N%H == 0 else 1)
else:
  sum = int(N / W) + ( 0 if N%W == 0 else 1)
  
print(sum)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int n,ans=0;
	cin>>n;
	for(int i=1;i<=1000000;i++){
		for(int j=1;i*j<n;j++){
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    string s; cin>>s;
    ll ans=0;
    rep(i,s.size()){
        ans+=s[i]-'0';
    }
    if(ans%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}













































































Measured memory_bytes: 3720
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    VI a(3);
    REP(i,3) cin >> a[i];
    sort(a.begin(),a.end());
    printf("%d %d %d\n", a[0], a[1], a[2]);
    return 0;
}

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

string s;

int search(char c){
    s[s.size()-1] = c;

    int ans = 0;
    int last = -1;
    for(int i = 0;i < s.size();i++){
        if(s[i] == c){
            ans = max(ans, i-(last+1));
            last = i;
        }
    }

    return ans;
}

int main(){
    cin >> s;
    s.push_back('*');

    int ans = INT_MAX;
    for(int i = 'a';i <= 'z';i++){
        ans = min(ans, search(i));
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)

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

int main() {
    int A[3];
    cin >>A[0]>>A[1]>>A[2];
    sort (A, A+3);
    
    cout <<10*A[2]+A[1]+A[0] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

int main(){
	int N,K;
	cin>>N>>K;
	cout<<(K<=(N+1)/2 ? "YES" : "NO")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<pair<double, double>> vec(N);
    for (int i=0; i<N; i++) {
        double x, y;
        cin >> x >> y;
        vec[i] = make_pair(x, y);
    }

    double sum = 0;
    double count = 0;
    vector<int> permutations(N);
    for (int i=0; i<N; i++) {
        permutations[i] = i;
    }

    do {
        int first_index = permutations[0];
        double x = vec[first_index].first;
        double y = vec[first_index].second;
        for (int i=1; i<N; i++) {
            int index = permutations[i];
            double x2 = vec[index].first;
            double y2 = vec[index].second;
            sum += sqrt(pow(x2 - x, 2.0) + pow(y2 - y, 2.0));
            x = x2;
            y = y2;
        }
        count++;
    } while(next_permutation(permutations.begin(), permutations.end()));

    cout << fixed << setprecision(6)  << sum / count << endl;
    return 0;
}

Measured memory_bytes: 3756
#include <iostream>
#include <algorithm>
#include <vector>
typedef std::vector<int> TList;
TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << " " << *It;
    }
    std::cout << std::endl;
}
void InsertSort(TList& Input)
{
    typedef TList::iterator TIt;
    TList Sorted;
    for(TIt i = Input.begin(); i != Input.end(); ++i){
        TIt l = std::lower_bound(Sorted.begin(), Sorted.end(), *i);
        Sorted.insert(l, *i);
        {
            TList Temp = Sorted;
            Temp.insert(Temp.end(), i+1, Input.end());
            Output(Temp);
        }
    }
    std::swap(Input, Sorted);
}
int main()
{
    TList List = Input();
    InsertSort(List);
}

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

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CRectangleCutting {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int W, H, x, y;
        cin >> W >> H >> x >> y;

        double res = W * H / 2;
        if ((W * H) % 2 != 0) {
            res += 0.5;
        }
        fcout << res << " ";

        if (x * 2 == W && y * 2 == H) {
            cout << 1 << endl;
        } else {
            cout << 0 << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CRectangleCutting solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

    int n; cin >> n;
    Yn(n%findSumOfDigits(n)==0);

    return 0;
}

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

int dfs (const vector<vector<int>> &g, int v) {
    if (g[v].size() == 0) return 0;
    vector<int> dat;
    for (int u : g[v]) dat.push_back(dfs(g, u));
    sort(dat.begin(), dat.end(), greater<int>());
    for (int i = 0; i < dat.size(); i++) dat[i] += i + 1;
    return *max_element(dat.begin(), dat.end());
}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    for (int i = 1; i < n; i++) {
        int p;
        cin >> p;
        g[p - 1].push_back(i);
    }

    cout << dfs(g, 0) << '\n';

    return 0;
}

Measured memory_bytes: 13568
#include<stdio.h>

int main(void){
  int n,m,i,s[1002],d[1002],now;
  
  while(scanf("%d %d",&n,&m),n|m){
    for(i=1;i<=n;i++)scanf("%d",&s[i]);
    for(i=1;i<=m;i++)scanf("%d",&d[i]);

    now=1;
    for(i=1;i<=m+1;i++){
      if(now>=n){
	printf("%d\n",i-1);
	break;
      }
      now+=d[i];
      now+=s[now];
    }
  }


  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <math.h>
using namespace std;

int main()
{
	long long int A, B, N, X;

	cin >> A >> B >> N;

	X = min(N, B-1);

	cout << (A*X/B - A*(X/B));

	return 0;
	
}

Measured memory_bytes: 3588
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 10000)

func readLine() string {
	buf := make([]byte, 0, 10000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

type cost struct {
	a int
	b int
}

type costs []cost

func (p costs) Len() int {
	return len(p)
}

func (p costs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p costs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

func main() {
	ins := readLine()
	n, _ := strconv.Atoi(ins)

	c := make([]cost, n)
	for i := 0; i < n; i++ {
		inabs := strings.Split(readLine(), " ")
		ai, _ := strconv.Atoi(inabs[0])
		bi, _ := strconv.Atoi(inabs[1])
		c[i].a = ai
		c[i].b = bi
	}
	sort.Sort(costs(c))

	var sum int
	for i := range c {
		sum += c[i].a
		if sum > c[i].b {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}


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

int main(){

    long long X;
    cin >> X;

    int ans = 0;
    double asset = 100;
    rep (i, 3761){
        if (asset >= X){
            cout << ans << endl;
            return 0;
        }
        asset = floor(asset * 1.01);
        ans++;
    }

    return 0;
}

Measured memory_bytes: 3636
package main

import (
	"fmt"
	"math"
	"sort"
)

type Ints []int

func (i Ints) Len() int {
	return len(i)
}

func (i Ints) Swap(j, k int) {
	i[j], i[k] = i[k], i[j]
}

func (i Ints) Less(j, k int) bool {
	return i[j] > i[k]
}

func main() {
	var A Ints
	A = make([]int, 3)
	fmt.Scan(&A[0], &A[1], &A[2])

	sort.Sort(A)

	answer := 0.0
	answer += math.Abs(float64(A[0] - A[1]))
	answer += math.Abs(float64(A[1] - A[2]))

	fmt.Println(int(answer))
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s,t;
  vector<string> anss;
  cin>>s>>t;
  REP(i,int(s.length())-int(t.length())+1){
    string ss=s.substr(i,t.length());
    bool flag=true;
    string ans=s;
    REP(j,t.length()){
      if(ss[j]!=t[j] && ss[j]!='?'){
        flag=false;
      }else{
        ans[i+j]=t[j];
      }
    }
    if(flag){
      REP(j,s.length()){
        if(ans[j]=='?'){
          ans[j]='a';
        }
      }
      anss.push_back(ans);
    }
  }
  sort(ALL(anss));
  if(anss.size()==0){
    anss.push_back("UNRESTORABLE");
  }
  cout<<anss[0]<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
	int n;
	cin >>n;
	vector<int> a(n);

	for(int i = 0; i < n; ++i)
		cin >>a[i];
	
	long long sum = 0;
	for(int i = 1; i < n; ++i){
		if(a[i - 1] > a[i]){
			sum += a[i - 1] - a[i];
			a[i] = a[i - 1];
		}
	}
	cout <<sum <<'\n';
	return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  cout << 6 - a - b << endl;
  return 0;
}


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

int main(){
    int n,m;
    scanf(" %d %d",&n,&m);
    string ans = "";
    for(int i = 0; i < n;++i)
        ans +=  '*';
    bool posi = 1;
    while(m--){
        int s,v;
        scanf(" %d %d",&s,&v);
        --s;
        if(ans[s] != '*' && ('0'+v) != ans[s]){
            posi = 0;continue;
        }
        ans[s] = '0' + v;
    }
    if(!posi){puts("-1");return 0;}
    for(int i = 0; i < n;++i){
        if(ans[i] != '*') continue;
        else ans[i] = ((i == 0 && n != 1)? '1':'0');
    }
    if(ans[0] == '0' && n > 1) puts("-1");
    else cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
/* Author: Rennan Rocha
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

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

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll, ll>
#define vpi vector<pi>
#define vpll vector<pll>

#define INF 1e18
#define MOD 1000000007

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
//*find_by_order(); order_of_key();

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

    ll x;
    cin >> x;
    for(ll i = -2000; i <= 2000; i++) {
        for(ll j = -2000; j <= 2000; j++) {
            if(j*j*j*j*j-i*i*i*i*i == x) {
                cout << j << " " << i << "\n";
                return 0;
            }
        }
    }

}


Measured memory_bytes: 3648
#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;
const int INF = 1001001001;
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; }

int main(){
  string s,t;
  cin >> s >> t;
  int n = int(s.size());
  int m = int(t.size());
  vector<vector<int>> dic(26);
  rep(i,n) dic[s[i]-'a'].push_back(i);
  rep(i,n) dic[s[i]-'a'].push_back(i+n);
  ll ans = 0;
  int p = 0;
  rep(i,m){
    int a = t[i] - 'a';
    if(dic[a].size()==0){
      puts("-1");
      return 0;
    }
    p = *lower_bound(dic[a].begin(),dic[a].end(),p) + 1;
    
    if(p>=n){
      p -= n;
      ans += n;
    }
  }
  ans += p;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1724
package main

import "fmt"

func main() {
	var N int

	fmt.Scan(&N)

	answer := int64(0)
	for i := 1; i <= N; i++ {
		if i%3 != 0 && i%5 != 0 {
			answer += int64(i)
		}
	}
	fmt.Println(answer)
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> t(m, vector<int>(n+1));
  vector<int> p(m);
  rep(i, m) {
    cin >> t[i][0];
    rep(j, t[i][0]) {
      cin >> t[i][j+1];
    }
  }
  rep(i, m) cin >> p[i];
  
  int ans = 0;
  rep(b, (1<<n)) {
    vector<int> sn(n, 0);
    bool ON = false;
    rep(i, n) { if (b & (1<<i)) sn[i] = 1; }
    rep(i, m) {
      int sum = 0;
      rep(j, t[i][0]) { sum += sn[t[i][j+1]-1]; }
      if (sum % 2 == p[i]) ON = true;
      else { ON = false; break; }
    }
    if (ON) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#define INF 1000000021
#define MOD 1000000007
#define pb push_back
#define sqr(a) (a)*(a)
#define M(a, b) make_pair(a,b)
#define T(a, b, c) make_pair(a, make_pair(b, c))
#define F first
#define S second
#define all(x) (x.begin(), x.end())
#define deb(x) cerr << #x << " = " << x << '\n'
#define N 222222

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const ld pi = 2 * acos(0.0);
template<class T> bool umin(T& a, T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool umax(T& a, T b){if(a<b){a=b;return 1;}return 0;}
template<class T, class TT> bool pal(T a, TT n){int k=0;for(int i=0;i<=n/2;i++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}

//int month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

int main()
{
	ld n;
	cin >> n;
	ld q = n / 3.;
	ld s = q * q * q;
	cout << setprecision(9) << fixed << s;





	





	getchar();
	getchar();
	return 0;
	//ios::sync_with_stdio(false);
	//cin.tie(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
#define PI 3.141592653589793
using namespace std;


int main()
{
    FAST
    int x,n;cin>>x>>n;
    map<int,int> m;
    f(i,0,n) 
    {
        int t;cin>>t;
        m[t]++;
    }
    int l,r;
    f(i,0,200)
    {
        if(!m[i+x])
        {
            r=i+x;
            break;
        }
    }
    f(i,0,200)
    {
        if(!m[x-i])
        {
            l=x-i;
            break;
        }
    }
    if(x-l<=r-x) cout<<l;
    else cout<<r;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int sum(int i) {
    int ret = i % 10;

    while ((i /= 10) > 0) {
        ret += (i % 10);
    }

    return ret;
}

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

    vector<int> nums;

    for (int i = 1; i <= n; i++) {
        int _sum = sum(i);
        if (a <= _sum && _sum <= b) {
            nums.push_back(i);
        }
    }

    int ans = 0;
    for (auto num : nums) {
        ans += num;
    }

    cout << ans << endl;

    return 0;
}

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

int main() {
  int n,m,c; cin >> n >> m >> c;
  vector<int> B(m);
  rep(i,m)  cin >> B[i];
  int ans = 0;
  
  rep(i,n){
    int sum = c;
    rep(j,m){
      int a; cin >> a;
      sum += a*B[j];
    }
    if(sum > 0) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>

using namespace std;

int main ()
{
  string in;
  cin >> in;

  vector<char> out;

  for(char ch : in) {
    if (ch == '0') out.push_back(ch);
    if (ch == '1') out.push_back(ch);
    if (ch == 'B') {
      if (!out.empty()) out.pop_back();
    }
  }

  for(auto ch : out) {
    printf("%c", ch);
  }

}




Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
pair<string, int>A[101];
signed main() {
  string S; cin>>S;
  int count1=0;
  int count2=0;
  rep(i,S.size()){
    if(i%2==0){
      if(S.at(i)=='0')count1++;
      else count2++;
    }
    else{
      if(S.at(i)=='1')count1++;
      else count2++;
    }
  }
  cout<<min(count1,count2)<<endl;
}

Measured memory_bytes: 3748
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

#define Min(a, b) ((a<b) ? a : b)
#define MOD 1000000007
#define N 200001 //size of array

long fac[N], inv[N], finv[N];

void com_init()
{
  fac[0] = 1;
  fac[1] = 1;
  finv[0] = 1;
  finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < N; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

long combination(int a, int b)
{
  if (a < b)
    return 0;
  if (a < 0 || b < 0)
    return 0;
  return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  long ans = 0;
  int l = Min(n-1, k);
  com_init();
  for (int i=0; i<=l; i++) {
    ans += (combination(n, i) * combination(n-1, i))%MOD;
    ans %= MOD;
  }
  printf("%ld\n", ans);
  return 0;
}


Measured memory_bytes: 4864
(let* ((n (read))
    (a (make-array n))
    (su 0)
    (ar 0)
    (ans 0))

    (dotimes (i n)
        (setf (aref a i) (read))
        (incf ar (aref a i))
    )
    
    (setq su (aref a 0))
    (decf ar (aref a 0))
        (if (> (* su ar) 0)
            (setq ans (abs (- su ar)))
            (setq ans (+ (abs su) (abs ar)))
        )
    (loop for i from 1 to (- n 2) do
        (incf su (aref a i))
        (decf ar (aref a i))
        (if (>= (* su ar) 0)
            (if (> ans (abs (- su ar)))
                (setq ans (abs (- su ar)))
            )
            (if (> ans (+ (abs su) (abs ar)))
                (setq ans (+ (abs su) (abs ar)))
            )
        )

    )
    
    (princ ans)
)

Measured memory_bytes: 78584
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define rev(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = INT_MAX;



int revint(int n) {
    string s = to_string(n);
    rev(s);
    int res = stoi(s);

    return res;
}


int main() {

    int a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; ++i) {
        if (i == revint(i)) {
            ++ans;
        }
    }

    out(ans);

    return 0;
}




//              g++ -std=c++1z






Measured memory_bytes: 384
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
struct UnionFind {
  vector< int > par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

  UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
    for (int i = 0; i < N; i++)
      par[i] = i;
  }

  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x);        // xの根をrx
    int ry = root(y);        // yの根をry
    if (rx == ry)
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    par[rx] =
        ry; // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
  }

  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N, M;
  cin >> N >> M;
  vec< int > p(N);
  REP(i, N) {
    cin >> p[i];
    p[i]--;
  }
  UnionFind tree(N);
  REP(i, M) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    tree.unite(x, y);
  }
  int ans = 0;
  REP(i, N) { ans += tree.same(i, p[i]); }

  print(ans);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
int n;
void dfs(string s,char now)
{
	if(s.size()==n)
	{
		cout<<s<<endl;
		return ;
	}
	for(char i='a';i<now;i++)
		dfs(s+i,now);
	dfs(s+now,now+1);
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n;
	dfs("",'a');
	return 0;
}




Measured memory_bytes: 1536
import fractions
N=int(input())
A=list(map(int, input().split()))
GCD = A[0]
for i in range(1,N):
  GCD = fractions.gcd(GCD,A[i])

count = 0
while True:
  if GCD%2==0:
    count = count + 1
    GCD = GCD / 2
  else:
    break
print(count)

Measured memory_bytes: 5048
#include<bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define lcm( a, b ) ((a)/__gcd(a,b)*(b))
#define MP make_pair
#define pb push_back
#define all(x) (x).begin(),(x).end()

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<int, P> i_P;
typedef pair< LL, LL > L_P;

const int INF = INT_MAX;
const int MIN = INT_MIN;
const LL LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const int SIZE = 100005;

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

    int res = 0;
    for( int i = 0; i < 10; ++i ) {
        int a;
        cin >> a;
        res += a;

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3176
#include <cstdio>

int main() {
  char S[32];
  scanf("%s", S);

  int count['z'+1]={};
  for (int i=0; S[i]; ++i)
    if (count[S[i]]++)
      return !printf("no\n");

  printf("yes\n");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <utility>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;



ll solve(int i, int j, vector <vector<ll>> &dp, vector<int> &a, vector<ll> &sum) {
  if (dp[i][j] != -1) {
    return dp[i][j];
  }
  if (i == j) {
    return dp[i][j] = 0;
  }
  ll cost = 1e15;
  for (int k = i; k < j; k++) {
    cost = min(cost, solve(i, k, dp, a, sum) + solve(k+1, j, dp, a, sum));
  }
  dp[i][j] = cost + sum[j+1] - sum[i];
  return dp[i][j];
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<ll> sum(N+1);
  vector<vector<ll>> dp(N, vector<ll>(N, -1));

  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sum[0] = 0;
  for (int i = 1; i <= N; i++) {
    sum[i] = sum[i-1] + a[i-1];
  }
  // for (int i = 1; i <= N; i++) {
  //   cout << sum[i] << endl;
  // }

  cout << solve(0, N-1, dp, a, sum) << endl;
}


Measured memory_bytes: 1536
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(len(a)):
        ans *= a[i]
        if ans > (1000000000000000000):
            print(-1)
            sys.exit()
    else:
        print(ans)

Measured memory_bytes: 21596
/*
 * Author : Sadi
 * Wed 08/07/2020
 * 15:08:11.42
 */
#include <iostream>
#include <cstdio>
#include <cmath>
#include <climits>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
//const int mx = 1e5 + 5;



int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    int n;
    cin >> n;
    vector<int> A(n + 1), B(n);
    for(int i = 0; i < n + 1; ++i) {
    	cin >> A[i];
    }
    for(int i = 0; i < n; ++i) {
    	cin >> B[i];
    }
    long long ans = 0;
    for(int i = 0; i + 1 <= n; ++i) {
    	if(B[i] <= A[i]) {
    		ans += B[i];
    	}
    	else {
    		ans += A[i];
    		B[i] -= A[i];
    		if(B[i] >= A[i + 1]) {
    			ans += A[i + 1];
    			A[i + 1] = 0;
    		}
    		else {
    			ans += B[i];
    			A[i + 1] -= B[i];
    		}
    	}
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3968
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam))
  #-swank (set-dispatch-macro-character #\# #\> (lambda (s c p) (declare (ignore c p)) (read s nil (values) t))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)
#-swank (disable-debugger) ; for CS Academy

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (a (read))
         (b (read)))
    (println (min (* a n) b))))

#-swank(main)


;; For Test
#+swank
(defun io-equal (in-string out-string &optional (func #'main))
  "Passes IN-STRING to *STANDARD-INPUT*, executes FUNC, and returns true if the
string output to *STANDARD-OUTPUT* is equal to OUT-STRING."
  (labels ((ensure-last-lf (s)
             (if (and (> (length s) 0)
                      (eql (char s (- (length s) 1)) #\Linefeed))
                 s
                 (uiop:strcat s uiop:+lf+))))
    (equal (ensure-last-lf out-string)
           (with-output-to-string (out)
             (let ((*standard-output* out))
               (with-input-from-string (*standard-input* (ensure-last-lf in-string))
                 (funcall func)))))))

#+swank
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

#+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
#+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))

#+swank
(defun run (&optional thing (out *standard-output*))
  (let ((*standard-output* out))
    (etypecase thing
      (null ; Runs #'MAIN with the string on clipboard
       (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
         (main)))
      (string
       (with-input-from-string (*standard-input* (delete #\Return thing))
         (main)))
      (symbol (5am:run! thing))
      (pathname ; Runs #'MAIN with the string in a text file
       (with-open-file (*standard-input* thing)
         (main))))))

#+swank
(defun gen-dat ()
  (uiop:with-output-file (out *dat-pathname* :if-exists :supersede)
    (format out "")))

#+swank
(defun bench (&optional (out (make-broadcast-stream)))
  (time (run *dat-pathname* out)))


Measured memory_bytes: 15208
# coding: utf-8

def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n ** 0.5)+1):
        if n % i == 0:
            return False
    return True

X = int(input())

while True:
    if is_prime(X) == True:
        print(X)
        exit()
    else:
        X += 1

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<queue<int>> vec;
  queue<int> used;
  queue<int> copy;
  vector<bool> isVisited;
  for(int i=0; i<n; i++){
    isVisited.push_back(false);
  }
  for(int i=0; i<n; i++){
    vec.push_back(queue<int>());
    for(int j=0; j<n-1; j++){
      int enemy;
      cin >> enemy;
      vec[i].push(enemy-1);
    }
  }
  
  bool allEmpty = true;
  bool deleteOne = false;
  int count = 0;
  for(int i=0; i<n; i++){
    copy.push(i);
  }
  while(true){
    
    used.swap(copy);
    while (!copy.empty()) copy.pop();
    allEmpty = true;
    deleteOne = false;
  
  	for(int i=0; i<n; i++){
      isVisited[i] = false;
    }
    while(!used.empty()){
      int i = used.front();
      used.pop();
      if(vec[i].empty()) continue;
      if(vec[vec[i].front()].empty()) continue;
      int aite = vec[i].front();
      if(isVisited[i] || isVisited[aite]){
        continue;
      }else if(i == vec[aite].front()){
        vec[i].pop();
        vec[aite].pop();
        isVisited[i] = true;
        isVisited[aite] = true;
        copy.push(i);
        copy.push(aite);
        deleteOne = true;
      }
    }
    
    if(deleteOne == false){
      for(int i=0; i<n; i++){
        if(!vec[i].empty()) allEmpty = false;
      }
      if(allEmpty){
        cout << count << endl;
        return 0;
      }
      cout << -1 << endl;
      return 0;
    }
    
  	count++;
  }
}
      
  
  


Measured memory_bytes: 4736
s = input()
t = input()

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            #print(t[i:k], s[i:], k-i)
        else:
            cnt.append(0)
            #print(t[i:k], k - i)
#print(cnt)
print(len(t) - max(cnt))


Measured memory_bytes: 14324
# ある合宿におやつとしてチョコレートが何個か準備されました。
# 合宿は N 人が参加して D 日間行われました。
# i 人目の参加者 (1≤i≤N) は合宿の 1,Ai+1,2Ai+1,... 日目に
# チョコレートを 1 個ずつ食べました。
# その結果、合宿終了後に残っていたチョコレートは X 個となりました。
# また、合宿の参加者以外がチョコレートを食べることはありませんでした。
# 合宿開始前に準備されていたチョコレートの個数を求めてください。

n = gets.to_i

input_line_2 = gets.chomp.split
d = input_line_2[0].to_i
x = input_line_2[1].to_i

a = Array.new

n.times do
  input_line = gets.to_i
  a << input_line
end

sum = x

n.times do |i|
  the_person_eat = 1
  day = 1

  loop do
    day += a[i]

    if day > d
      break
    else
      the_person_eat += 1
    end
  end

  sum += the_person_eat
end

puts sum


Measured memory_bytes: 1788
type ABC(stream:System.IO.TextReader) =
  member this.Scan2 f1 f2 = stream.ReadLine().Split() |> (fun a -> (f1 a.[0], f2 a.[1]))
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f

let util = ABC(stdin)

let N, X = util.Scan2 int int
let xs = util.ScanVecH int

xs
|> Seq.scan (+) 0
|> Seq.takeWhile (fun n -> n <= X)
|> Seq.length
|> printfn "%d"


Measured memory_bytes: 14172
n, m = map(int, input().split())
A = sorted(map(int, input().split()))
C = []
for _ in range(m):
    b, c = map(int, input().split())
    C += [[-c, b]]
C = sorted(C)
p = 0
for cb in C:
    c, b = -cb[0], cb[1]
    for _ in range(b):
        if (p >= n) | (A[min(p, n-1)] >= c):
            break
        else:
            A[p] = c
            p += 1
print(sum(A))

Measured memory_bytes: 24820
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
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;
}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int calcNumOfCombination(int n, int r){
    int num = 1;
    for(int i = 1; i <= r; i++){
        num = num * (n - i + 1) / i;
    }
    return num;
}

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

    int N, M;
    cin >> N >> M;

    cout << calcNumOfCombination(N, 2) + calcNumOfCombination(M, 2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
	int n;
	scanf("%d", &n);
	if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9) cout << "hon";
	else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) cout << "pon";
	else cout << "bon";
	return 0;
}

Measured memory_bytes: 3168
N=int(input())
s = [input() for _ in range(N)]
for i in range(N):
    s[i] = "".join(sorted(s[i]))
count = {}
for i in range(N):
    if s[i] in count:
        count[s[i]] += 1
    else:
        count[s[i]] = 1
#print(count)
print(sum(count[k] * (count[k] -1) // 2 for k in count))


Measured memory_bytes: 108144
#include <cstdio>

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int y, d, m;
		int ans = 0;
		scanf("%d%d%d", &y, &m, &d);
		ans += 200*((y-1)/3);
		ans += 195*(y-1-(y-1)/3);
		if(y%3 == 0) ans += 20*(m-1);
		else{
			ans += 19*((m-1)/2);
			ans += 20*(m-1-(m-1)/2);
		}
		ans += d-1;
		printf("%d\n", 196470-ans);
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d)
    cout<<"Left"<<endl;
    else if(a+b<c+d)
    cout<<"Right"<<endl;
    else
    cout<<"Balanced"<<endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define pb push_back
#define vi vector<int>
using namespace std;
struct objects{
    int weight,value;
};
ll solve(){
   int n,w;
   cin>>n>>w;
   objects object[n];
   int totalvalue=0;
   for(int i=0;i<n;i++){
       cin>>object[i].weight>>object[i].value;
       totalvalue+=object[i].value;
   }
   ll dp[n+1][totalvalue+1];
    //dp[i][j] denotes the least weight to get a value of
   // j from the first i objects
   dp[0][0]=0;//It takes 0 weight here
   int ans=0;
   for(int i=1;i<=totalvalue;i++){
       dp[0][i]=1e18;
      // Just set it arbitrarily large
       //because it's not possible 
   }
   for(int i=0;i<n;i++){
       for(int j=0;j<=totalvalue;j++){
           if(j>=object[i].value){
                dp[i+1][j]=min(dp[i][j],dp[i][j-object[i].value]+object[i].weight);
                //Either don't choose this object(dp[i][j]) or choose this object
                //The value without it would be j-object[i].value
                //the minimum weight would be the minimum weight needed to
                //get a value of j- object[i].value and add the weight of this object.
           }
           else{
               //If I choose this object the value will go over j
               dp[i+1][j]=dp[i][j];
           }
           if(dp[i+1][j]<=w){//Is it possible to get value of j in less than w weight
               ans=max(ans,j);//Find maximum such j
           }
       }
   }
   return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout<<solve();
}

Measured memory_bytes: 82388
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back 
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
using ll = long long;
using namespace std;


int main() {
    int n, m, ans=0;
    vector<int>erase;
    vector<pair<int, int>>order;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int t, tt;
        cin >> t >> tt;
        order.push_back(make_pair(tt, t));
    }
    sort(order.begin(), order.end());
    for (int i = 0; i < m; i++) {
        if (i == 0) {
            ans++;
            erase.push_back(order[i].first - 1);
        }
        else {
            int count = 0;
            for (int j = 0; j < erase.size(); j++) {
                if (!(erase[j] < order[i].first && erase[j] >= order[i].second))count++;
            }
            if (count == erase.size()) {
                ans++;
                erase.push_back(order[i].first - 1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1400
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, R = getlist()
	if N >= 10:
		print(R)
	else:
		print(R + (10 - N) * 100)
	


if __name__ == '__main__':
	main()

Measured memory_bytes: 3316
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>

using namespace std;  //このネームスペースを使う

int main(){
  int A;
  cin >> A ;
  
  if(A < 1200){
  	cout << "ABC" << endl;
  }
  else if(A < 2800){
  	cout << "ARC" << endl;
  }
  else{
  	cout << "AGC" << endl;
  }

  
  return 0;
}



Measured memory_bytes: 256
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 INT_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 INT_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<int>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
 
int main()
{
	
	int n,i,ans=0;

	string s;

	cin>>n>>s;

	for(i=0;i<n;++i)
	{
		if(s[i]=='A' && i<(n-2))
		{
			if(s[i+1]=='B' && s[i+2]=='C')
				++ans;
		}
	}

	cout<<ans<<"\n";

	return 0;
}

Measured memory_bytes: 256