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

int main(){
  string s; cin>>s;
  int c=0;
  if (s.substr(0,7)=="keyence") c==1;
  if (s.substr(0,6)=="keyenc" && s.substr(s.size()-1)=="e") c=1;
  if (s.substr(0,5)=="keyen" && s.substr(s.size()-2)=="ce") c=1;
  if (s.substr(0,4)=="keye" && s.substr(s.size()-3)=="nce") c=1;
  if (s.substr(0,3)=="key" && s.substr(s.size()-4)=="ence") c=1;
  if (s.substr(0,2)=="ke" && s.substr(s.size()-5)=="yence") c=1;
  if (s.substr(0,1)=="k" && s.substr(s.size()-6)=="eyence") c=1;
  if (s.substr(s.size()-7)=="keyence") c=1;
  cout<<(c==1 ? "YES" : "NO")<<endl;
}

Measured memory_bytes: 3636
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> lpair;
const ll MOD = 1e9+7;
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)...);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b;
    cin >> a >> b;
    print(max(0LL, a - 2*b));

}


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

int main()
{
  int64_t n, d;
  cin >> n >> d;
  vector<int64_t> x(n), y(n);
  for(int i = 0; i < n; i++)
  {
    cin >> x.at(i) >> y.at(i);
  }
  int64_t ans = 0;
  
  for(int i = 0; i < n; i++)
  {
    if((x.at(i)*x.at(i) + y.at(i)*y.at(i)) <= d*d)
    {
      ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}

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

def f(s):
    i = 0
    n = 0
    while i < len(s)-1:
        if s[i] == s[i+1]:
            n += 1
            i += 2
        else:
            i += 1
    return n

import collections

# 解説 AC のつもり
def main():
    S = input().strip()
    K = int(input())

    # S が全て同じ文字の場合
    if len(collections.Counter(S).keys()) == 1:
        print(len(S)*K//2)
        return

    # S について、変更が必要な回数
    n = f(S)

    # 末尾が異なる場合、n を K 倍すればよい
    if S[0] != S[-1]:
        print(n*K)
        return

    # 以降、末尾が同じ文字の場合

    # 末尾から連続して S[0] が現れる数
    a = 0
    for c in S[::-1]:
        if c == S[0]:
            a += 1
        else:
            break
    # 先頭から連続して S[0] が現れる数
    b = 0
    for c in S:
        if c == S[0]:
            b += 1
        else:
            break

    # まず（接続部を気にせず） n*K とした後、
    ans = n*K
    # K-1 個の S の接続部に対して計算し直す。
    # （S 単体で見たときの変更数を引き、S+S で見たときの変更数を足す）
    ans += (K-1) * (-(a//2) -(b//2) + (a+b)//2)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<iostream>

using namespace std;

int main(){
  int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;
  int x3 = x2 - y2 + y1;
  int y3 = y2 + x2 - x1;
  int x4 = x3 - y3 + y2;
  int y4 = y3 + x3 - x2;
  
  cout<< x3 <<' '<<y3 << ' ' << x4 << ' '<< y4 << endl;
  
  return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

            
int main(){
    ll n,W;cin>>n>>W;
    ll w[n],v[n];
    vector<ll> p[4];
    rep(i,0,n-1){
        cin>>w[i]>>v[i];
        p[w[i]-w[0]].pb(v[i]);
    }
    rep(i,0,3){
        sort(p[i].begin(),p[i].end(),greater<ll>());
    }
    ll sum[4][110];
    rep(i,0,3){
        sum[i][0]=0;
        if(p[i].size()>=1){
            rep(j,0,p[i].size()-1){
                sum[i][j+1]=sum[i][j]+p[i][j];
            }
        }
    }
    ll ans=0;
    rep(i0,0,p[0].size())rep(i1,0,p[1].size())rep(i2,0,p[2].size())rep(i3,0,p[3].size()){
        if(w[0]*(i0+i1+i2+i3)+(i1*1+i2*2+i3*3)<=W){
            ans=max(ans,sum[0][i0]+sum[1][i1]+sum[2][i2]+sum[3][i3]);
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  long long n, a, b; cin >> n >> a >> b;
  long long cnt = a * (n / (a+b));
  n %= (a+b);
  cnt += min(n, a);
  cout << cnt << endl;
  return 0;
}

// EOF


Measured memory_bytes: 256
n,k,q=map(int,input().split())
member=[0]*(n+1)
noruma=1-(k-q)
for i in range(q):
        a=int(input())
        member[a]+=1
if k-q>=1: #全員生き残る
    for i in range(n):
        print("Yes")
else:
    noruma=1-(k-q)
    for i in range(1,n+1):
        if noruma<=member[i]:
            print("Yes")
        else:
            print("No")

Measured memory_bytes: 4680
"""
a + b = x
4a + 2b = y

a = (-2x + y) / 2
b = (4x - y) / 2
"""

x, y = map(int, input().split())

if y - 2 * x >= 0 and 4 * x - y >= 0 and y % 2 == 0:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9160
#include<iostream>
using namespace std;
int main(){
    int n;
    int count=0;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)  cin>>a[i];
    for(int j=1; j<n; j++){
        for(int i=n-1; i>=j; i--){
            if(a[i]<a[i-1]){
                int memo=a[i];
                a[i]=a[i-1];
                a[i-1]=memo;
                count++;
            }
        }
    }
    for(int i=0; i<n-1; i++)  cout<<a[i]<<" ";
    cout<<a[n-1]<<endl<<count<<endl;
}


Measured memory_bytes: 3104
import java.util.*;
public class Main {
    private int[] _parent;
    private int[] _rank;
    
    public int find(int i){
      int p = _parent[i];
      if(i == p){
        return i;
      }
      return _parent[i] = find(p);
    }
    
    public void union(int i, int j){
      int root1 = find(i);
      int root2 = find(j);
      
      if(root1 == root2){
        return;
      }
      
      if(_rank[root1] > _rank[root2]){
        _parent[root2] = root1;
      } else if(_rank[root2] > _rank[root1]){
        _parent[root1] = root2;
      } else{
        _parent[root2] = root1;
        _rank[root1]++;
      }
    }
    
    public Main(int max){
      _parent = new int[max];
      _rank = new int[max];
      
      for(int i = 0; i < max; i++){
        _parent[i] = i;
      }
    }
    
    public boolean same(int i, int j){
      int root1 = find(i);
      int root2 = find(j);
      
      return root1 == root2;
    }
    
    public static void main(String[] args){
      // 入力
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int M = sc.nextInt();
      Main uf = new Main(N);
      
      // 都市を結ぶ
      for(int i = 0; i < M; i++){
        int A = sc.nextInt()-1;
        int B = sc.nextInt()-1;
        
        uf.union(A,B);
      }
      
      // 必要な道路数カウント
      int count = 0;
      for(int i = 0; i < N; i++){
        if(!uf.same(0,i)){
          uf.union(0,i);
          count++;
        }
      }
      
      // 出力
      System.out.println(count);
    }
    

}

Measured memory_bytes: 59800
#include <bits/stdc++.h>
using namespace std;
#define lowbit(x) (x&(-x))
#define N 7105
int mark[150];
char s[15];
int main() {
	scanf("%s",s+1);
	for(int i=1; i<=4; i++) mark[s[i]] ++;
	int tot = 0;
	for(int i='A'; i<='Z'; i++) if(mark[i] == 2) tot ++;
	if(tot == 2) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
const int inf=2e9;

int n=0;
int a[200005],inp;
int dp[200005];

int LIS(){
    int ln=0;dp[ln]=-inf;
    for(int i=1;i<=n;i++){
        if(a[i]>dp[ln]){
            dp[++ln]=a[i];
        }else{
            int idx=lower_bound(dp+1,dp+ln+1,a[i])-dp;
            dp[idx]=a[i];
        }
    }
    return ln;
}

int bin(int l,int r,int ks){
    while(l<r){
        int mid=l+r>>1;
        if(dp[mid]>=ks){
            l=mid+1;
        }else r=mid;
    }
    return l;
}

int LDS(){
    int ln=0;dp[ln]=inf;
    for(int i=1;i<=n;i++){
        if(dp[ln]>=a[i]){	// 可以更新 
            dp[++ln]=a[i];
        }else{
            int idx=bin(1,ln,a[i]);
                // dp[idx]<=a[i] 且 idx 最大 ,每一个结尾的数越大越好 
            dp[idx]=a[i];
        }
    }
    return ln;
}

int main(){
//	freopen("Luogu1020.in","r",stdin);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    
    int ans1=LDS();
    printf("%d\n",ans1);

    return 0;
}


Measured memory_bytes: 896
#include<iostream>
#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>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
  ll a,e=0;cin>>a;
  string b;cin>>b;
  vector<ll>c('z'-'a'+1,0),d('z'-'a'+1,0);
  rep(i,a)d[b[i]-'a']++;
  rep(o,a){
    c[b[o]-'a']++;
    d[b[o]-'a']--;
    ll f=0;
    rep(i,'z'-'a'+1)if(c[i]&&d[i])f++;
    e=max(e,f);
  }
  cout<<e;
}



Measured memory_bytes: 27052
# -*- coding: utf-8 -*-
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))

sre = (1/(4*M))*sum(A)

cor = []
for a in A:
    if a > sre or a == sre:
        cor.append(a)

#print(len(cor))
if len(cor) > M or len(cor) == M:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
vector<vector<int>>adj;
pair<ll,ll> dfs(int i,int p){
    ll all_white=1;
    ll sm_black=0;
    for(int u:adj[i]){
        if(u!=p){
            pair<ll,ll>p=dfs(u,i);
            sm_black=(all_white*p.first%mod+sm_black*(p.first+p.second)%mod)%mod;
            all_white=all_white*p.second%mod;

        }
    }
    return{all_white,all_white+sm_black};

}

int main(){
    int n;
    cin>>n;
    adj=vector<vector<int>>(n+1);
    int x,y;
    for(int i=0;i<n-1;i++){
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    pair<ll,ll>p=dfs(1,-1);
    cout<<(p.first+p.second)%mod;
    return 0;
}


Measured memory_bytes: 12672
n ,m = map(int, input().split())
a = []
b = []
c = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
for i in range(m):
    x, y = map(int, input().split())
    c.append(x)
    d.append(y)

for i in range(n):
    ans = 0
    for j in range(m):
        dist = abs(a[i]-c[j]) + abs(b[i]-d[j])
        if dist < abs(a[i]-c[ans]) + abs(b[i]-d[ans]):
            ans = j
    print (ans+1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

int main(){
    ll N;
    string S;
    cin >> N >> S;
    //ll l = 0;
    ll r = N-1;
    ll ans = 0;
    rep(l,N){
        if(S[l] == 'W'){
            while(S[r] != 'R' && l < r){
                r--;
            }
            if(!(l<r)){
                break;
            }
            S[l] = 'R';
            S[r] = 'W';
            ans++;
            r--;
        }
        if(!(l<r))break;
    }
    cout << ans << endl;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	ll ans = 0;
	if ( (N==1) || (M==1) ){
		if (N*M == 1){
			ans = 1;
		} else {
			ans = N*M - 2;
		}
	} else if ((N==2) || (M==2)) {
		ans = 0;
	} else {
		ans = N*M - 2*(N + M) + 4;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main()
{
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner
{
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for ( A&i : a ) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

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


void Calc()
{

  int n = in;
  auto a = in.Array(n);
  deque<int> b;

  int c = 0;
  rep(i, n)
  {
    if ( c )
    {
      b.push_front(a[i]);
    }
    else
    {
      b.push_back(a[i]);
    }
    c = 1 - c;
  }
  if ( c == 1 )reverse(all(b));
  rep(i, b.size())
  {
    if ( i != 0 )cout << ' ';
    cout << (b[i]);
  }
  cout << endl;
}


Measured memory_bytes: 3840
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b=scan.nextInt();
	String str=scan.next();
	boolean fig=true;
	for(int i=0;i!=a+b+1;i++) {
		char ch=str.charAt(i);
		if(i==a) {
			if(ch=='-') {
			}
			else {
				fig=false;
			}
		}
		else {
			if(ch=='-') {
				fig=false;
			}
		}
	}
	System.out.println(fig?"Yes":"No");
	scan.close();
}
}

Measured memory_bytes: 22996
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class ABC069A
    {
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = NN;
            var m = NN;
            Console.WriteLine((n - 1) * (m - 1));
        }
        static class Console_
        {
            static Queue<string> param = new Queue<string>();
            public static string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static public void Main(string[] args) { if (args.Length == 0) { Console.SetOut(new Printer(Console.OpenStandardOutput())); } var t = new Thread(Solve, 134217728); t.Start(); t.Join(); Console.Out.Flush(); }
        static long NN => long.Parse(Console_.NextString());
        static double ND => double.Parse(Console_.NextString());
        static string NS => Console_.NextString();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static IEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => x.OrderBy(_ => xorshift);
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
    }
}
namespace Library {
}


Measured memory_bytes: 14688
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define in(x, a, b) (a <= x && x < b)

using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
const ll inf = 1000000001, INF = (ll)1e18 + 1;

bool comp(pair<int, ii> a, pair<int, ii> b) {
	if(a.ss.ff == b.ss.ff) return a.ss.ss > b.ss.ss;
	else return a.ss.ff > b.ss.ff;
}

void upd(vi &t, int pos, int x) {
	for(int i = pos + 1; i <= t.size(); i += (i&-i)) t[i - 1] += x;
}

int get(vi &t, int pos) {
	int s = 0;
	for(int i = pos + 1; i > 0; i -= (i&-i)) s += t[i - 1];

	return s;
} 

void solve() {
	int n, q;
	cin >> n >> q;
	
	vi c(n);
	for(int i = 0; i < n; i++) cin >> c[i];
	
	vector<pair<int, ii>> query(q);
	for(int i = 0; i < q; i++) cin >> query[i].ss.ff >> query[i].ss.ss, query[i].ss.ff--, query[i].ss.ss--, query[i].ff = i;
	
	sort(all(query), comp);
	
	int lastl = n;
	vi t(n, 0), last(n + 1, -1), ans(q);
	for(int i = 0; i < q; i++) {
		for(int j = lastl - 1; j >= query[i].ss.ff; j--) {
			upd(t, j, 1);
			if(last[c[j]] != -1) upd(t, last[c[j]], -1);
			last[c[j]] = j;
		}
		
		lastl = min(lastl, query[i].ss.ff);
		
		ans[query[i].ff] = get(t, query[i].ss.ss) - get(t, query[i].ss.ff - 1);
	}
	
	for(int i = 0; i < q; i++) cout << ans[i] << endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	solve();
    return 0;
}

Measured memory_bytes: 17396
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;
const long long MINF = LLONG_MIN;

// -------------------------------------------------------

ll K;

int main() {
  cin >> K;

  ll N = max(2LL, min(K, 50LL));

  ll base = N - 1 + K / N;

  ll r = K % N;

  cout << N << "\n";
  rep(i, 0, r) { cout << base + N - r + 1 << " "; }
  rep(i, 0, N - r) { cout << base - r << " "; }
}


Measured memory_bytes: 3592
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<int,int>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x;
	cin >> x;
	if(x == 7 || x == 5 || x == 3) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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


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

int main()
{
  int N, A;
  cin >> N >> A;
  int amari = N % 500;
  if (amari <= A)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列
#include <map> //map



#define REP(i,m,n) for(ll i = (ll) (m);i < (ll) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

int n;
pair<string, pair<int,int> > p[100];
string s;




int main() {
	
	cin >> n;
	rep(i, n) {
		cin >> p[i].first >> (p[i].second).first;
		(p[i].second).first *= -1;
		(p[i].second).second = i + 1;
	}
	sort(p,p + n);
	rep(i, n) {
		cout << (p[i].second).second << endl;
	}



	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

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

  ll ans = 0;
  if (S == "SUN")
    ans = 7;
  if (S == "MON")
    ans = 6;
  if (S == "TUE")
    ans = 5;
  if (S == "WED")
    ans = 4;
  if (S == "THU")
    ans = 3;
  if (S == "FRI")
    ans = 2;
  if (S == "SAT")
    ans = 1;

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
int main() {
	int N,M; SCD2(N,M);
	vector< PII > ab;

	REP(i,M){
		int a,b; SCD2(a,b);
		ab.PB(MP(a,b));
	}

	sort(ab.begin(),
        ab.end(),
        [](const PII& x, const PII& y){return x.second < y.second;}
	);

	int cutp = 0;
	int ans = 0;
	REP(i,M){
		if (cutp <= ab[i].fst){
			cutp = ab[i].snd;
			ans++;
		}
	}

	PRINTD(ans);
	return 0;
}

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

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
#define forn(i, n) for(int i = 1; i <= n; i++)
#define rep(i, x, y) for(int i = x; i <= y; i++)
#define sz(x) (int)x.size()
#define pii pair<int, int>
#define ll long long
#define ull unsigned long long
#define ld long double
#define mii map<int, int>
#define all(x) x.begin(), x.end()
#define N 100001

using namespace std;

const int maxn = 1e9;
const int mod = 1e9 + 7;

bool ok(int n) {
    int k = 0;
    while(n != 0) {
        k++;
        n /= 10;
    }

    return k % 2;
}

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

    int ans = 0;
    for(int i = 1; i <= n; i++)
        if(ok(i))
            ans++;

    cout << ans;

}

int main() {
	int tt = 1;

	while(tt--) {
		solve();
	}
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct Node_struct{
  int p, l, r;
};
/*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/

typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

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

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].l != NIL) calcDepth(T[u].l, p + 1);
  if(T[u].r != NIL) calcDepth(T[u].r, p);
}

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

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

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



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

int main()
{
    long long n,k;
    cin >> n >> k;

    long long pre = n;

    if(n > k)
    {
        n = n % k;
    }
    
    while(true)
    {
        n = abs(n-k);

        if(n > pre)
        {
            break;
        }
        else
        {
            pre = n;
        }
    }
    cout << pre;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include <string.h>
int map[105][105]={0};
using namespace std;
int main(){
	string hoge,temp1="",temp2="";
	cin>>hoge;
	hoge+='E';
	int ans=0,i=0,cntJ=0,cntO=0,cntI=0;
	bool flagO=false,flagI=false;
	while(1){
		cntJ=0;
		cntO=0;
		cntI=0;
		while(hoge[i]=='J'){
			cntJ++;
			i++;
			flagO=true;
		}
		while(flagO&&hoge[i]=='O'){
			cntO++;
			i++;
			flagI=true;
		}
		while(flagI&&hoge[i]=='I'){
			cntI++;
			i++;
		}
		if(!flagI||!flagO)i++;
		if(flagI&&(cntJ>=cntO)&&(cntO<=cntI))ans=max(ans,cntO);
		flagI=false;
		flagO=false;
		if(i>hoge.size()) break;
	}
	
	cout<<ans<<endl;		
}

Measured memory_bytes: 2056
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int d = scanner.nextInt(), g = scanner.nextInt();
			Score[] s = IntStream.range(0, d)
					.mapToObj(i -> new Score((i + 1) * 100, scanner.nextInt(), scanner.nextInt())).sorted()
					.toArray(Score[]::new);
			System.out.println(IntStream.range(1, 1 << d).map(i -> getProblemNo(i, s, g)).min().getAsInt());
		}
	}

	/**
	 * 目標スコアが達成させるための解く問題数を計算する
	 * 
	 * @param mask 使用する問題の2進数表現
	 * @param s    問題数とスコア数の配列
	 * @param g    目標スコア
	 * @return 目標スコアが達成させるための解く問題数
	 */
	private static int getProblemNo(int mask, Score[] s, int g) {
		int result = 0;
		for (int i = 0; i < s.length; i++) {
			if ((mask & (1 << i)) > 0) {
				if (g > s[i].max) {
					result += s[i].count;
					g -= s[i].max;
				} else {
					int index = Arrays.binarySearch(s[i].scores, g);
					if (index < 0) {
						index = ~index;
					}
					result += index + 1;
					return result;
				}
			}
		}
		// 達成できない場合
		return Integer.MAX_VALUE;
	}

	/**
	 * 問題数とスコアを表すクラス
	 */
	private static class Score implements Comparable<Score> {
		/** 問題数 */
		int count;
		/** スコアの配列 */
		int[] scores;
		/** 完成したときのスコア数 */
		int max;

		/**
		 * コンストラクタ
		 * 
		 * @param n 1問あたりのスコア
		 * @param p 問題数
		 * @param c ボーナススコア
		 */
		Score(int n, int p, int c) {
			scores = new int[count = p];
			IntStream.range(0, p - 1).forEach(i -> scores[i] = (i + 1) * n);
			scores[p - 1] = max = p * n + c;
		}

		@Override
		public int compareTo(Score score) {
			// 問題を完了させたときのスコア数/問題数 で降順でソート
			return Double.compare(((double) score.max) / score.count, ((double) this.max) / this.count);
		}
	}
}


Measured memory_bytes: 36408
#include <iostream>

int main(int argc, char const* argv[])
{
	int a, b, digit, sum;
	while(std::cin >> a >> b)
	{
		sum = a + b;
		while(sum > 0)
		{
			sum /= 10;
			digit++;
		}

		std::cout << digit << std::endl;
		digit = 0;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#include<numeric>
#include <iterator>
using namespace std;
int main()
{
  string s;
  cin>>s;
  if(s[1]=='R')
  {
    cout<<"ABC";
  }
  else
  {cout<<"ARC";
  }
  return 0;
}
  

Measured memory_bytes: 3492
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    while(in.hasNext()){
      int a = in.nextInt();
      int b = in.nextInt();
      int val = a + b;
      int valLen = String.valueOf( val ).length();
      System.out.println(valLen);
    }
  }
}

Measured memory_bytes: 26224
package main

import (
"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	N, A, B := scanInt(sc), scanInt(sc), scanInt(sc)

	fmt.Println(resolve(N, A, B))
}

func resolve(N, A, B int) int {
	ab := A + B

	div := N / ab
	sur := N % ab

	count := div * A

	if sur > A {
		count += A
	} else {
		count += sur
	}

	return count
}


// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i:=0; i<n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}


Measured memory_bytes: 1780
Imports System

Public Class Program

    Public Shared Sub Main(args As String())
        Dim Input() As Integer = Array.ConvertAll(Of String, Integer)(Console.ReadLine.Split(" "), AddressOf Integer.Parse)
        If Input(0) + Input(1) + Input(2) >= 22 Then
            Console.WriteLine("bust")
        Else
            Console.WriteLine("win")
        End If

    End Sub
End Class

Measured memory_bytes: 13140
use std::io::{BufRead, Write};
use std::io;
use std::cmp;

fn range_sum(table: &Vec<Vec<usize>>, start: (usize, usize), end: (usize, usize)) -> usize {
    assert!(end.0 >= start.0);
    assert!(end.1 >= start.1);
    table[end.0][end.1] + table[start.0][start.1] - table[start.0][end.1] - table[end.0][start.1]
}

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let (n, k): (usize, usize) = {
        let mut split = buf.split_whitespace();
        (split.next().unwrap().parse().unwrap(), split.next().unwrap().parse().unwrap())
    };
    let mut white = vec![vec![0usize; k * 2]; k * 2];
    let mut black = white.clone();
    let mut white_sums = vec![vec![0usize; k * 2 + 1]; k * 2 + 1];
    let mut black_sums = white_sums.clone();
    for _ in 0..n {
        buf.clear();
        input.read_line(&mut buf).unwrap();
        let (x, y, c): (usize, usize, bool) = {
            let mut split = buf.split_whitespace();
            (split.next().unwrap().parse().unwrap(), split.next().unwrap().parse().unwrap(), split.next().unwrap() == "B")
        };
        if c {
            black[x % (k * 2)][y % (k * 2)] += 1;
        } else {
            white[x % (k * 2)][y % (k * 2)] += 1;
        }
    }
    for x in 0..k * 2 {
        for y in 0..k * 2 {
            white_sums[x + 1][y + 1] = white_sums[x + 1][y] + white_sums[x][y + 1] - white_sums[x][y] + white[x][y];
            black_sums[x + 1][y + 1] = black_sums[x + 1][y] + black_sums[x][y + 1] - black_sums[x][y] + black[x][y];
        }
    }
    let result = (0..k).map(|x| (0..k).map(|y| {
        let white = range_sum(&white_sums, (0, 0), (x, y))
            + range_sum(&white_sums, (x, y), (x + k, y + k))
            + range_sum(&white_sums, (x + k, 0), (k * 2, y))
            + range_sum(&white_sums, (0, y + k), (x, k * 2))
            + range_sum(&white_sums, (x + k, y + k), (k * 2, k * 2));
        let black = range_sum(&black_sums, (x, 0), (x + k, y))
            + range_sum(&black_sums, (0, y), (x, y + k))
            + range_sum(&black_sums, (x + k, y), (k * 2, y + k))
            + range_sum(&black_sums, (x, y + k), (x + k, k * 2));
        cmp::max(white + black, n - white - black)
    }).max().unwrap()).max().unwrap();
    writeln!(output, "{}", result).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "4 3
0 1 W
1 2 W
5 3 B
5 4 B
",
            "4\n",
        );
    }

    #[test]
    fn case2() {
        test(
            "2 1000
0 0 B
0 1 W
",
            "2\n",
        );
    }

    #[test]
    fn case3() {
        test(
            "6 2
1 2 B
2 1 W
2 2 B
1 0 B
0 6 W
4 5 W
",
            "4\n",
        );
    }
}

Measured memory_bytes: 168188
#include<bits/stdc++.h>
#define MAX 1000000
#define pb push_back
#define f first
#define s second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define int long long int
using namespace std;

typedef pair<int, int> pii;
typedef map<int, int> mapint;
typedef vector<int> vi;

int power(int x, int y) 
{ 
    int res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
   
        // n must be even now 
        y = y>>1; // y = y/2 
        x = x*x;  // Change x to x^2 
    } 
    return res; 
}

int32_t main(){
	fio;
	int n, d;
	cin>>n>>d;
	int area = 2*d+1;
	int ans = ceil((float)n/area);
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
given H and A.
find how many A needed to reduce H to 0

10 4

3

*/

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

using ll = long long; 

const int mod = 1e9+7;

int add(int a, int b) {
    int c = a + b;
    if (c >= mod) {
        c -= mod;
    }
    return c;
}


int main() {
    int H, A;
    scanf("%d%d", &H, &A);
    int ans = (H % A == 0) ? (H / A) : (H / A) + 1; 
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
#define mp  std::make_pair
#define ll long long int
#define abs(n) ((n>0)?(n):((n)*(-1)))
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define VREP(v) for(std::vector<ll>::iterator itr = (v).begin(); itr != (v).end();itr++)
#define VALL(v) ((v).begin(),(v).end())
#define errln(v) cerr << (v) << endl;
#define println(v) cout << (v) << endl;

int main(int argc, const char * argv[]) {
	int A,B;
	cin >> A >> B;
	println(max(A+B,max(A-B,A*B)));
}


Measured memory_bytes: 256
#119 b
n=int(input())
x=[]
u=[]
btc=380000
ans=0
def yen_or_btc(m):
    if m=="JPY":
        return 1
    else:
        return btc

for i in range(n):
    y,b=list(input().split())
    y=float(y)
    x.append(y)
    u.append(b)

for i in range(n):
    ans+=x[i]*yen_or_btc(u[i])
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <cstring>
#include <bitset>
#include <map>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using PP = pair<ll, pair<ll,ll>>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define MOD 1000000007
//           123456789

string s;

int main() {
    cin >> s;
    cout << s;
    if (s[s.size()-1] == 's') cout << "e";
    cout << "s" << endl;
    return 0;
}

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

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

 int ans= 0;
 rep(i,n){
   int b=1;
   while(b <= d){
     ans++;
     b+=a.at(i);
   }
 }
 cout << ans+x << endl;
 } 

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

int main() {
    int n;
    cin >> n;
    while(n>0) {
        if(n%10==9) {
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int A, B, C;
  cin >> A >> B >> C;
  if (A == B && B != C) {
    cout << "Yes" << endl;
  } else if (A == C && B != C) {
    cout << "Yes" << endl;
  } else if (B == C && A != C) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#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 forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
	int n; cin >> n;
	vector<int> a(n);
	forn(i, n) cin >> a[i];
	bool ok = true;
	for (int i = n - 1; i >= 1; --i)
	{
		if (a[i] >= a[i - 1]) continue;
		else
		{
			a[i - 1]--;
			if (a[i] < a[i - 1]) 
			{
				ok = false;
				break;
			}
		}
	}
	cout << (ok ? "Yes" : "No");
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#include<vector>
#include<queue>
#include<math.h>
#include<list>
#include<limits.h>
#include<algorithm>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define PI 3.141592654
#define rep(i,a) for(int i=1;i<=a;i++)
#define loop(j,b) for(int j=0;j<b;j++)
typedef long long ll;
using namespace std;
const int MXSIZE = 1e6+6;
int main(){
ll n;
cin>>n;
vector<ll> a(n+1);
ll t=0,x=0;
for(ll i=1;i<=n;i++){
	cin>>x;
	t=n-i;
	if(t%2==0){
		a[1+(t/2)]=x;
	}
	if(t%2==1){
		t-=1;
		a[n-(t/2)]=x;
	}
	
}
for(ll i=1;i<=n;i++){
	cout<<a[i]<<" ";


}

	return 0;
}

Measured memory_bytes: 3712
/*input
2
ip cc
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define eb emplace_back
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define EL cout<<'\n'
#define BS(a,x) binary_search(ALL(a),x)
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
template<typename T>
ostream& operator<<(ostream& out,vector<T> V){
	REP(i,SZ(V)) out<<V[i]<<((i!=SZ(V)-1)?" ":"");
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=20;
const ll INF64=1e18;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}


int main(){
	IOS;
	string a[]={"Sunny","Cloudy","Rainy","Sunny"};
	string s;
	cin>>s;
	REP(i,3){
		if(s==a[i]) cout<<a[i+1];
	}	
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)




















 
int main(){
    double w, h, x, y;
    cin >> w >> h >> x >> y;
    
    if(w / 2.0 == x && h / 2.0 == y){
        printf("%.11lf 1\n", h * w / 2.0);
        return 0;
    }

    printf("%.11lf 0\n", h * w / 2.0);
}

Measured memory_bytes: 256
#include <cmath>

#include <algorithm>
#include <iostream>
#include <vector>

#include <string>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;

string s;

void solve() {
  cin >> s;

  string ans = "Yes\n";

  if (s[2] != s[3] || s[4] != s[5])
    ans = "No\n";

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

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

  int t = 1;

#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  t = 3;
#endif


  while (t--)
    solve();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

string S;

int main(){
  cin >> S;
  int cnt=0;
  for(auto u : S){
    if(u == '1')cnt++;
  }
  cout << min(cnt,((int)S.size()-cnt))*2 << endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
int n, a[1001], ans, k, po[43];
vector<int> x, y;
bool ck;
 
signed main(){
    cin >> n >> k;
    po[0] = 1;
    for(int i = 1; i <= 42; i++) po[i] = po[i - 1] * 2;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int i = 1; i <= n; i++){
        int ans = 0;
        for(int j = i; j <= n; j++){
            ans += a[j];
            x.push_back(ans);
        }
    }
    //for(int i = 0; i < x.size(); i++) cout << x[i] << endl;
    for(int i = 42; i >= 0; i--){
        //cout << i << " " << tmp << "\n";
        y.clear();
        for(int j = 0; j < x.size(); j++){
            //cout << (x[j] & po[i]) << " ";
            if((x[j] & po[i])) y.push_back(x[j]);
        }
        //cout << endl;
        //cout << i << " " << y.size() << endl;
        if(y.size() < k) continue;
        ans += po[i];
        x.clear();
        x = y;
    }
    cout << ans;
}

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

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  int max = a;
  if (b > max) max = b;
  if (c > max) max = c;

  int answer;

  if (max == a) answer = b + c;
  else if (max == b) answer = a + c;
  else answer = a + b;

  cout << answer << endl;

  return 0;
}

Measured memory_bytes: 256
/*
AizuOnline A2007
Purse
2012/12/31 WA
*/
#include <stdio.h>
// Select Below
//#include <stdlib.h>
//#include <string.h>
//#include <float.h>
//#include <math.h>
//#include <limits.h>
#define min(x,y) (((x)<(y))?(x):(y))
//Global data section
int c10,c50,c100,c500;
int m10,m50,m100,m500;
int sum;
//
int _read()
{
  // sum=160;
  // c10=1;c50=1;c100=2;c500=0;
  scanf("%d",&sum);
  if(sum ==0)
    return(0);
  scanf("%d %d %d %d",&c10,&c50,&c100,&c500);
  return(-1);
}
main()
{ 
  int flag=0,wk;
  while(_read())
    {
      if(flag)
	printf("\n");
      flag=-1;
      m10 =  (sum % 50)/10 ;
      if(m10 > c10)
	{
	  m10=0;
	  sum += 50 - (sum % 50);
	}
      else
	{	  
	  m10 += ((c10 - m10)/ 5)* 5;
	  sum -= m10*10;
	}
      //if(sum < 0)sum=0;
      m50 =  (sum % 100)/50;
      //printf("m50A:%d\n",m50);
      if(m50 > c50)
	{
	  m50=0;
	  sum += 100 - (sum % 100);
	}
      else
	{
	  m50 += ((c50 - m50) / 2)*2;
	  sum -= m50*50;
	}
      //if(sum < 0)sum=0;
      m100 = (sum % 500)/100;
      // printf("m100:%d\n",m100);
      if(m100 > c100)
	{
	  m100=0;
	  sum += 500 - (sum % 500);
	}
      else
	{
	  m100 += ((c100 - m100)/5)*5;
	  sum -= m100*100;
	  if(sum < 0)
	    sum = 0;
	}
      m500 = sum / 500;
      
      if(m10 > 0)
	printf("10 %d\n",m10);
      if(m50 > 0)
	printf("50 %d\n",m50);
      if(m100 > 0)
	printf("100 %d\n",m100);
      if(m500 > 0)
	printf("500 %d\n",m500);
    }

return(0);
}

Measured memory_bytes: 604