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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 998244353ll;
const ll MAXN = (ll) 1e6 + 10;
const ll INF = (ll) 9223372036854775;
const ld EPS = (ld) 1e-8;

ll in(char a, char b, char c){
	return 100 * (a-'0') + 10 * (b-'0') + (c-'0');
}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	str s;
	cin >> s;
	ll ans = 999;
	for(int i = 2; i < s.size();i++) ans = min(ans, abs(in(s[i-2], s[i-1], s[i]) - 753));
	cout << ans;
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int prod[1000001];
const int mod=998244353;
int quickpow(int x,int y)
{
	long long res=1,base=x;
	while(y)
	{
		if(y&1) res*=base,res%=mod;
		y>>=1; base*=base,base%=mod;
	}
	return res;
}
int inv(int x)
{
	return quickpow(x,mod-2);
}
int c(int n,int m){return 1ll*prod[n]*inv(prod[m])%mod*inv(prod[n-m])%mod;}
signed main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(n<m) swap(n,m);
	prod[0]=1;
	for(int i=1;i<=n+m;i++)
		prod[i]=1ll*prod[i-1]*i%mod;
	int ans=0;
	for(int i=1;i<=m;i++)
	{
		ans+=1ll*c(2*i,i)*c(n-i+m-i,n-i)%mod;
		ans%=mod;
	}
	ans=1ll*ans*inv(c(n+m,m))%mod*inv(2)%mod;
	ans+=n;
	printf("%d",ans%mod);
	return 0;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
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; }

const int MOD = 1000000007;
const int INF = 1e9;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


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

	int n, t;
	cin >> n >> t;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int mi = a[0];
	map<int,int> mp;
	for(int i = 1; i < n; i++) {
		mp[a[i]-mi]++;
		mi = min(mi, a[i]);
	}
	int ans = (--mp.end())->second;
	cout << ans << endl;
}

Measured memory_bytes: 5376
def linear_search(A, n, key):
    A.append(key)
    i = 0
    while A[i] != key:
        i += 1
    A.pop()
    return i != n

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

ans = 0
for t in T:
    if linear_search(S, n, t):
        ans += 1
print(ans)


Measured memory_bytes: 6556
#include <bits/stdc++.h>
#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 FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(std::unique(all(x)), x.end());
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=acos(-1);
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
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...));
}

vector<ll> BellmanFord(vector<vector<pair<ll,ll>>> graph,int s) {
    int n=sz(graph);
    vector<ll> dist(n,LINF);
    dist[s]=0;
    
    rep(i,n-1) {
        rep(from,n) {
            for(auto p:graph[from]) {
                int to=p.first;
                ll cost=p.second;
                chmin(dist[to],(dist[from]==LINF ? LINF : dist[from]+cost));
            }
        }
    }
    
    rep(i,n+1) {
        rep(from,n) {
            for(auto p:graph[from]) {
                int to=p.first;
                ll cost=p.second;
                if(chmin(dist[to],(dist[from]==LINF ? LINF : dist[from]+cost))) {
                    dist[to]=-LINF;
                }
            }
        }
    }
    
    return dist;
}

int main() {
    int n,m;
    cin>>n>>m;
    vector<vector<pair<ll,ll>>> graph(n);
    while(m--) {
        int a,b;
        ll c;
        cin>>a>>b>>c;
        a--;b--;
        graph[a].emplace_back(b,-c);
    }
    
    auto d=BellmanFord(graph,0);
    if(d[n-1]==-LINF) cout<<"inf"<<endl;
    else cout<<-d[n-1]<<endl;
}


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

# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ;

# define ll long long
# define C continue;

# define pb push_back
# define vi vector < int >
# define vll vector < ll >

# define I insert

# define pii pair < int , int >
# define pll pair < ll , ll >
# define F first
# define S second

# define vpii vector < pair < int , int > >
# define vpll vector < pll >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()

# define ld long double
# define PQ priority_queue

# define vc vector < char >
# define vb vector < bool >
# define vs vector < string >

# define vvi vector < vector < int > >
# define vvll vector < vector < ll > >
# define vvc vector < vector < char > >
# define vvb vector < vector < bool > >

# define allcomp(v) v.begin() , v.end() , comp

# define pp(n) printf("%.10Lf",n);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

/// Tip : If a and b are positive integers ; we may say - ceil (a/b) = 1 + floor ( (a-1)/b ) .
/// Start using lower bound !!

void solve ( int test_case )
{
    int x ; 
    cin >> x ; 
    
    int ans = 1 - x ; 
    cout << ans ; line ; 
}

int main()
{
    int t = 1;
    // cin >> t;

    for ( int i = 1 ; i <= t ; i ++ )
    {
        solve ( i ) ;
    }

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int t,n;
    int ans[5];
    for(int i=0;i<4;i++){
      cin>>t>>n;
      if(t==1){
	ans[i]=6000*n;
      }else if(t==2){
	ans[i]=4000*n;
      }else if(t==3){
	ans[i]=3000*n;
      }else{
	ans[i]=2000*n;
      }
    }
    for(int i=0;i<4;i++){
      cout<<ans[i]<<"\n";
    }
    return 0;
}



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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    cout << (((n-k)+(k-2))/(k-1))+1 << "\n";
}

Measured memory_bytes: 3652
//
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <numeric>
#include <functional>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <complex>

using namespace std;

#define REP(i,m,n) for(int i=m;i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define ALL(x) (x).begin(),(x).end()

typedef long long ll;
typedef pair<int, int> pii;

int main(){

	string n;
	cin >> n;
	sort(ALL(n));
	int rpos = (int)n.rfind("o");
	if(rpos > 7 || 15 - n.size() + rpos + 1 > 7){
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    int a,b,c,d; cin >> a >> b >> c >> d;
    cout << min(a,d) - max(0,d-a-b) << endl;


    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define pll pair<ll,ll>
#define pint pll
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

const int MAX = 510000;
const int MOD = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll L[200020],R[200020];
ll sum,sum2;

int main(){
  COMinit();
  int n,k;
  cin >> n >> k;
  ll a[n]={};
  rep(i,n)cin >> a[i];
  sort(a,a+n);
  ll ans=0;
  R[k-2]=COM(k-2,k-2);
  for(int i=k-1;i<=n;i++){
    R[i]=R[i-1]+COM(i,k-2);
    R[i]%=mod;
  }
  for(int r=2;r<=n;r++){
    sum+=a[r-1]*R[r-2];
    sum%=mod;
  }
  for(int l=1;l<=n-1;l++){
    sum2+=a[l-1]*(R[n-l-1]);
    sum2%=mod;
  }
  sum-=sum2;
  sum+=mod;
  sum%=mod;
  cout << sum << endl;
return 0;
}

Measured memory_bytes: 14464
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, Mod = 1e9 + 7;
using namespace std;
typedef long long ll;
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
int n, k;
vector<int>arr;
int dp[100001];
int sol(int k){
	if (~dp[k])
		return dp[k];
	dp[k] = 0;
	for (int i = 0; i < n; i++){
		if (arr[i] <= k)
			dp[k] |= !sol(k - arr[i]);
	}
	return dp[k];
}
int main(){
	K_K();
	cin >> n >> k;
	arr.resize(n);
	clr(dp, -1);
	for (auto &it : arr)
		cin >> it;
	cout << (sol(k) ? "First" : "Second");
}

Measured memory_bytes: 8704
#include <stdio.h>
#include <math.h>

long long a, b;
long long g;
long long coun;
long long fl;

long long uclid(long long x, long long y)
{
	if(x % y == 0)
	{
		return y;
	}
	
	else
	{
		return uclid(y, x % y);
	}
}

void gogogo(long long x)
{
	if(fl == 1)
		return;
	
	long long sq = sqrt(x);
	long long chek = 0;
	
	for(long long i = 2 ; i <= sq ; i++)
	{
		if(x % i == 0)
		{
			while(x % i == 0)
			{
				x /= i;
			}
			
			chek = 1;
			coun++;
			
			gogogo(x);
			break;
		}
	}
	
	if(chek == 0)
	{
		if(x != 1)
			coun++;
			
		fl = 1;
		return;
	}
}

int main(void)
{
	scanf("%lld %lld", &a, &b);
	
	g = uclid(a, b);
	
	gogogo(g);
	
	printf("%lld", coun + 1);
	return 0;
}

Measured memory_bytes: 128
function Main(input) {
	input = input.trim().split(" ").map((a)=>Number(a));
  var list1 = [2];
  var list2 = [1,3,5,7,8,10,12];
  var list3 = [4,6,9,11];
  if((list1.indexOf(input[0]) != -1 && list1.indexOf(input[1]) != -1) || 
    (list2.indexOf(input[0]) != -1 && list2.indexOf(input[1]) != -1) || 
    (list3.indexOf(input[0]) != -1 && list3.indexOf(input[1]) != -1)){
     console.log("Yes");
     }else{
      console.log("No"); 
     }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);    
    int N,K; cin >> N >> K;
    string S; cin >> S;
 
    VI qua;
    char prev = S[0];
    int sec = 1;
 
    FOR(i,1,S.length())
    {
        dump(S[i])
        dump(prev)
 
 
        if(S[i] == prev)
        {
            sec++;
        }
        else
        {
            qua.pb(sec);
            sec = 1;
        }
        prev = S[i];
    }
    qua.pb(sec);
    //cout << printVector(qua) << endl;
 
    VI wa;
 
    REP(i,SZ(qua))
    {
        if(i == 0) wa.pb(qua[0]);   
        else
        {
            wa.pb(wa[i-1] + qua[i]);
        }
    }
    //cout << printVector(wa) << endl;
 
    LL ans = 0;
    int state; // 1:逆立ち -1:not
    if(S[0] == '0') state = -1;
    else state = 1;

    REP(i,SZ(qua))
    {
        LL kouho;
        if(state == 1)
        {
            int dest = i + 2*K;
            if(dest < SZ(qua))
            {
                kouho = wa[dest] - (i != 0 ? wa[i-1] : 0);
            }
            else
            {
                kouho = wa[SZ(qua)-1] - (i != 0 ? wa[i-1] : 0);
            }
            if(ans < kouho) ans = kouho;
        }
        else
        {
            int dest = i + 2*K-1;
            if(dest < SZ(qua))
            {
                kouho = wa[dest] - (i != 0 ? wa[i-1] : 0);
            }
            else
            {
                kouho = wa[SZ(qua)-1] - (i != 0 ? wa[i-1] : 0);
            }
            if(ans < kouho) ans = kouho;
        }
        state *= -1;
    }
    cout << ans << endl;


 
 
}



Measured memory_bytes: 1528
#include <map>
#include <list>
#include <cmath>
#include <queue>
#include <cstring>
#include <iostream>
#include <algorithm>
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,k,ans=1;
int main()
{
	fast;
	cin>>n>>k;
	for (int i=1;i<=n;i++)
	{
		ans=min(ans*2,ans+k);
	}
	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 MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    int N, X, Y;
    cin >> N >> X >> Y;
    int ans[N] = {0};
    for(int i = 1; i <= N - 1; ++i)
    {
        for (int j = i + 1; j <= N; ++j)
        {
            int dist = min(j - i, abs(X - i) + 1 + abs(Y - j));
            ans[dist]++;
        }
    }
    for (int i = 1; i <= N - 1; ++i) cout << ans[i] << endl;
}


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

typedef vector<int> vi;
typedef vector<ui> vui;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<string> vs;

typedef vector<vi> vvi;
typedef vector<vui> vvui;
typedef vector<vll> vvll;
typedef vector<vull> vvull;
typedef vector<vs> vvs;

typedef string ss;
#define forr(i,b) for(int i = 0; i < b; i++)
#define ford(i,b) for(int i = b; i >= 0; i--)
#define ff for(;;)

template<typename T> int sgn(T val) { return (T(0) < val) - (val < T(0)); }
int gcd(int a, int b) { if(a == 0) return b; return gcd(b % a, a); }
int ncr(int n, int k) { int r = 1; if(k > n - k) k = n - k; for(int i=0;i<k;i++) { r *= n - i; r /= i + 1; } return r; }
template<typename T> void printa(vector<T> arr) { for(ui i = 0; i < arr.size(); i++) if(i != arr.size() - 1) cout << arr[i] << ' '; else cout << arr[i] << '\n'; }

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

    int a,b,c,d;
    cin >> a >> b >> c >> d;

    while(a > 0 && c > 0)  {
        c -= b;
        if(c > 0)
            a -= d;
        else break;
    }

    if(a > 0)
        printf("Yes\n");
    else if(a < 1)
        printf("No\n");

    return 0;
}



Measured memory_bytes: 3644
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <set>
#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>;

using namespace std;

int main()
{
	ll N;
	cin >> N;
	string ret = "";

	while (N)
	{	
		--N;
		ret += (char)('a' + (N % 26));
		N /= 26;
	}

	reverse(ret.begin(), ret.end());
	cout << ret << endl;

}

Measured memory_bytes: 3608
#include<stdio.h>
int main(void){
  int inum[13],num[14];
  int tmp,i,j,k,l=0,flag=1,flag1=0,flag3=0;
  int ko[9],koc[9];
  

  while(1){
  aaa:
    if(scanf("%1d",&inum[0])==EOF){
      break;
    }
    scanf("%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d%1d",&inum[1],&inum[2],&inum[3],&inum[4],&inum[5],&inum[6],&inum[7],&inum[8],&inum[9],&inum[10],&inum[11],&inum[12]);
    for(k=1;k<10;k++){
    lp:
      flag=1;
          
      for(i=0;i<9;i++){
	ko[i]=0;
	koc[i]=0;
      }
      for(i=0;i<13;i++){
	num[i]=inum[i];
      }
      num[13]=k;
      for(i=0;i<13;i++){
	for(j=13;j>i;j--){
	  if(num[j]<num[j-1]){
	    tmp=num[j];
	    num[j]=num[j-1];
	    num[j-1]=tmp;
	  }
	}
      }

     
     
      for(i=0;i<14;i++){
	for(j=1;j<10;j++){
	  if(j==num[i]){
	    ko[j-1]=ko[j-1]+1;
	    if(ko[j-1]>5){
	      printf("0\n");
	      goto aaa;
	    }
	  }
	}
      }
   
      for(i=0;i<9;i++){
	koc[i]=ko[i];
	if(koc[i]>4){
	  k++;
	  goto lp;
	}
      }

     
      //hanntei

      for(j=0;j<9;j++){
	for(l=0;l<9;l++){
	  koc[l]=ko[l];
	}

	if(flag==1){
	  
	  if(koc[j]>=2){
	    flag=0;
	    flag1=0;
	    koc[j]=koc[j]-2;
	    
	    
	    for(l=0;l<9;l++){
	      if(koc[l]==1&&koc[l+1]>=1&&koc[l+2]>=1){
		koc[l]--;
		koc[l+1]--;
		koc[l+2]--;
	      }else if(koc[l]==4&&koc[l+1]>=1&&koc[l+2]>=1){
		koc[l]--;
		koc[l+1]--;
		koc[l+2]--;
	      }
	    }
	   

	     for(l=0;l<9;l++){
	      if(koc[l]==2&&koc[l+1]>=2&&koc[l+2]>=2){
		koc[l]=koc[l]-2;
		koc[l+1]=koc[l+1]-2;
		koc[l+2]=koc[l+2]-2;
	      }
	    }
	  
	    for(l=0;l<9;l++){
	      if(koc[l]>=3){
		koc[l]=koc[l]-3;
	      }
	    }
	   
	   
	    for(l=0;l<9;l++){
	      if(koc[l]==1&&koc[l+1]>=1&&koc[l+2]>=1){
		koc[l]--;
		koc[l+1]--;
		koc[l+2]--;
	      }
	      }
	    for(l=0;l<9;l++){
	      if(koc[l]!=0){
		flag=1;
		flag1=1;
	      }
	    }
	    if(flag1==0){
	      if(flag3>0){
		printf(" ");
	      }
	      printf("%d",k);
	      flag3++;
	    }
	  }
	}
      }
    }
    if(flag3==0){
      printf("0");
    }
    printf("\n");
    flag3=0;
  }
  return 0;
}

Measured memory_bytes: 1812
N,x = map(int,input().split())
A = list(map(int,input().split()))
cnt = 0
if A[0]>x:
    cnt += A[0]-x
    A[0] = x
if A[-1]>x:
    cnt += A[-1]-x
    A[-1] = x
for i in range(1,N-1):
    if A[i-1]+A[i]>x:
        cnt += A[i-1]+A[i]-x
        A[i] = x-A[i-1]
if A[N-1]+A[N-2]>x:
    cnt += A[N-1]+A[N-2]-x
    A[N-2] = x-A[N-1]
print(cnt)

Measured memory_bytes: 63984
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    private static final int ALL_DIGITS_SAME = 111;

    public static String process(TestCase testCase) {
        final int N = testCase.N;

        return String.valueOf(
                IntStream.range(1, 10)
                .map(i -> i * ALL_DIGITS_SAME)
                .filter(contestNum -> contestNum >= N)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("N is too large: " + N))
        );
    }

    // Util func

    public static void main(String[] args) {
        TestCase testCase = readFromInput();

        final String result = process(testCase);

        output(result);
    }

    private static TestCase readFromInput() {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        return new TestCase(N);
    }

    private static void output(String result) {
        System.out.println(result);
    }

    public static class TestCase {
        final int N;

        public TestCase(int N) {
            this.N = N;
        }
    }
}


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

int main() {
	int a, b, c, yaku = 0;
	cin >> a >> b >> c;
	while(a <= b) {
		if(c % a == 0) {
			yaku++;
		}
		a++;
	}
	cout << yaku << endl;
}


Measured memory_bytes: 3080
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a,b,x = Is()
y = 2*(b - (x/a**2))
if y <= b:
    print(math.degrees(math.atan2(y,a)))
else:
    print(math.degrees(math.atan2(b,2*x/a/b)))


Measured memory_bytes: 4584
#include<stdio.h>
int main(void){
   int  a, b, ab, o, i;
   a = b = ab = o = 0;
   char s[10];
   while ( scanf("%d, %s", &i, s) != EOF ) {
      if ( s[0] == 'A' && s[1] == 'B') ab++;
      else if ( s[0] == 'A' ) a++;
      else if ( s[0] == 'B' ) b++;
      else if ( s[0] == 'O') o++;
/*rintf("%d %d %d %d\n", a, b, ab, o);*/
   }
   printf("%d\n%d\n%d\n%d\n", a, b, ab, o);
   return 0;
}

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

#define rep(i,a,b) for(int i=a;i<b;i++)

typedef pair<int, int> pii;
typedef vector<pii> vpii;

bool solve(vpii temp, vpii target)
{
	rep(i, 1, target.size())
		target[i] = make_pair(target[i].first - target[0].first, target[i].second - target[0].second);
	target[0] = make_pair(0, 0);

	rep(i, 0, 4)
	{
		bool ok = true;
		rep(j, 0, target.size())
		{
			if (temp[j].first != target[j].first || temp[j].second != target[j].second) ok = false;
		}
		if (ok) return true;

		rep(j, 0, target.size())
		{
			target[j] = make_pair(-target[j].second, target[j].first);
		}
	}

	rep(i, 0, target.size() / 2)
	{
		pii p = target[i];
		target[i] = target[target.size() - 1 - i];
		target[target.size() - 1 - i] = p;
	}

	rep(i, 1, target.size())
		target[i] = make_pair(target[i].first - target[0].first, target[i].second - target[0].second);
	target[0] = make_pair(0, 0);

	rep(i, 0, 4)
	{
		bool ok = true;
		rep(j, 0, target.size())
		{
			if (temp[j].first != target[j].first || temp[j].second != target[j].second) ok = false;
		}
		if (ok) return true;

		rep(j, 0, target.size())
		{
			target[j] = make_pair(-target[j].second, target[j].first);
		}
	}

	return false;
}

int main()
{
	while (1)
	{
		int n; cin >> n;
		if (n == 0) return 0;

		int tm; cin >> tm;
		vpii temp(tm);
		rep(i, 0, tm)
		{
			int x, y; cin >> x >> y;
			temp[i] = make_pair(x, y);
		}
		rep(i, 1, tm) temp[i] = make_pair(temp[i].first - temp[0].first, temp[i].second - temp[0].second);
		temp[0] = make_pair(0, 0);
		
		rep(i, 1, n + 1)
		{
			int m; cin >> m;
			vpii target(m);
			rep(j, 0, m)
			{
				int x, y; cin >> x >> y;
				target[j] = make_pair(x, y);
			}

			if (tm != m) continue;

			if (solve(temp, target))
				cout << i << endl;
		}

		cout << "+++++" << endl;
	}
}

Measured memory_bytes: 2908
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) ((a>b)?a:b);
#define min(a,b) ((b>a)?a:b);
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)                                 //g++ template.cpp -o template.exe
#define zeroes(x) memset(x,0,sizeof(x))                                        //all elements to 0
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn=100000;
 
 
 
 
 
 
 
bool sortbysec(const pair<int,int> &a,                         //sorting of elements wrt second
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
 
 
 
 
int main()
{
    long double a,b,h,m;
    long double th1,th2,sum;
    cin>>a>>b>>h>>m;
    
 
    th1=6*(long double)m;
    th2=30*(long double)h+(long double)m/2.0;
    //cout<<cos(60*3.141592654/180.0)<<endl;
    //cout<<th2-th1<<cos((th2-th1)*M_PI/180.0) <<endl;
  sum=sqrt((long double)(a*a+b*b)-(long double)(2*b*a)*(cos((long double)(th1-th2)*(long double)M_PI/180.0) ));
 
    cout<<setprecision(20)<<fixed<<sum<<endl;
 
    return 0;
}

Measured memory_bytes: 4172
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
constexpr char ln = '\n';

const int mx=200010;
const ll mod=1e9+7;

int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  vector<ll> v(n);
  rep(i,n){
    cin >> v[i];
  }
  sort(v.rbegin(),v.rend());
  ld ans = 0;
  rep(i,a){
    ans += v[i];
  }
  ans /= (ld)a;
  cout << fixed << setprecision(10) << ans << ln;

  if(v[a-1]!=v[a]){
    cout << 1 << ln; return 0;
  }

  int st=-1,ed=-1;
  rep(i,n){
    if(st==-1 && v[i]==v[a-1]){
      st = i;
    }
    if(st!=-1 && v[i]==v[a-1]){
      ed = i;
    }    
  }

  if(st!=0){
    ll C = ed-st+1;
    ll K = a-st;
    ll ans2 = 1;
    for(ll i=0; i<K; i++){
      ans2 *= (C-i);
      ans2 /= (i+1);
    }
    cout << ans2 << ln;
  } else {
    ll C = ed-st+1;
    ll K = a-st;
    ll ans2 = 0;
    for(ll j=K; j<=min(C,b); j++){
      ll tmp = 1;
      for(ll i=0; i<j; i++){
        tmp *= (C-i);
        tmp /= (i+1);
      }
      ans2 += tmp;
    }
    cout << ans2 << ln;
  }
  return 0;
}

Measured memory_bytes: 3808
#include <cmath>
#include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(false);

	int n, k;
	cin >> n >> k;
	int k2 = 2*k;
	vector< vector<int> > b(2*k, vector<int>(2*k,0));
	vector< vector<int> > w(2*k, vector<int>(2*k,0));
	vector< vector<int> > sb(2*k+1, vector<int>(2*k+1,0));
	vector< vector<int> > sw(2*k+1, vector<int>(2*k+1,0));
	for(int i=0; i<n; ++i)
	{
		int x, y;
		char c;
		cin >> x >> y >> c;
		if(c == 'B')
			++b[y%k2][x%k2];
		else
			++w[y%k2][x%k2];
	}
	
	for(int y=0; y<k2; ++y)
		for(int x=0; x<k2; ++x)
		{
			sb[y+1][x+1] = b[y][x] + sb[y][x+1] + sb[y+1][x] - sb[y][x];
			sw[y+1][x+1] = w[y][x] + sw[y][x+1] + sw[y+1][x] - sw[y][x];
		}

	int ans = 0;

	for(int y=0; y<k; ++y)
		for(int x=0; x<k; ++x)
		{
			int nb = sb[y+k][x+k] - sb[y][x+k] - sb[y+k][x] + sb[y][x]*2
				+ (sb[k2][k2] - sb[y+k][k2] - sb[k2][x+k] + sb[y+k][x+k])
				+ (sb[y][k2] - sb[y][x+k])
				+ (sb[k2][x] - sb[y+k][x]);
			int nw = sw[y+k][x+k] - sw[y][x+k] - sw[y+k][x] + sw[y][x]*2
				+ (sw[k2][k2] - sw[y+k][k2] - sw[k2][x+k] + sw[y+k][x+k])
				+ (sw[y][k2] - sw[y][x+k])
				+ (sw[k2][x] - sw[y+k][x]);
			ans = max(ans, nb + sw[k2][k2]-nw);
			ans = max(ans, sb[k2][k2]-nb + nw);
		}
	
	cout << ans << "\n";

	return 0;
}


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

int main(){
    int n;
    int a;
    int flag=1;

    cin >> n;
    for (int i=0; i<n; i++){
        cin >> a;
        if (a%2 == 0){
            if (a%3 == 0 || a%5 == 0){
                flag = 1;
            }
            else {
                flag = 0;
                break;
            }
        }

    }
    if (flag ) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0; 
    
}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}



main(){
	int n,ans=0;
	cin>>n;
	int h[n];
	rep(i,n)cin>>h[i];
	int dp=h[0];
	rep(i,n){
		if(dp<=h[i]){
			ans++;
			dp=h[i];
		}
	}
	dans;
}





Measured memory_bytes: 256
array = [
    1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
]

s = int(input())
print(array[s-1])


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

int a[5], f[5];

int main(){
  for(int i = 0; i < 5; i++){
    f[i] = 10;
  }
  for(int i = 0; i < 5; i++){
    cin >> a[i];
  }

  int tmp = 10, k;
  for(int i = 0; i < 5; i++){
    f[i] = a[i] % 10;
    if(f[i] != 0 && tmp > f[i]){
      tmp = f[i];
      k = i;
    }
  }

  int ans = 0;
  if(tmp == 10){
    for(int i = 0; i < 5; i++){
      ans += a[i];
    }
    cout << ans << endl;
  }
  else{
    for(int i = 0; i < 5; i++){
      if(i == k || f[i] == 0)  ans += a[i];
      else ans += a[i] + (10 - f[i]);
    }
    cout << ans << endl;
  }

  return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  int n, d, x, y, ans = 0;
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (sqrt((double)x*x + (double)y*y) <= d)
      ans++;
  }

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


Measured memory_bytes: 3192
#include<cstdio>
using namespace std;
typedef long long ll;
ll a,b,ans=1;
int main()
{
    scanf("%lld%lld",&a,&b);
    for(ll i=2;i*i<=a;i++)
    {
        if(a%i==0)
        {
            if(b%i==0)
            ans++;
            while(a%i==0)
            a/=i;
        }
    }
    ans+=(a>1&&b%a==0);
    printf("%lld\n",ans);
    return 0;
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  int n; cin >> n;
  cout << (n >= 30 ? "Yes" : "No") << endl;
  return 0;
}


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

using ll=long long;
const ll MOD=1000000007;

int main() {
  ll a,b,x;
  cin >> a >> b >> x;
  if(a!=0)
    cout << (b/x)-(a-1)/x << endl;
  else{
    if(a==b&&b==0)
      cout << 1 << endl;
    else
      cout << (b/x)+1 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <cstring>

using namespace std;
vector<set<pair<int,int> > > v;
set<pair<int,int> > s2;
//
int a[100005];
int f[100005];
int h[100005];
int find(int x)
{
	if(f[x]==x) return x;
	find(f[x]);
}
int main()
{
	long long cost=0;
	int n,m;
	cin>>n>>m;
	memset(h,0,sizeof(h));
	for(int i=0;i<n;i++) f[i]=i;
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) s2.insert(make_pair(a[i],i));
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		f[find(x)]=find(y);
	}
	if(n-1==m) 
	{
		cout<<0<<endl;
		return 0;
	}
	if((n-1-m)*2>n) 
	{
		cout<<"Impossible"<<endl;
		return 0;
	}
	int tot=0;
	for(int i=0;i<n;i++)
	{
		f[i]=find(f[i]);
		if(h[f[i]]==0) h[f[i]]=++tot;
	}
	for(int i=1;i<=tot;i++)
	{
		set<pair<int,int> > s;
		v.push_back(s);
	}
	for(int i=0;i<n;i++)
	{
		v[h[f[i]]-1].insert(make_pair(a[i],i));
	}
	for(int i=0;i<n-m;i++)
	{
		cost+=(*v[i].begin()).first;
		s2.erase((*v[i].begin()));
	}
	int temp=(n-1-m)*2-(n-m);
	for(int i=1;i<=temp;i++)
	{
		cost+=(*s2.begin()).first;
		s2.erase(*s2.begin());
	} 
	cout<<cost<<endl;
	return 0;
}

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

#define ADD 0
#define GETSUM 1

using namespace std;

vector<int> a;

void _add(int index, int n) {
	a[index] += n;
}

void get_sum(int s, int t) {
	int sum = 0;

	for(int i = s;i <= t;i++) {
		sum += a[i];
	}

	cout << sum << endl;
}

int main() {
	int n, q, com, x, y;

	cin >> n >> q;

	a.resize(n);
	fill(a.begin(), a.end(), 0);

	for(int i = 0;i < q;i++) {
		cin >> com >> x >> y;

		switch(com) {
			case ADD:
				x--;
				_add(x, y);
				break;

			case GETSUM:
				x--;
				y--;
				get_sum(x, y);
				break;
		}
	}

	return 0;
}
	




Measured memory_bytes: 3128
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ESumEqualsXor solver = new ESumEqualsXor();
        solver.solve(1, in, out);
        out.close();
    }

    static class ESumEqualsXor {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char c[] = s.next().toCharArray();
            long mod = (long) 1e9 + 7, ans = 0;
            int n = c.length, tot = 0, cur = n - 1;
            for (int i = 0; i < n; i++) {
                if (c[i] == '1') {
                    ans += func.power(2, tot++, mod) * func.power(3, cur, mod);
                    ans %= mod;
                }
                cur--;
            }
            ans += func.power(2, tot, mod);
            ans %= mod;
            w.println(ans);
        }

    }

    static class func {
        public static long power(long x, long y, long p) {
            long res = 1;
            x = x % p;
            while (y > 0) {
                if ((y & 1) == 1)
                    res = (res * x) % p;
                y = y >> 1;
                x = (x * x) % p;
            }
            return res;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22868
import sys

def S(): return sys.stdin.readline().rstrip()

N,M = map(int,S().split())
mod = 10**9+7

a = M  # (M_P_N)**2
for i in range(1,N):
    a *= M-i
    a %= mod

# 包除原理
# 2つめの条件は常に成り立った状況で考える
# {1,…,N}の部分集合Sの元iに対してA_i=B_iが成り立つようなA_1,…,B_1,…の組の個数を考える
ans = a**2 % mod
r = ans
for i in range(1,N+1):
    r *= (N-i+1)*pow(i,-1,mod)*pow(M-i+1,-1,mod)*(-1)
    r %= mod
    ans += r
    ans %= mod

print(ans)

Measured memory_bytes: 9208
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, x;
    cin >> n >> x;
    vector<int> l(n);
    rep(i, 0, n){
        cin >> l[i];
    }
    int ans = 1;
    int now = 0;
    rep(i, 0, n){
        now += l[i];
        if(now <= x) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

dp = [[0] * (N + 1) for _ in range(N + 1)]

for d in range(1, N + 1):
    for i in range(N - d + 1):
        j = i + d
        if (N-d) % 2 == 1:
            dp[i][j] = min(dp[i+1][j]-A[i], dp[i][j-1]-A[j-1])
        else:
            dp[i][j] = max(dp[i+1][j]+A[i], dp[i][j-1]+A[j-1])

ans = dp[0][N]
print(ans)


Measured memory_bytes: 113116
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;

int main() {
    int x;
    cin >> x;
    for(int i = x;i<200000;++i){
        bool ok = true;
        for(int j = 2; j*j<=i;++j){
            if(i%j==0) ok = false;
        }
        if(ok) {cout << i <<endl;
        return 0;}
    }
}

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

public class Main {

	public static void main(String[] args) {
		Map<String, Integer> map = new HashMap<String, Integer>();
		map.put("SUN", 7);
		map.put("MON", 6);
		map.put("TUE", 5);
		map.put("WED", 4);
		map.put("THU", 3);
		map.put("FRI", 2);
		map.put("SAT", 1);
		Scanner scanner = new Scanner(System.in);
		String input = scanner.nextLine();
		System.out.println(map.get(input));
	}

}

Measured memory_bytes: 23892
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 2000000000
#define FOR(i,a,n) for(i=a;i<n;i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}
void fill(int a[],int b,int c){
	int i;
	FOR(i,0,b) a[i]=c;
	return;
}
int n,a,b;
int h[100000];
int check(ll t){
	int i,d=a-b;
	ll k=b*t;
	FOR(i,0,n){
		if(h[i]>k){
			t-=((h[i]-k+d-1)/d);
		}
	}
	return t>=0;
}
int main(void)
{
	int i;
	ll l=0,r=INF,mid;
	scanf("%d%d%d",&n,&a,&b);
	FOR(i,0,n) scanf("%d",&h[i]);
	FOR(i,0,100){
		mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%lld\n",r);
	return 0;
}

Measured memory_bytes: 512
while True:
    wh = list(map(int, input().split()))
    if wh[0] == 0 and wh[1] == 0:
        break
    else:
        for i in range(wh[0]):
            if i > 0:
                print()
            if i == 0 or i == (wh[0] - 1):
                for j in range(wh[1]):
                    print("#", end="")
            else:
                for j in range(wh[1]):
                    if j == 0 or j == (wh[1] - 1):
                        print("#", end="")
                    else:
                        print(".", end="")
        print("\n")



Measured memory_bytes: 7004
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long

const int N=1005;
const int MOD=1e9+7;
 
 
int32_t main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  set<int> s;
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
  {
  	cin>>arr[i];
  	s.insert(arr[i]);
  }
  if(s.size()==n)
  {
  	cout<<"YES";
  }
  else
  {
  	cout<<"NO";
  }
  
}



Measured memory_bytes: 11264