akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	vector<int>a(n);
	int s=0,mx=0;
	for(auto& i:a)cin>>i,s+=i;
	int c=0;
	for(auto i:a){
		if(i*4*m>=s){
			c++;
		}
	}
	puts(c>=m?"Yes":"No");
}

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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template<typename T, size_t size> void fill(T (&ary)[size], const T& val){
    fill_n((T*)ary, size, val);
}

void solve() {
    //const i64 mod = 1'000'000'007;
    i64 A,B,T;
    cin >> A >> B >> T;
    cout << B*(T/A) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
/*
 *
 * Author: r3gz3n
 * 3b 13 12 9 56 4e
 * 6 56 a a 5f f
 * 6 56 47 18 56 d
 * 13 46 14 1f 13 27
 * 52 52 a 5a 47 1
 * 1d 13 b 1b 49 17
 *
 */


#include <utility>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;


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


#define siz(x) ((int) x.size())


class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
		string s;
		in >> s;
		int x = -1, y = -1;
		rep(i, 0, siz(s), 1) {
			if (s[i] == 'Z') y = i;
			if (s[i] == 'A' and x == -1) x = i;
		}
		out << y - x + 1 << endl;
    }
};

void solve(std::istream& in, std::ostream& out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}


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


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}




Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define INF 100000000

int main(){
  int n,m;
  cin >> n >> m;
  vector<vint> A(m,vint(2));
  vector<vint> tmpA(m,vint(2));
  vector<vint> B(n);
  rep(i,m) cin >> A[i][0] >> A[i][1];
  tmpA = A;
  sort(tmpA.begin(),tmpA.end());
  rep(i,m) {
    B[tmpA[i][0]-1].push_back(tmpA[i][1]);
   // cout << "a" << endl;
  }
  //rep(i,B[0].size()) cout << B[0][i] << endl;
  //cout << B[0][0] << endl;
  //cout << find(B[0].begin(), B[0].end(),12)-B[0].begin()+1<< endl;
  //rep(i,m) cout << A[i][0] << " " << find(B[A[i][0]-1].begin(), B[A[i][0]-1].end(), A[i][1]) << endl;
  rep(i,m) printf("%06d%06d\n",A[i][0],lower_bound(B[A[i][0]-1].begin(), B[A[i][0]-1].end(), A[i][1]) -B[A[i][0]-1].begin()+1);
}


//sortしてから配列に突っ込む
//そのあと、それぞれの県番号と配列の何番目かを出力したらいい


Measured memory_bytes: 17920
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD (int64_t)1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector


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

int N; cin >> N;

i64 cnt = 0;
VVI c(10, VI(10, 0));
rep(i, 1, N+1){
    int digit = (int)log10(i) + 1;
    ++c[i / (int)pow(10, digit-1) % 10][i % 10];
}

rep(i, 0, 10) rep(j, 0, 10)
    cnt += c[i][j] * c[j][i];

cout << cnt << "\n";

return 0;
}
// 書いて考える．場合分け．情報整理．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll m=1000000000000000000;
ll a[1000010];
int flag=0;
ll sum=1;
int r;
int main()
{
    int n;
    scanf("%d",&n);
    rep(i,1,n+1){
    	scanf("%lld",&a[i]);
	}
	sort(a+1,a+1+n);
	if(a[1]==0){
		printf("0\n");
		return 0;
	}
	rep(i,1,n+1){
		if(sum<=(m/a[i])){
			sum*=a[i];
		}
		else{
			flag=1;
			break;
		}
	}
	if(flag){
		cout<<-1;
	}
	else cout<<sum;
    return 0;
}


Measured memory_bytes: 4552
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;

int main(void){
        int i,j;
        long long a,b,c,d;
        long long ll;
        int n;
        c=0;
        scanf("%lld",&n);
        scanf("%lld",&a);
        scanf("%lld",&b);
        for(i=2;i<n;i++){
                scanf("%lld",&ll);
                c = c^ll;
        }
        d=a+b;
        if(((d-c)%2)!=0){
                printf("-1\n");
                return 0;
        }
        long long e;
        long long f;
        e=(d-c)/2;
        f=d-e;
        for(i=63;i>=0;i--){
                if(((e>>i)%2 == 0) && ((f>>i)%2 == 1)){
                        if(e+(1ull<<i) <= a){
                                e=e+(1ull<<i);  
                        }
                }
        }
        //printf("%lld\n",e);
        if(e<=0 || e>a){
                printf("-1\n");
                return 0;
        }

        if( (e^(d-e)) != c){
                printf("-1\n");
                return 0;
        }
        printf("%lld\n",a-e);
        return 0;
}
                


Measured memory_bytes: 3828
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

struct Party{
  int number;
  ull A;
};

using P=std::pair<int, int>;

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

  int N;
  cin >> N;
  vector<Party> Member(N);
  rep(i, N) {
    Member[i].number = i+1;
    cin >> Member[i].A;
  }

  vector<P> X(N);
  rep(i, N) {
    X[i].first  = Member[i].number + Member[i].A;
    X[i].second = Member[i].number - Member[i].A;
  }

  std::unordered_map<int, int> mp;
  ull ans {};
  rep(i, N) {
    ans += mp[X[i].second];
    ++mp[X[i].first];
  }

  cout << ans << '\n';
}


Measured memory_bytes: 23224
#include <iostream>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <float.h>
#include <limits>
#include <vector> 
#include <string.h>
#include <iomanip>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define INF 2147483647
#define ll long long
#define asort(a) sort(a.begin(),a.end());
#define usort(a) sort(a.rbegin(),a.rend());

using namespace::std;

int jo(ll int a, ll int b){//累乗
    ll int num=1;
    rep(i,0,b) num=num*a;
    return num;
}
char tobig(char s){//char大文字化
  return (s-0x20);
}
char tolow(char s){//char小文字化
  return (s+0x20);
}
int ctoi(char a){//char->int
  if('0'<=a&&a<='9') return (a-'0');
  return -1;
}

int gcd(ll int a,ll int b) {//最大公約数
  if(a<b) return gcd(b,a);
  int c;
  while ((c=a%b)) {
    a=b;
    b=c;
  }
  return b;
}
int lcm(ll int a,ll int b){//最小公倍数
 return (a*b)/gcd(a,b);
}


int main(){
  string S,T;
  cin>>S>>T;
  cout<<T<<S;
  
}
// int *p = new int[N];

//  sort(変数名.begin(),変数名.end());//昇順ソート
//  sort(変数名.rbegin(),変数名.rend());//降順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//cout<<fixed<<setprecision(n);  //小数点n桁まで表示

//  vector<pair<int,int>> data(N);  //2つのデータを格納、.first/.secondで参照
// pairのソートはfirst優先の昇順

//cout.fill('0');
//cout<<setw(N)<<value;  //整数の左側を0梅して指定桁数出力

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int x,y,z,k;
  cin >> x >> y >> z >> k;
  vector<ll> a(x);
  vector<ll> b(y);
  vector<ll> c(z);
  vector<ll> d;
  vector<ll> e;
  for(int i = 0;i < x;i++)cin >> a[i];
  for(int i = 0;i < y;i++)cin >> b[i];
  for(int i = 0;i < z;i++)cin >> c[i];
  sort(c.begin(),c.end(),greater<ll>());
  for(int i = 0;i < x;i++){
    for(int j = 0;j < y;j++){
      d.push_back(a[i]+b[j]);
    }
  }
  sort(d.begin(),d.end(),greater<ll>());
  for(int i = 0;i < k && i < x*y;i++){
    for(int j = 0;j < k && j < z;j++){
      e.push_back(d[i]+c[j]);
    }
  }
  sort(e.begin(),e.end(),greater<ll>());
  for(int i = 0;i < k;i++){
    cout << e[i] << endl;
  }
}

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

using namespace std;

int main()
{
int a;
int y[100];
cin>>a;int s[9]={};
for(int i=0;i<a;i++)
{cin>>y[i];
 if(y[i]>=1&&y[i]<=399)
 s[0]++;
  if(y[i]>=400&&y[i]<=799)
 s[1]++;
  if(y[i]>=800&&y[i]<=1199)
 s[2]++;
  if(y[i]>=1200&&y[i]<=1599)
 s[3]++;
  if(y[i]>=1600&&y[i]<=1999)
 s[4]++;
  if(y[i]>=2000&&y[i]<=2399)
 s[5]++;
  if(y[i]>=2400&&y[i]<=2799)
 s[6]++;
  if(y[i]>=2800&&y[i]<=3199)
 s[7]++;
  if(y[i]>=3200)
 s[8]++;
}
int sum=0,k=0;
for(int i=0;i<8;i++)
{
    if(s[i]>0)
    k++;
}int hh=k;
k+=s[8];


cout<<max(1,hh)<<' '<<k;

cout<<endl;
return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s []byte
	fmt.Scanf("%s", &s)
	length := len(s) - 1
	n := 0
	count := 0
	for {
		if n >= length - n {
			break
		}
		if s[n] != s[length - n] {
			count++
		}
		n++
	}

	fmt.Printf("%d", count)
}

Measured memory_bytes: 512
//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    vector<int> v[100001];

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,m,i,j,k;
            cin>>n>>m;
            ll ans=0;
            pll ar[n+1];
            for(i=1;i<=n;++i)
            {
                cin>>ar[i].s>>ar[i].f;
                if(m-ar[i].s+1<=0)
                    continue;
                v[m-ar[i].s+1].pb(ar[i].f);
            }
            set<pii> st;
            k=1;
            for(i=m;i>=1;--i)
            {
                for(j=0;j<v[i].size();++j,++k)
                {
                    st.insert({-1*v[i][j],k});
                }
                if(st.size()>0)
                {
                    auto it=st.begin();
                    ans=ans+-1*it->f;
                    st.erase(it);
                }
            }
            cout<<ans<<endl;
        }
        return 0;
    }


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

using ll = long long;
const int INF = 1e9 + 5;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,k;
    scanf("%d%d",&n,&k);
    vector<int> h(n);
    for(int i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
    vector<int> dp(n,INF);
    dp[0] = 0;
    for(int i=0;i<n;i++){
		for(int j=i+1;j<=i+k;j++){
			if(j<n){
				dp[j] = min(dp[j],dp[i] + abs(h[i]-h[j]));
			}
		}
	}
    cout<<dp[n-1];
    return 0;
}









Measured memory_bytes: 1024
#include <stdio.h>
#define MAX 1000000
#define W 10000
#define INFTY 2000000000
int F(int,int [],int);
int main()
{
  int n,k,w[MAX]={},m,r,l,sum=0,i;
  
  scanf("%d %d",&n,&k);
  
  for(i=0;i<n;i++){
    scanf("%d",&w[i]);
  }

  w[n]=-1;
  l=0;
  r=INFTY;

  while(l<r){
    m=(l+r)/2;
    sum=F(m,w,k);
    if(sum==n && F(m-1,w,k)!=sum) break;
    if(sum<n) l=m+1;
    else if(sum==n && F(m-1,w,k)==sum) r=m;
  }

  printf("%d\n",m);

  return 0;
}

int F(int p,int w[],int k){
  int i,sum=0,s=0;
  for(i=0;i<k;i++){
    if(w[s]<=p){
      while(sum+w[s]<=p&&w[s]!=-1){
	sum+=w[s];
	s++;
      }
    }
    sum=0;
  }
  return s;
}

Measured memory_bytes: 6652
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
int const MOD = 1000000007;
#define END {cout<<END<<'\n'; return 0;}
#define ALL(vec) vec.begin(),vec.end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,s,n) for(int i=s; i<n; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<a<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n';
template<class T> inline bool cmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool cmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int n,m,q,_,x,y;
string s,t;
bool ok;

int main(){
  cin.tie(0); ios::sync_with_stdio(false);
    
  cin>>n; V(int)a(n); rep(i,n)cin>>a[i];
  rep(i,n){
    m=i;
    rer(j,i+1,n)if(a[j]<a[m])m=j;
    swap(a[i],a[m]);
    if(i!=m)q++;
  }
  pri2(a,n); pri1(q);
}


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> A, std::vector<long long> B)
{

    ll ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (A[i] <= B[i])
        {
            ans += A[i];
            B[i] -= A[i];
            A[i] = 0;
        }
        else
        {
            ans += B[i];
            A[i] -= B[i];
            B[i] = 0;
        }

        if (A[i + 1] <= B[i])
        {
            ans += A[i + 1];
            B[i] -= A[i + 1];
            A[i + 1] = 0;
        }
        else
        {
            ans += B[i];
            A[i + 1] -= B[i];
            B[i] = 0;
        }
    }

    cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N + 1);
    for (int i = 0; i < N + 1; i++)
    {
        scanf("%lld", &A[i]);
    }
    std::vector<long long> B(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &B[i]);
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}


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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

const int MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); ++i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;
// TOP
void Main()
{
	ll n, m;
	cin >> n >> m;
	vector<pair<ll, ll>> V(n);
	rep(i, n)
			cin >>
		V.at(i).first >> V.at(i).second;
	sort(V.begin(), V.end());
	ll sum;
	sum = 0;
	rep(i, n)
	{
		if (m > V.at(i).second)
		{
			m -= V.at(i).second;
			sum += V.at(i).first * V.at(i).second;
		}
		else
		{
			sum += V.at(i).first * m;
			break;
		}
	}
	cout << sum << endl;
}
// END

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


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

using namespace std;
using ll = long long;
using ld = long double;

//#define int long long
//signed main(){
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    cin >> n >> s;

    int w=0;
    for(int i = 0; i < n; i++) {
        if(s[i]=='.') w++;
    }

    int b=0;
    int ans=w;
    for(int i = 0; i < n; i++) {
        if(s[i]=='#') b++;
        else w--;
        ans=min(ans,b+w);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3796
from itertools import product

n = int(input())
fs = [[int(x) for x in input().split()] for _ in range(n)]
ps = [[int(x) for x in input().split()] for _ in range(n)]

xs = product((0, 1), repeat=10)
next(xs)
print(max(sum(p[sum(a==b==1 for a, b in zip(f, x))] for f, p in zip(fs, ps)) for x in xs))

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

bool calc(char a)
{
	bool ret = false;
	if (a == 'A') {
		ret = true;
	} else if (a == 'B') {
		ret = true;
	} else if (a == 'C') {
		ret = true;
	} else if (a == 'D') {
		ret = true;
	} else if (a == 'E') {
		ret = true;
	} else if (a == 'F') {
		ret = true;
	} else if (a == 'G') {
		ret = true;
	} else if (a == 'H') {
		ret = true;
	} else if (a == 'I') {
		ret = true;
	} else if (a == 'J') {
		ret = true;
	} else if (a == 'K') {
		ret = true;
	} else if (a == 'L') {
		ret = true;
	} else if (a == 'M') {
		ret = true;
	} else if (a == 'N') {
		ret = true;
	} else if (a == 'O') {
		ret = true;
	} else if (a == 'P') {
		ret = true;
	} else if (a == 'Q') {
		ret = true;
	} else if (a == 'R') {
		ret = true;
	} else if (a == 'S') {
		ret = true;
	} else if (a == 'T') {
		ret = true;
	} else if (a == 'U') {
		ret = true;
	} else if (a == 'V') {
		ret = true;
	} else if (a == 'W') {
		ret = true;
	} else if (a == 'X') {
		ret = true;
	} else if (a == 'Y') {
		ret = true;
	} else if (a == 'Z') {
		ret = true;
	}
	return ret;
}

int main()
{
	char a;
	cin >> a;
	if (calc(a)) {
		cout << 'A' << endl;
	} else {
		cout << 'a' << endl;
	}

}


Measured memory_bytes: 3644
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int Nums[]=new int[A];
    int count=0;
    for(int i=0;i<A;i++){
    	Nums[i]=sc.nextInt();
    }
     for(int i=0;i<A;i++){
    	if(Nums[i]>=B){
        	count++;
        }
    }
    System.out.print(count);
  }
}

Measured memory_bytes: 49952
require "pp"
H,W=gets.split.map &:to_i
cs=10.times.map{gets.split.map(&:to_i)}
ws=H.times.map{gets.split.map(&:to_i)}
minpower=Array.new(10,nil)
for i in 0..9
    fin=false
    dp=Array.new(10){Array.new(1010,false)}
    dp[i][0]=true
    for k in 0...1010
        for j in 0..9
            if dp[j][k]
                for l in 0..9
                    dp[l][k+cs[j][l]]=true
                end
            end
            if dp[j][k] && j==1
                minpower[i]=dp[1].index{|x|x}
                fin=true
            end
            break if fin
        end
        break if fin
    end
end

cnt=0
for i in 0...H
    for j in 0...ws[0].size
        next if ws[i][j]==-1
        cnt+=minpower[ws[i][j]]
    end
end
puts cnt


Measured memory_bytes: 6012
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RankNTypes #-}
import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe
import Data.List
import Data.Bifunctor
import qualified Data.Vector.Unboxed as VU
-- import qualified Data.Vector.Unboxed.Mutable as VUM
import Control.Monad
-- import Control.Monad.ST
-- import Debug.Trace
-- trace _ = id

solve :: Int -> [Int] -> [Int]
solve n as | even n    = reverse os ++ es
           | otherwise = reverse es ++ os
  where
    (es, os) = part as

part (a:b:xs) = (a:es1, b:os1)
  where (es1, os1) = part xs
part es2 = (es2, [])

readBInt :: B.ByteString -> Int
readBInt = fst . fromJust . B.readInt

tmain :: B.ByteString -> [Int]
tmain cont =
  let remLines0 = map B.words (B.lines cont)
      [bs_n]:remLines1 = remLines0
      n = readBInt bs_n
      line2:remLines2 = remLines1
      as = map readBInt line2
  in solve n as

outAnswer :: [Int] -> IO ()
outAnswer ns = putStrLn $ unwords $ map show ns

main :: IO ()
main = outAnswer . tmain =<< B.getContents


-------------------------------------------------------------------------------

inp1 = "4\n1 2 3 4\n"
inp2 = "3\n1 2 3\n"
inp3 = "1\n1000000000\n"
inp4 = "6\n0 6 7 6 7 0\n"
tv1 = tmain $ B.pack inp1
tv2 = tmain $ B.pack inp2
tv3 = tmain $ B.pack inp3
tv4 = tmain $ B.pack inp4
test1 = tv1 == [4, 2, 1, 3]
test2 = tv2 == [3, 1, 2]
test3 = tv3 == [1000000000]
test4 = tv4 == [0, 6, 6, 0, 7, 7]
alltest = test1 && test2 && test3 && test4



Measured memory_bytes: 43516
import collections
n = int(input())
a = [int(i) for i in input().split()]
l = collections.Counter(a)
l_ = [k for k, v in l.items() if v > 1]
if len(l_) > 1:
    l_.sort()
    if l[l_[-1]] > 3:
        print(l_[-1]**2)
    else:
        print(l_[-1]*l_[-2])
else:
    print(0)

Measured memory_bytes: 18592
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

int n;
D dp[305][305][305];

D dfs(int i, int j, int k){
    if(dp[i][j][k] >= 0.0) return dp[i][j][k];
    if(i == 0 && j == 0 && k == 0) return 0.0;
    D res = 0.0;
    if(i > 0) res += dfs(i-1, j ,k) * i;
    if(j > 0) res += dfs(i+1, j-1, k) * j;
    if(k > 0) res += dfs(i, j+1, k-1) * k;
    res += n;
    res /= (D)(i+j+k);
    return dp[i][j][k] = res;
}

int main(){
    cin >> n;
    vector<int> a(n), cnt(4);
    rep(i,n) {
        cin >> a[i];
        cnt[a[i]]++;
    }
    rep(i,305)rep(j,305)rep(k,305) dp[i][j][k] = -1.0;

    printf("%.10f", dfs(cnt[1], cnt[2], cnt[3]));
}


Measured memory_bytes: 222080
a,b,c,x,y = map(int, input().split())

# set x >= y
if x < y: 
    x,y = y,x
    a,b = b,a

price_1 = a*x + b*y
price_2 = a*(x-y) + 2*c*y
price_3 = 2*c*x

print(min(price_1, price_2, price_3))

Measured memory_bytes: 9164
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	int n; cin >> n;
	int result = 0;
	for (int x = 1; x <= n; x += 2)
	{
		int cntDivisors = 0;
		for (int i = 1; i * i <= x; i++)
		{
			if (x % i == 0)
			{
				cntDivisors++;
				if (i != x / i)
					cntDivisors++;
			}
		}
		if (cntDivisors == 8)
			result++;
	}
	cout << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll mod = 1000000007;

void solve()
{
	int a,b,c; cin >> a >> b >> c;
	if((a==b&& a!= c) ||(c==b&& a!= c)||(a==c&& b!= c))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;	
	return;	
}

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


Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 1000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*4
#define REP(a,b) for(long long a = 0;a < b;++a)
int main() {
	int n;
	cin >> n;
	double a = (n+1) / 2;
	double b = n;
	cout << fixed << setprecision(20);
	cout << a / b << endl;
}

Measured memory_bytes: 888
//
//  test.cpp
//  AtCoder
//
//  Created by A on 2018/04/28.
//  Copyright © 2018年 A. All rights reserved.
//

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

int main() {
    int N, P=0, W=0, G=0, Y=0;
    string s;
    cin >> N;
    
    for(int i=0; i<N; i++){
        cin >> s;
        if(s == "P") P++;
        else if(s == "W") W++;
        else if(s == "G") G++;
        else if(s == "Y") Y++;
        else cout << "error" << endl;
    }
    if(P>0 && W>0 && G>0 && Y>0) cout << "Four" << endl;
    else if(P>0 && W>0 && G>0) cout << "Three" << endl;
    else cout << "Error" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a=0,b=0,c=0,d=0;
    string p="AC",q="WA",r="TLE",s1="RE";
    while(n--)
    {
        string s;
        
        cin>>s;
        if(s.compare(p)==0)
          a++;
        else if(s.compare(q)==0)
          b++;
        else if(s.compare(r)==0)
          c++;
        else
          d++;
    }
    cout<<p<<" x "<<a<<"\n";
    cout<<q<<" x "<<b<<"\n";
    cout<<r<<" x "<<c<<"\n";
    cout<<s1<<" x "<<d<<"\n";  

}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int i=0;
  string a,b;
  int ans=0;
  cin>>a;
  cin>>b;

  for(auto it:a){
      if(it!=b[i])
      ans++;
      i++;
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 3920
#include <iostream>
using namespace std;
int n,a[6][5][12];
int main() {
	cin>>n;
	for(int i=0;i<n;i++){
		int b,f,r,v;
		cin>>b>>f>>r>>v;
		a[b][f][r]+=v;
	}
	for(int b=1;b<=4;b++){
		for(int f=1;f<=3;f++){
			for(int r=1;r<=10;r++){
				cout<<" "<<a[b][f][r];
			}
			cout<<endl;
		}
		if(b!=4){
			cout<<"####################"<<endl;
		}
	}
}



Measured memory_bytes: 3092
using namespace std;
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define input() ios::sync_with_stdio(false);cin.tie(0);
void solve(){
	
}
int power(int x,int y){
	int res=1;
	while(y){
		if(y&1)
		res=res*x;
		x=x*x;
		y=y/2;
	}
	return res;
}
int main(){
    input()
    int x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y;
    return 0;
}

Measured memory_bytes: 256
class Chokudai
    S = 0
    T = 1
    ALPHA = 26
    def initialize()
        @dic = []
        2.times do |n|
            @dic.push(Array.new(ALPHA, -1))
        end
        @a = 'a'.ord
    end

    def solve(s, t)
        s.size.times do |i|
            si = s[i].ord - @a
            ti = t[i].ord - @a
            if @dic[S][ti] == -1  then
                @dic[S][ti] = si
            elsif @dic[S][ti] != si then
                return false
            end
            if @dic[T][si] == -1  then
                @dic[T][si] = ti
            elsif @dic[T][si] != ti then
                return false
            end
        end
        return true
    end

    def answer(s, t)
        if self.solve(s, t) then
            puts('Yes')
        else
            puts('No')
        end
    end
end

inputs = STDIN.readlines.map{|line|line.strip.split()}
s = inputs.shift[0]
t = inputs.shift[0]

chokudai = Chokudai.new
chokudai.answer(s, t)


Measured memory_bytes: 2760
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = ReadArrayInt();
            var A = input[0];
            var P = input[1];
            P += A * 3;

            Console.WriteLine(P / 2);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

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

using namespace std;

int main() {
    int n;

    cin >> n;

    vector<vector<int>> a(n, vector<int>(3));

    for(int i = 0; i < n; ++i) {
        cin >> a.at(i).at(0) >> a.at(i).at(1) >> a.at(i).at(2);
    }

    vector<vector<int>> dp(n, vector<int>(3));

    for(int j = 0; j < 3; ++j) {
        dp.at(0).at(j) = a.at(0).at(j);
    }

    for(int i = 1; i < n; ++i) {
        for(int j = 0; j < 3; ++j) {
            dp.at(i).at(j) = max(dp.at(i - 1).at((j + 1) % 3), dp.at(i - 1).at((j + 2) % 3)) + a.at(i).at(j);
        }    
    }

    printf("%d\n", max(max(dp.at(n - 1).at(0), dp.at(n - 1).at(1)), dp.at(n - 1).at(2)));

    return 0;
}

Measured memory_bytes: 11136
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#include <cstring>
#define mod  1000000007

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

using namespace std;

using ll = long long;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  int N, M, x, y;
  cin >> N >> M;
  vector<int> box(N + 1, 1);
  vector<bool> possibility(N + 1, false);

  possibility[1] = true;
  for(int i = 0; i < M; i++){
    cin >> x >> y;
    box[x]--, box[y]++;
    if(possibility[x]) possibility[y] = true;
    if(box[x] == 0) possibility[x] = false;
  }

  int ans = 0;
  for(int i = 1; i <= N; i++){
    ans += possibility[i];
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

#define ll long long
#define rep(cnt,a,n) for(ll cnt=a;cnt<n+a;cnt++) //aから始めてn回ループ
#define vector2(type,name,a,b) vector<vector<type>> name(a, vector<type>(b))

int main()
{
    ll n;
    ll k;
    cin >> n;
    cin >> k;
    vector<ll> s(n);
    rep(cnt, 0, n) {
        s[cnt] = 1;
    }
    rep(cnt, 0, k) {
        ll d;
        cin >> d;
        rep(i, 0, d) {
            ll a;
            cin >> a;
            s[a-1] = 0;
        }
    }
    ll ans=0;
    rep(cnt, 0, n) {
        if (s[cnt] == 1) {
            ans += 1;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
(function Main(input){
	var input = input.split('\n'),
		X = input[1].split(' ').map(Number),
		len = X.length,
		result = 0,
		avg = function(data){
			var sum = 0;
			for(var i=0; i<len; i++){
				sum += data[i];
			}
			return Math.round(sum / len);
		}(X);
	for(var i=0; i<len; i++){
		result += Math.pow(X[i]-avg, 2);
	}
	console.log(result);
})(require("fs").readFileSync("/dev/stdin","utf8"));

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

typedef long long ll;

int main() {
	ll n, s, ans; cin >> n >> s;
	for (ll i = 2; i * i <= n; i++) {
		ans = i;
		ll x = log2(n) / log2(i), tmp = 0, tmpN = n;
		while (x >= 0) {
			ll ml = tmpN / pow(i, x);
			tmp += ml;
			tmpN = tmpN - ml * pow(i, x--);
		}
		if (tmp == s) {
			cout << i << endl;
			return 0;
		}
	}
	ll start = n / ans + 1;
	for (ll i = start; i > 0; i--) {
		if (s - i < 0)continue;
		ll b = (n - (s - i)) / i;
		if (b > s - i && b * i + (s - i) == n && b >= 2 && b > i) { cout << b << endl; return 0; }
	}
	cout << (n == s ? n + 1 : -1) << endl;

	return 0;
}

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

int main()
{
    int a[5], i;

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

    for(i=0; i<5; i++)
    {
        if(a[i]==0)
        {
            cout << i+1 << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 3560
N,W=map(int,input().split())
w=[]
v=[]
for _ in range(N):
    ww,vv=map(int,input().split())
    w.append(ww)
    v.append(vv)
INF=float("inf")
max_v=10**5+1
dp=[[INF for i in range(max_v)] for j in range(N+1)]
dp[0][0]=0
for i in range(N):
    for j in range(max_v):
        if j - v[i]>=0:
            dp[i+1][j]=min(dp[i+1][j],dp[i][j-v[i]]+w[i])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j])

for i in range(max_v):
    if dp[N][i] <=W:
        ans=i
print(ans)


Measured memory_bytes: 331316
AL = [list(map(int, input().split())) for i in range(3)]
# print(AL)
N = int(input())
BL = list(int(input()) for i in range(N))
# print(BL)

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

for k, i in enumerate(AL):
    for n,j in enumerate(i):
        if j in BL:
            AL[k][n]="True"

# print(AL)
ans=False
if AL[0][0]=="True" and AL[1][1]=="True" and AL[2][2]=="True":
    ans=True
if AL[0][2]=="True" and AL[1][1]=="True" and AL[2][0]=="True":
    ans=True
if AL[0][0]=="True" and AL[0][1]=="True" and AL[0][2]=="True":
    ans=True
if AL[1][0]=="True" and AL[1][1]=="True" and AL[1][2]=="True":
    ans=True
if AL[2][0]=="True" and AL[2][1]=="True" and AL[2][2]=="True":
    ans=True
if AL[0][0]=="True" and AL[1][0]=="True" and AL[2][0]=="True":
    ans=True
if AL[0][1]=="True" and AL[1][1]=="True" and AL[2][1]=="True":
    ans=True
if AL[0][2]=="True" and AL[1][2]=="True" and AL[2][2]=="True":
    ans=True

if ans:
    print("Yes")
else:
    print("No")


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

using namespace std;

int MOD = pow(10, 9) + 7;

map<int, int> prime_factor(int n) {
  map<int, int> factors;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      factors[i]++;
      n /= i;
    }
  }
  if (n != 1) factors[n] = 1;
  return factors;
}

vector<vector<long long>> cache(pow(10, 5) + 100, vector<long long>(31, 0));
                               
void init() {
  cache.at(0).at(0) = 1;
  for (int i = 1; i < pow(10, 5) + 100; i++) {
    cache.at(i).at(0) = 1;
    for (int j = 1; j < 31; j++) {
      cache.at(i).at(j) = cache.at(i - 1).at(j - 1) % MOD + cache.at(i - 1).at(j) % MOD;
      cache.at(i).at(j) %= MOD;
    }
  }
}

long long comb(int n, int k) {
  return cache.at(n).at(k);
}

int main() {
  init();
  
  int N, M;
  cin >> N >> M;
  
  map<int, int>factors = prime_factor(M);
  
  long long answer = 1;
  
  for (pair<int, int> x: factors) {
    answer = answer * comb(x.second + N - 1, x.second) % MOD;
  }
  
  cout << answer << endl;
}

Measured memory_bytes: 27648
card=[]
while True:
    s=raw_input()
    if s=="-":
        break
    for i in s:
        card.append(i)
    shuffle=input()
    for i in xrange(shuffle):
        h=input()
        card+=card[0:h]
        del card[0:h]
    print("".join(card))
    del card[0:len(card)]

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

typedef long long LL;
typedef pair<LL, LL> pll;
typedef pair<int, int> pii;

const int mod = 1e9 + 7;
const int maxn = 4000 + 5;
const int maxm = 4e6 + 10;
const int oo = 0x3f3f3f3f;

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

#define fst first
#define snd second
#define pb push_back

template<typename T> T read() {
	T n(0), f(1);
	char ch = getchar();
	for( ;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
	for( ; isdigit(ch); ch = getchar()) n = n * 10 + ch - 48;
	return n * f;
}

LL Fac(int n) {
    LL res = 1;
    for(int i = 2; i <= n; i++) (res *= i) %= mod;
    return res;
}

LL fpm(LL a, LL b) {
    LL ans = 1;
    for(; b > 0; b >>= 1) {
        if(b & 1) 
            ans = ans * a % mod;
        a = a * a % mod;
    }
    return ans;
}

LL f[maxn][maxn];
LL fac[maxm], ifac[maxm];

void init() {
    fac[0] = 1;
    ifac[0] = 1;
    for(int i = 1; i < maxm; i++) {
        fac[i] = fac[i-1] * i % mod;
        ifac[i] = fpm(fac[i], mod-2);
    }
}
LL C(int n, int k) {
    return fac[n] * ifac[n-k] % mod * ifac[k] % mod;
}

int main() {
#ifndef ONLINE_JUDGE
    //freopen("data.txt", "r", stdin);
    //freopen("ans.txt", "w", stdout);
#endif

    init();

    int n, k;
    n = read<int>(), k = read<int>();
    if(k == 1) { puts("1"); return 0; }

    f[n][n] = 1;

    for(int i = n; i >= 0; i--) {
        for(int j = n; j >= 0; j--) if(f[i][j]) {
            if(i > 0) (f[i-1][j] += f[i][j]) %= mod;
            if(j > i) (f[i][j-1] += f[i][j] * C(i+j*(k-1)-1, k-2) % mod) %= mod;
        }
    }
    printf("%lld\n", f[0][0] * Fac(n) % mod);
    return 0;
}


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

int main(){
    int a,b;
    cin>>a>>b;
    if(a<b)for (int i=0;i<b;i++)cout<<a;
    else for (int i=0;i<a;i++)cout<<b;
    cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000
#define MAX 100000
using namespace std;

int main()
{
	int N, W;
	cin >> N >> W;
	vector<vector<int>> dp(N + 1, vector<int>(MAX + 1, INF));
	dp[0][0] = 0;
	for (int i = 1, v, w; i <= N; i++) {
		cin >> v >> w;
		for (int j = MAX; j >= 0; j--) {
			if (j < MAX)
				dp[i][j] = min(dp[i][j], dp[i][j + 1]);
			if (j >= v) {
				dp[i][j] = min(dp[i][j], min(dp[i - 1][j], dp[i - 1][j - v] + w));
			}
			else {
				dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			}
		}
	}
	cout << (upper_bound(dp[N].begin(), dp[N].end(), W) - dp[N].begin() - 1) << endl;
	return 0;
}

Measured memory_bytes: 42732
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"

using namespace std;

#include <cstdio>
#include <cstring>


int main() {
    int n, m, count = 0, res = 0;
    cin >> n >> m;
    for (int i = 1; i <= n ; ++i) {
        count++;
        if (count == m){
            res++;
            count = 0;
            i -= (m - 1);
        }
    }
    cout << res;

}

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

using namespace std;

#define MAX ((1<<15)+100)

int main(){

	int dp[5][MAX]={0};
	int n;
	int cnt;

	dp[0][0]=1;

	for(int i=1;i<MAX;i++){
		for(int j=0;j<4;j++){
			for(int k=0;k<MAX;k++){
				if(dp[j][k]>0&&k+i*i<MAX){
					dp[j+1][k+i*i]+=dp[j][k];
				}
			}
		}
	}

	while(1){
		cin>>n;
		if(n==0) break;
		cnt=0;
		for(int i=0;i<5;i++){
			cnt+=dp[i][n];
		}
		cout<<cnt<<endl;
	}
	return 0;
}

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

int main() {
 string s;
  cin >> s;
  
        
        if(s=="SSS")
            {
                cout << 0;
            }
             if(s=="RSS")
            {
                cout << 1;
            }
             if(s=="SRS")
            {
                cout << 1;
            }
             if(s=="SSR")
            {
                cout << 1;
            }
             if(s=="RSR")
            {
                cout << 1;
            }
             if(s=="RRS")
            {
                cout << 2;
            }
             if(s=="SRR")
            {
                cout << 2;
            }
             if(s=="RRR")
            {
                cout << 3;
            }
            
        return 0;
        
}


Measured memory_bytes: 3624
s=input()
ans=0
cnt=0
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    cnt+=1
  else:
    ans=max(ans,cnt)
    cnt=0
ans=max(ans,cnt)
print(ans)

Measured memory_bytes: 61764
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;



int main() {

	int a, b;
	cin >> a >> b;
	if ((a*b) % 2 == 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
M = 10**5+1
p = [1]*M
p[0] = p[1] = 0
for i in range(2, 10**3):
    if p[i]:
        for j in range(i*i, M, i):
            p[j] = 0
C = [0]*M
for i in range(2, M):
    if p[i] and p[(i+1)//2]:
        C[i] = C[i-1] + 1
    else:
        C[i] = C[i-1]
q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(C[r] - C[l-1])

Measured memory_bytes: 4980
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		double power = 1;
		for(int i=1; i<=n; i++) {
			power= (power*i)%(Math.pow(10, 9)+7);
		}
		System.out.println((int)power);
	}

}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    set<int> st;
    rep(i, n)
    {
        if (st.count(a.at(i)) == 0)
        {
            st.insert(a.at(i));
        }
        else
        {
            st.erase(a.at(i));
        }
    }

    cout << int(st.size()) << endl;
}

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cstring>
#define MOD 1e+9 + 9


int main(){
    int n;
    int sn = 0;
    scanf("%d",&n);
    int N =n;
    while(n >= 10){
        sn += n % 10;
        n /= 10;
    }
    sn += n;
    if(N % sn == 0){
        printf("Yes");
    }else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 256
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    N = len(S)
    start = None
    for i in range(N):
        if S[i] == 'A':
            start = i
            break
    end = None
    for i in reversed(range(N)):
        if S[i] == 'Z':
            end = i
            break
    return end - start + 1


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 62448