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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<ll> divisor(ll n){
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++){
        if(n % i == 0){
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

vector<int> g[30];

int main(void) {
  string s, t;
  cin >> s >> t;

  map<char, int> ms;
  REP(i, s.size()) {
    ms[s[i]]++;
    g[(int)s[i]].push_back(i + 1);
  }

  bool ans = true;
  REP(i, t.size()) if(ms[t[i]] == 0) ans = false;
  
  int now = 0;
  ll ans_c = 0;
  if(ans) {
    REP(i, t.size()) {
      auto ite = upper_bound(all(g[t[i]]), now); 
      if (g[t[i]].end() - ite == 0) {
        now = g[t[i]][0];
        ans_c++;
      } else {
        now = *ite; 
      }
    }
    cout << ans_c * (ll)s.size() + now << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

int gcd(int a, int b) {
  int r;
  while (b != 0) {
    r = a % b;
    a = b; 
    b = r;
  }
  return a;
}
int main(){
    int n, x, d;
    vector<int> v, w;
    cin >> n >> x;
    v.resize(n);
    w.resize(n);
    for (int i=0; i<n; ++i){
        cin >> v[i];
        w[i] = abs(x - v[i]);
        // cout << w[i] << endl;
    }
    d = w[0];
    for (int i=1; i<n; ++i){
        d = gcd(d, w[i]);
    }
    cout << d << endl;
}



Measured memory_bytes: 1024
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cctype>
using namespace std;

int main(){
    string x;
    for(;;) {
        int num = 0;
        getline(cin,x);
        char n = x[0];
        for(int i = 0; i < x.size(); i++) {
            num += x[i] - '0';
        }
        if(n == '0'){
            break;
        }
        cout << num << endl;
    }
    return 0;
}



Measured memory_bytes: 3160
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    int N;
    read(N);
    vector<string> S(N);
    for(int i = 0; i < N; i++){
        read(S[i]);
    }
    set<string> st;
    for(int i = 0; i < N; i++){
       st.insert(S[i]);
    }
    write(st.size());
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

Measured memory_bytes: 25168
#include<iostream>
using namespace std;
void swap(int& a, int& b) {
  int t = a;
  a = b;
  b = t;
}
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while(b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
int main () {
  int A[100005];
  int N;
  cin >> N;
  for (int i = 1; i <= N; i ++) cin >> A[i];
  int L[100005];
  int R[100004];
  L[N + 1] = 0;
  R[0] = 0;
  for (int i = 1; i <= N; i ++) {
    L[i] = gcd(L[i - 1], A[i]);
  }
  for (int j = N; j > 0; j --) {
    R[j] = gcd(R[j + 1], A[j]);
  }
  int ans = 0;
  for (int i = 1; i <= N; i ++) {
    int k = gcd(L[i - 1], R[i + 1]);
    if (ans < k) ans = k;
  }
  cout << ans << endl;
  //cout << gcd(39, 13) << endl;
}



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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int sum = accumulate(A.begin(), A.end(), 0L);
  cout << ((sum > N) ? -1 : N - sum) << "\n";
}

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

int main() {
  int N;
  scanf("%d", &N);

  int MAX = -1;
  int MIN = 1001;
  for (int i = 0; i < N; i++) {
    int A = 0;
    scanf("%d", &A);
    if (MIN > A) MIN = A;
    if (MAX < A) MAX = A;
  }

  printf("%d", MAX - MIN);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
void Main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    // +でstart
    vector<ll> S(n + 1);

    ll res = 1e18;
    ll sum = 0;
    rep(i, n) {
        if (i % 2 == 0) {
            // +でありたい
            if (S[i] + a[i] <= 0) {
                S[i + 1] = 1;
                sum += abs(S[i + 1] - (S[i] + a[i]));
            }
            else {
                S[i + 1] = S[i] + a[i];
            }
        }
        else {
            if (S[i] + a[i] >= 0) {
                S[i + 1] = -1;
                sum += abs(S[i + 1] - (S[i] + a[i]));
            }
            else {
                S[i + 1] = S[i] + a[i];
            }
        }
    }
    res = min(res, sum);

    
    sum = 0;
    rep(i, S.size()) S[i] = 0;
    rep(i, n) {
        if (i % 2 == 0) {
            // -でありたい
            if (S[i] + a[i] >= 0) {
                S[i + 1] = -1;
                sum += abs(S[i + 1] - (S[i] + a[i]));
            }
            else {
                S[i + 1] = S[i] + a[i];
            }
        }
        else {
            if (S[i] + a[i] <= 0) {
                S[i + 1] = 1;
                sum += abs(S[i + 1] - (S[i] + a[i]));
            }
            else {
                S[i + 1] = S[i] + a[i];
            }
        }
    }
    res = min(res, sum);

    put(res);
    
}
signed main(){ Main();return 0;}

Measured memory_bytes: 4776
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
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; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int a,b; cin>>a>>b;
    char aa = '0' + a, bb = '0' + b;
    string s,t; cin>>s>>t;
   
    rep(i, b) s += aa;
    rep(i,a) t += bb;

    cout<<min(s,t)<<endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author apurba_debnath
 */

#include <bits/stdc++.h>

#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl

using namespace std;

class BEasyLinearProgramming {
public:
    void solve(std::istream &in, std::ostream &out) {
        int a, b, c, k;
        in >> a >> b >> c >> k;
        if (k <= a)
            out << k << endl;
        else if (k <= a + b)
            out << a << endl;
        else
            out << a - (k - a - b) << endl;
    }
};


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

    BEasyLinearProgramming solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);

    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    s << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    s << ']';
	return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

	int a, b, t;
	cin >> a >> b >> t;

	ppp(b*(t/a));



    return 0;
}


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

int n, z, mx, x, a, num;
int g(int p) {return p > 0 ? p : -p;}
int main()
{
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf ("%d", &a);
		num = g(a);
		if (num > mx) {
			mx = num;
			if (a < 0) z = -1;
			else z = 1;
			x = i;
		}
	}
	printf("%d\n", n * 2 - 1);
	for (i = 0; i<n;i++)printf("%d %d\n", x + 1, i + 1);
	if (z == 1) for (i = 0; i < n - 1; i++) printf("%d %d\n", i + 1, i + 2);
	else for (i = n - 1; i >= 1; i--) printf("%d %d\n", i + 1, i);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;
using pii = pair<int, int>;
using vpii = vector<pii>;

int main() {
  int N, M, x, y, p, q, tmp = 0;
  cin >> N >> M;
  vi apex(N);
  vpii side(M);
  int ans = 0;
  bool judge = false;
  
  rep(i, N) {
    tmp++;
    apex.at(i) = tmp;
  }
  
  rep(i, M) {
    cin >> x >> y;
    side.at(i) = make_pair(x, y);
  }
  
//  sort(apex.begin(), apex.end());
  do {
    if (apex.at(0) != 1) break;
    rep(j, N-1) {
      judge = false;
      rep(k, M) {
        tie(p, q) = side.at(k);
        if (p == apex.at(j) && q == apex.at(j+1)) {
          judge = true;
          break;
        } else if (p == apex.at(j+1) && q == apex.at(j)) {
          judge = true;
          break;
        }
      }
      if (!judge) break;      
    }
    if (judge) ans++;
  } while (next_permutation(apex.begin(), apex.end()));
  
  cout << ans << endl;
}



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

typedef long long ll;
#define rep(i, n) for (int i = 0; (i) < int(n); ++(i))

bool comp(const vector<int> &x, const vector<int> &y){
    return x[2] > y[2];
}

int P [10]={0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2};
int Q [10]={1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3};
int R [10]={2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4};

int main(void){

    int x; cin >> x;
    int ans = 0;
    rep(i, 10){
        if(i<2){
            continue;
        }
        double p = pow(double(x), 1.0/double(i)) + 0.000001;
        int tmp = int(p);
        int cnd = int(pow(double(tmp), double(i)));
        ans = max(ans, cnd);
    }
    cout << ans << endl;


    return 0;
}

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

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

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (h[i] < K)
        {
            break;
        }
        ans++;
    }
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
PROGRAM main
	implicit none
	integer :: x,xmax, xx
	read *, x
    xmax = 100000000
    do xx = x, xmax
      if (isPrimeNum(xx))then
      	print "(i0)", xx
        exit
       endif
    enddo
contains

	logical pure function isPrimeNum(n)
    	integer, intent (in) :: n
        integer :: i, iend
        
        iend = sqrt(dble(n))+1
        if(iend == n) iend = iend-1
    	isPrimeNum = .false.
        do i = 2 , iend
        	if (mod(n,i)==0) return
        enddo
        
	    isPrimeNum = .true.
    end function isPrimeNum

END PROGRAM main

Measured memory_bytes: 256
// 3

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<29;
const bool debug = 0;

int main() {
  int n;
  cin >> n;
  
  for(int i=0; i<n; i++){
     int k,p;
     cin >> k >> p;
     if(k%p == 0)cout << p << endl;
     else cout << k%p << endl;
  }
  
	return 0;
}

Measured memory_bytes: 3100
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
using namespace std;

#define huge 1000000007

int main(void) {

	int N = 0;
	int A[2][100];
	int max = 0;
	int res = 0;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		cin >> A[0][i];
	}

	for (int i = 0; i < N; i++)
	{
		cin >> A[1][i];
	}

	for (int i = 0; i < N; i++) {
		
		for (int j = 0; j < i + 1;j++)
		{
			max += A[0][j];
			//cout << A[0][j] << endl;
		}

		for (int j = N-1; j >= i; j--)
		{
			max += A[1][j];
			//cout << A[1][j] << endl;
		}

		if (max > res) {
			res = max;
		}

		

		max = 0;
	}


	cout << res << endl;
	return 0;




}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define Mod 1000000007

using namespace std;

int main() {
    ll n,m;cin>>n>>m;
    priority_queue<ll>q;
    for(ll i=0;i<n;i++){
        ll x;cin>>x;
        q.push(x);
    }
    while(m--){
        ll t=q.top();q.pop();
        t>>=1;
        q.push(t);
    }
    ll sum=0;
    while(q.size()){
        sum+=q.top();
        q.pop();
    }
    cout<<sum;
}

Measured memory_bytes: 1400
fun main(args:Array<String>?): Unit {
    val lunchStart = Date(11, 0)
    val lunchEnd = Date(14, 59)
    val dinnerStart = Date(18, 0)
    val dinnerEnd = Date(20, 59)
    val midnightStart = Date(21, 0)
    val midnightEnd = Date(1, 59)
    while (true) {
        val n = readLine()!!.trim().toInt()
        if (n == 0) return
        val orders = Array(n) {
            val (date, time) = readLine()!!.trim().split(' ')
            Pair(Date.parse(date), time.toInt())
        }
        println("lunch ${countOrders(orders, lunchStart, lunchEnd).takeIf { it.first != 0 }?.let { (whole, good) -> good * 100 / whole }
                ?: "no guest"}")
        println("dinner ${countOrders(orders, dinnerStart, dinnerEnd).takeIf { it.first != 0 }?.let { (whole, good) -> good * 100 / whole }
                ?: "no guest"}")
        println("midnight ${countOrders(orders, midnightStart, midnightEnd).takeIf { it.first != 0 }?.let { (whole, good) -> good * 100 / whole }
                ?: "no guest"}")
    }
}
fun countOrders(orders: Array<Pair<Date, Int>>, from: Date, to: Date): Pair<Int, Int> {
    return orders.filter{(orderTime, _ ) ->
        orderTime.minutesFrom(from) <= to.minutesFrom(from)
    }.let{list ->
        Pair(list.size, list.count{ (orderTime, time) -> orderTime.nextTime(time).minutesFrom(orderTime) <= 8})
    }
}

data class Date(val hour: Int, val minute: Int) {
    fun minutesFrom(start: Date): Int = ((hour - start.hour) * 60 + (minute - start.minute)).let{if (it > 0) it else 60 * 24 + it}
    fun nextTime(diff: Int): Date = if (minute < diff) Date(hour, diff) else Date(hour + 1, diff)
    companion object {
        fun parse(expression: String): Date {
            val (hour, minute) = expression.split(':').map(String::toInt)
            return Date(hour, minute)
        }
    }
}


Measured memory_bytes: 32616
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
AB = np.array([lr() for _ in range(N)])
AB = AB[np.argsort(AB[:, 1])]
A = AB[:, 0]
B = AB[:, 1]
bl = np.all(A.cumsum() <= B)
print('Yes' if bl else 'No')
# 

Measured memory_bytes: 62368
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int N; cin >> N;
    if (N % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    string S; cin >> S;
    rep(i, N / 2) {
        if (S.at(i) != S.at(i + N / 2)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

signed main() {
    string s; 
    cin >> s;
    ll len = (ll)s.size();
    
    ll r = 0;
    
    for (ll i = len-2; i > 0; i -= 2) {
        bool flg = true;
        rep(j, i/2) {
            if (s[j] != s[j+(i/2)]) flg = false;
        }
        if(flg) r = max (r, i);
    }
    
    mes(r);
    
    
    
}

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

bool has_divisor(int N, int i) {
  if (i == N) {
    return false;
  }
  
  if (N % i == 0) {
 
    return true;
  }

  return has_divisor(N, i + 1);
}

bool is_prime(int N) {
  if (N == 1) {
    return false;
  }
  else if (N == 2) {
    return true;
  }
  else {
    return !has_divisor(N, 2);
  }
}




int main(){
  int X;
  cin >> X;
  
  for(int i=X;i<100004;i++){
    if(is_prime(i)==true){
      cout << i << endl;
      break;
    }
  }
}
    

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

int main()
{
	int a,b,c,d,max;
	cin >> a >> b;
	c=a-1;
	d=b-1;
	max=a+c;
	if (max<(c+b))
		max=c+b;
	if (max<(c+d))
		max=c+d;
	if (max<(a+b))
		max=a+b;
	if (max<(d+b))
		max=d+b;
	if (max<(a+d))
		max=a+d;
	cout << max;
}


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

int main()
{


        ll n,sum=0,l=0,k;
        cin>>n;
         vector<ll>a;
       for(ll i=1;i<=n;i++)
       {
           for( ll j=1;j<=n;j++)
           {
               k=gcd(i,j);
               a.push_back(k);

           }
       }
       for(ll i=0;i<a.size();i++)
      {

       for( ll j=1;j<=n;j++)
           {
               l= gcd(j,a[i]);
               sum=sum+l;


           }
      }
      cout<<sum<<endl;


    return 0;
}



Measured memory_bytes: 3860
package main

import (
	"fmt"
)

func main() {
	var N, r, ans int
	var C string
	fmt.Scan(&N, &C)
	W := make([]int, 0)
	for i := range C {
		if string(C[N-1-i]) == "R" {
			r++
		} else {
			W = append(W, r)
		}
	}
	for i := range W {
		if W[len(W)-1-i] > ans {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 8964
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	int m[2];
	for(;cin>>s,s!="#";){
		m[0]=m[1]=0;
		for(int i=1;i<s.size();i++){
			if((s[i]-'1')%3>(s[i-1]-'1')%3){
				m[0]=min(m[0]+1,m[1]);
				m[1]=1<<30;
			}else if((s[i]-'1')%3<(s[i-1]-'1')%3){
				m[1]=min(m[0],m[1]+1);
				m[0]=1<<30;
			}else{
				m[1]^=m[0],m[0]^=m[1],m[1]^=m[0];
			}
		}
		cout<<min(m[0],m[1])<<endl;
	}
}

Measured memory_bytes: 1316
while True:
    try:
        N = int(input())
        H = map(int, input().split())
        result = 0
        pre = None
        l = 0
        for i in H:
            if pre is None:
                pre = i
                continue
            if i <= pre:
                l += 1
            else:
                if l > result:
                    result = l
                l = 0
            pre = i
        if l > result:
            result = l
        print(result)
    except EOFError:
        break

Measured memory_bytes: 11136
# include<iostream>
using namespace std;
int main (){
string a ;
cin >> a ;
if (a == "Cloudy" ){
    cout << "Rainy";
}
 else if ( a == "Rainy"){
    cout << "Sunny";
}
else if (a== "Sunny"){
    cout<< "Cloudy";
}
}

Measured memory_bytes: 256
from itertools import accumulate
from math import ceil

N = int(input())
a = list(map(int, input().split()))

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0] * (n + 1)
        
    def update(self, i, v):
        while i <= self.n:
            self.bit[i] += v
            i += i & -i
            
    def query(self, i):
        ret = 0
        while i > 0:
            ret += self.bit[i]
            i -= i & -i
        return ret
    
    def reset(self):
        self.bit = [0] * (self.n + 1)

ub = max(a) + 1
lb = 0
th = ceil(((N + 1) * N // 2) / 2)
bit = BIT(N + 1)

while ub - lb > 1:
    mid = (ub + lb) // 2
    b = [1 if v >= mid else -1 for v in a]
    b = [0] + list(accumulate(b))
    b_sorted = {v: i + 1 for i, v in enumerate(sorted(b))}
    
    # Count inversion
    cnt = 0
    bit.reset()
    for v in b:
        cnt += bit.query(b_sorted[v])
        bit.update(b_sorted[v], 1)
        
    if cnt >= th:
        lb = mid
    else:
        ub = mid
    
print(lb)







Measured memory_bytes: 131008
import sys

def debug(*args):
    print(*args, file=sys.stderr)


def solve(N, A, B):
    B = B

    result = 0
    for i in range(0, N):
        r0 = min(A[i], B[i])
        A[i] -= r0
        B[i] -= r0
        result += r0
        debug("i=%d"%i, r0)
        if B[i] > 0:
            r = min(A[i+1], B[i])
            A[i+1] -= r
            B[i] -= r
            result += r
            debug("i=%d"%i, r)

    return result


def main():
    N = int(input())
    A = [int(x) for x in input().split()]
    B = [int(x) for x in input().split()]
    print(solve(N, A, B))

main()


Measured memory_bytes: 19284
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y, z;
	cin >> x >> y >> z;
	cout << z << " " << x << " " << y << endl;
	return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> x(n);
    int memo;
    int count=0;
    for (int i = 0; i < n; i++)
    {
        cin >> x.at(i);
        memo=min(x.at(i),k-x.at(i));
        count+=2*memo;
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <array>
#include <cstdio>

using namespace std;

template<class T> void gc(T &x)
{
    char c;
    int s = 0;
    x = 0;

    c = getchar_unlocked();

    if (c == '-') s = 1;
    else if ('0' <= c && c <= '9')  x = c - '0';

    while (true)
    {
        c = getchar_unlocked();

        if (c < '0' || c > '9') break;
        x = x * 10 + (c - '0');
    }

    if (s) x = -x;
}

int main()
{
    int N, C;

    gc(N);
    gc(C);

    array<int, 100000> s, t, c;

    array<int, 100000> sm, tt;

    for (int i = 0; i < N; i++)
    {
        gc(s[i]);
        gc(t[i]);
        gc(c[i]);
    }

    int idxmx = 0;
    sm.fill(0);
    for (int i = 1; i <= C; i++)
    {
        tt.fill(0);
        for (int j = 0; j < N; j++)
        {
            // 始点 + 1
            // 終点 - 1
            // 終点+1 に対して -1 とすると被る
            if (c[j] == i) tt[s[j]- 1]++, tt[t[j]]--;

            // 終点の最大値を取得 ブン回しせず
            if (idxmx < t[j]) idxmx = t[j];
        }

        for (int j = 1; j < idxmx; j++) tt[j] += tt[j - 1];

        for (int j = 0; j < idxmx; j++) if (tt[j] > 0) sm[j]++;
    }

    int mx = 0;
    for (int i = 0; i < idxmx; i++) if (mx < sm[i]) mx = sm[i];

    printf("%d\n", mx);
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
string a[101];
int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	for (int i = 0; i < n; i++)
		cout << a[i] ;
}

Measured memory_bytes: 256
#include <stdio.h>
int a[44];
int fib(int);

main(){
  int n;

  scanf("%d", &n);
  printf("%d\n", fib(n));
  return 0;
}

int fib(int n){
  int i;
  switch(n){
    case 0:
    case 1:
      a[n] = 1;
      break;
    default:
      a[n] = fib(n - 1);
      break;
  }
  return a[n] + a[n - 1];
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod)
{
        a %= _mod; b %= _mod; ll res = 1;
        switch(op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break;
        } 
        if (res < 0) { res += _mod; } return res;
}



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

        rep(i, 0, len(S)-2+1) {
                if (S[i] == 'A' and S[i+1] == 'C') {
                        cout << "Yes" << endl;
                        return 0;
                }
        }

        cout << "No" << endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

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

    if((abs(a-c) <= d) || ((abs(a-b) <= d) && (abs(b-c) <= d))) {
        cout << "Yes\n";
    } else { cout << "No\n"; }
    
    return 0;
}


Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
nums = list(map(int, input().split()))
n = len(nums)
heap = []
for i in range(M):
    B, C = map(int, input().split())
    heap.append([-C, B])
for num in nums:
    heap.append([-num, 1])
s = 0
heapq.heapify(heap)
while n > 0:
    num, cnt = heapq.heappop(heap)
    num = num * -1
    s += num * min(cnt, n)
    n -= min(cnt, n)
print(s)

Measured memory_bytes: 37048
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int numN = 0;

		try {
			scanner = new Scanner(System.in);
			numN = scanner.nextInt();

			int[] height = new int[numN];
			for (int i = 0; i < numN; i++) {
				height[i] = scanner.nextInt();
			}

			int[] costArray = new int[numN];
			Arrays.fill(costArray, Integer.MAX_VALUE);
			costArray[0] = 0;
			for (int i = 0; i < height.length; i++) {
				for (int j = 1; j <= 2 && j + i < numN; j++) {
					int cost = Math.min(Math.abs(height[i + j] - height[i]) + costArray[i], costArray[i + j]);
					costArray[i + j] = cost;
				}
			}

			System.out.println(costArray[numN - 1]);

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 49932
package main

import "fmt"

func main() {
	// Code for A - White Cells
	var H, W int
	var h, w int
	fmt.Scanf("%d %d", &H, &W)
	fmt.Scanf("%d %d", &h, &w)

	fmt.Println(H*W - W*h - H*w + h*w)
}


Measured memory_bytes: 1836
import bisect
N = int(input())
Alist = [int(x) for x in input().split()]
Blist = [int(x) for x in input().split()]
Clist = [int(x) for x in input().split()]

Alist.sort()
Blist.sort()
Clist.sort()

result = 0
for b in Blist:
    a = bisect.bisect_left(Alist, b)
    c = N - bisect.bisect_right(Clist, b)
    result += a*c

print(result)

Measured memory_bytes: 23232
A=list(input().split())
if A[0]==A[1] and A[1]!=A[2]:
  print('Yes')
elif A[1]==A[2] and A[2]!=A[0]:
  print('Yes')
elif  A[0]==A[2] and A[2]!=A[1]:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
#include<iostream>
#define N 200005
using namespace std;
int n,q,m;
long long Q,V[N],ans[N],a[N];
void CL(long long x,long long v)
{
	int P;
	P=upper_bound(a+1,a+m+1,x)-a-1;
	if (!P)
	{
		ans[1]+=v;
		ans[x+1]-=v;
		return;
	}
	V[P]+=v*(x/a[P]);
	CL(x%a[P],v);
}
int main()
{
	scanf("%d%d",&n,&q);
	m++;
	a[m]=n;
	for (int i=1;i<=q;i++)
	{
		scanf("%lld",&Q);
		while (Q<=a[m])
			m--;
		a[++m]=Q;
	}
	V[m]=1;
	for (int i=m;i>1;i--)
	{
		V[i-1]+=V[i]*(a[i]/a[i-1]);
		CL(a[i]%a[i-1],V[i]);
	}
	ans[0]=0;
	ans[1]+=V[1];
	ans[a[1]+1]-=V[1];
	for (int i=1;i<=n;i++)
	{
		ans[i]+=ans[i-1];
		printf("%lld\n",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 6160
# include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 1e5;
LL a[maxn+3]={0}, b[maxn+3]={0}, c[maxn+3]={0};
int main()
{
    LL sum = 0;
    int n, m;
    scanf("%d%d%lld",&n,&m,&a[1]);
    for(int i=2; i<=n; ++i)
    {
        scanf("%lld",&a[i]);
        if(a[i] > a[i-1])
        {
            sum += a[i]-a[i-1];
            b[a[i-1]+1] += a[i-1]+1;
            b[a[i]+1] -= a[i-1]+1;
            ++c[a[i-1]+1];
            --c[a[i]+1];
        }
        else
        {
            sum += m-a[i-1]+a[i];
            b[a[i-1]+1] += a[i-1]+1;
            ++c[a[i-1]+1];
            b[1] -= m-a[i-1]-1;
            ++c[1];
            b[a[i]+1] += m-a[i-1]-1;
            --c[a[i]+1];
        }
    }
    for(int i=1; i<=m; ++i)
        b[i] += b[i-1], c[i] += c[i-1];
    LL ans = 0;
    for(int i=1; i<=m; ++i)
        ans = max(ans,i*1LL*c[i]-b[i]);
    printf("%lld\n",sum-ans);
    return 0;
}


Measured memory_bytes: 2560
s = input()
x, y = map(int, input().split())
n = len(s)

D = [[], []]
st_x = 0
st_y = 0
st = 0
while st <= len(s)-1 and s[st] == "F":
    x -= 1
    st += 1

di = 0
for i in range(st, n):
    if s[i] == "T":
        di = (di+1) % 2
        D[di].append(0)
    else:
        D[di][-1] += 1

# print(D)


ANS = [0, 0]
st_po = [0, 0]
go_po = [x, y]
for i in range(2):
    mid = sum(D[i]) + 5
    DP = [[0] * (mid*2) for i in range(len(D[i]) + 1)]
    DP[0][st_po[i] + mid] = 1
    for j in range(len(D[i])):
        dd = D[i][j]
        for k in range(len(DP[0])):
            aa = 0
            bb = 0
            if 0 <= k-dd <= len(DP[0])-1:
                aa = DP[j][k-dd]
            if 0 <= k+dd <= len(DP[0])-1:
                bb = DP[j][k+dd]

            DP[j+1][k] = int(aa or bb)

    if 0 <= go_po[i]+mid <= len(DP[0])-1:
        ANS[i] = DP[-1][go_po[i]+mid]
    # print("len",mid*2)
    #if i == 1:
        # print(DP[1][7999+mid])
# print(ANS)

print("Yes" if ANS[0] and ANS[1] else "No")

Measured memory_bytes: 168924
#include<bits/stdc++.h>
#define maxn 1005
#define mod 1000000007 
using namespace std;

unsigned int n,m,p[maxn][maxn],f[maxn][maxn];

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		string s;
		cin>>s;
		for(int j=0;j<m;j++){
			if(s[j]=='.') p[i][j+1]=1;
		}
	}
//	for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ printf("%d ",p[i][j]); } printf("\n"); }
	f[1][1]=1;
	for(int i=2;i<=n;i++){
		if(p[i][1]) f[i][1]=f[i-1][1];
		else break;
	}
	for(int i=2;i<=m;i++){
		if(p[1][i]) f[1][i]=f[1][i-1];
		else break;
	}
//	for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ printf("%d ",f[i][j]); } printf("\n"); }
	for(int i=2;i<=n;i++){
		for(int j=2;j<=m;j++){
			if(p[i][j]) {
				f[i][j]=f[i-1][j]+f[i][j-1];
				f[i][j]%=mod;
			}
		}
	}
	
	printf("%d\n",f[n][m]%mod);
} 


Measured memory_bytes: 11616
import sys
input()
rl = sys.stdin.readlines()
d = {}

for i in rl:
    #c, s = i.split()
    if i[0] == 'i':
    #if c[0] == 'i':
        d[i[7:]] = 0
        #d[s] = 0
    else:
        if i[5:] in d:
        #if s in d:
            print('yes')
        else:
            print('no')

Measured memory_bytes: 112312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl



int main() {
    int ans = INF;
    IN(int, d);
    IN(int, g);
    vector<pii> a(d);
    REP(i, d){
        cin >> a[i].first >> a[i].second;
    }
    for (int bit = 0; bit < (1<<d); bit++) {
        int sum = 0;
        int n = 0;
        for (int i = 0; i < d; i++) {
            if ((1<<i)&bit) {
                sum += a[i].first*(i+1)*100 + a[i].second;
                n += a[i].first;
            }
        }
        if (sum >= g) {
            ans = min(ans,n);
        }else{
            for (int j = d-1; j >= 0; j--) {
                if (!((1<<j)&bit)) {
                    if(g-sum <= (a[j].first-1)*100*(j+1)){
                        n += (g-sum+100*(j+1)-1) /(100*(j+1));
                        ans = min(ans,n);
                        break;
                    }
                }
            }
        }
    }
    
    COUT(ans);
}





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

res = 0
prev = H[0]
count = 0

for i in range(1, N):
    if H[i] <= prev:
        count += 1
    else:
        count = 0
    prev = H[i]
    res = max(res, count)

print(res)

Measured memory_bytes: 63856
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

struct data{
  int num;
  int score;
};
data da[1000];

int b_sort(int j){
  int tmp;
  tmp = da[j].score;
  da[j].score = da[j+1].score;
  da[j+1].score = tmp;

  tmp = da[j].num;
  da[j].num = da[j+1].num;
  da[j+1].num = tmp;
}

int main(){

  int n; 
  for(n = 0;;n++ ){
    scanf("%d,%d",&da[n].num,&da[n].score);
    if(da[n].num == 0 && da[n].score == 0 )break;
  }

  for(int i = n-1 ; i >= 0 ; i--){
    for(int j = 0 ; j < n ; j++ ){
      if(da[j].score < da[j+1].score){
	b_sort(j);
      }
    }
  }
  int table[1000],rank = 1;
 
  for(int i = 0; i < n; i++){
    table[da[i].num] = rank;
    if(da[i].score > da[i+1].score)rank++;
  }

  int call;
  while(cin >> call){
    cout << table[call] << endl;
  }

}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int i(0),l,n,A(0),B(0);
  cin >> n;
  vector<int> a(n);
  while(cin >> l){
    a.at(i) = l;
    i++;
  }
  sort(a.begin(),a.end());
  for(int j(0);j<n;j++){
    if(j%2==0)	A += a[n-1-j];
    else	B += a[n-1-j];
  }
  cout << A-B;
  
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import sys
s = sys.stdin.readlines()
N = s[0].split()
rest_dict = {}
order_dict = {}
count = 1
for e in s[1:]:
    S = e.split()[0]
    P = int(e.split()[1])
    if S in rest_dict:
        rest_dict[S].append(P)
    else:
        rest_dict[S] = [P]
    order_dict["{}_{}".format(S, P)] = count
    count += 1
    
for k, v in sorted(rest_dict.items()):
    v.sort()
    v.reverse()
    for p in v:
        print(order_dict["{}_{}".format(k, p)])

Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();
    let mut ans = a[0] - 1;
    let mut po = 2;
    for i in 1..n {
        if po < a[i] {
            let ko = (a[i] - 1) / po;
            ans += ko;
        } else {
            po = std::cmp::max(po, a[i] + 1);
        }
    }
    println!("{}", ans);
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
const int N=305;
int a[N][N];
bool b[N];
queue<int>f[N];
int n,m;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			scanf("%d",&a[i][j]);
	for(int i=1;i<=n;i++)
		f[a[i][1]].push(i),a[i][0]=1;
	memset(b,true,sizeof(b));
	int ret=0;
	for(int i=1;i<=m;i++)
		if(f[i].size()>ret)ret=f[i].size();
	int ans=ret;
	while(1){
		int k=-1;
		for(int i=1;i<=m;i++)
			if(k==-1||f[i].size()>f[k].size())k=i;
		if(k==-1)break;
		b[k]=false;
		while(!f[k].empty()){
			int i=f[k].front();
			f[k].pop();
			while(!b[a[i][a[i][0]]])a[i][0]++;
			f[a[i][a[i][0]]].push(i);
		}
		int ret=0;
		for(int i=1;i<=m;i++)
			if(f[i].size()>ret)ret=f[i].size();
		if(ret==0)break;
		ans=min(ans,ret);
	}
	printf("%d",ans);
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if (i < B) {
                cout << (j < A ? 1 : 0);
            }
            else {
                cout << (j < A ? 0 : 1);
            }
        }
        cout << '\n';
    }

}



Measured memory_bytes: 1280
#include<iostream>
#include <algorithm>
#include<iomanip>
#include<math.h>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main()
{
	long N = 0, M = 0, a[2000] = { 0 },max=0;
	cin >> N >> M;
	for (int x = 0; x < N; x++) {
		cin >> a[x];
		max += a[x];
	}
	sort(a, a + SIZE_OF_ARRAY(a), greater<>());
	if (a[M - 1] >= double(max / (4.0 * M)))cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int N,M;
  	cin >> N >>M;
  	vector<int> A(M);
  	int days = 0;
  	for(int i = 0; i < M; i++){
    	cin >> A.at(i);
      	days = days + A.at(i);
    }
  	if((N - days) >= 0)
      	cout << N-days <<endl;
  	else
      	cout << -1 <<endl;
  	
}

Measured memory_bytes: 3668