akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[100100];
char op[100100];
ll dp[100100][3];

ll solve() {
    dp[0][0] = a[0];
    dp[0][1] = dp[0][2] = -1e18;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j <= 2; j++) {
            ll s = (op[i]=='+'?1:-1)*(j%2?-1:1)*a[i];
            dp[i][j] = dp[i-1][j] + s;
            if (j < 2) dp[i][j] = max(dp[i][j], dp[i-1][j+1] + s);
            if (j < 1) dp[i][j] = max(dp[i][j], dp[i-1][j+2] + s);
        }
        for (int j = 2; j > 0; j--) {
            if (op[i] == '-' && j > 0) {
                dp[i][j] = max(dp[i][j], dp[i][j-1]);
            }
        }
    }
    return max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
}

void input() {
    cin >> n;
    cin >> a[0];
    for (int i = 1; i < n; i++) cin >> op[i] >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3456
program Sum_of_Large_Numbers;
uses math;
const
  m: int64 = 1000000007;
  h: int64 = 500000004;
  s: int64 = 166666668;
var
  n, k: int64;
function f(i: int64): int64;
begin
  f := i*(((n+1)*(h*(i+1) mod m)-(s*((i+1)*(i*2+1) mod m) mod m)+1) mod m);
end;
begin
  read(n, k);
  writeln((m+(f(n+1)-f(k-1)) mod m) mod m);
end.

Measured memory_bytes: 1380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
int D;
vector<int> c(26);
int main()
{
    cin >> D;
    int s[366][28];
    int last[28];

    rep(i, 1, 27)
    {
        cin >> c[i];
    }
    rep(i, 1, D + 1)
    {
        rep(j, 1, 27)
        {
            cin >> s[i][j];
            last[j] = 0;
        }
    }
    vector<int> t(D + 1);
    vector<ll> tmp(D + 1);

    ll score = 0;
    ll maxi = -100000;
    int dcon;
    rep(i, 1, D + 1)
    {
        // }
        maxi = 0;
        rep(j, 1, 27)
        {
            //i日目の満足度の最大値を求める
            score = s[i][j];
            rep(k, 1, 27)
            {
                score -= c[k] * (i - (j == k ? i : last[k]));
            }
            // d+k日後までの満足度を計算する.

            if (maxi < score)
            {
                maxi = score;
                dcon = j;
            }
        }
        t[i] = dcon;
        last[dcon] = i;
    }

    rep(i, 1, D + 1)
    {
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t;
  cin >> s >> t;
  for(int i=0;i<s.size();i++){
    if(s.substr(i,s.size())+s.substr(0,i)==t){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n;
    cin >> s;
    for (int i=0; i<s.size(); i++) {
        s[i] = (char)(((s[i]-65+n)%26)+65);
    }
    cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>

int main(void) {
    int n, m;
    std::cin >> n >> m;

    for(int i = 0; i < m; ++i) {
        int input;
        std::cin >> input;
        n -= input;
    }
    if(n < 0) {
        std::cout << -1 << std::endl;
    }
    else
    {
        std::cout << n << std::endl;
    }
    
}

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

const int mod = 1000000007;
struct mint {
    ll x;

    mint(ll 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 {
      mint res(*this);
      return res += a;
    }

    mint operator-(const mint a) const {
      mint res(*this);
      return res -= a;
    }

    mint operator*(const mint a) const {
      mint res(*this);
      return res *= a;
    }

    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t >> 1);
      a *= a;
      if (t & 1) a *= *this;
      return a;
    }

    mint inv() const {
      return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
      return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
      mint res(*this);
      return res /= a;
    }
};

mint table[100010];

void init() {
  table[0] = table[1] = 1;
  for (ll i = 2; i < 100010; i++) {
    table[i] = table[i - 1] * i;
  }
}

mint nCr(int n, int r) {
  if(r > n) return 0;
  return table[n] / table[r] / table[n - r];
}

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

  vector<int> a(n + 1);
  vector<vector<int>> itr(n + 1);
  rep(i, n + 1) {
    cin >> a[i];
    itr[a[i]].push_back(i);
  }

  int left = 0;
  int right = 0;
  for (int i = 0; i < n + 1; i++) {
    if(itr[i].size() > 1) {
      left = itr[i][0];
      right = itr[i][1];
    }
  }

  init();


  int left_sz = left;
  int right_sz = n - right;

  for (int i = 1; i <= n + 1; i++) {
    mint ans = nCr((n + 1), i);
    mint sub = nCr((left_sz + right_sz), (i - 1));
    ans = ans - sub;
    cout << ans.x << '\n';
  }

  return 0;
}


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

int main() {
    int N, D, s;
    s = 0;
    cin >> N >> D;
    int *a, *b;
    a = new int[N];
    b = new int[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
    }
    
    for (int i = 0; i < N; i++) {
        double d = sqrt(fabs(a[i]) * fabs(a[i]) + fabs(b[i]) * fabs(b[i]));
        if (d <= D) {
            s++;
        }
    }
    cout << s;
    delete[] a;
    delete[] b;
    return 0;
}


Measured memory_bytes: 4808
#include<bits/stdc++.h> 
using namespace std;
typedef long long ll;
template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;}
template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;}



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    ll n;
    cin>>n;
    ll ans = 0;
    for(int i=1;i<=n;i++){
        if(i%5 && i%3)ans+=i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3584
#include<iostream>
#include<algorithm>
#include<map>
#include<string>
#include<vector>

using namespace std;

int main()
{
	string str;
	cin >> str;
	vector<char> vec;
	for (int i = 0; i < str.size(); i++)
	{
		vec.push_back(str[i]);
	}
	map<char, int> mp;

	sort(vec.begin(), vec.end());
	for (int i = 0; i < vec.size(); i++)
	{
		auto itr = mp.find(vec[i]);
		if (itr == mp.end())
		{
			mp[vec[i]] = 1;
		}
		else
		{
			//探索してあったらmapに加算
			if (binary_search(vec.begin() + i, vec.end(), vec[i]))
			{
				mp[vec[i]]++;
			}
		}
	}
	int sum = 0;
	for (auto itr : mp)
	{
		sum += itr.second;
	}
	if (sum == 4&& mp.size()==2)
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}


	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

using namespace std;

inline int topbit(unsigned long long x){
	return x?63-__builtin_clzll(x):-1;
}

inline int popcount(unsigned long long x){
	return __builtin_popcountll(x);
}



void solve(){
	int N;
	cin>>N;
	vector<int> A(N);
	rep(i,N)cin>>A[i];

	string S;cin>>S;

	vector<int> T(60); //T[j]:=0がjビット目を0にできるときに使用する数。掃き出し法を用いて整理する。
	for(int i=N-1;i>=0;i--){
		int e=A[i];
		for(int j=59;j>=0;j--){
			if(T[j]==0)continue;
			if((e&T[j])==0)continue;
			if(topbit(e&T[j])==topbit(T[j]))e^=T[j]; //0がA[i]を0にできるかどうかを調べる
		}
		if(S[i]=='1'){
			if(e){
				cout<<1<<endl;
				return;
			}
		}
		else{
			if(e){
				rep(j,60){
					if(T[j]==0)continue;
					if((e&T[j])==0)continue;
					if(topbit(e&T[j])==topbit(e))T[j]^=e;
				}
				T[topbit(e)]=e;
			}
		}
	}
	cout<<0<<endl;
}

signed main(){
	int T;cin>>T;
	while(T--)solve();
	return 0;
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n , k, s= 0;
	cin>>n>>k;
	if(n<k)
	for(int i = 0;i<k;i++)
	{
	    cout<<n;
	}
	else
	for(int i = 0;i<n;i++)
	{
	    cout<<k;
	}
//	cout<<"No";
	
	return 0;
}

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

#define fi first
#define se second
#define endl '\n'
#define lc (rt<<1)
#define rc (rt<<1|1)
#define mp make_pair
#define pb push_back
#define lowbit(a) (a&(-a))
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define mst(a,v) memset(a,v,sizeof(a))
#define debug(x) cout<<#x": "<<x<<'\n';
#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

const int N=1000010;
const int mod=1e9+7;
const ld PI=acos(-1.0);
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;

template<typename T>inline void gmax(T &A,T B) {(A<B)&&(A=B);}
template<typename T>inline void gmin(T &A,T B) {(A>B)&&(A=B);}

template <class T>
inline bool re(T &ret)
{
    char c;
    int sgn;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    ret*=sgn;
    return 1;
}



int main()
{
#ifdef local
    //freopen("in.txt", "r", stdin);
#endif
    IOS;
    int n,ans;
    cin>>n>>ans;
    while(--n)
    {
        int t;
        cin>>t;
        ans=__gcd(ans,t);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = 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;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
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;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int n;cin>>n;
  map<int,int> ma;
  rep(i,0,n){
    int x;cin>>x;
    ma[x]++;
  }
  for(auto&& i:ma){
    if(i.sc>1){
      cout<<"NO"<<ENDL;
      return 0;
    }
  }
  cout<<"YES"<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 9600
/*
* Note: This template uses some c++11 functions , so you have to compile it with c++11 flag.
*       Example:-   $ g++ -std=c++11 c++Template.cpp
*
* Author : Akshay Pratap Singh
* Handle: code_crack_01
*
*/
 
/********   All Required Header Files ********/
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define FOR(i, j, k, in) for(int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for(int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
typedef long long int ll;
typedef unsigned long long int  ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;

int main(){

  int n, k, w;
  SCD(n); SCD(k);
  
  vll ws(n);
  SCD(w);
  ws[0] = w;
  for(int i=1; i<n; ++i){
    SCD(w);
    ws[i]=ws[i-1]+w;
  }


  int ans;
  ll pl=0; ll pr=10000000000;
  while( pr-pl > 1 ){
    ll pm=(pl+pr)/2;

    ll __k = 1;
    ll __w = pm;
    for(int i=1; i<n; ++i){
      if( ws[i]-ws[i-1] > pm ){ __k=k+1; break; }
      if( __w < ws[i] ){
        __k++;
        __w = ws[i-1]+pm;
      }
    }

//    cout << pm << " " << __k << " " << __w << endl;

    if( __k <= k ){ pr = pm; ans = pm; }
    else pl = pm;

  }

  cout << ans << endl;

//  for(int p=ws[0]; ; ++p){
//    int __k = 1;
//    int __w = p;
//    bool isend = true;
//
//    auto itr = upper_bound(ws.begin(), ws.end(), __w);
//    while( itr != ws.end() ){
//      __w = *(itr-1) + p;
//      auto itr_next = upper_bound(ws.begin(), ws.end(), __w);
////      cout << *itr_next << " ";
//      if( itr_next == itr ) { isend = false; break;}
//      itr = itr_next;
//      __k++;
//    }
////    cout << endl;
//
////    cout << p << " " << __k << " " << k << endl;
//    if( isend and __k <= k ) { ans = p; break; }
//  }
//

  return 0;
}



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

int main() {
  int n, m;
  cin>>n>>m;
  int xs[n], ys[m];
  for (int i=0; i<n; i++) cin>>xs[i];
  for (int i=0; i<m; i++) cin>>ys[i];
  long long mod = 1e9 + 7;

  long long sum_x = 0;
  for (int i=0; i<n-1; i++) {
    long long d = xs[i+1] - xs[i];
    sum_x += d * (i+1) * (n-i-1);
    sum_x %= mod;
  }
  long long sum_y = 0;
  for (int i=0; i<m-1; i++) {
    long long d = ys[i+1] - ys[i];
    sum_y += d * (i+1) * (m-i-1);
    sum_y %= mod;
  }
  long long ans = sum_x * sum_y;
  ans %= mod;
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, ll> Pil;

int N, M;

struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) : par(N), rank(N) {
        for(int i = 0; i < N; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void merge(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (rank[rx] < rank[ry]) swap(rx, ry);
        if (rank[rx] == rank[ry]) rank[rx]++;
        par[ry] = rx;
    }

    bool is_same(int x, int y) {
        return root(x) == root(y);
    }
};

int main() {
    cin >> N >> M;
    UnionFind tree(N);
    for (int i = 0; i < M; i++) {
        int A, B;
        cin >> A >> B;
        tree.merge(A-1, B-1);
    }

    map<int, int> mp;
    for (int i = 0; i < N; i++) {
        mp[tree.root(i)]++;
    }

    int ans = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        int val = itr->second;
        ans = max(ans, val);
    }

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


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

int main() {
  double L; cin >> L;
  double l = L / 3;
  double ans = l * l * l;
  cout << setprecision(15) << ans << endl;
  return 0;
}


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

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

  vector<int> k(M);
  vector<vector<int>> s(M);
  vector<int> p(M);

  for(int i = 0; i < M; i++) {
      cin >> k[i];
      for(int j = 0; j < k[i]; j++) {
     int a; cin >> a; a--;
     s[i].push_back(a);
      }
  }

  for(int i = 0; i < M; i++) cin >> p[i];
    ll ans = 0;
  for(int bit = 0; bit < (1 << N); bit++) {
      bool ok = true;
      for(int i = 0; i < M; i++) {
          int sum = 0;
          for(auto v : s[i]) {
              if((1 << v) & bit) sum++;
          }
          if(sum % 2 != p[i]) ok = false;
      }
    if(ok) ans += 1;
  }

  cout << ans;

    return 0;

}

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

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

void solve() {
  int X;
  cin >> X;
  if (X == 1 || X == 2) {
    cout << 2 << endl;
    return;
  }
  X += (X % 2 == 0 ? 1 : 0);
  for (int i = X; i; i += 2) {
    bool flag = true;
    for (int j = 3; j < sqrt(i); j++) {
      if (i % j == 0) {
        flag = false;
      }
    }
    if (flag) {
      cout << i << endl;
      return;
    }
  }
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n;
  cin >> s;
  char current = ' ';
  int ans = 0;
  for(char color: s){
    if(color == current) continue;
    ans++;
    current = color;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    S = input()
    T = input()

    if T.startswith(S):
        print(Yes)
    else:
        print(No)


def main():
    solve()


if __name__ == '__main__':
    main()


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

void func( int x, int y, int z )
{
    if ( x == y )
        cout << z << endl;
}

int main( void )
{
    int a,b,c;
    cin >> a >> b >> c;
    
    func(a,b,c);
    func(b,c,a);
    func(c,a,b);
}


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

int main(){
    int n, min, minj, s = 0;
    cin >> n;
    vector<int> v(n);
    rep(i, n){
        cin >> v.at(i);
    }
    rep(i, n){
        min = v.at(i);
        minj = i;
        repc(j, i+1, n){
            if (v.at(j) < min){
                min = v.at(j);
                minj = j;
            }
        }
        if (i != minj){
            swap(v.at(i), v.at(minj));
            s++;
        }
    }
    repc(i, v.begin(), v.end()){
        cout << (i != v.begin() ? " " : "") << *i;
    }
    cout << endl << s << endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define REP(i, n) for(int i=0; i<n; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

int main(){
    ll n; cin >> n;
    cout << n*(n-1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
nn=n//2
x=[int(i) for i in input().split()]
y=x[:]
x.sort()
 
low_median=x[nn-1]
high_median=x[nn]
 
for i in range(n):
  if y[i]<high_median:
    print(high_median)
  else:
    print(low_median)


Measured memory_bytes: 26016
#include<stdio.h>
int main ()
{
	int N,A[60],B[60],C[60],i,s=0;
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d",&A[i]);
	}
	for(i=0;i<N;i++)
	{
		scanf("%d",&B[i]);
	}
	for(i=0;i<N-1;i++)
	{
		scanf("%d",&C[i]);
		C[N-1]=0;
	}
	for(i=0;i<N;i++)
	{
		if((A[i]-A[i-1])==1 && A[i]!=1)
		{
			s=s+B[A[i]-1]+C[A[i]-2];
		}
		else
		{
			s=s+B[A[i]-1];
		}
		
	}
	printf("%d",s);
	return 0;

	
}

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

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

    int n, k, count = 0;
    cin >> n >> k;
    int a[k][n];
    vector<int> d(k), c(n, 0);
    rep(i, k)
    {
        cin >> d.at(i);
        rep(j, d.at(i))
        {
            cin >> a[i][j];
            rep(l, n)
            {
                if (a[i][j] == l + 1)
                {
                    c.at(l)++;
                }
            }
        }
    }
    rep(i, n)
    {
        if (c.at(i) == 0)
        {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 3584
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int A, B, C, D;

int main()
{
	in >> A >> B >> C >> D;
	out << std::min(A, B) + std::min(C, D) << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    char s[100],t[10];
    int a,i;

    // 整数の入力
    scanf("%s", &s);

    //if (s == u)
    //printf("strcmp%d",strcmp(s,u));
    a = strlen(s);
    for (i=0;i<a;i++)
    {
        s[i] = 'x';
    }
    s[i]='\0';
    

    // 出力
    printf("%s\n",s);
    return 0;
}

Measured memory_bytes: 128
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    s = input().rstrip()
    if len(s)<4:
        print('No')
    else:
        if 'YAKI'==s[:4]:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)

using namespace std;

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
const ll mod = 1e9+7;

template<typename T> ostream& operator << (ostream& os, vector<T> v) {
  for (auto& i : v) os << i << " "; return os; 
}
template<typename T> istream& operator >> (istream& is, vector<T>& v) {
  for (auto& i : v) is >> i; return is;
}
template<typename K, typename V> ostream& operator << (ostream& os, unordered_map<K, V> m) {
  for (auto& i : m) os << i.first << ":" << i.second << endl; return os;
}
template<typename T> inline bool chmin(T& x, T y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template<typename T> inline bool chmax(T& x, T y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}

int N, K;
int H[100010];
int dp[100010];

int main() {
  cin >> N >> K;
  rep(i, 0, N) cin >> H[i];
  rep(i, 0, N) dp[i] = inf;
  dp[0] = 0;
  rep(i, 0, N) {
   rep(k, 1, K+1) {
     chmin(dp[i+k], dp[i] + abs(H[i] - H[i+k]));
   }
  }
  cout << dp[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;
 
int main() {
   ll s; scanf("%lld", &s);
   printf("0 0 1000000000 1 %lld %lld", (int) 1e9 - 1 - (s - 1) % (int) 1e9, (s - 1) / (int) 1e9 + 1);
   return 0;
}

Measured memory_bytes: 256
/*
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
*/

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//const ll INF = ll(2)*ll(1e31) - ll(1);

struct SegTree{
    const ll INF = ll(pow(ll(2),ll(31))) - ll(1);
    //const ll INF=50;
    vector<ll> data;
    int data_num;
    SegTree(int n): data(){
        data_num=1;
        while(n!=0){
            n = n/2;
            data_num*=2;
        }
        data_num*=2;
        data_num--;
        rep(i,data_num) data.push_back(INF); 
    }

    void update(int i, ll x){
        i = (data_num+1)/2 -1 + i;
        data[i] = x;

        while(i>0){
            i = (i-1)/2;
            data[i]=min(data[i*2+1],data[i*2+2]);
        }
    }

    ll find(int s, int t){
        ll res = INF;
        s=(data_num+1)/2 -1 + s; t=(data_num+1)/2 -1 + t;
        res = min(res,data[s]); res = min(res,data[t]);
        while(t-s>1){
            s++; t--;
            t=(t-1)/2; s=(s-1)/2;
            res = min(res,data[s]); res = min(res,data[t]);
        }
        //cout << "min " << res << endl;
        return res;
    }

    void show(){
        //cout << "num " << data_num << endl;
        int layer=1;
        rep(i,data_num) {
            if(layer-1==i){
                layer*=2;
                cout << endl;
            }
            cout << data[i] << " ";
        }
        cout << endl;
    }

    void show_one(int k){
        cout << data[(data_num+1)/2 - 1 + k] << endl;
    }
};


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

    SegTree st(n);

    vector<ll> ans;

    rep(i,q){
        int com;
        //cout << "pleas enter" << endl;
        cin >> com;
        if(com==0){
            //cout << "update" << endl;
            int x;ll y;
            cin >> x >> y;
            st.update(x,y);
        }
        if(com==1){
            //cout << "find" << endl;
            int x,y;
            cin >> x >> y;
            ll temp;
            temp = st.find(x,y);
            ans.push_back(temp);
        }
        //st.show();
    }

    for(auto a:ans) cout << a << endl;

}


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

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

    int need_left = 0;
    int pointer = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if(S[i] == '(') ++pointer;
        else
        {
            if(pointer == 0) ++need_left;
            else --pointer;
        }
    }

    int need_right = pointer;

    string res = "";
    for (int i = 0; i < need_left; i++)
    {
        res += '(';
    }
    res += S;
    for (int i = 0; i < need_right; i++)
    {
        res += ')';
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
	int A, B, C, D = 0;
	std::cin >> A >> B >> C >> D;

	bool isTakahashiAttack = true;

	while (A > 0 && C > 0)
	{
		if (isTakahashiAttack)
		{
			C -= B;
		}
		else
		{
			A -= D;
		}

		isTakahashiAttack = !isTakahashiAttack;
	}

	if (A <= 0)
	{
		std::cout << "No\n";
	}
	else if (C <= 0)
	{
		std::cout << "Yes\n";
	}

	return 0;
}

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

int gcd(int x, int y) {
	if(y==0) return x;
	return gcd(y, x%y);
}

int main() {
	int x,y;
	cin >> x >> y;

	cout << gcd(x,y) << endl;
}
	



Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
long long ar [110000];
 
int main ()
{
int n,w;
int wi,vi;
cin >>n>>w;
int i,j;
for (i = 1 ;i <= n;i++)
{
cin >>wi>>vi;
for (j = w - wi;j >= 0;j --)
{
ar [j + wi] = max (ar[j + wi] , ar [j] + vi);
}
}
long long t ;
t = 0;
for (i = 0 ; i <= w;i ++)
{
t = max (t , ar [i]);
}
cout <<t<<'\n';
 
}


Measured memory_bytes: 4368
#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9+7;
typedef long long int lli;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<lli> vlli;
typedef vector<bool> vb;
long long int max(long long int a,long long int b){
  if(a>b)
    return a;
  else
    return b;
}
long long int min(long long int a,long long int b){
  if(a<b)
    return a;
  else
    return b;
}
long long int binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)
      res = res * a % m;
      a = a * a % m;
      b >>= 1;
    }
  return res;
}
long long binpow(long long a, long long b) {
    if (b == 0)
        return 1;
    long long res = binpow(a, b / 2);
    if (b % 2)
        return res * res * a;
    else
        return res * res;
}

lli mul(lli a,lli b){
  return (a%mod * b%mod)%mod;
}

lli add(lli a,lli b){
  return (a%mod + b%mod)%mod;
}

lli sub(lli a,lli b){
  return (a%mod-b%mod+mod)%mod;
}
 
//############################ENDOFTEMPLATE############################



void solve(){
  int n;
  cin>>n;

  vlli a(n);

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

  lli ans = 0;

  for(int i = 0;i<60;i++){
    lli on = 0, of = 0;
    for(int j = 0;j<n;j++){
      if((a[j]&binpow(2,i))==0)
        of++;
      else
        on++;
    }
    //cout<<i<<" "<<on<<" "<<of<<" "<<on*of*binpow(2,i)<<endl;
    ans = (ans%mod + (((on%mod*of%mod)%mod)*binpow(2,i,mod))%mod)%mod;
  }

  cout<<ans;
}

 
 
 
 
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  int t = 1;
  //cin>>t;
  while(t--){
    solve();
  }
}

Measured memory_bytes: 5516
def read_input():
    x, a, b = map(int, input().split())
    return x, a, b

def submit():
    x, a, b = read_input()

    if b <= a:
        print('delicious')
    elif b <= x + a:
        print('safe')
    else:
        print('dangerous')



if __name__ == '__main__':
    submit()

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

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


	int ans = 10000, tmp = 0;;
	for (int i = 0;i < s.length()-t.length()+1;i++) {
		for (int j = 0;j < t.length();j++) {
			if (s[i + j] != t[j]) tmp++;
		}
		ans = min(ans, tmp);
		tmp = 0;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main(){
    int a, b, c, d, taka=0;
    cin >> a >> b >> c;
    d=a+b;
    if(d>=c-1){
        taka = c+b;
    }
    else{
        taka = d+b+1;
    }
    cout << taka << endl;
    return 0;
}

Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n){
    for(int i = 0; i <= 50000; ++i){
        if(int(i * 1.08) == n){
            cout << i << endl;
            return;
        }
    }
    cout << ":(\n";
}


signed main(){
    long long N;
    cin >> N;
    solve(N);
    return 0;
}


Measured memory_bytes: 256
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 998244353;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << "\n"

using mint = modint998244353;

typedef struct {
    mint val;
    mint len;
} S;

using F = int;
ll ID = 0;
ll ten[200010] = {};
mint m9 = mint(9).inv();


S op(S a, S b){
    return {a.val * b.len + b.val, a.len * b.len};
}

S e(){
    return {0,1};
}

S mapping(F f, S x){
    if(f == ID){
        return x;
    }else{
        return {f * (x.len-1) * m9, x.len};
    }
}


F composition(F f, F g){
    if(f == ID){
        return g;
    }else{
        return f;
    }
}

F id(){
    return ID;
}

void solve(){
    int N,Q;
    cin >> N >> Q;
    vector<S> v(N);
    rep(i,0,N){
        v[i] = {1, 10};
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> sg(v);
    while(Q--){
        int l,r,d;
        cin >> l >> r >> d;
        l--; r--;
        sg.apply(l, r+1, d);
        print(sg.all_prod().val.val());
    }

}

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

    solve();
}

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

int main() {
	int X, A, B;
	cin >> X >> A >> B;
	cout << (X - A) % B;
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、ケーキを買った後の持ち金はX-A円
このお金でドーナツをできるだけ買った時のおつり(→余り)が知りたいので、
(X-A)をBで割った余りを表示すれば良い
*/

Measured memory_bytes: 256
n,x,y = map(int,input().split())
ans_ls = [0] * (n-1)
for start in range(1,n):
    for end in range(start+1,n+1):
        cost_1 = end - start
        cost_2 = abs(start - x) + abs(end - y) + 1
        cost = min(cost_1,cost_2)
        ans_ls[cost-1] += 1
for ans in ans_ls:
    print(ans)



Measured memory_bytes: 9236
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}


int main(void){
  ll m;cin>>m;
  vector<ll> D,C;
  ll sum = 0,sum_c = 0;
  rep(i,m){
    ll d,c;
    cin>>d>>c;
    D.push_back(d);
    C.push_back(c);
    sum += d*c;
    sum_c += c;
  }
  ll ans = 0;
  ans += sum_c - 1;

  while(sum/10 > 0){
    ans += sum/10;
    sum = sum/10 + sum%10;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>

int main(){
    int n,m,max,min,a,b;
    scanf("%d %d",&n,&m);
    min=0;
    max=100000;
    for(int i=0;i<m;i++){
        scanf("%d %d",&a,&b);
        if(a>min){
            min=a;
        }
        if(b<max){
            max=b;
        }
        if(min>max){
            break;
        }
    }
    if(min>max){
        printf("0\n");
    }
    else{
        printf("%d\n",max-min+1);
    }
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int m = sc.nextInt();
		int maxLeft = Integer.MIN_VALUE;
		int minRight = Integer.MAX_VALUE;
		
		for (int i = 0; i < m; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			maxLeft = Math.max(maxLeft, l);
			minRight = Math.min(minRight, r);
		}
		
		if (minRight - maxLeft + 1 >= 0) {
			System.out.println(minRight - maxLeft + 1);
		} else {
			System.out.println("0");
		}
		
	}
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


Measured memory_bytes: 41000
def main():
    n, k = [int(x) for x in input().split()]
    scores = [int(x) for x in input().split()]

    for index in range(n - k):
        if scores[index] < scores[index + k]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 31728
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;


int main(){

	int N;
	int a = 0;
	int b = 0;
	int bl = 0;
	int wh = 0;
	int MIN = 0;


	string S;
	cin >> N >> S;

	for (int i = 0; i < N; i++){
		if (S[i] == '.') wh++;
	}
	MIN = wh + bl;
	for (int i = 0; i < N; i++){
		
		if (S[i] == '.'){
			bl--;
		}
		else wh++;
		if (MIN > wh + bl)	MIN = wh + bl;
	}
	cout << MIN << endl;


	return 0;
}


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

int main(){
  int N;
  cin >> N;
  int n = N / 1000;
  if (N % 1000 != 0) n++;
  cout << 1000*(n) - N << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main()
{
	char s[11], i;
	int dp[11], max = 0;
	scanf("%s", s);
	for (i = 0; i <= 10; i++)
		dp[i] = 0;
	if (s[0] == 'A' || s[0] == 'C' || s[0] == 'T' || s[0] == 'G')
		dp[0] = 1;
	for (i = 1; s[i] != 0; i++) {
		if (s[i] == 'A' || s[i] == 'C' || s[i] == 'T' || s[i] == 'G')
			dp[i] = dp[i - 1] + 1;
	}
	for (i = 0; s[i] != 0; i++)
		if (dp[i] > max)
			max = dp[i];
	printf("%d\n", max);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
    string s;
    cin >> s;
    int N = s.length();

    int count_p = 0;
    int count_g = 0;
    int count_win = 0;
    int count_lose = 0;

    for(int i=0;i<N;i++){
        if(s[i] == 'p'){
            if(count_p < count_g){
                // pを出して引き分けにする
                count_p++;
            }else{
                // p出せないので負ける
                count_g++;
                count_lose++;
            }
        }else if(s[i] == 'g'){
            if(count_p < count_g){
                // pを出して勝つ
                count_p++;
                count_win++;
            }else{
                // gを出して引き分け
                count_g++;
            }
        }
    }
    cout << count_win - count_lose << endl;
    return 0;
}

Measured memory_bytes: 512
upp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
low = "abcdefghijklmnopqrstuvwxyz"

while 1:
	a,type = raw_input().split()
	if type == "X": break
	ans = ""
	if type == "U":
		if "_" in a:
			words = a.split("_")
			for word in words:
				ans += upp[low.index(word[0])] + word[1:]
		else:
			ans = upp[low.index(a[0])] + a[1:] if a[0] in low else a
	elif type == "L":
		if "_" in a:
			words = a.split("_")
			ans += words[0]
			for word in words[1:]:
				ans += upp[low.index(word[0])] + word[1:]
		else:
			ans = low[upp.index(a[0])] + a[1:] if a[0] in upp else a
	else:
		if "_" not in a:
			words = []
			sp = 0
			for i in range(1,len(a)):
				if a[i] in upp:
					words.append(a[sp:i].lower())
					sp = i
			words.append(a[sp:].lower())
			ans = "_".join(words)
		else:
			ans = a
	print ans

Measured memory_bytes: 4280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    vector<int> a;
    int cnt = 0;
    char pre = 'R';
    char c;
    while(cin >> c){
        if(pre==c){
            cnt++;
        }else{
            a.push_back(cnt);
            cnt = 1;
        }
        pre = c;
    }
    a.push_back(cnt);
    for(int i = 0 ; i < a.size() ; i+=2){
        rep(j, a[i]-1){
            cout << 0 << " ";
        }
        int l = a[i]/2+(a[i]%2)+a[i+1]/2;
        int r = a[i+1]/2+(a[i+1]%2)+a[i]/2;
        cout << l << " " << r << " ";
        rep(j, a[i+1]-1){
            cout << 0 << " ";
        }
    }
}

Measured memory_bytes: 892
#include <stdio.h>
 
int main(void) {
    int W, H, x, y, r;
    scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
    if((x-r)<0 || (x+r)>W || (y-r)<0 || (y+r)>H) {
    printf("No\n");
  } else {
    printf("Yes\n"); 
  }
}



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

using namespace std;

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

  int count = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S - (x + y);

      if (x + y <= S && z <= K) {
        count++;
      }
    }
  }

  cout << count << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>

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

#define INF 1000000000

using namespace std;

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

    vector<int> H(N);

    REP(i, N)
    cin >> H[i];

    int current_max = H[0];
    int ok = 1;
    REP(i, N - 1) {
        if (current_max <= H[i + 1]) {
            current_max = H[i + 1];
            ok++;
        }
    }

    cout << ok << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
using ll = long long;
const int N = 2e6 + 15;
int main(){
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans = 0;
	ans += min(a, k);
	k -= min(a, k);
	if (k > 0) {
		k -= min(b, k);
	}
	if (k > 0) {
		ans -= min(c, k);
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3636
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int m = sc.nextInt();
            int f = sc.nextInt();
            int r = sc.nextInt();
            if (m == -1 && f == -1 && r == -1)
                break;
            else if (m == -1 || f == -1) System.out.println("F");
            else if (m + f >= 80) System.out.println("A");
            else if (m + f >= 65 && m + f < 80) System.out.println("B");
            else if ((m + f >= 50) && (m + f < 65) || (r >= 50)) System.out.println("C");
            else if (m + f >= 30 && m + f < 50) System.out.println("D");
            else if (m + f < 30) System.out.println("F");
        }
        }
    }


Measured memory_bytes: 26164
n,m = map(int,input().split())
War = [list(map(int,input().split())) for i in range(m)]
War = sorted(War, key=lambda x:x[1])
count = 0
bridge = 0
for war in War:
  if bridge <= war[0]:
    bridge = war[1]
    count += 1
  else:
    continue
print(count)

Measured memory_bytes: 29852