akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  
  int n, a, b;
  cin >> n >> a >> b;
  
  vector<int> p(n);
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }
  
  int one=0, two=0, three=0;
  
  for(int i = 0; i < n; i++){
    if(p[i] <= a) one++;
    else if(a + 1 <= p[i] && p[i] <= b) two++;
    else if(p[i] >= b+1) three++;
  }
  
  cout << min({one, two, three});
   
}


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

constexpr int MOD = 1000000007;
// constexpr int MOD = 998244353;
constexpr int MAX = 10000000;

vector<long> fact(MAX), finv(MAX), inve(MAX);

void init() {
  fact.at(0) = fact.at(1) = 1;
  finv.at(0) = finv.at(1) = 1;
  inve.at(1) = 1;
  for (int i = 2; i < MAX; i++) {
    fact.at(i) = fact.at(i - 1) * i % MOD;
    inve.at(i) = MOD - inve.at(MOD % i) * (MOD / i) % MOD;
    finv.at(i) = finv.at(i - 1) * inve.at(i) % MOD;
  }
}

long com(long n, long r) {
  if (n < r || n < 0 || r < 0) return 0;
  return fact.at(n) * (finv.at(r) * finv.at(n - r) % MOD) % MOD;
}

long mpow(long a, long b) {
  long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

int main() {
  init();
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int K;
  string S;
  cin >> K >> S;
  int N = S.size();
  K += N;
  long ans = 0;
  for (int i = N; i <= K; i++) {
    long tmp = com(i - 1, N - 1);
    (tmp *= mpow(25, i - N)) %= MOD;
    (tmp *= mpow(26, K - i)) %= MOD;
    (ans += tmp) %= MOD;
  }
  cout << ans << "\n";
}

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

int main(){
	string a,b,c;
	cin>>a>>b>>c;
	char current = 'a';
	while(true){
		if(current == 'a'){
			if(a.length()==0){
				cout<<"A";
				return 0;
			}
			current = a[0];
			a=a.substr(1);
		}else if(current == 'b'){
			if(b.length()==0){
				cout<<"B";
				return 0;
			}
			current = b[0];
			b=b.substr(1);
		}else if(current == 'c'){
			if(c.length()==0){
				cout<<"C";
				return 0;
			}
			current = c[0];
			c=c.substr(1);
		}

	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c,n;
    c = 0;
    scanf("%d",&n);
    for(a=1;a<n;a++){
        for(b=1;b<n;b++){
            if(a*b < n)
            c = c + 1;
            if(a*b >= n)
            break ;
        }
    }
    printf("%d\n",c);
    return 0;
}

Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	int cnt=0;
	for(int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			cnt++;
		}
	}
	cout<<min(n-1,cnt+2*k)<<endl;
} 

Measured memory_bytes: 512
import sys
from heapq import heappush, heappop, heapify
from collections import defaultdict

N,M=map(int, sys.stdin.readline().split())

reward=defaultdict(lambda: []) 

hq=[]
for _ in range(N):
	a,b=map(int, sys.stdin.readline().split())
	reward[a].append(-1*b)


hq=[]
ans=0
for day in range(M-1,-1,-1):
	for r in reward[M-day]:
		heappush(hq,r)
	if hq:
		t=heappop(hq)
		ans+=t*-1

print ans

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

int main()
{
  int64_t a, b, c, d, e;
  cin >> a >> b >> c;
  if (c - a - b <= 0)
  {
    cout << "No" << endl;
    return 0;
  }
  d = (c - a - b) * (c - a - b);
  e = 4 * a * b;
  if (e < d)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}


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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long n,a,b;
    cin>>n>>a>>b;
    long long res=min(b-1,n-a);
    if((b-a+1)%2) res=min(res,a+(b-a)/2);
    else res=min(res,a-1+(b-a+1)/2);
    if((b-a)%2==0) res=min(res,(b-a)/2);
    else res=min(res,n-b+1+(b-a)/2);
    cout<<res;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int D = scan.nextInt();
		int T = scan.nextInt();
		int S = scan.nextInt();

		int target = S * T;

		if(target >= D) {
			System.out.println("Yes");
		}else
		{
			System.out.println("No");
		}


		scan.close();
	}
}

Measured memory_bytes: 35808
#include<cmath>
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	for(int n;scanf("%d",&n),n;){
		double bmi,best=1e9;
		int ibest=1000000000;
		for(int j=0;j<n;j++){
			int i,h,w;
			scanf("%d%d%d",&i,&h,&w);
			bmi=w/((h/100.0)*(h/100.0));
			if(abs(22-bmi)+1e-9<abs(22-best))
				best=bmi,ibest=i;
			else if(abs(abs(22-bmi)-abs(22-best))<1e-9)
				ibest=min(ibest,i);
		}
		printf("%d\n",ibest);
	}

	return 0;
}

Measured memory_bytes: 0
from collections import Counter
from itertools import product

n = int(input())
s = list(input())
s_l = list(reversed(s[n:]))

red = Counter(["".join([s[i] for i in range(n) if bit[i] == 1] + ["|"] + [s[i] for i in range(n) if bit[i] == 0]) for bit in product(range(2), repeat=n)])
blue = Counter(["".join([s_l[i] for i in range(n) if bit[i] == 1] + ["|"] + [s_l[i] for i in range(n) if bit[i] == 0]) for bit in product(range(2), repeat=n)])

ans = 0

for key, value in red.items():
	ans += value * blue[key]

print(ans)

Measured memory_bytes: 147364
// ABC178C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>

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


using ll = long long;
using P = pair<int, int>;

const int mod = 1000000000 + 7;

ll pow_mod(ll n, ll k) {
    if (k == 0) {
        return 1; // 0乗は1
    }
    else if (k % 2 == 1) { // 乗数が奇数
        return pow_mod(n, k - 1) * n % mod;
    }
    else { // 乗数が偶数
        ll t = pow_mod(n, k / 2);
        return t * t % mod;
    }
}
int main()
{
    ll n;
    cin >> n;

    ll n10 = pow_mod(10, n);
    ll n9 = pow_mod(9, n);
    ll n8 = pow_mod(8, n);
    ll ans = n10 % mod;
    ans = (ans - (n9 * 2) % mod) % mod;
    ans = (ans + n8) % mod;
    ans = (ans + mod) % mod;
    cout << ans << endl;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define MOD 1000000007ULL;
#define rep(i,n) for(int i=0;i<n;i++)


int main() {
  	int N;
  	cin>>N;
  	
  	if(N/100==N%10) cout<<"Yes"<<endl;
  	else cout<<"No"<<endl;
  
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
int r; cin >> r;
cout << r*r << endl;
}

Measured memory_bytes: 256
# include<cstdio>
# include<cstring>
# include<algorithm>
using namespace std;
const int N = 50 + 5;
typedef long long ll;
const ll inf = 1e18;
struct node
{
	int p;
	ll w,v;
}a[N];
int st[N],to[N << 1],nx[N << 1];
ll f[N * N * N],w[N],v[N];
int n,X,D,tot,all;
bool cmp(node z,node y) { return z.w * y.v > y.w * z.v; }
inline void add(int u,int v)
{ to[++tot] = v,nx[tot] = st[u],st[u] = tot; }
inline void dfs(int x) { w[x] = 1; for (int i = st[x] ; i ; i = nx[i]) dfs(to[i]),w[x] += w[to[i]],v[x] += v[to[i]]; all += n * w[x]; }
int main()
{
	scanf("%d%d%d",&n,&X,&D);
	scanf("%lld",&v[1]);
	for (int i = 2 ; i <= n ; ++i)
	{
		int p; scanf("%lld%d",&v[i],&p);
		add(p,i);
	} dfs(1);
	int lim = min(n,D);
	for (int i = 1 ; i <= n ; ++i) a[i] = (node){i,w[i],v[i]};
	for (int i = 1 ; i <= all ; ++i) f[i] = inf;
	sort(a + 1,a + n + 1,cmp);
	for (int i = 1 ; i <= n ; ++i)
		for (int j = 1 ; j <= lim ; ++j)
			for (int k = all ; k >= w[i] ; --k) f[k] = min(f[k],f[k - w[i]] + v[i]);
	int ans = 0;
	for (int i = 0 ; i <= all ; ++i)
	if (f[i] <= X)
	{
		int ret = i; ll s = X - f[i];
		for (int j = 1 ; j <= n ; ++j)
		if (s >= a[j].v)
		{
			ll c = min(max(0ll,(ll)D - n),s / a[j].v);
			if (a[j].p == 1) c = s / a[j].v;
			s -= c * a[j].v,ret += c * a[j].w;
			if (!s) break;
		} ans = max(ans,ret);
	} printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define SZ(v) int((v).size())
#define ALL(vec) begin(vec), end(vec)
using namespace std;
typedef long long i64;
template<typename T> inline bool uax(T &x, T y) {return (y > x) ? x = y, true : false;}
template<typename T> inline bool uin(T &x, T y) {return (y < x) ? x = y, true : false;}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
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 f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " =: " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
int const MOD = 1e9 + 7;
long long const INF = 1e18 + 42;
/*************************************/

i64 lcm(i64 a, i64 b) {
  i64 g = __gcd(a, b);
  a /= g;
  if (MOD / a / b == 0) kek(0);
  return a * b; 
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int n, m;
  cin >> n >> m;
  vector<i64> a(n);
  i64 ans = 1;
  for (auto &x : a) {
    cin >> x;
    if (x & 1) kek(0);
    x /= 2;
    ans = lcm(ans, x);
  }
  for (auto &x : a) {
    i64 b = ans / x;
    if (b % 2 == 0) kek(0);
  }
  cout << (m / ans) - (m / (ans * 2)) << '\n';
}


Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() uint32 {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return uint32(i)
}

func convertDigitsBits(n uint32) uint32 {
	var ret uint32
	for ; n > 0; n /= 10 {
		ret = ret | 1<<(n%10)
	}
	return ret
}
func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), int(nextInt())
	var pattern uint32
	for i := 0; i < k; i++ {
		pattern += (1 << nextInt())
	}
	for i := n; ; i++ {
		if convertDigitsBits(i)&pattern == 0 {
			fmt.Println(i)
			break
		}
	}
}


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

int main()
{
    string s, t, u;
    int a, b;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(s == u)
        cout << a-1 << " " << b << endl;
    else
        cout << a << " " << b-1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main
{
	public static void main(String[] args)
	{
	Scanner s=new Scanner(System.in);
	String st1=s.next();
	String st2=s.next();
	String ans="";
	int dp[][]=new int[st1.length()+1][st2.length()+1];
	for(int i=0;i<st2.length()+1;i++)
	dp[0][i]=0;
	for(int i=0;i<st1.length()+1;i++)
	dp[i][0]=0;
	for(int i=1;i<st1.length()+1;i++)
	{
	for(int j=1;j<st2.length()+1;j++)
	{
	 if(st1.charAt(i-1)==st2.charAt(j-1))
	   dp[i][j]=dp[i-1][j-1]+1;
	 else	
	  dp[i][j]=Math.max(dp[i-1][j],dp[i][j-1]);
	
	}
	
	}
	int i=st1.length();
	int j=st2.length();
	while(true)
	{
	if(i==0||j==0)
	break;
	if(dp[i][j]!=dp[i-1][j]&&dp[i][j]!=dp[i][j-1])
	{
	ans=st1.charAt(i-1)+ans;
	i--;
	j--;
	}
	else
	{
	if(dp[i][j]==dp[i-1][j])
	i--;
	else
	j--;
	}
	}
	//System.out.println(dp[st1.length()][st2.length()]);
	System.out.println(ans);
	}
}

Measured memory_bytes: 84356
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int

using namespace std;


int main() {
	speed;
	string b;
	cin >> b;
	if (b == "A")cout << "T";
	if (b == "T")cout << "A";
	if (b == "C")cout << "G";
	if (b == "G")cout << "C";
	ed;
	return 0;
}


Measured memory_bytes: 256
input()
a=list(map(int,input().split()))
sl=sum(a)//len(a)-1
sm=sum(a)//len(a)
sr=sum(a)//len(a)+1
l=0
m=0
r=0
for i in a:
    l+=(i-sl)**2
for i in a:
    m+=(i-sm)**2 
for i in a:
    r+=(i-sr)**2 
print(min(l,m,r))

Measured memory_bytes: 3188
N = gets.to_i
a = []
N.times{
    a << gets.to_i - 1
}
b = Array.new(N){false}
i = 0
c = 0
loop{
    if b[i]
        puts -1
        break
    end
    if i == 1
        puts c
        break
    end
    b[i] = true
    i = a[i]
    c += 1
}


Measured memory_bytes: 16088
from math import sqrt
from itertools import combinations


def main(n, d, x):
    ans = 0
    for a, b in combinations(x, 2):
        r = 0
        for c, d in zip(a, b):
            r += abs(c - d)**2

        if sqrt(r).is_integer():
            ans += 1

    print(ans)


if __name__ == '__main__':
    n, d = map(int, input().split())
    x = [list(map(int, input().split())) for _ in range(n)]

    main(n,d,x)


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

using ll= long long;
const ll INF=1LL<<60;
const ll MOD=1000000007;

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

int N;
vector<vector<ll>> dp;
deque<int> a;

ll rec(int l=0, int r=N, int turn=1){
    int x=a.front();
    int y=a.back();
    if(turn == 1) turn=0;
    else turn=1;
    if(r-l <= 1) return x*(1-turn)-x*turn; 
    if(r-l <= 2){
        if(turn == 0) return max(x, y)-min(x,y);
        else return -max(x,y)+min(x,y);
    }
    ll &ret=dp[l][r];
    if(ret != -1) return ret;
    if(turn == 0){
        a.pop_front();
        ret=rec(l+1, r, turn)+x;
        a.push_front(x);
        a.pop_back();
        chmax(ret, rec(l, r-1, turn)+y);
        a.push_back(y);
    }
    else{
        a.pop_front();
        ret=rec(l+1, r, turn)-x;
        a.push_front(x);
        a.pop_back();
        chmin(ret, rec(l, r-1, turn)-y);
        a.push_back(y);
    }
    return ret;
}

int main(){
    cin >> N;
    for(int i=0; i<N; i++){
        int x; cin >> x;
        a.push_back(x);
    }
    dp.assign(N+1, vector<ll>(N+1, -1));
    ll ans=rec();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 72960
#include <bits/stdc++.h>
using namespace std;
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;

int n;
int a[100001][3];
int dp[100001][3];

int f(int i,int last){
    if(i>=n)return 0;
    int x=0,y=0,z=0;
    if(last!=0)x=a[i][0]+f(i+1,0);
    if(last!=1)y=a[i][1]+f(i+1,1);
    if(last!=2)z=a[i][2]+f(i+1,2);

    return max({x,y,z});
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++)for(int j=0;j<3;j++)cin>>a[i][j];

    dp[0][0]=a[0][0];
    dp[0][1]=a[0][1];
    dp[0][2]=a[0][2];

    for(int i=1;i<n;i++){
        dp[i][0]=a[i][0]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=a[i][1]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=a[i][2]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});
}


Measured memory_bytes: 2560
n, m = map(int, input().split())
C = list(map(int, input().split()))
INF = 10**5
dp = [INF for _ in range(n+1)]
dp[0] = 0
for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1)
print(dp[n])

Measured memory_bytes: 8252
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

// Rolling Hash
struct RollingHash {
public:
    long long base_1, base_2, mod_1, mod_2;
    vector<long long> hash1, hash2, pow1, pow2;
    RollingHash(string &s) : base_1(1013), base_2(1007), 
        mod_1(1000000007), mod_2(1000000009),
        hash1(s.length()+1,0), hash2(s.length()+1,0),
        pow1(s.length()+1,1), pow2(s.length()+1,1) {
            for(int i=0; i<s.length(); i++) {
                hash1[i+1] = (hash1[i]+s[i]) * base_1 % mod_1;
                hash2[i+1] = (hash2[i]+s[i]) * base_2 % mod_2;
                pow1[i+1] = pow1[i] * base_1 % mod_1;
                pow2[i+1] = pow2[i] * base_2 % mod_2;
            }
        }

    // calc str[l,r) hash
    pair<long long, long long> get(int l, int r) {
        long long t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod_1 + mod_1) % mod_1;
        long long t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod_2 + mod_2) % mod_2;
        return make_pair(t1, t2);
    }
};

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

    RollingHash RH(s);
    set<pii> strset;
    int l = 0, r = 0;
    rep(i,0,m) {
        cin >> inp;
        if(inp == "R++") r++;
        if(inp == "R--") r--;
        if(inp == "L++") l++;
        if(inp == "L--") l--;
        pii p = RH.get(l,r+1);
        // printf("l = %lld, r = %lld, get = (%lld, %lld)\n", l, r, p.fr, p.sc);
        strset.insert(p);
    }
    cout << strset.size() << endl;
    return 0;
}

Measured memory_bytes: 31296
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	string s;
	cin >> s;
	vector<char> t(26);
	rep(i,26){
		t[i]='a'+i;
	}
	rep(i,s.size()){
		t.erase(remove(all(t), s[i]), t.end());
	}
	if(t.size()==0) puts("None");
	else cout << t[0] << endl;
	return 0;
}

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

string replaceAll(string s, string target, string replacement) {
  if (!target.empty()) {
    std::string::size_type pos = 0;
    while ((pos = s.find(target, pos)) != std::string::npos) {
      s.replace(pos, target.length(), replacement);
      pos += replacement.length();
    }
  }
  return s;
}

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

  // s = replaceAll(s, "BC", "X");

  ll ans = 0;
  ll cntA = 0;
  rep(i, s.size()) {
    if (s.substr(i, 2) == "BC") {
      ans += cntA;
      i++;
    } else if (s[i] == 'A') {
      cntA++;
    } else {
      cntA = 0;
    }
  }
  cout << ans << endl;

  return 0;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef pair<int,int> P;

const int INF = 1000000000;

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

    int dp[100005];
    rep(i,n) dp[i] = INF;
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);

    for(int i=2;i<n;i++){
        for(int j=1;j<=k;j++){
            if(i-j<0) break;
            dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<ll> Vl;
typedef vector<int> Vi;
typedef pair<int, int> Pi;

#define INF   (1e9 + 7)
int N = 5;
char vowels[5] = {'a', 'i', 'u', 'e', 'o'};


int main() {
  char c;
  scanf("%c", &c);

  for (int i = 0; i < N; i++) {
    if (c == vowels[i]) {
      printf("vowel\n");
      return 0;
    }
  }
  
  printf("consonant\n");
  return 0;
}


Measured memory_bytes: 256
using System;

namespace abc138_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] an = Console.ReadLine().Split(' ');

            double result = 0.0;
            double denominator = 0.0;
            foreach (string ak in an)
            {
                int v = int.Parse(ak);
                denominator += 1.0 / v;
            }

            result = 1.0 / denominator;

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,a[N],b[N];
int main(){
	scanf("%d",&n);
	
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),b[i]=a[i]-1;
	a[n+1]=1e9+1;
	int lst=0;
	for(int i=1;i<=n;i++){
		if(b[i]>=lst)lst=b[i];
		else if(a[i]>=lst)lst=a[i];
		else{puts("No");return 0;}
	}
	puts("Yes");
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	string s;
	cin>>s;

	int a=0,b=0,c=0,ma=0;
	rep(i,s.size()){
		if(s[i]=='a')a++;
		if(s[i]=='b')b++;
		if(s[i]=='c')c++;
	}
	ma=max(a,b);
	ma=max(ma,c);
	if(ma-a>1)cout<<"NO"<<endl;
	else if(ma-b>1)cout<<"NO"<<endl;
	else if(ma-c>1)cout<<"NO"<<endl;
	else cout<<"YES"<<endl;

	return 0;
}


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

using namespace std;

/*int main() {
    int n, m, q;
    cin >> n >> m >> q;

    int t1, t2, t3, t4;
    vector<pair<int, int>> a;
    pair<int, int> temp;

    for (int i = 0; i < q; i++) {
        cin >> t1 >> t2 >> t3 >> t4;
        temp = make_pair(t4 , t1 * 100 + t2 * 10 + t3);
        a.push_back(temp);
    }

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

    for (int i = q - 1; i >= 0; i--) {
        cout << a[i].first << " " << a[i].second << "\n";
    }




    return 0;
}*/

int main() {
    double a, b, n;
    cin >> a >> b >> n;

    int f1, f2;

    if (b > n) {
        f1 = (int)(a * n / b);
        f2 = (int)a * (int)(n / b);
        cout << f1 - f2;
    } else {
        f1 = (int)(a * (b-1) / b);
        f2 = (int)a * (int)((b - 1) / b);
        cout << f1 - f2;
    }




    return 0;
}

Measured memory_bytes: 3724
def main():
	N = int(input())
	ps = [2]
	ans = ["2"]
	i = 3
	while len(ans) < N:
		is_prime = True
		for p in ps:
			if i % p == 0:
				is_prime = False
				break

		if is_prime:
			ps.append(i)
			if i % 5 == 2:
				ans.append(str(i))
		i += 1
	print(" ".join(ans))


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
for x in [a, b, c, d, e]:
    for y in [a, b, c, d, e]:
        if x != y:
            if k < abs(x - y):
                print(":(")
                exit()
print("Yay!")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iA = int.Parse(sS[0]);
            int iB = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "IMPOSSIBLE";
            int iD = iA + iB;
            if (iD % 2 == 0) { sOut = (iD / 2).ToString(); }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include<stdio.h>
int main(){
char a[2000];
int i,count=0,k=0,j=0,sta=0,l=0;
for(i=0;i<1024;i++){
a[i]=',';
}
while(scanf("%s",a)!=EOF){
while(l==0){
for(i=j;;i++){
if(a[i]==' ' || a[i]==',' || a[i]=='.'){
j=i+1;
break;
}
else if(a[i]=='\0'){
l++;
break;
}
else{
count++;
}
}
if(count>=3 && count<=6){
if(k==0){
k=1;
}
else{
printf(" ");
}
for(i=sta;i<sta+count;i++){
printf("%c",a[i]);
}
}
sta=j,count=0;
}
for(i=0;i<1024;i++){
a[i]=',';
}
j=0,l=0,sta=0;
}
printf("\n");
return 0;
}


Measured memory_bytes: 2140
#include <stdio.h>

int n, A[100];

int solve(i, m){
  if(m == 0)   return 1;
  if(i >= n)   return 0;
  int res = solve(i + 1, m) || solve(i + 1,m - A[i]);
  return res;
}

int main(){
  int i, q, M;

  scanf("%d", &n);
  for(i = 0; i < n; i++)   scanf("%d",&A[i]);
  scanf("%d", &q);
  for(i = 0; i < q; i++){
    scanf("%d",&M);
    if(solve(0,M))         printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;


int main(){
    int n;
    scanf("%d",&n);
    list<int> lst;
    for(int i=0;i<n;i++){
        char s[11];
        int p;
        scanf("%s",&s);
        //string s=c;
        //if(s=="deleteFirst"){
        if(s[6]=='F'){
            lst.pop_front();
        }else if(s[6]=='L'){
            lst.pop_back();
        }else if(s[0]=='i'){
            scanf("%d",&p);
            lst.push_front(p);
        }else{
            scanf("%d",&p);
            for(auto itr=lst.begin(); itr!=lst.end();itr++){
                if(*itr==p){
                    lst.erase(itr);
                    break;
                }
            }
        }
    }
    int l=lst.size();
    for(int i=0;i<l-1;i++){
        printf("%d ",*lst.begin());
        lst.pop_front();
    }
    printf("%d\n",*lst.begin());
    return 0;
}

Measured memory_bytes: 32360
N = int(input())
L = list(map(int, input().split()))

ans = 0
for x in L:
    for y in L:
        for z in L:
            if x != y:
                if x < z:
                    if y < z:
                        if x + y > z:
                            ans += 1

print(int(ans/2))


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

using namespace std;

long long int abcd(long long int n){
  
  while(n >= 10){
     n /= 10;
  }
  
  return n ;
}


long long int abc(long long int m){
 int sum =0;
  while(m > 0){
    sum++;
     m /= 10;
  }
  
  return sum;
}
  
 
    

int main(){
	long long int a;
  cin >> a;
  
  if((a+1)%10 ==0){
    cout << (abcd(a))+(abc(a)-1)*9 << endl;
  }
  else if(a/10 ==0){
    cout << a << endl;
  }
  
  else{
 cout << (abcd(a)-1)+(abc(a)-1)*9 << endl;
  }
}
  
 


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

int main()
{
    int N, M;
    cin >> N >> M;
    priority_queue<int> A;
    for (int i = 0; i < N; i++)
    {
        int Ai;
        cin >> Ai;
        A.push(Ai);
    }
    priority_queue<pair<int, int>> tasks; // <Ci, Bi>
    for (int i = 0; i < M; i++)
    {
        int Bi, Ci;
        cin >> Bi >> Ci;
        tasks.push(make_pair(Ci, Bi));
    }

    int64_t res = 0;
    int cnt = 0;
    while (cnt < N)
    {
        if (tasks.empty())
        {
            int64_t Ai = A.top();
            A.pop();
            res += Ai;
            cnt++;
        }
        else
        {
            int64_t Ai = A.top();
            int Bi = tasks.top().second;
            int64_t Ci = tasks.top().first;
            if (Ai >= Ci)
            {
                A.pop();
                res += Ai;
                cnt++;
            }
            else
            {
                tasks.pop();
                int n = min(Bi, N - cnt);
                res += Ci * n;
                cnt += n;
            }
        }
    }

    cout << res << endl;
}

Measured memory_bytes: 1784
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int n,m;
    cin>>n>>m;
    vector<int>v[n+2];
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for(int i=1;i<n+1;i++)cout<<v[i].size()<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>

#define MAX 100009
using namespace std;
typedef pair<int,int> P;

typedef struct Node
{
	int n;
	vector<int>e;
}Node;

Node G[MAX];
int N,M,s,t,d,a,b;
long long res=0;
map<int,long long>SC,GC;
void dijcstra(int s,int g,map<int,long long>&X)
{
	int C[MAX];
	memset(C,0x7f,sizeof(C));
	P tmp(0,s);
	priority_queue<P,vector<P>,greater<P> >Q;
	Q.push(tmp);
	while(!Q.empty())
	{
		tmp=Q.top();Q.pop();
		if(tmp.first>=C[tmp.second])
			continue;
		C[tmp.second]=tmp.first;
		for(int i=0;i<G[tmp.second].e.size();i++)
		{
			int nn=G[tmp.second].e[i];
			if(C[nn]>tmp.first+1)
			{
				Q.push(make_pair(tmp.first+1,nn));
			}
		}
	}
	if(g==t)d=C[t];
	for(int i=0;i<N;i++)
		X[C[i]]++;
}

int main()
{
	scanf("%d%d%d%d",&N,&M,&s,&t);
	s--;t--;
	for(int i=0;i<M;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		x--;y--;
		G[x].e.push_back(y);
		G[y].e.push_back(x);
	}
	dijcstra(s,t,SC);
	dijcstra(t,s,GC);
	for(int i=0;i<=d;i++)
	{
		if(d-i-2>=0)
			res+=SC[i]*GC[d-i-2];
	}
	printf("%lld\n",res);
	return 0;
}

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

int main() {
  int n,d,x,s=0;
  cin>>n>>d>>x;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }
  rep(i,n){
    s+=(d+a[i]-1)/a[i];
  }
  cout<<x+s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using i64 = long long;

int main() {
    int n, k;
    std::cin >> n >> k;
    std::vector<int> a(n);
    for (auto &e : a) std::cin >> e;

    for (int i = 0; i < k; i++) {
        std::vector<int> next(n + 1);
        for (int j = 0; j < n; j++) {
            const int l = std::max(0, j - a[j]),
                r = std::min(n, j + a[j] + 1);
            next[l]++;
            next[r]--;
        }

        for (int j = 1; j <= n; j++) next[j] += next[j - 1];
        next.pop_back();

        std::swap(a, next);
        if (std::all_of(a.begin(), a.end(), [n](const int e) { return e == n; })) {
            break;
        }
    }

    for (const auto &e : a) std::cout << e << ' ';
    std::cout << std::endl;

    return 0;
}


Measured memory_bytes: 5124
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

int V, E;
vector<vector<int>> G;

int dfs(int u, int bit) {
    if (bit == (1 << V) - 1) {
        return 1;
    }

    int ans = 0;
    for (const int nxt : G[u]) {
        if ((bit >> nxt) & 1) continue;
        ans += dfs(nxt, bit | (1 << nxt));
    }

    return ans;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    read(V, E);
    G.resize(V);

    rep(i, E) {
        int a, b;
        read(a, b);
        --a, --b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    print(dfs(0, 1));


    return 0;
}


Measured memory_bytes: 256
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

int underf(int a, int b){
	return a%b==0? a/b:(a+b-a%b)/b;
}

int main (){
	int nn,kk;
	cin >> nn >> kk;
	int one = 0;
	int a=0;
	rep(i,nn){
		cin >> a;
		if(a == 1) one = i;
	}
	int ans;
	if(kk==nn){
		ans = 1;
	}else if(kk==2){
		ans = nn-1;
	}else{
		ans = underf(nn-1,kk-1);
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define ll long long
#define mod 1000000007
#define N 510
using namespace std;
ll f[N][N][2],fac[N],inv[N];
ll ksm(ll a,ll b=mod-2)
{
    ll r=1;
    for(;b;b>>=1)
    {
        if(b&1) r=r*a%mod;
        a=a*a%mod;
    }
    return r;
}
int d[N];
int main()
{
    int n;
    scanf("%d",&n);
    if(n<=2){puts("0");return 0;}
    fac[0]=1;
    for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
    inv[n]=ksm(fac[n]);
    for(int i=n-1;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
    for(int i=1;i<=n;i++) scanf("%d",&d[i]);
    f[0][0][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=0;j<=i;j++)
        {
            (f[i][j][0]+=f[i-1][j][0]*inv[d[i]-1])%=mod,(f[i][j][1]+=f[i-1][j][1]*inv[d[i]-1])%=mod;
            if(d[i]>=2 && j) (f[i][j][0]+=f[i-1][j-1][0]*inv[d[i]-2])%=mod,(f[i][j][1]+=f[i-1][j-1][1]*inv[d[i]-2])%=mod;
            if(d[i]>=3 && j) (f[i][j][1]+=f[i-1][j-1][0]*inv[d[i]-3])%=mod;
        }
    ll ans=0;
	for(int i=3;i<n;i++)
		ans=(ans+f[n][i][1]*fac[n-i-1]%mod*fac[i-1]%mod*inv[2]%mod)%mod;
    printf("%lld\n",(ans+f[n][n][0]*fac[n-1]%mod*inv[2])%mod);
    return 0;
}

Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    cin.ignore();
    string s;
    getline(cin,s);
    ll c=0;
    ll len=s.size();
    //vector<char>v;
    for(ll i=0,j=n-1; i<j;)
    {
        if(s[i]=='W')
        {
            if(s[j]=='R')
            {
                swap(s[i],s[j]);
                c++;
                i++;
            }
            j--;
        }
        else
        {
            i++;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <map>
#include <cmath>
#include <vector>

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

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

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

    vector<int> com_div(n);
    int count = 0;
    rep(i, n) {
        rep(j, n) {
            if (j%2 == 1 && j%i == 0)
            {
                /* code */
                com_div.at(j-1) += 1;
            }
        }
        if (com_div.at(i-1) == 8 && i%2 == 1)
        {
            /* code */
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
//在 POJ 和小白菜中，该库禁用！
//在 USACO中请用文件。
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cstdlib>

using namespace std;
typedef long long ll;
int n,a[3][105],dp[3][105];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++){
			cin >> a[i][j];
		}
	}
	
//	dp[1][1] = a[1][1];
	for(int i=1;i<=2;i++){
		for(int j=1;j<=n;j++){
			dp[i][j] = max(dp[i-1][j],dp[i][j-1]) + a[i][j];
		}
	}
	cout<<dp[2][n]<<endl;
  return 0;
}

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

using ll = long long;

template<typename T>
T gcd(T a, T b)
{
	if (a < b)	return gcd(b, a);
	T r;
	while ((r = a % b))
	{
		a = b;
		b = r;
	}
	return b;
}

template<typename T>
T lcm(T a, T b)
{
	return a * b / gcd(a, b);
}

template<typename T>
T ext_gcd(T a, T b, T& x, T& y)
{
	x = 1;
	y = 0;
	T x0 = 0, y0 = 1;
	while (b != 0)
	{
		T q = a / b;
		a -= q * b;
		swap(a, b);
		x -= q * x0;
		swap(x, x0);
		y -= q * y0;
		swap(y, y0);
	}
	return a;
}

template<typename T>
T inv_mod(T a, T mod)
{
	T t1, t2;
	ext_gcd(a, mod, t1, t2);
	t1 %= mod;
	if (t1 < 0)		t1 += mod;
	return t1;
}

template<typename T>
T combination_large(T n, T k, T mod)
{
	if (n < k || n < 0 || k < 0)	return 0;
	vector<T> inv(n + 1, 1), fact(n + 1, 1), fact_inv(n + 1, 1);
	for (T i = 2; i <= n; ++i)
	{
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		fact[i] = (fact[i - 1] * i) % mod;
		fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
	}
	return fact[n] * (fact_inv[k] * fact_inv[n - k] % mod) % mod;
}

template<typename T>
T combination(T n, T k, T mod = 1)
{
	vector<vector<T>> table(n + 1, vector<T>(k + 1, 1));
	for (T i = 1; i <= n; ++i)
	{
		table[i][0] = 1;
		for (T j = 1; j <= n; ++j)
		{
			table[i][j] = (table[i - 1][j - 1] + table[i - 1][j]) % mod;
		}
	}
}


int main(int, char**)
{
	long long N;
	scanf("%lld",&N);

	ll sum = 0;
	for (ll i = 1; i <= N; ++i)
	{
		if (i % 3 != 0 && i % 5 != 0)
		{
			sum += i;
		}
	}
	cout << sum << endl;

	return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	string S, T;
	cin >> N >> S >> T;

	for( int i = 0; i < N; ++i ) {
		cout << S[i] << T[i];
	}

	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define F first
#define S second
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define forit(it,cont) for(auto it=cont.begin();it!=cont.end();it++)
#define forv(v,cont) for(auto v:cont)
#define for0(i,n) for(i=0;i<n;i++)
#define for1(i,n) for(i=1;i<=n;i++)
#define for0r(i,n) for(i=n-1;i>=0;i--)
#define for1r(i,n) for(i=n;i>=1;i--)
#define ll long long 
const ll inf=1e16;
const ll _inf=-1e16;
ll dx[]={-1,0};
ll dy[]={0,-1};
char a[1005][1005];
ll d[1005][1005];
#define mod 1000000007
int main()
{
	ll h,w,i,j,newx,newy;
	cin>>h>>w;
	for0(i,h)
	{
		for0(j,w)
		cin>>a[i][j];
	}
	if(a[0][0]=='.')
		d[0][0]=1;
	else
		d[0][0]=0;
	for0(i,h)
	{
		for0(j,w)
		{
			if(a[i][j]=='#')
			{
				d[i][j]=0;continue;
			}
			for(int k=0;k<2;k++)
			{
				newx=i+dx[k];
				newy=j+dy[k];
				if(newx<0||newy<0||newx>=h||newy>=w)
					continue;
//				cout<<i<<" "<<j<<endl;
				d[i][j]+=d[newx][newy];
				d[i][j]%=mod;
			}
		}
	}
/*	for0(i,h)
	{
		for0(j,w)
		cout<<d[i][j]<<" ";
		cout<<endl;
	}*/
	cout<<d[h-1][w-1]<<endl;
	return 0;	
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define double    long double
#define ull       unsigned long long
#define mod       1000000007
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define p(a)      cout<<a;
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"THIS_AND_THIS"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
void solve(){
	ll n;cin>>n;
	ll a=0,b=0,c=0,d=0;
	while(n--){
		str s;cin>>s;
		if(s=="AC"){a+=1;}
		else if(s=="WA"){b+=1;}
		else if(s=="TLE"){c+=1;}
		else{d+=1;}
	}
	cout<<"AC x "<<a<<endl;
	cout<<"WA x "<<b<<endl;
	cout<<"TLE x "<<c<<endl;
	cout<<"RE x "<<d<<endl;
}
int32_t main(){
	kehsihba();
	ll t=1;
	//cin>>t;
	while(t--){
		solve();
	}
}




Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 2;

int main()
{
  ll N;
  scanf("%lld",&N);
  vector<ll> a(N+1, 0);
  for(int i=1; i<=N; i++){
    scanf("%lld",&a[i]);
  }

  vector<ll> t(N+1, 0);
  for (ll i=N; i>=1; i--) {
    ll sum = 0;
    for (ll j=2; i*j<=N; j++) {
      sum += t[i*j];
    }
    t[i] = (sum+a[i])%2;
  }

  vector<ll> b;
  for (int i=1; i<=N; i++) {
    if (t[i]>0) b.push_back(i);
  }

  cout << b.size() << endl;
  if ((int)(b.size())>0) {
    for (int i=0; i<(int)(b.size()); i++) {
      if (i==0) cout << b[i];
      else cout << " " << b[i];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 4980
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();
        char[] a = new char[n];
        char[] b = new char[n];
        char[] c = s.toCharArray();
        for (int i = 0 ; i < n ; i++) {
            if (i % 2 == 0) {
                a[i] = '0';
                b[i] = '1';
            } else {
                a[i] = '1';
                b[i] = '0';
            }
        }
        int d = 0;
        int e = 0;
        for (int i = 0 ; i < n ; i++) {
            if (a[i] != c[i]) {
                d++;
            }
            if (b[i] != c[i]) {
                e++;
            }
        }

        System.out.println(Math.min(d, e));


    }

}


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

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

Measured memory_bytes: 3640
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
print(N*800 - (N//15)*200)

Measured memory_bytes: 13668
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> His;
    for (ll i = 0; i < N; i++) {
        ll Hi;
        cin >> Hi;
        His.push_back(Hi);
    }
    vector<ll> dp(N, numeric_limits<ll>::max());
    for (ll i = 0; i < N; i++) {
        if (i == 0) {
            dp[0] = 0;
            continue;
        }
        for (ll j = 1; j <= K && i - j >= 0; j++) {
            dp[i] = min(dp[i], dp[i-j] + abs(His[i] - His[i-j]));
        }
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1908