akhauriyash/Code-Regression huggingface dataset:
// +build ignore
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	N := sc.nextInt()
	M := sc.nextInt()
	X := sc.nextInt()

	C := make([]int, N)
	A := make([][]int, N)
	for i := 0; i < N; i++ {
		C[i] = sc.nextInt()
		A[i] = make([]int, M)
		for j := 0; j < M; j++ {
			A[i][j] = sc.nextInt()
		}
	}

	moneys := make([]int, 0)

	var fn func([]int)

	fn = func(B []int) {
		if len(B) > N {
			return
		}

		sums := make([]int, M)
		for i := 0; i < len(B); i++ {
			for j := 0; j < M; j++ {
				sums[j] += A[B[i]][j]
			}
		}

		ok := true
		for j := 0; j < M; j++ {
			if sums[j] < X {
				ok = false
				break
			}
		}

		if ok {
			sum := 0
			for i := 0; i < len(B); i++ {
				sum += C[B[i]]
			}
			moneys = append(moneys, sum)
		}

		for i := B[len(B)-1] + 1; i < N; i++ {
			fn(append(B, i))
		}
	}

	for i := 0; i < N; i++ {
		fn([]int{i})
	}

	sort.Ints(moneys)

	if len(moneys) == 0 {
		fmt.Println(-1)
	} else {
		fmt.Println(moneys[0])
	}

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


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

using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

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

   int x;
   cin >> x;
   if (x == 0){
       cout << "1" << "\n";
   }
   else{
       cout << "0" << "\n";
   }

}




















Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}


int main(){

  ll N;
  cin >> N;
  vector<ll> li;
  map<ll,ll> ma;

  rep(i,N){
    ll inp; cin >>  inp;
    li.pb(inp);
    ma[inp]++;
  }

  rmsame(li);


  ll ans = 0;
  rep(i,li.size()){
    if(ma[li[i]] < li[i]) ans += ma[li[i]];
    else ans += (ma[li[i]]-li[i]);
  }

  cout << ans << endl;
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 7028
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;
vector<ll> knode[100005],node[100005];
ll n,k;
const ll mod=1e9+7;
vector<ll> kai;
bool used[100005],used2[100005];
ll kj(ll t){
  if(t>=0) return kai[t];
  if(t<0) return 0;
}
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll ret=pow(x,y/2);
  ret*=ret;
  ret%=mod;
  if(y%2==1) ret*=x;
  return ret%mod;
}
ll dfs(ll pos,ll d){
  ll ans=1;
  ll son_size=node[pos].size();
  if(son_size==0) return (d==0?k:1);
//  used[pos]=true;
  if(d==0){
    ans=(kj(k-1)*pow(kj(k-1-son_size),mod-2))%mod;
    ans*=k;
    ans%=mod;
    for(ll i=0;i<son_size;i++){
    //  if(used[node[pos][i]]) continue;
      ans*=dfs(node[pos][i],d+1);
      ans%=mod;
    }
    return ans;
  }
  else{
    ans=(kj(k-2)*pow(kj(k-2-son_size),mod-2))%mod;
    for(ll i=0;i<son_size;i++){
      //if(used[node[pos][i]]) continue;
      ans*=dfs(node[pos][i],d+1);
      ans%=mod;
    }
    return ans;
  }
}
void d2(ll pos){
  used2[pos]=true;
  for(int i=0;i<knode[pos].size();i++){
    if(!used2[knode[pos][i]]){
      node[pos].push_back(knode[pos][i]);
      d2(knode[pos][i]);
    }
  }
}
int main(){
  cin>>n>>k;
  for(int i=0;i<n-1;i++){
    ll a,b;
    cin>>a>>b;
    knode[a].push_back(b);
    knode[b].push_back(a);
    used[i]=false;
  }
  used2[n-1]=false;
  used2[n]=false;
  used[n-1]=false;
  used[n]=false;
  d2(1);
  kai.push_back(1);
  for(int i=1;i<=k;i++) kai.push_back((kai[i-1]*i)%mod);
  cout<<dfs(1,0)%mod<<endl;
}


Measured memory_bytes: 16128
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n;
    double k, res = 0.0;
    string s;
    in(n, k);
    rep(i, 1, min(n + 1, (int)k + 1)){
        double tmp = 1.0 / double(n);
        tmp /= pow(2.0, ceilf(log2(k / i)) );
        res += tmp;
    }
    if(n > k){
        res += (double(n) - k) / double(n);
    }
    print(res);
}


Measured memory_bytes: 512
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Ciniii(a, b, c);
    if (a == b && b == c) {
        cout << "Yes" << nn;
    } else {
        cout << "No" << nn;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    set<ll> v;
    ll cv = 0, cur = 0;
    while(cv <= n) {
        cur++;
        cv += cur;
        v.insert(cur);
    }
    ll diff = cv - n;
    while(diff > 0) {
        auto it = v.upper_bound(diff);
        it--;
        diff -= *it;
        v.erase(it);
    }
    for(auto x : v) cout << x << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[2][N], qz[2][N];

int main() {
  int n;
  scanf("%d", &n);
  for(int i = 0; i < 2; ++i) {
    for(int j = 1; j <= n; ++j) {
      scanf("%d", &a[i][j]);
    }
  }
  for(int j = 1; j <= n; ++j)
    qz[0][j] = qz[0][j - 1] + a[0][j];
  for(int j = n; j >= 1; --j)
    qz[1][j] = qz[1][j + 1] + a[1][j];
  int ans = 0;
  for(int i = 1; i <= n; ++i) {
    ans = max(ans, qz[0][i] + qz[1][i]);
  }
  printf("%d\n", ans);
  return 0;
}

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

#define INF 100000000
#define FOR(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
typedef long long ll;

map<ll, int> cnt;
int n;
ll x;

int main() {

#ifdef CONTEST
    freopen("input.in", "r", stdin);
#endif
    IOS

    cin >> n;
    FOR(i,1,n) {
        cin >> x;
        cnt[x]++;
    }

    for (auto pr : cnt) {
        if (pr.second < 2) cnt.erase(pr.first);
    }

    ll wid = 0;
    for (auto pr : cnt) {
        wid = max(wid, pr.first);
    }
    cnt[wid] -= 2;
    if (cnt[wid] < 2) cnt.erase(wid);

    ll he = 0;
    for (auto pr : cnt) {
        he = max(he, pr.first);
    }

    cout << wid*he << endl;

}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int n;
long long x;
map<long long, int> mp;
long long ans; 
int main() {
	scanf("%d", &n);
	mp[0] = 1;
	for(int i = 1; i <= n; ++i) {
		int t;
		scanf("%d", &t);
		x += t;
		ans += mp[x];
		++mp[x];
	}
	printf("%lld\n", ans);
	return 0;
}

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

int main(){
  int m,d,m2,d2;
  cin >> m >> d >> m2 >> d2;
  
  if(m!=m2&&(d+1)!=d2){
    cout << "1";
  }else{
    cout << "0";
  }
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long sum = 0, exc = 0;
  int l = 0, r = 0;
  while (true) {
    while (r < n && (sum + a[r]) == (exc ^ a[r])) {
      ans += r - l + 1;
      sum += a[r];
      exc ^= a[r];
      r++;
    }
    if (r >= n) {
      break;
    }
    do {
      sum -= a[l];
      exc ^= a[l];
      l++;
    } while (sum != exc);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

map<int, int> flag;
int main()
{
	int N;

	cin >> N;
	REP(i, 0, N) {
		int A;
		cin >> A;
		flag[A]++;
	}

	int cnt = 0;
	for (auto itr = flag.begin(); itr != flag.end(); itr++) {
		if ((itr->second) % 2 != 0) cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_ABC153
{
    class MainClass
    {

        static long[] s, a;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            a = Array.ConvertAll(ReadLine().Split().ToArray(), long.Parse);
            var al = a.ToList();
            al.Sort((long x,long y) => y.CompareTo(x));
            long ans = 0;
            if(s[1]>=s[0]){
                WriteLine(0);
                return;
            }
            for(int i = (int)s[1];i<s[0];i++){
                ans += al[i];

            }
            WriteLine(ans);
            
        }
    }
}


Measured memory_bytes: 41088
#include <iostream>
#include <vector>
#include <stack>
#include <string>
#include <map>
#include <ctime>
#include <list>
#include <bitset>
#include <algorithm>

#define ll long long
#define fo(i, c) for (int i = 0; i != c; i++)

using namespace std;

int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k;
	cin >> n >> k;
	k++;
	vector<int> h(n);
	for (auto& it : h)
		cin >> it;
	vector<int> dsu(n + k, 2e9);
	dsu[0] = 0;
	fo(i, n)
		fo(j, k)
			if (i + j < n)
				dsu[i + j] = min(dsu[i + j], dsu[i] + abs(h[i] - h[i + j]));
	cout << dsu[n - 1];
	return 0;
}

Measured memory_bytes: 1024
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int L; cin >> L;
    string s, t; cin >> s >> t;
    if(s+t > t+s) swap(s, t);

    int N = s.length(), M = t.length();
    int X = L / N;
    while((L - N*X) % M != 0) X--;
    int ans_s = X, ans_t = (L - N*X) / M;

    string ans = "";
    rep(i,0,ans_s) ans += s;
    rep(i,0,ans_t) ans += t;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1544
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m;i<n;i++)
#define fix(n) cout<<fixed<<setprecision(n)
#define co(n) cout<<n<<endl
#define so(n,m) sort(n,n+m);
#define sr(n,m) so(n,m) reverse(n,n+m)
using namespace std;
typedef long long ll;
const ll mod=1000000007;
double pi=3.1415926535;

int main(){
  int x,y,a,b,c;
  cin>>x>>y>>a>>b>>c;
  int aa[a],bb[b],cc[c],ax[x],ay[y],p[x+y];
  rep(i,0,a) cin>>aa[i]; rep(i,0,b) cin>>bb[i]; rep(i,0,c) cin>>cc[i];
  sr(aa,a); sr(bb,b); sr(cc,c);
  rep(i,0,x) ax[i]=aa[i]; rep(i,0,y) ay[i]=bb[i];
  rep(i,0,x) p[i]=ax[i]; rep(i,0,y) p[i+x]=ay[i];
  so(p,x+y);
  rep(i,0,c){
    if(cc[i]>p[i]) p[i]=cc[i];
    else break;
  }
  ll ans=0;
  rep(i,0,x+y) ans+=p[i];
  co(ans);
  return 0;
}

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

int n, a[3000], ta = 0;

signed main(){
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		ta += a[i] - 1;
	}
	cout << ta << endl;
	return 0;
}

Measured memory_bytes: 256
/* * * * * * * * * * * **
*                      *
*	   saurabh8522	   *
*	  I will handle	   *
*		   IT.		   *
*                      *
* * * * * * * * * * * **/
#include<bits/stdc++.h>
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define ld long double
#define zero(a) memset((a),0,sizeof((a)))
#define one(a) memset((a),1,sizeof((a)))
#define minus(a) memset((a),-1,sizeof((a)))
#define all(g) g.begin(),g.end()
#define ppb pop_back
using namespace std;
typedef long long int ll;
#define MOD 1000000007
ll extgcd(ll a,ll b,ll& x,ll& y){if(b==0){x=1;y=0;return a;}else{int g=extgcd(b,a%b,y,x);y-=a/b*x;return g;}}
ll modpow(ll a,ll b) {ll res=1;a%=MOD;for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
ll numdigit(ll n){return floor(log10(n)) + 1;}
bool isPowerTwo (ll x) { return x && (!(x&(x-1))); }
const ll INF=1e16;
vector<ll>v(200005,-INF);
ll dp[200005][2][2];
bool vis[200005][2][2];
ll n;
ll find(ll pos,ll flag1,ll flag2){
	// cout<<pos<<" "<<flag1<<" "<<flag2<<endl;
	if(pos>=n) return 0ll;
	ll &ans=dp[pos][flag1][flag2];
	if(vis[pos][flag1][flag2]) return ans;
	vis[pos][flag1][flag2]=1;
	if(flag2==0){
		if(pos==n-3){
			if(flag1==0) return ans=max(v[pos],max(v[pos+1],v[pos+2]));
			else         return ans=max(v[pos+1],v[pos+2]);
		}
		if(flag1==0){
			ll ans1=find(pos+2,0ll,1ll);
			ll ans2=v[pos]+find(pos+2,0ll,0ll);
			ll ans3=v[pos+1]+find(pos+2,1ll,0ll);
			ans=max(ans1,max(ans2,ans3));
		}
		else{
			ll ans1=find(pos+2,0ll,1ll);
			ll ans2=v[pos+1]+find(pos+2,1ll,0ll);
			ans=max(ans1,ans2);
		}
	}
	else{
		if(flag1==0){
			ll ans1=v[pos]+find(pos+2,0ll,1ll);
			ll ans2=v[pos+1]+find(pos+2,1ll,1ll);
			ans=max(ans1,ans2);
		}
		else{
			ans=v[pos+1]+find(pos+2,1ll,1ll);
		}	
	}
	// cout<<pos<<" "<<flag1<<" "<<flag2<<" "<<ans<<endl;
	return ans;
} 
int main(){
	FastRead;
	ll t=1;
	while(t--){
		cin>>n;
		for(ll i=0;i<n;i++){
			cin>>v[i];
		}
		for(ll i=0;i<n;i++){
			vis[i][0][0]=vis[i][0][1]=0;
			vis[i][1][0]=vis[i][1][1]=0;
		}
		if(n&1){
			cout<<find(0,0ll,0ll)<<endl;
		}
		else{
			cout<<find(0,0ll,1ll)<<endl;
		}
	}
}

Measured memory_bytes: 19548
T1,T2,A1,A2,B1,B2 = map(int, open(0).read().split())
D1,D2 = (A1-B1)*T1, (A1-B1)*T1+(A2-B2)*T2
if D1*D2 > 0: print(0)
elif D2 == 0: print("infinity")
else:         print(-D1//D2*2+1 - (-D1%D2 == 0))

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

int main(){
	vector<long long int> v(200001,0);
	vector<long long int> c(200001, 0);
	vector<int> input;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int tmp;
		cin >>tmp;
		input.emplace_back(tmp);
		v[tmp]++;
	}
	for (int i = 1; i <= n; i++) {
		c[i] = c[i-1] + v[i] * (v[i] - 1) / 2;
	}
	for(int i = 0; i < n; i++) {
		cout << c[n]-c[input[i]]+c[input[i]-1] + ((v[input[i]] - 2)  * (v[input[i]] - 1) / 2)<<endl;
	}
	return 0;
}


Measured memory_bytes: 6644
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;

int h,w;
string s[105];
vector<string> s1;
bool a[105];
bool b[105];
int main() {
  cin >> h >> w;
  for(int i = 0; i < h; i++) cin >> s[i];
  for(int i = 0; i < h; i++) {
    bool e = true;
    for(int j = 0; j < w; j++) {
      if(s[i][j] == '#') {
	e = false;
	break;
      }
    }
    if(e) a[i] = true;
  }
 
  for(int i = 0; i < w; i++) {
    bool e = true;
    for(int j = 0; j < h; j++) {
      if(s[j][i] == '#') {
	e = false;
	break;
      }
    }
    if(e) b[i] = true;
  }
 
  for(int i = 0; i < h; i++) {
    if(a[i])continue; 
    for(int j = 0; j < w; j++) {
      if(!b[j])
      cout << s[i][j];
    }
    cout << endl;
  }
}

  
  


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[2005],l,r,ans,mid;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n);
	for(int i=1;i<=n-2;i++)
	{
		for(int j=i+1;j<=n-1;j++)
		{
			l=j+1;
			r=n;
			while(l<=r)
			{
				mid=(l+r)/2;
				if(a[i]+a[j]>a[mid]) ans+=mid-l+1,l=mid+1;
				else r=mid-1;
			}
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s.size()%2)
	{
		cout<<"No"<<endl;
		return 0;
	}
	for(int i=0;i<s.size();i++)
	{
		if(i%2==0&&s[i]!='h')
		{
			cout<<"No"<<endl;
			return 0;
		}
		else if(i%2&&s[i]!='i')
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a,b,c,d;
	int ans=0;
	cin>>a>>b>>c>>d;
	if(c*2==a&&d*2==b)
		ans=1;
	cout<<fixed<<setprecision(10)<<(a*b)/2<<" "<<ans<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;


int main(){

    ll N, L;
    cin >> N >> L;
    vector<string>v(N);
    rep(i, N)cin >> v[i];
    sort(v.begin(), v.end());
    rep(i, N)cout << v[i];
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv, std.algorithm;

int lcs(string x, string y) {
    int m = x.length.to!int, n = y.length.to!int;
    int[][] c = new int[][](m+1, n+1);
    foreach (i; 1 .. m+1) {
        foreach (j; 1 .. n+1) {
            if (x[i-1] == y[j-1]) {
                c[i][j] = c[i-1][j-1] + 1;
            } else {
                c[i][j] = max(c[i-1][j], c[i][j-1]);
            }
        }
    }
    return c[m][n];
}

void main() {
    int q = readln.chomp.to!int;
    foreach (i; 0 .. q) {
        string x = readln.chomp, y = readln.chomp;
        lcs(x, y).writeln;
    }
}


Measured memory_bytes: 16672
#include<iostream>
#define Rep(n) for(int j = 0; j < n; j++)
using namespace std;
int main() {
	int n, m, l;
	cin >> n >> m >> l;
	int a[100][100];
	int b[100][100];
	long long c[100][100] = { 0 };
	Rep(n){
		for (int i = 0; i < m; i++){
			cin >> a[j][i];
		}
	}
	Rep(m) {
		for (int i = 0; i < l; i++){
			cin >> b[j][i];
		}
	}
	Rep(n){
		for (int i = 0; i < l; i++){
			for (int k = 0; k < m; k++){
				c[j][i] += (a[j][k] * b[k][i]);
			}
		}
	}
	Rep(n) {
		for (int i = 0; i < l; i++){
			cout << c[j][i];
			if (i == l - 1){
				cout << endl;
			}
			else cout << ' ';
		}
	}
	return 0;
}

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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

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

    ll a,b;
    ll k;
    cin >> a >> b >> k;
    ll ans = 0;

    frr(i,100,1)
    {
    	if(a%i==0 && b%i==0)
    		k--;
    	if(k==0)
    	{
    		ans = i;
    		break;
    	}
    }

    cout << ans << endl;
}


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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

ll Math, Greedy, Geometry, DP, Graph, Other;

int main(){
  while(scanf("%lld%lld%lld%lld%lld%lld", &Math, &Greedy, &Geometry, &DP, &Graph, &Other) 
	&& Math + Greedy + Geometry + DP + Graph + Other){
    ll g[3], res = 0, s;
    g[0] = Math + DP, g[1] = Greedy + Graph, g[2] = Geometry + Other;
    s = min(g[0], min(g[1], g[2]));
    for(int i = max((ll)0, s-2); i <= s; i++)
      res = max(res, (g[0]-i)/3+(g[1]-i)/3+(g[2]-i)/3+i);
    printf("%lld\n", res);
  }
  return 0;
}

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

int main() {
	int K, T;
	cin >> K >> T;
	int ma = 0;
	for (int i = 0; i < T; i++) {
		int a;
		cin >> a;
		ma = max(ma, a);
	}
	if (K - ma < ma) {
		cout << ma - (K - ma + 1) << endl;
	}
	else {
		cout << 0 << endl;
	}
}

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

int main() {
	int a, b, c;

	cin >> a >> b >> c;

	map<int, int> m;

	++m[a];
	++m[b];
	++m[c];

	for (auto mm : m)
	{
		if (mm.second == 2)
		{
			cout << "Yes";
			return 0;
		}
	}

	cout << "No";

	return 0;
}


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

int main() {
	int N, ali,bob,p,k;
	cin >> N;
	vector <int> an(N,0);
	vector <int> bn(N,0);
	ali=0;
	bob=0;
	
	for (int i= 0;i<N;i++){
		cin >> an.at(i);
	}
	p = 0;
	k=0;
	
	//sort
	
	sort(an.begin(),an.end());
	reverse(an.begin(),an.end());
	
	//plus
	
	for(int i=0;i<N;i++){
		if(i%2==0){
			ali = ali + an.at(i);
		}
		
		if(i%2==1){
			bob = bob+an.at(i);
		}
	}
	
	
	cout << ali - bob<< endl;
		
		
}


Measured memory_bytes: 256
"use strict";
const main = input => {
    let H = parseInt(input[0].split(' ')[0], 10);
    let W = parseInt(input[0].split(' ')[1], 10);
    let h = parseInt(input[1].split(' ')[0], 10);
    let w = parseInt(input[1].split(' ')[1], 10);
    console.log((H-h)*(W-w));
    
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 21192
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
graph0 = [0 for _ in range(N)]
graphN = [0 for _ in range(N)]

for _ in range(M):
    ab = list(map(int, input().split()))
    a,b = ab[0],ab[1]
    if a == 1:
        graph0[b-1] = 1
    if b == N:
        graphN[a-1] = 1

for i in range(1,N):
    if graph0[i] == 1 and graphN[i] == 1:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')


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

const int MOD = (int)1e9+7;

int main(){
	int H,W;
	cin >> H >> W;
	vector<string> A(H);
	for(int i=0;i<H;i++)	cin >> A.at(i);

	vector<vector<int>> dis(H,vector<int>(W,1e9));
	for(int i=0;i<H;i++){
		int x=-1;
		for(int j=0;j<W;j++){
			if(A.at(i).at(j)=='#'){
				x=j;
			}
			if(x!=-1)	dis.at(i).at(j)=min(dis.at(i).at(j),abs(x-j));
		}
	}

	for(int i=0;i<H;i++){
		int x=-1;
		for(int j=W-1;j>=0;j--){
			if(A.at(i).at(j)=='#'){
				x=j;
			}
			if(x!=-1)	dis.at(i).at(j)=min(dis.at(i).at(j),abs(x-j));
		}
	}
	
	for(int j=0;j<W;j++){
		int y=-1;
		int dd=1e9;
		for(int i=0;i<H;i++){
			if(dis.at(i).at(j)<abs(y-i)+dd){
				dd=dis.at(i).at(j);
				y=i;
			}
			if(y!=-1)	dis.at(i).at(j)=min(dis.at(i).at(j),abs(y-i)+dd);
		}
	}
	
	for(int j=0;j<W;j++){
		int y=-1;
		int dd=1e9;
		for(int i=H-1;i>=0;i--){
			if(dis.at(i).at(j)<abs(y-i)+dd){
				dd=dis.at(i).at(j);
				y=i;
			}
			if(y!=-1)	dis.at(i).at(j)=min(dis.at(i).at(j),abs(y-i)+dd);
		}
	}

	int ans=0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			ans=max(ans,dis.at(i).at(j));
			//cout << dis.at(i).at(j);
		}
		//cout << endl;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 5248
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)
#define fs first
#define sc second
using namespace std;
int sx,sy,gx,gy,n,x[1000],y[1000],lx,ly,d[201*201*6],inf=1e8;
int dx[2][7]={{0,1,1,0,-1,-1,0},{0,1,1,0,-1,-1,0}},dy[2][7]={{1,0,-1,-1,-1,0,0},{1,1,0,-1,0,1,0}};
typedef pair<int,int> P;
bool obs[201][201];
void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P> > que;
	rep(i,201*201*6) d[i]=inf;
	que.push(P(0,s));
	d[s]=0;
	while(!que.empty()){
		P p=que.top();
		que.pop();
		if(d[p.sc]<p.fs) continue;
		int x=p.sc/1206-lx,y=p.sc%1206/6-ly,t=p.sc%6;
//		cout << x << " " << y << " " << t << " " << p.fs << endl;
		int xg=(x+1000)%2,di=(int)abs(x*y*t)%6;
		rep(i,7){
			int nx=x+dx[xg][i],ny=y+dy[xg][i],nt=(t+1)%6;
			if(-lx<=nx && nx<=lx && -ly<=ny && ny<=ly && !obs[nx+lx][ny+ly]){
				int st=(nx+lx)*1206+(ny+ly)*6+nt,pen=1;
				if(di==i) pen=0;
				if(d[st]>d[p.sc]+pen){
					d[st]=d[p.sc]+pen;
					que.push(P(d[st],st));
				}
			}
		}
	}
}
int main(){
	cin >> sx >> sy >> gx >> gy >> n;
	rep(i,n) cin >> x[i] >> y[i];
	cin >> lx >> ly;
	rep(i,n) x[i]+=lx,y[i]+=ly;
	rep(i,n) obs[x[i]][y[i]]=1;
	sx+=lx,sy+=ly,gx+=lx,gy+=ly;
	dijkstra(sx*1206+sy*6);
	int ans=inf;
	rep(i,6) ans=min(ans,d[gx*1206+gy*6+i]);
	if(ans==inf) ans=-1;
	cout << ans << endl;
}

Measured memory_bytes: 2308
import itertools
import math
n = int(input())
cities = []
distance = 0
for i in range(n):
    cities.append([int(x) for x in input().split()])

all  = list(itertools.permutations(cities))

for j in range(len(all)):
    for k in range(len(all[j])-1):
        distance += math.hypot(all[j][k][0] - all[j][k+1][0], all[j][k][1] - all[j][k+1][1]) 
average = distance/len(all)
print(average)



Measured memory_bytes: 7972
#include <iostream>
#include <string>
#include <array>
#include <algorithm>
#include <vector>
#define int long long
using namespace std;

signed main() {
    int n;
    int d,x;
    int a[101];
    int sum = 0;
    int j = 1;
    cin >> n >> d >> x;
    for(int i = 0; i < n; i ++){
        cin >> a[i];
    }

    for(int i = 0; i < n; i ++){
        sum ++;
        j = 1;
        while(j*a[i]+1 <= d){
            sum++;
            j ++;
        }
    }

    cout <<sum+x;

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<char> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  
  int sum = 0;
  for (int i = 0; i < N - 2; i++) {
    if (S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') sum++;
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256
s = input()
K = int(input())
head = [h for h in s]

head = set(head)
head = list(head)
head.sort()

cnt = 0
ans = []
idx = 0
while cnt < K:
    for i in range(len(s)):
        if s[i] == head[idx]:
            for k in range(i+1, min(len(s)+1, i+6)):
                ans.append(s[i:k])
        ans = set(ans)
        ans = list(ans)
        cnt = len(ans)
    idx += 1
ans = set(ans)
ans = list(ans)
ans.sort()
print(ans[K-1])

Measured memory_bytes: 3064
#pragma GCC optimize "-O3"
#include <bits/stdc++.h>
using namespace std;
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define four pair<two,two>
#define pb push_back
#define mk make_pair
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
int n,a,b;
int main(){std::ios::sync_with_stdio(false);
cin>>n>>a>>b;
cout<<min(a,b)<<" "<<max(a+b-n,0)<<endl;
}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 














const int N=3000;
int n;
int main()
{
    cin>>n;
    double a[n+1];
    for(int i=1;i<=n;i++){cin>>a[i];}
    double dp[n+1][n+1];
    for(int i=0;i<=n;i++)for(int j=0;j<=n;j++)dp[i][j]=0;
    dp[0][0]=1.0;
    dp[1][0]=1.0-a[1];
    dp[1][1]=a[1];
    for(int i=2;i<=n;i++)dp[i][0]=(1.0-a[i])*dp[i-1][0];
    for(int i=1;i<=n;i++)
    {
         dp[i][0]=(1.0-a[i])*dp[i-1][0];
         
         for(int j=1;j<=i;j++)
         {
              dp[i][j]=1.0*dp[i-1][j-1]*a[i]+1.0*dp[i-1][j]*(1.0-a[i]);    
         }
    }
    double sum=0.0;
    for(int i=n/2+1;i<=n;i++)
    {
         
         sum+=dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<sum;

     
     

}























 

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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  map<ll, ll> cnt;
  for (ll i = 0; i < N; i++) {
    ll a; cin >> a;
    cnt[a]++;
  }
  ll ans = 0;
  for (auto [a, c] : cnt) {
    if (c < a) ans += c;
    else ans += c - a;
  }
  cout << ans << endl;

  return 0;
}



Measured memory_bytes: 9540
// #define __LOCAL_DEBUG__
#include<bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(x) { cerr << "\033[94m" << __func__ << " " << #x << ": " << (x) << "\n\033[0m"; }
#else
# define _debug(...) {((void) 0);}
#endif
#define REP(i, n) for (int i = (0); i < (n); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define EACH(x, arr) for (auto& x : arr) 
#define ITR(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define CLR(x, v) memset(x, v, sizeof (x))
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int) x.size()
template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
using LL = long long;
using PII = pair<int, int>;
using VI = vector<int>;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAXN = 5005;

int n, m;
void MAIN() {
    VI c = {0, 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6}; 
    cin >> n >> m;
    VI d(m);
    REP(i, m) cin >> d[i];
    sort(ALL(d));
    vector<string> dp(n + 10, "");
    auto less = [](string a, string b) {
        if (SZ(a) != SZ(b)) return SZ(a) < SZ(b);
        REP(i, SZ(a)) if (a[i] != b[i]) return a[i] < b[i];
        return false;
    };
    REP(i, n) {
        if (i && dp[i] == "") continue;
        EACH(x, d) {
            if (less(dp[i + c[x]], dp[i] + char('0' + x))) 
                dp[i + c[x]] = dp[i] + char('0' + x);
        }
    }
    cout << dp[n] << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int TC = 1;
    // cin >> TC;
    REP(tc, TC) {
        // cout << "Case " << tc + 1 << ": ";
        MAIN();
    }
    return 0;
}


Measured memory_bytes: 43904
n,m=map(int,input().split())
abc=[list(map(int,input().split())) for _ in range(m)]
d=[[1<<32 for _ in range(n)] for _ in range(n)]
for a,b,c in abc:
    d[a-1][b-1]=c
    d[b-1][a-1]=c
for i in range(n):
    d[i][i]=0
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j]=min(d[i][j],d[i][k]+d[k][j])
ans=0
for a,b,c in abc:
    j=True
    for s in range(n):
        if d[s][a-1]+c==d[s][b-1]:
            j=False
    if j: ans+=1
print(ans)

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

int main(){
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  int st=0,t=0;
  for(int i=0;i<(int)s.size();i++){
    if(s[i]=='T') t++;
    if(t>=1&& s[i]=='S'){
      t--;
      st++;     
    }
  }
  cout<<(s.size()-st*2)<<endl;

  return 0;
}


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

const int N = 500020 , mod = 998244353;

inline int qpow(int x , int y = mod - 2) {
	int res = 1;
	for(; y ; y >>= 1 , x = 1ll * x * x % mod)
		if(y & 1) res = 1ll * res * x % mod;
	return res; 
} 
int fac[N] , inv[N];
int C(int x , int y) {
	if(y < 0 || y > x) return 0;
	return 1ll * fac[x] * inv[y] % mod * inv[x - y] % mod; 
}
typedef long long int64;

void C_init(int n) {
    fac[0] = 1;
    for(int i = 1 ; i <= n ; i++) fac[i] = 1ll * fac[i - 1] * i % mod;
    inv[n] = qpow(fac[n]);
    for(int i = n-1 ; ~i ; i--) inv[i] = inv[i + 1] * (i + 1ll) % mod;
}

int n , k , ans;

int main() {
    cin >> n >> k;
    C_init(k);
    for(int i = n ; i <= k ; ++i)
        ans = (ans + C(k , i)) % mod,
        ans = (ans - C(k, 2*i - n + 1) + mod) % mod;
 
    cout << ans << endl;
}

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

int main(){
    int n,l;
    cin >> n >> l;
    vector<int> t(n);
    int sum=0;
    int mini=100000;
    for(int i=0;i<n;i++){
        t.at(i) = i+l;
        //cout << i+1 << "番目の味は" << t.at(i) << endl;
        sum += t.at(i);
        if(abs(mini)>abs(t.at(i))){
            mini = t.at(i);
        }
    }


    cout << sum - mini << endl;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#include <tuple>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#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,n,m) for(int i = (n); i < (m); i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    string s1, s2; cin >> s1 >> s2;
    // dp[i][j] := s1のi番目までとs2のj番目までの文字列のLCS
    vector<vector<int>> dp(s1.size() + 1, vector<int>(s2.size() + 1, 0));
    REP(i, s1.size()) {
        REP(j, s2.size()) {
            if (s1[i] == s2[j]) {
                dp[i + 1][j + 1] = dp[i][j] + 1;
            }
            else {
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }
    int u = s1.size(), v = s2.size();
    vector<char> str(dp[u][v]);
    while (u != 0 && v != 0) {
        if (dp[u - 1][v] == dp[u][v]) {
            u--;
        }
        else if (dp[u][v - 1] == dp[u][v]) {
            v--;
        }
        else {
            str[dp[u][v]-1] = s1[u - 1];
            u--;
            v--;
        }
    }
    for (char c : str) {
        cout << c;
    }
    cout << endl;
    getchar(); getchar();
}

Measured memory_bytes: 35584
#include <stdio.h>
 
int main(){
    int countTable[256] = {0};
    char ch;
 
    while((ch = getchar()) != EOF){
                countTable[ch]++;
    }
    for(int i = 97; i <=122;i++)printf("%c : %d\n",i,countTable[i]+countTable[i-32]);
}


Measured memory_bytes: 2620
n = int(input())
lst = [111, 222, 333, 444, 555, 666, 777, 888, 999]


if n in lst:
    print(n)
    exit()

for i in range(1, 10):
    if n >= lst[i-1] and n <= lst[i]:
        print(lst[i])
        exit()
    elif n >= 100 and n <= 110:
        print(lst[0])
        exit()


Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
# print(A,B)
dif = [ 0 for i in range(N)]
# print(dif)

if sum(A) < sum(B):
    print(-1)
else :
    for i in range(N):
        dif[i] = A[i] - B[i]
    if all( 0<=n for n in dif): 
        print(0)
    else:
        dif.sort(reverse=True)
        # print(dif)
        sum_minus = 0
        ans = 0 
        for d in dif:
            if d < 0:
                ans += 1
                sum_minus += d
        for d in dif:
            sum_minus += d
            ans += 1
            if sum_minus >= 0:
                print(ans)
                break



Measured memory_bytes: 19188
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();

    int ans = 0;
    for (int i = 1; i <= N; i+=2) {
      if (countYakusu(i) == 8) {
        ans++;
      }
    }
    System.out.println(ans);
  }
  
  private static int countYakusu(int n) {
    int ret = 0;
    for (int i = 1; i*i <= n; i++) {
      if (n % i == 0) {
        if (n / i == i) {
          ret += 1;
        } else {
          ret += 2;
        }
      }
    }
    return ret;
  }
}

Measured memory_bytes: 21844
#include "bits/stdc++.h"

using namespace std;

const int INF = numeric_limits<int>::max() / 2;

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

    int n,m;
    while(cin>>n>>m,n&&m){
        vector<int> taro(n),hana(m);
        int taro_sum=0,hana_sum=0;
        for(int i=0;i<n;i++){
            cin>>taro[i];
            taro_sum+=taro[i];
        }
        for(int i=0;i<m;i++){
            cin>>hana[i];
            hana_sum+=hana[i];
        }
        int mi=INF,t=-1,h=-1;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(taro_sum-taro[i]+hana[j]!=hana_sum-hana[j]+taro[i]) continue;
                if(taro[i]+hana[j]<mi){
                    t=taro[i];h=hana[j];
                    mi=taro[i]+hana[j];
                }
            }
        }
        if(t==-1) cout<<"-1"<<endl;
        else cout<<t<<" "<<h<<endl;
    }
}

Measured memory_bytes: 3068
#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 mod = 998244353;
struct mint {
  ll x;  // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  int n;
  cin >> n;
  mint ans = 1;
  rep(i, n) { ans *= (i + 1); }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll hpow(ll x,ll y){
    ll ans=1;
    ll i=x;
    if(y==0)return 1;
    while(y>0){
        if(y%2==1){
            ans=(ans*i)%i_7;
        }
        i=(i*i)%i_7;
        y=y/2;
        
    }
    return ans;
}

ll memop[2000000];
ll mkai(ll i){
    if(i==0){
        return 1;
    }
    if(memop[i]!=0){
        return memop[i];
    }else{
        ll ans=(mkai(i-1)*hpow(i,i_7-2))%i_7;
        memop[i]=ans;
        return ans;
    }
}

ll memok[2000000];
ll kai(ll i){
    if(i==0){
        return 1;
    }
    if(memok[i]!=0){
        return memok[i];
    }else{
        ll ans=(kai(i-1)*i)%i_7;
        memok[i]=ans;
        return ans;
    }
}

ll comb(ll n,ll k){
    ll ans=(kai(n)*mkai(k))%i_7;
    ans=(ans*mkai(n-k))%i_7;
    return ans;
}


int main(){
    
    ll n,k;cin>>n>>k;
    
    if(k>=n-1){
        cout<<comb(2*n-1,n)<<endl;
    }else{
        ll ans=0;
        rep(i,n-k,n){
            ans=(ans+comb(n,i)*comb(n-1,i-1))%i_7;
        }
        cout<<ans<<endl;
    }
    
    return 0;
}



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

typedef long long ll;

#define INF 100000000;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define eps 1.0e-14;

using pint = pair<ll,ll>;

int main(){
	int n; cin >> n;
	ll a[100006];
	rep(i,n) cin >> a[i];
	sort(a, a + n);
	ll ans = 1;
	rep(i,n){
		if(a[i] == 0){
			ans = 0;
			break;
		}else if (ans > ll(1e18) / a[i]){
			ans = -1;
			break;
		}else{
			ans *= a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

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

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

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

	int N; cin >> N;
	double JPY_BTC = 380000.0;

	double ans = 0;
	for (int i = 0;i < N;i++){
		double x; string u;
		cin >> x >> u;
		if(u == "JPY") ans += x;
		else ans += x*JPY_BTC;
	}

	printf("%.6f\n", ans);

	return 0;

}


Measured memory_bytes: 256