akhauriyash/Code-Regression huggingface dataset:
#ifdef __cplusplus
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
#else
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#endif

#define rep(i,n) for(int i = 0; i < (n); ++i)
 
#define BIG_PRIME 1000000007
#define BP_remainder(x) ((x) % BIG_PRIME)

#define INF (1 << 30)
#define INF_NEG (INF * -1)
#define INF_LONG (1LL << 62)
#define INF_LONG_NEG (INF_LONG * -1L)

typedef long long ll;
typedef char str255[256];
int StrLen(char *s) { for(int ptr = 0;; ++ptr) if(!s[ptr]) return ptr; } 
// char * の後ろから n 文字削除, 削除後の文字数を返す
int StrDel(char *s, int n) { int l = StrLen(s); s[l - n + 1] = '\0'; return l - n; }

int NumDigits(int i){ char s[20]; return sprintf(s, "%d", i); }
int NumDigitsLL(long long l){ char s[30]; sprintf(s, "%lld", l); return strlen(s); }

int is1stAns = 1;
#ifdef __cplusplus
template <class T> 
void print(T t) { if (is1stAns) cout << t, is1stAns = 0; else cout << " " << t; }
#else
void printI(int    i) { if (is1stAns) printf(  "%d", i), is1stAns = 0; else printf(  " %d", i); }
void printL(ll     l) { if (is1stAns) printf("%lld", l), is1stAns = 0; else printf(" %lld", l); }
void printD(double d) { if (is1stAns) printf("%.9f", d), is1stAns = 0; else printf(" %.9f", d); }
void printC(char   c) { if (is1stAns) printf(  "%c", c), is1stAns = 0; else printf(  " %c", c); }
void printS(char  *s) { if (is1stAns) printf(  "%s", s), is1stAns = 0; else printf(  " %s", s); }
#endif

signed main()
{
#ifdef __cplusplus
    cout << fixed << setprecision(9);
#endif

    int N, p[60];
    scanf("%d", &N);
    rep(i, N) scanf("%d", &p[i]);

    int count = 0;
    rep(i, N){
        if (p[i] != i + 1) ++count;
    }

    if ((count == 2) || (count == 0))
        puts("YES");
    else
        puts("NO");

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define mp make_pair 
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define rrep(i,a,b) for(int i = a; i >=b; i--)
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define sq(a) (a)*(a)
#define nl "\n"
#define all(x) (x).begin(),(x).end()
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,
//tree_order_statistics_node_update> indexed_set;

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using ii = pair<int, int>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using pil = pair<int,ll>;
using vvi = vector<vi>;
using vpi = vector<ii>;

const int N = 100100;
ll mod=1000000007;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	set<int> a;
	rep(i,0,n-1){
		int tmp;
		cin>>tmp;
		a.insert(tmp);
	}
	if(a.size() == n){
		cout<<"YES"<<nl;
	}
	else{
		cout<<"NO"<<nl;
	}
	return 0;
}



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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;

const int mod=1e9+7;


int main(){
	int n;
	string s;
	cin>>n>>s;

	vector<int> cnt(26);
	for (int i = 0; i < n; ++i){
		cnt[s[i]-'a']++;
	}

	long long ans=1;
	for (int i = 0; i < 26; ++i){
		ans=ans*(cnt[i]+1)%mod;
	}

	cout<<ans-1<<endl;

}

Measured memory_bytes: 512
def main():
    a,b,k = map(int,input().split())
    ansSet = set()


    if a+k > b:
        c = b
    else:
        c = a+k
    
    if a == c:
        c += 1

    for i in range(a,c):
        ansSet.add(i)
    
    if b-k < a:
        c = a
    else:
        c = b-k

    for i in range(b,c,-1):
        ansSet.add(i)

    for i in sorted(list(ansSet)):
        print(i)


if __name__== "__main__":
    main() 






Measured memory_bytes: 3064
<?php
$N = (int)trim(fgets(STDIN));
//list($N,$Q) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$S = trim(fgets(STDIN));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));


$R = array_fill(0,$N+1,0);
for($i=0;$i<$N;$i++) {
  $R[$i+1]=$R[$i]+$A[$i];
}
$s = array_count_values($R);
$t=0;
foreach($s as $k=>$v) {
  if ($v > 1) {
    $t += $v * ($v-1)/2;
  }
}
printf("%d\n",$t);

Measured memory_bytes: 41972
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
  int64_t x;
  mint(int64_t x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(int64_t t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  //for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) {return mint(*this) /= a;}
};

istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

const int N = 1e5+10;

//head

int n, k;
vi G[N];

mint dfs(int i, int j) {
  if(j == -1) {
    mint res = k;
    rep(id, G[i].size()) {
      res *= dfs(G[i][id], i) * (k-1-id);
    }
    return res;
  }
  mint res = 1;
  int kk = k;
  rep(id, G[i].size()) {
    int ne = G[i][id];
    if(j == ne) continue;
    res *= dfs(ne, i) * ((kk--)-2);
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  cout << dfs(n>>1, -1) << endl;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

int main()
{
    int m,a,b;
    while(cin >>m >>a >>b,m)
    {
        vector<int> p(m);
        rep(i,m) cin >>p[i];

        int ans=b;
        int gap=0;

        //????????????i?????¨??????
        for(int i=b; i>=a; --i)
        {
            int tgap=p[i-1]-p[i];
            if(tgap>gap)
            {
                gap=tgap;
                ans=i;
            }
        }

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

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

typedef long long ll;
typedef unsigned int ui;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;

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

    string s, t;    
    cin >> s >> t;

    vector<vi> dp(s.size() + 1, vi(t.size() + 1));

    for (ui i = 1; i <= s.size(); ++i) {
        for (ui j = 1; j <= t.size(); ++j) {
            if (s[i - 1] == t[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
            }
            else {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }
    string ans;
    int i = s.size(), j = t.size();
    while (i > 0 && j > 0) {
        if (s[i - 1] == t[j - 1] && dp[i][j] - 1 == dp[i - 1][j - 1]) {
            ans += s[i - 1];
            --i; --j;
        }
        else if (dp[i][j] == dp[i - 1][j]) {
            --i;
        }
        else {
            --j;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << '\n';


    return 0;
}

Measured memory_bytes: 35584
#include <stdio.h>
#include <stdlib.h>
int main() {
	int a,b;
	scanf("%d %d",&a,&b);
	int vetor[2*a],vet[2*b];
	for(int x=0;x<2*a;++x)
	    scanf("%d",&vetor[x]);
	for(int z=0;z<2*b;++z)
	    scanf("%d",&vet[z]);
	
	for(int f=0;f<2*a;f+=2){
	    int val = 0,v=1000000000,pos=0;
	    for(int g=0;g<2*b;g+=2){
	        val=abs(vetor[f]-vet[g])+abs(vetor[f+1]-vet[g+1]);
	        if(val<v){
	            v= val;
	            pos=(g/2)+1;
	        }
	    }
	    printf("%d\n",pos);
	}    
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
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 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;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  ll A[N+1];
  A[0]=0;
  RREP(i,N) cin>>A[i];
  
  bool CAN=true;
  RREP(i,N){
    if(A[i]>A[i-1]+1 || A[i]>=i) CAN=false;
  }
  
  if(CAN){
    ans+=A[N];
    for(int i=N-1;  i>0; --i){
      if(A[i]>=A[i+1]) ans+=A[i];
    }
    co(ans);
  }
  else co(-1);
  return 0;
}

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

int main(){
    long long N;
    // vector<long long> P_list[N];
    // vector<long long> judge[N];
    long long P, min_P = 200001;
    long long count = 0;
    std::cin >> N;

    for(long long i = 0; i<N; i++){
        std::cin >> P;
        if(P < min_P){
            min_P = P;
        }
        if(P <= min_P){
            count++;
        }
    }
    std::cout << count;
}


Measured memory_bytes: 3616
#include <climits>
#include <iostream>
#include <vector>

using namespace std;

struct Card {
    char c;
    int n;
};

// merge v[left] to v[mid-1] and v[mid] to v[right-1]
int merge(vector<Card>& v, int left, int mid, int right) {
    vector<Card> l(mid - left + 1);
    for (int i = 0; i < l.size() - 1; ++i)
        l[i] = v[i + left];
    vector<Card> r(right - mid + 1);
    for (int i = 0; i < r.size() - 1; ++i)
        r[i] = v[i + mid];

    l[l.size() - 1].n = INT_MAX;
    r[r.size() - 1].n = INT_MAX;

    int idx_left = 0;
    int idx_right = 0;
    int compare_count = 0;
    for (int i = left; i < right; ++i) {
        if (l[idx_left].n <= r[idx_right].n) {
            v[i] = l[idx_left];
            ++idx_left;
        } else {
            v[i] = r[idx_right];
            ++idx_right;
        }
        ++compare_count;
    }

    return compare_count;
}

// sort v[left] to v[right-1] with merge sort algorithm
// v[right] will not be modified
int _merge_sort(vector<Card>& v, int left, int right) {
    int count = 0;

    if (left + 1 < right) {
        int mid = left + (right - left) / 2;
        count += _merge_sort(v, left, mid);
        count += _merge_sort(v, mid, right);
        count += merge(v, left, mid, right);
    }

    return count;
}

int merge_sort(vector<Card>& v) { return _merge_sort(v, 0, v.size()); }

int partition(vector<Card>& v, int left, int right) {
    int base = v[right].n;
    int idx = left - 1;
    for (int i = left; i < right; ++i) {
        if (v[i].n <= base) {
            ++idx;
            swap(v[idx], v[i]);
        }
    }
    ++idx;
    swap(v[idx], v[right]);
    return idx;
}

void _quick_sort(vector<Card>& v, int left, int right) {
    if (left < right) {
        int idx = partition(v, left, right);
        _quick_sort(v, left, idx - 1);
        _quick_sort(v, idx + 1, right);
    }
}

void quick_sort(vector<Card>& v) { _quick_sort(v, 0, v.size() - 1); }

int main() {
    int n;
    cin >> n;

    vector<Card> cards(n);
    vector<Card> cards_stable(n);
    for (int i = 0; i < n; ++i) {
        cin >> cards[i].c >> cards[i].n;
        cards_stable[i].c = cards[i].c;
        cards_stable[i].n = cards[i].n;
    }

    quick_sort(cards);
    merge_sort(cards_stable);

    bool stable = true;
    for (int i = 0; i < n; ++i) {
        if (cards[i].c != cards_stable[i].c ||
            cards[i].n != cards_stable[i].n) {
            stable = false;
            break;
        }
    }
    if (stable)
        cout << "Stable\n";
    else
        cout << "Not stable\n";

    for (int i = 0; i < n; ++i)
        cout << cards[i].c << ' ' << cards[i].n << '\n';
}



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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int n;
  vector<ll> a;
  vector<pair<ll, ll>> list;
  cin >> n;
  REP(i, n)
  {
    ll t;
    cin >> t;
    a.push_back(t);
  }
  sort(a.begin(), a.end());

  ll m1 = a[a.size() - 1];
  ll m2 = a[0];
  a.erase(a.begin());
  a.erase(a.begin() + a.size() - 1);
  int i = 0;
  while (a[i] < 0 && i < a.size())
  {
    list.push_back(make_pair(m1, a[i]));
    m1 = m1 - a[i];
    i++;
  }
  while (i < a.size())
  {
    list.push_back(make_pair(m2, a[i]));
    m2 = m2 - a[i];
    i++;
  }

  list.push_back(make_pair(m1, m2));
  cout << m1 - m2 << endl;
  REP(i, list.size())
  {
    cout << list[i].first << " " << list[i].second << endl;
  }
}


Measured memory_bytes: 4720
#include<stdio.h>
#include<string.h>
int t[2000000]={};

int main(){
	int c=0,i,I=0,N,k,T,rimit=0;

	scanf("%d %d",&N,&T);
	for(i=0;i<N;i++){
		scanf("%d",&t[i]);
		k=t[i];
	}

	for(i=0;i<k+T;i++){
		if(t[I]==i){
			rimit=T;
			if(I!=N-1){
				I++;}
		}
		if(rimit>0){
			c++;
			rimit--;
		}
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;
  cin >>n;
  ll a[n],b[n];
  for(ll i=0;i<n;i++){
    cin >> a[i];
    b[i]=0;
  }
  for(ll i=n-1;i>=0;i--){
    ll temp=0;
    for(ll j=i+1;j<=n;j+=(i+1)){
      if(b[j-1]==1)temp++;
    }
    if(temp%2==0 && a[i]==1)b[i]=1;
    else if (temp%2==0 && a[i]==0)b[i]=0;
    else if (temp%2==1 && a[i]==1)b[i]=0;
    else if (temp%2==1 && a[i]==0)b[i]=1;
  }
  ll res=0;
  vector<ll> ans;
  for(ll i=0;i<n;i++)if(b[i]==1){
    res++;
    ans.push_back(i+1);
  }
  cout << res<<endl;
  for(ll i=0;i<ans.size();i++)cout << ans[i] <<" ";
  cout <<endl;
  
}

Measured memory_bytes: 4980
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
typedef long long ll;
using namespace std;
int main()
{
  string a;
  cin >> a;
  cout << "2018" << a.substr(4,6) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mm(a,b) memset(a,b,sizeof(a))
#define ACCELERATE (ios::sync_with_stdio(false),cin.tie(0))
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<long long,long long>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define debug(x) cout<<#x<<": "<<x<<endl
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define sc3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pf(x) printf("%d\n",x)
#define pf2(x,y) printf("%d %d\n",x,y)
#define pf3(x,y,z) printf("%d %d %d\n",x,y,z)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
#define E exp(1.0)
#define db double
#define ll long long
#define ld long double
#define ull unsigned long long
//#define io
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
//#define gc getchar
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
//inline int read()
//{
//    int ret=0,f=0;char c=gc();
//    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
//    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
//    if(f)return -ret;return ret;
//}
map<char,int>m;
int main()
{
    #ifdef io
    freopen("in.txt","r",stdin);
    #endif
    rep(i,0,3){
        char c=getchar();
        m[c]++;
    }
    bool flag=true;
    if(m.size()==2){
        for(auto &x:m){
            if(x.second!=2)flag=false;
        }
    }else{
        flag=false;
    }
    printf("%s\n",flag?"Yes":"No");

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii; 
const int N = 2e5+10, mod = 1e9+7;

void solve() {
    int n, m, x; cin >> n >> m >> x;
    int c[n], a[n][m];

    for (int i = 0; i < n; ++i) {
        cin >> c[i];
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }
    
    int ans = INT_MAX;
    for (int i = 1; i < (1 << n); ++i) {
        int cnt = 0;
        vector<int> t(m);
        
        for (int j = 0; j < n; ++j) {
            if (i & (1 << j)) {
                for (int k = 0; k < m; ++k) {
                    t[k] += a[j][k];
                }
                cnt += c[j];
            }
        }
        
        bool mark = true;
        for (int i : t) {
            if (i < x) {
                mark = false;
            }
        }

        if (mark) {
            ans = min(ans, cnt);
        }
    }
    (ans == INT_MAX) ? cout << -1 << endl: cout << ans << endl;
}

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

Measured memory_bytes: 3620
in1 = list(input())
in1.sort()
i = 1
flg = True
if len(in1) %2 != 0:
  flg=False
else:
  while i < len(in1):
    if in1[i] != in1[i-1]:
      flg = False
      break
    i+=2
if flg:
  print("Yes")
else:
  print("No")

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

using namespace std;

int main(){
	for(string s;getline(cin,s),s!="END OF INPUT";){
		int n=s.length();
		int cnt=0;
		for(int i=0;i<n;i++){
			if(s[i]==' ')	cout<<cnt,cnt=0;
			else	cnt++;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;int main(){cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);int n,a,b,m;cin>>n>>m;bitset<100005>c;for(int i=0;i<m;++i){cin>>a>>b;c[a]=!c[a];c[b]=!c[b];}cout<<(c.any()?"NO":"YES");return 0;}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int N; ll K; cin >> N >> K;
    vl A(N), F(N); rep(i,N) cin >> A[i]; rep(i,N) cin >> F[i];

    sort(all(A)); sort(rall(F));

    ll sum = 0;
    rep(i,N) sum += A[i];
    if(sum <= K) {
        cout << 0 << endl;
        return 0;
    }
    vl seki(N); rep(i,N) seki[i] = A[i] * F[i];
    ll ma = 0;
    rep(i,N) chmax(ma, A[i]*F[i]);
    ll mi = 0;
    while(ma - mi > 1LL){
        ll mid = (ma + mi) / 2LL;
        ll cnt = 0;
        rep(i,N){
            cnt += max(0LL, (A[i] * F[i] - mid + F[i] - 1LL) / F[i]);
        }
        if(cnt <= K) ma = mid;
        else mi = mid;
    }
    ll cnt2 = 0;
    rep(i,N) cnt2 += max(0LL, (A[i] * F[i] - ma + F[i] - 1LL) / F[i]);
    if(cnt2 > K) ma = mi;
    cout << ma << endl;
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e18
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n; cin>>n;
    vector<vector<pii>>edge(n,vector<pii>());
    rep(i,n-1){
        int to,from,cost;
        cin>>to>>from>>cost;
        edge[--to].push_back(mp(--from,cost));
        edge[from].push_back(mp(to,cost));
    }
    priority_queue<pii,vector<pii>,greater<pii>>que;
    int Q,k;cin>>Q>>k;
    vector<int>d(n,INF);
    d[--k]=0;
    que.push(mp(0,k));
    while(!que.empty()){
        pii now=que.top();
        que.pop();
        if(d[now.second]<now.first)continue;
        rep(i,edge[now.second].size()){
            pii next=edge[now.second][i];
            if(d[now.second]+next.second>d[next.first])continue;
            d[next.first]=d[now.second]+next.second;
            que.push(mp(d[next.first],next.first));
        }
    }
    rep(i,Q){
        int to,from; cin>>to>>from;
        cout<<d[--to]+d[--from]<<endl;
    }
}


Measured memory_bytes: 11120
import collections

n = int(input())

s_sorted = []
for i in range(n):
    s_sorted.append(''.join(sorted(list(input()))))
    # s.append(input())

# print(s)

c = collections.Counter(s_sorted)
# print(c.values())

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

print(int(ans))


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

using namespace std;

int n, a[110], ans[110];

void fail() { puts("-1"); exit(0); }

void solve() {
	for(int i = n, curn = n, flag; i >= 1; --i) {
		flag = 0;
		for(int j = curn; j >= 1; --j) {
			if(a[j] != j) continue;
			flag = 1;
			ans[i] = j;
			for(int k = j; k < curn; ++k)
				a[k] = a[k + 1];
			--curn;
			break;
		}
		
		if(!flag) fail();
	}
	
	for(int i = 1; i <= n; ++i)
		printf("%d\n", ans[i]);
}

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

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

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef pair <ll, ll> dl;
typedef pair <int, int> ii;
typedef vector <ii> vii;
typedef vector <vi> graph;

bool mat[25][25];

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

	int n, m;
	cin >> n >> m;
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			mat[i][j] = true;
		}
	}
	for (int i = 0; i < w; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			mat[j][i] = true;
		}
	}
	int cont = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < m; ++j)
		{
			if (!mat[i][j]) cont++;
		}
	}
	cout << cont << "\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
const ll N = 2e5+10;




int main(){
        ios_base::sync_with_stdio(0);
            cin.tie(0);cout.tie(0);
        ll n,a,b;
        cin>>n>>a>>b;
        ll r=n%(a+b);
        ll d=n/(a+b);
        if(r>a){
            r=a;
        }
        cout<<(d*a)+r;
        
            
            
        return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main() {
	int c=0;
	char a[200005],b[200005];
	scanf(" %s",&a);
	scanf(" %s",&b);
	for(int i=0;a[i];i++) {
		if(a[i]!=b[i]) c++;
	}
	printf("%d",c);
}


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

int main() {
  int64_t N,A,B,S;
cin>>N>>A>>B;
  if(A==0){
   cout<<0<<endl; 
  }
  else{
  S=N/(A+B);
  S *=A;
    if(N%(A+B)>A){
  S +=A;
    }
    else{
     S +=N%(A+B);
    }
  cout<<S<<endl;
  }
}


Measured memory_bytes: 256
N = int(input())

cnt_AC = 0
cnt_WA = 0
cnt_TLE = 0
cnt_RE = 0

for n in range(N):
    tmp = input()
    if(tmp == 'AC'):
        cnt_AC += 1
    elif(tmp == 'WA'):
        cnt_WA += 1
    elif(tmp == 'TLE'):
        cnt_TLE += 1
    elif(tmp == 'RE'):
        cnt_RE += 1

print('AC x ' + str(cnt_AC))
print('WA x ' + str(cnt_WA))
print('TLE x ' + str(cnt_TLE))
print('RE x ' + str(cnt_RE))

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

vector<int> W;
int N,K;
int NMAX=100000, WMAX=10000;

bool check(int p) {
    int i,j=0,sum;
    for (i=0;i<K && j<N;i++) {
        sum = 0;
        for (;j<N && sum + W[j] <= p;j++) {
            sum += W[j];
        }
    }
    return (j>=N);
}
int search(int l, int r) {
    int p=(l+r)/2, ret = l;
    if (r-l >= 1) {
        ret = check(p) ? search(l, p) : search(p+1, r);
    }
    return ret;
}
int main() {
    cin>>N>>K;
    W = vector<int>(N);
    for (int i=0;i<N;i++) cin>>W[i];
    cout<<search(0,NMAX*WMAX)<<endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  int n,k; cin >>n >>k;
  int res = (n+1)/2;
  cout <<(k <= res ? "YES" : "NO") <<endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> cards(N);
  for (int i = 0; i < N; i++) {
    cin >> cards.at(i);
  }
  
  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());
  
  
  int total_g, total_b = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0)
      total_g += cards.at(i);
    else
      total_b += cards.at(i);
  }
  
  cout << total_g - total_b << endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> x, a;
  int tmp;
  for(int i = 0; i < m; i++){
    cin >> tmp;
    x.push_back(tmp);
  }
  if(n >= m){
    cout << "0" << endl;
    return 0;
  }

  sort(x.begin(), x.end());
  for(int i = 1; i < m; i++){
    tmp = x[i] - x[i-1];
    a.push_back(tmp);
  }
  sort(a.begin(), a.end());
  for(int i = 0; i < n-1; i++) a.pop_back();

  int sum = accumulate(a.begin(), a.end(), 0);
  cout << sum << endl;
  return 0;
}


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

int main(){
	long long N, M;
	cin >> N >> M;
	long long front = 2*N + 2*M - 4;
	if(min(N,M) == 1)
		front = 2;
	if(max(N,M) == 1)
		front = 0;
	cout << N*M - front << endl;
	return 0;
} 

Measured memory_bytes: 256
<?php
declare(strict_types=1);

//5
//2 6 1 4 5

$h = STDIN;
$len = trim(fgets($h));
$line = explode(' ', trim(fgets($h)));

//$c = [];
//foreach ($line as $item) {
//
//}
 sort($line);
$ans = 'YES';
foreach ($line as $index => $item) {
    $peek = $line[$index + 1] ?? false;
    if ($item === $peek) {
        $ans = 'NO';
        break;
    }
}

echo $ans;


Measured memory_bytes: 23028
#include <iostream>
#define int long long
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int mod = 1000000007;
int n, K;
const int C = 2525;
int dp[51][51][2 * C];	//dp[i][j][k + C] = (i, i)から見る. j個対応作った. 暫定奇妙さ = k (-C ≦ k < C)

signed main() {
	int i, j, k;
	
	cin >> n >> K;
	
	if (K >= C) { cout << 0 << endl; return 0; }
	
	dp[0][0][C] = 1;
	rep(i, n) {
		rep(j, i + 1) {
			rep(k, 2 * C) {
				if (dp[i][j][k] == 0) continue;
				(dp[i + 1][j][k - 2 * i] += dp[i][j][k]) %= mod;
				(dp[i + 1][j + 1][k] += 2 * (i - j) * dp[i][j][k]) %= mod;
				if (j < i) { (dp[i + 1][j + 2][k + 2 * i] += (i - j) * (i - j) * dp[i][j][k]) %= mod; }
				(dp[i + 1][j + 1][k] += dp[i][j][k]) %= mod;
			}
		}
	}
	
	cout << dp[n][n][C + K] << endl;
	return 0;
}

Measured memory_bytes: 100736
import java.util.*;
import java.io.*;

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int B = in.nextInt();
        if(A>0 && A<10 && B>0 && B<10)
        {
            System.out.println(A*B);
        }
        else
            {
                System.out.println(-1);
            }







        }







    }

















Measured memory_bytes: 35712
N,T = map(int,input().split())
trr = list(map(int,input().split()))


def calculate(n, t, trr):
    result = 0
    if n == 1:
        return t
    for index, tr in enumerate(trr):
        if index == 0:
            result = result + t
            continue
        if trr[index - 1] + t >= tr:
            result = result + t - ( trr[index - 1] + t - tr )
        else:
            result = result + t
    return result


result = calculate(N, T, trr)
print(result)

Measured memory_bytes: 25200
def bellmanford(num, start, goal, edges):
    cost = [float('inf')] * num
    cost[start] = 0
    for _ in range(num):
        updated = False
        for a, b, c in edges:
            if cost[b] > cost[a] + c:
                cost[b] = cost[a] + c
                updated = True
        if not updated: break
    else:
        return (-1,cost)
    return (1,-cost[goal])

def examD(inf):
    N, M = LI()
    v = []
    for i in range(M):
        x, y, z = map(int, input().split())
        v.append((x-1,y-1,-z))
#    print(v)
#    print(bellmanford(N, 0, N-1, v))
    cur,d = bellmanford(N, 0, N-1, v)
    if cur==-1:
        inf_flag = [False]*N
        for i in range(N):
            for f, t, c in v:
                if d[f] == inf: continue
                if inf_flag[f] == True:
                    inf_flag[t] = True
                if d[t] > d[f] + c:
                    d[t] = d[f] + c
                    inf_flag[t] = True
        print("inf" if inf_flag[N-1] else -d[N-1])
    else:
        print(d)

import sys
import copy
import bisect
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD(inf)

Measured memory_bytes: 47704
//#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;
using ll = long long;
using ull = unsigned long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007; // 998244353;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const ld PI = acos((ld)-1);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template <typename T> V<T> prefix_sum(const V<T>& v) {
  int n = v.size();
  V<T> ret(n + 1);
  rep(i, 0, n) ret[i + 1] = ret[i] + v[i];
  return ret;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(auto&& x: vec) is >> x;
  return is;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
  return os<<"{"<<p.fs<<","<<p.sc<<"}";
}

template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
  os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}

template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,cnt=0;
  cin>>n;

  bool f=false;
  rep(i,0,n){
    ll a,b;cin>>a>>b;
    if(a==b)++cnt;
    else cnt=0;

    if(cnt==3)f=true;
  }

  if(f)cout<<"Yes"<<ENDL;
  else cout<<"No"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3652
import sys
input = sys.stdin.readline


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    K = readint()
    S = readstr()
    if len(S) <= K:
        print(S)
    else:
        print(f'{S[:K]}...')


if __name__ == "__main__":
    main()


Measured memory_bytes: 9184
def inpl(): return [int(i) for i in input().split()]

N,Ma,Mb = inpl()
inf = float('inf')
H = {(0,0): 0}
for i in range(N):
    a, b, c = inpl()
    for (ia, ib), ic in H.copy().items():
        H[(ia+a,ib+b)] = min(H.get((ia+a, ib+b), inf),ic+c)

ans = min(H.get((i*Ma, i*Mb), inf) for i in range(1,401))
print(-1 if ans == inf else ans)    

Measured memory_bytes: 8220
N, T = map(int, input().split())
t = list(map(int, input().split()))

count = 0

for i, yt in enumerate(t):
    try:
        x = t[i + 1]
    except IndexError:
        count += T
        break

    if (t[i + 1] - yt) <= T:
        count += t[i + 1] - yt
    else:
        count += T

print(count)

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

#define M1 1000000007
#define M2 1000000009
#define ll long long 
#define ull unsigned long long
#define ui unsigned int
#define us unsigned short
#define INF 1001001001
#define PI 3.1415926535897932384626
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define f0(i, n) for (int i = 0; i < (int)(n); ++i)
#define f1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fc0(i,l,r) for(int i = (int)(l); i<(int)(r); ++i)
#define fc1(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define fr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
 
void init()
{
  #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      freopen("error.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;
}
 
signed main()
{
    init();

    int n,m,k;
    cin>>n>>m>>k;
    char c[7][7];
    f0(i,n){f0(j,m){cin>>c[i][j];}}

    int d=0,b;
    f0(i,1<<n)
    { 
      f0(j,1<<m)
      { b=0;
        f0(p,n)
        {
          f0(q,m)
          {
            if(((i>>p)&1)==0 && ((j>>q)&1)==0 && c[p][q]=='#')
              b++;
          }
        }
        if(b==k){d++;}
      }
    }
    cout<<d<<endl;

    cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
    return 0;
}

Measured memory_bytes: 3776
"use strict";

function main(input) {
  input = input.trim();
  let N = parseInt(input);
  let ans;
  let i = 1000;
  while (true) {
    if (i - N >= 0) {
      ans = i - N;
      break;
    }
    i = i + 1000;
  }
  console.log(ans);
}

function numberSort(array) {
  array.sort(f);
  return array;
}

var f = function (a, b) {
  return a - b;
};

main(require("fs").readFileSync("/dev/stdin", "utf-8"));


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

int n;
int a,b;

int main(){

	char c;
	cin>>c;
	if('a'<=c && c<='z'){
		cout<<'a'<<endl;
	}
	else{
		cout<<'A'<<endl;
	}
	return(0);
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int bsearch(const vector<ll>& a, ll x){
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if(a[mid] < x) {
      lft = mid;
    }
    else {
      rgt = mid;
    }
  }
  return lft;
}


signed main() {
  ios::sync_with_stdio(false);
  ll n, a, b;
  cin >> n >> a >> b;
  ll x;
  cin >> x;
  ll ans = 0;
  REP(i, n-1) {
    ll y;
    cin >> y;
    ans += min(a*(y-x), b);
    x = y;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;

#define MAX 1000000

int main(){

	bool p[MAX+1];
	int i,j,n;

	p[0]=false;
	p[1]=true;
	for(i=2; i<=MAX; i++){
		p[i] = true;
	}
	for(i=2; i<=sqrt(MAX)+1; i++){
		if(p[i]){
			for(j=i*2; j<=MAX; j=j+i){
				p[j] = false;
			}
		}
	}
	
	while(cin >> n){
		for(int i=n-1 ; i>=0 ; i--){
			if(p[i]){
				cout << i << " " ;
				break;
			}
		}
		for(int i=n+1 ; i<MAX ; i++){
			if(p[i]){
				cout << i << endl ;
				break;
			}
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef deque<int> di;
typedef pair<int,int> pi;
#define pb push_back
#define mp make_pair
#define mh make_heap
#define pf push_front
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 1000000000
#define FOR(i,a,b) for(ll i=a;i<b;i++)
int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    IOS
    ll d,t,s;
    cin>>d>>t>>s;
    if((t*s)>=d)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef map<string,int>mp;
int main(){
int N;
cin>>N;
mp m;
for(int i=0;i<N;i++){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    m[s]++;
}
long long cnt=0;
for(pair<string,int>p:m){
    if((p.second)>1){
        for(int i=(p.second)-1;i>=1;i--){
            cnt+=i;
        }
    }
}
cout<<fixed<<setprecision(0)<<cnt;

return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <stack>
#include <vector>
#include <algorithm>
#include <cmath>
#include <climits>

using namespace std;

const double PI = 3.14159265358979;

void printArr(int a[], int len) {

	for (int i = 0; i < len; i++)
	{
		if (i == 0) cout << a[0];
		else cout << " " << a[i];
	}
	cout << endl;
}


void countingSort(int a[], int len, int max) {

	int* b = new int[max + 1] ();
	int* c = new int[len];

	for (int i = 0; i < len; i++) {
		b[a[i]]++;
		c[i] = a[i];
	}

	for (int i = 1; i < max + 1; i++) {
		b[i] += b[i - 1];
	}

	for (int i = len - 1; i >= 0; i--) {
		a[b[c[i]] - 1] = c[i];
		b[c[i]]--;
	}

	delete[] b;
	delete[] c;
}

int main() {

	int n; cin >> n;

	int* a = new int[n];

	int max = -1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (max < a[i]) max = a[i];
	}
	countingSort(a, n, max);
	printArr(a, n);

	delete[] a;
	
	return 0;
}



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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

constexpr int INF = 1e9;
//constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  vector<int> cnt(N+1, 1);
  
  FOR(i, 2, N+1){
    for(int j = 1; j * i <= N; j++){
      cnt[j*i]++;
    }
  }
  ll ans = 0;
  FOR(i, 1, N+1){
    ans += (ll)i * cnt[i];
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
	string s;
	cin >> s;

	string ans = "";
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			ans += s.at(i);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

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

    double ans=0;
    rep(n,1,N+1){
        int v=n,powN=0;
        while(v<K){v*=2; powN++;}
        ans+=1./N*pow(1/2.,powN);
    }

    cout<<fixed<<setprecision(10)<<ans<<endl;
}

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

int main() {
    string s;
    cin >> s;
    bool a = false;
    bool b = false;
    for(int i = 0; i < s.length(); i++) {
        if(s[i] == 'A') {
            a = true;
        }
        else {
            b = true;
        }
    }
    if(a == true && b == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(/*ここを埋める*/T[u].p==-1) printf("root, ");
  else if(/*ここを埋める*/T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(/*ここを埋める*/T[u].l!=NIL) calcDepth(/*ここを埋める*/T[u].l,p+1);
  if(/*ここを埋める*/T[u].r!=NIL) calcDepth(/*ここを埋める*/T[u].r,p);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 3416
import numpy as np
N, M, C = map(int, input().split())
b_inputs = np.array(list(map(int, input().split())))

a_inputs = [np.array(list(map(int, input().split()))) for _ in range(N)]

ans = 0
for i in range(N):
    if sum(a_inputs[i] * b_inputs) + C > 0:
        ans += 1

print(ans)

Measured memory_bytes: 20812
D, G = list(map(int, input().split()))
p, c = [0,], [0,]
for _ in range(D):
    pi, ci = list(map(int, input().split()))
    p.append(pi)
    c.append(ci)
ans = 1010
for i in range(2 ** D):
    score = 0
    solve = [False] * D
    for j in range(D):
        if i >> j & 1:
            solve[j] = True
        else:
            continue
    score = sum([100 * (j + 1) * p[j + 1] + c[j + 1] for j in range(D) if solve[j]])
    num = sum([p[j + 1] for j in range(D) if solve[j]])
    maxp = len(list(filter(lambda x: not x, solve)))
    if maxp != 0:
        for i in range(1, p[maxp]):
            if score >= G:
                break
            score += 100 * maxp
            num += 1
    if score < G:
        num = 1010
    ans = min(num, ans)
print(ans)

Measured memory_bytes: 45532