akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> A;
void input(){
    fast_io();
    cin >> N;
    A = fetch_vec<ll>(N);
}

int solve(){
    vector<ll> AS(N+1,0);
    map<ll,ll> mp;
    for (int i = 0; i < N; i++)
    {
        AS[i+1] = AS[i]+A[i];
        mp[AS[i+1]]++;
    }
    mp[0]++;
    ll ans = 0;
    for(auto p:mp){
        ans += p.second*(p.second-1)/2;
    }
    cout << ans << endl;

    
    return 0;
}   

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

Measured memory_bytes: 15872
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

constexpr const int N_MAX = 100010;
constexpr const int sqrtN = 300;

int N, K;
int a[N_MAX];
int b[N_MAX / sqrtN + 1];

void build()
{
  for (int i = 1; i <= N; ++i) {
    b[i / sqrtN] = __gcd(b[i / sqrtN], a[i]);
  }
}

int query(int l, int r)
{
  int ret = 0;
  while(l < r && l % sqrtN != 0) ret = __gcd(ret, a[l++]);
  while(l < r && r % sqrtN != 0) ret = __gcd(a[--r], ret);

  for (int i = l/sqrtN; i < r/sqrtN; ++i) {
    ret = __gcd(ret, b[i]);
  }

  return ret;
}

signed main()
{
  iostreamBooster();

  cin >> N;
  K = (N + sqrtN - 1) / sqrtN;

  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
  }

  build();

  int maxv = 0;
  for (int i = 1; i <= N; ++i) {
    chmax(
        maxv,
        __gcd(query(1, i), query(i+1, N+1))
    );
  }

  cout << maxv << endl;


  return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a, b, c, x;
cin >> a >> b >> c >> x;
int ans = 0;
for (int i = 0; i <= a; i++)
{
    for (int j = 0; j <= b; j++)
    {
        for (int k = 0; k <= c; k++)
        {
            int sum = 500*i + 100*j + 50*k;
            if (sum==x)
            {
                ans = ans + 1;
            }
            
        }
        
    }
    
}
cout << ans << endl;

}

Measured memory_bytes: 3592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
#include <limits>
using namespace std;
// 素因数分解
typedef pair<long long, long long> P;
vector<P> prime_factorize(long long n)
{
vector<P> res;
for (long long p = 2; p * p <= n; ++p)
{
if (n % p != 0)
continue;
int num = 0;
while (n % p == 0)
{
++num;
n /= p;
}
res.push_back(make_pair(p, num));
}
if (n != 1)
res.push_back(make_pair(n, 1));
return res;
}
// 因数分解
long long gcd(long long x, long long y)
{
  if (y == 0)
  {
    return x;
  }
  else
  {
    return gcd(y, x % y);
  }
}
const int MOD = 1000000007;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)

int main()
{
    int n;
    cin >> n;
    if(n%2==1){
    cout << n / 2 +1<< endl;
    }else{
        cout << n / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 3612
n,*d=open(0).read().split()
n=int(n)
s=set()
for i in range(n):
    for j in range(i+1,n+1):
        s|={int(''.join(d[i:j]))}
for i,j in enumerate(sorted(s)):
    if i!=j:
        print(i)
        break


Measured memory_bytes: 110524
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n, l;
	string s[1000];
	cin >> n>>l;
	for (int i = 0; i < n; i++) cin >> s[i];
	sort(s, s + n);
	for (int j = 0; j < n; j++) {
		cout << s[j];
	}
	cout << endl;
	int x;
	cin >> x;
	return 0;
}

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

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  long long sum = 0;
  for (int i = 0; i < m; ++i) {
    int a;
    cin >> a;
    sum += a;
  }
  if (n >= sum) cout << n - sum;
  else cout << -1;

}


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

int main(void){
    string s;
    cin >> s;
    char ans[100];
    int count = 0;

    for(int i = 0; i < s.length(); i++){
        if(i % 2 == 0){
            cout << s[i];
        }
    }

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c - '0';}

// TODO: write
int main() { 
  string s;cin>>s;
  ll n;cin>>n;
  rep(i,s.size()){
    if('z'-s[i]+1 > n || s[i] == 'a')continue;
    n -= 'z'-s[i]+1;
    s[i] = 'a';
  }
  if(n != 0){
    s[s.size()-1] = (s[s.size()-1]-'a' + n%26)%26 + 'a';
  }
  print(s);
  return 0;
}

Measured memory_bytes: 512
a, b, c = map(int, input().split())
count = 0
for i in range(1, int(c**0.5)+1):
    if c % i == 0:
        if i >= a and i <= b:
            count += 1
        if c != i*i:
            if c/i >= a and c/i <= b:
                count += 1
print(count)


Measured memory_bytes: 5636
{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Data.Int
import Data.Foldable
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

newtype FixF f = InF { outF :: f (FixF f) }

cata :: Functor f => (f a -> a) -> FixF f -> a
cata !phi = phi . fmap (cata phi) . outF
{-# INLINE cata #-}

ana :: Functor f => (a -> f a) -> a -> FixF f
ana !psi = InF . fmap (ana psi) . psi
{-# INLINE ana #-}

hylo :: Functor f => (f x -> x) -> (y -> f y) -> (y -> x)
hylo !phi !psi = cata phi . ana psi
{-# INLINE hylo #-}

data Node f a x = Node !a !(f x)
  deriving Show

instance Functor f => Functor (Node f a) where
  fmap f (Node a fx) = Node a (fmap f fx)

newtype Cofree f a = Cofree { runCofree :: FixF (Node f a) }

instance Functor f => Functor (Cofree f) where
  fmap f = Cofree . ana (phi . outF) . runCofree where
    phi (Node a b) = Node (f a) b

extract :: Functor f => Cofree f a -> a
extract !cf = case outF (runCofree cf) of
  Node a _ -> a
{-# INLINE extract #-}

sub :: Functor f => Cofree f a -> f (Cofree f a)
sub !cf = case outF (runCofree cf) of
  Node _ b -> fmap Cofree b
{-# INLINE sub #-}

histo :: Functor f => (f (Cofree f a) -> a) -> FixF f -> a
histo !phi = extract . cata ap
  where ap !a = Cofree $ InF $ Node (phi a) (fmap runCofree a)
{-# INLINE histo #-}

dyna :: Functor f => (f (Cofree f x) -> x) -> (y -> f y) -> (y -> x)
dyna !phi !psi = extract . hylo ap psi
  where ap !a = Cofree $ InF $ Node (phi a) (fmap runCofree a)
{-# INLINE dyna #-}

data DP a = N | P !Int !a
  deriving (Eq, Show)

dpmap :: (a -> b) -> DP a -> DP b
dpmap f N       = N
dpmap f (P n a) = P n (f a)
{-# INLINE [2] dpmap #-}
{-# RULES
"dpmap/covariant" forall f g x. dpmap f (dpmap g x) = dpmap (f . g) x
  #-}

instance Functor DP where
  fmap = dpmap

solve :: Int -> VU.Vector Int16 -> Int
solve !n !hs = dyna phi psi $ (n - 1)
 where
  psi !0 = N
  psi !n = P n (n - 1)

  phi !N        = 0
  phi !(P n dp) = min f1 f2
   where
    h  = hs VU.! n
    f1 = extract dp + fromIntegral (abs (h - hs VU.! (n - 1)))
    f2 = case sub dp of
      N     -> fromIntegral $ abs $ hs VU.! 1 - hs VU.! 0
      P _ a -> extract a + fromIntegral (abs (h - hs VU.! (n - 2)))

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  hs <- VU.unfoldrN n readInt <$> B.getLine
  print $ solve n hs


Measured memory_bytes: 19068
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int N,need[3],sum[256],len[8],bn[256];
int get_bit(int x,int v){return (x>>v)&1;}
int main(){
    R(N);
    REP(i,3)R(need[i]);
    REP(i,N)R(len[i]);
    REP(i,1<<N){
        REP(j,N){
            if(get_bit(i,j))sum[i]+=len[j],bn[i]++;
        }
    }
    int an=1e9;
    REPP(i,1,1<<N)REPP(j,1,1<<N)REPP(k,1,1<<N){
        if((i|j|k)!=i+j+k)continue;
        an=min(an,abs(sum[i]-need[0])+abs(sum[j]-need[1])+abs(sum[k]-need[2])+(bn[i|j|k]-3)*10);
    }
    W(an);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long LL;
typedef vector<LL> VEC;
typedef vector<VEC> VVEC;
typedef  pair<LL,LL> P;


const LL INF=1<<30;
const LL MOD=1000000007;




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



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,a=1;
  cin >>n>>k;
  for(int i=0;i<n;i++){
    if(a*2<=a+k){
      a*=2;
    }
    else{
      a+=k;
    }
  }
  cout <<a<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<map>;
#include<iostream>
#include<algorithm>
using namespace std;
string s;
string t;
int main()
{
	bool sign=true;
	cin>>s;
	cin>>t;
	s+=s;
	int cnt=0;	
	int ans=t.size();
	for(int i=0;i<s.size();i++)
	{
		if(t[cnt]==s[i]){
			for(;cnt<ans;cnt++,i++)
				if(t[cnt]!=s[i])
					break;
			if(cnt==ans)
			break;
		}
			cnt=0;
	}		
	if(cnt!=ans)
		sign=false;
	if(sign)
		puts("Yes");
	else
		puts("No");
	return 0;
}

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

int main(){
    int N,dif=0;
    cin >> N;
    int arr[N];
    for (int i=0;i<N;i++){
        cin >> arr[i];
    }
    sort(arr,arr+N,greater<int>());

    for (int i=0;i<N;i++){
        int p=-1;
        for (int j=0;j<=i;j++){
            p=p*(-1);
        }
        dif = dif + p*arr[i];
    }
    cout << dif << endl;
    return 0;
}

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

const int maxn = 100010;

int main()
{
	int n;
	int a[maxn];
	memset(a, 0, sizeof(a));
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);

	}
	sort(a, a + n);
	int num = 0;
	for (int i = 0; i <=n; i++)
	{
		if (a[i] != a[i + 1])
		{
			num++;
		}
		else
			i++;
	}
	printf("%d", num);


	system("pause");
	return 0;

}

Measured memory_bytes: 760
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

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

	vector<int> V;

	for (int i = 0; i < N; i++) {
		int a;
		cin >> a;
		V.push_back(a);
	}

	sort(V.begin(), V.end(), greater<int>());

	int ans = 0;

	for (int i = 0; i < N; i++) {
		if (i % 2 == 0) {
			ans += V[i];
		}
		else ans -= V[i];
	}

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


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


int main() {
  ll W,H,x,y;
  cin >> W >> H >> x >> y;
  double ans = W*H;
  ans /= 2.0;
  int f = (x == double(W)/2.0 && y == double(H)/2.0) ? 1 : 0;
  printf("%.15f %d", ans, f);
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

dxdy4 = ((-1, 0), (0, -1), (0, 1), (1, 0))


def main():
    H, W = map(int, readline().split())
    Ch, Cw = map(int, readline().split())
    Dh, Dw = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    Ch -= 1
    Cw -= 1
    Dh -= 1
    Dw -= 1

    grid = [[-1] * W for _ in range(H)]
    n = 0
    for i in range(H):
        for j in range(W):
            if grid[i][j] != -1 or S[i][j] == '#':
                continue
            grid[i][j] = n
            queue = deque([(i, j)])
            while queue:
                x, y = queue.popleft()
                for dx, dy in dxdy4:
                    nx, ny = x + dx, y + dy
                    if 0 <= nx < H and 0 <= ny < W and grid[nx][ny] == -1 and S[nx][ny] == '.':
                        grid[nx][ny] = n
                        queue.append((nx, ny))
            n += 1

    if grid[Ch][Cw] == grid[Dh][Dw]:
        print(0)
        return

    G = [set() for _ in range(n)]
    for i in range(H):
        for j in range(W):
            if grid[i][j] == -1:
                continue
            this_num = grid[i][j]
            for dx in range(-2, 3, 1):
                for dy in range(-2, 3, 1):
                    nx, ny = i + dx, j + dy
                    if 0 <= nx < H and 0 <= ny < W and grid[nx][ny] not in (-1, this_num):
                        G[this_num].add(grid[nx][ny])
                        G[grid[nx][ny]].add(this_num)

    queue = deque([grid[Ch][Cw]])
    dist = [-1] * n
    dist[grid[Ch][Cw]] = 0
    while queue:
        v = queue.popleft()
        for nv in G[v]:
            if dist[nv] == -1:
                dist[nv] = dist[v] + 1
                queue.append(nv)

    print(dist[grid[Dh][Dw]])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 126484
#include<stdio.h>
int d[201][201],l[8],u[8],n,m,r,a;
void df(int c,int p,int e){
  if(c==r){if(a>e)a=e;return;}
  for(int i=0;i<r;i++)if(u[i]){u[i]=0;if(p==-1)df(c+1,i,0);else df(c+1,i,e+d[l[p]][l[i]]);u[i]=1;}
}
int main(){
  int i,j,k,x,y,z;
  scanf("%d%d%d",&n,&m,&r);n++;
  for(i=0;i<r;i++){scanf("%d",&l[i]);u[i]=1;}
  for(i=1;i<n;i++)for(j=1;j<n;j++)d[i][j]=(i!=j)*(1<<29);
  for(i=0;i<m;i++){scanf("%d%d%d",&x,&y,&z);if(d[x][y]>z)d[x][y]=d[y][x]=z;}
  for(k=1;k<n;k++)for(i=1;i<n;i++)for(j=1;j<n;j++)if(d[i][j]>d[i][k]+d[k][j])d[i][j]=d[i][k]+d[k][j];
  a=1<<29;df(0,-1,0);
  printf("%d",a);
}


Measured memory_bytes: 1840
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
typedef long long int ll;

int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int cnt=0;
	multiset<int> mt;
	for(int i=0;i<n;i++){
		auto iter =mt.lower_bound(a[i]);
		if(iter==mt.begin()){
			cnt++;
			mt.insert(a[i]);
		}
		else{
			iter--;
			mt.erase(iter);
			mt.insert(a[i]);
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 5376
#!/bin/python

import math
import os
import random
import re
import sys

def solution(a,b):
    sum = 0
    for i in range(b-a):
        sum += i+1
    return sum-b
    

if __name__ == '__main__':
    nk = raw_input().split()
    a = int(nk[0])
    b = int(nk[1])
    
    result = solution(a,b)

    print result

Measured memory_bytes: 2936
import java.util.Scanner;
class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    boolean[] hasSunuke = new boolean[N];
    for(int i = 1;i <= K;i++) {
      int di = sc.nextInt();
      for(int j = 0;j < di;j++) {
        int a = sc.nextInt();
        hasSunuke[a-1] = true;
      }
    }
    int result = 0;
    for(int i = 0;i < hasSunuke.length;i++) {
      if(!hasSunuke[i]) {
        result++;
      }
    }
    System.out.println(result);
  }
}

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

typedef long long ll;

typedef pair<ll, int> p;

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

    int N;
    cin >> N;

    vector<ll> a(3 * N);

    for(int i = 0; i < 3 * N; i++) cin >> a[i];

    priority_queue<ll, vector<ll>, greater<ll> > lq;
    vector<ll> ls(N * 2);
    vector<ll> la(N + 1);

    ll lc = 0;

    ls[0] = a[0];
    for(int i = 1; i < 2 * N; i++) {
        ls[i] += ls[i - 1] + a[i];
    }

    for(int i = 0; i < N; i++) {
        lq.push(a[i]);
    }

    la[0] = ls[N - 1];
    for(int i = 0; i < N; i++) {
        lq.push(a[i + N]);
        lc += lq.top();
        lq.pop();
        la[i + 1] = ls[N + i] - lc;
    }

    priority_queue<ll> rq;
    vector<ll> rs(N * 2);
    vector<ll> ra(N + 1);

    ll rc = 0;

    rs[0] = a[3 * N - 1];
    for(int i = 1; i < 2 * N; i++) {
        rs[i] += rs[i - 1] + a[3 * N - 1 - i];
    }

    for(int i = 3 * N - 1; i >= 2 * N; i--) {
        rq.push(a[i]);
    }

    ra[0] = rs[N - 1];
    for(int i = 0; i < N; i++) {
        rq.push(a[2 * N - 1 - i]);
        rc += rq.top();
        rq.pop();
        ra[i + 1] = rs[N + i] - rc;
    }

    ll ans = -pow(10, 18);

    for(int i = 0; i <= N; i++) {
        ans = max(ans, la[i] - ra[N - i]);
    }

    cout << ans << endl;
}

Measured memory_bytes: 9588
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;

int i,n;
string s[N];

void solve()
{
    map<string,int> cnt;
    cin>>n;
    for(i=1;i<=n;++i)
    {
        cin>>s[i];
        cnt[s[i]]++;
    }
    cout<<"AC x "<<cnt["AC"]<<endl;
    cout<<"WA x "<<cnt["WA"]<<endl;
    cout<<"TLE x "<<cnt["TLE"]<<endl;
    cout<<"RE x "<<cnt["RE"]<<endl;
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 6724
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin>>N;

  using T = tuple<string, int, int>;
  vector<T> A(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    A[i] = T(s, -p, i);
  }

  sort(A.begin(), A.end());
  for(int i=0;i<N;i++){
    int ans;
    tie(ignore, ignore, ans) = A[i];
    cout<<ans+1<<endl;
  }

  
  
  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  REP(x,1,500000) {
    ll y=x*1.08;
    if(n==y) {
      pr(x);
      return;
    }
  }
  pr(":(");
}

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


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

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

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

    bool has_X = false;
    for (int p_i : p) {
        if (p_i == X) {
            has_X = true;
            break;
        }
    }
    if (!has_X) {
        cout << X << endl;
        return 0;
    }

    for (int i = 1; i <= 101; ++i) {
        bool has_Xminusi = false;
        for (int p_i : p) {
            if (p_i == X - i) {
                has_Xminusi = true;
                break;
            }
        }
        if (!has_Xminusi) {
            cout << X - i << endl;
            return 0;
        }

        bool has_Xplusi = false;
        for (int p_i : p) {
            if (p_i == X + i) {
                has_Xplusi = true;
                break;
            }
        }
        if (!has_Xplusi) {
            cout << X + i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3628
program arc102_a
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: n,k,i
    integer(int64):: a0, ah
    read*, n,k
    a0=0
    ah=0

    do i=1,n
        if (mod(i,k)==0) a0=a0+1
    end do

    if (mod(k,2) == 0) then
        do i=1,n
            if (mod(i,k) == k/2) ah=ah+1
        end do
    end if

    print'(i0)', a0**3 + ah**3


end program arc102_a

Measured memory_bytes: 256
s = gets.chomp.split('')

f = 1
s.length.times do |i|
  if i.even? && s[i] == 'L'
    print 'No'
    f = 0
    break
  elsif i.odd? && s[i] == 'R'
    print 'No'
    f = 0
    break
  end
end

print 'Yes' if f == 1

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

signed main () {
	int n;
	cin >> n;
	vector < int > a(n + 1, 0);
	for (int i = 0; i < n - 1; ++i) {
		int p;
		cin >> p;
		++a[p];
	}
	for (int i = 1; i <= n; ++i)	
		cout << a[i] << '\n';
}


Measured memory_bytes: 4056
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long

using namespace __gnu_pbds;
using namespace std;

template <class T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

int main()
{
    usaco();
    ll n, k;
    cin >> n >> k;
    vector <vector <ll>> dp(n+1, vector <ll> (k+1));
    vector <ll> w(n), v(n);
    for (int i = 0; i < n; ++i) cin >> w[i] >> v[i];
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= k; ++j)
        {
            if (i == 0 || j == 0) dp[i][j] = 0;
            else if (w[i-1] <= j) dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i-1]]+v[i-1]);
            else dp[i][j] = dp[i-1][j];
        }
    }
    cout << dp[n][k] << '\n';
}


Measured memory_bytes: 83156
#include<bits/stdc++.h>
using namespace std;
#define infinity 100000007
#define mx 50007
int ans,n,coin[22],amount;
int table[mx];

int init()
{
    for(int i=1;i<=amount;i++)
        table[i]=INT_MAX;

        table[0]=0;
}

void solve()
{
    int res;
    for(int i=1;i<=amount;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(coin[j]<=i)
            {
            res=table[i-coin[j]];
            if(res!=INT_MAX && res+1<table[i])
            {
                table[i]=res+1;
       //         cout<<" table "<<table[i]<<" ";
            }
            }

        }
    }


}

bool compare(int a,int b)
{
    return a>b;
}

int main(){
cin>>amount>>n;
init();
for(int i=0;i<n;i++)cin>>coin[i];

sort(coin,coin+n,compare);
solve();
cout<<table[amount]<<endl;

return 0;
}



Measured memory_bytes: 3364
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*n
dp[1] = abs(h[0] - h[1])
for i in range(2, n):
    tmp = float("inf")
    for j in range(1, k+1):
        if i-j >= 0:
            tmp = min(tmp, dp[i-j] + abs(h[i-j] - h[i]))
    dp[i] = tmp

print(dp[-1])

Measured memory_bytes: 52448
n = int(input())
home = [[0 for i in range(20)] for j in range(15)]  #横最大20→間の#,縦最大3階*4棟+3行の空行
for i in range(n) :
 b, f, r, v = map(int, input().split())
 h = (b - 1) * 4 + f - 1
 w = r * 2 - 1
 s = v
 home[h][w] += s
for y in range(15) :
 for x in range(20) :
   if(y % 4 == 3) :
     home[y][x] = "#"
   elif(x % 2 == 0) :
     home[y][x] = " "
   print(home[y][x], end = "")
 print()


Measured memory_bytes: 5640
#include <stdio.h>

int main() {
	char s[4];
	char t[4];
	int i, ans = 0;

	scanf("%s", s);
	scanf("%s", t);

	for (i = 0; i < 3; i++) {
		if (s[i] == t[i]) {
			ans++;
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,j,N,M,K;
  vector<ll> v(N);
  string ss,sk,st;
  char ans[4];
  cin>>ss>>sk>>st;
  ans[0]=ss[0]-'a'+'A';
  ans[1]=sk[0]-'a'+'A';
  ans[2]=st[0]-'a'+'A';
  ans[3]='\0';
  printf("%s\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int heap;

int Right(int i){
  i=i*2+1;
  
  if(i>heap) return 500002;
  else return i;
  
}

int Left(int i){
  i=i*2;
  
  if(i>heap) return 500002;
  else return i;
  
}
 
void maxHeap(int A[],int i){
  int l = Left(i),r = Right(i);
  int largest,j;
 
  if( l <= heap && A[l] > A[i]) largest = l;
  
  else largest = i;
  
  if( r <= heap && A[r] > A[largest]) largest = r;
  
  if (largest != i){
    j=A[i];
    A[i]=A[largest];
    A[largest]=j;
    maxHeap(A,largest);
  }
}
 
void buildMHeap(int A[]){
    int i;
    
    for(i=heap/2;i>=1;i--){
      maxHeap(A,i);
    }
    
}
 
int main(){
    int i,A[500001];
     
    scanf("%d",&heap);
     
    for(i=1;i<=heap;i++){
      scanf("%d",&A[i]);
    }
 
    buildMHeap(A);
 
    for(i=1;i<=heap;i++){
      printf(" %d",A[i]);
    }
    
    printf("\n");
    return 0;
 }

Measured memory_bytes: 2552
#include<stdio.h>
int main(){

	int s,m,h;
	scanf("%d",&s);
	if(0<=s && s<=86400){
		h=s/3600;
		s=s%3600;
		m=s/60;
		s=s%60;
		printf("%d:%d:%d\n",h,m,s);
	}
	return 0;
}

Measured memory_bytes: 1808
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;



 

int main() {
    int a, b, c;
  cin >> a >> b >> c;
  
  cout << min(b/a, c) << endl;
}


 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  ll d,g;cin>>d>>g;
  vector<ll> ps(d), cs(d);
  for(int i=0;i<d;i++){
    cin>>ps[i]>>cs[i];
  }

  ll res=1000*1000*1000;
  for(int i=0; i < (1<<d); i++){
    ll score=0;
    ll prob=0;

    for(int j=d-1;j>=0;j--){
      if(score >= g) break;
      ll base = (100 * (j+1));
      if ( i & (1 << j ) ) {
        score += base * ps[j] + cs[j];
        prob += ps[j];
      }
    }

    // debug("comp");
    //     debug(prob);
    //     debug(score);

    for(int j=d-1;j>=0;j--){
      if(score >= g) break;
      if ( i & (1 << j ) ) continue;
      ll base = (100 * (j+1));
      if(ps[j]>=1) {
        ll max_ps = ps[j]-1;
        ll left = g - score;
        if(left >= base * max_ps){
          score += base * max_ps;
          prob += max_ps;
        } else {
          ll c_ps = left / base;
          score += base * c_ps;
          prob += c_ps;
          if(score < g){
            score += base;
            prob++;
          }
        }
      }
    }

    // debug("all");
    // debug(prob);
    // debug(score);

    if(score>=g)
        res = min(res, prob);
  }
  cout<<res<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		sc.close();

		long ans1 = 0;
		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (i % 2 == 1) {
				if (sum <= 0) {
					ans1 += 1 - sum;
					sum = 1;
				}
			} else {
				if (sum >= 0) {
					ans1 += 1 + sum;
					sum = -1;
				}
			}
		}

		long ans2 = 0;
		sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
			if (i % 2 == 1) {
				if (sum >= 0) {
					ans2 += 1 + sum;
					sum = -1;
				}
			} else {
				if (sum <= 0) {
					ans2 += 1 - sum;
					sum = 1;
				}
			}
		}

		System.out.println(Math.min(ans1, ans2));
	}
}


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

int main(){
    int K;
    string S;
    cin >> K >> S;
    if(S.size() <= K){
        cout << S << endl;
        return 0;
    } else {
        cout << S.substr(0, K) << "..." << endl;
        return 0;
    }
}

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
#include <list>
#include <stdexcept>
using namespace std;

#define ll long long
#define VEC2(type, name, dim0, dim1, init_val) vector<vector<type>> name(dim0, vector<type>(dim1, init_val))
#define IN(type, name) type name; cin >> name
#define IN_V(type, name, size) vector<type> name(size); for(auto& x: name) cin >> x
#define IN_VPair(type1, type2, name, size) vector<pair<type1, type2>> name(size); for(auto& x: name) cin >> x.first >> x.second
#define IN_VW(type, name, size) vector<type> name(size); for(auto& x: name)

#define REP(name, start, end) for(ll name = (start); (name) < (end); ++(name))
#define REPR(name, end, start) for(ll name = (start - 1); (name) >= (end); --(name))
#define ALL(iterable) (iterable).begin(), (iterable).end()

int main()
{
	cout << fixed << setprecision(6);
	IN(ll, m);
	IN(ll, d);

	ll cnt = 0;
	REP(i, 1, m + 1) {
		REP(j, 1, d + 1) {
			auto ten = j / 10;
			auto one = j % 10;
			if (ten > 1 && one > 1 and i == ten * one)++cnt;
		}
	}

	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pi pair<int, int>
#define l first
#define r second
#define all(x) x.begin(), x.end()
#define fori(a, b, step) for (int i = a; i < b; i += step)
#define forj(a, b, step) for (int j = a; j < b; j += step)
#define int long long

const int maxn = 5e5 + 1, mod = 1e9 + 7;

using namespace std;

bool v[1001][1001];
int a[maxn], b[maxn];

signed main() {
    string s; cin >> s;
    int ans = 0, bal = 0, cl = 0, mbal = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '>') {
            ++cl;
            if (bal == 0) {ans += cl - (cl <= mbal); b[i - cl + 1 + (cl <= mbal)]++; b[i + 1]--;}
            else {b[i + 1] = -bal; bal = 0;}
        } else {
            cl = 0;
            b[i + 1] = 1;
            ans += (++bal);
            mbal = bal;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 7708
#include <iostream>

using namespace std;
int main() {
	string s;
	cin >> s;
	
	int result = 1000;
	
	int size = s.length();
	for (int i = 0; i + 2 < size; ++i) {
		int x = stoi(s.substr(i, 3));
		
		x -= 753;
		if (x < 0)
			x *= -1;
		
		if (result > x)
			result = x;
	}
	
	cout << result << endl;
}

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

int main() {
  int W, H, x, y, r;
  cin >> W >> H >> x >> y >> r;
  if ((r <= x && x <= W - r) && (r <= y && y <= H - r)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 3116
#include <map>
#include <cstdio>
#include <iostream>

using namespace std ;

typedef long long LL ;


#define mkp make_pair
#define pll pair<LL, LL>

const LL B1 = 237ll ;
const LL B2 = 637ll ;
const int N = 300010 ;
const LL P1 = 998244353 ;
const LL P2 = 1004535809 ;

int n ;
LL ans ;
char s[N] ;
LL I1, I2 ;
LL g[N][2] ;
LL S[N], T[N] ;
map <pll, LL> buc ;

LL expow(LL a, LL b, LL p){
    LL ret = 1 ;
    while (b){
        if (b & 1)
            (ret *= a) %= p ;
        (a *= a) %= p ; b >>= 1 ;
    }
    return ret ;
}
int main(){
    cin >> n >> (s + 1) ;
    g[0][0] = g[0][1] = 1ll ; 
    I1 = expow(B1, P1 - 2, P1) ;
    I2 = expow(B2, P2 - 2, P2) ;
    for (int i = 1 ; i <= n ; ++ i){
        if (s[i] == '-'){
            g[i][0] = g[i - 1][0] ;
            g[i][1] = g[i - 1][1] ;
            S[i] = (S[i - 1] - g[i][0] + P1) % P1 ;
            T[i] = (T[i - 1] - g[i][1] + P2) % P2 ;
        }
        if (s[i] == '+'){
            g[i][0] = g[i - 1][0] ;
            g[i][1] = g[i - 1][1] ;
            S[i] = (S[i - 1] + g[i][0]) % P1 ;
            T[i] = (T[i - 1] + g[i][1]) % P2 ;
        }
        if (s[i] == '<'){
            g[i][0] = g[i - 1][0] * I1 % P1 ;
            g[i][1] = g[i - 1][1] * I2 % P2 ;
            S[i] = S[i - 1] ; T[i] = T[i - 1] ;
        }
        if (s[i] == '>'){
            g[i][0] = g[i - 1][0] * B1 % P1 ;
            g[i][1] = g[i - 1][1] * B2 % P2 ;
            S[i] = S[i - 1] ; T[i] = T[i - 1] ;
        }
		++ buc[mkp(S[i], T[i])] ;
    }
    ++ buc[mkp(0, 0)] ; LL x, y ;
    for (int i = 0 ; i < n ; ++ i){
		buc[mkp(S[i] , T[i])] -- ; 
        x = (S[i] + S[n] * g[i][0] % P1) % P1 ; 
		y = (T[i] + T[n] * g[i][1] % P2) % P2 ;
        ans += buc[mkp(x, y)] ; 
    }
    cout << ans << endl ; return 0 ;
}

Measured memory_bytes: 40192
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define INF 0xFFFFFF
#define endl '\n'
#define pb push_back
#define mp make_pair
const unsigned int mod = 1e9+7;
const int mx=1e5+5;

int main(){
	/*freopen(".gir", "r", stdin);
	freopen(".cik", "w", stdout); 
    */ios_base::sync_with_stdio(false);cin.tie(NULL);
	int n;cin >> n;
	double a[n];
	double sum=0;
	rep(i,n){
		cin >> a[i];
	}
	sort(a,a+n);
	sum=(a[0]+a[1])/2;
	ref(i,2,n-1){
		sum=(sum+a[i])/2;
	}
	printf("%.15f\n",sum);
}
	

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <list>
using namespace std;

int main()
{
    string S;
    cin >> S;
    bool flag = true;
    for (char c = 'a'; c <= 'z'; c++)
    {
        if ((int)S.find(c) < 0)
        {
            cout << c << endl;
            flag = false;
            break;
        }
    }
    if (flag)
    {
        cout << "None" << endl;
    }
    return 0;
}

Measured memory_bytes: 512
#include<cstdio>
const int inf=1<<29;
int N,M;
int G[15][15],g[1<<15],f[1<<13][15];
void cmax(int&a,int b){b>a?a=b:1;}
int main(){
	scanf("%d%d",&N,&M);
	while(M--){
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		--a,--b;
		G[a][b]=G[b][a]=c;
	}
	for(int S=1;S<1<<N;S++){
		int i=N;while(!(S>>i&1))i--;
		g[S]=g[S-(1<<i)];
		for(int j=i;j--;)if(S>>j&1)g[S]+=G[i][j];
	}
	int ans=-inf;
	for(int S=0;S<1<<N-2;S++){
		for(int i=1;i<N;i++)if(S>>i-1&1){
			int F=-inf;
			for(int T=S;T;T=T-1&S)if(T>>i-1&1){
				for(int j=1;j<N;j++)if((S-T>>j-1&1)&&G[i][j])cmax(F,f[S-T][j]+g[T<<1]+G[i][j]);
				if(G[i][N-1])cmax(F,g[S-T<<1|1<<N-1]+g[T<<1]+G[i][N-1]);
			}
			f[S][i]=F;
			if(G[0][i])cmax(ans,F+g[(1<<N-1)-1-S*2]+G[0][i]);
		}
		if(G[0][N-1])cmax(ans,g[S<<1|1<<N-1]+g[(1<<N-1)-1-S*2]+G[0][N-1]);
	}
	printf("%d\n",g[(1<<N)-1]-ans);
}

Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <iomanip>
#include <ios>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  int n = s.length();
  bool step = true;
  
  for(int i=0;i<n;i++){
    if(i % 2 == 0 && s[i] == 'L') step = false;
    if(i % 2 != 0 && s[i] == 'R') step = false;
  }
  
  if(step) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    b = input()
    at = ('A', 'T')
    cg = ('C', 'G')
    revAT = lambda x: at[0] if x != 'A' else at[1]
    revCG = lambda x: cg[0] if x != 'C' else cg[1]
    if b == 'A' or b == 'T': print(revAT(b))
    else: print(revCG(b))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-5;
const ld pi = acos(-1.0);



void solve() {
	int n; cin >> n;
	vector<int> a(n);
	rep(i, n) {
		cin >> a[i]; a[i]--;
	}
	vector<int> b(n), c(n - 1);
	rep(i, n) {
		cin >> b[i];
	}
	rep(i, n - 1) {
		cin >> c[i];
	}
	int ans = 0;
	rep(i, n) {
		int dish = a[i];
		ans += b[dish];
		if (i > 0 && a[i - 1] == dish - 1) {
			ans += c[dish - 1];
		}
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(50);
	//init();
	solve();

	//cout << "finish" << endl;
	//stop
		return 0;
}


Measured memory_bytes: 256
a,b,c = map(int, input().split())
if a<b:
    if b<c:
        print(a, b, c)
    else:
        if a<c:
            print(a, c, b)
        else:
            print(c, a, b)

else:
    if a<c:
        print(b, a, c)
    else:
        if b<c:
            print(b, c, a)
        else:
            print(c, b, a)


Measured memory_bytes: 5596
S = int(input())
MOD = 10 ** 9+7


def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


ans = 0
for i in range(1, 670):
  S_ = S - 3 * i
  if S_ < 0:
    break
  ans += cmb(S_+i-1,  i-1) % MOD
print(ans%MOD)

Measured memory_bytes: 9244
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <map>
#include <array>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    int a,b;
    cin >> a >> b;
    int ans;
    if(a <= b){
        ans = a;
    } else if(b < a){
        ans = a - 1;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256