akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<endl
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define endl "\n"
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define tr(container, it) for(auto it = container.begin(); it != container.end(); it++)
bool compare(pair<ll,string> p1,pair<ll,string> p2){
return p2.fi>p1.fi;
}
void solve(){
  ll x;
  cin>>x;
  fr(i,-500,500){
  fr(j,-500,500){
  if(pow(i,5)-pow(j,5)==x){
    cout<<i<<" "<<j<<endl;
    return;
  }
  }
  }
}
int main()
{   fast;
    ll t=1;
    //cin>>t;
    fr(zz,1,t+1){
    solve();
    }
}


Measured memory_bytes: 4116
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long i,j,N,M;
  cin>>N;
  vector<pair<long long,long long>> v(N);
  vector<vector<long long>> dp(N+1,vector<long long>(N+1,0));
  for(i=0;i<N;++i){
    cin>>v[i].first;
    v[i].second=i;
  }
  //降順ソート
  sort(v.rbegin(),v.rend());
  //(配る)dp
  for(i=0;i<N;++i){
    for(j=0;j<=i;++j){
      dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+v[i].first*abs(v[i].second-j));
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]+v[i].first*abs(N-1-i+j-v[i].second));
    }
  }
  //答えはN番目まで見たときの最大値
  cout<<*max_element(dp[N].begin(),dp[N].end())<<endl;
}

Measured memory_bytes: 34684
// atcoder/aising2019/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int h, w;
  while (cin >> h >> w) {
    const int H = 400 + 5;
    const int W = 400 + 5;
    static char g[H][W];
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        cin >> g[i][j];
      }
    }

    static bool vis[H][W];
    fill(&vis[0][0], &vis[H - 1][W - 1] + 1, false);

    lli x = 0;
    map<char, lli> m;
    function<void(int, int)> rec = [&] (int i, int j) {
      vis[i][j] = true;
      ++m[g[i][j]];
      for (int d = 0; d < 4; ++d) {
        int ni = i + di[d];
        int nj = j + dj[d];
        unless (0 <= ni && ni < h) continue;
        unless (0 <= nj && nj < w) continue;
        if (g[i][j] != g[ni][nj] && !vis[ni][nj]) {
          rec(ni, nj);
        }
      }
    };
    for (int i = 0; i < h; ++i) {
      for (int j = 0; j < w; ++j) {
        if (!vis[i][j]) {
          m.clear();
          rec(i, j);
          x += m['.'] * m['#'];
        }
      }
    }
    cout << x << endl;
  }

  return 0;
}


Measured memory_bytes: 21388
import os
import itertools
import numpy as np

class getStdin(object):
    @classmethod
    def get_int(cls):
        return int(input())

    @classmethod
    def get_ss_int(cls):
        return list(map(int, input().split()))

    @classmethod
    def get_na_int(cls):
        return np.array(list(map(int, input().split())))


class funcCls(object):
    @classmethod
    def leng(cls, x1, y1, x2, y2):
        return np.sqrt((x1 - x2)**2 + (y1-y2)**2)

    @classmethod
    def done(cls, n, a):
        ll = len(a)
        total = dict()
        for i in range(ll):
            for j in range(i+1, ll):
                tmp = cls.leng(a[i][0], a[i][1], a[j][0], a[j][1])
                try:
                    if total[i] is not None:
                        total[i][j] = tmp

                except:
                    dum = dict()
                    dum[j] = tmp
                    total[i] = dum

        p = list(itertools.permutations(range(ll)))
        ss = list()
        for bbb in p:
            length = 0
            for c in range(len(bbb)-1):
                if bbb[c] < bbb[c+1]:
                    l = bbb[c]
                    r = bbb[c+1]
                else:
                    l = bbb[c+1]
                    r = bbb[c]
                length += total[l][r]

            ss.append(length)

        print(sum(ss) / len(ss))
        return

if __name__ == '__main__':
    n = getStdin.get_int()
    a = list()
    for i in range(n):
        a.append(getStdin.get_ss_int())

    funcCls.done(n, a)

    os.sys.exit(0)

Measured memory_bytes: 27728
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vstr=vector<string>;
#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 _GLIBCXX_DEBUG
int main()
{
    int n;
    cin>>n;
    string s,t;
    cin>>s>>t;
    vstr ans(2*n);
    for(int i=0;i<n;i++){
        ans[2*i]=s[i];
        ans[2*i+1]=t[i];
    }
    rep(i,2*n)cout<<ans[i];
    return 0;
}

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

using namespace std;
#define ll long long int


int main()
{
   ll t;
   t = 1;	
//    cin t;
   while(t--){
        ll n;
        cin >> n;
        ll ans = 0;
        for(int i = 1; i <=n ; i ++)
        {
            ll x = n / i;
            ans += (i + i * x) * x / 2;
        }

        cout << ans << endl;   
   }
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
struct edge{
	int x,y;
	ll v;
	edge(int a=0,int b=0,ll c=0){x=a;y=b;v=c;}
};
bool operator<(edge a,edge b){return a.v<b.v;}
vector<edge>e;
int h[200010],nex[400010],to[400010],w[400010],v[200010],M;
void add(int a,int b,int c){
	M++;
	to[M]=b;
	w[M]=c;
	nex[M]=h[a];
	h[a]=M;
}
bool vis[200010];
int siz[200010],n;
void dfs1(int fa,int x){
	siz[x]=1;
	n++;
	for(int i=h[x];i;i=nex[i]){
		if(!vis[to[i]]&&to[i]!=fa){
			dfs1(x,to[i]);
			siz[x]+=siz[to[i]];
		}
	}
}
int mn,cn;
ll d[200010];
void dfs2(int fa,int x){
	int i,k;
	k=0;
	for(i=h[x];i;i=nex[i]){
		if(!vis[to[i]]&&to[i]!=fa){
			dfs2(x,to[i]);
			k=max(k,siz[to[i]]);
		}
	}
	k=max(k,n-siz[x]);
	if(k<mn){
		mn=k;
		cn=x;
	}
}
vector<int>q;
void dfs3(int fa,int x){
	q.push_back(x);
	for(int i=h[x];i;i=nex[i]){
		if(!vis[to[i]]&&to[i]!=fa){
			d[to[i]]=d[x]+w[i];
			dfs3(x,to[i]);
		}
	}
}
void solve(int x){
	int i,t;
	ll mn;
	n=0;
	dfs1(0,x);
	::mn=2147483647;
	dfs2(0,x);
	x=cn;
	q.clear();
	d[x]=0;
	dfs3(0,x);
	mn=9223372036854775807ll;
	for(int x:q){
		d[x]+=v[x];
		if(d[x]<mn){
			mn=d[x];
			t=x;
		}
	}
	for(int x:q)e.push_back(edge(t,x,d[t]+d[x]));
	vis[x]=1;
	for(i=h[x];i;i=nex[i]){
		if(!vis[to[i]])solve(to[i]);
	}
}
int fa[200010];
int get(int x){return fa[x]==x?x:(fa[x]=get(fa[x]));}
int main(){
	int n,i,a,b,c;
	ll ans;
	scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",v+i);
	for(i=1;i<n;i++){
		scanf("%d%d%d",&a,&b,&c);
		add(a,b,c);
		add(b,a,c);
	}
	solve(1);
	sort(e.begin(),e.end());
	for(i=1;i<=n;i++)fa[i]=i;
	ans=0;
	for(edge t:e){
		a=get(t.x);
		b=get(t.y);
		if(a!=b){
			fa[a]=b;
			ans+=t.v;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 86624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   
    int a;
    cin >> a;
    int b;
    int c=0;//カウンター
 for (int i=1;i<=a;i*=10){
     b = (a/i)%10;//きりすてて％１０であまりみてる
     if(b==1){
         ++c;}
           }  
           cout <<c << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(S: str):
    print(S.replace('2017', '2018'))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
/*
We will not return to the countless mistakes of the past
I will not relive the failures of the man I once was

Only through dedication will I destroy all preconception

No longer will I let myself be truly satisfied with the standard
We will not return to the countless mistakes of the past

Only through dedication will I destroy all preconception

Let this be
Be the day
Day of my
My declaration
Let this be the day of my declaration

Join me,
Walk with me

Shatter the bonds that tie us
To what we strive to never be

Join me,
Walk with me
*/
#include<bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const ll maxn=1000001;

int main(){

string str;
cin>>str;
int w;
cin>>w;
forn(i,str.size()){

if(i%w==0) cout<<str.at(i);

}
return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (h, w) = readIntegerList()
    var costMatrix = Array(10) { readLongList().toTypedArray() }
    warshallFloyd(costMatrix)
    val aMtrix = Array(h) { readIntegerList() }
    var ans = 0L
    for (row in aMtrix) {
        for (i in row) {
            if (i != -1) {
                ans += costMatrix[i][1]
            }
        }
    }
    println(ans)
}

/** O((costMatrix.size)^3) costMatrix is changed */
fun warshallFloyd(costMatrix: Array<Array<Long>>): Array<Array<Long>> {
    val indices = costMatrix.indices
    for (k in indices) {
        for (i in indices) {
            for (j in indices) {
                if (costMatrix[i][k] != Long.MAX_VALUE && costMatrix[k][j] != Long.MAX_VALUE) {
                    costMatrix[i][j] = Math.min(costMatrix[i][j], costMatrix[i][k] + costMatrix[k][j])
                }
            }
        }
    }
    return costMatrix
}


fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


Measured memory_bytes: 41044
#include <algorithm>
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll p[62];
map<ll, ll> memo;

ll dfs(ll n){
    if(n < 0) return 0;
    if(n == 0) return 1;
    if(memo[n]) return memo[n];
    ll k = lower_bound(p, p + 62, n) - p - 1;
    return memo[n] = (dfs(p[k]) * 2 + dfs(n - p[k] - 2) - dfs(p[k + 1] - n - 1) + 1) % MOD;
}

int main()
{
    ll n;
    cin >> n;
    for(int i = 1; i < 62; i++) p[i] = p[i - 1] * 2 + 2;
    cout << dfs(n) << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

bool isSquare(ll n) {
	ll d = (ll)sqrt(n) - 1;
	while (d * d < n) ++d;
	return d * d == n;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    while(!isSquare(n)) n--;
    out(n);

    return 0;
}

Measured memory_bytes: 256
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    int n;
    cin>>n;
    ll ans = 0;
    REP(i,1,n){
    	REP(j,1,n){
    		REP(k,1,n){
    			ans += __gcd(i, __gcd(j, k));
    		}
    	}
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3648
import sys
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[int(input()) for i in range(N)]
tate1=[A1[0],A2[0],A3[0]]
tate2=[A1[1],A2[1],A3[1]]
tate3=[A1[2],A2[2],A3[2]]
naname1=[A1[0],A2[1],A3[2]]
naname2=[A1[2],A2[1],A3[0]]

if A1[0] in b and A1[1] in b and A1[2] in b:
    print('Yes')
    sys.exit()
if A2[0] in b and A2[1] in b and A2[2] in b:
    print('Yes')
    sys.exit()
if A3[0] in b and A3[1] in b and A3[2] in b:
    print('Yes')
    sys.exit()
if tate1[0] in b and tate1[1] in b and tate1[2] in b:
    print('Yes')
    sys.exit()
if tate2[0] in b and tate2[1] in b and tate2[2] in b:
    print('Yes')
    sys.exit()
if tate3[0] in b and tate3[1] in b and tate3[2] in b:
    print('Yes')
    sys.exit()
if naname1[0] in b and naname1[1] in b and naname1[2] in b:
    print('Yes')
    sys.exit()
if naname2[0] in b and naname2[1] in b and naname2[2] in b:
    print('Yes')
    sys.exit()
print('No')

Measured memory_bytes: 3188
(function() {
    'use strict';
 
    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;
      
    // ToDo start
      var A = parseInt(lines[0])
      var G = parseInt(lines[1])
      var ans = 2 * G - A
      console.log( ans )
    // ToDo end

    });

    
})();
  
  

Measured memory_bytes: 7628
N, M = gets.split(' ').map(&:to_i)
prev_l, prev_r = 1, 100000
M.times do
  l, r = gets.split(' ').map(&:to_i)
  prev_l = l if l > prev_l
  prev_r = r if r < prev_r
end
puts (prev_l <= prev_r) ? (prev_r - prev_l + 1) : 0 

Measured memory_bytes: 1788
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define EPS 1e-9
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}


signed main(void) {
    int n;
    cin >> n;
    int l = n/100, r = n/105;
    //cout << l << " " << r << endl;
    int sum = n - 100*l;
    //cout << sum << endl;
    int ans = 0;
    rep(a,100)rep(b,100)rep(c,100)rep(d,100){
        int p = 1*a + 2*b + 3*c + 4*d;
        if(sum < p)continue;
        int e = (sum - p)/5;
        if((sum - p)%5 == 0 && a+b+c+d+e <= l){
            //cout << a << " " << b << " " << c << " " << d << endl;
            ans = 1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 888
package main

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

func main() {
	b := readBytes()

	if b[0] == 'A' {
		fmt.Println("T")
	}
	if b[0] == 'T' {
		fmt.Println("A")
	}
	if b[0] == 'C' {
		fmt.Println("G")
	}
	if b[0] == 'G' {
		fmt.Println("C")
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <stdlib.h>
#include <stdio.h>
using namespace std;
using Graph = vector<vector<int>>;
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; }
const int INF = 1000000000;
const int MOD = 1000000007;

typedef pair<int, int> P;
int myAbs(int num) {
    if (num > 0)
        return num;
    else
        return -num;
}

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

/*vector<bool> seen;
void dfs(const Graph& G, int v, int count) {
    seen[v] = true;
    count = 0;
    for (auto next_v : G[v]) {
        if (seen[next_v]) continue;
        if (count > 2) continue;
        count++;
        cout << count << ":" << next_v << endl;
        dfs(G, next_v, count);
    }
}*/

int main() {
    long long N;
    long long ans = 0;
    cin >> N;
    if (N % 2 == 1) {
        cout << 0;
        return 0;
    }
    long long waru = 10;
    while (waru <= N) {
        ans += N / waru;
        waru *= 5;
    }
    cout << ans << endl;
}


Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <functional>
#include <queue>
using namespace std;



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

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

	vector<int>cnt(N);
	for (int i = 0; i < id.size(); i++) {
		queue<int>que;
		que.push(id[i]);
		int pre_q = id[i];
		while (que.size()) {
			int q = que.front(); que.pop();
			if (E[q].size() > 2) {
				cnt[q]++;
				continue;
			}
			for (int j = 0; j < E[q].size(); j++) {
				if (E[q][j] == pre_q)continue;
				pre_q = q;
				que.push(E[q][j]);
				break;
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < N; i++)if (cnt[i])ans += cnt[i] - 1;

	cout << max(1, ans) << endl;

    return 0;
}



Measured memory_bytes: 8188
//Catchharsh
#include<bits/stdc++.h>
#define ll long long int 
#define ld long double
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define see(x) cout<<#x<<" = "<<x<<endl
const ll MOD = 1e9+7;
const ll INF = 1011111111;
const ll LLINF = 1000111000111000111LL;
const ld EPS = 1e-10;
const ld PI = 3.14159265358979323;
using namespace std;
ll power (ll base,ll exponent)
{
    ll ans=1;
    //base%=MOD;
    //exponent%=(MOD-1);
    while(exponent!=0)
    {
      if(exponent&1) ans=(1LL*ans*base);
      base=(1LL*base*base);
      exponent>>=1;
    }
    return ans;
}
ll b[3][3];
bool is()
{
  if(b[0][0]&&b[0][1]&&b[0][2]) return true;
  if(b[1][0]&&b[1][1]&&b[1][2]) return true;
  if(b[2][0]&&b[2][1]&&b[2][2]) return true;
  if(b[0][0]&&b[1][0]&&b[2][0]) return true;
  if(b[0][1]&&b[1][1]&&b[2][1]) return true;
  if(b[0][2]&&b[1][2]&&b[2][2]) return true;
  if(b[0][0]&&b[1][1]&&b[2][2]) return true;
  if(b[0][2]&&b[1][1]&&b[2][0]) return true;
  return false;
}
int32_t main()
{   
     IOS;
     
     ll a[3][3];
     ll n,m,i,j,k;
     for(i=0;i<3;i++) for(j=0;j<3;j++) cin>>a[i][j];
    cin>>n;
  while(n--)
  {
    ll num;
    cin>>num;
    for(i=0;i<3;i++)
    {
      for(j=0;j<3;j++)
      {
        if(a[i][j]==num) b[i][j]=1;
      }
    }
  }
 if(is()) cout<<"Yes";
 else cout<<"No";

     
     cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';             
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define viii vector <pair<ll,pair<ll,ll> > >
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define input(a,n) fr(i,0,n)cin>>a[i]
#define output(a,n) fr(i,0,n)cout<<a[i]<<" "
#define dbg cout<<"hurr"<<endl;
#define dbg2 cout<<"hurr2"<<endl;
#define md 1000000007
#define inf 999999999999999999
#define sp << " " <<
#define pi 3.14159265358979323846
#define fixd(x) cout << fixed << setprecision(x);
#define sz size()

int main()
{
    ll a,b,c;
    cin >> a >> b >> c ;
    if(a==b && b==c)
        cout << "Yes";
    else
        cout << "No";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define f first
#define s second
#define inf 999999999999
#define N  500009
#define M  (L+R)/2
#define ll long long
#define pb push_back
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace __gnu_pbds;
using namespace std;

ll n,R,G,B,ans,sum;

int main()
{
	ios::sync_with_stdio(0);
	
	cin>>R>>G>>B>>n;
	
	for(int r=0;r<=n/R;r++){
		for(int g=0;g<=n/G;g++){
			sum=r*R+g*G;
			if(sum>n)continue;
			if((n-sum)%B==0)ans++;
		}
	}
	cout<<ans<<endl;
	
return 0;
}








Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n;
  cin >> n;
  long long int t[n],ans,r,a,b;
  for(int i=0;i<n;i++) cin >> t[i];
  sort(t,t+n);
  ans=t[0];
  for(int i=1;i<n;i++){
    if(ans<t[i]) swap(ans,t[i]);
    a=ans;b=t[i];
    r=ans%t[i];
    while(r!=0){
      ans=t[i];
      t[i]=r;
      r=ans%t[i];
    }
     ans=(a/t[i])*b;
  }
  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100

main(){
  int n;
  int i,j;
  int min,t,c=0;
  int A[MAX];

  scanf("%d",&n);

  for(i=0;i<n;i++)scanf("%d",&A[i]);

  for(i=0;i<n;i++){
    min=i;
    for(j=i+1;j<n;j++){
      if(A[j]<A[min])min=j;
    }
    t=A[i];
    A[i]=A[min];
    A[min]=t;
    if(min!=i)c++;
  }

  printf("%d",A[0]);
  for(i=1;i<n;i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  printf("%d\n",c);


  return 0;
}
  

  



Measured memory_bytes: 2088
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll=long long;
#define MOD  1000000007

int a[1000];
int main(int argc, char const *argv[]) {
  string s;
  std::cin >> s;
  memset(a,0,sizeof(a));

  for(int i=0; i<s.size(); i++){
    a[s[i]]++;
  }

  for(int i='a'; i<='z'; i++){
    if(a[i]%2==1){
      std::cout << "No" << '\n';
      return 0;
    }
  }

  std::cout << "Yes" << '\n';

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
long long dp[100001];
int main()
{
	int n, w;
	scanf("%d%d", &n, &w);
	for(long long i = 0, j, k; i < n; ++i)
	{
		scanf("%lld%lld", &j, &k);
		for(int l = w - j; l >= 0; --l)
		{
			dp[l + j] = max(dp[l + j], dp[l] + k);
		}
	}
	printf("%lld\n", *max_element(dp, dp + w + 1));
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>
#include<cmath>
#include<queue>

using namespace std;

int main() {

	int L,R;
	cin >> L >> R;

	int ans = 2020;
	R = min(R, L + 4038);
	for (long long i = L; i <= R; i++)
	{
		for (long long j = L; j <= R; j++)
		{
			if (i == j)
			{
				continue;
			}
			int tmp = (i * j) % 2019;
			ans = min(ans, tmp);
		}
	}


	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a==1)
  {
    if(b==2)cout<<3;
    else cout<<2;
  }
  if(a==2)
  {
    if(b==3)cout<<1;
    else cout<<3;
  }

  if(a==3)
  {
    if(b==2)cout<<1;
    else cout<<2;
  }


}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int a, b;

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

    
	if(a > b)
        printf("a > b\n");
	else if(a < b)
        printf("a < b\n");
    else
        printf("a == b\n");
	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	ll n ;
	cin>>n;
	vector<ll>v(n);
	for(int i =0;i<n;i++)
	{cin>>v[i];}
	
	
	vector<vector<ll>>dp(n,vector<ll>(n,9999999999999999));
	vector<vector<ll>>pre(n,vector<ll>(n,0));
	for(int i =0;i<n;i++)
	{  ll sum=0;
		for(int j=i;j<n;j++ )
		{sum+=v[j];
		 pre[i][j]=sum;
			
		}
	}
	
	for(int i = 0 ; i<n ; i++ )
	{
		dp[i][i]=0;
	}
	for(int l=2 ;l<=n;l++)
	{
		for(int i =0 ; i+l-1<n ;i++)
		{int j = i+l-1; 
		  
		  for(int k =i ; k<j ; k++)
		   { 
		   	 dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+pre[i][k]+pre[k+1][j]);
		   }
		}
	}
	
	cout<<dp[0][n-1]<<endl;
	/*for(int i = 0 ; i<n ; i++ )
	{for(int j = 0 ; j<n ; j++ )
	{
		cout<<dp[i][j]<<" ";
	}
		cout<<endl;
	}*/
	return 0;
}

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

int main(void){
    int N,A,B,C;
    cin>>N>>A>>B>>C;
    vector<int> l(N);

    int ans=1000000;
    for (int i=0;i<N;i++) cin>>l[i];

    //bit全探索みたいなのを4進数でやりたい
    for (ll i=0;i<pow(4,N);i++){
        ll qq=i;
        vector<int> useA,useB,useC;

        //4進数の桁が0=>その竹を使わない
        //1=>Aの材料,2=>Bの材料,3=>Cの材料にする
        for (int j=0;j<N;j++){
            int use=qq%4;
            qq/=4;
            switch(use){
                case 1:useA.push_back(l[j]);break;
                case 2:useB.push_back(l[j]);break;
                case 3:useC.push_back(l[j]);break;
                default: break;
            }
        }

        //A,B,Cどれかに材料がなかったらcontinue
        if (useA.size()==0) continue;
        if (useB.size()==0) continue;
        if (useC.size()==0) continue;

        int aa=0,bb=0,cc=0; //材料の竹の長さの合計
        int mpA=0,mpB=0,mpC=0; //それぞれの竹を作るのに使うmp

        //まず材料の竹をすべて合成する
        for (int j=0;j<useA.size();j++) aa+=useA[j];
        mpA+=(useA.size()-1)*10;
        for (int j=0;j<useB.size();j++) bb+=useB[j];
        mpB+=(useB.size()-1)*10;
        for (int j=0;j<useC.size();j++) cc+=useC[j];
        mpC+=(useC.size()-1)*10;

        //延長or短縮の魔法を使う
        mpA+=abs(aa-A);
        mpB+=abs(bb-B);
        mpC+=abs(cc-C);

        int cost=mpA+mpB+mpC;
        //cout<<cost<<" "<<aa<<" "<<bb<<" "<<cc<<" ";
        //cout<<mpA<<" "<<mpB<<" "<<mpC<<endl;
        ans=(ans<cost)?ans:cost;
    }
    cout<<ans<<endl;
    return 0;
}

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

city = [[] for i in range(M)]
city_id = ["" for i in range(M)]
count = [0] * N

for i in range(M):
    city[i] = list(map(int, input().split())) + [i]

city = sorted(city, key=lambda x:(x[0], x[1]))

for i in range(M):
     ken, year, num = city[i]
     count[ken-1] += 1
     city_id[num] = "{:0=6}{:0=6}".format(ken, count[ken-1])

for i in range(M):
    print(city_id[i])


Measured memory_bytes: 33612
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF 1000000007 //1000000000000000003
#define MOD 1000000007
#define MAX 2000005

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;
//vector<vector<int>> data(3, vector<int>(4, -1));
//left + 1 < top

using namespace std;
using P = pair<int, int>;
using Pc = pair<double, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;
long long fact[MAX], inv[MAX];
int dx[] = { -1,0,1,0 };
int dy[] = { 0,-1,0,1 };

//////////////////////////////////

vector<vector<int>> bingo(3, vector<int>(3));
vector<vector<int>> tree(100005);
int color[100005];
map<P, int>colorMap;
int m = 0;

struct BridgeInfo {
	int town1;
	int town2;
	int year;
	BridgeInfo(int t1, int t2, int y) {
		town1 = t1;
		town2 = t2;
		year = y;
	}
};

struct People {
	int index;
	int town;
	int year;
	People(int i, int t, int y) {
		index = i;
		town = t;
		year = y;
	}
};

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

struct UnionFind {
	vector<int>uf;

	UnionFind(int size) :uf(size, -1) {};

	int root(int target) {
		if (uf[target] < 0)return target;
		else return uf[target] = root(uf[target]);
	}

	void merge(int a, int b) {
		a = root(a);
		b = root(b);
		if (a == b)return;
		if (uf[b] < uf[a])swap(a, b);
		uf[a] += uf[b];
		uf[b] = a;
	}
};

ll CalcPow(ll num, ll power) {
	if (power == 0)return 1;
	if (power % 2 == 0) {
		ll half = CalcPow(num, power / 2);
		return (half * half) % MOD;
	}
	else return (num * CalcPow(num, power - 1)) % MOD;
}

ll combination(ll all, ll select) {
	if (all < select) return 0;
	if (all < 0 || select < 0) return 0;
	return fact[all] * (inv[select] * inv[all - select] % MOD) % MOD;
}

void initCombination(int max) {
	fact[0] = fact[1] = 1;
	for (int i = 2; i <= max; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
	}

	inv[max] = CalcPow(fact[max], MOD - 2);
	for (int i = max - 1; 0 <= i; --i) {
		inv[i] = (inv[i + 1] * (i + 1)) % MOD;
	}
}

struct Connection {
	vector<int>friends;
	vector<int>block;
	vector<int>friendable;
	Connection() {};
};

int main() {

	string S;
	cin >> S;

	string ans = S[2] == S[3] && S[4] == S[5] ? "Yes" : "No";
	cout << ans << endl;
}



Measured memory_bytes: 2560
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <fstream>
#include <functional>

using namespace std;
using ll = long long;

#define all(x) (x).begin(),(x).end()
#define PRI(n) cout << n << " "<<endl;
#define PRI2(n, m) cout << n << " " << m << " "<<endl;

#define REP(i, n)  for(int i = 0; i < (int)n; ++i)
#define FOR(i, t, n)  for(int i = t; i <= (int)n; ++i)

const char alphabet[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                           's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const ll MOD = 1e9 + 7;

struct edge;
struct UnionFind;

bool isPrime(ll x);

ll GCD(ll a, ll b);

ll LCM(ll a, ll b);

ll nCr(int n, int r);


struct UnionFind {
    vector<int> par;
    vector<int> rank;

    UnionFind(int N) {
        for (int i = 0; i < N; ++i) {
            par.push_back(i);
            rank.push_back(0);
        }
    }

    int find(int x) {
        if (par[x] == x)return x;
        else return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)return;
        if (rank[x] < rank[y])par[x] = y;
        else {
            par[y] = x;
            if (rank[x] == rank[y])rank[x]++;
        }
    }

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

ll M, N;
bool s[10][10];
bool p[10];

int main() {
    ll N, M;
    string S;
    cin >> S >> M;
    REP(i, S.length()) {
        if (S[i] != '1'||i == M-1) {
            PRI(S[i])
            break;
        }
    }
    return 0;
}

struct edge {
    int to, cost;
    bool flag = false;
};

bool isPrime(ll x) {
    if (x == 0)return 0;
    if (x == 1)return 0;
    if (x == 2)return 1;
    if (x % 2 == 0)return 0;
    FOR(i, 3, x - 1) {
        if (x % i == 0)return 0;
    }
    return 1;
}

ll GCD(ll a, ll b) {
    if (b == 0)return a;
    return GCD(b, a % b);
}

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll nCr(int n, int r) {
    vector<ll> C(r + 1);
    C[0] = 1;
    FOR(i, 1, n) for (int j = min(i, r); j < 1; --j)C[j] = (C[j] + C[j - 1]) % MOD;
    return C[r];
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll H[50];

int main() {
    ll N;
    cin >> N;
    REP(i, N) {
        cin >> H[i];
    }
    ll ans = 0;
    REP(i, N) {
        bool e = true;
        REP(j, i) {
            if (H[j] > H[i])
                e = false;
        }
        if (e)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
l=raw_input()
k=l.split()
a=0.0
b=0.0
a=int(k[0])
b=int(k[1])
#
print int((a-(a%b))/b),
print int(a%b),
a*=1.0
b*=1.0
if b==1:
        print a*1.0
else:
        if a/b>0.0000002:
                print a/b
        else:   print "0.00000001.99999982"

Measured memory_bytes: 6424
n = int(input())
li = [input().split() for _ in range(n)]
x = input()
flag = 0
ans = 0

for i in range(n):
    s = li[i][0]
    if flag == 1:
        ans += int(li[i][1])
    if x == s:
        flag = 1

print(ans)

Measured memory_bytes: 3064
def main():
    N, MA, MB = list(map(int, input().split()))
    chemicals = [list(map(int, input().split())) for _ in range(N)]
    INF_COST = 1 + sum([chemical[2] for chemical in chemicals])
    MAX_A, MAX_B = 400, 400
    # dp[a][b]: 物質Aをaグラム、物質Bをbグラム入手するのに必要な最小コスト
    #           状態数は400 * 400 = 160000
    #           薬品の個数は40個
    #           → 更新ステップ数は 160000 * 40 = 6400000 = 6.4 * (10**6)
    dp = [[INF_COST for _ in range(1 + MAX_B)] for _ in range(1 + MAX_A)]
    dp[0][0] = 0
    for chemical in chemicals:
        da, db, dc = chemical
        for a in range(MAX_A, -1, -1):
            if a + da > MAX_A:
                continue
            for b in range(MAX_B, -1, -1):
                if b + db > MAX_B:
                    continue
                dp[a + da][b + db] = min(dp[a + da][b + db], dc + dp[a][b])
    ans = INF_COST
    scale = 1
    while scale * MA <= MAX_A and scale * MB <= MAX_B:
        ans = min(ans, dp[scale * MA][scale * MB])
        scale += 1
    if ans == INF_COST:
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  string S, T;
  cin >> S >> T;
  int N = S.size();
  int M = T.size();
  int ans = INT_MAX;
  for (int i = 0; i < N; i++) {
    int tmp = 0;
    for (int j = 0; j < M; j++) {
      if (i + j >= N) goto NG; 
      if (S.at(i + j) != T.at(j)) tmp++; 
    }
    ans = min(ans, tmp);
    NG:;
  }
  cout << ans << "\n";
}

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

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > v(n);

    for(int i = 0; i < n; i++){
        cin >> v[i].first >> v[i].second;
    }

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

    for(int i = 0; i < n; i++){
        cout << v[i].first << " " << v[i].second << endl;
    }
    cout << flush;
}


Measured memory_bytes: 3628
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<cmath>
#include<iomanip>
using namespace std;

int main(void){
	int d,b,a[100],c,q[100],hokan,ue,mae;
	cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6];
	cin>>q[1]>>q[2]>>q[3]>>q[4]>>q[5]>>q[6];
	if(a[1]==q[1]&&a[2]==q[2]&&a[3]==q[3]&&a[4]==q[4]&&a[5]==q[5]&&a[6]==q[6]){
				cout<<"Yes"<<endl;
				return 0;
	}
	for(d=0;d<4;d++){
		for(b=0;b<4;b++){
			hokan=a[2];
			a[2]=a[3];
			a[3]=a[5];
			a[5]=a[4];
			a[4]=hokan;
			if(a[1]==q[1]&&a[2]==q[2]&&a[3]==q[3]&&a[4]==q[4]&&a[5]==q[5]&&a[6]==q[6]){
				c++;
			}
		}
		hokan=a[1];
		a[1]=a[2];
		a[2]=a[6];
		a[6]=a[5];
		a[5]=hokan;
	}

	hokan=a[1];
	a[1]=a[3];
	a[3]=a[6];
	a[6]=a[4];
	a[4]=hokan;
	for(b=0;b<4;b++){
		hokan=a[2];
		a[2]=a[3];
		a[3]=a[5];
		a[5]=a[4];
		a[4]=hokan;
		if(a[1]==q[1]&&a[2]==q[2]&&a[3]==q[3]&&a[4]==q[4]&&a[5]==q[5]&&a[6]==q[6]){
			c++;
		}
	}
	hokan=a[1];
	a[1]=a[3];
	a[3]=a[6];
	a[6]=a[4];
	a[4]=hokan;
	hokan=a[1];
	a[1]=a[3];
	a[3]=a[6];
	a[6]=a[4];
	a[4]=hokan;
	for(b=0;b<4;b++){
			hokan=a[2];
			a[2]=a[3];
			a[3]=a[5];
			a[5]=a[4];
			a[4]=hokan;
			if(a[1]==q[1]&&a[2]==q[2]&&a[3]==q[3]&&a[4]==q[4]&&a[5]==q[5]&&a[6]==q[6]){
				c++;
			}
		}
	if(c>0){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
using namespace std;
int h,w;
string tbl[80];
string T[80][80];

string Max(string a,string b){
  int n = a.length();
  int m = b.length();
  if(n>m) return a;
  if(n<m) return b;
  for(int i=0;i<n;++i){
    if(a[i]>b[i]) return a;
    if(a[i]<b[i]) return b;
  }
  return a;
}

bool isnum(char c){
  return '0'<=c && c<='9';
}

int main(){
  while(cin>>w>>h,w||h){
    for(int i=1;i<=h;++i){
      string tmp; cin>>tmp;
      reverse(tmp.begin(),tmp.end());
      tmp+='A';
      reverse(tmp.begin(),tmp.end());      
      tbl[i] = tmp;
    }
    for(int i=0;i<=h;++i)
      for(int j=0;j<=w;++j)
	T[i][j]="";
    for(int i=1;i<=h;++i)
      for(int j=1;j<=w;++j)
	if(isnum(tbl[i][j])){
	  T[i][j] = Max(T[i-1][j],T[i][j-1])+tbl[i][j];
	  if(T[i][j]=="0") T[i][j]="";
	}

    string ans="";
    for(int i=1;i<=h;++i)
      for(int j=1;j<=w;++j)
	ans = Max(ans,T[i][j]);
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1452
import java.util.*;
public class Main {

    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();
       int A = sc.nextInt();
       int B = sc.nextInt();
       String S = sc.next();
       int rank = 0;
       int rankb = 0;
       boolean firstRank = true; 
       
       for(int i = 1 ; i<= N; i++ )
       {
           switch(S.charAt(i-1)){
           case 'a':
               if (rank < A+B ){
                   System.out.println("Yes");
                   rank++;
               }else{
                   System.out.println("No");
               }
                   break;
            case 'b':
                if(rank < A+B ){
                    if (rankb < B || firstRank ) {
                        System.out.println("Yes");
                        firstRank = false;
                        rankb++;
                        rank++;
                    }else {
                        System.out.println("No");
                    }
                }
                else{
                    System.out.println("No");
                }
                break;
            case 'c':
                System.out.println("No");    
       }
       }
       
    }
}


Measured memory_bytes: 23792
#include <bits/stdc++.h>
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(20);
    int n; cin >> n;
    vector<int> a(n);
    for (int &x : a) {
        cin >> x;
    }
    int res = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0 && a[i] & 1) {
            res++;
        }
    }
    cout << res << "\n";
}


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
struct ticket
{
    int f;
    int m;
    int money;
};
int calculate_ticket(ticket ticket[], int fridge[], int microwave[], int ticket_number);
int main()
{
    int fridge_number, microwave_number, ticket_number;
    cin >> fridge_number >> microwave_number >> ticket_number;
    int fridge[fridge_number], microwave[microwave_number];
    ticket ticket[ticket_number];
    for (int i = 0; i < fridge_number; i++)
    {
        cin >> fridge[i];
    }

    for (int i = 0; i < microwave_number; i++)
    {
        cin >> microwave[i];
    }

    for (int i = 0; i < ticket_number; i++)
    {
        cin >> ticket[i].f >> ticket[i].m >> ticket[i].money;
    }
    int min = calculate_ticket(ticket, fridge, microwave, ticket_number);
    int min_f = fridge[0], min_m = microwave[0];
    for (int i = 1; i < fridge_number; i++)
    {
        if (fridge[i] < fridge[0])
        {
            min_f = fridge[i];
        }
    }
    for (int i = 1; i < microwave_number; i++)
    {
        if (microwave[i] < microwave[0])
        {
            min_m = microwave[i];
        }
    }

    int result = (min_f + min_m < min) ? min_f + min_m : min;
    cout << result << endl;
}
int calculate_ticket(ticket ticket[], int fridge[], int microwave[], int ticket_number)
{
    int min = fridge[ticket[0].f - 1] + microwave[ticket[0].m - 1] - ticket[0].money;
    for (int i = 0; i < ticket_number; i++)
    {
        if (fridge[ticket[i].f - 1] + microwave[ticket[i].m - 1] - ticket[i].money < min)
        {
            min = fridge[ticket[i].f - 1] + microwave[ticket[i].m - 1] - ticket[i].money;
        }
    }
    return min;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
signed main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int i, mina = 1e9;
    for(i=0;i<=n-m;i++)
    {
        string ns = s.substr(i, m);
        //cout << ns << '\n';
        int j, cnt = 0;
        for(int j=0;j<m;j++)
            if(ns[j] != t[j])
                cnt++;
        mina = min(mina, cnt);
    }
    cout << mina;
}

Measured memory_bytes: 3628