akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

main()
{
    int N, z, y;
    scanf("%d",&N);

    if(N>=1 && N<=9)
    {
        z = N-0;
        printf("%d\n",z);
    }

    else if(N>=10 && N<=99)
    {
        z = 9;
        printf("%d\n",z);
    }

    else if(N>=100 && N<=999)
    {
        z = (N - 100) + 1;
        y = z + 9;
        printf("%d\n",y);
    }

    else if(N>=1000 && N<=9999)
    {
        z = 900 + 9;
        printf("%d\n",z);
    }

    else if(N>=10000 && N<=99999)
    {
        z = (N - 10000) + 1;
        y = z + 900 + 9;
        printf("%d\n",y);
    }

    else if(N>=100000 && N<=999999)
    {
        z = 90000 + 900 + 9;
        printf("%d\n",z);
    }

    return 0;
}


Measured memory_bytes: 1708
#include <iostream>
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <cmath>
using namespace std;

#define rep(i, a, n) for(int i = a; i <= n; i++)

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

// 第一引数 == 第二引数 ? true : false
template<class T, class U>
bool check(T first, U second) {
    return (first == second);
}

// 約数列挙
vector<int64_t> divisor(int64_t n) {
  vector<int64_t> ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


// 数字和
template<class T>
T digitSum(T num) {
    T dig;
    T sum = 0;
    while (num) {
        dig = num % 10;
        sum += dig;
        num /= 10;
    }
    return sum;
}

string background_black(string s) { return "\x1b[40m" + s; }
string background_red(string s) { return "\x1b[41m" + s + "\x1b[40m"; }
string background_green(string s) { return "\x1b[42m" + s + "\x1b[40m"; }
string background_yellow(string s) { return "\x1b[43m" + s + "\x1b[40m"; }
string background_bleu(string s) { return "\x1b[44m" + s + "\x1b[40m"; }
string background_white(string s) { return "\x1b[47m" + s + "\x1b[40m"; }

string black(string s) { return "\x1b[30m" + s + "\x1b[37m"; }
string red(string s) {return "\x1b[31m" + s + "\x1b[37m"; }
string green(string s) { return "\x1b[32m" + s + "\x1b[37m"; }
string yellow(string s) { return "\x1b[33m" + s + "\x1b[37m"; }
string blue(string s) { return "\x1b[34m" + s + "\x1b[37m"; }
string white(string s) { return "\x1b[37m" + s + "\x1b[37m"; }

const int ten = 10;
const int hundred = 100;
const int thousand = 1000;

typedef long long ll;
typedef unsigned long long ull;

string tolower(string s) {
  string c;
  for (int i = 0; i < s.size(); i++) {
    if ((s[i] >= 'A') && (s[i] <= 'Z')) {
        c.push_back((s[i] + 0x20));
    } else {
        c.push_back(s[i]);
    }
  }
  return c;
}
#include <cstdlib>
string solve() {
  string str = "";
// int->string: to_string, string->int: stoi
//=============================================================================


  ull n;
  cin >> n;
  ull a = 1, b = n-1;

  vector<int> v;
  for (int i = 0; i <= n/2-1; i++) {
    a++;
    b--;
    int s = digitSum(a)+digitSum(b);
    v.push_back(s);
  }

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

  int ans  = v[0];
  str+=to_string(ans);


//=============================================================================
  str += "\n";
  return str;
}

int main() {	
  std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
  cout << solve() << endl;
}

Measured memory_bytes: 640
count = int(input())
members = list()
buildings = [[[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,]],
             [[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,]],
             [[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,]],
             [[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,],[0,0,0,0,0,0,0,0,0,0,]]]
for i in range(count):
    e = list(map(int,input().split()))
    members.append(e)

for i in range(count):
    buildings[members[i][0]-1][members[i][1]-1][members[i][2]-1] += members[i][3]
    
    if buildings[members[i][0]-1][members[i][1]-1][members[i][2]-1] > 9:
        buildings[members[i][0]-1][members[i][1]-1][members[i][2]-1] = 9
    
for t in range(4):
    if t >= 1:
        print("#"*20)
    for f in range(3):
        for s in range(10):
            if s <= 8:
                print(" "+str(buildings[t][f][s]),end="")
            else:
                print(" "+str(buildings[t][f][s]))


Measured memory_bytes: 5628
#include <stdio.h>

int main (void)
{
    int w,a,b;

    scanf("%d %d %d",&w,&a,&b);

    if(a < b){
        if(b-a-w > 0){
            printf("%d\n",b-a-w);
        }else{
            printf("0\n");
        }
    }else{
        if(a-w-b > 0){
            printf("%d\n",a-w-b );
        }else{
            printf("0\n");
        }
    }

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
const int MAXN=(int)2e5+5;
char str[MAXN];
int mark[MAXN],dp[(1<<26)+10];
int main()
{
	int n;
	scanf("%s",str+1);
	n=strlen(str+1);
	for(int i=1;i<=(1<<26);i++)dp[i]=(int)1e9;
	for(int i=1;i<=n;i++){
		mark[i]=(mark[i-1]^(1<<(str[i]-'a')));
		for(int j=0;j<26;j++){
			dp[mark[i]]=min(dp[mark[i]^(1<<j)]+1,dp[mark[i]]);
		}
	}
	printf("%d\n",max(1,dp[mark[n]]));
	return 0;
}

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

int main() {
  int n,m;
  cin >> n >> m;
  long ans = 0;
  vector<unsigned int>data(n,0);
  vector<int>p(n);
  for(int i = 0;i < m;i++){
    int k;
    cin >> k;
    for(int j = 0;j < k;j++){
      int s;
      cin >> s;
      s--;
      data[i] |= (1<<s);
    }
  }
  for(int i = 0;i < m;i++) cin >> p[i];
  long long a = 1;
  for(int i = 0;i < n;i++) a *= 2;
  for (int bit = 0; bit < (1<<n); ++bit){
    for(int i = 0;i < m;i++){
      int c = 0;
      for(int j = 0;j < n;j++){
        if(data[i]&(1<<j) && bit&(1<<j)) c++;
      }
      if(c%2 != p[i]) break;
      if(i == m-1) ans++;
    }
  }
  cout << ans << endl;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int sum=0;
  for (int i=0; i<N; i++) {
    int x;
    cin >> x;
    if (x < K - x){
      sum += 2*x;
    }
    else {
      sum += 2*(K-x);
    }
  }
  cout << sum << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

vi get_divisors(ll i) {
  vi ret;
  for (ll j = 1; j * j <= i; j++) {
    if (i % j == 0) ret.push_back(j);
  }
  vi ret2;
  for (ll j: ret) {
    ret2.push_back(i / j);
  }
  if (ret.back() == ret2.back()) ret.pop_back();
  reverse(ret2.begin(), ret2.end());
  for (ll j: ret2) ret.push_back(j);
  return ret;
}

int main () {
  ll N, K; cin >> N >> K;
  vi A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll sum = 0;
  for (ll i: A) sum += i;
  vi D = get_divisors(sum);
  ll ans = 0;
  for (ll d: D) {
    priority_queue<ll> pq;
    ll s = 0;
    for (ll i = 0; i < N; i++) {
      ll j = d - A[i] % d;
      if (j == d) j = 0;
      s += j;
      pq.push(j);
    }
    for (ll k = 0; k < s / d; k++) {
      pq.pop();
    }
    ll p = 0;
    while (pq.size()) {
      p += pq.top();
      pq.pop();
    }
    if (p <= K) {
      ans = max(ans, d);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int i,n,d,x;
	int a[101],s=0;
	scanf("%d",&n);
	scanf("%d %d",&d,&x);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i]!=1)
		{
			if(d%a[i]!=0)
				s+=d/a[i]+1;
			else
				s+=d/a[i];
		}
		else
			s+=d/a[i];
	}
	printf("%d",s+x);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define mod   998244353
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define endl "\n"
    #define pii pair<ll,ll>
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

/**********************************************************************************************************************/
const ll man=3005;
ll dp1[man][man];
ll dp2[man][man];
ll dp3[man][man];
signed main()/*Check flow...question galat mat padhna */
{
    fast;   
    dp1[0][0]=1;
	ll n,s;
	cin>>n>>s;
	ll a[n];
	For(i,n)
	{
		cin>>a[i];
	}
	For(i,n)
	{
		for(ll sum=0;sum<=s;sum++)
		{
			dp1[i+1][sum]=(dp1[i+1][sum]+dp1[i][sum])%mod;
			dp2[i+1][sum]=(dp2[i+1][sum]+dp1[i][sum]+dp2[i][sum])%mod;
			dp3[i+1][sum]=(dp3[i+1][sum]+dp1[i][sum]+dp2[i][sum]+dp3[i][sum])%mod;
			if(sum+a[i]<=s)
			{
				dp2[i+1][sum+a[i]]=(dp2[i+1][sum+a[i]]+dp1[i][sum]+dp2[i][sum])%mod;
				dp3[i+1][sum+a[i]]=(dp3[i+1][sum+a[i]]+dp1[i][sum]+dp2[i][sum])%mod;
			}
		}
	}
	cout<<dp3[n][s]<<endl;
}      

Measured memory_bytes: 211840
//#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    double N, K;
    cin >> N >> K;

    double coinAll = 0;
    for (ll i = 1; i <= N; i++)
    {
        ll aa = i;
        double coinCount = 1;
        while (aa < K)
        {
            aa *= 2;
            coinCount *= 0.5;
        }
        coinAll += coinCount;
    }

    printf("%.10lf", coinAll / N);

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<ll> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;



int main(){
    int n;
    cin >> n;
    bool ans = false;
    int st = 0;
    rep(i,n){
        ll c,d;
        cin >> c >> d;
        if(c==d){
            st++;
        }
        else{
            st = 0;
        }
        if(st>=3)ans=true;
    }
    if(ans)cout<<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int d = 0, x;
  for (int i=0; i<N; i++) {
    cin >> x;
    if (K-x >= 0) {
      if (x <= K-x) {
        d += x*2;
      }
      else {
        d += (K-x)*2;
      }
    }
    else {
      if (x <= x-K) {
        d += x*2;
      }
      else {
        d += (x-K)*2;
      }
    }
  }
  
  cout << d << endl;
}

Measured memory_bytes: 3524
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223372036854775807
#define INF 2147483647
#define MOD 1000000007
using namespace std;


int main(int argc, char* argv[])
{
    long k, a, b;
    scanf("%ld%ld%ld", &k, &a, &b);

    if(b<a+2) {
        printf("%ld\n", k+1);
    }
    else {
        if(k<a) {
            printf("%ld\n", k+1);
        }
        else {
            long tmp = (k-(a-1));

            ll ans = a+(ll)(tmp/2)*(b-a)+(tmp%2);
            printf("%lld\n", ans);
        }
    }

    return 0;
}


Measured memory_bytes: 128
N , M , L = map(int,input().split())

lis = [ [float("inf")] * N for i in range(N) ]

for i in range(N):

    lis[i][i] = 0

for i in range(M):

    A,B,C = map(int,input().split())
    A -= 1
    B -= 1

    lis[A][B] = C
    lis[B][A] = C
    
for k in range(N):

    for i in range(N):

        for j in range(i):    

            if lis[i][j] > lis[i][k] + lis[k][j]:

                lis[i][j] = lis[i][k] + lis[k][j]
                lis[j][i] = lis[i][k] + lis[k][j]

lis2 = [ [float("inf")] * N for i in range(N) ]

for i in range(N):

    lis2[i][i] = 0

for i in range(N):

    for j in range(i):

        if lis[i][j] <= L:
            lis2[i][j] = 1
            lis2[j][i] = 1

for k in range(N):

    for i in range(N):

        for j in range(i):

            if lis2[i][j] > lis2[i][k] + lis2[k][j]:

                lis2[i][j] = lis2[i][k] + lis2[k][j]
                lis2[j][i] = lis2[i][k] + lis2[k][j]

Q = int(input())

for i in range(Q):

    s,t = map(int,input().split())
    s -= 1
    t -= 1

    if lis2[s][t] == float("inf"):
        print (-1)
    else:
        print (lis2[s][t]-1)


Measured memory_bytes: 78564
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
 
using namespace std;

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

long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}

long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int main(){
	int n;
	int mi = 1200, ma = 0;
	
	cin >> n;
	
	REP(i,n){
		int a;
		
		cin >> a;
		
		if (mi > a) mi = a;
		if (ma < a) ma = a;
	}
	
	cout << ma-mi << endl;
	
	return 0;
}

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

int main()
{
	int count;
	cin >> count;
	
	int input;
	cin >> input;
	int min = input;
	int max = input;
	long average = input;

	for(int i = 0; i < count - 1; i++)
	{
	  int input;
		cin >> input;
		
		average += input;
		if(min > input) min = input;
		if(max < input) max = input;
	}
	
	cout << min << " " << max << " " << average << endl;
	
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int k;
  string s;
  cin >> k;
  cin >> s;
  int n=s.size();
  if(n<=k){
    cout << s << endl;
  } else {
    string ans;
    rep(i, k){
      ans=ans+s[i];
    }
    ans=ans+"...";
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 998244353;

ll powmod(ll a, ll x) {
    ll ret = 1;
    for (ll i = 0; i < x; i++) {
        ret = (ret * a) % MOD;
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    ll d, ans = 1;
    vector<ll> cnt(n);
    cin >> d;
    if (d) ans = 0;
    for (int i = 1; i < n; i++) {
        cin >> d;
        cnt[d]++;
    }
    if (cnt[0]) ans = 0;
    cnt[0] = 1;
    // bool zero = false;
    for (int i = 1; i < n; i++) {
        // if (zero) {
        //     if (cnt[i]) ans = 0;
        // } else if (cnt[i] == 0) {
        //     zero = true;
        // } else {
        ans = (ans * powmod(cnt[i - 1], cnt[i])) % MOD;
        // }
    }
    cout << ans << endl;
    return 0;
}

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

int seq[10];
int h1[10], h2[10];
bool dfs(int p1, int p2, int d) {
	if (d==10) return true;
	if (d==0) {
		h1[p1] = seq[d];
		return dfs(p1+1, p2, d+1);
	}
	if (h1[p1-1] < seq[d]) {
		h1[p1] = seq[d];
		return dfs(p1+1, p2, d+1);
	} else {
		if (p2==0) {
			h2[p2] = seq[d];
			return dfs(p1, p2+1, d+1);
		} else if (h2[p2-1] < seq[d]) {
			h2[p2] = seq[d];
			return dfs(p1, p2+1, d+1);
		}
	}
	return false;
}
int main() {
	int n;
	cin >> n;
	while (n--) {
		memset(seq, 0, sizeof(seq));
		memset(h1, 0, sizeof(h1));
		memset(h2, 0, sizeof(h2));
		for (int i=0; i<10; i++)
			cin >> seq[i];
		cout << (dfs(0,0,0) ? "YES" : "NO") << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = gets.to_i
res = Array.new(n, 0)

1.step(100) do |x|
  x.step(100) do |y|
    y.step(100) do |z|
      t = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      if t < 1 || t > n
        next
      end
      
      if x == y && y == z
        res[t - 1] += 1
      elsif (x == y && y != z) || (x != y && y == z)
        res[t - 1] += 3
      else
        res[t - 1] += 6
      end
    end
  end
end
puts res

Measured memory_bytes: 14316
N, x = map(int, input().split())
A = list(map(int, input().split()))
acc = 0
ans = 0
for a in A:
    eat = max(acc + a - x, 0)
    ans += eat
    acc = a - eat
acc = 0
ans2 = 0
for a in A:
    eat = max(acc + a - x, 0)
    ans2 += eat
    acc = a - eat
print(min(ans, ans2))

Measured memory_bytes: 14156
/**
 *    author:  FromDihPout
 *    created: 2020-05-16   
**/

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

template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a, b;
    cin >> a >> b;
    int num = 1;
    while (num * 8 / 100 <= a) {
        if (num * 8 / 100 == a && num / 10 == b) {
            cout << num << endl;
            return 0;
        }
        num++;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
def cutter(nums, idx):
    if len(nums) - idx <= 2:
        return len(nums)
    
    for i in xrange(idx+1, len(nums)):
        if int(nums[i]) != int(nums[i-1]):
            pos = i
            flag = int(nums[i]) > int(nums[i-1])  # is asc?
            # print flag
            break
    else:
        return len(nums)

    for i in xrange(pos, len(nums)):

        if flag:
            if int(nums[i]) < int(nums[i-1]):
                return i
        else:
            if int(nums[i]) > int(nums[i-1]):
                return i
    return len(nums)


n = int(raw_input())
idx = 0
arr = raw_input().split()
if n < 2:
    print n
else:
    count = 0
    while idx < n:
        # print arr[idx:]
        count += 1
        idx = cutter(arr, idx)

    print count

Measured memory_bytes: 9232
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>


using namespace std;
typedef pair<int, int> PII;
typedef pair<int, PII> PP; //score, penalty, teamID
static const int INF = 999999999;

void solve()
{
	int T,	P, R;
	while(cin >> T >> P >> R, T || P || R)
	{
		vector<PP> team_data(T);
		vector< vector<int> > wrong_data(T, vector<int>(P));
		for(int i = 0; i < T; ++i)
		{
			team_data[i].second.first = INF;
			team_data[i].second.second = INF - i;
		}
		for(int i = 0; i < R; ++i)
		{
			int tid, pid, time;
			string message;
			cin >> tid >> pid >> time;
			cin >> message;
			--tid;
			--pid;
			if(message == "CORRECT")
			{
				++team_data[tid].first;
				team_data[tid].second.first -= wrong_data[tid][pid] * 1200 + time;
			}
			else
			{
				++wrong_data[tid][pid];
			}
		}
		sort(team_data.begin(), team_data.end(), greater<PP>());
		for(int i = 0; i < T; ++i)
		{
			team_data[i].second.first = INF - team_data[i].second.first;
			team_data[i].second.second = INF - team_data[i].second.second;
		}
		for(int i = 0; i < T; ++i)
		{
			cout << team_data[i].second.second + 1 << " " << team_data[i].first << " " << team_data[i].second.first << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1244
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;

bool is_integer_modf( double x ){
  double r;
  return 0==std::modf(x, &r);
}
 
int main() {

    int n;
    cin >> n;

    vector<int> f(n+1);
    rep(i,n+1) {
        f[i] = 0;
    }
    for(int k= 1;k<n+1;k++) {
        for(int i= 1;i<100;i++) {
            for(int j= 1;j<100; j++) {
                int l = i+j;
                int m = k- i*i - j*j - i*j;
                if(is_integer_modf((sqrt(l*l+4*m) - l) /2) && (sqrt(l*l+4*m) - l)/2>=1) {
                    f[k] ++;
                }
            }
        }   
    }

    for(int i = 1;i<n+1;i++) {
        cout<<f[i]<<endl;
    }

 return 0;
}

Measured memory_bytes: 3552
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

for i in range(1, 10):
	for j in range(1, 10):
		if i * j == N:
			print("Yes")
			sys.exit()
else:
	print("No")

Measured memory_bytes: 5716
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
    int N,W;
    cin >> N >> W;
    vector<int> w(N);
    vector<int> v(N);
    for(int i = 0;i < N;i++) {
        int A,B;
        cin >> A >> B;
        w.at(i) = A;
        v.at(i) = B;
    }
    int dp[110][100010];
    for(int i = 0;i <= N;i++) {
        for(int j = 0;j < 100010;j++) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;
    for(int i = 1;i <= N;i++) {
        for(int j = 0;j < 100010;j++) {
            if(j - v.at(i - 1) >= 0) {
                dp[i][j] = min(dp[i - 1][j],dp[i - 1][j - v.at(i - 1)] + w.at(i - 1));
            }
            else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    int ret = 100000;
    while(dp[N][ret] > W) {
        ret--;
    }
    cout << ret << endl;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main()
{
    int tc;
    cin >> tc;
    int n = tc%10;
    if(n == 2 || n==4||n==5||n==7||n==9)
        cout << "hon" << endl;
    else if(n == 0 || n==1||n==6||n==8)
        cout << "pon" << endl;
    else if(n == 3)
        cout << "bon" << endl;
    return 0;
}


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

int main()
{
    int i, x;
    vector <int> v;

    for (i = 0; i < 3; i++)
    {
        cin >> x;
        v.push_back (x);
    }

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

    for (i = 0; i < v.size (); i++)
    {
        cout << v[i];
        if (i != v.size()-1)
        {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1<<30;

int main(){
  int d1, d2;bool ans=true;
  for(int i=0;i<3;i++){
  	int a, b, c;cin>>a>>b>>c;
    if(i==0){
    	d1=b-a;d2=c-a;
    }else{
    	if(!(d1==b-a&&d2==c-a)){ans=false;break;}
    }
  }
  cout<<(ans?"Yes":"No")<<endl;
}


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

int main(){
    int N;
    std::cin >> N;
    for(int i = N;; i++){
        int num = i;
        int keta = num % 10;
        bool ok = true;
        while(num > 0){
            int tmp = num % 10;
            if(keta != tmp){
                ok = false;
                break;
            }
            num /= 10;
        }

        if(ok){
            std::cout << i << std::endl;
            return 0;
        }
    }
    return 0;
}


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

const int maxN = 1e6;
int n, p[maxN], res;

int main(){
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> p[i];
  int start = p[0];
  for (int i = 0; i < n; ++i){
    if (p[i] <= start){
      res++;
      start = p[i];
    }
  }
  cout << res;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define pb push_back
#define mp make_pair
#define INF 999999999
#define MOD 1000000007
#define sp ' '
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

//typedef
typedef long long ll;
typedef pair<int, int> pint;
typedef pair<long, long> pll;
typedef map<int, int> mint;
typedef set<int> sint;
typedef vector<int> vint;
typedef vector<char> vchr;
typedef vector<long long> vll;
typedef vector<string> vstr;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll a, ll b, ll c){ll ans=1; rep(i, b){ans=ans*a%c;} return ans;}


template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T>
void dpp(T n){cerr << n << endl;}
template<typename T>
void vpp(T a){rep(i,a.size()){cout << a[i] << endl;}}
template<typename T>
void vdp(T a){rep(i,a.size()){cerr << a[i] << endl;}}

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int ddx[8] = {1,0,-1,0,1,-1,-1,1};
const int ddy[8] = {0,1,0,-1,1,1,-1,-1};


template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}


vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.pb(buffer);
    }
    return v;
}




int main(){

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

    int n;
    cin >> n;
    
    mint mp;
    rep(i, n){
        int a;
        cin >> a;
        ++mp[a];
        ++mp[a-1];
        ++mp[a+1];
    }

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

    ppp(mx);


    return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <string>
using namespace std;
int n;
bool Is_Palindrome(string z)
{
    int i=0, j=z.length()-1;
    int m=z.length();
    while(i<=m/2&&j>=m/2)
    {
        if(z[i]!=z[j])
        {
            return false;
        }
        i++;
        j--;
    }
    return true;
}
int main()
{
    string s, p, t;
    cin>>s;
    n=s.length();
    p=s.substr(0, n/2);
    t=s.substr(n/2+1, n-1);
    if(Is_Palindrome(s)==0||Is_Palindrome(p)==0||Is_Palindrome(t)==0)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    return 0;
}


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


def main():
    H, W, K = map(int, input().split())
    cake = [[0]*W for _ in range(H)]
    sb = []
    for y in range(H):
        s = input().strip()
        for x, c in enumerate(s):
            if c == "#":
                sb.append((y, x))

    for i, (y, x) in enumerate(sb):
        cake[y][x] = i+1

    for y in range(H):
        for x in range(1, W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y][x-1]
        for x in range(W-2, -1, -1):
            if cake[y][x] == 0:
                cake[y][x] = cake[y][x+1]

    for y in range(1, H):
        for x in range(W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y-1][x]
    for y in range(H-2, -1, -1):
        for x in range(W):
            if cake[y][x] == 0:
                cake[y][x] = cake[y+1][x]

    for c in cake:
        print(*c)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14272
n,k,q=map(int,input().split())
q1=q
d={}
d1={}
for i in range(1,n+1):
    d[i]=k
    d1[i]=0
while(q!=0):
    d1[int(input())]+=1
    q-=1
for i in range(1,n+1):
    d[i]=(d[i]-(q1-d1[i]))
for i in range(1,n+1):
    if d[i]>0:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 22604
N = int(input())

if N % 2 == 0:
    print((N*N - 2*N)//2)
    for x in range(N):
        for y in range(x+1,N):
            if x != y and x+y != N-1:
                print(x+1,y+1)

else:
    print((N*N-N*2+1)//2)
    for x in range(N):
        for y in range(x+1,N):
            if x != y and x+y != N-2:
                print(x+1,y+1)

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
typedef std::vector<long> LI;
typedef std::queue<long> QI;
#define rep(i,n) for(long i = 0; i < (long)n; ++i)
const double pi = M_PI;
const long mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      std::string ss; scan(ss);
      std::string rev = ss; std::reverse(rev.begin(), rev.end());
      puts(ss == rev ? "Yes" : "No");
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}



Measured memory_bytes: 256
/*
  KUNAL ANAND
  MNNIT ALLAHABAD
*/  

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<assert.h>
using namespace std;
using namespace __gnu_pbds;
#define debug1(x) cout << # x << " " << x << endl;
#define debug2(x,y) cout << #x << " " << x << " " << #y << " " << y << endl;
#define debug3(x,y,z) cout << #x << " " << x << " " << #y << " " << y << " " << #z << " " << z << endl;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef long long int ll;
const ll INF=1e12;
const ll mod=998244353;


ll probs[2][1000005]={0};

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

    ll t;
    ll i,j,k,a,b=LLONG_MAX,n,curr=1,l,r,val=0,prev=0,m,x1,x2,ans1=0,ans2=0;
    
    cin >> n >> m;

    for(i=0;i<m;i++)
    {
        string verdict;

        cin >> a >> verdict;

        //cout << a << " " << verdict << endl;

        if(verdict=="AC")
        {

            if(probs[1][a]==0)
            {
                //cout << "Ok" << endl;
                probs[1][a]=1;
                ans1++;
            }
        }
        else
        {
            if(probs[1][a]==0)
                probs[0][a]++;
        }

    }

   // cout << "Ok" << endl;
    for(i=1;i<=n;i++)
        if(probs[1][i]==1)
            ans2+=probs[0][i];
 
    cout << ans1 << " " << ans2 << endl;
    return 0;
}

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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 55, M = 110;

int n, m;
int x[N], y[N], xx[N], yy[N];

int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i ++ )
	{
		scanf("%d%d", &x[i], &y[i]);
		xx[i] = x[i], yy[i] = y[i];
	}
	sort(xx, xx + n), sort(yy, yy + n);
	
	LL res = 4e18;
	for (int i = 0; i < n; i ++ )
		for (int j = 0; j <= i; j ++ )
			for (int k = 0; k < n; k ++ )
				for (int l = 0; l <= k; l ++ )
				{
					int cnt = 0;
					for (int u = 0; u < n; u ++ )
						if (x[u] <= xx[i] && x[u] >= xx[j] && y[u] <= yy[k] && y[u] >= yy[l])
							cnt ++ ;
					if (cnt >= m) res = min(res, (LL)(xx[i] - xx[j]) * (yy[k] - yy[l]));
				}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
for i in range(n-1):
  if h[n-2-i]-1>h[n-1-i]:
      print('No')
      exit()
  elif h[n-2-i]-1==h[n-1-i]:
      h[n-2-i]=h[n-2-i]-1
print('Yes')

Measured memory_bytes: 14524
// ひなあられの問題

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


int main ()
{

    int N;
    cin >>N;
    int color[4] = {0,0,0,0};

    rep(i,N)
    {
        char inData;
        cin >> inData;
        if(inData == 'P') color[0]++;
        else if(inData == 'W') color[1]++;
        else if(inData == 'G') color[2]++;
        else if(inData == 'Y') color[3]++; 
    }
    int cnt = 0;
    rep(i,4)
    {
        if(color[i]>0) cnt++;
    }
    if(cnt == 3)
    {
        cout << "Three" << endl;
    }
    else if(cnt == 4)
    {
        cout << "Four" << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

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

	set<int> numset;
	int tmp = 0;
	while (cin >> tmp) {
		numset.insert(tmp);
	}

	int ans = N;
	int m = 0;
	while (ans < 10*N) {
		tmp = ans;
		while (tmp) {
			m = tmp % 10;
			if (numset.count(m))
				break;
			tmp /= 10;
		}
		if (tmp == 0) {
			cout << ans << endl;
			break;
		}
		ans++;
	}

	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O2")

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

#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
typedef long long ll;
#define mk(arr, n, type) type *arr = new type[n]
const int mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

#define watch(x) cout << (#x) << " is : " << (x) << "\n"
#define watch2(x, y) cout << (#x) << " is " << (x) << " and " << (#y) << " is " << (y) << "\n"

void b_v_r()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


bool check(int x, int k, const vector<int> &a)
{
    int64_t res = 0;
    
    for (auto i : a)
    {
        res += (i - 1) / x;
    }

    return res <= k;
}

int main()
{
    b_v_r();

    int n, k;

    cin >> n >> k;

    vector<int> a(n);

    for(int i=0;i<n;i++)
        cin >> a[i];
    
    int l = 1, r = 1e9, ans = 0;
    // Binary Search  
    while (l <= r)
    {
        int mid = (l + r) >> 1;
        if (check(mid, k, a))
        {
            ans = mid;
            r = mid - 1;
        }
        else
        {
            l = mid + 1;
        }
    }
    cout << ans << endl;
    
    return 0;
}

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

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

  int total = 1;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] != s[i - 1]) total++;
  }

  cout << total << endl;
  return 0;
}

Measured memory_bytes: 512
import std.stdio, std.string, std.conv, std.range, std.array, std.algorithm;
import std.uni, std.math, std.container, std.typecons, std.typetuple;
import core.bitop, std.datetime;

immutable long mod = 10^^9 + 7;
immutable long inf = mod;

void main(){
    long n, m;
    readVars(n, m);

    auto ans = modpow(n, m, mod);

    writeln(ans);
}

bool is_prime(int x){
    for(int i = 2; i*i <= x; ++i){
        if (x % i == 0) {
            return false;
        }
    }

    return true;
}

T modpow(T)(T x, T y, T mod){
    T res = 1;

    while(y > 0){
        (res *= x^^(y&1)) %= mod;
        y >>= 1;
        x = x^^2 % mod;
    }

    return res;
}

void readVars(T...)(auto ref T args){
    auto line = readln.split;
    foreach(ref arg ; args){
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    if(!line.empty){
        throw new Exception("args num < input num");
    }
}

Measured memory_bytes: 2704
#include<stdio.h>

void trace(int A[],int N){
int i;
for(i=0;i<N;i++){
if(i>0) printf(" ");
printf("%d",A[i]);
}
printf("\n");
}
void insertionSort(int A[],int N){
int j,i,v;
for(i=1;i<N;i++){
v=A[i];
j=i-1;
while(j>=0 && A[j]>v){
A[j+1]=A[j];
j--;
}
A[j+1]=v;
trace(A,N);
}
}
int main(){
int N,i,j;
int A[100];
scanf("%d",&N);
for(i=0;i<N;i++) scanf("%d",&A[i]);
trace(A,N);
insertionSort(A,N);
return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
    int N;
    pair<string, pair<int, int>> sp[100];
    cin >> N;
    for (int i = 1; i <= N; i++) {
        string str;
        int p;
        cin >> str >> p;
        sp[i - 1].first = str;
        sp[i - 1].second.first = -p;
        sp[i - 1].second.second = i;
    }
    sort(sp, sp + N);

    for (int i = 1; i <= N; i++) {
        cout << sp[i - 1].second.second << endl;
    }

    return 0;
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

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

int s;
set<int> S;

signed main() {
  cin >> s;

  int cnt = 1;
  S.insert(s);
  while (1) {
    int next = 0;
    if (s % 2 == 0) {
      next = s / 2;
    } else {
      next = 3 * s + 1;
    }

    // dbg(next)
    if (S.count(next) >= 1) {
      cout << cnt+1 << endl;
      return 0;
    }

    S.insert(next);
    s = next;
    cnt++;
  }

  return 0;
}

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

int main(){
  int a , b , x;
  
  cin >> a >> b;
  
  x = a * b;
  
  if (x % 2 == 0){
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

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

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcount(n)

int main(){
    int x, y;
    cin >> x >> y;
    cout << x + y + 1 - gcd(x, y) << endl;
}




Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define int long long 

using namespace std;
const long double PI = acos(-1);
const int maxn = 2e5 + 7;

int n;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
    cout << fixed << setprecision(3);
    cin >> n;
    cout << (long double) n * 2 * PI;
}

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

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

    for (int i = 1; i < N; i++) P[i] = min(P[i - 1], P[i]);

    int last = 0, res = 0;
    for (int i = 0; i < N; i++) {
        if (P[i] != last) {
            res++;
        }
        last = P[i];
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    vector<ll> cumR(N+1), cumG(N+1), cumB(N+1);
    REP(i,N){
        cumR[i+1] = cumR[i] + (S[i] == 'R');
        cumG[i+1] = cumG[i] + (S[i] == 'G');
        cumB[i+1] = cumB[i] + (S[i] == 'B');
    }
    ll ans = 0;
    REP(i,N){
        for(int j=i+1;j<N-1;j++){
            if(S[i] == S[j]) continue;
            if(S[i] != 'R' && S[j] != 'R'){
                ans += cumR[N] - cumR[j];
                if(j + j - i > N) continue;
                if(S[2*j - i] == 'R') ans--;
            }
            if(S[i] != 'G' && S[j] != 'G'){
                ans += cumG[N] - cumG[j];
                if(j + j - i > N) continue;
                if(S[2*j - i] == 'G') ans--;
            }
            if(S[i] != 'B' && S[j] != 'B'){
                ans += cumB[N] - cumB[j];
                if(j + j - i > N) continue;
                if(S[2*j - i] == 'B') ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;

ll N, M, a[100010][3], maxn = -(1LL << 60);

int main() {
	cin >> N >> M;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j < 3; j++)cin >> a[i][j];
	}

	for (int i = 0; i < 8; i++) {
		vector<ll> v;
		for (int j = 1; j <= N; j++) {
			ll S = 0;
			for (int k = 0; k < 3; k++) {
				if ((i / (1 << k)) % 2 == 0)S += a[j][k];
				else S -= a[j][k];
			}
			v.push_back(S);
		}

		sort(v.begin(), v.end());
		reverse(v.begin(), v.end());
		ll ans = 0;
		for (int j = 0; j < M; j++)ans += v[j];
		maxn = max(maxn, ans);

	}
	
	cout << maxn << endl;

	return 0;
}

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

using namespace std;

long a[200001];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

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

  if (a[1] != 0) {
    cout << -1 << endl;
    return 0;
  }
  long cnt = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] - a[i - 1] > 1) {
      cout << -1 << endl;
      return 0;
    }
    if (a[i] == a[i - 1] + 1) {
      cnt++;
    } else {
      cnt += a[i];
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1792