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

#define EPS (1e-7)
#define INF (1<<25)
#define PI (acos(-1))

#define FOR(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define REP(i,n) FOR(i,0,n)

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

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

using ll = long long;

#define abs(x) (x>0?(x):(-(x)))

int main() {
  int N; cin >> N;
  vector<int> a(N);
  REP(i,N) cin >> a[i];
  whole(sort, a);
  int n = a[N-1];
  int r = a[0];
  REP(i,N-1) if (abs((double)a[i] - n/2.0) < abs((double)r-n/2.0)) r = a[i];
  cout << n << " " << r << endl;
  return 0;
}


Measured memory_bytes: 640
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   int n,k;
   cin >> n >> k;
   vector<int> a(n);
   for(int i=0; i<n; i++){
       cin >> a[i];
   }
   int dp[n+1]={0};
   dp[0]=0;
   if(k>n)k=n;
   for(int i=1; i<k; i++){
       dp[i]=INT_MAX;
       for(int j=0; j<i; j++){
           dp[i]=min( { dp[i], dp[j]+abs(a[i]-a[j])  } );
       }
   }
   for(int i=k; i<n; i++){
       dp[i]=INT_MAX;
       for(int j=1; j<=k; j++){
            dp[i]=  min( dp[i] , dp[i-j]+abs(a[i]-a[i-j]) );    
       }
   }
  cout << dp[n-1] << endl;
  
   return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <map>
#include <string>

int64_t solve(std::string &s) {
  std::map<int, int> count;
  int val = 0;
  int base = 1;
  int P = 2019;
  for (int i = s.length() - 1; i >= 0; --i) {
    val += (int)(s[i] - '0') * base;
    val %= P;
    ++count[val];
    base = base * 10 % P;
  }
  ++count[0];
  int64_t ans = 0;
  for (const auto &[val, num] : count) {
    (void)val;
    ans += (int64_t)num * (num - 1) / 2;
  }
  return ans;
}

int main() {
  std::string s;
  std::cin >> s;
  std::cout << solve(s) << std::endl;
  return 0;
}


Measured memory_bytes: 3752
n = input()
N = int(n)
l = len(n)
s = int(n[l-1])
pon = [0, 1, 6, 8]
hon = [2, 4, 5, 7, 9]

if s in pon:
  print('pon')
elif s == 3:
  print('bon')
elif s in hon :
  print('hon')

Measured memory_bytes: 9188
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;

int main()
{
    int numa, numb;
    cin >> numa >> numb;
    if(numa-numb*2>0){
        cout << numa-numb*2 << endl;
    }else{
        cout << "0\n";
    }
    return 0;
}


Measured memory_bytes: 256
"use strict";
const main = input => {
  input = input[0].split(' ').map(val => parseInt(val, 10));
  const l = input[0], r = input[1];
  // console.log(l, r);
  const ll = l%2019, rr = r%2019;
  let num = 2018;
  if (r-l >= 2018) {
    console.log(0);
  } else {
    for(let i=ll; i<rr; i++) {
      for(let j=i+1; j<=rr; j++) {
        num = Math.min(num, (i*j)%2019);
      }
    }
    console.log(num);
  }  
};
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));


Measured memory_bytes: 11468
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

class TrumpFinding { // ?????????????????¢????????????
	void finding(ArrayList<String> taroTrump) {
		for (int i = 0; i < 13; ++i) { // S???????????¨??¨???.??????????????¨????????????H,C,D??¨???????§?
			if (taroTrump.contains("S " + (i + 1)) == false) { // ????????????????????????????????????????????????????????????????????????????????°???
				System.out.println("S " + (i + 1)); // contains??????????????§??°?????????????????£?????????????????????????????¨???
			}
		}
		for (int i = 0; i < 13; ++i) { // H???????????¨??¨???.??????????????¨????????????H,C,D??¨???????§?
			if (taroTrump.contains("H " + (i + 1)) == false) { // ????????????????????????????????????????????????????????????????????????????????°???
				System.out.println("H " + (i + 1)); // contains??????????????§??°?????????????????£?????????????????????????????¨???
			}
		}
		for (int i = 0; i < 13; ++i) { // C???????????¨??¨???.??????????????¨????????????H,C,D??¨???????§?
			if (taroTrump.contains("C " + (i + 1)) == false) { // ????????????????????????????????????????????????????????????????????????????????°???
				System.out.println("C " + (i + 1)); // contains??????????????§??°?????????????????£?????????????????????????????¨???
			}
		}
		for (int i = 0; i < 13; ++i) { // D???????????¨??¨???.??????????????¨????????????H,C,D??¨???????§?
			if (taroTrump.contains("D " + (i + 1)) == false) { // ????????????????????????????????????????????????????????????????????????????????°???
				System.out.println("D " + (i + 1)); // contains??????????????§??°?????????????????£?????????????????????????????¨???
			}
		}
	}
}

public class Main {
	public static void main(String[] args) throws IOException { // S,H,C,D
		int n = 0;
		TrumpFinding tf = new TrumpFinding();
		ArrayList<String> taroTrump = new ArrayList<String>();
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		n = Integer.parseInt(br.readLine()); // ?????????????????£???????????????????????°
		for (int i = 0; i < n; ++i) { // ?????????????????£??????????????????????¨???¶
			taroTrump.add(br.readLine());
		}
		tf.finding(taroTrump); // ??????????????¢?´¢????????????????????????
	}
}

Measured memory_bytes: 24264
main :: IO ()
main = do
  strs <- getLine
  print $ solve strs

solve :: String -> Int
solve [] = 0
solve (s:ss) = go ss s
  where
    go :: String -> Char -> Int 
    go (x:xs) state
      | x == state = 0 + go xs x
      | otherwise = 1 + go xs x
    go [] _ = 0


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

using namespace std;
long long dp[1000005],num[1000005];
int main()
{
    //freopen("tttt.out", "w", stdout) ;
    //freopen("tttt.in", "r", stdin) ;
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    long long a,b=2;
    cin>>a;
    for(int i=0;i<a;i++)
    {
        cin>>num[i];
        long long mi;
        for(int j=1;j<=b;j++)
        {
            if(i-j<0)
                break;
            if(j==1)
                mi=dp[i-j]+abs(num[i]-num[i-j]);
            if(dp[i-j]+abs(num[i]-num[i-j])<mi)
            {
                mi=dp[i-j]+abs(num[i]-num[i-j]);
            }
            dp[i]=mi;
        }
    }
    cout<<dp[a-1];
    return 0;
}


Measured memory_bytes: 5120
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <utility>
#include <set>
#include <bitset>
typedef long long ll;
typedef long double ld;

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
    ll N;
    cin >> N;
    vector<string>S;
    rep(i,N) {
        string tmp;
        cin >> tmp;
        S.push_back(tmp);
    }
    sort(S.begin(),S.end());
    S.erase(unique(S.begin(),S.end()),S.end());
    cout << S.size() << endl;
    
    return 0;
}

Measured memory_bytes: 9132
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String input= sc.nextLine();
        String inputs[] = input.split(" ");
        int a  = Integer.valueOf(inputs[0]);
        int b = Integer.valueOf(inputs[1]);
        int area = (a*b)/2;
        System.out.println(area);
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100;
const int MAX_W = 10000;
int dp[MAX_W+1];
int v[MAX_N];
int w[MAX_N];

int main()
{
	int n,W;
	scanf("%d%d",&n,&W);
	rep(i,n){
		scanf("%d%d",&v[i],&w[i]);
	}
	rep(i,n){
		for(int j=w[i];j<=W;j++){
			dp[j] = max(dp[j],dp[j-w[i]] + v[i]);
		}
	}
	printf("%d\n",dp[W]);
}

Measured memory_bytes: 3256
N = int(input())
L = [0] * (N + 1)


def f(i):
    if i == 0:
        return 2
    if i == 1:
        return 1
    if L[i] == 0:
        L[i] = f(i - 1) + f(i - 2)
    return L[i]


print(f(N))


Measured memory_bytes: 9096
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <climits>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a >>b;
    if(b%a==0){
        cout<<a+b;
    }else{
        cout<<b-a;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	bool is_visited = false;
} node;
typedef struct {
	int to;
	int cost;
	P <int, int> change;
} edge;

int main( void ){
	int N; cin >> N;
	N--;
	vector <int> vec( N );
	rep( i, 0, N ) cin >> vec[ i ];
	int sum = vec[ 0 ] + vec[ N - 1 ];
	rep( i, 0, N - 1 ) sum += min( vec[ i ], vec[ i + 1 ] );
	cout << sum << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define ll long long
#define REP(a,b,c) for(int a=b;a<=c;a++)
#define re register
#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)
typedef pair<int,int> pii;
#define mp make_pair
inline int gi()
{
	int f=1,sum=0;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();}
	return f*sum;
}
int main()
{
	ll n,A,B;
	scanf("%lld%lld%lld",&n,&A,&B);
	if(A%2==B%2)
	{
		printf("%lld\n",abs(A-B)/2);
	}
	else
	{
		if(A>B)swap(A,B);
		ll ans=6e18;
		ans=A+(B-A-1)/2;
		ans=min(ans,n-B+1+(n-(A+n-B+1))/2);
		printf("%lld\n",ans);
	}
	return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define popcount(x) __builtin_popcount(x)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue

const ll MOD = 1e9 + 7;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	auto dp = vector<vvll>(n+1, vvll(2, vll(2, 0)));	
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int has0 = 0; has0 <= 1; has0++) {
			for (int has9 = 0; has9 <= 1; has9++) {
				for (int d = 0; d <= 9; d++) {
					int n0 = (d == 0 or has0) ? 1 : 0;
					int n9 = (d == 9 or has9) ? 1 : 0;
					dp[i+1][n0][n9] += dp[i][has0][has9];
					dp[i+1][n0][n9] %= MOD;
				}
			}
		}
	}
	cout << dp[n][1][1];
}

Measured memory_bytes: 151420
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,s,n) for(int i=s;i<n;i++)
#define fi first
#define se second
#define all(c) c.begin(),c.end()
typedef long long int ll;
typedef pair<int, int> P;
typedef long double ld;
void Ans(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

const ll INF=1001001001;
const ll mod=10000000007;

int main(){
  int n;
  cin>>n;
  int a;
  ld sum=0;
  rep(i,n){
    cin>>a;
    sum+=1.0/a;
  }
  cout<<fixed<<setprecision(10);
  cout<<1/sum<<endl;
}



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

int main()
{
    int N,K;
    int sum = 0;
    cin >> N >> K;
     vector<int> vec(N);
    for(int i = 0; i < N ; i++)
    {
        cin >> vec[i];
    }
    sort(vec.begin(),vec.end());

    for(int j = 0; j < K; j++)
    {
        sum = sum+vec[j];
    }
cout << sum << endl;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (int i = 0; i < sz(v); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << " ";
    }
    return os;
}
int main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    if (H % h == 0 && W % w == 0) {
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    if (W % w > 0) {
        int x = W / w + 1;
        int y = -x - 1;
        auto ans = make_vec<int>(H, W);
        rep(i, H) rep(j, W) {
            if (i % h == 0 && j % w == 0) ans[i][j] = x;
            if (i % h == h - 1 && j % w == 0) ans[i][j] = x;
            if (i % h == 0 && j % w == w - 1) ans[i][j] = y;
            if (i % h == h - 1 && j % w == w - 1) ans[i][j] = y;
        }
        rep(i, H) cout << ans[i] << endl;
    } else {
        int x = H / h + 1;
        int y = -x - 1;
        auto ans = make_vec<int>(H, W);
        rep(i, H) rep(j, W) {
            if (i % h == 0 && j % w == 0) ans[i][j] = x;
            if (i % h == h - 1 && j % w == 0) ans[i][j] = y;
            if (i % h == 0 && j % w == w - 1) ans[i][j] = x;
            if (i % h == h - 1 && j % w == w - 1) ans[i][j] = y;
        }
        rep(i, H) cout << ans[i] << endl;
    }
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
long long dp[110][100100];//do[i][j]=i番目のものまでで重さjのときの価値の最大値

int main(void){
	long long N,W;
	cin >> N >> W;
	long long w[N],v[N];
	for(int i=0;i<N;i++)cin >> w[i] >> v[i];
	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			//i番目の商品を選んだ場合
			if(j-w[i]>=0){
				dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i]);
			}
			//選ばなかった場合
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
		}
	}
	cout << dp[N][W] << endl;
}

Measured memory_bytes: 79488
#!/bin/sh
  
read N

a3=$(( $N / 1000 ))
a2=$(( (( $N - (( $a3 * 1000 )) )) / 100 ))
a1=$(( (($N - (( $a3 * 1000 )) - (( $a2 * 100 )) )) / 10 ))
a0=$(( $N - (( $a3 * 1000 )) - (( $a2 * 100 )) - (( $a1 * 10 )) ))

if [ $a0 -eq $a1 ] && [ $a1 -eq $a2 ]
then
        echo Yes
elif [ $a1 -eq $a2 ] && [ $a2 -eq $a3 ]
then
        echo Yes
else
        echo No
fi

Measured memory_bytes: 376
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define inf 1e+9
#define endl "\n"
#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(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){ cin >> first; IN(rest...); return;}

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(T first, T end){
    for (auto i = first; i < end - 1; i++) cout << *i << " ";
    cout << *(end-1) << endl;
}
template <class T> void print(T a){ cout << a << endl;};
vector<string> Yes = {"No", "Yes"};
vector<string> YES = {"NO", "YES"};

lint mod = 1e9+7;
lint inv[500001], fac[500001], finv[500001];

void finv_table(int k){
    int mod = 1e9 + 7;
    inv[0] = 0; inv[1] = 1;
    fac[0] = 1; fac[1] = 1;
    finv[0] = 1; finv[1] = 1;
    for (int i = 2; i < k+1; ++i){
        inv[i] = inv[mod % i] * (mod - (mod / i)) % mod;
        fac[i] = fac[i-1] * i % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

template<typename T, typename U>
lint comb(T n, U r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;

    return fac[n] * finv[r] % mod * finv[n-r] % mod;
    
}

int main(){
    finv_table(300000);
    INT(n, k); vlint a(n); line(a);
    map<lint, lint> cnt_max, cnt_min;
    sort(all(a));
    rep(i, n){
        cnt_max[a[i]] += comb(i, k-1);
        cnt_max[a[i]] %= mod;
        cnt_min[a[i]] += comb(n-i-1, k-1);
        cnt_min[a[i]] %= mod;
    }
    lint ans = 0;
    UNIQUE(a);
    for (auto&& p : a){
        ans += p * cnt_max[p] % mod; ans %= mod;
        ans -= p * cnt_min[p] % mod; ans %= mod;
    }
    print(ans);
}
    



Measured memory_bytes: 22712
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,a[410];
ll dp[410][410],sum[410];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();
	rep(i,1,n) {a[i]=read();sum[i]=sum[i-1]+a[i];}
	memset(dp,0x3f,sizeof(dp));
	rep(i,1,n) dp[i][i]=0;
	rep(len,2,n)
	{
		for (int i=1;i+len-1<=n;i++)
		{
			int j=i+len-1;
			rep(k,i,j-1)
				dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+sum[j]-sum[i-1]);
		}
	}
	printf("%lld",dp[1][n]);
	return 0;
}


Measured memory_bytes: 1536
package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scan(&n)
	for i := 0; i <= 50000; i++ {
		if int64(float64(i)*1.08) == n {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(":(")
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int main(void) {
    int n, i, a[100003], p, ans;
    vector<int> ap;

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

    for (i = 0; i < n; i++) {
        ap.push_back(a[i]);
    }

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

    ans = 0;
    for (i = 0; i < n; i++) {
        p = lower_bound(ap.begin(), ap.end(), a[i]) - ap.begin();
        if (abs(p - i) % 2 == 1) {
            ans++;
        }
    }

    printf("%d\n", ans / 2);

    return 0;
}

Measured memory_bytes: 1276
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b


def main():
    N, M = map(int, input().split())  # 複数数値入力
    li = list()
    last = -1
    current = N
    ans = 1
    beforeBroken = 0
    for i in range(M):
        current = int(input())
        beforeBroken = current
        if last == current - 1 and last != 0:
            print(0)
            return

        if current != 1:
            li.append(current - last-2)
        last = current

    if M != 0:
        li.append(N - beforeBroken-1)
    else:
        li.append(N)
    for i in li:
        ans *= Fib(i+2)
    print(ans % 1000000007)


main()


Measured memory_bytes: 3548
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

ret = 0
curr = 1
i = 0
loop do
  break if i > n - 1
  if a[i] == curr
    ret += 1
    curr += 2
    i += 2
  else
    curr += 1
    i += 1
  end
end

puts ret

Measured memory_bytes: 8708
h, w, a, b = map(int, input().split())

memo = [[0 for _ in range(w)] for i in range(h)]

for i in range(b):
    for j in range(w):
        if j < a:
            memo[i][j] = 1
        else:
            memo[i][j] = 0

for i in range(b, h):
    for j in range(w):
        if j < a:
            memo[i][j] = 0
        else:
            memo[i][j] = 1

for mi in memo:
    ans = ""
    for i in mi:
        ans += str(i)
    print(ans)

Measured memory_bytes: 12788
import math
from functools import reduce
from sys import stdin
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)
  
def main():
  N = int(stdin.readline())
  N_list = list(range(1, N+1))
  
  ans = 0
  
  for xs in itertools.combinations_with_replacement(N_list, 3):
    if len(set(xs)) == 1:
      ans += gcd(xs[0], xs[1], xs[2])
    elif len(set(xs)) == 2:
      ans += 3*gcd(xs[0], xs[1], xs[2])
    else:
      ans += 6*gcd(xs[0], xs[1], xs[2])
      
  print(ans)

if __name__ == '__main__':
  main()


Measured memory_bytes: 74700
/**
 *    author: gxfireball       
**/
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
using namespace std;

void solve(){
   ll a,b,n,x;
   cin >> a >> b >> n;
   if(n >= b) x = b-1;
   else x = n;
   cout << floor((a*x)/b) << endl;
}

int main(){
    fastio;
    int t;
    t = 1;
    //cin>>t;
    while(t--){
    	solve();
    }
    return 0;
}


Measured memory_bytes: 3804
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
using namespace std;
typedef long long ll;

int main()
{
    int H, W;
    cin >> H >> W;
    string S;

    vector<vector<int>> ans(H + 2, vector<int>(W + 2, 0));
    for (int i = 0; i < H; i++)
    {
        cin >> S;
        for (int j = 0; j < W; j++)
        {
            if (S.at(j) == '#')
            {
                ans.at(i + 1).at(j + 1) = 10;
                for (int k = -1; k < 2; k++)
                {
                    ans.at(i + 1 + k).at(j + 1 - 1)++;
                    ans.at(i + 1 + k).at(j + 1)++;
                    ans.at(i + 1 + k).at(j + 1 + 1)++;
                }
            }
        }
    }

    for (int i = 1; i <= H; i++)
    {
        for (int j = 1; j <= W; j++)
        {
            if (ans.at(i).at(j) >= 10)
                cout << '#';
            else
                cout << ans.at(i).at(j);
        }

        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 200200;
int n , x , dp[N] , ans ;

int main(){

scanf("%d",&n);
for(int i=1;i<=n;i++){
    scanf("%d",&x);
    dp[x]=1+dp[x-1];
    ans=max(ans,dp[x]);
}
printf("%d\n",n- ans);
return 0;
}


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

typedef long long ll;

int main() {
    int N, ans = 0;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    int i = 0;
    while (i < N) {
        while (i < N && A[i] == A[i + 1]) i++;
        if (i < N && A[i] < A[i + 1]) {
            while (i < N && A[i] <= A[i + 1]) i++;
        } else if (i < N && A[i] > A[i + 1]) {
            while (i < N && A[i] >= A[i + 1]) i++;
        }
        //cout << "i=" << i << "\n";
        ans++;
        i++;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <utility>
#include <numeric>
#include <iomanip>
#include <locale>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>
#include <cmath>

using namespace std;

vector<string> read();
int think(vector<string>);
void write(int);

bool isInArea(int, int, int, int);
int blockCount(vector<string>, char);

int main(int argc, char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);

  auto input = read();
  auto output = think(input);
  write(output);

  return 0;
}

vector<string> read() {
  int h, w;
  string buf;
  vector<string> maze;

  cin >> h >> w;
  for (int y = 0; y < h; y++) {
    cin >> buf;
    maze.push_back(buf.substr(0, w));
  }
  return maze;
}

int think(vector<string> input) {
  auto wallMark = '#';
  auto h = input.size();
  auto w = input.at(0).size();
  auto invalid = h * w + 1;

  auto sx = 0;
  auto sy = 0;
  auto gx = w - 1;
  auto gy = h - 1;

  auto visited = vector< vector<int> > (h, vector<int> (w, invalid));

  auto direction = vector< vector<int> >();
  direction.push_back(vector<int> {1, 0});
  direction.push_back(vector<int> {-1, 0});
  direction.push_back(vector<int> {0, 1});
  direction.push_back(vector<int> {0, -1});

  auto q = queue< vector<int> >();
  q.push(vector<int> {sx, sy, 1});

  while (!q.empty()) {
    auto d = q.front();
    q.pop();

    auto cx = d.at(0);
    auto cy = d.at(1);
    auto steps = d.at(2);

    if (visited.at(cy).at(cx) <= steps) {
      continue;
    }
    visited.at(cy).at(cx) = steps;

    for (auto e : direction) {
      auto nx = cx + e.at(0);
      auto ny = cy + e.at(1);

      if (!isInArea(nx, ny, w, h)) {
        continue;
      }
      if (input.at(ny).at(nx) == wallMark) {
        continue;
      }
      q.push(vector<int> {nx, ny, steps + 1});
    }
  }

  if (visited.at(gy).at(gx) == invalid) {
    return -1;
  } else {
    return h * w - visited.at(gy).at(gx) - blockCount(input, wallMark);
  }
}

void write(int output) {
  cout << output << endl;
}

bool isInArea(int x, int y, int w, int h) {
  return (0 <= x) && (x < w) && (0 <= y) && (y < h);
}

int blockCount(vector<string> maze, char mark) {
  int count = 0;
  for (int y = 0; y < maze.size(); y++) {
    for (int x = 0; x < maze.at(y).size(); x++) {
      if (maze.at(y).at(x) == mark) {
        count++;
      }
    }
  }
  return count;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
var d=Arr[0];
var A=Arr[1];
var B=Arr[2];
var a=Arr[3];
var b=Arr[4];
console.log(d-Math.max(Math.ceil(A/a),Math.ceil(B/b)));

Measured memory_bytes: 7384
#include <iostream>
using namespace std;
int main() {
  long long x;
  cin >> x;
  for (long long a = -118; a <= 119; ++a) {
    for (long long b = -119; b <= 118; ++b) {
      if (a * a * a * a * a - b * b * b * b * b == x) {
        cout << a << " " << b << endl;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long N,Y;
	int x,y,z;
	cin>>N>>Y;
	for(x=0;x<=Y/10000;x++)
	    for(y=0;y<=Y/5000;y++)
	  {
	  	z=N-x-y;
	  	if(z>=0&&x*10000+y*5000+z*1000==Y)
	  	{
	  		cout<<x<<' '<<y<<' '<<z;
	  		return 0;
	  	}
	  }
	  cout<<"-1 -1 -1";
	  return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        n:chars,
    }

    for i in 1..n.len() {
        if n[i - 1] == n[i] {
            println!("Bad");
            return;
        }
    }
    println!("Good");

}



Measured memory_bytes: 4352
import sys
from math import gcd


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    c = A[0]
    b = []

    cnt = [0] * (10 ** 6 + 1)

    for a in A:
        c = gcd(c, a)
        cnt[a] += 1

    max_num = 0
    for i in range(2, 10 ** 6 + 1):
        max_num = max(max_num, sum(cnt[i::i]))

    if c == 1 and max_num <= 1:
        print('pairwise coprime')
    elif c == 1:
        print('setwise coprime')
    else:
        print('not coprime')


if __name__ == '__main__':
    main()


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

using namespace std;

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    vector<int64_t> arr;
    int64_t cur;
    int64_t sum = 0;
    for (int64_t i = 0; i < N; i++) {
        cin >> cur;
        arr.push_back(cur);
        sum += cur;
    }

    int64_t snuke = 0;
    int64_t bear = 0;
    int64_t ans = INT64_MAX;
    for (int j = 0; j < N - 1; j++) {
        snuke += arr[j];
        bear = sum - snuke;
        ans = min(ans, abs(snuke - bear));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2420
# coding: utf-8
while 1:
    n,m,a=map(int,input().split())
    if n==0:
        break
    dic={}
    for i in range(1,1001):
        dic[i]=[]
    for i in range(m):
        h,p,q=map(int,input().split())
        dic[h].append((p,q))
        dic[h].append((q,p))
    h=1000
    pos=a
    while h>0:
        for d in dic[h]:
            if d[0]==pos:
                pos=d[1]
                break
        h-=1
    print(pos)


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

int main() {
    int t; cin >> t;
    while (t--) {
        ll n, m, a, b;
        cin >> n >> m >> a >> b;
        cout << floor_sum(n, m, a, b) << endl;
    }
}

Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

ll C[26];

int main() {
    string line; cin >> line;
    ll mx = 0;
    for(char c : line) {
        C[c - 'a'] += 1;
        mx += 1;
    }
    
    mx = mx * (mx - 1) >> 1;
    for(int i = 0; i < 26; ++i)
        mx -= ll(C[i]) * ll(C[i] - 1) >> 1;
    
    cout << mx + 1;
    
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define N 15000
using namespace std;

template <typename T>
void print(T x){cout<<x<<"\n";}
template <typename T1, typename T2>
void print2(T1 x,T2 y){cout<<x<<" "<<y<<"\n";}
template <typename T1, typename T2,typename T3>
void print3(T1 x, T2 y,T3 z){cout<<x<<" "<<y<<" "<<z<<"\n";}

ll profit[101],Weights[101];

ll knapsack(ll weights[],ll profit[],ll n,ll net,ll w)
{
    vector<ll> k(net+1);
    k.assign(net+1,INT_MAX);

    k[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=net;j>=profit[i];j--)
        k[j]=min(k[j],weights[i]+k[j-profit[i]]);
    }
    
    for(int i=net;i>=0;i--)
    {
        if(k[i]<=w)
        return i;
    }   
}


int main()
{
    io;
    ll test_case;
    //cin>>test_case;
    test_case=1;
    while(test_case--)
    {
        ll n,net_weight;
        cin>>n>>net_weight;
        ll v=0;
        for(int i=0;i<n;i++)
        {
            cin>>Weights[i];
            cin>>profit[i];
            v+=profit[i];
        }

        cout<<knapsack(Weights,profit,n,v,net_weight)<<"\n";
    }   
}

Measured memory_bytes: 3992
q = int(input())
for i in range(q):
    a,b,c,d,e,f,g,h = [int(i) for i in input().split()]
    A = d-b
    B = c-a
    C = f-h
    D = e-g
    E = a*d-b*c
    F = e*h-f*g
    G = A*D-B*C
    print((E*D+F*B)/G,(E*C+F*A)/G)

Measured memory_bytes: 7736
h, w = map(int, input().split())
array = [input() for x in range(h)]
res_array = []
for row in array:
    if len(row) != row.count("."):
        res_array.append(row)

array2 = [x for x in zip(*res_array)]
res_array2 = []
for row in array2:
    if len(row) != row.count("."):
        res_array2.append(row)

for i in [x for x in zip(*res_array2)]:
    print("".join(i))

Measured memory_bytes: 3188
s = input()
ans = 0
if len(s) %2 != 0:
    a = len(s)//2
    list1 = s[:a]
    list2 = s[a+1:]
    for i in range(a):
        if list1[i] != list2[-(i+1)]:
            ans +=1

else:
    a = len(s)//2
    list1 = s[:a]
    list2 = s[a:]
    for i in range(a):
        if list1[i] != list2[-(i+1)]:
            ans +=1


print(ans)


Measured memory_bytes: 39884
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using namespace std;

int memo[25][15][160];

int rec (int n, int k, int s) {
    if(n < 0 || k < 0 || s < 0) return 0;
    if(memo[n][k][s] >= 0) return memo[n][k][s];
    if(n == 0 && k == 0 && s == 0) return memo[n][k][s] = 1;
    memo[n][k][s] = rec(n - 1, k, s) + rec(n - 1, k - 1, s - n);
    return memo[n][k][s];
}

int main(){
    int n, k, s;
    // k : number of elements <- [1, n]
    // s : sum
    while (true) {
        scanf("%d%d%d", &n, &k, &s);
        if(n == 0 && k == 0 && s == 0) break;
        for (int i = 0; i <= n; ++i) {
            for (int j = 0; j <= k; ++j) {
                fill(memo[i][j], memo[i][j] + s + 1, -1);
            }
        }
        printf("%d\n", rec(n, k, s));
    }
    return 0;
}

Measured memory_bytes: 1380
#include <iostream>
#include <cstdio>

using namespace std;

typedef long long ll;
const ll INF = -4e18;
ll n, m;
ll a[1005][1005];


int main()
{
    scanf("%d%d", &n, &m);
    for(ll i = 1; i <= n; i++)
    {
        for(ll j = 1; j <= n; j++)
        {
            a[i][j] = INF;
        }
        a[i][i] = 0;
    }
    for(ll i = 1; i <= m; i++)
    {
        ll u, v, w;
        scanf("%lld%lld%lld", &u, &v, &w);
        a[u][v] = w;
    }
    for(ll k = 1; k <= n; k++)
    {
        for(ll i = 1; i <= n; i++)
        {
            if(a[i][k] == INF)continue;
            for(ll j = 1; j <= n; j++)
            {
                if(a[i][k] + a[k][j] > a[i][j]) a[i][j] = a[i][k] + a[k][j];
            }
        }
    }
    if(a[1][1] > 0)
    {
        printf("inf");
        return 0;
    }
    printf("%lld", a[1][n]);
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main() {
  double N;
  cin >> N;
  if ((int)N % 2 == 0) {
    printf("%f\n", 0.5);
  } else {
    printf("%f\n", (1+N) / 2 / N);
  }
  return 0;
}


Measured memory_bytes: 256
char S[1<<17],T[1<<17];
a,b,c;
main(d){
	for(scanf("%s%s%*d",S+1,T+1);S[d]|T[d];++d)
		S[d]=S[d-1]%3+S[d]%4,
		T[d]=T[d-1]%3+T[d]%4;
	for(;~scanf("%d%d%d%d",&a,&b,&c,&d);)
		puts((S[b]-S[a-1]-T[d]+T[c-1])%3?"NO":"YES");
}


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;



int main(){
    int date[26];
    int N;
    string s;
    int x=0;
    long long ans = 1;
  	cin >> N >> s;
  	for(int i=0;i<26;i++)date[i]=0;
    for(int i=0;i<N;i++){
        if(s[i]=='a')date[0]++;
        if(s[i]=='b')date[1]++;
        if(s[i]=='c')date[2]++;
        if(s[i]=='d')date[3]++;
        if(s[i]=='e')date[4]++;
        if(s[i]=='f')date[5]++;
        if(s[i]=='g')date[6]++;
        if(s[i]=='h')date[7]++;
        if(s[i]=='i')date[8]++;
        if(s[i]=='j')date[9]++;
        if(s[i]=='k')date[10]++;
        if(s[i]=='l')date[11]++;
        if(s[i]=='m')date[12]++;
        if(s[i]=='n')date[13]++;
        if(s[i]=='o')date[14]++;
        if(s[i]=='p')date[15]++;
        if(s[i]=='q')date[16]++;
        if(s[i]=='r')date[17]++;
        if(s[i]=='s')date[18]++;
        if(s[i]=='t')date[19]++;
        if(s[i]=='u')date[20]++;
        if(s[i]=='v')date[21]++;
        if(s[i]=='w')date[22]++;
        if(s[i]=='x')date[23]++;
        if(s[i]=='y')date[24]++;
        if(s[i]=='z')date[25]++;
    }

   
    //合計
    for(int i=0;i<26;i++){
        if(!date[i]==0)ans = ans*(date[i]+1);
        ans= ans%1000000007;
    }
        
    cout << ans-1;

}


Measured memory_bytes: 512
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ab, abc = [], []

for i in a:
    for j in b:
        ab.append(i+j)

ab.sort()
s = ab[x*y-k:]
for i in s:
    for j in c:
        abc.append(i+j)

abc.sort(reverse=True)
for i in range(k):
    print(abc[i])


Measured memory_bytes: 151640
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto &__VA_ARGS__:(c))
using namespace std;
using ll = long long;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int K,X;
	cin>>K>>X;
	if (K*500>=X) cout<<"Yes\n"; else cout<<"No\n";
}


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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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


vector<ll> t;

int main(void)
{
  ll n , T;
  cin >> n >> T;
  REP(i, n) {
    ll t1;
    cin >> t1;
    t.push_back(t1);
  }
  ll ans = 0;
  REP(i, n -1) {
    ll iv = t[i+1]-t[i];
    ans += (iv > T ? T : iv);
  }
  ans += T;
  cout << ans << endl;
}


Measured memory_bytes: 2420
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<std::vector<i64>> graph(N);
  for (i64 i = 0; i < N - 1; ++i) {
    i64 a_i, b_i;
    std::cin >> a_i >> b_i;
    graph[a_i - 1].push_back(b_i - 1);
    graph[b_i - 1].push_back(a_i - 1);
  }
  std::vector<i64> c;
  tools::read(c, N);

  std::sort(c.begin(), c.end(), std::greater<i64>());
  i64 M = 0;
  std::vector<i64> d(N);
  std::vector<bool> visited(N, false);
  std::function<void(i64)> dfs;
  dfs = [&](const i64 from) {
    visited[from] = true;
    for (const i64& to : graph[from]) {
      if (!visited[to]) {
        dfs(to);
      }
    }
    M += c.back();
    d[from] = c.back();
    c.pop_back();
  };
  dfs(0);
  M -= *std::max_element(c.begin(), c.end());

  std::cout << M << std::endl;
  std::string delimiter = "";
  for (const i64& d_i : d) {
    std::cout << delimiter << d_i;
    delimiter = " ";
  }
  std::cout << std::endl;
  return 0;
}

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

int main() {
   int n, m, a;
   long long ans=0;
   cin >> n >> m;
   priority_queue<int> pq;
   for(int i=0; i<n; i++) {
       cin >> a;
       pq.push(a);
    }
    for(int i=0; i<m; i++) {
        a=pq.top();
        pq.pop();
        pq.push(a/2);
    }
    for(int i=0; i<n; i++) {
        a=pq.top();
        pq.pop();
        ans += a;
    }
    cout << ans;
}

Measured memory_bytes: 892
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
namespace John
{
class stack
{
private:
    int64_t p;
    int64_t n;
    double *pBuff;

public:
    stack()
    {
        p = 0;
        n = 2;
        pBuff = new double[2];
    }
    double top()
    {
        return pBuff[p];
    }
    void pop()
    {
        if (p > 0)
        {
            --p;
        }
        else
        {
            std::cerr << "Stack underflow\n";
            throw;
        }
    }
    void push(double v)
    {

        if (n <= p)
        {
            int64_t np = n * 2;
            double *ptBuff = new double[np];
            for (int64_t i = 0; i <= p; ++i)
            {
                ptBuff[i] = pBuff[i];
            }
            delete[] pBuff;
            pBuff = ptBuff;
            n = np;
        }
        ++p;
        pBuff[p] = v;
    }
};
bool gIsCommnet = false;
void fCom(auto f)
{
    if (gIsCommnet)
    {
        f();
    }

    int AnnoyingVariable = 1;
}
} // namespace John

int main(int argc, char *argv[])
{

    bool isComment = false;
    for (int i = 0; i < argc; ++i)
    {
        if (std::string("--debug") == argv[i])
        {
            John::gIsCommnet = true;
        }
    }

    John::fCom([&] {
        John::stack oStack;

        for (int i = 0; i < 100; i++)
        {
            oStack.push(i);
            std::cout << oStack.top() << "\n";
        }
        for (int i = 0; i < 100; ++i)
        {
            std::cout << oStack.top() << "\n";
            oStack.pop();
        }
        std::cout << "Hellow\n";
    });

    std::string line;
    std::getline(std::cin, line);

    std::istringstream iss(line);
    std::string str;
    John::stack oStack; // 00.00 s 3296 KB 2839 B 
    while (iss >> str)
    {
        John::fCom([&] {
            std::cout << str << " This is in a comment section\n";
        });
        if(str == "+"){
            double v2 = oStack.top();
            oStack.pop();
            double v1 = oStack.top();
            oStack.pop();
            oStack.push(v1 + v2);
        }
        else if(str == "-"){
            double v2 = oStack.top();
            oStack.pop();
            double v1 = oStack.top();
            oStack.pop();
            oStack.push(v1 - v2);
        }else if(str == "*"){
            double v2 = oStack.top();
            oStack.pop();
            double v1 = oStack.top();
            oStack.pop();
            oStack.push(v1 * v2);
        }else if(str == "/"){
            double v2 = oStack.top();
            oStack.pop();
            double v1 = oStack.top();
            oStack.pop();
            oStack.push(v1 / v2);
        }
        else{
            oStack.push(std::stod(str));
        }

    }
    //1 2 + 3 4 - *
    //-3
    //1 1 + 1 1 + 2 * + 1 + 2 2 + * 1 + 
    std::cout << oStack.top() << "\n";
    return 0;
}


Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
int main()
{
      int a,b,flag;
      char ch;
      cin>>a>>b;
      for(int i= 0;i<a;i++){
            flag = -1;
            for(int j = 0 ; j < b;j++){
                  cin >> ch;
                  if(ch == 'c'){
                        cout << '0';
                        flag = 0;
                  }else{
                        if (flag == -1)cout << flag;
                        else cout << ++flag;
                 }
                  if(j!=b-1)cout << ' ';
            }
            cout<<endl;
      }
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c=1;
  	cin>>a>>b;
  	int count=0;
  	while(1){
    if(c>=b){
    break;
    }
    c=(c-1)+a;
    count++;
    }
  	cout<<count<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

#define fr(i,b,e) for(int i=(b); i<(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long ll;




int main(void){
    int A,B;
    
    cin >> A >> B;
    bool chk=false;
    B*=10;
    fr(i,0,10){
        if(((B+i)*8)/100==A){
            chk=true;
            cout << B+i << endl;
            break;
        }
    }
    
    if(chk==false){
        cout << -1 << endl;
    }
}


Measured memory_bytes: 256