akhauriyash/Code-Regression huggingface dataset:
package main

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

type Alds16b struct {
	scanner  *bufio.Scanner
	f        func(a ...interface{}) (n int, err error)
	A        []int
	sentinel int
}

func main() {
	a := NewAlds16b()
	a.main()
}

func NewAlds16b() *Alds16b {
	a := &Alds16b{}
	return a
}

func (a *Alds16b) main() {
	scanner := bufio.NewScanner(os.Stdin)
	a.handle(scanner, fmt.Print)
}

func (a *Alds16b) handle(scanner *bufio.Scanner, f func(a ...interface{}) (n int, err error)) {

	a.scanner = scanner
	a.f = f

	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	a.A = make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		a.A[i], _ = strconv.Atoi(scanner.Text())
	}

	a.solve()

	pr := func(i int, sp string) {
		if i == a.sentinel {
			f(fmt.Sprintf("%s[%d]", sp, a.A[i]))
		} else {
			f(fmt.Sprintf("%s%d", sp, a.A[i]))
		}
	}
	i := 0
	pr(0, "")
	i++
	for i < n {
		pr(i, " ")
		i++
	}
	f("\n")
}

func (a *Alds16b) solve() {
	i, j, l := 0, 0, len(a.A)
	for j < l {
		if a.A[j] <= a.A[l-1] {
			a.A[i], a.A[j] = a.A[j], a.A[i]
			i++
		}
		j++
	}
	a.sentinel = i - 1
}



Measured memory_bytes: 5924
#ABC 80, C - March
from itertools import combinations
from collections import Counter

n = int(input())
S = [s[0] for s in [input() for i in range(n)]]


C = Counter(S)
total = 0
for comb in combinations('MARCH', 3):
    total += C[comb[0]] * C[comb[1]] * C[comb[2]]
print(total)


Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
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> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }

int main() {
  int h,a; cin >>h >>a;
  cout <<(h+a-1) / a <<endl;
}

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

#define rep(i, n) for(int i = 0; i < n; ++i)
typedef long long ll;
using namespace std;

int main() {
    int a, b, c, d, n;
    cin >> n >> a >> b >> c >> d;
    a--;
    b--;
    c--;
    d--;
    string s;
    cin >> s;
    if(d > c){
        for (int i = b; i < d; ++i) {
            if(i == b) continue;
            if(s[i - 1] == '#' && s[i] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        for (int i = a; i < c; ++i) {
            if(i == a) continue;
            if(s[i - 1] == '#' && s[i] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }

    else{
        int f = 0;
        for (int i = b; i < d; ++i) {
            if(i == b) continue;
            if(i > a - 2){
                if(s[i - 2] == '.' && s[i - 1] == '.' && s[i] == '.'){
                    f = 1;
                }
            }
            if(s[i - 1] == '#' && s[i] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        if(s[d - 2] == '.' && s[d - 1] == '.' && s[d] == '.') f = 1;
        if(f == 0) s[d] = '#';
        for (int i = a; i < c; ++i) {
            if(i == a) continue;
            if(s[i - 1] == '#' && s[i] == '#'){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
    }

}

Measured memory_bytes: 640
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] k = new int[n];
        int[][]a = new int[n][m];
        for(int i=0; i<n; i++){
            for(int j=0; j<m; j++){
                a[i][j] = 0;
            }
        }
        int like = 0;
        for(int i=0; i<n; i++){
            k[i] = sc.nextInt();
            for(int j=0; j<k[i]; j++){
                like = sc.nextInt();
                a[i][like-1] = 1;
            }
        }
        int counter = 0;
        for(int j=0; j<m; j++){
            for(int i=0; i<n; i++){
                if(a[i][j] == 0){
                    break;
                }
                else if(i == n-1){
                    counter += 1;
                }
            }
        }
        System.out.println(counter);
    }
}

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

typedef long long ll;

ll r, D, x0;

int main()
{
    cin >> r >> D >> x0;
    for (int i = 1; i <= 10; i++) {
        ll x = r * x0 - D;
        cout << x << endl;
        x0 = x;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main() {
	vector<int> A(3);
	cin >> A[0] >> A[1] >> A[2];
	cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
	return 0;
}

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

using namespace std;
template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}

using ll = long long int;

int main(void) {
  vector<int> v(5);
  for(int i=0; i<5; i++)
    cin>>v[i];
  int k;
  cin>>k;
  for(int i=0; i<5; i++) {
    for(int j=i+1; j<5; j++) {
      if(abs(v[i]-v[j])>k) {
	cout<<":("<<endl;
	return 0;
      }
    }
  }
  std::cout << "Yay!" << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <memory>
#include <initializer_list>
#include <iomanip>
#include <stack>
#include <bitset>
#include <cstdio>
//#include <complex>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
const ll INF = 1e9;
//const ll MOD = 1e9 + 7;
//const double EPS = 1e-9;
//const double PI = acos(-1);
 
void solve() {
    int a, b;
    cin >> a >> b;
    int k = abs(a - b);
    if (k % 2 == 1)
        cout << "IMPOSSIBLE";
    else 
        cout << min(a, b) + k / 2;   
}   
 
 
int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout); 
    solve();
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
	long long int ans = 1,N =0;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++)
	{
		ans = ans * i;
		if (ans > (1000000000 + 7)*(1000000000 + 7))
		{
			ans %= (1000000000 + 7);
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#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()); }
int ABS(int a) {if(a<0) a = -a; return a;}
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 /= 2; }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;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/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;}
//----------------ライブラリとか----------------

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

    int a,b,k; cin >> a >> b >> k;
    set<int> st;
    FOR(i,a,a+k){if(i>b) break; st.insert(i);}
    for(int i=b; i>b-k; i--){if(i<a) break; st.insert(i);}
    for(auto x:st) out(x);

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  map<int, int> op, ep;
  for (int i = 0; i < n / 2; i++) {
    int v, w;
    cin >> v >> w;
    op[v]++;
    ep[w]++;
  }

  int op1 = 0;
  int mxop1 = 0, mxop2 = 0;
  int ep1 = 0;
  int mxep1 = 0, mxep2 = 0;

  for (auto oq : op) {
    if (oq.second >= mxop1) {
      op1 = oq.first;
      mxop1 = oq.second;
    }
  }

  for (auto oq : op) {
    if (oq.first != op1 && oq.second >= mxop2) {
      mxop2 = oq.second;
    }
  }

  for (auto eq : ep) {
    if (eq.second >= mxep1) {
      ep1 = eq.first;
      mxep1 = eq.second;
    }
  }

  for (auto eq : ep) {
    if (eq.first != ep1 && eq.second >= mxep2) {
      mxep2 = eq.second;
    }
  }

  int ans;
  if (op1 != ep1) {
    ans = n - (mxop1 + mxep1);
  } else {
    ans = n - max(mxop1 + mxep2, mxop2 + mxep1);
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 8240
#include <stdio.h>

struct DICE{      // struct
    int ue;
    int temae;
    int migi;
    int hidari;
    int oku;
    int shita;
};

void fancDice(char *direct, struct DICE *diceStr) {     // original_function
    int temp;
    switch (*direct) {
        case 'E':
            temp = diceStr->ue;
            diceStr->ue = diceStr->hidari;
            diceStr->hidari = diceStr->shita;
            diceStr->shita = diceStr->migi;
            diceStr->migi = temp;
            return;
        case 'S':
            temp = diceStr->ue;
            diceStr->ue = diceStr->oku;
            diceStr->oku = diceStr->shita;
            diceStr->shita = diceStr->temae;
            diceStr->temae = temp;
            return;
        case 'W':
            temp = diceStr->ue;
            diceStr->ue = diceStr->migi;
            diceStr->migi = diceStr->shita;
            diceStr->shita = diceStr->hidari;
            diceStr->hidari = temp;
            return;
        case 'N':
            temp = diceStr->ue;
            diceStr->ue = diceStr->temae;
            diceStr->temae = diceStr->shita;
            diceStr->shita = diceStr->oku;
            diceStr->oku = temp;
            return;
    }
    return;
}

int main() {    // main
    int num[6], q, top, fro, cou = 0;
    char *directStr;
    
    struct DICE diceStr;
    scanf("%d", &diceStr.ue);
    scanf("%d", &diceStr.temae);
    scanf("%d", &diceStr.migi);
    scanf("%d", &diceStr.hidari);
    scanf("%d", &diceStr.oku);
    scanf("%d", &diceStr.shita);
    
    scanf("%d", &q);    // question number
    
    for (int i=0; i<q; i++) {
        scanf("%d %d", &top, &fro);     // top front
        cou = 0;
        
        while (1) {
            if ((top == diceStr.ue) && (fro == diceStr.temae)) {
                printf("%d\n", diceStr.migi);
                break;
            } else if (top == diceStr.ue) {
                directStr = "WSE";
            } else if (fro == diceStr.temae) {
                directStr = "W";
            } else {
                if (cou % 2 == 0) {
                    directStr = "W";
                } else {
                    directStr = "S";
                }
                cou++;
            }
            for (int j=0; directStr[j]!='\0'; j++) {
                fancDice(&directStr[j], &diceStr);
            }
        }
    }
    return 0;
}



Measured memory_bytes: 2148
#include<iostream>
#include<vector>
#include<climits>
#include<algorithm>
using namespace std;

int main()
{
    int n, m;
    while(cin>>n>>m, n|m) {
        vector<long long int> c(m), x(n);
        for(int i=0; i<m; i++) cin>>c[i];
        for(int i=0; i<n; i++) cin>>x[i];
        vector< vector<long long int> > dp(n+1, vector<long long int>(255+1, LONG_LONG_MAX/2));
        dp[0][128] = 0;
        for(int i=0; i<n; i++) {
            for(int j=0; j<=255; j++) {
                for(int k=0; k<m; k++) {
                    int l = j+c[k];
                    if(l < 0) l = 0;
                    if(255 < l) l = 255;
                    dp[i+1][l] = min(dp[i+1][l], dp[i][j]+(x[i]-l)*(x[i]-l));
                }
            }
        }
        cout<<*(min_element(dp[n].begin(), dp[n].end()))<<endl;
    }
}

Measured memory_bytes: 41992
import math

def dist(z,p):
    sigma=0
    for i in range(0,len(z)):
        sigma += z[i]**p
    print(sigma**(1/p))


n=int(input())
x=list(map(float,input().split()))
y=list(map(float,input().split()))
z=[abs(x[i]-y[i]) for i in range(0,n)]
dist(z,1)
dist(z,2)
dist(z,3)
print(max(z))


Measured memory_bytes: 5720
from collections import defaultdict
h, w = map(int, raw_input().split())
a = [raw_input().strip() for _ in xrange(h)]
d = defaultdict(int)
for r in a:
    for c in r:
        d[c] += 1
c = [0] * 4
for x in d.values():
    c[x%4] += 1
if c[1] + c[3] > 1 or c[1] + c[3] != h * w % 2:
    print "No"
    quit()
k = 0
if h * w % 2:
    if c[1]:
        c[0] += 1
    elif c[3]:
        c[2] += 1
    k = h + w - 2
elif h % 2:
    k = w
elif w % 2:
    k = h
print "Yes" if c[2] <= k / 2 else "No"

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


int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    rep(i,n){
        cout << s[i] << t[i];
    }
}

Measured memory_bytes: 256
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int n,E,T;
ll x[MAXN];
ll dp[MAXN+1]; // dp[i]=minimum time to have collected all coins for i bears and be at the last of them (x[i-1]) (and not haven given any candy to other bears)
// dp[i]=min(x[j]-x[j-1]+min(dp[j]+max(2*(x[i-1]-x[j]),T)+x[i-1]-x[j],j=0..i-1)
// dp[i]=min(3*x[i-1]+min(dp[j]-2*x[j]-x[j-1],j=0..jwait-1),x[i-1]+min(dp[j]+T-x[j-1],j=jwait..i-1))
// dp[i+1]=min(3*x[i]+min(dp[j]-2*x[j]-x[j-1],j=0..jwait-1),x[i]+min(dp[j]+T-x[j-1],j=jwait..i))
ll mna[MAXN+1]; // mna[i]=min(dp[j]-2*x[j]-x[j-1],j=0..i-1)
// mna[i+1]=min(mna[i],dp[i]-2*x[i]-x[i-1])



void run() {
	scanf("%d%d%d",&n,&E,&T); REP(i,n) scanf("%lld",&x[i]);
	dp[0]=0; mna[0]=LLONG_MAX; int jwait=0;
	REP(i,n) {
		while(2*(x[i]-x[jwait])>T) ++jwait;
		ll a=mna[jwait]==LLONG_MAX?LLONG_MAX:3*x[i]+mna[jwait];
		ll b=x[i]+dp[jwait]+T-(jwait==0?0:x[jwait-1]);
		dp[i+1]=min(a,b);
		mna[i+1]=min(mna[i],dp[i]-2*x[i]-(i==0?0:x[i-1]));
		//printf("dp[%d]=%lld, mna[%d]=%lld [%lld vs %lld]\n",i+1,dp[i+1],i+1,mna[i+1],a,b);
	}
	ll ret=dp[n]+E-x[n-1]; printf("%lld\n",ret);
}

int main() {
	run();
	return 0;
}


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

def solve():
    N = int(input())
    As = list(map(int, input().split()))

    Ldic = {}
    for i, a in enumerate(As):
        if not (a+i) in Ldic:
            Ldic[a+i] = 0
        Ldic[a+i] += 1

    ans = 0
    for j, a in enumerate(As):
        if j-a in Ldic:
            ans += Ldic[j-a]

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 40456
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

#define POS(x) cout<<((x)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define Pos(x) cout<<((x)?"Possible":"Impossible")<<endl;
#define YES(x) cout<<((x)?"YES":"NO")<<endl;
#define Yes(x) cout<<((x)?"Yes":"No")<<endl;
#define yes(x) cout<<((x)?"yes":"no")<<endl;


int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int a,b;
  cin >> a >> b;
  Pos(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
signed main(){
	int a,b,c,d;
	cin>>a>>b;
	cin>>c>>d;
	cout<<(a-c)*(b-d)<<endl;
}


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

using namespace std;

typedef long long ll;

ll gcd(ll x, ll y) {
  if (x<y) swap(x,y);
  if (y==0) return x;
  return gcd(x%y, y);
}
ll lcm(ll x, ll y) {
  return x*(y/gcd(x,y));
}

int main() {
  ll a,b,c,d; cin>>a>>b>>c>>d;
  ll ans = b-a+1;
  ans -= (b/c - (a-1)/c);
  ans -= (b/d - (a-1)/d);
  ll x = lcm(c,d);
  ans += (b/x - (a-1)/x);
  cout<<ans<<endl;
}


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

int main(){
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    int tmp = 0;
    int num[3] = {0,0,0};
    while(num[tmp] < s[tmp].size()){
        num[tmp]++;
        tmp = s[tmp][num[tmp] - 1] - 'a';
    }
    cout << char('A' + tmp) << endl;
}

Measured memory_bytes: 3624
n,h=map(int,input().split())
ab=[]
for i in range(n):
	x,y=map(int,input().split())
	ab.append([x,y])
x=ab[0][0]
for i in range(n):
	x=max(x,ab[i][0])
ab.sort(key=lambda x:-x[1])
k=n
for i in range(n):
	if x>=ab[i][1]:
		k=i
		break
ans=0
ab.sort(key=lambda x:-x[1])
for i in range(k):
	h-=ab[i][1]
	ans+=1
	if h<=0:
		print(ans)
		exit()
import math
ab.sort(key=lambda x:-x[0])
ans+=math.ceil(h/ab[0][0])
print(ans)


Measured memory_bytes: 24268
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long
#define MOD 998244353
#define MAXN  100005
#define P pair<int,int>

char f[10][10];
int dh[2] = {0,-1},dw[2] = {-1,0};
signed main(){
	
	int n,a,b;cin>>n>>a>>b;
	if(a>b)
	{
		cout << 0 << endl;
		return 0;
	}
	
	if(n == 1)
	{
		if(a == b) cout << 1 << endl;
		else cout << 0 << endl;
		return 0;
	}
	
	int minn = a*(n-1) + b;
	int maxn = a + b * (n-1);
	
	cout << maxn - minn + 1 << endl;
	
	
}

//cout << ans << endl;

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

typedef long long ll;

const int Maxn = 2005;
const int mod = 998244353;

int C[Maxn][Maxn];
string s;
int dp[Maxn][Maxn];
int res;

int main()
{
    for (int i = 0; i < Maxn; i++) {
        C[i][0] = C[i][i] = 1;
        for (int j = 1; j < i; j++)
            C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
    }
    cin >> s;
    dp[0][0] = 1;
    for (int i = 0; i < s.length(); i++)
        for (int j = 0; j <= i; j++) if (dp[i][j]) {
            int blue = j, red = i - j;
            if (s[i] == '0') red += 2;
            else if (s[i] == '1') red++, blue++;
            else blue += 2;
            if (red > 0) dp[i + 1][blue] = (dp[i + 1][blue] + dp[i][j]) % mod;
            if (blue > 0) dp[i + 1][blue - 1] = (dp[i + 1][blue - 1] + dp[i][j]) % mod;
        }
    for (int j = 0; j <= s.length(); j++)
        res = (res + ll(dp[s.length()][j]) * C[s.length()][j]) % mod;
    printf("%d\n", res);
    return 0;
}


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

using namespace std;
const int maxn = 1e5+7;
typedef long long ll;

int main()
{
	int a,b;
	cin>>a>>b;
	int i;
	for(i=0;i<=20;i++){
		int ans=i*a-i+1;
		if(ans>=b){
			break;
		}
		
	}cout<<i<<endl;
}


Measured memory_bytes: 256
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: i,j,n
    integer(int64):: ans
    character(10),allocatable:: s(:)
    character(1):: tmp
    logical:: ok

    read*, n
    allocate(s(n))
    do i=1,n
        read*, s(i)
    end do

    do i=1,n
        ok=.false.
        do while(.not. ok)
            ok = .true.
            do j=1,9
                if (s(i)(j:j) > s(i)(j+1:j+1)) then
                    ok = .false.
                    tmp = s(i)(j:j)
                    s(i)(j:j) = s(i)(j+1:j+1)
                    s(i)(j+1:j+1) = tmp
                end if
            end do
        end do
    end do

    call char_sort(s,1,n)
    j=1
    ans=0
    do i=1,n-1
        if (s(i) == s(i+1)) then
            ans=ans+j
            j=j+1
        else
            j=1
        end if
    end do

    print'(i0)', ans
contains
    recursive subroutine char_sort(c,fst,lst)
        integer(int32),intent(in):: fst, lst
        character(*),intent(inout):: c(:)
        integer(int32):: mdl

        if (lst-fst < 2)then
            if (c(fst) > c(lst)) call cswap(c(fst),c(lst))
            return
        end if

        mdl = (fst+lst)/2
        call char_sort(c,fst,mdl)
        call char_sort(c,mdl+1,lst)
        call char_merge(c,fst,mdl,lst)
    end subroutine

    subroutine char_merge(c,fst,mdl,lst)
        integer(int32),intent(in):: fst,mdl,lst
        character(*),intent(inout):: c(:)
        character(10),allocatable:: tmp(:)
        integer(int32):: l,r,ti

        allocate(tmp(lst-fst+1))
        l=fst
        r=mdl+1
        ti=1

        do while(l <= mdl .and. r <= lst)
            if (c(l) <= c(r)) then
                tmp(ti) = c(l)
                l=l+1
            else
                tmp(ti) = c(r)
                r=r+1
            end if
            ti=ti+1
        end do

        if (l <= mdl) then
            tmp(ti:) = c(l:mdl)
        else
            tmp(ti:) = c(r:lst)
        end if

        c(fst:lst) = tmp(:)
        deallocate(tmp)
    end subroutine

    subroutine cswap(c1,c2)
        character(*):: c1,c2
        character(10),allocatable:: tmp

        tmp = c1
        c1 = c2
        c2 = tmp
    end subroutine
end program name

Measured memory_bytes: 2716
M,D=map(int,input().split())
ans=0
for i in range(11,D+1):
  a,b=0,0
  if i%10>=2:
    a=i%10
  if i//10>=2:
    b=i//10
  if 4<=a*b<=M:
    ans+=1
print(ans)


Measured memory_bytes: 9124
import numpy as np
import itertools as ittr

def test_switch(e_balls, sw, p):
    for i, e_ball in enumerate(e_balls):
        n_on = np.sum(sw[e_ball - 1])
        
        if p[i] != (n_on % 2):
            return False
    
    return True

N, M = map(int, input().split())

e_balls = []

for m in range(M):
    e_balls.append(np.asarray([int(si) for si in input().split()[1:]]))

p = [int(pi) for pi in input().split()]

cnt = 0

for sw in ittr.product([0, 1], repeat = N):
    if test_switch(e_balls, np.array(sw), p):
        cnt += 1

print(cnt)

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

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

    ll ans = 0;
    for(ll k=0; k<29; k++){
        ll T  = ((ll)1 << k);
        vector<ll> bb(N);
        for(int i=0; i<N; i++){
            bb[i] = b[i]%(2*T);
        }
        sort(bb.begin(), bb.end());

        ll cnt = 0;
        for(int i=0; i<N; i++){
            ll aa = a[i]%(2*T);
            cnt += lower_bound(bb.begin(), bb.end(), 2*T-aa) - lower_bound(bb.begin(), bb.end(), T-aa);
            cnt += lower_bound(bb.begin(), bb.end(), 4*T-aa) - lower_bound(bb.begin(), bb.end(), 3*T-aa);
        }
        if(cnt%2==1) ans+=T;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#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, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<string> s(N);
    vector<int> t(N);
    REP(i, N) { cin >> s.at(i) >> t.at(i); }
    string X;
    cin >> X;
    bool flag = false;
    int ans = 0;
    REP(i, N) {
        if (flag) {
            ans += t[i];
        } else {
            if (X == s[i]) {
                flag = true;
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

long long gcd(long long a, long long b) {
	if (a == 0 || b == 0) {
		return a + b;
	}
	if (a > b) {
		return gcd(a % b, b);
	}
	return gcd(a, b % a);
}

pair<long long, long long> parse(string s) {
	int ps = -1;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] == '.') {
			ps = i;
		}
	}
	if (ps == -1) {
		s += '.';
		ps = s.length() - 1;
	}

	int len = (int)(s.length()) - ps - 1;
	while (len < 9) {
		s += '0';
		++len;
	}

	long long val1 = 0;
	for (int i = 0; i < s.length(); ++i) {
		if (s[i] != '.') {
			val1 *= 10;
			val1 += s[i] - '0';
		}
	}
	long long val2 = 1000000000;

	long long d = gcd(val1, val2);
	val1 /= d;
	val2 /= d;
	return make_pair(val1, val2);
}

void solve() {
	int n;
	cin >> n;
	vector<pair<long long, long long> > v;

	int num = 1e9;

	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;

		v.push_back(parse(s));
	}

	vector<int> tot;
	for (int i = 1; i * i <= num; ++i) {
		if (num % i == 0) {
			tot.push_back(i);
			tot.push_back(num / i);
		}
	}

	vector<vector<int> > cmp(n, vector<int>(tot.size(), 0));
	vector<vector<int> > totals(tot.size());

	for (int i = 0; i < v.size(); ++i) {
		long long p = v[i].first;
		for (int j = 0; j < tot.size(); ++j) {
			if (p % tot[j] == 0) {
				++cmp[i][j];
			}
			if (v[i].second == tot[j]) {
				totals[j].push_back(i);
			}
		}
	}

	vector<vector<int> > res(tot.size(), vector<int>(tot.size(), 0));

	for (int i = 0; i < totals.size(); ++i) {
		vector<int> curcnt(tot.size(), 0);
		for (int j = 0; j < totals[i].size(); ++j) {
			int v = totals[i][j];
			for (int k = 0; k < tot.size(); ++k) {
				//if (k != i) {
					res[i][k] += cmp[v][k];
				//}
			}
		}
	}

	long long ans = 0;
	for (int i = 0; i < v.size(); ++i) {
		int idx = -1;
		for (int j = 0; j < tot.size(); ++j) {
			if (tot[j] == v[i].second) {
				idx = j;
			}
		}
		for (int j = 0; j < tot.size(); ++j) {
			if (cmp[i][j]) {
				if (idx == 0 && j == 0) {
					ans += res[j][idx] - 1;
				} else {
					ans += res[j][idx];
				}
			}
		}
	}
	cout << ans / 2 << endl;

	/*int res2 = 0;
	for (int i = 0; i < v.size(); ++i) {
		for (int j = i + 1; j < v.size(); ++j) {
			if (v[i].first % v[j].second == 0 && v[j].first % v[i].second == 0) {
				++res2;
			}
		}
	}
	cout << res2 << endl;*/
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(false);

	int t;
	//cin >> t;
	t = 1;

	for (int tt = 0; tt < t; ++tt) {
		solve();
	}


	return 0;
}

Measured memory_bytes: 93988
#include <iostream>

using namespace std;

int main()
{
    int N, x;
    cin >> N;
    int sum = 0;
    int ssum = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> x;
        sum += x;
        ssum += x * x;
    }
    double P = (double) sum / N;
    int low = (int)P;
    int high = low + 1;
    cout << min(N * low * low - 2 * low * sum, N * high * high - 2 * high * sum) + ssum << endl;
}


Measured memory_bytes: 256
s = input()
k = int(input())

def string_changer(letter):
  ans = 0
  count = 0
  content = letter[0]
  for i in range(1, len(letter)):
    if letter[i] == content:
      count += 1
    else:
      ans += (count+1) // 2
      count = 0
      content = letter[i]
  ans += (count+1) // 2
  return ans

all_same = True
first_letter = s[0]
for i in range(1, len(s)-1):
  if s[i] != s[0]:
    all_same = False
    break
  else:
    pass

if all_same == True:
  ans = len(s)*k // 2
elif s[0] == s[len(s)-1] and k > 1:
  connected_s = s+s
  connection = string_changer(connected_s)
  if connection == string_changer(s)*2:
    ans = string_changer(s) * k
  else:
    ans = string_changer(s)*k + k-1
else:
  ans = string_changer(s) * k
print(ans)

Measured memory_bytes: 3064
from collections import deque
from itertools import accumulate
import sys
sys.setrecursionlimit(10**6)
mo=10**9+7

#n=int(input())  
#n,l=map(int,input().split())
#a=[int(i) for i in input().split()]
#a=[l+i-1 for i in range(1,n+1)]
s=input()
ans='Good'
pre=None
for i in s:
    if pre!=None:
        if pre==i:
            ans='Bad'
        pre=i
    else:
        pre=i
print(ans)


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

int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  int ans = 0;
  rep(i, 10)rep(j, 10)rep(k, 10){
    int idx = 0;
    rep(l, n){
      int cy[3] = { i, j, k };
      if ((s[l]-'0') == cy[idx]) idx++;
      if (idx == 3){
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N, K = LI()
    h_li = [0] + LI()
    min_cost_li = [INF for _ in range(N+1)]
    min_cost_li[1] = 0

    for i in range(1,N+1):  # 10**5
        for j in range(1, K+1): # 10**2
            if i+j > N: continue
            min_cost_li[i+j] = min(min_cost_li[i+j], min_cost_li[i] + abs(h_li[i] - h_li[i+j]))

    print(min_cost_li[N])


main()

Measured memory_bytes: 59280
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    
    vec<int> A(N);
    vec<vec<pair<int,int>>> W(N);

    rep(i,N){
        cin >> A[i];
        rep(j,A[i]){
            int x,y;
            cin >> x >> y;
            --x;
            W[i].push_back({x,y});
        }
    }

    int ans = 0;
    for(int i=0;i<(1<<N);++i){
        bool right = true;
        int count = 0;
        for(int j=0;j<N;++j){
            if(i&(1<<j)){
                ++count;
                for(auto [f,s]:W[j]){
                    if(s==0 && i&(1<<f)) right = false;
                    if(s==1 && !(i&(1<<f))) right = false;
                }
            }
        }
        if(right) ans = max(ans,count);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3632
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = sc.nextLong();
		long x = sc.nextLong();
		long sum = (b/x + 1);
		if(a!=0)sum -=(a - 1)/x + 1;
		System.out.println(sum);
	}
}

Measured memory_bytes: 23764
N,H,D=map(int,input().split())
mod=10**9+7

const=0
frac=[1]
for i in range(1,N+1):
    frac.append((frac[-1]*i)%mod)
    const=(const+frac[-1])%mod

dp=[0]*(H+1)
dp[0]=1
dp[1]=frac[-1]

S=dp[1]
for i in range(2,D+1):
    dp[i]=const*S+frac[-1]
    dp[i]%=mod
    S=(S+dp[i])%mod

S=sum(dp[i] for i in range(1,D+1))
S%=mod

for i in range(D+1,H+1):
    dp[i]=const*S
    dp[i]%=mod
    S=(S+dp[i]-dp[i-D])%mod

print(dp[H])


Measured memory_bytes: 156856
#include <iostream>
using namespace std;
#define MOD 1000000007
int main(){
    int a, b, key;
    char tar;
    cin>>a>>b;
    int dp[a][b];
    for (int i=0; i<a; i++){
        for (int j=0; j<b; j++){
            cin>>tar;
            if (tar=='#') dp[i][j]=0;
            else dp[i][j]=-1;
        }
    }
    key=0;
    for (int i=0; i<b; i++){
        if (dp[0][i]!=0 && key==0) dp[0][i]=1;
        else dp[0][i]=0, key=1;
    }
    key=0;
    for (int i=0; i<a; i++){
        if (dp[i][0]!=0 && key==0) dp[i][0]=1;
        else dp[i][0]=0, key=1;
    }
    for (int i=1; i<a; i++){
        for (int j=1; j<b; j++){
            if (dp[i][j]==0) continue;
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
        }
    }
    if (dp[a-1][b-1]==-1) cout<<0<<endl;
    else cout<<dp[a-1][b-1];
}

Measured memory_bytes: 4096
MOD = 10**9 + 7
N = int(input())

modsum = 0
A = list(map(int, input().split()))
for a in A:
    modsum = (modsum + a) % MOD

count = 0
for a in A[:-1]:
    modsum -= a
    while modsum < 0:
        modsum = MOD + modsum
    count = (count + (modsum * a) % MOD) % MOD
print(count)

Measured memory_bytes: 105348
n = gets.to_i
h = gets.chomp.split
n.times do |i|
    h[i] = h[i].to_i
end

result = true
max = h[0]
(n-1).times do |i|
    if h[i+1] > max
        h[i+1] -= 1
        max = h[i+1]
    elsif h[i+1] < max
        result = false
        break
    end
end

puts result ? "Yes" : "No"

Measured memory_bytes: 8836
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

vector<int> v[100100];
priority_queue<int> pq;

int main(void){
	int n,m,a,b,i,j,ans=0;
	cin >> n >> m;
	for(i=0; i<n; ++i){
		cin >> a >> b; --a;
		v[a].push_back(b);
	}
	for(i=0; i<m; ++i){
		for(j=0; j<v[i].l_ength(); ++j){
			pq.push(v[i][j]);
		}
		if(!pq.empty()){
			ans += pq.top();
			pq.pop();
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 5632
#include<iostream>
#include<algorithm>
#include<vector>

int perfect_power(int n){
    std::vector<int> v;
    v.push_back(1);
    for(long long i = 2 ; i * i <= n ; ++i){
        long long j = i * i;
        v.push_back(j);
        while(j * i <= n){
            v.push_back(j * i);
            j *= i;
        }
    }
    return *std::max_element(v.begin(),v.end());

}

int main(){

    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);

    int n;
    std::cin >> n;

    std::cout << perfect_power(n);

    return 0;

}

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

int main(){
  int N,K;
  cin >> N >> K;
  
  vector<int> d(K);
  vector<vector<int>> A(K, vector<int>(N, 109));
  
  for(int i=0; i<K; i++){
    cin >> d[i];
    for(int j=0; j<d[i]; j++){
      cin >> A[i][j];
      A[i][j]--;
      // cout << A[i][j] << endl;
    }
  }
  
 
  
  vector<int> sunuke(N, 0);
  
  for(int i=0; i<K; i++){
    for(int j=0; j<d[i]; j++){
      sunuke[A[i][j]]++;
    }
  }
  
  int treated = 0;
  
  for(int i=0; i<N; i++){
    // cout << sunuke[i] << endl;
    treated += (sunuke[i]==0);
  }
  
   cout << treated << endl;
}
    


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

int n, m, r;
vector<int> t1[114514], t2[114514], t3(114514);

void bfs(int s) {
	queue<pair<int, int> > q;
	vector<int> d(114514, -1), v(114514, 0);
	q.push(make_pair(s, 0));
	
	t3[s] = -1;
	d[s] = 0;
	
	while (!q.empty()) {
		pair<int, int> p = q.front(); q.pop();
		
		for (int i = 0; i < t2[p.first].size(); i++) {
			bool flag = true;
			
			v[t2[p.first][i]]++;
			
			/*for (int j = 0; j < t1[t2[p.first][i]].size(); j++) {
				//cout << t2[p.first][i] << ':' << t1[t2[p.first][i]][j] << ':' << d[t1[t2[p.first][i]][j]] << ':' << endl;
				if (t1[t2[p.first][i]][j] != p.first && d[t1[t2[p.first][i]][j]] == -1) {
					flag = false;
					break;
				}
			}*/
			
			if (v[t2[p.first][i]] != t1[t2[p.first][i]].size()) continue;
			
			//cout << p.first << ' ' << t2[p.first][i] << endl;
			
			d[t2[p.first][i]] = p.second + 1;
			t3[t2[p.first][i]] = p.first;
			q.push(make_pair(t2[p.first][i], p.second + 1));
		}
	}
}

int main(void) {
	cin >> n >> m;
	for (int i = 0; i < n - 1 + m; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		t1[b].push_back(a);
		t2[a].push_back(b);
	}
	for (int i = 0; i < n; i++) {
		if (t1[i].size() == 0) r = i;
	}
	bfs(r);
	for (int i = 0; i < n; i++) {
		cout << t3[i] + 1<< endl;
	}
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
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(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[0]+a[1]<<endl;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  if(s.at(2)==s.at(3) && s.at(4)==s.at(5)){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import bisect

n = int(input())
l = list(map(int, input().split()))
ls = sorted(l)

ld={}
for i in range(n):
    ld.setdefault(i,ls[i])
#print(ld)

ans=0
for i in range(n-2):
    for j in range(i+1, n-1):
        k = bisect.bisect_left(ls, ld[i]+ld[j])
        #print(k)
        ans += k-j-1

print(ans)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
using namespace std;
int main(){
  long n;
  cin >> n;
  string s = "";
  long pow2 = 2;
  int i=1;
  while(n!=0){
    if(n%pow2!=0){
      s = "1" + s;
      n -= i*pow2/2;
    }else{
      s = "0" + s;
    }
    pow2 *= 2;
    i *= -1;
  }

  if(s=="")s = "0";
  cout << s;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: i64,
        m: i64,
        x: i64,
        l: [[i64;m + 1];n],
    }
    let mut c = vec![0;n as usize];
    let mut a: Vec<Vec<i64>> = vec![vec![0;12];12];

    for i in 0..n {
        c[i as usize] = l[i as usize][0];
        for j  in 0..m {
            a[i as usize][j as usize] = l[i as usize][(j + 1) as usize];
        }
    }

    let inf = 1001001001;

    let mut ans = inf;
    for s in 0..(1<<n) {
        let mut cost = 0;
        let mut d = vec![0;m as usize];
        for i in 0..n {
            if ((s>>i)&1) == 1  {
                cost += c[i as usize];
                for j in 0..m {
                    d[j as usize] += a[i as usize][j as usize];
                }
            }
        }
        let mut ok = true;
        for j in 0..m {
            if d[j as usize] < x {
                ok = false;
            }
        }
        if ok {
            ans = std::cmp::min(ans, cost);
        }
    }
    if ans == inf {
        println!("-1");
    } else {
        println!("{}", ans);
    }
}


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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 2e3 + 10;

struct BIT{
	vector<int> val;
	BIT(int n) {
		val = vector<int>(n+10, 0);
	}
	void update(int v, int k) {for(v+=5; v<SZ(val); v+=v&-v) val[v] += k;}
	int getSum(int v) {int res=0; for(v+=5; v>0; v-=v&-v) res += val[v]; return res;}
	int getSum(int a, int b) {return getSum(b) - getSum(a-1);}
};

int N, Ix[2][MAX_N];
ll Dy[MAX_N][MAX_N];
int main() {
	cin >> N;
	for(int i=1; i<=2*N; i++) {
		char s[5]; int v; scanf("%s%d", s, &v);
		Ix[s[0] == 'B'][v] = i;
	}
	BIT up = BIT(2*N);
	BIT lf = BIT(2*N);
	for(int i=0; i<=N; i++) {
		if(i) lf.update(Ix[0][i], 1);
		for(int j=0; j<=N; j++) {
			if(i+j == 0) continue;
			Dy[i][j] = LINF;
			if(i && j) up.update(Ix[1][j], 1);

			if(i) Dy[i][j] = min(Dy[i][j], Dy[i-1][j] + abs( (i+j) - (Ix[0][i] + up.getSum(Ix[0][i], 2*N) ) ) );
			if(j) Dy[i][j] = min(Dy[i][j], Dy[i][j-1] + abs( (i+j) - (Ix[1][j] + lf.getSum(Ix[1][j], 2*N) ) ) );

			if(j) lf.update(Ix[1][j], 1);
		}
		for(int j=1; j<=N; j++) {
			if(i) up.update(Ix[1][j], -1);
			if(j) lf.update(Ix[1][j], -1);
		}
		if(i) up.update(Ix[0][i], 1);
	}
	printf("%lld\n", Dy[N][N]);
	return 0;
}



Measured memory_bytes: 31744
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#define ll long long
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#include<string>
#include<cctype>
#include<queue>
#define ii pair<int,int>
#include <sstream>
#define lli long long int
#define pairs pair<int,int>
#define mod 1000000007
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
ll pows(ll a,ll n,ll m)
{
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll  gcd(ll a,ll b)
{
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
			return false;
			}	
	}
	return true;
}
int main()
{
   ios::sync_with_stdio(false);
	 cin.tie(0);
    cout.tie(0);
int n,x;
cin>>x>>n;
set<int>s;
int l;
for(int i=0;i<n;i++)
{
	cin>>l;
	s.insert(l);
}
if(n==0)
{
	cout<<x<<endl;
	return 0;
}
int cnt1=0;
int cnt2=0;
int ans1=0,ans2=0;
for(int i=x;i<=110;i++)
{
	if(s.find(i)==s.end())
	{
		ans1=i;
	break;
}
	else
	cnt1++;
}
for(int i=x;i>=0;i--)
{
	if(s.find(i)==s.end())
	{
		ans2=i;
		break;
	}
	else
	{
	cnt2++;
		
	}
}
if(cnt1<cnt2)
{
	cout<<ans1<<endl;
}
else
cout<<ans2<<endl;
    
}




Measured memory_bytes: 3636
n = int(input())
f1 = 1
f2 = 1
ans = 0
if n == 0 or n == 1:
    ans = 1
else:
    for i in range(n-1):
        if i%2 == 0:
            f1 = (f1 + f2)
            ans = f1
            #print(f1, f2)
        else:
            f2 = (f1 + f2)
            ans = f2
            #print(f1, f2)
print(ans)


Measured memory_bytes: 5592
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <map>
using namespace std;

#define ll long long

int main()
{
    ll N;
    scanf("%lld", &N);

    vector<ll> sum(N);
    map<ll, ll> backmap;
    for (ll i = 0; i < N; i++)
    {
        ll A;
        scanf("%lld", &A);
        if (i - A > 0)
            backmap[i - A]++;
        sum[i] = i + A;
    }

    ll ans = 0;
    for (ll i = 0; i < N; i++)
        ans += backmap[sum[i]];
    printf("%lld\n", ans);
}


Measured memory_bytes: 18524
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const double EPS = 1e-7;
const double INF = 1e12;
struct Vec {
    double x,y;
    Vec(){}
    Vec(double x,double y){ this->x=x,this->y=y; }
    void read(){ scanf("%lf%lf",&x,&y); }
    void prt() {printf("%.9f %.9f\n",x,y); }
    double len(){ return sqrt(x*x+y*y); }
    double len2(){ return x*x+y*y; }
    
    Vec operator+(const Vec&o)const{ return Vec(x+o.x,y+o.y); }
    Vec operator-(const Vec&o)const{ return Vec(x-o.x,y-o.y); }
    Vec operator*(const double&k)const{ return Vec(k*x,k*y); }
    double operator*(const Vec&o)const {return x*o.x+y*o.y; }
    double operator^(const Vec&o)const {return x*o.y-y*o.x; }
    Vec rotate(double ang){ return Vec(x*cos(ang)-y*sin(ang), x*sin(ang)+y*cos(ang)); }
    Vec change(double l){ if(len()<EPS) return *this; return (*this)*(l/len()); }
    double disToLine(Vec A, Vec B) {
        return abs((A-*this)^(B-*this))/(B-A).len();
    }
    Vec Reflection(Vec A,Vec B){
        Vec P = *this;
        double dis=P.disToLine(A,B);
        int sgn=(((B-A)^(P-A))>=0)?-1:+1;
        return (*this)+(B-A).rotate(acos(-1)/2).change(dis)*sgn;
    }
};

Vec Lineintersect(Vec A1,Vec A2,Vec B1,Vec B2) {
    if (abs((A2-A1)^(B2-B1)) < EPS) return Vec(INF,INF);
    return A1 + (A2 - A1) * ( (((A2-A1)^(B2-B1)) - ((A2-B1)^(B2-B1))) / ((A2-A1)^(B2-B1)) );
}

Vec Segintersect(Vec A1,Vec A2,Vec B1,Vec B2) {
    Vec P = Lineintersect(A1,A2,B1,B2);
    //P.prt();
    if ((P-A1)*(P-A2)<=0 && (P-B1)*(P-B2)<=0) return P; 
    return Vec(INF,INF);
}

bool onseg(Vec P,Vec A,Vec B){
    if(P.disToLine(A,B) > EPS) return 0;
    return (P-A)*(P-B) <= 0;
}
double minDis(Vec P,Vec A,Vec B){
    double ans=min((A-P).len(),(B-P).len());
    Vec H = P.Reflection(A,B);
    if(onseg(H,A,B)) ans=min(ans,(H-P).len());    
    return ans;
}

Vec A,B,C,D; int q;
int main(){
    scanf("%d",&q);
    while(q--){
        A.read(); B.read(); C.read(); D.read();
        if(Segintersect(A,B,C,D).x != INF) {
            printf("0\n"); continue;
        }
        double ans=min( min(minDis(A,C,D),minDis(B,C,D)),min(minDis(C,A,B),minDis(D,A,B)) );
        printf("%.8f\n", ans);
    }
}


Measured memory_bytes: 3228