akhauriyash/Code-Regression huggingface dataset:
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <map>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;
	using BigNum = std::vector<long long>;

	class InputData {
	public:
		void getInput(void);
		void skipInput(void);
		Str getStr(void);
		Num getNum(void);
		BigNum getBigNum(void);
	private:
		Str str;
		Num num;
		BigNum bNum;
	};
	Str AtCoder::InputData::getStr(void) {
		return this->str;
	}
	Num AtCoder::InputData::getNum(void) {
		return this->num;
	}
	BigNum AtCoder::InputData::getBigNum(void) {
		return this->bNum;
	}
	void AtCoder::InputData::skipInput(void) {
		std::string buf = "";
		std::getline(std::cin, buf);
	}
	void AtCoder::InputData::getInput(void) {
		this->str.clear();
		this->num.clear();
		this->bNum.clear();

		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				this->str.push_back(row);
				this->num.push_back(std::atoi(row.c_str()));
				this->bNum.push_back(std::atoll(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		this->str.push_back(row);
		this->num.push_back(std::atoi(row.c_str()));
		this->bNum.push_back(std::atoll(row.c_str()));
	}

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(long long);
		void decrement(void);
		void decrement(long long);
		long long getResult(void);
	private:
		long long result;
	};
	void Ans::showResult(void) {
		printf("%lld\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(long long value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(long long value) {
		this->result -= value;
	}
	long long AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::InputData* data = new AtCoder::InputData();
	data->getInput();

	const int t8 = data->getNum()[0], t10 = data->getNum()[1];

	AtCoder::Ans* ans = new AtCoder::Ans();

	ans->decrement(1);

	for (int i = 1; i < 1001; i++) {
		const int b8 = (i * 0.08);
		const int b10 = (i * 0.1);
		if (t8 == b8 && 
			t10 == b10) {
			ans->increment(1);
			ans->increment(i);
			break;
		}
	}

	ans->showResult();

	delete(ans);
	delete(data);

	return 0;
}


Measured memory_bytes: 888
#include<iostream>

using namespace std;

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

	int n;
	cin >> n;
	for(int i=0; i<=25; i++){
		for(int j=0; j<=15; j++){
			if(4*i + 7*j == n){
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 3644
N = int(input())
A = [0] * N

ans = 0
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a + b
    ans -= b
A = sorted(A, reverse=True)
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
print(ans)


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

 using namespace std;
string A;
bool a[26] = {};
  int main(){
  cin >> A;
  for(int i=0;i<A.size();i++){
  a[A[i]-'a'] = true;
}
for(int i=0;i<26;i++){
 if(!a[i]) {
  cout << (char)('a' + i) ;
  return 0;
}
}
 printf("None");
}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct UnionFind
{
    vector<int>d;
    UnionFind(int n) : d(n,-1) {};
    int find(int x) {
        if(d[x] < 0) return x;
        return d[x] = find(d[x]);
    }
    bool unite (int x, int y) {
        x = find(x),y = find(y);
        if(x==y) return false;
        if(d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x,int y) {
        x = find(x),y = find(y);
        if(x == y) return true;
        else return false;
    }
    int size(int x) {
        return -d[find(x)];
    }
};


int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int>deg(n);
    vector<vector<int>>to(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--;b--;
        deg[a]++;
        deg[b]++;
        uf.unite(a,b);
    }
    rep(i,k) {
        int c,d;
        cin >> c >> d;
        c--;d--;
        to[c].push_back(d);
        to[d].push_back(c);
    }
    rep(i,n) {
        int ans = uf.size(i)-1-deg[i];
        for(int u: to[i]) {
            if(uf.same(i,u)) ans--;
        }
        if(i<n-1)cout << ans << " ";
        if(i==n-1) cout << ans << endl;
    }
}

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    ll i,j,n,m,k,cnt=0,ans=0,t=1;
    string s;
    cin>>s;
    n=s.length();
    ll lef[n],rig[n];
    rep(i,0,n){
        if(s[i]=='R') cnt=i;
        else lef[i]=cnt;
    }    
    for(i=n-1;i>=0;i--){
        if(s[i]=='L') cnt=i;
        else rig[i]=cnt;
    }
    ll out[n+1]={0};
    rep(i,0,n){
        if(s[i]=='L'){
            k=(i-lef[i]);
            if(k%2==1) out[lef[i]+1]++;
            else out[lef[i]]++;
        }
        else{
            k=(rig[i]-i);
            if(k%2==1) out[rig[i]-1]++;
            else out[rig[i]]++;
        }
    }
    rep(i,0,n) cout<<out[i]<<" ";
    return 0;
}

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

int main(void){
    int a, b;
    char grid[100][100];
    cin >> a >> b;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            grid[i][j] = i < 50 ? '.' : '#';
        }
    }
    for (int i = 0; i < a - 1; i++)
        grid[i / 50 * 2 + 51][i % 50 * 2] = '.';
    for (int i = 0; i < b - 1; i++)
        grid[i / 50 * 2][i % 50 * 2] = '#';
    cout << "100 100" << endl;
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            cout << grid[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 1LL << 61;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222






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



  cin >> s;
  ll cnt = 0;
  rep(i, s.size()) if (s[i] == 'x') cnt++;
  if (cnt >= 8) cout << "NO" << endl;
  else cout << "YES" << endl;







  return 0;
}

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

int main(){
	int N, K, i, j, k, now, ans = 0;
	scanf("%d%d", &N, &K);
	vector<int> V(N);
	for(i = 0; i < N; i++){
		scanf("%d", &V[i]);
	}
	for(i = 0; i < N; i++){
		for(j = i; j <= N; j++){
			vector<int> A(0);
			for(k = 0; k < i; k++){
				A.push_back(V[k]);
			}
			for(k = j; k < N; k++){
				A.push_back(V[k]);
			}
			if(A.size() > K) continue;
			sort(A.begin(), A.end());
			for(k = 0; k < K - A.size() && k < A.size(); k++){
				if(A[k] >= 0) break;
			}
			for(now = 0; k < A.size(); k++){
				now += A[k];
			}
			ans = max(ans, now);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int N;
	cin >> N;
	cout << N*(N + 1) / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

#define int ll

int n,ma,mb;
int a[44],b[44],c[44];
int dp[44][444][444];
int inf=100000;

signed main(){
    cin>>n>>ma>>mb;
    rep(i,0,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    rep(i,0,n+1)rep(j,0,401)rep(k,0,401){
        dp[i][j][k]=inf;
    }
    dp[0][0][0]=0;
    
    rep(i,0,n)rep(j,0,401)rep(k,0,401){
        if(dp[i][j][k]==inf)continue;
        dp[i+1][j][k]=min(dp[i][j][k],dp[i+1][j][k]);
        dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
    }
    
    int ans=inf;
    rep(i,1,401)rep(j,1,401){
        if(i*mb==j*ma)ans=min(ans,dp[n][i][j]);
    }
    
    if(ans==inf)ans=-1;
    cout<<ans<<endl;
    
}

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

int main(){
	int n;
	cin >> n;
	
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	rep(i, n){
		string s;
		cin >> s;

		if(s == "AC") ac++;
		if(s == "WA") wa++;
		if(s == "TLE") tle++;
		if(s == "RE") re++;
	}

	cout <<"AC x " << ac << endl;
	cout <<"WA x " << wa << endl;
	cout <<"TLE x " << tle << endl;
	cout <<"RE x " << re << endl;

	return 0;
}

Measured memory_bytes: 3624
def compute():
  from sys import stdin
  N, M = list(map(int, stdin.readline().split()))
  E = [tuple(map(lambda i: int(i) - 1,
                  stdin.readline().split())) for _ in range(M)]

  cnt = [1] * N
  par = [x for x in range(N)] # Disjoint set

  def parent(x):
    if par[x] == x:
      return x
    par[x] = parent(par[x])
    return par[x]

  def joinset(a,b):
    pa, pb = parent(a), parent(b)
    if pa==pb:
      return 0

    x, y = cnt[pa], cnt[pb]
    ret = x * y # decrement value

    # joining set
    if pb > pa:
      pa, pb = pb, pa
    cnt[pa], cnt[pb] = cnt[pa] + cnt[pb], 0
    par[pb] = pa

    return ret


  toprint = []
  cur = N * (N-1) // 2
  for a,b in reversed(E):
    toprint.append(cur)
    # print(cur, cnt, par, sep="\n")
    cur -= joinset(a,b)

  print(*reversed(toprint), sep="\n")


if __name__ == "__main__":
  compute()


Measured memory_bytes: 95452
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())
K = int(input())
X = LI()


def main():
    ans = 0
    for x in X:
        ans += 2 * min(x - 0, K - x);
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import sys

class SamInput(object):
    def __init__(self):
        self.inp = []
        for i in sys.stdin:
            i = i.replace("\n", "")
            j = list(i.split())
            self.inp.append(j)

    def readln(self):
        if len(self.inp) == 0:
            return False
        else:
            return str.join(" ", self.inp.pop(0))

    def read(self):
        if len(self.inp) == 0:
            return False
        while len(self.inp[0]) == 0:
            self.inp.pop(0)
            if len(self.inp) == 0:
                return False
        return self.inp[0].pop(0)

def main():
    inp = SamInput()
    x = inp.read()

    p1 = int(x[:2])
    p2 = int(x[2:])

    posdm = True
    posmd = True

    if p1 < 1 or p1 > 12:
        posmd = False

    if p2 < 1 or p2 > 12:
        posdm = False

    if posdm and posmd:
        print("AMBIGUOUS")
    elif (not posdm) and (not posmd):
        print("NA")
    elif posdm:
        print("YYMM")
    else:
        print("MMYY")


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
typedef long long int lli;
using namespace std;
#pragma region DEBUG
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#pragma endregion DEBUG
#define MOD 1000000007
#define MAX 500005
#define endl "\n"
lli arr[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    
   // freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    lli t;
    t =1 ;
    while(t--){
        string s,t;
        cin>>s>>t;
        int a = s.length();
        int b = t.length();
        int ans = INT_MAX;
        for(int i = 0; i<=(a-b); i++){
            int ctr = 0;
            for(int j = 0; j< b; j++){
                if(t[j] != s[i+j])
                    ctr++;
            }
            ans = min(ans,ctr);
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<pair<int, int>, int> PP;
const ll INFL = 1LL << 20;
const ll MOD = 1000000007;
const int INF = 1000000000;
const int MAX = 300000;
int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

//------------------------------------------------------------------------------------------------------------------------------
int N;
ll M;
vector<ll> A;
ll getCount(ll m) {
    ll ret = 0;
    for (int i = 0; i < N; i++) {
        int idx = lower_bound(A.begin(), A.end(), m - A[i]) - A.begin();
        ret += N - idx;
    }
    return ret;
}
int main(void) {
    cin >> N >> M;
    A.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    ll left = 0, right = INFL;
    while (right - left > 1) {
        ll mid = (left + right) / 2;
        if (getCount(mid) >= M) {
            left = mid;
        } else {
            right = mid;
        }
    }
    vector<ll> sum(N + 1, 0);
    for (int i = 0; i < N; i++) {
        sum[i + 1] = sum[i] + A[i];
    }
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        int idx = lower_bound(A.begin(), A.end(), left - A[i]) - A.begin();
        ans += 1LL * (N - idx) * A[i];
        ans += sum[N] - sum[idx];
    }
    ll cnt = getCount(left);
    ans -= (cnt - M) * left;
    cout << ans << endl;
}

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

#include <bits/stdc++.h>

using namespace std;

class agc022_a {
public:
    void solve(istream& in, ostream& out) {
        string S;
        in >> S;
        for (char c = 'a'; c <= 'z'; ++c) {
            if (S.find(c) == string::npos) {
                out << S + c << "\n";
                return;
            }
        }
        /*int n = S.size();
        for (int i = n - 2; i >= 0; --i) {
            if (S[i] < S.back()) {
                out << S.substr(0, i) + S.back() << "\n";
                return;
            }
        }
        out << -1 << "\n";*/
        string res(S);
        next_permutation(begin(res), end(res));
        if (res < S) {
            out << -1 << "\n";
            return;
        }
        int n = res.size();
        for (int i = 0; i < n; ++i) {
            if (res[i] > S[i]) {
                out << res.substr(0, i + 1) << "\n";
                return;
            }
        }
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	agc022_a solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int i,j,k,n,s=0,p=1, ans=0,a[3][3], b[3][3];
int main() {
    for(i = 0; i < 3;i++) for (j = 0; j < 3; j++) {scanf("%d",&a[i][j]);b[i][j] = 0;}
    scanf("%d",&n);int num[n];
  for (i = 0; i < n; i++){scanf("%d",&num[i]);
  for (j = 0; j < 3; j++){
    for(k = 0; k < 3; k++){
      if(num[i] == a[j][k]) b[j][k] = 1;
    }
  }
  }
  for (i = 0; i < 3;i++) if(b[i][0]&&b[i][1]&&b[i][2]) ans = 1;
  for (i = 0; i < 3;i++) if(b[0][i]&&b[1][i]&&b[2][i]) ans = 1;
  if(b[0][0]&&b[1][1]&&b[2][2]) ans = 1;
  if(b[0][2]&&b[1][1]&&b[0][2]) ans = 1;
  if(ans) puts("Yes");
  else puts("No");
    return 0;
}


Measured memory_bytes: 256
n = int(raw_input())
a = map(int, raw_input().split())

result = [0] * n
for i in range(n):
    if n % 2 == 1:
        result[int(n / 2)] = a[0]
        if i % 2 == 1:
            result[int(n / 2) + int((i + 1) / 2)] = a[i]
        else:
            result[int(n / 2) - int((i + 1) / 2)] = a[i]
    else:
        if i % 2 == 1:
            result[int(n / 2) - int((i + 1) / 2)] = a[i]
        else:
            result[int(n / 2) + int((i + 1) / 2)] = a[i]

import sys
for i in range(n):
    sys.stdout.write(str(result[i]) + ' ')

Measured memory_bytes: 19972
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		while(true){
			int n = sc.nextInt();
			int w = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			int hist[] = new int[101];
			
			int max = 0;
			int right = 0;
//			int input[] = new int[n];
			for(int i = 0; i < n; i++){
				int tmp = sc.nextInt();
				hist[tmp/w]++;
				max = Math.max(max, hist[tmp/w]);
				right = Math.max(right, tmp/w);
			}
			
			//debug
//			System.out.println("max "+max);
//			for(int i = 0; i < hist.length ; i++){
//				System.out.print(hist[i]+" ");
//			}
//			System.out.println();
			
			double result = 0.01;
			
			int bars = right + 1;
			for(int i = 0; i < n; i++){
				result += (double)hist[i]/max * (bars - i - 1)/(bars - 1);
//				System.out.println("i = "+i+" result = "+result);
			}
			
			
			System.out.println(result);
			
		}

	}

}



Measured memory_bytes: 30992
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter
from math import factorial

sys.setrecursionlimit(10**7)
H = int(input())
W = int(input())
N = int(input())

if N%max(H, W)==0:
    print(N//max(H, W))
else:
    print(N//max(H, W) + 1)




Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

int N;
cin >> N;
vvi A(2,vi(N));

rep(i,2) {
    rep(j,N) {
        cin >> A[i][j];
    }
}

vvi dp(2,vi(N));

//dp配列の初期化
rep(i,2) {
    rep(j,N) {
        dp[i][j] = 0;
    }
}

//初期条件
dp[0][0] = A[0][0];
dp[1][0] = A[0][0] + A[1][0];

rep(i,2) {
    for(int j = 1;j < N;j++) {
        chmax(dp[i][j],dp[i][j-1]+A[i][j]);
        if(i == 1) chmax(dp[i][j],dp[i-1][j]+A[i][j]);
    }
}

cout << dp[1][N-1] << endl;

return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

ll exp(ll);

int main() {

	int n; cin >> n;

	pair<pair<string, int>, int> p[110];

	rep(i, 0, n) {
		string s;
		int x;
		cin >> s >> x;
		p[i] = make_pair(make_pair(s, -x), i);
	}

	sort(p, p + n);

	rep(i, 0, n) cout << p[i].second + 1<< endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
   int a,b;
   cin >> a >> b;
   if(a <= 9 && b <= 9){
      cout << a * b << endl;
   }else{
      cout << -1 << endl;
   }
   return 0;
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i];
  sort(ALL(a));
  ll l=-INF-2,r=INF+2;
  while(r-l>=2){
    ll mid=(l+r)/2;
    ll cnt=0;
    rep(i,0,n){
      if(a[i]>=0){
        auto f=[&](ll w){
          return a[i] * w <= mid;
        };
        cnt+=partition_point(ALL(a),f)-a.begin();
      }
      else{
        auto f=[&](ll w){
          return a[i] * w > mid;
        };
        cnt+=a.end()-partition_point(ALL(a),f);
      }
      if(a[i]*a[i]<=mid)cnt--;
    }
    if(cnt/2>=k)r=mid;
    else l=mid;
  }
  cout<<r<<endl;
  return 0;
}

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

using namespace std;

typedef long long ll;
const int MOD = 1000000007;
int n;
int p[1 << 20];
ll fac[1 << 20];
ll st[1 << 20], tot[1 << 20];
ll bit_sum(ll st[], int x) {
  ll ans = 0;
  for (; x; x -= x & (-x)) {
    ans += st[x];
  }
  return ans;
}
void bit_add(ll st[], int x) {
  for (; x <= n; x += x & (-x)) {
    st[x]++;
  }
}

ll k = 0, sm;
ll gao(ll x, ll y, ll z) {
  ll ans = x * fac[n - k] + z * fac[n - k - 1] % MOD * y;
  return ans % MOD;
}
ll gao(ll y, ll z) {
  ll t = fac[n - k];
  if (t % 2 != 0) {
    t += MOD;
  }
  t /= 2;
  ll ans = (sm + z * t) % MOD;
  //  printf("sm=%d\n", sm);
  return ans;
}

int main() {
  scanf("%d", &n);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    if (p[i]) {
      bit_add(tot, p[i]);
      k++;
    }
  }
  ll ans = fac[n - k];
  for (int i = n; i >= 1; i--) {
    if (p[i] != 0) {
      ll x = bit_sum(st, p[i]);
      ll y = p[i] - bit_sum(tot, p[i]);
      ll z = n - i - bit_sum(st, n);
      ans += gao(x, y, z) * fac[n - i];
      //      printf("++%d\n", gao(x, y, z) * fac[n - i]);
      ans %= MOD;
      bit_add(st, p[i]);
      sm += fac[n - k - 1] * (n - k - y);
      //      printf("sm+%d\n",fac[n - k - 1] * (n - k - y));
      sm %= MOD;
    } else {
      ll y = p[i] - bit_sum(tot, p[i]);
      ll z = n - i - bit_sum(st, n);
      //      printf("+%d\n", gao(y, z) * fac[n - i]);
      ans += gao(y, z) * fac[n - i];
      ans %= MOD;
    }
  }
  printf("%d\n", (int)ans);
}


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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//Write From this Line

int n, q; string s;
int main()
{
	cin >> n >> s >> q;
	vector<set<int>> st(26);
	rep(i,n){
		st[s[i]-'a'].insert(i);
	}
	while(q--){
		int type;
		cin >> type;
		if(type == 1){
			//  クエリ1 i文字目をcにする
			int i; char c;
			cin >> i; cin >> c;
			--i;
			st[s[i]-'a'].erase(i);
			s[i] = c;
			st[s[i]-'a'].insert(i);
		} else {
			//  クエリ2　l文字目からr文字目までに何種類現れるか。
			int l, r;
			cin >> l >> r;
			--l, --r;
			int ans = 0;
			rep(i,26){
				auto it = st[i].lower_bound(l);
				if(it == st[i].end()) continue;
				if(*it <= r) ans++;
			}
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 24196
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<iostream>
using namespace std;
long long int lcm(long long int a,long long int b){
  long long int n;
  n=a*b/__gcd(a,b);
  return n;
}
using ll =long long int;
#define ci(a) cin>>a
#define co(a) cout<<a<<endl
#define gcd(a,b) __gcd(a,b)
#define vec vector<ll>
#define For(i,a,b) for(int i=a;i<b;i++)
#define rFor(i,a,b) for(int i=a;i>b;i--)
#define sort(a,b) sort(a.begin(),b.end())
//gcd 最大公約数
//lcm 最小公倍数
//double 少数（変数）
//string 文字列（変数）
//sqrt 平方根
//ceil 天井関数
//floor 床関数
//abs 絶対値
//pow 累乗
//cbrt  立方根
//hypot 平方和の平方根
//(string-'0') 文字列を数字に変換
//vector<vector<int>> data(a,vector<b>(b)) a×b行列
//for(int i=0;i<a;i++)
//for(int j=0;j<b;j++)
//cin>>data.at(i).at(j)  a×b行列の入力
//floor(log10(a)+1) aの10進法での桁数
//ceil(log10(a)) aの10進法での桁数

int main() {
  ll n;
  ci(n);
  vec a(n),b(n),c(n-1);
  For(i,0,n)
    ci(a[i]);
  For(i,0,n)
    ci(b[i]);
  For(i,0,n-1)
    ci(c[i]);
  ll an=0;
  ll d=0,e=0;
  For(i,0,n){
    e=d;
    d=a[i];
    an+=b[a[i]-1];
    if(e!=0&&d==e+1)
      an+=c[e-1];
  }
  co(an);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int N,Y;
  cin >> N >> Y;
  FOR(x,0,N+1) {
    FOR(y,0,N+1-x) {
      if (x*10000 + y*5000 + (N-x-y)*1000 == Y) {
        cout << x << " " << y << " " << N-x-y << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
  return 0;
}

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

int main(){
    int n;
    while(1){
        cin >> n;
        double sum = 0;
        double A[n];
        if (n ==0) break;
        for (int i=0;i<n; i++){
            cin >> A[i];
            sum += A[i];
        }
        double ave = double(sum/n);
        for (int i =0;i<n;i++){
            A[i]= A[i]-ave;
            A[i]= (A[i])*(A[i]);
        }
        double sum2 =0;
        for(int i =0;i<n;i++){
            sum2 += A[i];
        }
        sum2 = double(sum2/n);
        double ans =sqrt(sum2);
        printf("%lf\n",ans);
    }
}


Measured memory_bytes: 3204
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);

	//0500
	static class CardGame {
		void score() {
			for(;;) {
				int n = sc.nextInt();
				if(n==0) break;
				int scoreA=0, scoreB=0;
				for(int i=0; i<n; i++) {
					int ac = sc.nextInt(), bc = sc.nextInt();
					if(ac == bc) {
						scoreA += ac;
						scoreB += bc;
					}else if(ac > bc) {
						scoreA += ac+bc;
					}else {
						scoreB += ac+bc;
					}
				}
				System.out.println(scoreA + " " + scoreB);
			}
		}
	}

	public static void main(String[] args) {
		CardGame cg = new CardGame();
		cg.score();
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k,x;
    cin>>k>>x;
    if (k*500>=x) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
if(a == 1 and b == 0 and c == 0):
    print("Close")
elif(a == 0 and b == 1 and c == 0):
    print("Close")
elif(a == 1 and b == 1 and c == 0):
    print("Open")
elif(a == 0 and b == 0 and c == 1):
    print("Open")
elif(a == 0 and b == 0 and c == 0):
    print("Close")
    


Measured memory_bytes: 5596
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let mut ans = String::from("2018");
    ans.push_str(&s[4..]);
    println!("{}", ans);
}


Measured memory_bytes: 4352
N = int(input())
A = list(map(int,input().split()))
ans = 0
A.sort()
a=0
b=0
c=1

for i in range(N-1):
  if A[i] == A[i+1]:
    a += 1
    b += 1
    c += 1
  elif A[i]+1 == A[i+1]:
    if ans < a:
      ans = a
    a = b
    a += 1
    b = c
    b += 1
    c = 1
  elif A[i]+2 == A[i+1]:
    if ans < a:
      ans = a
    if ans < b:
      ans = b
    a = c
    a += 1
    b = 1
    c = 1
  else:
    if ans < a:
      ans = a
    if ans < b:
      ans = b
    if ans < c:
      ans = c
    a = 1
    b = 1
    c = 1

if ans < a:
      ans = a
if ans < b:
      ans = b
if ans < c:
      ans = c
print(ans)

Measured memory_bytes: 20628
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  string s;
  cin >> s;
  s[1]=s[1]^'R'^'B';
  cout << s << endl;
  return 0;     
}


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

int main() {
	int n;
	cin >> n;
	vector<long long> V(n);
	for (int i = 0; i < n; i++) {
		if (i == 0)cin >> V[i];
		else {
			cin >> V[i];
			V[i] += V[i - 1];
		}
	}
	long long left = 0;
	long long right = 2;
	long long ans = (1 << 30);
	for (long long middle = 1; middle < V.size() - 2; middle++) {
		while (left < middle && abs((V[middle] - V[left]) - V[left]) >= abs((V[middle] - V[left + 1]) - V[left + 1])) {
			left++;
		}
		while (right < V.size() && (abs((V[V.size() - 1] - V[right]) - (V[right] - V[middle])) >= abs((V[V.size() - 1] - V[right + 1]) - (V[right + 1] - V[middle])))) {
			right++;
		}
		ans = min(ans, abs(min({ (V[V.size()-1] - V[right]),(V[right] - V[middle]),(V[middle] - V[left]),V[left] }) - max({ (V[V.size()-1] - V[right]),(V[right] - V[middle]),(V[middle] - V[left]),V[left] })));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
from collections import deque
N = int(input())
div = {}
def dividers(n):
  global div
  i = 2
  while n != i:
    if n % i == 0:
      div[i] = div.setdefault(i, 0) + 1
      n //= i
      i = 2
    else:
      i += 1
  else:
    div[i] = div.setdefault(i, 0) + 1

for n in range(2, N + 1):
  dividers(n)

def f(L):
  ret = 1
  for l in L.values():
    ret *= (l + 1)
  return ret

print(f(div) % (10 ** 9 + 7))


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

int a[200000];
int search(int k){
  if(a[k]==k){return k;}
  int p=search(a[k]);
  a[k]=p;
  return p;
}




int main(){
  for(int i=0;i<200000;i++){
    a[i]=i;
  }
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int p,q;
    cin>>p>>q;
    a[search(p)]=search(q);
  }

  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int s,t;
    cin>>s>>t;
    if(search(s)==search(t)){cout<<"yes"<<endl;}
    else{cout<<"no"<<endl;}
  }

  
  
  return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

double A,B,X;

void solve() {
	int i,j,k,l,r,x,y; string s;
	double pi=atan(1)*4;
	cin>>A>>B>>X;
	
	X/=A;
	
	if(X<=B*A/2) {
		double C=2*X/B;
		double d=atan2(B,C);
		d=d/pi*180;
		_P("%.12lf\n",d);
	}
	else {
		double d=atan2(2*(B-X/A),A);
		d=d/pi*180;
		_P("%.12lf\n",d);
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vecInt = vector<int>;
using vecLong = vector<long long>;
#define rep(i,l,n) for(int i=l;i<n;i++)

const ll mod = ll(1e9) + 7;
const int INF = 1<<29;
const ll lINF = 1l<<40;

ll gcd(ll a,ll b){
    if (a<b){
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b,a%b):a;
}

int main(){
    int n;
    cin >> n;
    ll ans = 0l;
    rep(i,1,n+1) rep(j,1,n+1) rep(k,1,n+1){
        int res = gcd(i,j);
        ans += gcd(res,k);
    }
    cout << ans << "\n";
    return 0;
}

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

const int MAX_N = 3002;

int N;
int a[MAX_N];

int main() {
  int ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    ans += a[i] - 1;
  }
  cout << ans << endl;
}


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

int main() {

  int N, K;
  cin >> N >> K;

  string S;
  cin >> S;

  int count = 0;

  for (int i = 0; i < N - 1; i++) {
    if (S[i] == S[i + 1]) {
      count++;
    }
  }

  int answer = min(count + 2 * K, N - 1);
  cout << answer << endl;

  return 0;
}

Measured memory_bytes: 512
from sys import exit
n=int(input())
h=list(map(int,input().split()))
can = True
if n==2:
    if (h[0]<=h[1]) or (h[0]-1 <= h[1]):
        print("Yes")
    else:
        print("No")
    exit()
for i in range(1,n-1):
    one = h[i-1]
    two = h[i]
    three = h[i+1]
    if (one<=two-1) and (two-1<=three):
        h[i]-=1
    elif (one<=two) and (two<=three):
        None
    else:
        print("No")
        exit()
print("Yes")


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define DUP(x, y) (((x) + (y) - 1) / (y))
#define YES puts("YES")
#define NO puts("NO")
#define Yes puts("Yes")
#define No puts("No")
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end())

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using vstr = std::vector<std::string>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    string s;
    cin >> s;
    rep(i, s.length()) {
        if (s[i] == '9')s[i] = '1';
        else if (s[i] == '1')s[i] = '9';
    }
    cout << s << endl;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int N, M;
int ans = 0;
int count = 0;
vector<int>G[10];
vector<bool>visited(10, false);
void def(int n,int count) {
	if (visited[n]) {
		return;
	}
	if (count == N - 1) {
		ans++;
		return;
	}
	visited[n] = true;
	for (int a : G[n]) {
		def(a, count + 1);
	}
	visited[n] = false;
	return;
}
int main() {
	cin >> N >> M;
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	def(0, 0);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String args[]){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String tmp = null;
		int cup = 0;
		int mun = 0;
		int ter = 0;
		String[] rrr;
		int st = 0,sr = 0;
		int mon = 0;
		int[] m = {31,29,31,30,31,30,31,31,30,31,30,31};
		
		
		while(true){
			
			try {
				tmp = br.readLine();
			} catch (IOException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			
			if(tmp == null){
				break;
			}
			
			if(tmp.equals("")){
				break;
			}
			
			rrr = tmp.split(" ");
			
			for(int i=0;i<rrr.length;i++){
				
				if(rrr[i].length() >= st){
					st = rrr[i].length();
					ter = i;
				}
				sr = 0;
				for(int j=0;j<rrr.length;j++){
					if(rrr[i].equals(rrr[j])){
						sr++;
					}
				}
				if(sr >=mun){
					mun = sr;
					cup = i;
				}
				
			}
			
			System.out.println(rrr[cup]+" "+rrr[ter]);
			
		}
	}

}

Measured memory_bytes: 16896
var     st:ansistring;
        i,j:longint;
        kt:boolean;
begin
    readln(st);
    i:=1;
    j:=length(st);
    while i < j do 
        if (st[i] <> st[j]) then 
            begin
                kt:=true;
                break;
            end
        else 
            begin
                inc(i);
                dec(j);
            end;
    i:=1;
    j:=(length(st)-1) div 2;
    while i < j do 
        if (st[i] <> st[j]) then 
            begin
                kt:=true;
                break;
            end
        else 
            begin
                inc(i);
                dec(j);
            end;
    j:=length(st);
    i:=(length(st)+3) div 2;
    while i < j do 
        if (st[i] <> st[j]) then 
            begin
                kt:=true;
                break;
            end
        else 
            begin
                inc(i);
                dec(j);
            end;
    if (kt = false) then writeln('Yes')
    else 
        writeln('No');
end.

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main() {
    while(true) {
        int n;
        cin >> n;
        if(n == 0) break;
        vector<int> point(n);
        int sum = 0;
        for(int i = 0; i < n; i++) {
            cin >> point.at(i);
            sum += point.at(i);
        }
        double ave = (double)sum/(double)n;
        double sumdiv = 0.0;
        for(int i = 0; i < n; i++) {
            sumdiv += pow((double)point.at(i)-ave,2);
        }
        cout << sqrt(sumdiv/(double)n) << endl;
    }
}


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

template <typename T> T gcd(T x, T y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

template <typename T> T lcm(T x, T y) {
  if (x == 0 || y == 0)
    return 0;
  return x / gcd(x, y) * y;
}

int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}

vector<int> p;
vector<int> r;

void init(int n) {
  p.reserve(n);
  r.reserve(n);
  for (int i = 0; i < n; i++) {
    p[i] = i;
    r[i] = 0;
  }
}

int root(int x) { return p[x] == x ? x : p[x] = root(p[x]); }

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

void unite(int x, int y) {
  x = root(x);
  y = root(y);
  if (x == y)
    return;

  if (r[x] < r[y])
    p[x] = y;
  else {
    p[y] = x;
    if (r[x] == r[y])
      r[x]++;
  }
}

int main() {
  int N, K;
  cin >> N >> K;
  int ans = 0;
  K--;
  N--;
  while (N > 0) {
    N -= K;
    ans++;
  }
  cout << ans << endl;
}


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

int main(){
  int c;
  while(1){
    c = 0;
    int n,x;
    cin >> n >> x;
    cin.ignore();
    if((n == 0)&&(x == 0)){
      break;
    }else{
      for(int i=1;i<=n;i++){
	for (int j=i+1;j<=n;j++){
	  for(int k=j+1;k<=n;k++){
	    if(i+j+k == x){
	      c = c +1;
	    }
	  }
	}
      }
      cout << c << endl;
    }
  }
  return 0;
} 



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

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

    bool exist_flag=false;
    for (int i=0; i<S.size(); i++){
        if (S[i]=='7'){
            exist_flag=true;
            break;
        }
    }

    if (exist_flag==true){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3588
# AOJ 1210: Die Game
# Python3 2018.7.22 bal4u

dic = {'s':1, 'w':2, 'e':3, 'n':4}
rot = [[0,1,2,3,4,5,6],[0,2,6,3,4,1,5],[0,4,2,1,6,5,3],[0,3,2,6,1,5,4],[0,5,1,3,4,6,2]]
	
while True:
    n = int(input())
    if n == 0: break
    dice = [i for i in range(7)]
    for j in range(n):
        a = input()[0]
        dice = [dice[rot[dic[a]][i]] for i in range(7)]
    print(dice[1])


Measured memory_bytes: 5608