akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <bitset>
#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	int n;
	string s;
	cin >> n >> s;
	int res = 0;
	for (int i = 0; i + 2 < s.size(); i++) {
		if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
			res++;
	}
	cout << res << endl;
}









Measured memory_bytes: 256
#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>
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()

int main(void){
	int n;
	int h,h2;
	cin>>n;
	h = 0;
	int ans = 0;
	rep(i,n){
		cin>>h2;
		if(h2>=h){
			ans++;
			h = h2;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 636
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF 1145141919364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}

int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}

int mod_pow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}

int n, k, q, a[100000];
int cnt[100010];

signed main() {
	cin >> n >> k >> q;
	for (int i = 0; i < q; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (int i = 1; i <= n; i++) {
		if (k - (q - cnt[i]) > 0)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

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

using namespace std;

int main() {
  char map[3][3];
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> map[i][j];
    }
  }

  for (int i = 0; i < 3; i++) {
    if (map[0][i] != map[1][2 - i]) {
      cout << "NO" << endl;
      return 0;
    }
  }

  cout << "YES" << endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

typedef pair<P,ll> PP;

ll table[1001][1001];
ll h,w;
string s[1001];
ll dx[] = {0,1,0,-1};
ll dy[] = {1,0,-1,0};
vector<P> vp;


void solve(){
	queue<PP> que;
	rep(i,vp.size()){
		ll y = vp[i].first;
		ll x = vp[i].second;
		que.push(PP(P(y,x),0));
	}
	while(que.size()){
		PP p = que.front();
		que.pop();
		int cy = p.first.first;
		int cx = p.first.second;
		if(p.second >= table[cy][cx])continue;
		table[cy][cx] = p.second;
		rep(i,4){
			int nx = cx+dx[i];
			int ny = cy+dy[i];
			if(nx < 0 || nx >= w || ny < 0 || ny >= h)continue;
			que.push(PP(P(ny,nx),p.second + 1));
		}
	}

}

int main(){
	// rep(i,1000){
	// 	rep(j,1000){
	// 		if((i+j)%2)cout << "#";
	// 		else cout << ".";
	// 	}
	// 	cout << endl;
	// }
	// return 0;
	cin >> h >> w;
	rep(i,h)cin >> s[i];
	rep(i,h)rep(j,w)table[i][j] = INF;
	rep(i,h){
		rep(j,w){
			if(s[i][j] == '#')vp.push_back(P(i,j));
		}
	}
	// rep(i,h){
	// 	rep(j,w)cout << table[i][j];
	// 	cout << endl;
	// }
	solve();

	ll ans = 0;
	rep(i,h){
		rep(j,w)ans = max(ans,table[i][j]);
	}
	cout << ans << endl;

}

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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
template<class T> lint gcd(T a, T b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T> lint lcm(T a, T b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
#define pi acos(-1)
#define mod 1000000007
#define MOD 998244353
#define inf ((1LL << 62) - 1 + (1LL << 62))

// キーワード //
#define elif else if

// End of Template //



int main() {

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

    int N, M, hyou = 0;
    cin >> N >> M;
    vi shouhin(N);
    int k;
    rep(i, N) {
        cin >> k;
        shouhin[i] = k;
        hyou += k;
    }
    sort(shouhin);
    reverse(all(shouhin));
    bool flag = false;
    rep(i, M) {
        if ((double)shouhin[i] / (double)hyou < 1.0/((4.0)*(double)M)) {
            flag = true;
            break;
        }
    }
    flag ? n() : y();

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define m 998244353
using namespace std;
typedef long long int ll;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    int k;
    cin>>k;
    string s="ACL";
    for(int i=1; i<=k; i++)  cout<<s;
    cout<<endl;
    
    
   return 0;
}

Measured memory_bytes: 3640
import sys

MOD = 10 ** 9 + 7

def make_power_2_table(n=10**6, mod=MOD):
    power = [None] * (n + 1)
    power[0] = 1
    for i in range(n):
        power[i+1] = power[i] * 2 % mod
    return power

power_2 = make_power_2_table(2*10**5)
inv_2 = pow(2, MOD-2, MOD)

n, *c = map(int, sys.stdin.read().split())
c.sort()

def main():
    r_diffs = (power_2[n] + power_2[n] * n % MOD * inv_2 % MOD) % MOD
    res = 0
    for i in range(n):
        r_diffs = (r_diffs - power_2[n-i-1]) % MOD * inv_2 % MOD
        l_comb = power_2[i]
        res += c[i] * l_comb % MOD * r_diffs % MOD
        res %= MOD

    return res * power_2[n] % MOD

if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 33100
#include <bits/stdc++.h>
 #define ll long long
#define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define test int t; cin >> t; while(t--)
 #define inp(n) int n;cin >> n;
 #define mp make_pair
 #define pb push_back
 #define forl(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second

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

 int32_t main()
{
     fast;
    
//    test
//    {
//       
//    }
    string a;cin>>a;
    ll ans=1;ll i;
    for(i=1;i<a.length();i++)
    {
        
     if(a[i]==a[i-1])
     {
         if(i<a.length()-2){ i+=2;ans+=2;}
        else break;
     }
     else ans++;
    }
    if(i==a.length()-2)
    {
        ans++;
    }
    cout<<ans<<endl;
    return 0;
 }
  














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

#define debug(x) cout << '[' << #x << " is: " << x << "] " <<"\n";
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;

using namespace std;

int main()
{
	FAST;
/*
    char a;
    cin >> a;
    cout << char(a + 1) <<endl;


    int n,k,m;
    cin >> n >>  k >> m;

    double sum = 0;
    for(int i = 0 ; i < n-1 ; i++){
        int in;
        cin >> in;
        sum+=in;
    }

    for (int i  = 0 ; i <= k ; i++){
        double ans = (sum + i)/n;
        if (ans >= m){cout << i <<endl;return 0;}
    }

    cout << -1 <<endl;
    */

    int n,m;
    cin >> n >> m;
    map<int,int> sub;
    map<int,bool> accpted;

    int accptedd = 0;
    int p = 0;

    for (int i = 0 ; i < m ; i++){
        int pro;
        string res;
        cin >> pro >> res;
        if (accpted[pro])continue;
        if (res == "WA")sub[pro]++;
        else {
            accptedd++;
            accpted[pro] = true;
            p += sub[pro];
        }
    }

    cout << accptedd << " " << p <<endl;


	return 0;
}


Measured memory_bytes: 9600
using System;
 
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    int n =int.Parse(Console.ReadLine());
    if(n%2==0){
      Console.WriteLine(n/2);
      }else{
      Console.WriteLine(n/2+1);
    }
    }
    
  }

}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define maxn 200005
using namespace std;
struct Node{
    int to,next,val,col;
}q[maxn<<1];
struct Query{
    int id,col,dis,tag;
    Query(){}
    Query(int _id,int _col,int _dis,int _tag){
        id=_id,col=_col,dis=_dis,tag=_tag;
    }
};
vector<Query>vec[maxn];
int head[maxn],cnt=0;
void add_edge(int from,int to,int col,int val){
    q[cnt].to=to;
    q[cnt].val=val;
    q[cnt].next=head[from];
    q[cnt].col=col;
    head[from]=cnt++;
}
struct LCA{
#define LOG 20
    int ST[maxn<<1][LOG];
    int val[maxn],depth[maxn<<1],first[maxn],len;
    int cal(int x,int y){
        return depth[x]<depth[y]?x:y;
    }
    void dfs(int x,int fa,int dis){
        val[++len]=x,depth[len]=dis;
        first[x]=len;
        for(int i=head[x];i!=-1;i=q[i].next){
            int to=q[i].to;
            if(to==fa) continue;
            dfs(to,x,dis+1);
            val[++len]=x;
            depth[len]=dis;
        }
    }
    void init(int root){
        len=0;
        dfs(root,-1,1);
        for(int i=1;i<=len;i++) ST[i][0]=i;
        for(int j=1;(1<<j)<=len;j++){
            for(int i=1;i+(1<<j)-1<=len;i++){
                ST[i][j]=cal(ST[i][j-1],ST[i+(1<<(j-1))][j-1]);
            }
        }
    }
    int query(int x,int y){
        int l=first[x],r=first[y];
        if(l>r) swap(l,r);
        int k=log2(r-l+1);
        return val[cal(ST[l][k],ST[r-(1<<k)+1][k])];
    }
}lca;
int res[maxn],dis[maxn],Cnt[maxn];
void dfs(int x,int fa,int d){
    for(auto it:vec[x]){
        res[it.id]+=it.tag*(d-dis[it.col]+Cnt[it.col]*it.dis);
    }
    for(int i=head[x];i!=-1;i=q[i].next){
        int to=q[i].to;
        if(to==fa) continue;
        Cnt[q[i].col]++;dis[q[i].col]+=q[i].val;
        dfs(to,x,q[i].val+d);
        Cnt[q[i].col]--,dis[q[i].col]-=q[i].val;
    }
}
int main()
{
    int n,Q;
    memset(head,-1,sizeof(head));
    cnt=0;
    scanf("%d%d",&n,&Q);
    for(int i=1;i<n;i++){
        int from,to,cal,val;
        scanf("%d%d%d%d",&from,&to,&cal,&val);
        add_edge(from,to,cal,val);
        add_edge(to,from,cal,val);
    }
    lca.init(1);
    for(int i=1;i<=Q;i++){
        int cal,dis,from,to;
        scanf("%d%d%d%d",&cal,&dis,&from,&to);
        vec[from].push_back(Query(i,cal,dis,1));
        vec[to].push_back(Query(i,cal,dis,1));
        int LCA=lca.query(from,to);
        vec[LCA].push_back(Query(i,cal,dis,-2));
    }
    dfs(1,0,0);
    for(int i=1;i<=Q;i++){
        printf("%d\n",res[i]);
    }
    return 0;
}

Measured memory_bytes: 43380
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>

const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<endl;}return os;}

namespace ndifix{
template<class T>void sort(T &v){std::sort(v.begin(),v.end());}
template<class T>void rsort(T &v){std::sort(v.rbegin(),v.rend());}

}

int main(){
  int x,a;cin>>x>>a;
  cout<<(x<a?0:10)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  if(k>=s.size()) {
    cout << s << endl;
    return 0;
  }

  cout << s.substr(0,k) << "..." << endl;

  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  if(N % 10 == 3) cout << "bon";
  else if(N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8) cout << "pon";
  else cout << "hon";
  return 0;
}

Measured memory_bytes: 3572
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a,b,t[4],ta,ans;
	while(cin>>a>>b,a){
		ans=1<<30;
		for(int a0=1;a0*a0<=a;a0++)if(a%a0==0)
		for(int b0=1;b0*b0<=b;b0++)if(b%b0==0){
			t[0]=a0,t[1]=a/a0,t[2]=b0,t[3]=b/b0;
			sort(t,t+4);
			ta=0; for(int i=0;i<3;i++)ta+=(t[i]-t[i+1])*(t[i]-t[i+1]);
			if(ta<ans)ans=ta;
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    int a, b;
    cin >> a >> b;
    
    cout << a * b << endl;

    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
 
using namespace std;
 
#define int unsigned long long
#define M 1000000007
 
int gcd(int a,int b){
	if(b==0){
		return(a);
	}
	return(gcd(b,a%b));
} 
 
signed main(){
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	
	int n;
	cin >> n;
	int d=10;
	int ans=0;
	if(n%2!=0){
		cout << 0 << endl;
		exit(0);
	}
	while(d<=n){
		ans+=(n/d);
		d*=5;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3616
n, k = gets.chomp.split(" ").map(&:to_i)
h = []
ans = 1 << 30
n.times do
    h << gets.chomp.to_i
end
h.sort!
(n-k+1).times do |i|
    ans = [ans, h[i+k-1]-h[i]].min
end
puts ans

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

int main(){
	int N, K; cin >> N >> K;
	priority_queue<pair<int, int>> dt, mdt;

	for(int i=0; i<N; ++i){
		int t, d; cin >> t >> d;
		dt.push(make_pair(d, t));
	}

	vector<long long> sums(K+1, -1);
	long long sum = 0;
	map<int, int> kind;
	for(int i=0; i<K; ++i){
		int d = dt.top().first, t = dt.top().second;
		dt.pop();
		mdt.push(make_pair(-d, t));
		++kind[t];
		sum += d;
	}
	sums[kind.size()] = sum + kind.size()*kind.size();
	// cout << kind.size() << " : " << sum << " "<< sums[kind.size()] << endl;

	for(int i=kind.size()+1; i<=K; ++i){
		bool f = true;
		while(f){
			vector<pair<int, int>> mem;
			auto top = mdt.top(); mdt.pop();

			if(kind[top.second] > 1){
				--kind[top.second];
				dt.push(top);
				for(auto work : mem){
					mdt.push(work);
				}
				sum += top.first;
				break;
			}else{
				mem.push_back(top);
			}
			if(mdt.empty()) f = false;
		}
		while(f){
			vector<pair<int, int>> mem;
			auto top = dt.top(); dt.pop();

			if(kind.find(top.second) == kind.end()){
				++kind[top.second];
				mdt.push(top);
				for(auto work : mem){
					dt.push(work);
				}
				sum += top.first;
				break;
			}else{
				mem.push_back(top);
			}
			if(dt.empty()) f = false;
		}
		if(!f) break;
		sums[i] = sum + kind.size()*kind.size();
		// cout << kind.size() << " : " << sum << " "<< sums[kind.size()] << endl;
	}

	sort(sums.begin(), sums.end(), greater<long long>());
	cout << sums[0] << endl;
}


Measured memory_bytes: 5492
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
  }
 	
void solve() {
   int d,t,s;
   cin>>d>>t>>s;
   double rt=(double)d/s;
   if(rt<=t) cout<<"Yes\n";
   else cout<<"No\n";	                          
}

    
int32_t main() {
	cool;
	int t=1;	
   
	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 3624
import sys
import Queue

sys.setrecursionlimit(1000000)

def s(m, h, w, d, q):
    if q.empty(): return d[h - 1][w - 1]
    k, i, j = q.get()
    if i > 0 and m[i - 1][j] == '.' and k + 1 < d[i - 1][j]:
        d[i - 1][j] = k + 1
        q.put((k + 1, i - 1, j))
    if i < h - 1 and m[i + 1][j] == '.' and k + 1 < d[i + 1][j]:
        d[i + 1][j] = k + 1
        q.put((k + 1, i + 1, j))
    if j > 0 and m[i][j - 1] == '.' and k + 1 < d[i][j - 1]:
        d[i][j - 1] = k + 1
        q.put((k + 1, i, j - 1))
    if j < w - 1 and m[i][j + 1] == '.' and k + 1 < d[i][j + 1]:
        d[i][j + 1] = k + 1
        q.put((k + 1, i, j + 1))
    return s(m, h, w, d, q)

h, w = map(int, raw_input().split())
m = [raw_input()[:w] for _ in range(h)]
q = Queue.PriorityQueue()
d = [None] * h
for i in range(h):
    d[i] = [1000000] * w
d[0][0] = 1
for i in range(h):
    for j in range(w):
        if m[i][j] == '.':
            q.put((d[i][j], i, j))
c = s(m, h, w, d, q)
if c == 1000000: print -1
else:
    a = 0
    for row in m:
        a += row.count('#')
    print h * w - c - a


Measured memory_bytes: 7660
n=int(input())
p_list=list(map(int,input().split()))
count=0
for i in range(1,n-1):
    if p_list[i-1]<p_list[i]<p_list[i+1] or p_list[i+1]<p_list[i]<p_list[i-1]:
        count+=1
print(count)


Measured memory_bytes: 39888
#include <iostream>

using namespace std;

int main() {
string s;
cin>>s;
if(s=="Sunny"){
    cout<<"Cloudy";
}else if (s=="Cloudy"){
    cout<<"Rainy";
}else if(s=="Rainy"){
    cout<<"Sunny";
}else {
    cout<<"Invalid String";
}
}

Measured memory_bytes: 256
//Code By PMD
#include<bits/stdc++.h>
#define faster() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long i64;
int r;
void input(){
    cin >> r;
}
void solve(){
    cout << r*r;
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    faster();int t=1; 
    //cin>>t; cin.ignore();
    while(t--){ input();solve();}
    cerr << "\nRunning is : " << 1.0*clock()/1000 ;
    return 0;
}
//Code By PMD
 

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

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

    long long sum=0;
    for(int i=0; i<str.size(); i++)
        sum+=(str[i]-'0');
    if(sum%9==0)
        cout << "Yes\n";
    else
        cout << "No\n";
}


Measured memory_bytes: 3768
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    // read input
    int N, M;
    cin >> N >> M;
    vector<int> edge[N];
    rep(i, 0, M)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    // initial setting
    vector<int> path(N);
    vector<bool> visited(N, false);
    int left = 0;
    int right = edge[left][0];
    path[left] = right;
    visited[left] = visited[right] = true;

    // expand left
    for(;;)
    {
        // check state
        bool is_ok = true;
        for (auto next: edge[left])
        {
            if (visited[next]) continue;
            is_ok = false;

            // move to next
            path[next] = left;
            visited[next] = true;
            left = next;
            break;
        }

        if (is_ok) break;
    }

    // expand right
    for (;;)
    {
        bool is_ok = true;
        for (auto next: edge[right])
        {
            if (visited[next]) continue;
            is_ok = false;

            // move to next
            path[right] = next;
            visited[next] = true;
            right = next;
            break;
        }
        if (is_ok) break;
    }

    // make final answer
    int now = left;
    vector<int> res;
    while (now!= right)
    {
        // increment node number
        res.push_back(now+1);
        // move to next 
        now = path[now];
    }
    res.push_back(now+1);

    cout << res.size() << endl;
    for (auto r: res)
        cout << r << ' ';
    cout << endl;
    return 0;
}


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

int main(){
    int X,N;
    cin>>X>>N;
    vector<int>p(N);
    for(int i=0;i<N;i++)cin>>p[i];
    set<int>S;
    for(int i=0;i<N;i++){
        S.insert(p[i]);
}

int a=1000;
int b=1000;
int i=0;
int j=0;
while(1){
    if(S.count(X-i))i++;
    else {a=X-i;break;}
    }

while(1){
    if(S.count(X+j))j++;
    else {b=X+j;break;}
}
if(a!=1000&&b!=1000){
    if(X-a==b-X)cout<<a;
    if(X-a!=b-X){
        int q=min(abs(a-X),abs(b-X));
    if(q==X-a)cout<<a;
    else if(q==b-X)cout<<b;
}}
if(a!=1000&&b==1000){cout<<a;}
if(b!=1000&&a==1000){cout<<b;}
return 0;
}

Measured memory_bytes: 3196
#include <stdio.h>
 
int main() {
   
    long long n, a, b;
    
    scanf("%lld%lld%lld", &n, &a, &b);
    
    long long total = 0, resposta = 0;
    
    long long ciclosCompletos = n / (a+b);
    resposta = ciclosCompletos * a;
    long long sobra = n % (a+b);
    
    if (sobra <= a) 
        resposta += sobra;
    else
        resposta += a;
    
    printf("%lld\n", resposta);
    
 
    return 0;
}

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

int main(){
  
  int N,Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  
  vector<int> memo(N-1);
  
  int ans = 0;
  
  for(int i=0;i<N-1;i++){
    string part = S.substr(i,2);
    //cout << part << endl;
    if(part=="AC") ans++;
    memo[i] = ans;
  }
  
  //for(int i=0;i<N-1;i++){
  //  cout << memo[i] << " ";
  //}
  //cout << endl;
  
  for (int i=0;i<Q;i++){
    int l,r;
    cin >> l >> r;
    cout << memo[r-2]-memo[l-2] << endl;
  }
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<vector<int>> open(N,vector<int>(10));
  for(int i=0; i<N; i++){
    for(int j=0; j<10; j++){ 
      int a;
      cin >> a;
      open[i][j]=a;
    }
  }
  vector<vector<long long>> pro(N,vector<long long>(11));
  for(int i=0; i<N; i++){
    for(int j=0; j<11; j++){ 
      long long a;
      cin >> a;
      pro[i][j]=a;
    }
  }
  long long ans=-1e9;
  for(int i=1; i<(1<<10); i++){
    vector<int> F(N,0);
    for(int j=0; j<10; j++){
      if(i>>j &1){
        for(int k=0; k<N; k++){
          if(open[k][j]==1) F[k]++;
        }
      }
    }
    long long temp=0;
    for(int k=0; k<N; k++){
      temp+=pro[k][F[k]];
    }
    ans=max(ans, temp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int N = 1e4 + 10;
int ret[N];

int sqr(int x) {
  return x * x;
}

int main() {
  for (int x = 1; x <= 100; ++x) {
    for (int y = 1; y <= 100; ++y) {
      for (int z = 1; z <= 100; ++z) {
        int cur = sqr(x) + sqr(y) + sqr(z) + x * y + x * z + y * z;
        if (cur < N) ret[cur]++;
      }
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cout << ret[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 3236
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string a, b;
    cin >> a >> b;

    if (a < b || a.size() < b.size())
        cout << "LESS" << endl;
    else if (a > b || a.size() > b.size())
        cout << "GREATER" << endl;
    else
        cout << "EQUAL" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
#include <vector>
#include <algorithm>
#include <map>
typedef long long ll;
#include <cmath>
#include <iomanip>

const int MOD = 1000000007;


ll POWER(ll x,ll y)
{
	ll ret=1;
	ll p=x;
	for (ll i=y;i>0;i/=2)
	{
		if (i%2) ret=(ret*p)%MOD;
		p=(p*p)%MOD;
	}
	return ret;
}
ll gcm(ll a, ll b)
{
	if (b>a) {ll c=a; a=b; b=c;}
	while (b>0)
	{
		ll r=a%b;
		a=b;
		b=r;
	}
	return a;
}


int main(int argc, char *argv[])
{
	string s;
	cin>>s;
	cout<<((s=="ABC") ? "ARC":"ABC")<<endl;

	return 0;
}



Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K % 2 == 0) {
		cout << A - B << endl;
	}
	else {
		cout << B - A << endl;
	}
}

Measured memory_bytes: 256
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

int main() {
	ll k, a, b;
	cin >> k >> a >> b;
	k++;
	if (b <= a + 1) {
		cout << k << endl;
	} else {
		if (k <= a + 1) {
			cout << k << endl;
		} else {
			k -= a + 2;
			ll op = k / 2;
			ll ret = b + op * (b - a);
			if (k & 1) {
				ret++;
			}
			cout << ret << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3612
S = input()
i = 0
for char in S:
    if char == "A":
        first = i
        break
    else:
        i += 1
n = 0
for char in S[::-1]:
    if char == "Z":
        last = n
        break
    else:
        n += 1

print(len(S[i:len(S)-n]))

Measured memory_bytes: 3512
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<ll,int> P;

P dp[51][51]={};

ll x[100001];
ll y[100001];
int main() {
	char a,b;
	cin>>a>>b;

	if(a=='H'){
		cout<<b<<endl;
	}else{
		if(b=='D')cout<<"H"<<endl;
		if(b=='H')cout<<"D"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(9)]
for i in range(n):
    b[min([a[i]//400,8])]+=1

ans1=len([i for i in b[:8] if i>0])
ans2=ans1+b[8]
ans1=max([ans1,1])
print(ans1,ans2)


Measured memory_bytes: 9100
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <vector>
#include <string>
#include <vector>
#include <cassert>
#include <cmath>
#include <cctype>
#include <queue>
#include <algorithm>
#include <memory>
#include <memory.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

int main(){
	int a, b, c;
	while(cin >> a >> b >> c && (a || b || c)){
		vector<int> vp;
		vector<int> vq;
		for(int i = 1; i <= abs(a); i++){
			if(a % i == 0) vp.push_back(i);
		}
		for(int i = 1; i <= abs(c); i++){
			if(abs(c) % i == 0) vq.push_back(i);
		}
		int p, q, r, s;
		bool f = false;
		if(c != 0){
			for(int i = 0; i < (int)vp.size(); i++){
				p = vp[i];
				r = a / p;
				if(p < r) continue;
				for(int j = vq.size()-1; j >= 0; j--){
					q = vq[j];
					s = c / q;
					if(b == p * s + q * r){
						f = true;
						break;
					}
				}
				if(f) break;
				for(int j = 0; j < (int)vq.size(); j++){
					q = -vq[j];
					s = c / q;
					if(b == p * s + q * r){
						f = true;
						break;
					}
				}
				if(f) break;
			}
			if(f){
				cout << p << " " << q << " " << r << " " << s << endl;
			}else{
				cout << "Impossible" << endl;
			}
		}else{
			if(b == 0){
				cout << a << " " << 0 << " " << 1 << " " << 0 << endl;
			}else{
				if(a == 1 && b < 0){
					cout << 1 << " " << 0 << " " << 1 << " " << b << endl;
				}else{
					cout << a << " " << b << " " << 1 << " " << 0 << endl;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
	int n, i, a[100000] = {}, sum;

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

	sum = n;

	sort(a, a + n);

	for (i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			sum -= 2;
			i++;
		}
	}

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

	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  int a, b, c, d; cin >> a >> b >> c >> d;
  bool taka = true;
  while(1) {
    if(taka) {
      c -= b;
      if(c <= 0) {
        cout << "Yes" << endl;
        break;
      }
    } else {
      a -= d;
      if(a <= 0) {
        cout << "No" << endl;
        break;
      }
    }
    taka = !taka;
  }

}
























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

string s;

int main() {
  cin >> s;
  int ansl, ansr;
  int cnt = 0;
  for (int i=0; i<s.size(); i++) {
    if (s[i] == 'A' && cnt == 0) {
      ansl = i;
      cnt++;
    } else if (s[i] == 'Z') {
      ansr = i;
    }
  }
  cout << ansr - ansl + 1 << endl;
  return 0;
}


Measured memory_bytes: 640
n,w = map(int, input().split())
value = []
weight = []
dp = [[0 for i in range(w+1)]for j in range(n+1)]
for i in range(n):
    v,we = map(int, input().split())
    value.append(v)
    weight.append(we)

for i in range(n):
    for j in range(w+1):
        if(j >= weight[i]):
            dp[i+1][j] = max(dp[i][j], dp[i][j-weight[i]]+value[i])
        else:
            dp[i+1][j] = dp[i][j]

print(dp[n][-1])


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int n, k;
  std::cin >> n >> k;
  std::cout << n + 1 - k << std::endl;
  return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <cmath>
# include <functional>
# include <utility>
# include <queue>
# include <stack>
# define MOD 1000000007
# define INF 2000000000
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
using namespace std;

int main() {
	int ans = 0, counter = 0, maxi = -1, mini = INF, pass = 0;
	//new
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double dp[3000][3000];
int n;
double arr[3000];
double rec(int x, int y){
	if(x == n){
		if(y > n/2)return 1;
		return 0;
	}
	if(dp[x][y] >= 0.0)return dp[x][y];
	return dp[x][y] = arr[x]*rec(x+1, y+1) + (1-arr[x]) * rec(x+1, y);
}
int main(){
	for(int i = 0; i < 3000; i++)
		for(int j = 0; j < 3000; j++)
			dp[i][j] = -1;
	cin >> n;
	for(int i = 0; i < n; i++)cin >> arr[i];
	cout <<fixed <<setprecision(10)<<rec(0,0);
}

Measured memory_bytes: 70784
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */

public class Main {
    public static void main(String[] args) {
        InputStream    inputStream    = System.in;
        OutputStream outputStream = System.out;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
        	String S = in.next();
        	String ans = "NO";
    		if(S.substring(0,7).equals("keyence")) {
    			ans = "YES";
    		}else if(S.substring(S.length() - 7, S.length()).equals("keyence")){
    			ans = "YES";
    		}else{
            	for(int i = 0; i < 7; i++) {
        			if((S.substring(0, i) + (S.substring(S.length() - 7 + i, S.length()))).equals("keyence")) {
            			ans = "YES";
            			break;
        			}
            	}
    		}
        	out.println(ans);
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}



Measured memory_bytes: 23508
import math

N = int(input())
route = math.factorial(N)
town = []
d = 0.0

for i in range(N):
  town.append(list(map(int, input().split())))

for t in town:
  for tt in town:
    d += math.sqrt((tt[0]-t[0])**2 + (tt[1]-t[1])**2) * (route / N)

print(d / route)


Measured memory_bytes: 3188
N = int(input())
A = [int(input()) for _ in range(N)]
ans = 0
for i in range(N):
    ans += A[i]//2
    if i < N-1:
        if A[i]%2 == 1 and A[i+1] > 0:
            ans += 1
            A[i+1] -= 1
print(ans)


Measured memory_bytes: 7072
tmp=input().split(" ")
h = int(tmp[0])
w = int(tmp[1])

coin_map = [ [ int(s) for s in input().split(" ")] for _ in range(h) ]
# print(coin_map)

n=0
history=[]

def move(x1,y1,x2,y2):
    global n
    n += 1
    history.append([y1+1, x1+1, y2+1, x2+1])
    coin_map[y1][x1] -= 1
    coin_map[y2][x2] += 1

for y in range(h):
    for x in range(w):
        if coin_map[y][x] % 2 == 1:
            if x < w-1:
                move(x,y, x+1,y)
            elif y < h-1:
                move(x,y, x,y+1)

print(n)

for i in range(n):
    print(" ".join(map(lambda n:str(n), history[i])))

Measured memory_bytes: 29752
import sys
s=sys.stdin
while 1:
 n=int(s.readline())
 if n==0:break
 d={}
 for _ in[0]*n:
  k,v=s.readline().strip().split()
  d[k]=v
 a=''
 for _ in[0]*int(s.readline()):
  e=s.readline().strip()
  a+=d[e]if e in d else e
 print(a)


Measured memory_bytes: 6472
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, m;
    cin >> n;
    vector<int> ans;
    repb(i, 40, 0){
        if(n >= ((int)1 << i) - 1){
            m = i; n -= ((int)1 << i) - 1; break;
        }
    }
    // cout << m << " "<< n << endl;
    rep(i, 1, m + 1){
        ans. push_back(i);
    }
    repb(i, m - 1, 0){
        if(n >= ((int)1 << i)){
            // cout << n << " " << i << endl;
            n -= ((int)1 << i);
            m++;
            ans.insert(ans.begin() + i, m);
        }
    }
    cout << 2 * m << endl;
    rep(i, 0, ans.size()){
        cout << ans[i] << " ";
    }
    rep(i, 0, ans.size()){
        cout << i + 1;
        if(i != m - 1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b) {if(a<b) {a=b; return true;} return false;}
template<typename T> bool chmin(T &a,T b) {if(a>b) {a=b; return true;} return false;}
#define itn int
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sortt(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
typedef tuple<int,int,int,int> tiiii;
const ll mod=1e9+7;
const int inf=2e9;
const ll lnf=9e18;

int g[510][510];

int main(){
  int h,w; cin >> h >> w;
  rep(i,h)rep(j,w) cin >> g[i][j];
  vector<tiiii> ans(0);
  rep(i,h)rep(j,w-1){
    if(g[i][j]%2==1){
      g[i][j]--;
      g[i][j+1]++;
      ans.push_back(tiiii(i,j,i,j+1));
    }
  }
  rep(i,h-1){
    if(g[i][w-1]%2==1){
      g[i][w-1]--;
      g[i+1][w-1]++;
      ans.push_back(tiiii(i,w-1,i+1,w-1));
    }
  }
  cout << ans.size() << endl;
  rep(i,ans.size()){
    int a,b,c,d;
    tie(a,b,c,d)=ans[i];
    cout << a+1 << " " << b+1 << " " << c+1 << " " << d+1 << endl;
  }
}

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

int main(){
    int n,k,r,s,p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    vector<int> c(n,0);
    int ans = 0;
    rep(i,k){
        if(t[i] == 'r') c[i] = p;
        if(t[i] == 's') c[i] = r;
        if(t[i] == 'p') c[i] = s;
        ans += c[i];
        for(int j = i+k; j < n; j += k){
            if(t[j-k] != t[j] || c[j-k] == 0){
                if(t[j] == 'r') c[j] = p;
                if(t[j] == 's') c[j] = r;
                if(t[j] == 'p') c[j] = s;
            }
            ans += c[j];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 896