akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 998244353

using namespace std;
using ll = long long;
using ldb = long double;

int main() {
    int N; cin >> N;
    int g = 0;
    for (int K = 0; K <= 1e5; K++) {
        if (K * (K - 1) == 2 * N) {
            g = K;
            break;
        }
    }
    if (g == 0) cout << "No" << endl;
    else {
        vector<vector<int>> grid(g);
        int j = 0, k = 1;
        for (int i = 1; i <= N; i++) {
            grid[j].push_back(i);
            grid[k].push_back(i);
            if (grid[j].size() >= g - 1) j++;
            k++;
            if (k >= g) k = j + 1;
        }

        cout << "Yes" << endl;
        cout << g << endl;
        for (int i = 0; i < g; i++) {
            cout << g - 1 << " ";
            for (int j = 0; j < g - 1; j++) {
                cout << grid[i][j] << " ";
            }
            cout << endl;
        }       
    }
}


Measured memory_bytes: 2304
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>
#include<stack>
#include <functional>
#include <queue>
#include <regex>

using namespace std;

constexpr int MOD = 1000000007;
constexpr int INF = 1050000000;

#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl

#define Tof(x) (x) ? Yes : No
#define TOF(x) (x) ? YES : NO
#define tof(x) (x) ? yes : no

using ll = long long;





/*for文でx,yを上下左右確認するやつだよ。

int dy[] = { 0, 1, 0, -1 };
int dx[] = { 1, 0, -1, 0 };


for (int i = 0; i < 4; i++) {
	int ny = y + dy[i];
	int nx = x + dx[i];
}
*/

/*繰り返し二乗法だよ。modもとってくれるよ。n^kをmodで割った余りでやってくれるよ。

ll POW_MOD(ll n, ll k, ll mod) {
	ll r = 1;

	for (; k > 0; k >>= 1) {
		if (k & 1) {
			r = (r * n) % mod;
		}
		n = (n * n) % mod;
	}
	return r;
}


*/

/*2重for文書くのめんどくなった時用だよ。

for (int i = 0; i < h; i++) {
	for (int j = 0; j < w; j++) {

	}
}

*/
int dy[] = { 0, 1, 0, -1 };
int dx[] = { 1, 0, -1, 0 };



char a[1001][1001];
int b[1001][1001];

int main(void) {
	int h, w; cin >> h >> w;
	queue<pair<int, int>> q;

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			b[i][j] = INF;
		}
	}

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				q.push(make_pair(i, j));
				b[i][j] = 0;
			}
		}
	}

	int ans = 0;

	while (!q.empty()) {
		pair<int, int> d = q.front(); q.pop();

		for (int i = 0; i < 4; i++) {
			int ny = d.first + dy[i];
			int nx = d.second + dx[i];

			if (a[ny][nx] == '.' && b[ny][nx] == INF) {
				b[ny][nx] = b[d.first][d.second] + 1;
				q.push(make_pair(ny, nx));
			}
		}

	}

	for (int i = 1; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			ans = max(ans, b[i][j]);
		}
	}


	cout << ans << endl;





}

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

int D[10];

inline bool ok(int n) {
  while (n) {
    if (D[n%10]==0) {
      n/=10;
    } else {
      return false;
    }
  }
  return true;
}
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int N,K;
  cin>>N>>K;
  for (int i=0; i<K; i++) {
    int d;
    cin>>d;
    D[d]=1;
  }
  while (!ok(N)) {
    N++;
  }
  cout<<N<<endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
  if a[i] <= b[i]:
    ans += a[i]
    if b[i] - a[i] <= a[i + 1]:
      ans += b[i] - a[i]
      a[i + 1] -= b[i] - a[i]
    else:
      ans += a[i + 1]
      a[i + 1] = 0
  else:
    ans += b[i]
print(ans)

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

void aaa(int *a,int start,int end){
  if(start<end){
	for(int i=start;i<end; i++){
      if(a[i]>a[i+1]){
        int tmp=a[i];
        a[i]=a[i+1];
        a[i+1]=tmp;
      }
    }
    aaa(a,start,end-1);
  }
}

int main(void){
  using namespace std;

  int n,m,count[101];
  string s[101],t[101];
  
  cin >> n;
  for(int i=0;i<n;i++){
    std::cin >> s[i];
  }
  cin >> m;
  for(int i=0;i<m;i++){
    std::cin >> t[i];
  }
  s[n]="";
  
  for(int i=0;i<n+1;i++){
    count[i]=0;
    for(int j=0;j<n;j++){
      if(s[i]==s[j]) count[i]++;
    }
    for(int k=0;k<m;k++){
      if(s[i]==t[k]) count[i]--;
    }
  }
  
  aaa(count,0,n);
  std::cout << count[n] <<endl;
}

  

Measured memory_bytes: 3572
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int n,m;cin>>n>>m;

    int o = (n-m)*100 + m * 1900;

    cout << pow(2, m) * o << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ss second
#define ff first
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

const int oo = 1e9 + 7;
const int mod = 998244353;
const double PI = acos(-1);


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

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

    for (auto& x : a) cin >> x;

    for (int i=0; i<n; i++){
        for (int j=0; j<=s; j++){
            ll& val = dp[i+1][j], val2 = dp[i][j];
            val += val2*2;
            val = (val + mod)%mod;
            if (j + a[i] <= s){
                dp[i + 1][j + a[i]] += dp[i][j];
                dp[i + 1][j + a[i]] %= mod;
            }
        }
    }

    cout << dp[n][s] << endl;
    return 0;
}

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

string S;

int main() {
  ios_base::sync_with_stdio(0);
  cin >> S;
  S = '0' + S;
  int N = S.size() - 1;
  for(int i = 1; i <= N / 2; i++) {
    if(S[i] != S[N - i + 1]) {
      cout << "No\n";
      return 0;
    }
  }
  for(int i = 1; i <= N / 4; i++) {
    if(S[i] != S[N / 2 - i + 1]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}

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

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

class BPapersPlease {
public:
	void solve(std::istream& in, std::ostream& out) {
	    bool good = true;
	    int n;
	    s(n);
	    f(i,0,n){
	        int a;
	        s(a);
	        if(a%2 == 0 && a%3 !=0 && a%5 != 0) good = false;
	    }
	    out<<(good?"APPROVED":"DENIED")<<endl;

	}
};


integer main() {
	BPapersPlease solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


Measured memory_bytes: 256
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    num = input_int()

    if num == 1:
        print('0')
    else:
        print('1')

run()



Measured memory_bytes: 9196
a,b,c,x,y=map(int,input().split())
if a>=2*c and b>=2*c:
    print(max(x,y)*2*c)
elif a<2*c and b>=2*c:
    print(y*2*c + max(0,x-y)*a)
elif a>=2*c and b<2*c:
    print(x*2*c + max(0,y-x)*b)
elif a+b>2*c:
    if x>y:
        print(y*2*c+(x-y)*a)
    else:
        print(x*2*c+(y-x)*b)
else:
    print(a*x+b*y)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

void dfs(vector<vector<int>> &gr, int now, int chk, int &ans){
  chk += 1 << now;
  bool f = true;
  for(int nx : gr.at(now)){
    if((chk & (1 << nx)) == 0){
      dfs(gr, nx, chk, ans);
      f = false;
    }
  }
  if(f == true){
    int a = __builtin_popcount(chk);
    if(a == gr.size()){
      ans++;
    }
  }
}

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> gr(n, vector<int>());
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    gr.at(a).push_back(b);
    gr.at(b).push_back(a);
  }
  int ans = 0;
  dfs(gr, 0, 0, ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include <queue>
#include <vector>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start; end <= i; i--)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
#define INF32 1'050'000'000
#define INF64 4'000'000'000'000'000'000
using ll = long long;
using namespace std;
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }

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

    int x; cin >> x;
    if (x==3||x==5||x==7)
        cout << "YES" << '\n';
    else
        cout << "NO" << '\n';

    return 0;
}





Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
rate = [0] * 9
for i in range(n):
    for j in range(8):
        if 400 * j <= a[i] < 400 * (j + 1):
            rate[j] += 1
            break
    else:
        rate[8] += 1

counter = 0
for i in range(8):
    if rate[i] >= 1:
        counter += 1

print(max(1, counter), counter + rate[8])


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

using namespace std;

inline bool isOK(const char c)
{
    return c == 'A' || c == 'T' || c == 'C' || c == 'G';
}

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

    int ans = 0, slen = s.length();
    for (int i = 0; i < slen; i++)
    {
        for (int j = i; j < slen; j++)
        {
            if (isOK(s[j]))
                ans = max(ans, j - i + 1);
            else
                break;
        }
    }

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

    return 0;
}


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

#define REP(i, x) for (int i = 0, i##_len = (int)(x); i < i##_len; i++)
#define REP1(i, x) for (int i = 1, i##_len = (int)(x); i <= i##_len; i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using l_l = pair<ll, ll>;
using d_d = pair<double, double>;
using vint = vector<int>;
using vll = vector<ll>;
using vbool = vector<bool>;

int main() {
    int n, k;
    cin >> n >> k;
    vint v(n);

    REP(i, n) {
        cin >> v[i];
    }
    //左からi個(0<=i<=k) 右からj個(0<=j<=k)
    // j+j<=min(n,k)
    //このi,jに対してとったもののうち負の価値を持つ物のうち大きい方からk-(i+j)個まで戻す
    int ans = 0;
    REP(i, k + 1) {
        REP(j, k + 1) {
            if (i + j > min(n, k))
                break;
            vint g;
            int t = 0;
            REP(a, i) {
                if (v[a] < 0)
                    g.pb(v[a]);
                else
                    t += v[a];
            }
            REP(a, j) {
                if (v[n - a - 1] < 0)
                    g.pb(v[n - a - 1]);
                else
                    t += v[n - a - 1];
            }
            sort(ALL(g));
            // int r = k - i - j;
            // if (r < g.size()) {
            //     g.erase(g.begin(), g.begin() + r);
            // }
            g.erase(g.begin(), g.begin() + min(k - (i + j), (int)g.size()));
            for (auto x : g) {
                t += x;
            }
            if (t > ans) {
                ans = t;
                // printf("%lld (%d, %d)\n", t, i, j);
            }
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int h,w,d,q,i,j,a,p[90010][2],c[90010]={};
  cin >> h >> w >> d;
  for (i=0;i<h;i++) for (j=0;j<w;j++){
    cin >> a;
    p[a][0]=i;
    p[a][1]=j;
  }
  for (i=d+1;i<=h*w;i++) c[i]+=c[i-d]+abs(p[i][0]-p[i-d][0])+abs(p[i][1]-p[i-d][1]);
  
  cin >> q;
  for (i=0;i<q;i++){
    int l,r;
    cin >> l >> r;
    cout << c[r]-c[l] << endl;
  }
  return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S,T;
    cin>>S>>T;
    int SIZE=S.size();
    for(int i=0;i<26;i++){
        char check ='0';
        for(int j=0;j<SIZE;j++){
            if(S[j]=='a'+i){
                if (check=='0'){check=T[j];}
                else{
                    if (T[j]!=check){cout<<"No"<<endl;exit(0);}
                }
            }
        }
    }
    for(int i=0;i<26;i++){
        char check ='0';
        for(int j=0;j<SIZE;j++){
            if(T[j]=='a'+i){
                if (check=='0'){check=S[j];}
                else{
                    if (S[j]!=check){cout<<"No"<<endl;exit(0);}
                }
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 776
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, Q, k[111], acc[1111111];
  std::string S;

  std::cin >> N >> S >> Q;

  for (int i = 0; i < Q; i ++)
    std::cin >> k[i];

  acc[0] = 0;

  for (int i = 0; i < N; i ++)
    acc[i + 1] = (S[i] == 'M' ? 1 : 0) + acc[i];

  for (int q = 0; q < Q; q ++) {
    long long dp[3] = {0};

    for (int i = 0, j; i < N; i ++) {
      if ((j = i - k[q]) >= 0)
        if (S[j] == 'D') {
          dp[0] --;
          dp[1] -= acc[i] - acc[j];
        }

      if (S[i] == 'D') {
        dp[0] += 1;
      }
      else if (S[i] == 'M') {
        dp[1] += dp[0];
      }
      else if (S[i] == 'C') {
        dp[2] += dp[1];
      }
    }

    std::cout << dp[2] << std::endl;
  }

  return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    while (a > 0 || c > 0) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            break;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3604
s = input()
n = len(s)
mae = (n-1)//2
usiro = (n+3)//2

for i in range(mae):
  if s[i] != s[mae-1-i] or s[i] != s[usiro-1+i]:
    print("No")
    exit()
    
for i in range(usiro-1, n):
  if s[i] != s[n-1+usiro-1-i]:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 3060
use std::io::{self, Read};
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let v: Vec<i64> =
        read::<String>().chars().map(|c| if c == 'B' {1} else {0}).collect();
    let d: i64 = 1000000007;

    let mut choice = 1i64;
    let mut arms = 0i64;
    for c in &v {
        if (*c + arms + 1) % 2 == 0 {
            // Extend arm from c to right.
            arms += 1;
        } else {
            // Stop arm here.
            choice = choice * arms % d;
            arms -= 1;
        }
    }
    if arms != 0 {
        choice = 0
    }
    for i in 1i64..(n as i64 + 1i64) {
        choice = choice * i % d;
    }
    println!("{}", choice);
}


Measured memory_bytes: 6396
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <cassert>

#define dig(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

template <class TAT>
inline void read(TAT &a)
{
	static char cc;
	static bool f;
	while ((cc = getchar()) != '-' && (cc < '0' || cc > '9'));
	if (cc == '-') f = 1, a = 0;
	else f = 0, a = cc - '0';
	while ((cc = getchar()) >= '0' && cc <= '9') a = a * 10 + cc - '0';
	if (f) a = -a;
}
template <class TAT>
inline void write(TAT a)
{
	static char cc[27];
	static int ct;
	if (a == 0) {
		putchar('0');
		return;
	}
	if (a < 0) {
		a = -a;
		putchar('-');
	}
	ct = 0;
	while (a) cc[++ct] = a % 10 + '0', a /= 10;
	while (ct) putchar(cc[ct--]);
}
template <class TAT>
inline void Ckmin(TAT &a, const TAT &b)
{
	if (a > b) a = b;
}
template <class TAT>
inline void Ckmax(TAT &a, const TAT &b)
{
	if (a < b) a = b;
}
void begin()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
void end()
{
	fclose(stdin);
	fclose(stdout);
}

typedef long long LL;

const int maxn = 15;

int n;
LL Ans = 0;
char S[maxn];

void Init()
{
    scanf("%s", S + 1);
    n = strlen(S + 1);
}

void Solve()
{
    LL sum = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i; j <= n; ++j) {
            sum = 0;
            for (int k = i; k <= j; ++k) {
                sum = sum * 10 + S[k] - '0';
            }
            Ans += sum * (1LL << (n - 1 - (j - i + 1) - 1 + (i == 1) + (j == n)));
        }
    }
    write(Ans);
    putchar('\n');
}

int main()
{
    Init();
    Solve();
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    if ((n-m) == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define pb push_back
#define ALL(v) v.begin(),v.end()
const long long INF = 1LL << 60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P = pair<int, int>;
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; }
using Graph = vector<vector<int>>;
int main()
{
    string S, T;
    cin >> S >> T;
    string TT = T.substr(0, S.size());
    if(S.size() != T.size()-1 || TT != S)
    {
        cout << "No" << endl;
        return 0;
    }
	cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
    string N;
    
    cin >> N;

    int sum = 0;
    for(int i = 0; i < (int)N.size(); i++) {
        char char_digit = N[i];
        int digit = atoi(&char_digit);
        sum += digit;
    }

    if ((sum % 9) == 0 ){
        cout << "Yes";
    } else {
        cout << "No";
    }
}

Measured memory_bytes: 3716
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A, B;
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    A.push_back(a);
    B.push_back(b);
    A.push_back(b);
    B.push_back(a);
  }

  vector<int> ok1(N), ok2(N);
  for (int j = 0; j < 2 * M; j++) {
    if (A[j] != 0) continue;
    ok1[B[j]] = 1;
  }
  
  for (int j = 0; j < 2 * M; j++) {
    if (A[j] != N - 1) continue;
    ok2[B[j]] = 1;
  }

  for (int i = 0; i < N; i++) {
    if (ok1[i] && ok2[i]) {
      cout << "POSSIBLE" << endl;
      return 0;
    }
  }
  
  cout << "IMPOSSIBLE" << endl;
  return 0;
}

Measured memory_bytes: 4964
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)
	N := nextInt()
	M := nextInt()
	H := make([]int, N)
	heightPeakEnableds := make([]bool, N)
	for i := 0; i < N; i++ {
		H[i] = nextInt()
		heightPeakEnableds[i] = true
	}

	for i := 0; i < M; i++ {
		a := nextInt()
		b := nextInt()
		if H[a-1] > H[b-1] {
			heightPeakEnableds[b-1] = false
		} else if H[a-1] < H[b-1] {
			heightPeakEnableds[a-1] = false
		} else {
			heightPeakEnableds[b-1] = false
			heightPeakEnableds[a-1] = false
		}
	}

	r := 0
	for _, heightPeakEnabled := range heightPeakEnableds {
		if heightPeakEnabled {
			r++
		}
	}
	fmt.Println(r)
}


Measured memory_bytes: 5524
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	int cnt = 0;
	int ans = 0;
	rep(i, S.size() - 1) {
		if (S[i] == S[i + 1])ans++;
	}
	ans = min(ans + 2 * K, N - 1);
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int dp[6001][6001];
int A,B,C,D,E,F;
int main(){
    cin>>A>>B>>C>>D>>E>>F;
    A*=100;
    B*=100;
    REP(i,6001){
        REP(j,6001){
            dp[i][j]=0;
        }
    }
    dp[0][0]=1;
    REP(i,3001){
        REP(j,3001){
            if(dp[i][j]==1){
               dp[i+A][j]=1;
               dp[i+B][j]=1;
               dp[i+C][j+C]=1;
               dp[i+D][j+D]=1;
            }
        }
    }
    double ans=0;
    int n=A,m=0;
    REP(i,F+1){
        REP(j,F+1){
            if(dp[i][j]==0)continue;
            int wa=i-j;
            if(j*100>E*wa)continue;
            if(m*i<j*n){
               n=i;
               m=j;
            }
        }
    }
    cout<<n<<" "<<m<<endl;
    return(0);
}

Measured memory_bytes: 140928
#include<stdio.h>
#include<math.h>
#include <stdlib.h>
int main(){
	int a=0;
	int b=0;
	int c=0;
int d;
	scanf("%d %d %d\n",&c, &a, &b);
	if( a<b    ){
		d=a;
	}else{
		d=b;
	}
		if( a+b<  c  ){
		printf("%d %d\n", d, 0 );
	}else{
		printf("%d %d\n", d, a+b-c );
	}
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const int mod = 2019;
static const int INF = 3000;
using namespace std;

int main(){
	string s;
	cin>>s;
	int a=-1,b=-1;
	rep(i,s.size()-1){
		if(s[i]==s[i+1]){
			a=i+1,b=i+2;
		}
	}
	if(a==-1){
		rep(i,s.size()-2){
			if(s[i]==s[i+2]){
				a=i+1;b=i+3;
			}
		}
	}
	cout<<a<<" "<<b<<endl;
}


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

int main() {
  int n;
  int x[110], y[110];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < n; i++) cin >> y[i];

  double D1 = 0, D2 = 0, D3 = 0, D = -1.0;
  for (int i = 0; i < n; i++) {
    D1 += abs(x[i] - y[i]);
  }
  printf("%lf\n", D1);
  
  for (int i = 0; i < n; i++) {
    D2 += pow(abs(x[i] - y[i]), 2);
  }
  printf("%lf\n", sqrt(D2));

  for (int i = 0; i < n; i++) {
    D3 += pow(abs(x[i] - y[i]), 3);
  }
  printf("%lf\n", pow(D3, 1.0 / 3));

  for (int i = 0; i < n; i++) {
    if (D < abs(x[i] - y[i])) {
      D = abs(x[i] - y[i]);
    }
  }
  printf("%lf\n", D);
  
  return 0;
}


Measured memory_bytes: 3348
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#include <chrono> 
using namespace std::chrono;
#define fl(i,z,n) for(int i=z;i<=(n);i++)
#define flr(i,z,n) for(int i=z;i>=(n);i--)
using namespace std;
#define ll long long 
#define pa(a,s) fl(i,0,s-1) cout<<*(a+i)<<" "; cout<<nl;
#define pv(v) fl(i,0,v.size()-1) cout<<v[i]<<" "; cout<<nl;
#define read(v) fl(i,0,v.size()-1) cin>>v[i];
#define all(v) v.begin(),v.end()
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define vll vector<ll>
#define sll set<ll>
#define spll set<pll>
#define debnl(x) cout<<#x<<"="<<x<<nl;
#define deb(x) cout<<#x<<"="<<x<<" ";
#define mkp(x,y) make_pair(x,y)
#define ump unordered_map
#define ff first
#define ss second
#define in insert
#define sz size
#define len length
#define nl '\n'
#define pb push_back
#define in insert
#define ub upper_bound
#define lb lower_bound
#define ld long double
const int MXN=1e5;
ll mod=1e9+7;
void solve(){
    ll n;
    cin>>n;
    vll v(n);
    read(v);
    ll ans=0;
    ll mx=v[0];
    fl(i,1,n-1){
        if(v[i] > mx){
            mx=v[i];
        }else ans+=mx-v[i];
    }
    cout<<ans<<nl;
}
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); ll t=1;
    //cin>>t; //comment for single test
    while(t--) solve();
}

Measured memory_bytes: 4780
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#define MAX 200
 
int sp = MAX;
int stack[MAX];

static void push(int n) {
	if(sp > 0) {
		stack[--sp] = n;
	} else {
		fprintf(stderr,"push overflow\n");
	}
}
static int pop() {
	if(sp < MAX) {
		return stack[sp++];
	} else {
		return 0;
	}
}


int main() {
	char s[MAX];
	int i=0,j=0;
	
	while(scanf("%s",s) != EOF) {
		if(s[0] =='+') {
			push(pop() + pop());
		}else if(s[0] == '-') {
			j = pop();
			i = pop();
			push(i-j);
		}else if(s[0] == '*') {
			push(pop() * pop());
		} else {
			push(atoi(s));
		}
	}
        printf("%d\n", pop());
        return 0;
}


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

int main(){
  int n;
  cin >>n;
  vector<int> x(n);
  int sum = 0, sqsum = 0;
  
  for(int i=0; i<n; i++){
    cin >> x[i];
    sum += x[i];
    sqsum += x[i]*x[i];
  }
  
  int a = (sum/n)*n, b = (sum/n+1)*n;
  int p;
  if(sum-a < b-sum)p = sum/n;
  else p = sum/n+1;
  
  int d = abs(sum-p*n);
  
  
  cout << sqsum + (-sum*sum + d*d)/n << endl;
  
  return 0;
}

Measured memory_bytes: 256
function Main(input) {
  const data = input.split("");
  var ans = [];
  for (var i = 0; i < data.length; i++) {
    if (data[i] === "1") {
      ans.push("1");
    } else if (data[i] === "0") {
      ans.push("0");
    } else if (data[i] === "B") {
      if (ans.length > 0) {
        ans.pop();
      } else {
        continue;
      }
    }
  }
  console.log(ans.join(""));
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import math

def prime(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1

n=int(input())
count=0
for i in range(n):
	x=int(input())
	if prime(x):
		count+=1
print(count)


Measured memory_bytes: 5672
N, Y = map(int, input().split())

resx, resy, resz = (-1, -1, -1)
for x in range(N+1):
    for y in range(N+1-x):
        z = N - x - y
        total = 10000*x + 5000*y + 1000*z

        if total == Y:
            resx, resy, resz = (x, y, z)
            break

print(resx, resy, resz)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int num=scan.nextInt();
int numm=scan.nextInt();
int nummm=scan.nextInt();
int nummmm=scan.nextInt();
  
System.out.println(nummm-num);
  
}
}

Measured memory_bytes: 21460
use text_io::read;
use whiteread::{parse_line, reader::Result};
use num_integer::Roots;

fn isprime(x: i64, ps: Vec<&i64>) -> bool {
    ps.iter().all(|&y| x%y != 0)
}

fn until_sqrt(v: &Vec<i64>, x: i64) -> Vec<&i64> {
    v.iter().take_while(|y| y.pow(2) <= x).collect()
}

fn primes(max: i64) -> Vec<i64> {
    let mut ps: Vec<i64> = Vec::new();
    let n = max.sqrt();

    for x in 2..=n {
        if isprime(x, until_sqrt(&ps, x)) {
            // println!("{} is prime", x);
            ps.push(x)
        }
    }

    ps
}

fn main() -> Result<()> {
    let n: i64 = read!();

    if n == 1 {
        println!("0");
    } else {
        let ps = primes(n);
        println!("{}", f(n, ps));
    }

    Ok(())
}

fn f(x: i64, ps: Vec<i64>) -> i32 {
    let mut y = x;
    let mut ans: i32 = 0;
    let mut z;

    for p in ps {
        z = p;
        while y % z == 0 {
            y /= z;
            z *= p;
            ans += 1;
        }
        while y % p == 0 {
            y /= p;
        }
    }

    if y != 1 {
        ans += 1;
    }

    ans
}


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

char s[60][60];
int cnt[60][26];
int main()
{
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; ++i) scanf("%s", s[i]);
	for (int i = 1; i <= n; ++i)
	{
		int ll = strlen(s[i]);
		for (int j = 0; j < ll; ++j) ++cnt[i][s[i][j] - 'a'];
	}
	for (int i = 0; i < 26; ++i)
	{
		int minn = 0x7fffffff;
		for (int j = 1; j <= n; ++j) cnt[j][i] < minn ? minn = cnt[j][i] : 0;
		for (int j = 1; j <= minn; ++j) printf("%c", i + 'a');
	}
	return 0;
}

Measured memory_bytes: 128
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

list=[]
for i in range(n-1):
  if a[i]+1==a[i+1]:
    list.append(a[i]-1)
vonus=0
for ll in list:
  vonus+=c[ll]
print(sum(b)+vonus)
  
    

Measured memory_bytes: 3064
'use strict';

function main(input) {
  const lines = input.split('\n');
  lines.pop();
    const n = parseInt(lines[0], 10);
    const array = lines[1];
    console.log(fn(n, array));
}

function fn(n, array) {
  const a = array.split(' ').map(v => parseInt(v, 10));
  const max = Math.max.apply(null, a);
  const idx = a.indexOf(max);
  let c = 0;
  while (c < n -1) {
    const current = a[c],
      next = a[c+1];
    if (max - next >= 2 && c+1 > idx) {
      return 'No';
    }
    if ((current - 1) > next) {
      return 'No';
    }
    c++;
  }
  return 'Yes';
}

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


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

int main(){
	int N,x;
	cin>>N>>x;
	int boxes[N];
	for(int i=0;i<N;i++){
		cin>>boxes[i];
	}
	long minS=0;
	for(int i=0;i<N-1;i++){
			int s=boxes[i]+boxes[i+1];
			if(s>x){
				int min=s-x;
				minS=minS+min;
				if(boxes[i+1]>=min){
					boxes[i+1]=boxes[i+1]-min;
				}else{
					boxes[i+1]=0;
				}
			}
	}
	cout<<minS<<endl;
}
//ワーシャルフロイド法


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){
    
    int N,M;cin>>N>>M;
    
    vector<int> cnt(M+2,0),yaku[M+1];
    
    for(int i=1;i<=M;i++){
        for(int j=1;j*j<=i;j++){
            if(i%j==0){
                yaku[i].push_back(j);
                if(j*j!=i) yaku[i].push_back(i/j);
            }
        }
    }
    
    for(int i=0;i<N;i++){
        int a,b;
      scanf("%d",&a);
      scanf("%d",&b);
        if(a==b){
            for(int j=0;j<yaku[a].size();j++){
                int c=yaku[a][j];
                cnt[c]++;
                cnt[c+1]--;
            }
        }else if(a-1<=b-a+1){
            cnt[1]++;
            cnt[b+1]--;
        }else if(b-a+1<=20){
            set<int> S;
            
            for(int i=a;i<=b;i++){
                for(int j=0;j<yaku[i].size();j++){
                    int c=yaku[i][j];
                    S.insert(c);
                }
            }
            for(set<int>::iterator it=S.begin();it!=S.end();it++){
                cnt[*it]++;
                cnt[*it+1]--;
            }
            
        }else{
            
            cnt[1]++;
            cnt[b-a+2]--;
            cnt[a]++;
            cnt[b+1]--;
            
            int now=2;
            while(1){
                int l=(a+now-1)/now,r=b/now;
                if(l<=b-a+1){
                    if(r>b-a+1){
                        cnt[b-a+2]++;
                        cnt[r+1]--;
                    }
                    break;
                }else{
                    cnt[l]++;
                    cnt[r+1]--;
                }
                now++;
            }
        }
    }
    
    for(int i=2;i<=M;i++){
        cnt[i]+=cnt[i-1];
    }
    
    for(int i=1;i<=M;i++){
        cout<<cnt[i]<<"\n";
    }
}




Measured memory_bytes: 10880
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#define rep(i, f, n) for (int i = (f); i < (int)(n); i++)
#define repe(i, f, n) for (int i = (f); i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pint = pair<int, int>;

const int INF = 1001001001;

int main() {
  int a, b;
  cin >> a >> b;
  int c = b - a;
  cout << c * (c + 1) / 2 - b << endl;
  return 0;
}


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

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

  ll a,b; int k; cin >> a >> b >> k;

  if (b-a+1 <= 2*k) {
    for (int i = a; i <= b; i++) {
      cout << i << endl;
    }
  } else {
    for (int i = a; i < a+k; i++) {
      cout << i << endl;
    }
    for (int i = b-k+1; i <= b; i++) {
      cout << i << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
int a[200105],b[200105];
int ans;
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        a[x]=i;
    }
    for(int i=1;i<=n-1;i++)
    {
        if(a[i]<a[i+1])
        {
            b[i+1]+=b[i]+1;
            ans=max(ans,b[i+1]);
        }
    }
    ans=n-ans-1;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC052FofF
{
    class Program
    {
        static Dictionary<int, int> primeDic = new Dictionary<int, int>();

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            

            for(int i = 2; i <= N; i++)
            {
                int x = i;
                int j = 2;
                while (j * j <= i)
                {
                    if (x % j == 0)
                    {
                        x /= j;
                        //Console.WriteLine("{0} is a factor of {1}", j, i);
                        if (primeDic.ContainsKey(j))
                        {
                            primeDic[j]++;
                        }
                        else
                        {
                            primeDic[j] = 1;
                        }
                    }
                    else
                    {
                        j++;
                    }
                }

                if (x != 1)
                {
                    //Console.WriteLine("{0} is a factor of {1}", x, i);
                    if (primeDic.ContainsKey(x))
                    {
                        primeDic[x]++;
                    }
                    else
                    {
                        primeDic[x] = 1;
                    }
                }


            }

            /*
            foreach (var key in primeDic.Keys)
            {
                Console.WriteLine("{0}:{1}", key, primeDic[key]);
                
            }
            */

            long ans = 1;
            foreach(var val in primeDic.Values)
            {
                ans = ans * (val+1) % 1000000007;
            }

            Console.WriteLine(ans);
        }
    }
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int n1 = s.size();
  int n2 = t.size();
  int ans = 10005;
  rep(i, n1 - n2 + 1) {
    string s1 = s.substr(i, n2);
    int cnt = 0;
    rep(j, n2) {
      if(t[j] != s1[j]) cnt++;
    }
    ans = min(ans, cnt);
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  string S; cin>>S;
  cout<<"ABC"<<S<<endl;
  }


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

const int N = 505;
const double EPS = 1e-12, INF = 1e12;
int dcmp(double x) { return (x > EPS) - (x < -EPS); }
struct Point {
	int x, y;
	Point() { }
	Point(int _x, int _y) :x(_x), y(_y) { }
};
typedef Point Vector;
void read(Point &p) { scanf("%d%d", &p.x, &p.y); }

int m, n;
Point pa[N], pb[N];

double width(Point *poly, int n, double x) {
	int i;
	double lb = INF, ub = -INF;
	for (i = 0;i < n;++i) {
		Point a = poly[i], b = poly[(i + 1) % n];
		//if a.x == b.x we'd better consider it to be alone
		double x1 = a.x, x2 = b.x, y1 = a.y, y2 = b.y;
		if ((x1 - x) * (x2 - x) <= 0 && x1 != x2) {
			double y = a.y + (y2 - y1) * (x - x1) / (x2 - x1);
			lb = min(lb, y); ub = max(ub, y);
		}
	}
	return max(0.0, ub - lb);
}

void solve() {
	int i;
	int mna = pa[0].x, mxa = pa[0].x, mnb = pb[0].x, mxb = pb[0].x;
	for (i = 1;i < m;++i) mna = min(mna, pa[i].x), mxa = max(mxa, pa[i].x);
	for (i = 1;i < n;++i) mnb = min(mnb, pb[i].x), mxb = max(mxb, pb[i].x);
	vector<int> xs;
	for (i = 0;i < m;++i) xs.push_back(pa[i].x);
	for (i = 0;i < n;++i) xs.push_back(pb[i].x);
	sort(xs.begin(), xs.end());
	//xs.erase(unique(xs.begin(), xs.end()), xs.end());
	double res = 0.0;
	for (i = 0;i + 1 < xs.size();++i) {
		double a = xs[i], b = xs[i + 1], c = (a + b) / 2;
		//if (dcmp(mna - c) <= 0 && dcmp(c - mxa) <= 0 && dcmp(mnb - c) <= 0 && dcmp(c - mxb) <= 0) {
		if (mna <= c && c <= mxa && mnb <= c && c <= mxb) {		
			double fa = width(pa, m, a) * width(pb, n, a);
			double fb = width(pa, m, b) * width(pb, n, b);
			double fc = width(pa, m, c) * width(pb, n, c);
			res += (b - a) / 6 * (fa + 4 * fc + fb);
		}
	}
	printf("%.10f\n", res);
}

int main(int argc, char *argv[]) {
	while (scanf("%d%d", &m, &n) == 2 && n && m) {
		int i;
		for (i = 0;i < m;++i) read(pa[i]);
		for (i = 0;i < n;++i) read(pb[i]);
		solve();
	}
	return 0;
}

Measured memory_bytes: 2604
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>
#include <queue>

using namespace std;
typedef long long ll;
#define MOD 1000000007

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

    int H[N];
    for(int i=0; i<N; i++) cin >> H[i];

    int c = 0;
    bool flg = true;
    for(int i=0; i<N; i++) {
        if(H[i] > c) {
            c = H[i] - 1;
        } else if(H[i] == c) {
            c = H[i];
        } else {
            flg = false;
            break;
        }
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int N; cin >> N;
	vi A(N); rep(i, N) cin >> A.at(i);
	ll ans = 0; int d;
	rep(i, N - 1) {
		d = A.at(i + 1) - A.at(i);
		if (d > 1) { ans = -1; break;	}
		else if (d == 1) ans++;
		else if (d < 1) ans+= A.at(i + 1);
	}
	if (A.at(0) > 0) ans = -1;
	cout << ans << endl;
}

Measured memory_bytes: 1024
import sys
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]

dp=[[0]*w for i in range(h)]

def dfs(x,y):
    dx=[0,1,0,-1]
    dy=[1,0,-1,0]
    if s[x][y]=="#":
        for i in range(4):
            nx=x+dx[i]
            ny=y+dy[i]
            if 0<=nx<h and 0<=ny<w and s[nx][ny]=="#":
                dp[x][y]=1
for i in range(h):
    for j in range(w):
        dfs(i,j)
for i in range(h):
    for j in range(w):
        if s[i][j]=="#" and dp[i][j]==0:
            print("No")
            sys.exit()
print("Yes")

Measured memory_bytes: 9056
n = int(input())
a=list(map(int, input().split()))
t=a[0]
s=1
Ans=0
for i in range(1,n):
  if t==a[i]:
    s+=1
  else:
    Ans+=s//2
    s=1
  t=a[i]
Ans+=s//2
print(Ans)
  
  
  


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define endl  "\n"
#define ll long long
#define PI acos(-1.0)
#define test cout<<"\n****\n"
#define precise fixed(cout);cout<<setprecision(12)
#define fast  ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using  namespace  std;


int main(){
    string a,b;
    cin>>a>>b;

    ll siza = a.size();
    ll sizb = b.size();

    if(siza>sizb){
        cout<<"GREATER";
    } else if(siza<sizb){
        cout<<"LESS";
    } else{

        bool flag = true;
        for(ll i=0;i<sizb;i++){
            if(a[i] == b[i]){
                continue;
            } else if(a[i] > b[i]){
                cout<<"GREATER";
                return 0;
            } else{
                cout<<"LESS";
                return 0;
            }
        }
        
            cout<<"EQUAL";
        
    }
    
    return 0;
}


Measured memory_bytes: 3584
/*deco loves Chino*/
#include<bits/stdc++.h>
using namespace std;
int head[100010],dis[100010],pos,n,flag=1;
int cnt;
struct edge
{
	int next,to;
}e[200010];
void add(int u,int v)
{
	e[++cnt].to=v;
	e[cnt].next=head[u];
	head[u]=cnt;
}
void dfs(int u,int fa)
{
	for(int i=head[u];i;i=e[i].next)
	{
		int v=e[i].to;
		if(v==fa)
		{
			continue;
		}
		dfs(v,u);
	}
	if(!dis[u])
	{
		if(dis[fa])
		{
			cout<<"First";
			exit(0);
		}
		dis[u]=dis[fa]=1;
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y);
		add(y,x);
	}
	dis[0]=1;
	dfs(1,0);
	if(flag)
	{
		cout<<"Second";
	}
}

Measured memory_bytes: 2688
import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
X = list(map(int, sys.stdin.buffer.readline().split()))

sorted = np.msort(X)
I = np.searchsorted(sorted, X)
if N % 2 == 1:
    ans = np.zeros(N, dtype=int)
    ans[I <= N // 2] = sorted[N // 2 + 1]
    ans[I > N // 2] = sorted[N // 2]
else:
    ans = np.zeros(N, dtype=int)
    ans[I < N // 2] = sorted[N // 2]
    ans[I >= N // 2] = sorted[N // 2 - 1]
print(*ans, sep='\n')


Measured memory_bytes: 36496
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

  int64_t N;
  cin >> N;
  if (N == 0) {
    cout << 0;
  } else if (N % 2 != 0) {
    cout << 0;
  } else {
    N /= 2;
    int64_t sum = 0;
    int64_t x = 5;
    while (x <= N) {
      sum += N / x;
      x *= 5;
    }
    cout << sum;
  }
  return 0;
}


Measured memory_bytes: 3636