akhauriyash/Code-Regression huggingface dataset:
/*
digu_J - Digvijay Janartha
NIT Hamirpur - INDIA
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")

using namespace std;
using namespace __gnu_pbds;

template < typename T > using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    int len = comma - names;
    for (int i = 0; i < len; ++i) {
        cout << names[i];
    }
    cout <<  " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif

typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < ll, ll > pll;
typedef pair < int, int > pii;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef gp_hash_table < int, int > fast;

#define eb emplace_back
#define pb push_back
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) (sort(x.begin(), x.end()), x.resize(distance(x.begin(), unique(x.begin(), x.end()))))
#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, base = 1e9, MOD = 1e9 + 7, N = 2500 + 5, M = 1e3 + 5, LG = 20;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

struct edge{
    ll u, v, coins;
};

ll n, m, p, d[N], par[N];
bool vis[N];
vi g[N];
vector < edge > e;

void test();
void dfs(int s);

int main() {
    fast_io();
    cout << fixed << setprecision(15);
    test();
    return 0;
}

void test() {
    cin >> n >> m >> p;
    for (ll i = 0, x, y, z; i < m; ++i) {
        cin >> x >> y >> z;
        g[x].pb(y);
        e.pb({x, y, -z + p});
    }
    fill(d + 2, d + n + 1, ll(1e18));
    par[1] = -1;
    for (int i = 1; i <= n; ++i) {
        for (auto &x: e) {
            if (d[x.u] < 1e18) {
                if (d[x.v] > d[x.u] + x.coins) {
                    d[x.v] = max(ll(-1e18), d[x.u] + x.coins);
                    par[x.v] = x.u;
                    if (i == n) {
                        dfs(x.v);
                        if (vis[n]) {
                            cout << "-1\n";
                            return;
                        }
                        fill(vis, vis + n + 1, false);
                    }
                }
            }
        }
    }
    cout << max(0ll, -d[n]) << "\n";
}

void dfs(int s) {
    vis[s] = true;
    for (auto &x: g[s]) {
        if (!vis[x]) {
            dfs(x);
        }
    }
}


Measured memory_bytes: 640
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

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

mn = min(As)
mx = max(As)
if mx > mn + 1:
    print('No')
elif mx == mn:
    if 1 <= mx <= N // 2 or mx == N - 1:
        print('Yes')
    else:
        print('No')
else:
    mn_num = As.count(mn)
    mx_num = As.count(mx)
    k = mn + 1 - mn_num
    # print("can i make {} groups from {}?".format(k, mx_num))
    if mx_num == 0:
        if k == 0:
            print('Yes')
        else:
            print('No')
    else:
        if 1 <= k <= (mx_num // 2):
            print('Yes')
        else:
            print('No')


Measured memory_bytes: 16028
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N, M;
    cin >> N >> M;
    vector<ll> A(N);
    ll sum = 0;
    rep(i,N){
        cin>>A[i];
        sum += A[i];
    }
    sort(all(A));
    reverse(all(A));
    bool ok = true;
    rep(i,M){
        if(4 * A[i] * M < sum)ok = false;
    }
    cout << (ok ? Yes : No) << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int a,b;
  char str[100],*p;
  
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  a=atoi(p);
  p=strtok(NULL," \n");
  b=atoi(p);
  
  if(a<=b){
   printf("%d\n",a);
  }else{
    printf("%d\n",a-1);
  }
  
  
 return 0; 
}

Measured memory_bytes: 128
n = int(input())
v = list(map(int, input().split())) 
a = 0
ab = 0
ac = 0
b = [0]*(10**5+10)
c = [0]*(10**5+10)
d = [0]*(10**5+10)
e = [0]*(10**5+10)
for i in range(n-1):
  if v[i]==v[i+1]:
    a +=1
if(a == n-1):
  print(int(n/2))
else:
  for i in range(0,n,2):
    b[v[i]] = b[v[i]] + 1
  for j in range(1,n+1,2):
    c[v[j]] =c[v[j]] + 1
  d = sorted(b,reverse=True)
  e = sorted(c,reverse=True)
  for s in range(10**5+1):
    if(d[0]==b[s]):
      ab = s
      break
  for t in range(10**5+1):
    if(e[0]==c[t]):
      ac = t
      break
  if(s==t):
    print(min(2*int(n/2)-d[0]-e[1],2*int(n/2)-d[1]-e[0]))
  else: 
    f = int(n/2)-d[0]
    g = int(n/2)-e[0]
    print(f+g)

Measured memory_bytes: 20492
def is_kaibun(n):
    ns = [int(v) for v in str(n)]

    i = 0
    j = len(ns) - 1
    while i < j:
        if ns[i] != ns[j]:
            return False
        i += 1
        j -= 1

    return True


A, B = map(int, input().split())

count = 0
for i in range(A, B + 1):
    if is_kaibun(i):
        count += 1

print(count)


Measured memory_bytes: 41836
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    int a,b;
    cin>>a>>b;
    string ans="Impossible";
    if(a%3==0||b%3==0||(a+b)%3==0)ans="Possible";
    cout<<ans<<endl;
    
    return 0;
}


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

int main(){
  int A, B, K;
  cin >> A >> B >> K;

  vector<int> seq;
  for (int i=1; i<=A; i++) {
	if (((A % i) == 0) && ((B % i) == 0)) {
	  seq.push_back(i);
	}
  }

  cout << seq.at(seq.size() - K) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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

    string s;
    int k;
    cin >> s >> k;

    string t = s, u = s;
    int tcount = 0, ucount = 0;

    int n = s.size();

    for(int i = 0;i < n-1;i ++){
        if(t.at(i) == t.at(i+1)){
            t.at(i+1) = '0';
            tcount ++;
        }
    }

    u.at(0) = '1';
    ucount ++;
    for(int i = 0;i < n-1;i ++){
        if(u.at(i) == u.at(i+1)){
            u.at(i+1) = '0';
            ucount ++;
        }
    }

    int ans = 0;
    if(t.at(0) != t.at(n-1)){
        ans = tcount * k;
    }else if(u.at(n-1) != '0' && u.at(n-1) != '1'){
        ans = tcount + ucount * (k-1);
    }else{
        ans = (tcount + ucount) * (k/2) + tcount * (k%2);
    }

    cout << ans << endl;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define swap(a,b) tmp=ver[b], ver[b]=ver[a], ver[a]=tmp;
int main(){
	int w, n;
	int ver[30];
	int a, b, tmp;
	cin >> w >> n;
	rep(i, w) ver[i]=i+1;
	rep(i, n){
		scanf("%d,%d", &a, &b);
		swap(a-1,b-1);
	}
	rep(i, w) cout << ver[i] << endl;
	return 0;
}

Measured memory_bytes: 1240
N = int(input())
S = list(str(input()))

bk_all = wh_all = 0
for s in S:
    if s == "#":
        bk_all += 1
    else:
        wh_all += 1

ans = min(bk_all, wh_all)


left_bk = 0
right_wh = wh_all
for i in range(N):
    if S[i] == '#':
        left_bk += 1
    else:
        right_wh -= 1
    ans = min(ans, left_bk + right_wh)
print(ans)

Measured memory_bytes: 4840
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void) {

    int N; cin>>N;

    int minimum = N;
    int cnt=0;
    for (int i = 0; i < N; ++i) {
        int P; cin>>P;
        if(P>minimum) cnt++;
        minimum = min(minimum,P);
    }
    cout<<N-cnt<<endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(){
	int i,n,sum = 0,mx = 0;
	cin >> n;
	for(i=0;i<n;i++){
		int l;
		cin >> l;
		sum += l; mx = max(mx,l);
	}
	if(sum>2*mx){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

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

using namespace std;

typedef double db;
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

typedef pair < db, db > pdd;
typedef pair < db, ld > pdl;
typedef pair < ld, db > pld;
typedef pair < ld, ld > ldp;

typedef pair < ll, ll > pll;
typedef pair < int, ll > pil;
typedef pair < ll, int > pli;
typedef pair < int, int > pii;

#define F first
#define S second

#define en end()
#define bg begin()

#define rev reverse
#define mp make_pair
#define pb push_back

#define y1 y1234567890
#define um unordered_map

#define all(x) x.bg, x.en
#define sz(x) (int)x.size()
#define len(x) (int)strlen(x)

#define sqr(x) ((x + 0ll) * (x))
#define sqrd(x) ((x + 0.0) * (x))

#define forn(i, n) for (int i = 1; i <= n; i++)

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;

const db eps = (db)1e-9;
const db pi = acos(-1.0);

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

const int N = 5005;

vector < int > g[N];
int n, sz[N], f[N], dp[N][N][2], nw[N][N][2];

inline void add(int &x, int y) {
	x += y;
	if (x >= mod)
		x -= mod;
}

inline void sub(int &x, int y) {
	x -= y;
	if (x < 0)
		x += mod;
}

void dfs(int v, int pr = -1) {
	sz[v] = 1;
	dp[v][1][0] = 1;
	for (auto to : g[v]) {
		if (to == pr)
			continue;
		dfs(to, v);
		for (int j = 1; j <= sz[v]; j++) {
			for (int k = 1; k <= sz[to]; k++) {
				for (int fl = 0; fl < 2; fl++) {
					for (int fll = 0; fll < 2; fll++) {
						add(nw[v][j + k][fl ^ fll], (dp[v][j][fl] + 0ll) * dp[to][k][fll] % mod);
						add(nw[v][j][fl ^ fll ^ 1], (dp[v][j][fl] + 0ll) * dp[to][k][fll] % mod * f[k] % mod);
					}
				}
			}
		}
		sz[v] += sz[to];
		for (int j = 1; j <= sz[v]; j++)
			for (int fl = 0; fl < 2; fl++)
				dp[v][j][fl] = nw[v][j][fl], nw[v][j][fl] = 0;
	}
}

int main() {
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	//freopen(".err", "w", stderr);

	//srand(time(NULL));

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

	//cout << setprecision(10) << fixed;
	
	cin >> n;

	for (int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}

	f[0] = 1;
	for (int i = 1; i <= n; i++)
		f[i] = ((i & 1) ? 0 : f[i - 2] * (i - 1ll) % mod);

	dfs(1);

	int ans = 0;

	for (int i = 1; i <= n; i++) {
		add(ans, dp[1][i][0] * (f[i] + 0ll) % mod);
		sub(ans, dp[1][i][1] * (f[i] + 0ll) % mod);
	}

	cout << ans;
	
	//cerr << (clock() + 0.0) / CLOCKS_PER_SEC;

	return 0;
}


Measured memory_bytes: 391552
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  string S, T;
  cin >> S >> T;
  S += S;
  bool is_ok = false;
  rep(i, S.size() - T.size())
  {
    rep(j, T.size())
    {
      if (S[i + j] != T[j])
        break;

      if (j == T.size() - 1)
        is_ok = true;
    }
  }
  if (is_ok)
  {
    printYes();
  }
  else
  {
    printNo();
  }
  return 0;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;

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

	int ans1 = a + b;
	int ans2 = a - b;
	int ans3 = a * b;


	cout << max(ans1 ,max(ans2, ans3)) << endl;




    return 0;
}



Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_imports)]
use ascii::AsciiChar;
use ascii::AsciiStr;
use itertools::Itertools as _;
use permutohedron::LexicalPermutation as _;
use petgraph::algo::dijkstra;
use petgraph::algo::min_spanning_tree;
use petgraph::data::FromElements;
use petgraph::graph::NodeIndex;
use petgraph::graph::UnGraph;
use petgraph::unionfind::UnionFind;
use proconio::fastout;
use proconio::input;
use proconio::marker::Chars;
use proconio::marker::Usize1;
use std::cmp::max;
use std::cmp::min;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use superslice::Ext as _;

#[fastout]
fn main() {
    input! {
        N: usize,
        mut XYs: [(i64, i64); N],
    }

    // 扱いやすいように、Xの昇順,Yの昇順でソートしておく
    XYs.sort();

    // Nが小さいので、N^4くらいまで回せる
    // なので、ある2点間についてのxの差やyの差はメモリに乗せることができる

    // 等差数列になるように点を巡っていく際に、-方向に行ける道は逆から辿ることもできる。
    // よって、+方向だけ考えれば充分

    let mut ans = N;

    for fst_ind in 0..N {
        let (fst_x, fst_y) = XYs[fst_ind];

        for snd_ind in fst_ind + 1..N {
            let (snd_x, snd_y) = XYs[snd_ind];
            let p = snd_x - fst_x;
            let q = snd_y - fst_y;

            // pとqが確定していれば、0ポイントで移動できる点は列挙できる
            let mut pq_pair = 0;
            for i in 0..N {
                let (x0, y0) = XYs[i];

                for j in fst_ind + 1..N {
                    let (x1, y1) = XYs[j];

                    if x1 - x0 == p && y1 - y0 == q {
                        pq_pair += 1;
                    }
                }
            }

            let cand = N - pq_pair;
            ans = min(ans, cand);
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2188
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int s;
    cin >> s;
    int y = s/100, m = s%100;
    bool YM = false, MY = false;
    if(1 <= m && m <= 12)YM = true;
    if(1 <= y && y <= 12)MY = true;
    if(YM && MY)cout << "AMBIGUOUS";
    else if(YM)cout << "YYMM";
    else if(MY)cout << "MMYY";
    else cout << "NA";
}


Measured memory_bytes: 256
from collections import Counter
import math
n = int(input())
a = list(map(int,input().split()))
 
s = []

tem = 0
s.append(tem)
for i in range(n):
    tem += a[i]
    s.append(tem)
    
b = Counter(s)
c = b.values()

ans = 0
for i in c:
    ans += (i*(i-1)//2)
        
print(ans)

Measured memory_bytes: 112644
a = input()
dic = {}
if len(set(a)) == 2:
    for i in range(len(a)):
        if a[i] not in dic:
            dic.setdefault(a[i], 1)
        else:
            dic[a[i]] += 1
            if dic[a[i]] > 2:
                print('No')
                break
    print('Yes')

else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;
int b[100];
int a[100];
int main()
{
	int n;
	ll ans=0;
	cin>>n;
	for(int i=0;i<n-1;i++)
		cin>>b[i];
	a[0]=b[0];
	a[n-1]=b[n-2];
	for(int i=1;i<n-1;i++)
	{
		a[i]=min(b[i],b[i-1]);
	}
	for(int i=0;i<n;i++)
		ans+=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
// Problem : C - Multiplication 3
// Contest : AtCoder - AtCoder Beginner Contest 169
// URL : https://atcoder.jp/contests/abc169/tasks/abc169_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//Mmmmmm......
#include<bits/stdc++.h>
using namespace std;

#define w cout
#define e '\n'
#define int long long
#define sz(x) (int)x.size()
#define re return 
#define vi vector<int>
#define vii vector<pair<int ,int > >
#define F first
#define S second
#define pussy push_back
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

const int N = 1e6 , mod = 1e9 + 7;

void solve() {
	int a ;cin >> a;
	long double b ; cin >> b;
	b = b * 100;
	b += 0.01;
	int c = b;
	a = a * c;
	a /= 100;
	w << a;
}

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);	
	int t = 1;
	// cin >> t;
	while(t--) {
		solve();
	}	
}


Measured memory_bytes: 3748
#include<iostream>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<utility>
#include<iomanip>
using namespace std;
int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
long long READ(){
    long long xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=xx*10+ch-'0';ch=getchar();}
    return xx*ff;
}
char one(){
	char ch=getchar();
	while(ch==' '||ch=='\n')
		ch=getchar();
	return ch;
}
const int MOD=int(1e9)+7;
const int maxn=200010;
int n,k,fac[maxn],inv[maxn],invfac[maxn];
inline int mypow(int b,int p){
	int ret=1;
	while(p){
		if(p&1)
			ret=1LL*ret*b%MOD;
		p>>=1;
		b=1LL*b*b%MOD;
	}
	return ret;
}
int C(int n,int m){
	return 1LL*fac[n]*invfac[m]%MOD*invfac[n-m]%MOD;
}
int main(){
	//freopen("in.txt","r",stdin);

	fac[0]=inv[0]=invfac[0]=1;
	inv[0]=inv[1]=1;
	for(int i=2;i<maxn;i++)
		inv[i]=1LL*(MOD-MOD/i)*inv[MOD%i]%MOD;
	for(int i=1;i<maxn;i++){
		fac[i]=1LL*fac[i-1]*i%MOD;
		invfac[i]=1LL*invfac[i-1]*inv[i]%MOD;
	}
	n=read(),k=read();

	int ans=0;
    for(int i=0;i<=min(n-1,k);i++)
		(ans+=1LL*C(n-1,n-i-1)*C(n,i)%MOD)%=MOD;
	printf("%d\n",ans);
	return 0;
}





Measured memory_bytes: 2560
#include<stdio.h>
int main(void){
  long long int n,a,b,ans,rem;
  scanf("%lld%lld%lld",&n,&a,&b);
  ans=n/(a+b)*a;
  rem=n%(a+b);
  ans+=rem<a?rem:a;
  printf("%lld",ans);
  return 0;
}

Measured memory_bytes: 128
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    s = S()
    t = S()
    ans = 0
    for i in range(len(s)):
        if s[i] == t[i]:
            ans += 1
    print(ans)
    return

#B
def B():
    a,b = LI()
    for i in range(10000):
        if 1+i*a-i >= b:
            print(i)
            return
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    B()


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

using namespace std;

#ifdef LOCAL_DEFINE
  #include "../../library/DEBUG.hpp"
#else
  #define debug(...) 0
#endif

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  map<long long, long long> cnt;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ++cnt[a[i]];
    sum += a[i];
  }
  int q;
  cin >> q;
  while (q--) {
    long long B, C;
    cin >> B >> C;
    sum -= cnt[B] * B;
    sum += cnt[B] * C;
    cnt[C] += cnt[B];
    cnt[B] = 0;
    cout << sum << '\n';
  }
  return 0;
}

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

const int MAX = int(1e6);

int dp[MAX];
int odp[MAX];

int main(void)
{
    int n;

    fill(dp, dp + MAX, MAX);
    fill(odp, odp + MAX, MAX);
    dp[0] = odp[0] = 0;
    for (int i = 0; i < 200; i++){
        int tetra = i * (i + 1) * (i + 2) / 6;
        for (int j = 0; j < MAX - tetra; j++){
            dp[j + tetra] = min(dp[j + tetra], dp[j] + 1);
        }
        if (tetra % 2 == 1){
            for (int j = 0; j < MAX - tetra; j++){
                odp[j + tetra] = min(odp[j + tetra], odp[j] + 1);
            }
        }
    }
    while (cin >> n, n){
        printf("%d %d\n", dp[n], odp[n]);
    }

    return 0;
}

Measured memory_bytes: 8956
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


		String[] tmpArray = br.readLine().split(" ");

		long l = Integer.parseInt(tmpArray[0]);
		long r = Integer.parseInt(tmpArray[1]);

//		l %= 2019;
//		r %= 2019;

//		if(r <= l){
//			r += 2019;
//		}

		int result = 2019;
		for(long i = l; i < r && i <= l + 2019; i++){
			for(long j = i + 1; j <= r && j <= l + 2019; j++){
				result = Math.min(result, (int)((i*(j))%2019));
			}
		}

		System.out.println(result);

	}

}


Measured memory_bytes: 21204
fun main(args: Array<String>) = println(run {
    fun divisors(x: Long): List<Long> = (1..Math.sqrt(x.toDouble()).toLong()).asSequence().filter { x % it == 0L }.map { listOf(it, x / it) }.flatten().distinct().sorted().toList()
    val n = readLine()!!.toInt()

    (1L..n step 2).count { divisors(it).count() == 8 }

})


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

int main() {
  int a,b;
  cin >> a >> b;
  for(int i = 1;i <= 1000;i++){
    if(i*8/100 == a && i/10 == b){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}


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

main() {
  int A, B, C; cin >> A >> B >> C;
  bool ans = false;
  for (int i = 1; i < A * B; i++) {
    if ((i * A) % B == C) {
      ans = true;
      break;
    }
  }
  cout << ( (ans) ? "YES" : "NO" ) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

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

#define pb push_back
#define mp make_pair
#define st first
#define nd second

const int MOD = 1000000007;

char buf[100];

int main() {
  // ios_base::sync_with_stdio(0);

  scanf("%s", buf);
  buf[strlen(buf)-8] = 0;
  printf("%s\n", buf);
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline ll read()
{
	ll x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

ll n,a[maxn],ans;
map <ll,ll> p,C,V;

int main()
{
	n=read(); rep(i,1,n) a[i]=read();
	rep(i,1,n)
	{
		ll nw=1,res=1;
		for(ll j=2;j*j*j<=a[i];j++)
		{
			if(a[i]%j==0)
			{
				int cnt=0;
				while(a[i]%j==0) a[i]/=j,cnt++; cnt%=3;
				if(cnt)
				{
					nw*=pow(j,cnt);
					res*=pow(j,3-cnt);
				}
			}
		}
		ll tmp=a[i],q=sqrt(a[i]); nw*=a[i];
		if(q*q==tmp) res*=q; else res*=a[i]*a[i];
		p[nw]=res; p[res]=nw; C[nw]++;
	}
	for(map<ll,ll>::iterator it=p.begin();it!=p.end();it++)
	{
		pair <ll,ll> p2=*it;
		if(V[p2.first]||V[p2.second]||p2.first==1) continue;
		if(C[p2.second])
		{
			ans+=max(C[p2.first],C[p2.second]);
			V[p2.first]=1; V[p2.second]=1;
		}
	}
	cout<<ans+(C[1]>=1)<<endl;
	return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b[100000],c,cmp,data,m,h,w,x,y,xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> n >> a;
       rep(i,n){
           cin >> b[i];
       }
       sort(b,b+n);
       reverse(b,b+n);
       rep(i,a){
           ans+=b[i];
       }
       Cout(ans);
return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	double R; cin>>R; cout<<setprecision(10)<<fixed<<2*2*acos(0)*R<<endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;

ll gcd(ll a, ll b) {
  while (b) {
    ll c = b;
    b = a % b;
    a = c;
  }
  return a;
}

ll lcm(ll a, ll b) {
  if (!a || !b) return 0;
  return a * b / gcd(a, b);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b;
  cin >> a >> b;
  cout << lcm(a, b);
  return 0;
}


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

// Order statistics tree (if supported by judge!):
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// template<class TK, class TM> using order_tree = tree<TK, TM, less<TK>, rb_tree_tag, tree_order_statistics_node_update>;
// iterator	find_by_order(int r) (zero based)
// int		order_of_key(TK v)
// template<class TV> using order_set = order_tree<TV, null_type>;

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

template<class T> int sz(const vector<T> &v) { return (int) v.size(); }

template<class T> ostream& operator<<(ostream &os, vector<T> v) {
	os << "\n[";
	for(T &x : v) os << x << ',';
	return os << "]\n";
}

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

const int MAXN = 1'000'001;
const int mod = 1e9 + 7;

int sp[MAXN];

int mpows[MAXN] = {};

ll modpow(ll b, ll e) {
	ll r = 1;
	while (e) {
		if (e & 1)
			r = (r*b) % mod;
		b = (b*b) % mod;
		e >>= 1;
	}
	return r;
}

ll modinv(ll x) { return modpow(x, mod-2); }


void run() {
	REP(i, MAXN) sp[i] = i;

	for (int i = 2; i*i < MAXN; i++) {
		if (sp[i] != i) continue;
		// i is prime
		for (int j = i*i; j < MAXN; j += i)
			if (sp[j] == j) sp[j] = i;
	}

	int n;
	cin >> n;
	vi A(n);
	for (int &x : A) cin >> x;

	for (int x : A) {
		int y = x;
		while (y > 1) {
			int p = sp[y], e = 0;
			while (y % p == 0) y /= p, e++;

			mpows[p] = max(mpows[p], e);
		}
	}

	ll D = 1LL;
	REP(i, MAXN) {
		if (mpows[i] == 0) continue;
		while (mpows[i] > 0) {
			D = (D * i) % mod;
			mpows[i]--;
		}
	}

	ll ans = 0;
	for (int x : A) {
		ans = (ans + D*modinv(x)) % mod;
	}
	cout << ans << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}


Measured memory_bytes: 7808
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

ll read() {
	ll X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

int main() {
	ll n=read(),m=read();
	puts(abs(n-m)<=1?"Brown":"Alice");
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,tmp;

main() {
    cin >> n;
    for(int i=1;;i++) {
        tmp += i;
        if (tmp >= n) {
            cout << i << endl;
            return 0;
        }
    }
}




Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var n = IO.RInt;
            var a = IO.RSInt;

            var oddCnt = a.Where(x => x % 2 == 1).Count();
            var twoCnt = a.Where(x => (x % 2 == 0 && x % 4 != 0)).Count();
            var fourCnt = a.Where(x => x % 4 == 0).Count();

            if (twoCnt > 0)
            {
                IO.WriteLineYes_or_No(fourCnt >= oddCnt);
            }
            else
            {
                IO.WriteLineYes_or_No(fourCnt + 1 >= oddCnt);
            }
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

Measured memory_bytes: 28944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	/**
	 * AOJ002 Digit Number
	 *
	 * @param args
	 * @throws IOException
	 *             ??\?????¨??????
	 */
	public static void main(String[] args) throws IOException {

		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(System.in));

		String strInput = bufferedReader.readLine();
		while (strInput != null) {
			String[] strDigit = strInput.split("\\s");

			int sum = Integer.parseInt(strDigit[0])
					+ Integer.parseInt(strDigit[1]);

			System.out.println(Integer.toString(sum).length());
			strInput = bufferedReader.readLine();
		}

		bufferedReader.close();
	}

}

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


#define debug(x) cout << #x << " = " << x << endl;
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define FOR(it, b, e) for (typeof(b) it = (b); it != (e); ++it)
#define MSET(c, v) memset(c, v, sizeof(c))

const int INF = 0x3F3F3F3F; 
const int NEGINF = 0xC0C0C0C0;
const int NULO = -1;
const double EPS = 1e-10;
const ll mod = 1e9 + 7;

inline int cmp(double x, double y = 0) 
{  
  if(fabs(x - y) < EPS)
    return 0;
  return x > y ? 1 : -1;
}

ll exp(ll a, ll b)
{
  ll ans = 1;
  while(b)
  {
    if(b & 1)
      ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}

const int maxn = 85;
ll fat[maxn], inv[maxn];

ll C(int n, int k)
{
  if(n < k) 
    return 0;
  if(n < 0 || k < 0) 
    return 0;
  return (((fat[n] * inv[k]) % mod) * inv[n - k]) % mod;
}

void initFactorials()
{
  fat[0] = 1;
  inv[0] = 1;
  for(int i = 1; i < maxn; i++)
  {
    fat[i] = (i * fat[i-1]) % mod;
    inv[i] = exp(fat[i], mod - 2);
  }
}

int dp[maxn][maxn][2 * maxn * maxn];

ll a[maxn][maxn];

ll b[maxn][maxn];

int n,m;

int main()
{
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for(int i = 0 ; i < n; i++)
    for(int j = 0; j < m; j++)
      cin >> a[i][j];
  
  for(int i = 0 ; i < n; i++)
    for(int j = 0; j < m; j++)
      cin >> b[i][j];
  
  dp[0][0][abs(a[0][0] - b[0][0])] = true;
  for(int i = 0; i < n; i++)
  {
    for(int j = 0 ; j < m; j++)
    {
      for(int k = 0; k < (n + m) * maxn; k++)
      {
        if(i > 0)
        {
          dp[i][j][k] = dp[i - 1][j][k + abs(a[i][j] - b[i][j])] |
                        dp[i - 1][j][abs(k - abs(a[i][j] - b[i][j]))];
        }
        if(j > 0)
        {
          dp[i][j][k] = dp[i][j][k] |
                        dp[i][j - 1][k + abs(a[i][j] - b[i][j])] |
                        dp[i][j - 1][abs(k - abs(a[i][j] - b[i][j]))];
        }
      }
    }
  }

  for(int i = 0; i < (n + m) * maxn; i++)
  {
    if(dp[n - 1][m - 1][i] == 1)
    {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 365004
<?php
//error_reporting(0);
//$A = explode(" ",trim(fgets(STDIN)));
//$N=trim(fgets(STDIN));
list($A,$B) = explode(" ",trim(fgets(STDIN)));
if (is_square($A.$B)) {
  printf("Yes\n");
}
else {
  printf("No\n");
}

function is_square($n)
{
   $sqrt = floor(sqrt($n));
   return ($sqrt*$sqrt == $n);
}


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

int main() {

    int n;
    cin >> n;
    bool flag = false;
    for (int i = 1; i < 10; i++) {
        if (n%i==0 && n/i < 10) {
            flag=true;
            break;
        }
    }
    cout << (flag?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
/*  ex. final-2
	uchino.s.ac
	Shunsuke Uchino */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define SIZE 5050


char* reverseString(char* str);
int max(int a, int b);

int main(void) {
    char str1[SIZE], str2[SIZE];
    int str1len, str2len, i, j, anscount = 0;
    int dp[SIZE][SIZE];
    char ansstr[SIZE];
    
    /* dpテーブルを初期化する */
    memset(dp,0,sizeof(dp));

    /* 入力を受け取る */
    fgets(str1,SIZE,stdin);
    fgets(str2,SIZE,stdin);
    str1len = strlen(str1);
    str2len = strlen(str2);

    if (str1[str1len - 1] == '\n') {
        str1[--str1len] = '\0';
    }
    if (str2[str2len - 1] == '\n') {
        str2[--str2len] = '\0';
    }

    /* 最長共通部分文字列の長さをdpテーブルを更新しながら求める */
    for (i = 0; i < str1len; i++) {
        for (j = 0; j < str2len; j++) {
            if (str1[i] == str2[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]);
            }
        }
    }
    anscount = dp[str1len][str2len];
    ansstr[anscount] = '\0';
    /* dpテーブルの右下からLCSの長さをもとに最長共通部分文字列を求める */
    i = str1len;
    j = str2len;
    while (anscount > 0) {
        /* 最長共通部分文字列の一部ならば答えの文字列に追加する */
        if (dp[i][j] == dp[i - 1][j - 1] + 1 && str1[i - 1] == str2[j - 1]) {
            ansstr[--anscount] = str1[i - 1];
            i--; 
            j--;
        } else {
            /* そうでないならばdpテーブルの値に応じて遷移 */
            if (dp[i][j] > dp[i][j - 1]) {
                i--;
            } else {
                j--;
            }
        }
    }
    
    /* 逆側から遡っていったので文字列を反転して出力する */
    printf("%s\n",ansstr);
    
    return 0;
}

/* 文字列を反転させる関数 */
char* reverseString(char* str) {
    char* ansstr;
    int len, i;

    len = strlen(str);
    ansstr = (char*)malloc(sizeof(char) * len);
    
    for (i = 0; i < len; i++) {
        ansstr[i] = str[len - i - 1];
    }
    return ansstr;
}

/* 最大値を求める関数 */
int max(int a, int b) {
    return a > b ? a : b;
}

Measured memory_bytes: 99840
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    int X;
    int ans;
    cin >> X;
    bool flag = true;
    if(X==2) cout << X << endl;
    else{
    while(flag){
        bool prime = true;
        for(int i=2; i < sqrt(X)+1; ++i){
            if(X % i == 0){
                prime = false;
                break;
            }
        }
        if(prime){
            flag = false;
        }
        else X++;
    }
    cout << X << endl;
    }
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll N, A, B;
vector<ll> X;

int main() {
	cin >> N >> A >> B;
	X.resize(N + 1, 0);
	for (ll n = 1; n <= N; n++)cin >> X[n];
	ll ans = 0;
	for (ll n = 2; n <= N; n++) {
		if (A * (X[n] - X[n - 1]) <= B)ans += A * (X[n] - X[n - 1]);
		else ans += B;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
  string a;
  cin>>a;
  if(a=="SUN"){
    cout<<7<<endl;
  }
  else if(a=="MON"){
    cout<<6<<endl;
  }
  else if(a=="TUE"){
    cout<<5<<endl;
  }
  else if(a=="WED"){
    cout<<4<<endl;
  }
  else if(a=="THU"){
    cout<<3<<endl;
  }
  else if(a=="FRI"){
    cout<<2<<endl;
  }
  else if(a=="SAT"){
    cout<<1<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N, M, P;
int A[5000], B[5000], C[5000];
ll dist[2500];
int cnt[2500];

vector<int> g[2][2500];
bool done[2][2500];

void dfs(int dir, int u) {
	if (done[dir][u]) return;
	done[dir][u] = true;
	
	for (int v : g[dir][u]) if (!done[dir][v]) dfs(dir, v);
}

int main() {
	cin >> N >> M >> P;
	REP(i, M) {
		scanf("%d %d %d", A + i, B + i, C + i);
		A[i]--; B[i]--;
		C[i] -= P;
		
		g[0][A[i]].push_back(B[i]);
		g[1][B[i]].push_back(A[i]);
	}
	
	dfs(0, 0);
	dfs(1, N - 1);
	
	fill(dist, dist + N, -longINF);
	dist[0] = 0;
	
	bool ng = false;
	REP(i, M + 1) {
		vector<int> cur;
		bool update = false;
		REP(j, M) if (dist[A[j]] != -longINF && chmax(dist[B[j]], dist[A[j]] + C[j])) {
			update = true;
			cur.push_back(B[j]);
		}
		if (!update) break;
		
		if (i == M) {
			for (int u : cur) if (done[0][u] && done[1][u]) ng = true;
		}
	}
	
	ll ans = max(dist[N - 1], 0ll);
	if (ng) ans = -1;
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------


int main(){
    ll n;
    cin>>n;
    vector<string>s(n);
    for(int i=0;i<n;i++){
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
    }
    map<string,ll>rensou;
    for(int i=0;i<n;i++){
        rensou[s[i]]++;
    }
    ll ans=0;
    for(auto f:rensou){
        if(f.second>1)
        ans+=nCr(f.second,2);
    }
    cout<<ans<<endl;
}





Measured memory_bytes: 18176
(let* ((a (read))
       (b (sort (loop for i from 1 to a collect (read)) #'<))
       (result 1)
       (limit (expt 10 18)))
  (format t "~A~%"
          (loop for i in b
                do (setf result (* result i))
                   (when (> result limit)
                     (return -1))
                finally (return result))))


Measured memory_bytes: 78440
#include<bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<int,int>
#define debug(a) cout<<a<<'\n'
#define maxn 100009
#define MOD 1000000007
#define INF (int)300009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    ll vet[maxn];
    for(int i=0;i<n;i++){
        cin>>vet[i];
    }
    ll ans=vet[0];
    for(int i=1;i<n;i++){
        ans^=vet[i];
    }
    if(ans==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 1024