akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    
    int N;
    int Total = 0;
    cin >> N;
    
    for( int i = 1; i <= N; i++ ){
        
        Total = Total + 800;
        
        if( i%15 == 0 ){
            Total = Total - 200;
        }
    }
    
    cout << Total;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int m = 0;
  for (int i = 0; i < n; i++) cin >> a[i], m = max(m,a[i]);
  int ans = 0, k = m/2;
  for (int i = 0; i < n; i++) {
    if (abs(m/2 - a[i]) < k) {
      ans = a[i];
      k = abs(m/2 - a[i]);
    }
  }
  cout << m << " " << ans << endl;
  return 0;
}

Measured memory_bytes: 3684
k,n = map(int,input().split())

a = input().split()

point = k - int(a[-1]) + int(a[0])

for i in range(n-1):
    b = int(a[i+1]) - int(a[i])
    if point < b:
        point = b
sum_a = k - point
print(sum_a)

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

const int MOD = 1000000007;

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

  int n, m; cin >> n >> m;
  vector<int> a(n+1, 1);
  for(int i=0; i<m; i++) {
    int x; cin >> x;
    a[x] = 0;
  }

  vector<int> dp(n+1, 0);
  dp[0] = 1;

  for(int i=1; i<=n; i++) {
    if(a[i]) dp[i] = (dp[i-1] + (i>=2 ? dp[i-2] : 0)) % MOD;
  }

  cout << dp[n] << endl;

  return 0;
}


Measured memory_bytes: 1024
#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 rep(i, n)        for(int i=0; i<(int)(n); ++i)
#define ll  long long 
  vector<ll>to[1000005];
int main(){
  ll a;cin>>a;
  for(ll i=sqrt(a);i>0;i--){
    if(a%i==0){
      ll b=0;
      ll c=a/i;
      while (c)
      {
        b++;
        c/=10;
      }
      cout<<b;
      return 0; 
    }
  }
}


Measured memory_bytes: 23680
N = int(input())
a = sorted(list(map(int, input().split())))
MOD = 10 ** 9 + 7
if N % 2 == 0:
    for i in range(1, N, 2):
        if a[i - 1] == a[i] == i:
            continue
        break
    else:
        print(2 ** (N // 2) % MOD)
        exit()
else:
    if a[0] == 0:
        for i in range(2, N, 2):
            if a[i - 1] == a[i] == i:
                continue
            break
        else:
            print(2 ** (N // 2) % MOD)
            exit()
print(0)

Measured memory_bytes: 13880
#include <cstdio>
#include <cstring>

const int HASH_SIZE = 1046527;

int hash_table[HASH_SIZE] = {0}; // {0, 0, 0, ...}

int gen_key(const char str[], const int& str_len)
{
  int key = 1;

  // e.g. ACGT -> 101101100b
  for (int i = 0; i < str_len; ++i)
  {
    key <<= 2;
    switch (str[i])
    {
      case 'A':
      {
        key += 1;
        break;
      }
      case 'C':
      {
        key += 2;
        break;
      }
      case 'G':
      {
        key += 3;
        break;
      }
      default:
        break;
    }
  }

  return key;
}

int gen_hash1(const int& key)
{
  return key % HASH_SIZE;
}

int gen_hash2(const int& key)
{
  return key % (HASH_SIZE - 1);
}

int gen_hash(const int& key, const int& i)
{
  return (gen_hash1(key) + i * gen_hash2(key)) % HASH_SIZE;
}

void insert_hash(const int& key)
{
  int i = 0, j;
  while (true)
  {
    j = gen_hash(key, i);
    if (hash_table[j] == 0)
    {
      hash_table[j] = key;
      return;
    }
    else
    {
      ++i;
    }
  }
}

bool search_hash(const int& key)
{
  int i = 0, j;
  while (true)
  {
    j = gen_hash(key, i);
    if (hash_table[j] == key)
    {
      return true; // Found
    }
    else if (hash_table[j] == 0 || i >= HASH_SIZE)
    {
      return false; // Not found
    }
    else
    {
      ++i; // Next hash value
    }
  }
}

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

  char command[6];
  char str[12];
  int key;
  for (int i = 0; i < n; ++i)
  {
    scanf("%s%s", command, str);
    key = gen_key(str, strlen(str));

    if (command[0] == 'i')
    {
      insert_hash(key);
    }
    else
    {
      if (search_hash(key))
      {
        printf("yes\n");
      }
      else
      {
        printf("no\n");
      }
    }
  }

  return 0;
}



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

int main() {
	
	int n, m;
	cin >> n >> m;
	vector<int> a(n);
	vector<pair<int, int>> p(m);
	rep(i, n) cin >> a[i];
	rep(i, m){
		int b, c;
		cin >> b >> c;
		p[i] = make_pair(c, b);
	}
	sort(a.begin(), a.end());
	sort(p.begin(), p.end(), greater<pair<int, int>>());
	
	int j = 0;
	rep(i, n){
		if(a[i] < p[j].first){
			a[i] = p[j].first;
			p[j].second--;
			if(p[j].second == 0){
				if(j < m - 1) j++;
				else break;
			}
		}else{
			break;
		}
	}
	
	ll ans = 0;
	rep(i, n){
		ans += a[i];
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 1408
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    count = 0
    if b[0] >= a[0]:
        b[0] -= a[0]
        count += a[0]
    else:
        count += b[0]
        b[0] = 0
    for i in range(1, n):
        if b[i - 1] >= a[i]:
            count += a[i]
        else:
            a[i] = a[i] - b[i - 1]
            count += b[i - 1]
            if b[i] > a[i]:
                b[i] -= a[i]
                count += a[i]
            else:
                count += b[i]
                b[i] = 0
    if b[n - 1] >= a[n]:
        b[n - 1] -= a[n]
        count += a[n]
    else:
        count += b[n - 1]
        b[n - 1] = 0
    print(count)


Measured memory_bytes: 19004
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
n,m = LI()
A = [LI() for _ in range(n)]
B = [I() for _ in range(m)]
for i in range(n):
    temp = 0
    for j in range(m):
        temp += A[i][j]*B[j]
    print(temp)


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

#ifdef DEBUG
#include ".inc/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

long long cnt[210000];
vector<int> G[210000];

void update(int u, int prev) {
    for (int v : G[u]) {
        if (v == prev) continue;
        cnt[v] += cnt[u];
    }
    for (int v : G[u]) {
        if (v == prev) continue;
        update(v, u);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    int N, Q;
    cin >> N >> Q;

    for (int i = 0; i < N - 1; ++i) {
        int a, b;
        cin >> a >> b;
        G[a - 1].push_back(b - 1);
        G[b - 1].push_back(a - 1);
    }

    for (int i = 0; i < Q; ++i) {
        int p, x;
        cin >> p >> x;
        cnt[p - 1] += x;
    }
    update(0, -1);

    for (int i = 0; i < N; ++i) {
        cout << (i == 0 ? "" : " ") << cnt[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 24576
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N=ri()
ans = 0
for n in range(1,N+1,2):
    res = 0
    for i in range(1,n+1):
        if n%i==0:
            res += 1
    if res == 8:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
#define me(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=500005;
int main()
{
	int n,m,sum=0;
	cin>>n>>m;
	while(n>0)
	{
		sum++;
		n/=m;
	}
	cout<<sum;
}

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

using namespace std;

int main(void){
    int N;
    scanf("%d", &N);
    vector<int> A(N);
    for(int i = 0; i < N; i++)
        scanf("%d", &A[i]);

    vector <int> B = A;

    sort(B.begin(), B.end());

    for(const auto& e : A){
        if(e == B[B.size() - 1])
            cout << B[B.size() - 2] << "\n";
        else
            cout << B[B.size() - 1] << "\n";
    }

    return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int main()
{
	fast;
	ll a,b,c,k,sum=0;
	cin>>a>>b>>c>>k;
	if(k-a>=0){
		sum=a;
		k-=a;
		if(k-b>=0){
			k-=b;
			if(k>=0)
				sum-=k,cout<<sum;
			else
				cout<<sum;
		}
		else{
			cout<<sum;
		}
	}
	else
		cout<<k<<endl;
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <algorithm>

using namespace std;

int n, a, b;
int t[1000];
int main() {
  
  scanf("%d %d %d", &n, &a, &b);
  
  for (int i = 0; i < n; i++)
    scanf("%d", t+i);
  sort(t, t+n);
  printf("%d\n", n - (int)(upper_bound(t, t+n, b-1) - lower_bound(t, t+n,a)));
  
  
  return 0;
  
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(){
	long int larger, smaller;
  long int a, b;
  cin>>a;
  cin>>b;
  if(a>=b){
  	larger = a;
    smaller = b;
  }
  else{
    larger = b;
  smaller = a;
  }
  long int i = 1;
  while(1){
  	if((larger*i)%smaller == 0)
      break;
    i++;
  }
  cout<< larger*i<<endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X = map(int, input().split())
    x = map(int, input().split())
    Y = list(map(lambda x: abs(x-X),x))
    V = Y[0]
    for i in range(1,N):
        V = gcd(V, Y[i])
    print(V)

if __name__ == '__main__':
    main()

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

int main()
{
  int n,tt,hh,l;
  cin>>n>>tt>>hh>>l;
  int now=0;
  int t[n];
  int h[n];
  for(int i=0;i<n;i++)
    {
      cin>>t[i]>>h[i];
    }
  int pri=0;
  while(true)
    {
      if(t[now]>0)
	{
	  t[now]--;
	  pri+=10;
	  tt++;
	}
      else if(h[now]>0)
	{
	  h[now]--;
	  pri+=100;
	  hh++;
	}
      else
	{
	  break;
	}
      if(tt>l)
	break;
      if(pri>=90)
	{
	  pri-=90;
	  while(pri/10>tt)
	    {
	      pri-=100;
	      hh--;
	      h[now]++;
	      if(pri<0||hh<0)
		{
		tt=-999;
		break;
		}
	    }
	  if(tt==-999)
	    break;
	  tt-=pri/10;
	  t[now]+=pri/10;
	  pri=0;
	}
      now++;
      if(now>=n)
	now=0;
    }
  cout<<now+1<<endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
long long m,n,s=0,a,i;
int main()
{
    cin>>m>>n;
    for (i=1;i<=n;i++)
    {
        cin>>a;
        s+=a;
    }
    if (m-s>=0) cout<<m-s;
    else cout<<"-1";
}


Measured memory_bytes: 3636
#include<iostream>
#include<complex>
#include<cmath>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef complex<double> P;
const double PI =acos(-1);
const double eps = 1e-6;
double table[40][40][41];

P convert(double r){
  const P ori(1,0);
  double theta=r<eps?0:2*PI*r;
  P ret(ori.real()*cos(theta)-ori.imag()*sin(theta),
	ori.real()*sin(theta)+ori.imag()*cos(theta));
  return ret;
}

double Polygon_Area(P c,P d,P e){
  P a[3]={c,d,e};
  int n=3;
  double sum=0;
  rep(i,n){
    sum+=(a[i%n].real()-a[(i+1)%n].real())*(a[i%n].imag()+a[(i+1)%n].imag());
  }
  if ( sum<0)sum*=-1;
  return sum/2;
}



double solve(int n,int m,double *r){
  complex<double> in[n];
  rep(i,n)in[i]=convert(r[i]);

  rep(i,n)rep(j,n)rep(k,m+1)table[i][j][k]=0;
  
  rep(i,n){//start point
    table[i][i][1]=0;
    REP(j,i,n){//last point
      REP(k,2,m){
	REP(l,j+1,n){//nextpoint
	  table[i][l][k+1]=max(table[i][l][k+1],
			       table[i][j][k]+Polygon_Area(in[i],in[j],in[l])
			       );
	}
      }
    }
  }
  

  double ans=0;
  rep(i,n){
    rep(j,n)ans = max(table[i][j][m],ans);
  }
  return ans;
}

main(){
  int n,m;
  while(cin>>n>>m && n){
    double r[n];
    rep(i,n)cin>>r[i];
    printf("%.6lf\n",solve(n,m,r));
  }
}

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

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

const int N=100+5;
int a[N],cnt[N];
int n,L,L2;

ll ans;
void dfs(int x,ll s)
{
	if(x>L)
	{
		rep(i,L+1,L2)
		if(!cnt[i])
		{
			if(!cnt[i*2])
			{
				if(a[i]+a[i*2]<0)s-=a[i]+a[i*2];
			}
			else
			{
				if(a[i]<0)s-=a[i];
			}
		}
		if(s>ans)ans=s;
		return ;
	}
	dfs(x+1,s);
	if(cnt[x]||a[x]>=0)return ;
	for(int y=x;y<=n;y+=x)
	if(++cnt[y]==1)s-=a[y];
	dfs(x+1,s);
	for(int y=x;y<=n;y+=x)--cnt[y];
}

int main()
{
	cin>>n;
	rep(i,1,n)cin>>a[i];
	L=n/3;L2=n/2;
	rep(i,1,n)	
	{
		for(int j=i;j<=n;j+=i)
		if(a[j]>0)goto End;
		for(int j=i;j<=n;j+=i)a[j]=0;
		End : ;	
	}

	ll s=0;
	rep(i,1,n)s+=a[i];
	ans=s;
	dfs(1,s);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
// Bismillahir Rahmanir Rahim
// Mr_Emrul

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

typedef long long int ll;
typedef pair <ll, ll> pll;
typedef pair <ll, pll> plp;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
const ll MX = 100005;

#define LCM(a,b)        (a / __gcd(a,b) ) *-b
#define gcd(a,b)        __gcd(a,b)
#define all(x)          (x).begin(), (x).end()
#define mem(a, n)       memset(a,n,sizeof(a))
#define for1(i, n)      for(i=1; i<=n; i++)
#define for0(i, n)      for(i=0; i<n; i++)
#define rof0(i, n)      for(i=n-1; i>=0; i--)
#define rof1(i, n)      for(i=n; i>=1; i--)
#define forab(i, a, b)  for(i=a; i<=b; i++)
#define rofab(i, a, b)  for(i=b; i>=a; i--)
#define pb              push_back
#define pbb             pop_back
#define YES             cout << "YES" << endl
#define NO              cout << "NO" << endl
#define sin(s)          getline(cin, s)
#define scf(a)          cin >> a
#define scf2(a, b)      cin >> a >> b
#define scf3(a, b, c)   cin >> a >> b >> c
#define scf4(a,b,c,d)   cin >> a >> b >> c >> d
#define pnf(a)          cout << (a) << endl
#define pnf2(a, b)      cout << (a) << " " << (b) << endl
#define pnf3(a, b, c)   cout << (a) << " " << (b) << " " << (c) << endl
#define pnfa(a)         cout << (a) << " "
#define pf(a)           cout << (a)
#define sp              cout << " "
#define nl              cout << endl
#define sz(n)           n.size()
#define clear(v)        v.clear()
#define bug(n)          cout << ">> " << n << " <<" << endl
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define in              freopen("in.txt", "r", stdin)
#define out             freopen("out.txt", "w", stdout)
#define fast            ios_base::sync_with_stdio(false);
#define F               first
#define S               second
#define mpp             make_pair

ll ar[MX], br[MX];
//ll ans[MX];
//vector <ll> v;
//map <ll, ll> mp, st, xx;
//map <string, ll> mps;
//map <ll, string> mpi;
//map <char, ll> mpc;
//set <ll> st;
string s;


int main()
{
    ll n, m, t, a, b, c, x, y, sum=0, cnt=0, i, j, k;
    string s1, s2, s3;
    scf3(s1,s2,s3);
    pf((char)toupper(s1[0]));
    pf((char)toupper(s2[0]));
    pf((char)toupper(s3[0]));
    nl;
    return 0;
}


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

int N;
vector<int> a;

int main()
{
    cin >> N;
    a.resize(3 * N);
    for (auto &v : a) cin >> v;

    vector<lint> s1(N + 1), s2(N + 1);

    priority_queue<int, vector<int>, greater<int> > q1;
    priority_queue<int> q2;
    lint sum1 = 0, sum2 = 0;
    for (int i = 0; i<N; i++)
    {
        q1.push(a[i]);
        q2.push(a[3 * N - 1 - i]);
        sum1 += a[i];
        sum2 += a[3 * N - 1 - i];
    }
    s1[0] = sum1;
    s2[N] = sum2;
    for (int i = 0; i < N; i++)
    {
        if (a[i+N] > q1.top())
        {
            sum1 -= q1.top();
            q1.pop();
            q1.push(a[i + N]);
            sum1 += a[i + N];
        }
        s1[i + 1] = sum1;
        if (a[2 * N - 1 - i] < q2.top())
        {
            sum2 -= q2.top();
            q2.pop();
            q2.push(a[2 * N - 1 - i]);
            sum2 += a[2 * N - 1 - i];
        }
        s2[N - 1 - i] = sum2;
    }
    lint max_ = s1.back() - s2.back();
    for (int i = 0; i<N; i++)
    {
        max_ = max(max_, s1[i] - s2[i]);
    }
    cout << max_ << endl;
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

ll fac[510000], finv[510000], inv[510000];

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

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    if((S[0] == S[1] && S[1] == S[2]) || (S[1] == S[2] && S[2] == S[3])){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3616
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define flash_all ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b


using namespace std;



int main() {
    char s;
    cin>>s;
    if(s>=65 && s<=90){
		cout<<"A"<<nl;
    }
    else{
		cout<<"a"<<nl;
    }
}
//Happy Coding.....


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;

int n;
ll a[20][20];
ll dp[(1 << 16) + 3];

ll f(int s) {
	ll ret = 0;
	for (int i = 0; i < n; i++) {
		if (!((s >> i) & 1)) continue;
		for (int j = 0; j < n; j++) {
			if (!((s >> j) & 1)) continue;
			ret += a[i][j];
		}
	}
	return ret / 2;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) cin >> a[i][j];
	}
	for (int s = 1; s < (1 << n); s++) dp[s] = f(s);
	for (int s = 1; s < (1 << n); s++) {
		for (int t = s; t > 0; t = (t - 1)&s) {
			dp[s] = max(dp[s], dp[s&~t] + dp[t]);
		}
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;
}

Measured memory_bytes: 768
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var AV = Console.ReadLine().Split().Select(BigInteger.Parse).ToArray();
            var BW = Console.ReadLine().Split().Select(BigInteger.Parse).ToArray();
            var T = BigInteger.Parse(Console.ReadLine());
            if (AV[0] > BW[0])
            {
                Console.WriteLine((AV[0] - AV[1] * T) <= ((BW[0] - BW[1] * T)) ? "YES" : "NO");
            }
            else
            {
                Console.WriteLine((AV[0] + AV[1] * T) >= ((BW[0] + BW[1] * T)) ? "YES" : "NO");
            }

        }
    }
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n;
  cin >> n;
  int count[n] = {0};
  for(int x=1;x<=100;x++){
    for(int y=1;y<=100;y++){
      for(int z=1;z<=100;z++){
        int value = x*x + y*y + z*z +x*y + y*z + z*x;
        if(value<=n) count[value-1]++;
      }
    }
  }
  for(int64_t i=0;i<n;i++){
	cout << count[i] << endl;
  }
  return 0;
}




Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  
  if(A == B) cout << C << endl;
  else if(A == C) cout << B << endl;
  else cout << A << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int n=in.nextInt();
        int m=in.nextInt();
        Student [] students=new Student[n];
        for (int i = 0; i <n ; i++) {
            students[i]=new Student(in.nextLong(),in.nextLong());
        }
        Point points[]=new Point[m];
        for (int i = 0; i <m ; i++) {
            points[i]=new Point(in.nextLong(),in.nextLong());
        }
        long[]arr=new long[n];

        for (int i = 0; i <n ; i++) {
            long x=Long.MAX_VALUE;
            int val=-1;
            for (int j = 0; j <m ; j++) {
                long dist=Math.abs(students[i].x-points[j].x)+Math.abs(students[i].y-points[j].y);
                if(x>dist){
                    x=dist;
                    val=j;
                }

            }
            arr[i]=val+1;

        }
        for (long e:arr
             ) {
            System.out.println(e);
        }
    }
}
class Student {
    long x,y;
    public Student(long x,long y){
        this.x=x;
        this.y=y;
    }

}
class Point{
    long x,y;
    public Point(long xx,long yy){
        x=xx;
        y=yy;
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cctype>
#include <string>
#include <map>
#include <set>
#include <math.h>
#include <cmath>
#define ll long long

using namespace std;
using P = pair<int,int>;

int main(){

  string S;
  ll K;
  cin >> S >> K;

 for (int i = 0; i < min((long long)S.size(), K); i++) {
    if(S[i] >= '2') {
      cout << S[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;

  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = int(2e5) + 3;
const int oo = int(1e9) + 7;

vector<int> l, h, st, lz;

void Init(int n) {lz.resize(4 * n + 1); l.resize(4 * n + 1), h.resize(4 * n + 1), st.resize(4 * n + 1);}
void Build(int x, int low, int high) {
    l[x] = low, h[x] = high; st[x] = lz[x] = oo;
    if(l[x] == h[x]) return;
    int mid = (l[x] + h[x]) >> 1;
    Build(x << 1, low, mid);
    Build(x << 1 | 1, mid + 1, high);
}
void Down(int x) {
    if(lz[x] == oo || l[x] == h[x]) return;
    st[x << 1] = min(st[x << 1], lz[x]), lz[x << 1] = min(lz[x << 1], lz[x]);
    st[x << 1 | 1] = min(st[x << 1 | 1], lz[x]), lz[x << 1 | 1] = min(lz[x << 1 | 1], lz[x]);
    lz[x] = oo;
}
void Update(int x, int low, int high, int val) {
    Down(x);
    if(l[x] > high || h[x] < low) return;
    if(l[x] >= low && h[x] <= high) {
        st[x] = min(st[x], val); lz[x] = min(lz[x], val); return;
    }
    Update(x << 1, low, high, val);
    Update(x << 1 | 1, low, high, val);
    st[x] = min(st[x << 1], st[x << 1 | 1]);
}
int Get(int x, int pos) {
    Down(x);
    if(l[x] > pos || h[x] < pos) return oo;
    if(l[x] == pos && h[x] == pos) return st[x];
    if(h[x << 1] >= pos && pos >= l[x << 1]) return Get(x << 1, pos);
    return Get(x << 1 | 1, pos);
}

typedef pair<int, int> pii;
struct TEvent {
    int s, t, x;
} e[N];
int n, Q, q[N];
vector<int> v;

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> Q;
    for(int i = 1; i <= n; ++i) {
        cin >> e[i].s >> e[i].t >> e[i].x;
        e[i].s = max(e[i].s - e[i].x, 0), e[i].t -= (e[i].x + 1);
        if(e[i].t < 0) continue;
        v.pb(e[i].s), v.pb(e[i].t);
    }
    for(int i = 1; i <= Q; ++i) {
        cin >> q[i]; v.pb(q[i]);
    }
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(), v.end()), v.end());
    Init((int)v.size());
    Build(1, 1, int(v.size()));
    for(int i = 1; i <= n; ++i) {
        if(e[i].t < 0) continue;
        if(e[i].s <= e[i].t) Update(1, lower_bound(v.begin(), v.end(), e[i].s) - v.begin() + 1,
                                    lower_bound(v.begin(), v.end(), e[i].t) - v.begin() + 1, e[i].x);
    }
    for(int i = 1; i <= Q; ++i) {
        int ans = Get(1, lower_bound(v.begin(), v.end(), q[i]) - v.begin() + 1);
        if(ans == oo) cout << "-1\n";
        else cout << ans << '\n';
    }
}


Measured memory_bytes: 44396
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long max = a * c;
        max = Math.max(max, a * d);
        max = Math.max(max, b * c);
        max = Math.max(max, b * d);

        System.out.print(max);
    }


}



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

int main(){

    int N;
    cin >> N;

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

    int s1,s2,m;
    m=100000;
    for(int i=1;i<N;i++){
        s1 = accumulate(W.begin(),W.begin()+i,0);
        s2 = accumulate(W.begin()+i,W.end(),0);
        if(m>abs(s1-s2))m=abs(s1-s2);
    }

    cout << m <<endl;

    return 0;
}

Measured memory_bytes: 256
n,k = map(int,input().split())
p = [0]+list(map(int,input().split()))
kit = [0]*(max(p)+1)
for i in range(1,max(p)+1):
    kit[i] = (i*(i+1)//2)/i
for i in range(n):
    p[i+1] = kit[p[i+1]]
    p[i+1] +=p[i]
ans = 0
for i in range(n):
    l = i
    r = i+k
    if r >n:break
    s = p[r] - p[l]
    ans = max(ans,s)
print(ans)


Measured memory_bytes: 25060
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <complex>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 1000000007;
long long INF = 1000000000000000; //10^15
typedef long long ll;
typedef unsigned long long ull;


ll powMod(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll t = powMod(x, n/2, mod);
  t = t * t % mod;
  if (n & 1) return t * x % mod;
  return t;
}

int main(void) {

  int h, w, k;
  cin >> h >> w >> k;
  char s[20][2000];
  rep(i, h) cin >> s[i];

  vector<int> v;
  int ans = 100000000, tmp;
  for (int lp = 1; lp < 1 << h; lp++) {
    bool ff = false;
    if (((lp >> (h - 1)) & 1) == 0) continue;
    tmp = 0;
    v.clear();
    rep(i, h) {
      if ((lp >> i) & 1) v.push_back(i);
    }
    int n = v.size();
    tmp += n - 1;
    
    int r[20] = {};
    
    rep(i, w) {
      int t[20] = {};
      rep(j, n) {
	if (j == 0) {
	  for (int k = 0; k <= v[j]; k++) {
	    r[j] += (int)(s[k][i] - '0');
	    t[j] += (int)(s[k][i] - '0');
	  }
	} else {
	  for (int k = v[j - 1] + 1; k <= v[j]; k++) {
	    r[j] += (int)(s[k][i] - '0');
	    //cout << r[j] << endl;
	    t[j] += (int)(s[k][i] - '0');
	  }
	}
      }
      bool f = false;
      rep(j, n) if (r[j] > k) f = true;
      if (f) {
	rep(j, n) {
	  r[j] = t[j];
	  if (t[j] > k) ff = true;
	}
	tmp++;
      }
    }
    if (ff) continue;
    //cout << tmp << endl;
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;

class Main {

    public static void main(String[] args) {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        
        try {

            String[] line = reader.readLine().split(" ");

            int W = Integer.parseInt(line[0]);
            int H = Integer.parseInt(line[1]);
            int x = Integer.parseInt(line[2]);
            int y = Integer.parseInt(line[3]);
            int r = Integer.parseInt(line[4]);
            
            boolean flag_width  =(x > 0) && (x - r >= 0) && (x + r <= W);
            boolean flag_height =(y > 0) && (y - r >= 0) && (y + r <= H);
            
            if (flag_width && flag_height) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }

        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}

Measured memory_bytes: 24468
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    int a,b; cin>>a>>b;
    if(a+b>=10){
        cout<<"error"<<endl;
    }else{
        cout<<a+b<<endl;
    }
    
}


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

   	vector<long long> a;

	long long deal (long long s) {
		long long res = 0;
		for ( int i=1; i<a.size(); i++) {
			if(s > 0) {
				s+=a[i];
				if(s >= 0) {
					res+=s+1;
					s=-1;
				}
			} else {
				s+=a[i];
				if(s <= 0) {
					res+=1-s;
					s=1;
				}
			}
		}
		return res;
		
	}
     
    int main() {
    	int n;
    	cin >> n;
    	for (int i=0; i<n; i++) {
    		long long x;
    		cin >> x;
    		a.push_back(x); 
    	}
	
		if(a[0] == 0) cout << min(deal(1)+1, deal(-1)+1);
		else if ( a[0] > 0) cout << min(deal(a[0]), deal(-1)+a[0]+1);
		else cout << min(deal(a[0]), deal(1)+1-a[0]);
     
    	return 0;
    }


Measured memory_bytes: 1400
#ifndef CLASS_FENWICKTREE
#define CLASS_FENWICKTREE

#include <cstddef>

template <class type>
class fenwick_tree {
private:
	std::size_t n, sz;
	type* val;
public:
	fenwick_tree() : n(0), sz(0) {};
	fenwick_tree(std::size_t n_) : n(n_) {
		sz = 1; while (sz < n) sz *= 2;
		val = new type[sz + 1]();
	}
	template <class InputIterator>
	fenwick_tree(InputIterator first, InputIterator last) : n(last - first) {
		sz = 1; while (sz < n) sz *= 2;
		val = new type[sz + 1]();
		std::size_t cur = 0;
		for (InputIterator it = first; it != last; ++it) val[++cur] += *it;
		for (std::size_t i = 1; i < sz; ++i) val[i + (i & ~(i - 1))] += val[i];
	}
	~fenwick_tree() { delete[] val; }
	void add(std::size_t pos, type delta) {
		for (std::size_t i = pos + 1; i <= sz; i += i & ~(i - 1)) {
			val[i] += delta;
		}
	}
	type getsum(std::size_t r) const {
		type ans = 0;
		for (std::size_t i = r; i >= 1; i -= i & ~(i - 1)) {
			ans += val[i];
		}
		return ans;
	}
	type getsum(std::size_t l, std::size_t r) const {
		return getsum(r) - getsum(l);
	}
	std::size_t binary_search(type threshold) const {
		if (threshold <= 0) return 0;
		std::size_t ans = 0;
		for (std::size_t i = sz / 2; i >= 1; i >>= 1) {
			if (threshold > val[ans + i]) {
				threshold -= val[ans + i];
				ans += i;
			}
		}
		return ans + 1;
	}
};

#endif // CLASS_FENWICKTREE

#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int Q;
	cin >> Q;
	vector<int> tp(Q);
	vector<long long> a(Q), b(Q), ca, ta;
	for (int i = 0; i < Q; ++i) {
		cin >> tp[i];
		if (tp[i] == 1) {
			cin >> a[i] >> b[i];
			ca.push_back(a[i]);
		}
	}
	sort(ca.begin(), ca.end());
	ta = ca;
	int S = ca.size();
	fenwick_tree<long long> bita(S), bitb(S);
	long long sb = 0;
	int cnt = 0;
	for (int i = 0; i < Q; ++i) {
		if (tp[i] == 1) {
			int ptr = lower_bound(ta.begin(), ta.end(), a[i]) - ta.begin();
			sb += b[i];
			bita.add(ptr, 1);
			bitb.add(ptr, a[i]);
			--ta[ptr];
			++cnt;
		}
		else {
			int ptr = bita.binary_search((cnt + 1) / 2);
			long long ans = 0;
			if (cnt % 2 == 0) {
				ans = bitb.getsum(ptr, S) - bitb.getsum(0, ptr);
			}
			else {
				ans = bitb.getsum(ptr, S) - bitb.getsum(0, ptr - 1);
			}
			cout << ca[ptr - 1] << ' ' << ans + sb << '\n';
		}
	}
	return 0;
}

Measured memory_bytes: 11504
#include<bits/stdc++.h>
using namespace std;
int mod=1e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    long long ans=0;
    int Max=arr[0];
    for(int i=1;i<n;i++)
    {
        Max=max(arr[i],Max);
        if(Max>arr[i])
        ans+=(Max-arr[i]);
    }
    cout<<ans<<'\n';
    
    
    
    
    return 0;
}

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

using namespace std;
const int MAXN = 200010;
int _w;

int n, a[MAXN], f[MAXN], g[1<<26];
char s[MAXN];

int calc( int x ) {
	int ans = g[x] + 1;
	for( int i = 0; i < 26; ++i )
		ans = min(ans, g[x^(1<<i)] + 1);
	return g[x] = min(g[x], ans), ans;
}

int main() {
	_w = scanf( "%s", s );
	n = (int)strlen(s);
	for( int i = 0; i < n; ++i )
		a[i] = 1 << (s[i] - 'a');
	memset(g, 0x3f, sizeof g);
	g[0] = 0;
	int xors = 0;
	for( int i = 0; i < n; ++i )
		xors ^= a[i], f[i] = calc(xors);
	printf( "%d\n", f[n-1] );
	return 0;
}


Measured memory_bytes: 264192
import kotlin.math.PI

fun main() {
    val r = readInt()
    println(2 * PI * r)
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

Measured memory_bytes: 34656
use std::str::FromStr;
use std::collections::HashMap;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}
fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}


fn main() {
    let n : usize = get_one();
    let v : Vec<String> = get_vec_by_lines(n);
    let cur = "".to_string();
    let mut mx = 0;
    let mut vx = HashMap::new();
    for x in v {
        let stat = vx.entry(x).or_insert(0);
        *stat += 1;
    }
    for (s,x) in &vx {
        mx = std::cmp::max(mx,*x);
    }
    let mut ans = Vec::new();
    for (s,x) in &vx {
        //println!("{} {}", s, x);
        if *x == mx {
            ans.push(s);
        }
    }
    ans.sort();
    for s in ans {
        println!("{}", s);
    }
}


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

#define debug(args...) //fprintf (stderr, args)

typedef long long ll;

const int maxn = 2e5 + 10;

int n;
ll k, a[maxn];

ll solve (int L, int R)
{
	if (L == R)
		return a[L] >= k;

	int mid = (L + R) >> 1;

	debug ("[%d, %d] [%d, %d]\n", L, mid, mid + 1, R);

	ll ans = 0;

	ans = solve (L, mid) + solve (mid + 1, R);

	debug ("ans = %lld\n", ans);

	ll sz = 0, soma = 0;
	vector <ll> vec;
	for (int i = mid + 1; i <= R; ++i)
	{
		++sz;
		soma += a[i];
		vec.push_back (soma - k * sz);
	}

	sort (vec.begin(), vec.end());

	soma = 0;
	sz = 0;

	for (int i = mid; i >= L; i--)
	{
		++sz;
		soma += a[i];

		int pos = lower_bound (vec.begin(), vec.end(), k * sz - soma) - vec.begin();

		debug ("add = %d\n", vec.size() - pos);

		ans += ((int)(vec.size()) - pos);
	}

	return ans;
}

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

	for (int i = 1; i <= n; ++i)
		cin >> a[i];

	cout << solve (1, n) << '\n';

	return 0;
}

Measured memory_bytes: 3348
#include <iostream>
#include <algorithm>
using  namespace std;
int main()
{
    int n;
    cin>>n;
    int x[n];
    int x2[n];
    for(int i=0;i<n;i++){
        cin>>x[i];
        x2[i]=x[i];
    }

    sort(x,x+n);
    for(int i=0;i<n;i++){
        if(x2[i]<x[n/2])cout<<x[n/2]<<endl;
        else cout<<x[n/2-1]<<endl;
    }
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>


int main(){
  int N; cin >> N;
  int h[N]; rep(i,N) cin >> h[i];

  bool flag = true;
  rep(i,N) if (i>=1 && h[i]==h[i-1]-1) h[i]++;

  rep(i,N) if (i>=1 && h[i]<h[i-1]) flag = false;

  cout << (flag ? "Yes" : "No")  << endl;


  

  // cout << fixed << setprecision(6);
  return 0;
}



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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  while (true) {
    int n;
    cin >> n;
    if (n == 0) break;
    
    vector<vector<int>> x(n);
    for (int i = 0; i < n; i++) {
      int f;
      cin >> f;
      for (int j = 0; j < f; j++) {
        int a;
        cin >> a;
        x[i].emplace_back(a);
      }
      sort(x[i].begin(), x[i].end());
    }
    
    vector<set<int>> s(n);
    for (int i = 0; i < n; i++) s.at(i).insert(i);
    
    for (int i = 1; i <= 30; i++) {
      set<int> keep;
      vector<int> keep2;
      for (int j = 0; j < n; j++) {
        for (int k = 0; k < x[j].size(); k++) {
          if (x[j].at(k) == i) {
            keep2.emplace_back(j);
            for (auto l = s.at(j).begin(); l != s.at(j).end(); l++) {
              keep.insert(*l);
            }
            break;
          }
        }
      }
      
      for (auto j : keep2) {
        for (auto k = keep.begin(); k != keep.end(); k++) {
          s.at(j).insert(*k);
        }
      }
      
      bool flag = false;
      for (int j = 0; j < n; j++) {
        if (s.at(j).size() == n) flag = true;
      }
      
      if (flag) {
        cout << i << '\n';
        break;
      }
      if (!flag && i == 30) {
        cout << -1 << '\n';
        break;
      }
    }
  }
}


Measured memory_bytes: 3360
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
      	int b = sc.nextInt();
      	int h = sc.nextInt();
      	int sq = (a+b)*h;
      
      System.out.print(sq/2);
      
		
      
    }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

bool ab[100000], ac[100000], bc[100000];

bool match(char c1, char c2) {
    return (c1 == '?' || c2 == '?' || c1 == c2);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string a, b, c;
    cin >> a >> b >> c;
    ll A = a.size();
    ll B = b.size();
    ll C = c.size();
    REP(i, 0, A) {
        REP(j, 0, B) {
            if (!match(a[i], b[j])) {
                ab[i - j + 50000] = true;
            }
        }
    }
    REP(i, 0, A) {
        REP(j, 0, C) {
            if (!match(a[i], c[j])) {
                ac[i - j + 50000] = true;
            }
        }
    }
    REP(i, 0, B) {
        REP(j, 0, C) {
            if (!match(b[i], c[j])) {
                bc[i - j + 50000] = true;
            }
        }
    }
    ll M = 2000;
    ll ans = 3 * M;
    REP(i, -2 * M, 2 * M + 1) {
        REP(j, -2 * M, 2 * M + 1) {
            if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000]) {
                ll L = min((ll)0, min(i, j));
                ll R = max(A, max(B + i, C + j));
                ans = min(ans, R - L);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    int cnt = 0;
    rep(i, H) rep(j, W) {
        char c;
        cin >> c;
        if (c == '#') ++cnt;
    }
    if (cnt == H + W - 1) cout << "Possible\n";
    else cout << "Impossible\n";
    return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,d,x,sum=0;
    cin >> n >> d >> x;
    sum+=x;
    vll a(n);
    rep(i,n){
        cin >> a[i];
        for(int j=1;j<=d;j+=a[i])sum++;
    }
    cout << sum << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

}

signed main() {
	ll n;

	cin >> n;

	vector<ll> v1(n / 2, 0);
	vector<ll> v2(n / 2, 0);

	REP(i, n / 2) {
		cin >> v1[i] >> v2[i];
	}

	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());

	vector<pair<ll, ll>> vv1;
	vector<pair<ll, ll>> vv2;

	ll now = v1[0];
	ll cnt = 0;

	REP(i, n / 2) {
		if (v1[i] == now) {
			cnt++;
		}
		else {
			vv1.push_back(make_pair(cnt, now));
			now = v1[i];
			cnt = 1;
		}

		if (i == n / 2 - 1) {
			vv1.push_back(make_pair(cnt, v1[i]));
		}
	}

	now = v2[0];
	cnt = 0;

	REP(i, n / 2) {
		if (v2[i] == now) {
			cnt++;
		}
		else {
			vv2.push_back(make_pair(cnt, now));
			now = v2[i];
			cnt = 1;
		}

		if (i == n / 2 - 1) {
			vv2.push_back(make_pair(cnt, v2[i]));
		}
	}

	sort(vv1.begin(), vv1.end(), greater<pair<ll, ll>>());
	sort(vv2.begin(), vv2.end(), greater<pair<ll, ll>>());

	ll ans = INF;
	ll x, y;

	REP(i, vv1.size()) {
		REP(j, vv2.size()) {
			x = vv1[i].first;
			y = vv2[j].first;

			if (vv1[i].second != vv2[j].second) {
				ans = min(n - x - y, ans);
				break;
			}
		}
	}

	if (vv1.size() == vv2.size() && vv1.size() == 1) {
		ans = min(ans, n / 2);
	}

	cout << ans << endl;
}

Measured memory_bytes: 3316
'use strict';
(function(stdin) {
  var inputs  = stdin.toString();
  var cols = inputs.split('\n')[0].split(' ').map(Number);
  var a = cols[0];
  var b = cols[1];

  if (a < b) console.log('a < b'); 
  if (a > b) console.log('a > b'); 
  if (a == b) console.log('a == b');

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 7376