akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 7;

pair <int, int> a[3005];
long long dp[3005], fact[200005], inv[200005];

long long my_pow(long long a, long long lv) {
	if (lv == 0) return 1LL;
	long long tmp = my_pow(a, lv / 2);
	tmp = (tmp * tmp) % MOD;
	if (lv & 1) tmp = (tmp * a) % MOD;
	return tmp;
}

long long ncr(int x, int y) {
	long long res = fact[x];
	res = (res * inv[y]) % MOD;
	res = (res * inv[x - y]) % MOD;
	return res;
}

int main() {
	int h, w, n;
	scanf("%d%d%d", &h, &w, &n);
	
	for (int i = 0; i < n; i++) {
		scanf("%d%d", &a[i].first, &a[i].second);
	}
	
	a[n] = make_pair(h, w);
	n++;
	
	sort(a, a + n);
	
	fact[0] = 1;
	for (int i = 1; i <= 200000; i++) fact[i] = (fact[i - 1] * i) % MOD;
	for (int i = 0; i <= 200000; i++) inv[i] = my_pow(fact[i], MOD - 2);
	
	for (int i = 0; i < n; i++) {
		dp[i] = ncr(a[i].first + a[i].second - 2, a[i].first - 1);
		for (int j = 0; j < i; j++) {
			if (a[j].first <= a[i].first && a[j].second <= a[i].second) {
				long long minus = (dp[j] * ncr(a[i].first + a[i].second - a[j].first - a[j].second, a[i].first - a[j].first)) % MOD;
				dp[i] = (dp[i] - minus + MOD) % MOD;
			}
		}
	}
	
	printf("%lld\n", dp[n - 1]);
}


Measured memory_bytes: 3456
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

void solve() {
    string s;
    cin >> s;
    int len = s.size() - 2;
    while (s.substr(0, len/2) != s.substr(len/2, len/2)) {
        //cout << s.substr(0, len/2) << " - " << s.substr(len/2, len/2) << endl;
        len -= 2;
    }
   // cout << s.substr(0, len/2) << " - " << s.substr(len/2, len/2) << endl;
    cout << len;
}

int main() {

	solve();
    return 0;
}


Measured memory_bytes: 3220
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
 
static const int tx[] = {+0,+1,+0,-1};
static const int ty[] = {-1,+0,+1,+0};
 
static const double EPS = 1e-8;


map<vector<int>,int> dp;

int dfs(vector<int>& buns,int sum,int comb_i,vector<vector<int> >& all_combinations){
  if(comb_i >= all_combinations.size()) return sum;
  if(dp.find(buns) != dp.end()) return dp[buns];

  vector<int> prev = buns;
  bool isok = true;
  for(int weight = 1; weight <= 9; weight++){
    int use_count = all_combinations[comb_i][weight];
    buns[weight] -= use_count;
    if(buns[weight] < 0){
      isok = false;
      break;
    }
  }

  int res = 0;
  if(isok){
    res = max(sum + 1,dfs(buns,sum + 1,comb_i,all_combinations));
  }
  buns = prev;
  res = max(res,dfs(buns,sum,comb_i + 1,all_combinations));

  return (dp[buns] = max(res,dp[buns]));
}

void make_combinations(int weight,int sum,vector<int>& current,vector<vector<int> >& all_combinations){
  if(sum >= 10){
    if(sum == 10) all_combinations.push_back(current);
    return;
  }
  if(weight >= 10) return;

  for(int use_count = 0; use_count <= 10; use_count++){
    current[weight] = use_count;
    make_combinations(weight + 1,sum + weight * use_count,current,all_combinations);
    current[weight] = 0;
  }
}

int main(){
  int total_buns;
  
  vector<vector<int> > all_combinations;
  vector<int> current(11);
  make_combinations(1,0,current,all_combinations);

  while(~scanf("%d",&total_buns)){
    if(total_buns == 0) break;
    vector<int> buns(11);
    dp.clear();

    for(int i = 0; i < total_buns; i++){
      int weight;
      scanf("%d",&weight);
      buns[weight]++;
    }

    int greedy_sum = 0;
    for(int weight = 1; weight <= 5; weight++){
      if(weight == 5){
        int use_count = (buns[weight] / 2) * 2;
        greedy_sum += use_count / 2;
        buns[weight] -= use_count;
      }
      else{
        int use_count = min(buns[weight],buns[10 - weight]);
        greedy_sum += use_count;
        buns[weight] -= use_count;
        buns[10 - weight] -= use_count;
      }
    }

    printf("%d\n",greedy_sum + dfs(buns,0,0,all_combinations));
  }
}

Measured memory_bytes: 8572
import java.util.*;
 
public class Main { //クラス名はMain
    public static void main(String[] args) {
      //整数の入力
      Scanner sc = new Scanner(System.in);
      long n = Long.parseLong(sc.next());
      long total = 0;
      for(long i=0; i<=n; i++){
        if(i % 3 == 0 || i % 5 == 0 ){
        }else{
          total += i;
        }
      }
      System.out.println(total);   
    }
}


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

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]


    (n, k) = [int(e) for e in lines[0].split(' ')]
    h = [int(e) for e in lines[1].split(' ')]

    return (n, k, h)


def solve(n, k, h):

    h.sort(reverse=True)
    
    remained = h[k:]

    return sum(remained)


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Measured memory_bytes: 29452
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) //fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

/*
const int N=,P=;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }
*/


const int N = 19;
typedef long long ll;

int n;
ll a[N]; 
map<pair<int, int>, ll> f[N][N];

ll dp(int l, int r, int xl, int xr) {
	if (f[l][r].count(mp(xl, xr))) return f[l][r][mp(xl, xr)]; 
	ll &res = f[l][r][mp(xl, xr)];
	res = -1;
	rep(m, l + 1, r - 1) {
		ll t = dp(l, m, xl, xl + xr) + dp(m, r, xl + xr, xr) + (xl + xr) * a[m]; 
		if (res == -1) res = t; else res = min(res, t); 
	}
	if (l + 1 == r) res = 0;
	return res;
}

int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("d.in", "r", stdin); 
#endif
	read(n); 
	rep(i, 1, n) read(a[i]); 
	printf("%lld\n", dp(1, n, 1, 1) + a[1] + a[n]);
	return 0; 
}


Measured memory_bytes: 33024
#include<stdio.h>
int A[100000],n;

int binarySearch(int);

int main(){
  int i,q,k,sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&k);
    if(binarySearch(k)==k) sum++;
  }
  printf("%d\n",sum);
  
  return 0;
}

int binarySearch(int key){
  int left=0,right=n,mid;

  while(left<right){
    mid=(left+right)/2;
    if(key==A[mid]) return A[mid];
    if(key>A[mid]) left=mid+1;
    else if(key<A[mid]) right=mid;
  }
  return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N,M;
    Scd2(N,M);

    bool e[701][701] = {};

    int x,y;
    Rep(i,M){
        Scd2(x,y);
        x--,y--;
        e[x][y] = true;
        e[y][x] = true;
    }
    Rep(i,N) e[i][i] = true;

    bool biparitite = true;
    stack<int> st;
    vi id(N,-1);
    vi col(N,0);
    vii sum;
    int tid = 0;
    Rep(i,N){
        if( id[i] == -1 ){
            pii cnt(0,0);
            st.push(i);
            id[i] = tid;
            col[i] = 1;
            while(st.size()){
                int from = st.top();
                int c = col[from];
                if( c>0 ) cnt.first++;
                else cnt.second++;
                st.pop();
                Rep(to,N){
                    if( !e[from][to] ){
                        if( c == col[to] ) biparitite = false;
                        if( id[to] != -1 ) continue;
                        st.push(to);
                        id[to] = tid;
                        col[to] = -c;
                    }
                }
            }
            tid++;
            sum.push_back(cnt);
        }
    }

    if( !biparitite ) {
        printf ("%d\n", -1 );
        return 0;
    }

    static bool dp[701][701] = {};
    dp[0][0] = true;
    for( pii s : sum ){
        RRep(i,N+1) RRep(j,N+1){
            if( dp[i][j] ){
                int ii,jj;
                ii = i + s.first; jj = j + s.second;
                if( ii <= N && jj <= N ) dp[ii][jj] = true;
                ii = i + s.second; jj = j + s.first;
                if( ii <= N && jj <= N ) dp[ii][jj] = true;
            }
        }
    }

    ll ans = -1;
    Rep(i,N+1){
        if( dp[i][N-i] ) ans = max( ans, i*(N-i) );
    }

    printf ("%lld\n", N*(N-1)/2-ans );


    return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;


const int MAX_N = 1010;
vec nCm(MAX_N+1,0);
vec fact(MAX_N+1,0),fact_inv(MAX_N+1,0);

ll fastpow(ll a, ll pw) {
	ll res = 1;
	while (pw) {
		if (pw & 1) res = res * a % MOD;
		a = a * a % MOD;
		pw >>= 1;
	}
	return res;
}
void makefact(ll n){//MODは素数かつnより大きい
    ll ans = 1;
    fact.at(0) = ans;
    fact_inv.at(0) = ans;
    reps(i,1,n+1){
        (ans *= i)%=MOD;
        fact.at(i) = ans;
        fact_inv.at(i) = fastpow(ans,MOD-2);
    }
    return;
}
ll C, D;
mat memo(1001, vec(1001,-1));
ll dfs(ll rest, ll mem){
    if(mem == B + 1) return (rest == 0 ? 1 : 0);
    if(rest < 0) return 0;
    if(memo[rest][mem] != -1) return memo[rest][mem];
    ll ans = dfs(rest, mem + 1), alpha = fastpow(fact_inv.at(mem), C);
    for(int g_num = C; rest >= g_num * mem && g_num <= D; ++g_num){
        (ans += ((dfs(rest - g_num * mem, mem + 1) * alpha)%MOD)*fact_inv.at(g_num))%=MOD;
        (alpha *= fact_inv.at(mem))%=MOD;
    }
    memo[rest][mem] = ans;
    return ans;
}

int main() {
    cin>>N>>A>>B>>C>>D;
    makefact(N);
    ll ans = dfs(N, A);
    reps(i,1,N+1) (ans *= i)%=MOD;
    cout<<ans<<endl;
}

Measured memory_bytes: 8192
mod = 1000000007
N,M = [int(i) for i in input().split()]
A = []
for _ in range(M):
    A.append(int(input()))
steps = [0]*N
for a in A:
    steps[a-1] = 1
cnt = []
for n in range(N):
    if n == 0:
        if steps[n]==0:
            cnt.append(1)
        elif steps[n]==1:
            cnt.append(0)
    elif n == 1:
        if steps[n]==0:
            cnt.append(cnt[n-1]+1)
        elif steps[n]==1:
            cnt.append(0)
    elif steps[n] == 0:
        cnt.append((cnt[n-2]+cnt[n-1])%mod)
    elif steps[n] == 1:
        cnt.append(0)
print(cnt[-1])

Measured memory_bytes: 8748
from sys import stdin
N = int(stdin.readline().rstrip())
ran = [int(x) for x in stdin.readline().rstrip().split()]
ran.sort(reverse=True)

gen = len(ran) - 2
goukei = ran[0]
if gen % 2 == 0:
  for i in range(int(gen/2)):
    goukei += 2 * ran[i + 1]
else:
  for i in range(int((gen-1)/2)):
    goukei += 2 * ran[i + 1]
  goukei += ran[i + 2]

print(goukei)

Measured memory_bytes: 31644
#!/usr/bin/env python3

from collections import defaultdict

MOD = 1000000007
fact = []

def main():
    init_fact(2 * 10 ** 5)
    n, m = map(int, input().split())
    pf = prime_factor(m)
    cnt = defaultdict(int)
    for x in pf:
        cnt[x] += 1
    res = 1
    for k, v in cnt.items():
        res *= combi(n - 1 + v, v)
        res %= MOD
    print(res)

def combi(n, k):
    numera = fact[n]
    denomi = (fact[n - k] * fact[k]) % MOD
    return (numera * inv(denomi)) % MOD

def init_fact(maxn):
    assert len(fact) == 0
    fact.append(1)
    for i in range(1, maxn + 1):
        fact.append((fact[i - 1] * i) % MOD)

def inv(n):
    return pow(n, MOD - 2)

def pow(n, p):
    if p == 0:
        return 1
    elif p % 2 == 0:
        x = pow(n, p // 2)
        return (x * x) % MOD
    else:
        x = pow(n, p - 1)
        return (x * n) % MOD

def prime_factor(n):
    # n の素因数を重複有りの昇順リストで返す。O(sqrt n)
    resid = n
    result = []
    i = 2
    while True:
        if resid <= 1:
            return result
        if i ** 2 > resid:
            result.append(resid)
            return result
        if resid % i == 0:
            result.append(i)
            resid //= i
        else:
            i += 1

if __name__ == "__main__":
    main()


Measured memory_bytes: 11508
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> ps(n);
    for (auto& p : ps)
    {
        cin >> p;
    }
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (ps[i] == i + 1)
        {
            count++;
        }
    }
    if (count == n || count == n - 2)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#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>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int n; cin>>n;
    vector<int> p(n);
    for(int i=0; i<n; i++) cin>>p[i];

    vector<int> num2i(n+1, -1);
    for(int i=0; i<n; i++){
        num2i[p[i]] = i;
    }

    set<int> st;
    int ans = 0;
    for(int i=1; i<=n; i++){
        st.emplace(num2i[i]);
        auto itr = st.find(num2i[i]);
        if(itr == st.begin()) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

int x, n, a, sum;

int main(){
	cin>>x>>n;
	
	for(int i=1; i<=n; i++){
		cin>>a;
		sum+=a;
	}
	if(sum>=x) cout<<"Yes\n";
	else cout<<"No\n";
}


Measured memory_bytes: 256
import java.util.*;

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

        int dx [] = {1, 1, 0, -1, -1, -1, 0, 1};
        int dy [] = {0, 1, 1, 1, 0, -1, -1, -1};
        char[][] board = new char [50][50];
        int H = sc.nextInt();
        int W = sc.nextInt();

        for (int i=0; i<H; i++) {
            String s = sc.next();
            for(int j=0; j<W; j++) {
                board[i][j] = s.charAt(j); 
            }
        }

        for (int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                if (board[i][j] == '.') {
                    int cnt = 0;
                    for (int k = 0; k < 8; k++) {
                        int x = i + dx[k];
                        int y = j + dy[k];
                        if (x >= 0 && x < H && y >= 0 && y < W && board[x][y] == '#') cnt++;
                    }
                    board[i][j] = (char) ('0' + cnt);
                }
            }
        }

        for (int i=0; i<H; i++) {
            for(int j=0; j<W; j++) {
                System.out.print(board[i][j]); 
            }
            System.out.println();
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
using ll = long long;

using namespace std;

int main() {
    int N;
    cin >> N;
    ll primeCount[101];
    for(int i = 0; i < 101; i++){
        primeCount[i] = 0;
    }
    for(int i = 1; i <= N; i++){
        int ii = i;
        while(ii != 1){
            bool isP = true;
            for(int tmp = 2; tmp < 10; tmp++){
                if(ii % tmp == 0){
                    ii = ii / tmp;
                    primeCount[tmp]++;
                    isP = false;
                    break;
                }
            }
            if(isP){
                primeCount[ii]++;
                break;
            }
        }
    }
    for(int i = 0; i < 101; i++){
        //cout << primeCount[i] << ", ";
    }
    //cout << endl;
    ll count1 = 0;
    ll count3 = 0;
    ll count5 = 0;
    ll count15 = 0;
    ll count25 = 0;
    ll count75 = 0;
    for(int i = 0; i < 101; i++){
        ll tmp = primeCount[i];
        if(tmp > 0){
            count1++;
        }
        if(tmp >= 2){
            count3++;
        }
        if(tmp >= 4){
            count5++;
        }
        if(tmp >= 14){
            count15++;
        }
        if(tmp >= 24){
            count25++;
        }
        if(tmp >= 74){
            count75++;
        }
    }
    //cout << count1 << " " << count3 << " " << count5 << " " << count15 << " " << count25 << " " << count75;
    ll result = 0;
    result += max((ll)0,count75);
    result += max((ll)0,count25 * (count3 - 1));
    result += max((ll)0,count15 * (count5 - 1));
    result += max((ll)0,count5 * (count5 - 1) * (count3 - 2) / 2);
    cout << result << endl;

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int x,y;
	scanf("%d %d",&x,&y);
	if(x==1 && y==2 || x==2 && y==1){
		printf("3");
	}
	if(x==2 && y==3 || x==3 && y==2){
		printf("1");
	}
	if(x==1 && y==3 || x==3 && y==1){
		printf("2");
	}
	return 0;
}

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

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}

int atcoder(){
  int x,y;
  cin>>x>>y;
  bool ans=false;
  if(x>=2*y-1) ans=true;
  YESNO(ans);
  

    return 0;
}

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


Measured memory_bytes: 256
import collections
n = raw_input()
cc = collections.Counter(map(int, raw_input().split(' ')))
nums = sorted(cc.keys()) #his.sort()
res = 0
for i in range(len(nums)-2):
	for j in range(i+1, len(nums)-1):
		for k in range(j+1, len(nums)):
			if nums[i] + nums[j] > nums[k]:
				res += cc[nums[i]] * cc[nums[j]] * cc[nums[k]]
print res

Measured memory_bytes: 85524
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int X, Y;
  cin >> X >> Y;
  int ans = 0;
  if (X == 3) {
    ans += 100000;
  } else if (X == 2) {
    ans += 200000;
  } else if (X == 1) {
    ans += 300000;
  }
  if (Y == 3) {
    ans += 100000;
  } else if (Y == 2) {
    ans += 200000;
  } else if (Y == 1) {
    ans += 300000;
  }
  if (X == 1 and Y == 1) {
    ans += 400000;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    rep(i,n) cin>>v[i];
    rep(i,n+1){
        if(n<=k+(i-1)*(k-1)){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
	int p[20];
	int n;
	int count=0;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for (int i=0;i<n-2;i++){
		if(p[i]<p[i+1] && p[i+1]<p[i+2])
			count++;
		if(p[i+2]<p[i+1]&&p[i+1]<p[i])
			count++;
		
	}
	printf("%d",count);
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
N = int(input())
C = [0] * (N - 1)
S = [0] * (N - 1)
F = [0] * (N - 1)

for x in range(N - 1):
    C[x], S[x], F[x] = map(int, input().split())

for i in range(1, N + 1):
    t = 0
    for n in range(i - 1, N - 1):
        if t <= S[n]:
            t = S[n]
        else:
            if t % F[n] > 0:
                t = (t // F[n] + 1) * F[n]
        t = t + C[n]
    print(t)


Measured memory_bytes: 3064
#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>;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int t = 0;
    while (1) {
        if (t == 0) {
            c -= b;
            if (c <= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        } else {
            a -= d;
            if (a <= 0) {
                cout << "No" << endl;
                return 0;
            }
        }
        t ^= 1;
    }
    return 0;
}


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,a,b,c,d; cin>>n>>a>>b>>c>>d;
  string s; cin>>s;
  a--,b--,c--,d--;
  if(b<d&&d<c){
    irep(i,a,c){
      if(s[i]=='#'&&s[i+1]=='#'){
        cout<<"No"<<endl;
        return 0;
      }
    }
    irep(i,b,d+1){
      if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'){
        cout<<"Yes"<<endl;
        return 0;
      }
    }
    cout<<"No"<<endl;
  }
  else{
    irep(i,a,d){
      if(s[i]=='#'&&s[i+1]=='#'){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
  }

  
}

Measured memory_bytes: 592
#include <stdio.h>
int main(void){
    int H,W;
    scanf("%d %d",&H,&W);
    char moji[150][150];
    for(int i=0;i<H;i++){
        scanf("%s",moji[i]);
    }
    for(int i=0;i<W+2;i++){
        printf("#");
    }
    printf("\n");
    for(int i=0;i<H;i++){
        printf("#%s#\n",moji[i]);
    }
    for(int i=0;i<W+2;i++){
        printf("#");
    }
    return 0;
}


Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int h,w,k;
  cin >> h >> w >> k;
  vector<string> g(h);
  vector<vector<int> > p(h,vector<int>(w));
  rep(i,h){
    cin >> g[i];
  }
  int cnt=1;
  rep(i,h)rep(j,w){
    if(g[i][j]=='#'){
      p[i][j]=cnt;
      cnt++;
    }
  }
  rep(i,h)rep(j,w){
    if(j-1>=0&&p[i][j]==0) p[i][j]=p[i][j-1];
  }
  rep(i,h)for(int j=w-1;j>=0;j--){
    if(j+1<w&&p[i][j]==0) p[i][j]=p[i][j+1];
  }
  rep(j,w)rep(i,h){
    if(i-1>=0&&p[i][j]==0) p[i][j]=p[i-1][j];
  }
  rep(j,w)for(int i=h-1;i>=0;i--){
    if(i+1<h&&p[i][j]==0) p[i][j]=p[i+1][j];
  }
  rep(i,h){
    rep(j,w){
    cout << p[i][j] << " ";
    }cout << endl;
  }
  
}

Measured memory_bytes: 1280
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(void){
    string A,B;
    cin>>A>>B;

    int C=stoi(A+B);

    for(int i=1;i<=1000;i++){
        if(i*i==C){
            cout<<"Yes"<<endl;
            return 0;
        }
    }

    cout<<"No"<<endl;


}


Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<vector<int> > G(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b;
		cin >> a >> b; --a, --b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vector<int> dist(N, -1);
	dist[0] = 0;
	queue<int> que;
	que.push(0);
	while (!que.empty()) {
		int u = que.front(); que.pop();
		for (int i : G[u]) {
			if (dist[i] == -1) {
				dist[i] = dist[u] + 1;
				que.push(i);
			}
		}
	}
	vector<int> col(N);
	for (int i = 0; i < N; ++i) {
		col[i] = dist[i] % 2;
	}
	int ca = 0, cb = 0;
	for (int i = 0; i < N; ++i) {
		if (col[i] == 0) ++ca;
		else ++cb;
	}
	if (ca < cb) {
		for (int i = 0; i < N; ++i) {
			col[i] ^= 1;
		}
		swap(ca, cb);
	}
	int ga = (N + 2) / 3, gb = (N + 1) / 3, gc = N / 3;
	vector<int> preperm(N, -1);
	if (cb >= gb) {
		int ra = ga, rb = gb;
		for (int i = 0; i < N; ++i) {
			if (col[i] == 0) {
				if (ra > 0) preperm[i] = 1, --ra;
				else preperm[i] = 0;
			}
			if (col[i] == 1) {
				if (rb > 0) preperm[i] = 2, --rb;
				else preperm[i] = 0;
			}
		}
	}
	else {
		int ra = ga, rb = gb;
		for (int i = 0; i < N; ++i) {
			if (col[i] == 0) {
				if (ra > 0) preperm[i] = 1, --ra;
				else if (rb > 0) preperm[i] = 2, --rb;
				else preperm[i] = 0;
			}
			else {
				preperm[i] = 0;
			}
		}
	}
	vector<int> perm(N, -1);
	int va = 1, vb = 2, vc = 3;
	for (int i = 0; i < N; ++i) {
		if (preperm[i] == 0) {
			perm[i] = vc;
			vc += 3;
		}
		if (preperm[i] == 1) {
			perm[i] = va;
			va += 3;
		}
		if (preperm[i] == 2) {
			perm[i] = vb;
			vb += 3;
		}
	}
	for (int i = 0; i < N; ++i) {
		if (i) cout << ' ';
		cout << perm[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 16880
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const int EPS = 1e-9;
const int MOD = 1e9+7;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  int n;
  cin >> n;
  vi A(n);

  REP(i,n){
    cin >> A[i];
  }
  
  ll ans = 0;
  int right = 0;//
  int sum = 0;
  REP(i,n){
    while((right < n)&((A[right] + sum )== (A[right] ^ sum))){
      sum += A[right];
      if(right <= n)
      right++;
      if(right >= n) break;
    }
    ans += right - i;
    sum -= A[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
// #include <vector>
#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;
int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n) cin >> a[i];
  int ans = 0;
  int x=0;
  rep(i,n){
    ans = ((ll)ans + (ll)a[i]*x)%mod;
    x = ( x + a[i]) % mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3968
typedef long long ll;

#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
        ll N;
        ll res = 10000000000;
        cin >> N;
        for (ll i = 1; i <= sqrt(N); i++) {
                if(N%i!=0) continue;
                res = min(res,max(i,N/i));
        }
        cout << (int)log10(res)+1 << endl;

        return 0;
}


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

int main()
{
    char c;
    cin >> c;
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
n=int(input())
tail=[int(input())]
import bisect
from collections import deque
tail=deque(tail)
c=1
for i in range(n-1):
    a=int(input())
    p=bisect.bisect_left(tail,a)
    if p==0:
        tail.appendleft(a)
        c+=1
    else:
        tail[p-1]=a
print(c)


Measured memory_bytes: 47832
inf = 10**15
mod = 10**9+7
k,s = map(int, input().split())
ans = 0
for i in range(k+1):
    tmp = s-i
    if tmp >= 0:
        for j in range(k+1):
            t = tmp-j
            if 0 <= t <= k:
                ans += 1
print(ans)

Measured memory_bytes: 40684
#include "bits/stdc++.h"
using namespace std;

vector<pair<int, int> > gc;

double dist(int a, int b) {
	double fr = gc[a].first - gc[b].first;
	double sc = gc[a].second - gc[b].second;
	return sqrt(fr * fr + sc * sc);
}

double cost(vector<int> pm) {
	double res = 0.0;
	for (int i=1; i<pm.size(); i++) {
		res += dist(pm[i], pm[i-1]);
	}
	return res;
}

int main() {
    
	int n;
	cin >> n;
	vector<int> pm;
	for (int i=0; i<n; i++) {
		pm.push_back(i);
		pair<int, int> co;
		cin >> co.first >> co.second;
		gc.push_back(co);
	}
	
	
	double total = 0;
	int nm = 0;
	
	do {
		nm++;
		total += cost(pm);
	} while(next_permutation(pm.begin(), pm.end()));

	cout << setprecision(10) << total / nm << endl;
	
}


Measured memory_bytes: 256
/*Made by Shivam Solanki*/
#include<bits/stdc++.h> 
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define ll long long int
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
typedef queue<int> qii;
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define repllr(i,k,n) for (ll i = n; i >= k; --i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
 
void solve(){
    int n;
    cin>>n;
    vi a(n);
    int sum=0;
    rep(i,0,n){
        cin>>a[i];
        sum+=a[i];
    }
    int avg=round((long double)sum/n);
    // cout<<avg1<<' '<<avg2<<'\n';
    int ans = 0;
    rep(i,0,n){
        ans+=pow(a[i]-avg,2);
    }
    cout<<ans<<'\n';
} 
  
int main(){
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    // fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 512
package main

import(
	"fmt"
	"math"
)

func main(){
	var c int=10000000000000
	var t float64
	fmt.Scan(&t)

	for i:=1;float64(i)<=math.Pow(t, 0.5);i++{
		if int(t)%i==0 && (int(t)/i+i)<c{
			c=int(t)/i+i
		}
	}
	fmt.Println(c-2)
}

Measured memory_bytes: 512
#include <iostream>

int N,K;
int num[100008];
using namespace std;
int gcd(int a,int b) {
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	return gcd(b,a%b);
}
int main() {
	cin >> N >> K;
	int maxv=0;
	int gcdv;
	for(int i=0;i<N;i++) {
		cin >> num[i];
		if(maxv<num[i]) maxv=num[i];
		if(i) {
			gcdv=gcd(num[i],gcdv);
		} else {
			gcdv=num[i];
		}
	}
	if(maxv<K||K%gcdv>0) {
		cout << "IMPOSSIBLE" << endl;
	} else {
		cout << "POSSIBLE" << endl;
	}
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main ()
{
 int i,j;
 for(i=1;i<=9;i++)
 {
     for(j=1;j<=9;j++)
     {
         printf("%dx%d=%d\n",i,j,i*j);
     }
     //printf("\n");
 }

 return 0;

}



Measured memory_bytes: 2048
def main():
    n = int(input())
    s = input()
    ans = s.count('R') * s.count('G') * s.count('B')
    for j in range(n):
        for i in range(j):
            k = j+(j-i)
            if k < n:
                if s[i] == s[j] or s[i] == s[k] or s[k] == s[j]:
                    continue
                ans -= 1

    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 9204
while True:
    a = list(map(str, input().split()))
    if a[0] == "#":
        break
    elif int(a[1]) <= 30:
        print(" ".join(a))
    elif int(a[1]) == 31 and int(a[2]) <= 4:
        print(" ".join(a))
    else:
        a[0] = "?"
        s = int(a[1])
        s -= 30
        a[1] = str(s)
        print(" ".join(a))


Measured memory_bytes: 5600
//B - ∵∴∵:
//Assunto: 
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    string o, e, ans = "";
    int i;
    cin >> o >> e;
    for(i = 0; i < min(o.size(), e.size()); i++) {
        ans += o[i];
        ans += e[i];
    }
    if(i < o.size()) ans += o[i];
    if(i < e.size()) ans += e[i];
    cout << ans << "\n";
}

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

#define ll long long int
#define ull unsigned long long int
#define po2(z) 1<<(ll)z
#define fr(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#define rf(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);--i)
#define modinv(x) powah(x,mod-2)
#define ncr(n,r) (((fact[n]*modinv(fact[n-r]))%mod*modinv(fact[r]))%mod)
#define factorial fact.pb(1);sidha(i,1,MAX)fact.pb((fact[i-1]*i)%mod)
#define TC ll test;cin>>test;while(test--)
#define tej ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod (ll)1000000007
#define MAX 100005

int main(){
ll n,k;
cin>>n>>k;
ll a[n];
ll dp[n];
fr(i,0,n){
dp[i]=1000000007;
}
fr(i,0,n){
	cin>>a[i];
}
dp[0]=0;
for(ll i=0;i<n;i++){
	for(ll j=1;j<=k;j++){
		if(i+j<n){
			dp[i+j]=min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
		}
	}
}
cout<<dp[n-1];


}


Measured memory_bytes: 1792
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define rep(i,n) for(ll i=0;i<n;i++)
typedef long long ll;
using namespace std;

const ll MAX = 1000000;
const ll MOD = 1000000007;

ll fac[MAX];

// テーブルを作る前処理
/*
void COMinit() {
    fac[0] = fac[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
    }
}
*/

ll pow_kai(ll a,ll n){//aのn乗を計算します。
  ll x = 1;
  while(n > 0){//全てのbitが捨てられるまで。
    if(n&1){//1番右のbitが1のとき。
      x = x*a%MOD;
    }
    a = a*a%MOD;
    n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
  }
  return x;
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    ll tmp=1;
    for(ll i=n;i>=n-k+1;i--) tmp = (tmp*i)%MOD;

    return (tmp * pow_kai(fac[k],MOD-2)) % MOD;
}

void chmax(ll &a,const ll &b){
    if(a<b) a=b;
}
void chmin(ll &a,const ll &b){
    if(a>b) a=b;
}


int main()
{

    ll N,K,tmp;
    cin >>N>>K;

    vector<ll> p;

    rep(i,N){
        cin >> tmp;
        p.push_back(tmp);
    }

    sort(p.begin(),p.end());

    ll ans=0;

    rep(i,K){
        ans+=p[i];
    }


  
    cout << ans << endl;


    return 0;


}

Measured memory_bytes: 3624
#include<stdio.h>
#define MM 2000000000
typedef long long ll;
ll L[100003],R[100003];
ll merge(int A[],int l,int r){
	int m=(l+r)/2;
	int n1=m-l;
	int n2=r-m;
	int i;
	ll cnt=0;
	for(i=0;i<n1;i++) L[i]=A[l+i];
	for(i=0;i<n2;i++) R[i]=A[m+i];
	L[n1]=R[n2]=MM;
	int j=0;
	i=0;
	for(int k=l;k<r;k++){
		if(L[i]<=R[j]) A[k]=L[i++];
		else {
			A[k]=R[j++];
			cnt+=(n1-i);
		}
	}
	return cnt;
}

ll mergesort(int A[],int l,int r){
	if(l+1<r){
		int m=(l+r)/2;
		ll v1=mergesort(A,l,m);
		ll v2=mergesort(A,m,r);
		ll v3=merge(A,l,r);
		return v1+v2+v3;
	}
	return 0;
}

int main(){
	int A[200001];
	int i,n,j,k;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	printf("%lld\n",mergesort(A,0,n));
}


Measured memory_bytes: 5100
package main

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

var sc = bufio.NewScanner(os.Stdin)

const inf int = 1050000000

func main() {
	scanInit()

	n := nextInt()
	k := nextInt()
	h := make([]int, n)
	for i := 0; i < n; i++ {
		h[i] = nextInt()
	}

	dp := make([]int, n)
	dp[0] = 0
	for i := 1; i < n; i++ {
		mincost := inf
		for j := max(i-k, 0); j < i; j++ {
			nowcost := dp[j] + abs(h[i]-h[j])
			mincost = min(mincost, nowcost)
		}
		dp[i] = mincost
	}

	fmt.Println(dp[n-1])

}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 4120
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int n = sc.nextInt();
            int k = sc.nextInt();
            int r = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            String t = sc.next();

            List<String> aiteList = new ArrayList<>();
            List<Integer> takahashiList = new ArrayList<>();

            int score = 0;
            for (int i = 0; i < n; ++i) {
                String aite = t.substring(i, i + 1);

                if (i - k < 0 || !aiteList.get(i - k).equals(aite) || takahashiList.get(i - k) == 0) {
                    if (aite.equals("r")) {
                        score += p;
                    } else if (aite.equals("s")) {
                        score += r;
                    } else if (aite.equals("p")) {
                        score += s;
                    }
                    takahashiList.add(1);
                } else {
                    takahashiList.add(0);
                }

                aiteList.add(aite);
            }
            System.out.println(score);
        }
    }

}


Measured memory_bytes: 32568
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

    private static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    private static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        String s = sc.next();
        String t = sc.next();

        long l = lcm(n, m);
        Map<Long, Character> x = new HashMap<>();
        for (int i = 0; i < n; i++) {
            x.put(i * l / n, s.charAt(i));
        }
        for (int i = 0; i < m; i++) {
            long key = i * l / m;
            if (x.containsKey(key) && x.get(key) != t.charAt(i)) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(l);
    }

}


Measured memory_bytes: 34600
a,b,c,x,y = gets.split.map &:to_i
 
max = 1000000000
(0..(2*[x,y].max + 1)).each do |i|
    pay = i * c + [(x - (i / 2)), 0].max * a + [(y - (i / 2)), 0].max * b
    max = pay if pay < max
end
puts max

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}

vector<ll> g[MAX];
ll N, K;

ll bfs() {
  ll ans=K;
  ll used[MAX]={};
  ll i;
  queue<ll> q;
  
  used[0]=1;
  for(i=0; i<g[0].size(); i++) {
    ll u=g[0][i];
    q.push(u);
    used[u]=1;
    moC(ans, *, K-1-i);
  }
  
  while(q.size()) {
    ll u=q.front(); q.pop();
    
    ll t=0;
    for(i=0; i<g[u].size(); i++) {
      ll v=g[u][i];
      if(used[v]) continue;
      q.push(v);
      used[v]=1;
      moC(ans, *, K-2-t);
      t++;
    }
    
  }
  
  return  ans;
}

int main(void) {
  cin >> N >> K;
  ll i;
  
  for(i=0; i<N-1; i++) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    g[a].pb(b);
    g[b].pb(a);
  }
  
  pt(max(bfs(), 0));
}














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

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

    int ans = a + b + c - max({a, b, c});

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


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

int main(){
  int K, S;
  cin >> K >> S;

  int count=0;
  for (int i = 0; i < K+1; i++) {
    for (int j = 0; j < K+1; j++) {
      int k=S-i-j;
      if(k>=0 && k<=K) count+=1;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
s = input()

for i in range(len(s)):
    if ((i+1) % 2 == 0) and s[i] == "R":
        print("No")
        break
    elif ((i+1) % 2 != 0) and s[i] == "L":
        print("No")
        break
else:
    print("Yes")

Measured memory_bytes: 3060
package main

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

var sc = bufio.NewScanner(os.Stdin)

func getFloat() float64 {
	sc.Scan()
	n, _ := strconv.ParseFloat(sc.Text(), 64)
	return n
}

func main() {
	sc.Split(bufio.ScanWords)
	t, x := getFloat(), getFloat()

	fmt.Println(t / x)
}


Measured memory_bytes: 640
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>
#include <list>

using namespace std;

int main() {
	int n, r[8];
	double x[8], y[8], dx2, dy2, dist, sum = 0, sumsum = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
		r[i] = i + 1;
	}
	double count = 0;
	do {
		sum = 0;
		for (int i = 0; i < n - 1; i++) {
			dx2 = pow(x[r[i]-1] - x[r[i + 1]-1], 2);
			dy2 = pow(y[r[i]-1] - y[r[i + 1]-1], 2);
			dist = sqrt(dx2 + dy2);
			sum += dist;
		}
		sumsum += sum;
		count++;
	} while (next_permutation(r, r + n));
	printf("%.7f", sumsum / count);
	

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> mochi(N);
  
  for(int i=0; i<N; i++){
    cin >> mochi.at(i);
  }
  
  sort(mochi.begin(),mochi.end(),greater<int>());
  
  int max=0, a, l=0;
  for(int i=0; i<N; i++){
    a = mochi.at(i);
    if (i==0||max>a){
      l++;
      max = a;
    }
  }
  cout << l <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int main() {
    int X;
    cin >> X;
    int ans = 1;
    for(int i = 2; i < 32; i++) {
        int tmp = i;
        while(tmp * i <= X) {
            tmp *= i;
            ans = max(ans, tmp);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
eval'N,K,*A='+`dd`.split*?,
A.sort!
l=0
r=N
s=K%2>0?A[r-=1]:1
b=s>0?1:-1
(x,y=A[l]*A[l+1],A[r-2]*A[r-1]
s*=x*b>y*b ?(l+=2;x):(r-=2;y)
s%=10**9+7
K-=2)while K>1
p s

Measured memory_bytes: 58748