akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { //Partition babyyyyyyyyy
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int A = I.nextInt();
		int B = I.nextInt();
		O.pln(ceil(A+B,2));
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25604
SA = list(input())
SB = list(input())
SC = list(input())
j = 0
turn = 'a'
a = 1
b = 1
c = 1


while j == 0:
    if(turn == 'a' and len(SA) >= a):
        turn = SA[a-1]
        a += 1
    elif(turn == 'b' and len(SB) >= b):
        turn = SB[b-1]
        b += 1
    elif(turn == 'c' and len(SC) >= c):
        turn = SC[c-1]
        c += 1
    elif(turn == 'a' and len(SA) < a):
        turn = 'a'
        j = 1
    elif(turn == 'b' and len(SB) < b):
        turn = 'b'
        j = 1
    elif(turn == 'c' and len(SC) < c):
        turn = 'c'
        j = 1
        
if(turn == 'a'):
    print('A')
elif(turn == 'b'):
    print('B')
elif(turn == 'c'):
    print('C')

Measured memory_bytes: 9128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <algorithm>
using namespace std;
const int Max = 1e5;

int n, k, a[105];
int ans = 0;

int main()
{
	scanf ("%d %d", &n, &k);
	for (int i = 1; i <= n; i++){
		scanf ("%d", &a[i]);
		ans += 2 * (min(abs(a[i] - 0), abs(k - a[i])));
	}
	printf ("%d\n", ans);
}


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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

int is_on(int s, int N, int iter)
{
    return (s >> (N - iter)) % 2;
}

int main()
{
    int N, M;
    cin >> N >> M;
    
    vector<int> k(M);
    vector<vector<int>> s(M, vector<int>(10, 0));
    for (int i = 0; i < M; i++)
    {
        cin >> k[i];
        for (int j = 0; j < k[i]; j++)
        {
            cin >> s[i][j];
        }
    }

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

    int ans = 0;

    for (int i = 0; i < (1 << N); i++)
    {
        vector<int> on(N, 0);
        for (int j = 0; j < N; j++) on[j] = is_on(i, N, j+1);

        int num_on = 0;
        for (int j = 0; j < M; j++)
        {
            int num_switch = 0;
            for (int l = 0; l < k[j]; l++)
            {
                num_switch += on[s[j][l] - 1];
            }
            if (num_switch % 2 == p[j]) num_on++;
        }
        
        if (num_on == M) ans++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main() {
  int k;
  cin >> k;
  if (k%2==0 || k%5==0) {
    cout << -1;
    return 0;
  }
  int ans = 1;
  int r = 7;
  while (ans <= k) {
    if (r%k == 0) {
      cout << ans;
      return 0;
    }
    r = (r * 10 + 7) % k;
    ans++;
  }
  cout << -1;
  return 0;
}

Measured memory_bytes: 3588
def getlist():
	return list(map(int, input().split()))

N = int(input())
A = getlist()

M = [0]
v = 0
for i in range(N):
	x = 2 * (A[i] - int((v // 2)))
	M.append(x)
	v = x
n = int(M[N] // 2)
ans = []
for i in range(1, N + 1):
	if i % 2 == 0:
		ans.append(M[i] + n)
	else:
		ans.append((M[i] - n))

ans2 = []
for i in range(N):
	ans2.append(str(ans[(N - 1 + i) % N]))
print(" ".join(ans2))

Measured memory_bytes: 76900
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl

#include<iostream>
#include<string>
using namespace std;
 
 
long long rec(string s){
    long long ans = 0;
    int s_len = s.length();

    if(s_len == 1){
        return stol(s);
    }
 
    for(int i=1; i<s_len; i++){
        ans += stol(s.substr(0, i)) * (1 << (s_len-1-i)) + rec(s.substr(i));
    }
    return ans + stol(s);
}
 
int main(){
    string s;
    cin >> s;
    cout << rec(s) << endl;
}


Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <cstring>
#include <unordered_set>
#include <unordered_map>

using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
static const int INF = 1000010000;
static const ll MOD = 998244353;
 
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb push_back
#define mp make_pair
#define np next_permutation
#define pq priority_queue

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};


ll V;
struct edge{ ll to, cost; };
ll d[2][100010];
vector<edge> G[2][100010];

ll dijkstra(ll s, ll flag){
    priority_queue<P, vector<P>, greater<P> > que;
    que.push(P(0, s));

    while(!que.empty()){
        P p = que.top();que.pop();
        ll v = p.second;
        if(d[flag][v] < p.first) continue;

        //vと繋がっている頂点についてコストが下がるかどうかを調べる
        FOR(i, 0, G[flag][v].size()){
            edge e = G[flag][v][i];
            if(d[flag][e.to] > d[flag][v] + e.cost){
                d[flag][e.to] = d[flag][v] + e.cost;
                que.push(P(d[flag][e.to], e.to));
            }
        }
    }
}

int main(){
    ll n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    REP(i, m){
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        edge e;
        u--; v--;
        e.to = v; e.cost = a;
        G[0][u].push_back(e);
        e.to = u; e.cost = a;
        G[0][v].push_back(e);
        e.to = v; e.cost = b;
        G[1][u].push_back(e);
        e.to = u; e.cost = b;
        G[1][v].push_back(e);
    }
    REP(k, 2){
        REP(i, n){
            d[k][i] = 1e+15;
        }
    }
    d[0][s] = 0;
    d[1][t] = 0;
    dijkstra(s, 0);
    dijkstra(t, 1);
    ll ans[100010];
    ll c = 1e+15;
    for(ll i = n - 1; i >= 0; i--){
        if(i == n - 1){
            ans[i] = c - (d[0][i] + d[1][i]);
        }else{
            ans[i] = max(ans[i + 1], c - (d[0][i] + d[1][i]));
        }
    }
    REP(i, n){
        cout << ans[i] << endl;
    }
}

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

static class CodeJam
{
    static int[] Solve(int N, int M, string S)
    {
        var ans = new List<int>();
        int p = N;
        while (p > 0)
        {
            for (int i = M; i >= 1; --i)
            {
                if (p - i >= 0 && S[p - i] == '0')
                {
                    ans.Add(i);
                    p -= i;
                    break;
                }
                if (i == 1) { return null; }
            }
        }
        ans.Reverse();
        return ans.ToArray();
    }

    static void Main(string[] args)
    {
        int[] V = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        string S = Console.ReadLine();
        var ans = Solve(V[0], V[1], S);
        Console.WriteLine(string.Join(" ", ans ?? new[] { -1 }));
    }
}


Measured memory_bytes: 16224
using System;
public class Hello
{
    public static void Main()
    {
        var line = System.Console.ReadLine().Split(' ');
        long A = long.Parse(line[0]);
        long V = long.Parse(line[1]);
        line = System.Console.ReadLine().Split(' ');
        long B = long.Parse(line[0]);
        long W = long.Parse(line[1]);
        long T = long.Parse(System.Console.ReadLine());
        if (A < B)
        {
            if (A + T * V >= B + T * W)
            {
                Console.WriteLine("YES");
                return;
            }
        }
        else
        {
            if (A - T * V <= B - T * W)
            {
                Console.WriteLine("YES");
                return;
            }
            else
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("NO");
    }
}


Measured memory_bytes: 27500
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
    int H, W, a[501][501];
    cin >> H >> W;
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            cin >> a[i][j];
        }
    }
    int N = 0;
    int res[250000][4];
    for (int i = 1; i <= H; ++i) {
        for (int j = 1; j <= W; ++j) {
            if (a[i][j] % 2 == 0) {
                continue;
            }
            if (j != W) {
                a[i][j]--;
                a[i][j + 1]++;
                res[N][0] = i, res[N][1] = j, res[N][2] = i, res[N][3] = j + 1;
                N++;
            } else if (i != H) {
                a[i][j]--;
                a[i + 1][j]++;
                res[N][0] = i, res[N][1] = j, res[N][2] = i + 1, res[N][3] = j;
                N++;
            }
        }
    }
    cout << N << endl;
    for (int n = 0; n < N; ++n) {
        cout << res[n][0] << " " << res[n][1] << " " << res[n][2] << " "
             << res[n][3] << endl;
    }
    return 0;
}


Measured memory_bytes: 6656
use std::cmp::Ordering;
use std::io::*;
use std::str::FromStr;

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

fn main() {
    let a: u32 = read();
    let b: u32 = read();
    let c: u32 = read();

    match a.cmp(&b) {
        Ordering::Less => match b.cmp(&c) {
            Ordering::Less => println!("Yes"),
            Ordering::Equal => println!("No"),
            Ordering::Greater => println!("No"),
        },
        Ordering::Greater => println!("No"),
        Ordering::Equal => println!("No"),
    };
}



Measured memory_bytes: 5016
#include <cstdio>
#include <array>
#include <utility>

template <unsigned int N> struct shuumai{
    unsigned int minPrime[N + 1];
    unsigned int Primes[N + 1];
    unsigned int size_;

    constexpr shuumai(void): minPrime(), Primes(), size_(0U){
        minPrime[0] = 1; minPrime[1] = 1;
        for(int even = 2, odd = 3; odd <= N; even += 2, odd += 2){
            minPrime[even] = 2;
            minPrime[odd] = odd;
        }
        if(!(N & 1)) minPrime[N] = 2;
        Primes[size_++] = 2;

        for(int x = 3; x <= N; x += 2){
            if(minPrime[x] == x) Primes[size_++] = x;
            for(int y = 0; y < size_ and Primes[y] <= minPrime[x] and x * Primes[y] <= N; ++y)
                    minPrime[x * Primes[y]] = Primes[y];
        }
    }
    // 範囲for文用の begin() と end()
    const unsigned int *begin(void) const noexcept{ return Primes; }
    const unsigned int *end(void) const noexcept{ return Primes + size_;}
    const unsigned int size(void) const {return this.size_;}
};

using uint = unsigned int;
constexpr uint N = 1e6;
constexpr uint mod = 1e9 + 7;
constexpr uint M = mod - 2;
constexpr shuumai<N> P;
std::array<uint, N + 1> Count;

// a^nを返す関数
const uint power(uint a, uint n)noexcept{
    unsigned long long res = 1, waiting = a;
    while(n){ 
        if(n & 1) { res *= waiting; res %= mod; }
        waiting *= waiting; waiting %= mod; 
        n >>= 1;
    }
    return res;
}

uint fastRead(void) {
	char c;
	while(true){
        c = getchar_unlocked();
        if('0' <= c) break;
	}
    uint res = c - '0';
	while(true){
		c = getchar_unlocked();
        if(c < '0') break;
		res = 10 * res + (c - '0');
	}
    return res;
}


int main(void){
    uint n = fastRead();
    uint inv_sum = 0;
    for(uint _ = 0; _ < n; ++_){
        uint a = fastRead();
        inv_sum += power(a, M); if(inv_sum >= mod) inv_sum -= mod;
        while(a - 1U){
            uint fac = P.minPrime[a];
            uint cnt = 1; a /= fac;
            while(!(a % fac)) a /= fac, cnt++;
            if(Count[fac] < cnt) Count[fac] = cnt; 
        }
    }

    unsigned long long int lcm = 1;
    for(unsigned int x : P) if(Count[x]) (lcm *= power(x, Count[x])) %= mod;
    unsigned int res = lcm * inv_sum % mod;
    
    printf("%u\n", res);
    return 0;
}


Measured memory_bytes: 3200
n , m = map(int, input().split())
l = [list(map(int,input().split())) for _ in range(m)]
l.sort()
l = l[::-1]
cnt = 1
key = l[0][0]
for i in range(1,m):
    if key >= l[i][1]:
        cnt += 1
        key = l[i][0]
print(cnt)
    


Measured memory_bytes: 29508
def main():

    N = int(input())
    interval = []
    for _ in range(N):
        X, L = map(int, input().split())
        interval.append([X-L, X+L])
    interval.sort()
    cnt = 0
    i = 0
    while i < N:
        a, b = interval[i]
        cnt += 1
        i += 1
        while i < N and interval[i][0] < b:
            if interval[i][1] < b:
                a, b = interval[i]
            i += 1
    return cnt


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 20104
#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;
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
	template <class Arg1, class... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args) {
		const char* sep = strchr(names + 1, ',');
		cerr.write(names, sep - names) << " : " << arg1 << "  ";
		__f(sep + 1, args...);
	}
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif
 
typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<int,pii> piii;
typedef pair<char,int> pci;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plll;
 
 
 
#define pb push_back
 
// #define mp make_pair 
// order_of_key (k), find_by_order(k)
#define fi first
#define se second
#define input_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll> ,greater<ll>>
 
#define initialise(a, x) memset(a, x, sizeof(a))
#define endl '\n'
#define itt iterator
#define isvowel(a) (a=='a'||a=='e'||a=='i'||a=='o'||a=='u')
 
#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update> 
 
 
// #define maxn 200005
 
 
 
 
 
signed main() {
 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("out.txt", "w", stdout); 
	// #endif

	int n;
	cin>>n;

	std::vector<pii> a[n];

	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		while(x--)
		{
			int n,m;
			cin>>n>>m;n--;
			a[i].pb({n,m});
		}
	}

	int ans=0;

	for(int i=0;i<(1<<n);i++)
	{
		int wht[n];
		initialise(wht,-1);
		int f=1;

		for(int j=0;j<n;j++) if(i&(1<<j)) wht[j]=1;


		for(int j=0;j<n;j++)
		{
			if(i&(1<<j))
			{
				for(auto k:a[j])
				{
					if(wht[k.fi]!=-1)
					{
						if(wht[k.fi]!=k.se) f=0;
					}
					else
					{
						if(k.se==1) f=0;
						wht[k.fi]=k.se;
					}
				}
			}
		}

		if(f) ans=max(ans,__builtin_popcount(i));
	}

	cout<<ans<<'\n';
 

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int selectionSort(int A[], int N) {
    int i, j, t, sw =0, minj;
    for(i=0;i<N-1;i++) {
        minj = i;
        for(j=i;j<N;j++) {
            if(A[j]<A[minj]) minj = j;
        }
        t=A[i]; A[i]=A[minj]; A[minj]=t;
        if(i!=minj) sw++;
    }
    return sw;
}

int main(void) {
    int A[100], N, i, sw;

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

    sw = selectionSort(A,N);

    for(i=0;i<N;i++) {
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);

    return 0;
}


Measured memory_bytes: 2148
class SegTree:
    def __init__(self, init_val, ide_ele, seg_func):
        self.segfunc = seg_func
        n = len(init_val)
        self.num = 2**(n-1).bit_length()
        self.ide_ele = ide_ele
        self.seg=[self.ide_ele]*2*self.num
        for i in range(n):
            self.seg[i+self.num-1]=init_val[i]    
        for i in range(self.num-2,-1,-1) :
            self.seg[i]=self.segfunc(self.seg[2*i+1],self.seg[2*i+2]) 
        
    def update(self, k, x):
        k += self.num-1
        self.seg[k] = x
        # k+1ではなくkでは？
        while k+1:
            k = (k-1)//2
            self.seg[k] = self.segfunc(self.seg[k*2+1],self.seg[k*2+2])
        
    def query(self, p, q):
        if q<=p:
            return self.ide_ele
        p += self.num-1
        q += self.num-2
        res=self.ide_ele
        while q-p>1:
            if p&1 == 0:
                res = self.segfunc(res,self.seg[p])
            if q&1 == 1:
                res = self.segfunc(res,self.seg[q])
                q -= 1
            p = p//2
            q = (q-1)//2
        if p == q:
            res = self.segfunc(res,self.seg[p])
        else:
            res = self.segfunc(self.segfunc(res,self.seg[p]),self.seg[q])
        return res

def bsearch(mn, mx, func):
    #func(i)=False を満たす最大のi
    idx = (mx + mn)//2
    while mx-mn>1:
        if func(idx):
            idx, mx = (idx + mn)//2, idx
            continue
        idx, mn = (idx + mx)//2, idx
    return idx

import sys;input=sys.stdin.readline
mod = 998244353
N=int(input())
X = []
Y = []
for _ in range(N):
    x, d = map(int, input().split())
    X.append((x,d))
X.sort()
C = [0] * N
for i in range(N):
    x, d = X[i]
    k = bsearch(-1, N, lambda j: X[j][0] >= x+d)
    C[i] = k

st = SegTree(C, -1, max)
dp = [1]*(N+1)
for i in range(N-1, -1, -1):
    y=st.query(i, C[i]+1)
    st.update(i, y)
    dp[i] = (dp[i+1]+dp[y+1]) % mod
print(dp[0])


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

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


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

int N;

void dfs(string s, char mx) {
  if (s.size() == N) {
    cout << s << endl;
    return;
  }
  for (char c = 'a'; c <= mx+1; ++c) {
    string t = s;
    t += c;
    dfs(t, max(mx, c));
  }
}

int main () {
  cin >> N;
  dfs("", 'a'-1);
  return 0;
}

Measured memory_bytes: 1536
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <set>
using namespace std;
#define maxn 100000+5
typedef long long int ll;
const double INF = 1e20;
const double pi = acos (-1.0);
int vis[5];
int main () {
    int n;
    scanf("%d",&n);
    string a,b,c;
    while(cin>>a>>b>>c){
        int ans=0;
        for(int i=0;i<n;i++){
            if(a[i]==b[i]&&a[i]==c[i]){
                ;
            }
            else if(a[i]==b[i]||a[i]==c[i]||b[i]==c[i]){
                ans++;
            }else ans+=2;
        }
        printf("%d\n",ans);
    }
   //while(1)getchar();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;

int a, b, n;

string s;

int main()
{
    cin >> s;

    int y, m, d;

    y = 1000 * (s[0] - '0') + 100 * (s[1] - '0') + 10 * (s[2] - '0') + (s[3] - '0');
    m = 10 * (s[5] - '0') + (s[6] - '0');
    d = 10 * (s[8] - '0') + (s[9] - '0');

    if (y > 2019)
    {
        cout << "TBD";
    }
    else
    {
        if (y == 2019)
        {
            if (m > 4)
            {
                cout << "TBD";
            }
            else if (m < 4)
            {
                cout << "Heisei";
            }
            else
            {
                if (d <= 30)
                {
                    cout << "Heisei";
                }
            }
        }
        else
        {
            cout << "Heisei";
        }
    }

    return 0;
}

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

int main(){
	// sengen
	LL n,m,k;
	// nyuryoku
	cin >> n >> m >> k;
	LL a[n+1],b[m+1];
	LL sa[n+1],sb[m+1];
	sa[0] = 0; sb[0] = 0;
	for(int i=0;i<n;i++){
		cin >> a[i+1];
		sa[i+1] = a[i+1] + sa[i];
	}
	for(int i=0;i<m;i++){
		cin >> b[i+1];
		sb[i+1] = b[i+1] + sb[i];
	}
	int ans = 0,kari = 0,end = m;
	for(int i=0;i<=n;i++){
		for(int j=end;j>=0;j--){
			if(sa[i] + sb[j] > k){
				continue;
			}else{
				end = j;
				kari = i + j;
				ans = max(ans,kari);
				break;
			}
		}
	}
	// keisan
	cout << ans;
	// syutsuryoku
}

Measured memory_bytes: 9868
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int h,w;
    cin>>h>>w;
    vector<string> a(h);
    rep(i,h)cin>>a[i];
    vi c(26);
    rep(i,h)rep(j,w)c[a[i][j]-'a']++;
    int x1=(h%2)*(w%2);
    int x3=(h/2)*(w/2);
    int x2=(h*w-x1-x3*4)/2;
    rep(_,x1){
        rep(i,26){
            if(c[i]%2){
                c[i]--;
                break;
            }
        }
    }
    rep(_,x2){
        bool f=false;
        bool g=false;
        L:;
        int i;
        for(i=0;i<26;i++){
            if(g&&c[i]&&c[i]%2==0){
                c[i]-=2;
                f=false;
                g=false;
                break;
            }
            if(c[i]%4==2){
                c[i]-=2;
                f=false;
                g=false;
                break;
            }
            if(c[i]&&c[i]%4==0)f=true;
        }
        if(f){
            g=true;
            goto L;
        }
    }
    rep(_,x3){
        rep(i,26){
            if(c[i]>0&&c[i]%4==0){
                c[i]-=4;
                break;
            }
        }
    }
    bool f=true;
    rep(i,26){
        f&=c[i]==0;
    }
    Yes(f);
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int hexDist(int y1, int x1, int y2, int x2)
{
    if(y1 > y2){
        swap(y1, y2);
        swap(x1, x2);
    }

    int x3 = x1 - (y2 - y1) / 2;
    int x4 = x1 + (y2 - y1) / 2;
    if((y2 - y1) % 2 == 1){
        if(y1 % 2 == 0)
            -- x3;
        else
            ++ x4;
    }

    if(x2 < x3)
        return (y2 - y1) + (x3 - x2);
    if(x2 > x4)
        return (y2 - y1) + (x2 - x4);
    return y2 - y1;
}

int main()
{
    for(;;){
        int m, n, s;
        cin >> m >> n >> s;
        if(m == 0)
            return 0;

        vector<vector<int> > dist(n, vector<int>(m, INT_MAX));
        for(int i=0; i<s; ++i){
            int x, y;
            cin >> x >> y;

            for(int j=0; j<n; ++j){
                for(int k=0; k<m; ++k){
                    dist[j][k] = min(dist[j][k], hexDist(j, k, y-1, x-1));
                }
            }
        }

        int t;
        cin >> t;

        int ret = 0;
        for(int i=0; i<t; ++i){
            int x, y;
            cin >> x >> y;

            int num = 0;
            for(int j=0; j<n; ++j){
                for(int k=0; k<m; ++k){
                    if(hexDist(j, k, y-1, x-1) < dist[j][k])
                        ++ num;
                }
            }
            ret = max(ret, num);
        }

        cout << ret << endl;
    }
}

Measured memory_bytes: 0
#include <iostream>
#include <string.h>
#include <algorithm>
using namespace std ;
int N;
int main(){
    cin >> N;
    string S;
    cin >> S;
    int An=N;
    for(int i=0;i<N-1;i++){
        if(S[i]==S[i+1]){
            An--;
        }
    }
    cout << An << "\n";
}

Measured memory_bytes: 3668
import java.util.*;

public class Main {
	public int WaterMoney ( int water ) {
		int cost = 0;
		water -= 10; cost += 1150;
		while ( water > 0 ) {
			if ( water <= 10 ) cost += 125;
			else if ( water <= 20 ) cost += 140;
			else cost += 160;
			water--;
		}
		return cost;
	}
	
	public static void main ( String[] args ) {
		Main m = new Main();
		Scanner sc = new Scanner(System.in);
		while ( !sc.hasNext("-1") ) {
			int use = sc.nextInt();
			System.out.println(4280-m.WaterMoney(use));
		}
	}
}

Measured memory_bytes: 0
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
using namespace std;

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

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int n,x,y,z,dp[100110][3];
int maxn(int a,int b){
	return a>b?a:b;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d%d",&x,&y,&z);
		dp[i][0]=maxn(dp[i-1][1],dp[i-1][2])+x;
		dp[i][1]=maxn(dp[i-1][0],dp[i-1][2])+y;
		dp[i][2]=maxn(dp[i-1][0],dp[i-1][1])+z;
	}
	printf("%d",maxn(maxn(dp[n][0],dp[n][1]),dp[n][2]));
}

Measured memory_bytes: 1280
n,k = gets.split.map &:to_i; h=[]
n.times do |i|
	h[i] = gets.to_i
end
h = h.sort; arr = Array.new(n-k+1)
arr.length.times do |i|
	arr[i] = h[i+k-1] - h[i]
end
puts arr.min


Measured memory_bytes: 4676
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 55
#define INF 1000000000
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int n,m,a,b,c;
char in[M*2][M][M];
int dis[M];
int max(int x,int y,int z)
{
	return max(max(x,y),z);
}
int main()
{
	int x,y;
	int d1,d2,d3;
	bool flg;
	while(~scanf("%d %d %d %d %d",&n,&m,&a,&b,&c))
	{
		MSET(in, false);
		REP(i,1,m)
		{
			RI(x,y);
			in[1][x][y] = true;
		}

		REP(s,2,100)
		{
			REP(i,1,n)REP(j,1,n)REP(k,1,n)
				if(in[1][i][j] && in[s-1][j][k])
					in[s][i][k] = true;
		}
		
		REP(i,1,n)dis[i]=INF;
		dis[n]=0;

		while(1)
		{
			x=-1;
			flg=false;
			REP(i,1,n)
			{
				d1=d2=d3=INF;

				REP(j,1,n) if(in[a][i][j] && d1>dis[j]) d1=dis[j];
				REP(j,1,n) if(in[b][i][j] && d2>dis[j]) d2=dis[j];
				REP(j,1,n) if(in[c][i][j] && d3>dis[j]) d3=dis[j];

				if(max(d1,d2,d3)+1 < dis[i])
				{
					flg=true;
					dis[i] = max(d1,d2,d3)+1;
				}
			}

			if(!flg) break;
		}

		if(dis[1]==INF) puts("IMPOSSIBLE");
		else printf("%d\n",dis[1]);
	}
	return 0;
}

Measured memory_bytes: 3552
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner in = new Scanner(System.in);
    int a = in.nextInt();
    int b = in.nextInt();
    int c = in.nextInt();
    if( a < b && b < c ){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

int main()
{
    int n;
    cin >> n;
    int* arr = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    long double d = 0;
    for (int i = 0; i < n; i++) d += (float) 1 / arr[i];
    printf("%0.7Lf\n", 1 / d);
}

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

signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   // freopen("input.txt", "r", stdin);
    int n; cin>>n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i)
    {
        cin>>v[i];
    }
    int x=v[0], a=0;
    for(int i=0; i<n;i++){
        //cout<<x-v[i]<<" ";
        if(x > v[i]){
            a += (x-v[i]);
            //x= v[i];
        }
        x = max(x,v[i]);
    }
    //cout<<endl;
    cout<<a<<endl;
    
}

Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int H,W;cin>>H>>W;
    vector<string> v(H);
    REP(i,H)cin>>v[i];
    bool f=true;
    REP(i,H)REP(j,W){
        if(v[i][j]=='.')continue;
        else{
            if(i==0 && j==0){
                if(v[0][1]=='#'&&v[1][0]=='#'){
                    f=false;break;
                }
            }else if(i==H-1 && j==W-1){
                if(v[H-2][W-1]=='#' && v[H-1][W-2]=='#'){
                    f=false;break;
                }
            }else{
                if((i-1>=0 && v[i-1][j]=='#') && (j-1>=0 && v[i][j-1]=='#')){
                    f=false;break;
                }
                if((i+1<=H-1 && v[i+1][j]== '#') && (j+1<=W-1 && v[i][j+1]=='#')){
                    f=false;break;
                }
            }
        }
    }
    if(f)cout<<"Possible"<<endl;
    else cout<<"Impossible"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long INF = 1e9 + 7;
using namespace std;
typedef long long ll;
map<int, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long a, b, c;
	cin >> a >> b >> c;
	if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
		cout << 0 << endl;
	}
	else {
		cout << min(min(b * c, c * a), a * b) << endl;
	}
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,m,n) for(int i=m;i<(n);i++)
#define ALL(x) x.begin(),x.end()
#define ll long long

typedef pair<int,int> pii;

typedef complex<double> point;
const double R = 1.0;
const double EPS = 1e-6;
double dist(point &p1,point &p2){
	return abs(p1-p2);
}
struct Square{
	double d,u,l,r;
	int up_bound;
	
	Square(double _d,double _u, double _l,double _r,const vector<point>&ps):d(_d),u(_u),l(_l),r(_r){
		int res = 0;
		point c = {(l+r)/2,(d+u)/2};
		double ra = sqrt(2)*(r-l)/2+1;
		for(auto p:ps){
			if(dist(c,p)<ra+EPS)res++;
		}
		up_bound=res;
	}
	int count(const vector<point>&ps,const double &R){
		point c = {(l+r)/2,(d+u)/2};
		int res = 0;
		for(auto p:ps){
			if(dist(c,p)<R+EPS)res++;
		}
		return res;
	}
};
namespace std{
	bool operator<(const Square &S1, const Square &S2){
		return S1.up_bound<S2.up_bound;
	}
	bool operator>(const Square &S1, const Square &S2){
		return S1.up_bound>S2.up_bound;
	}
}
void solve() {
	int N;cin>>N;
	if(N==0)exit(0);

	int ans = 1;
	double l = 0,r = 10;
	vector<point>ps(N);
	REP(i,N){
		double x,y;cin>>x>>y;
		ps[i]={x,y};
	}
	Square s(-1e9,1e9,-1e9,1e9,ps);
	priority_queue<Square,vector<Square>,greater<Square>>que;
	que.push(s);
	REP(_,500){
		vector<Square>nxt;
		while(!que.empty()){
			Square s = que.top();que.pop();
			if(s.up_bound<=ans)continue;
			ans = max(ans,s.count(ps,R));
			double xl = s.l , xm = (s.l+s.r)/2.0,xr = s.r;
			double yl =s.d,ym = (s.d+s.u)/2.0,yr = s.u;
			Square s1(yl,ym,xl,xm,ps);
			if(s1.up_bound>ans)nxt.push_back(s1);

			Square s2(yl,ym,xm,xr,ps);
			if(s2.up_bound>ans)nxt.push_back(s2);
			
			Square s3(ym,yr,xl,xm,ps);
			if(s3.up_bound>ans)nxt.push_back(s3);
			
			Square s4(ym,yr,xm,xr,ps);
			if(s4.up_bound>ans)nxt.push_back(s4);
		}
		for(auto s:nxt)que.push(s);
	}
	cout<<ans<<endl;
}
signed main() {
	while (true) {
		solve();
	}
}


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

struct tp
{
	ll l, r, k;
};

tp a[200010];
vector <tp> v1, v2;

bool cmp1(tp a, tp b)
{
	return a.k<b.k;
}
bool cmp2(tp a, tp b)
{
	return a.k>b.k;
}
int main()
{
	ll i, j, k, n, m, t;

	scanf("%lld", &t);

	while(t--)
	{
		scanf("%lld", &n);
		v1.clear();
		v2.clear();
		for(i=0; i<n; i++)
		{
			scanf("%lld %lld %lld", &a[i].k, &a[i].l, &a[i].r);
			//cout<<i<<endl;
			if(a[i].l>=a[i].r) v1.push_back(a[i]);
			else v2.push_back(a[i]);
		}

		sort(v1.begin(), v1.end(), cmp1);
		ll sz=v1.size(), cnt=1;
		priority_queue <ll> pq;
		ll res=0;
		//cout<<"*"<<endl;
		for(i=0; i<sz; i++)
		{
			res+=v1[i].l;
			if(v1[i].k>=cnt)
			{
				cnt++;
				pq.push(v1[i].r-v1[i].l);
			}
			else 
			{
				pq.push(v1[i].r-v1[i].l);
				ll x=pq.top();
				pq.pop();
				res+=x;
			}
		}

		while(pq.size()) pq.pop();

		sort(v2.begin(), v2.end(), cmp2);

		cnt=n;
		sz=v2.size();
		for(i=0; i<sz; i++)
		{
			res+=v2[i].r;
			if(v2[i].k<cnt)
			{
				cnt--;
				pq.push(v2[i].l-v2[i].r);
			}
			else
			{
				pq.push(v2[i].l-v2[i].r);
				ll x=pq.top();
				pq.pop();
				res+=x;
			}
		}
		while(pq.size()) pq.pop();

		printf("%lld\n", res);

	}



	return 0;
}

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

int main() {
	int n,a,b,sum1=0,sum2=0,x1,x2,x3,x4,x5;
	string w,s1,s2,s3,s4,s5;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		if(i<10){
			w=to_string(i);
			s1=w;
			x1=stoi(s1);
			sum1=x1;
			if(sum1>=a &&sum1<=b)sum2+=i;
		}else if(i<100){
			w=to_string(i);
			s1=w.substr(0,1);
			s2=w.substr(1,1);
			x1=stoi(s1);
			x2=stoi(s2);
			sum1=x1+x2;
			if(sum1>=a &&sum1<=b)sum2+=i;
		}else if(i<1000){
			w=to_string(i);
			s1=w.substr(0,1);
			s2=w.substr(1,1);
			s3=w.substr(2,1);
			x1=stoi(s1);
			x2=stoi(s2);
			x3=stoi(s3);
			sum1=x1+x2+x3;
			if(sum1>=a &&sum1<=b)sum2+=i;
		}else if(i<10000){
			w=to_string(i);
			s1=w.substr(0,1);
			s2=w.substr(1,1);
			s3=w.substr(2,1);
			s4=w.substr(3,1);
			x1=stoi(s1);
			x2=stoi(s2);
			x3=stoi(s3);
			x4=stoi(s4);
			sum1=x1+x2+x3+x4;
			if(sum1>=a &&sum1<=b)sum2+=i;
		}else if(i==10000){
			w=to_string(i);
			s1=w.substr(0,1);
			s2=w.substr(1,1);
			s3=w.substr(2,1);
			s4=w.substr(3,1);
			s5=w.substr(4,1);
			x1=stoi(s1);
			x2=stoi(s2);
			x3=stoi(s3);
			x4=stoi(s4);
			x5=stoi(s5);
			sum1=x1+x2+x3+x4+x5;
			if(sum1>=a &&sum1<=b)sum2+=i;
		}
	}
	cout<<sum2<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  char s[LIMIT1],t[LIMIT1];
  
  scanf("%lld",&n);
  scanf("%s %s",s,t);
  rep(i,n){
    printf("%c%c",s[i],t[i]);
  }
  printf("\n");
  return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    double a=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    cout<<fixed<<setprecision(12);
   double d=sqrt(a);
    cout<<d<<endl;
}


Measured memory_bytes: 3300
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n=100000;
    int h[n],w[n];
    int N;
    for(int i=0;i<n;i++){
        cin >> h[i]>>w[i];
        if(h[i]==0 && w[i]==0){
            N=i;
            break;
        }
    }
    
    for(int k=0;k<N;k++){
        for(int i=0;i<h[k];i++){
            for(int j=0;j<w[k];j++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
program main;
var n,x,y:integer;
    s:string;
begin
readln(n);
readln(s);
x:=0;
for y:=1 to n do begin
 if(s[y]+s[y+1]+s[y+2]='ABC') then x:=x+1;
 end;
 writeln(x);
 end.

Measured memory_bytes: 1372
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

char dn[1300000], * di = dn;
int keta1 = 1, keta2;
char C1[10] = { '1', '0', '0', '0', '0', '0' };
char C2[10] = { '0', '0', '0', '0', '0', '0' };

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


	int N, M;
	scanf("%d %d", &N, &M);

	if (N % 2) {
		int n = N - 1;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}

		rep1(i, M) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}
	else {
		int n = N;
		keta2 = 0;
		while (n) {
			*(C2 + keta2) = '0' + n % 10;
			n /= 10;
			keta2++;
		}
		rep1(i, (M + 1) / 2) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
		C2[0]--;
		int tmp = 0;
		while (C2[tmp] < '0') {
			C2[tmp++] += 10;
			C2[tmp]--;
			if (C2[keta2 - 1] == '0') keta2--;
		}
		for (int i = (M + 1) / 2 + 1; i <= M; i++) {
			for (int i = keta1 - 1; i >= 0; i--)* di++ = (*(C1 + i));
			*di++ = ' ';
			for (int i = keta2 - 1; i >= 0; i--)* di++ = (*(C2 + i));
			*di++ = '\n';

			C1[0]++;
			int tmp = 0;
			while (C1[tmp] > '9') {
				C1[tmp++] -= 10;
				C1[tmp]++;
				if (C1[keta1] != '0') keta1++;
			}
			C2[0]--;
			tmp = 0;
			while (C2[tmp] < '0') {
				C2[tmp++] += 10;
				C2[tmp]--;
				if (C2[keta2 - 1] == '0') keta2--;
			}
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

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

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

    vector<ll> sunuke(N);
    for (size_t i = 0; i < K; i++)
    {
        ll d;
        cin >> d;
        vector<ll> A(d);
        for (size_t i = 0; i < d; i++)
        {
            cin >> A[i];
            sunuke[A[i] - 1]++;
        }
    }

    ll ans = 0;
    for (size_t i = 0; i < N; i++)
    {
        if (sunuke[i] == 0)
        {
            ans++;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;

ll n, k, s, x[2000], y[2000], z[2000], e[2000][2], cost[2000][2], counter[2000], used[2000], temp[5000];
const ll INF = 100000000000LL;

ll dfs(ll num, ll before, ll c, ll sum) {
  if (used[num] >= 2) return INF;
  //printf("%lld, %lld, %lld, %lld\n", num, before, c, sum);
  used[num]++;
  ll ans = INF;
  if (c >= k-1) ans = s * s * 6 * k - sum;
  for (ll i = 0; i < counter[num]; i++) if (e[num][i] != before) {
    temp[c] = cost[num][i];
    sum += cost[num][i];
    if (c == k-1 && used[i] == 1 && used[e[num][i]] == 1) return s * s * 6 * k - sum;
    if (c >= k-1) sum -= temp[c-k+1];
    ans = min(ans, dfs(e[num][i], num, c+1, sum));
  }
  return ans;
}

int main() {
  while (scanf("%lld%lld%lld", &n, &k, &s), n) {
    for (ll i = 0; i < n; i++) scanf("%lld%lld%lld", &x[i], &y[i], &z[i]), counter[i] = 0;
    for (ll i = 0; i < n; i++) {
      for (ll j = i+1; j < n; j++) {
        if (i == j) continue;
        ll xdiff = s - abs(x[i] - x[j]);
        ll ydiff = s - abs(y[i] - y[j]);
        ll zdiff = s - abs(z[i] - z[j]);
        if (xdiff < 0 || ydiff < 0 || zdiff < 0) continue;
        e[i][counter[i]] = j;
        cost[i][counter[i]] = (xdiff * ydiff + ydiff * zdiff + zdiff * xdiff) * 2;
        counter[i]++;
        e[j][counter[j]] = i;
        cost[j][counter[j]] = (xdiff * ydiff + ydiff * zdiff + zdiff * xdiff) * 2;
        counter[j]++;
      }
    }
    for (ll i = 0; i < n; i++) used[i] = 0;
    ll ans = INF;
    for (ll i = 0; i < n; i++) if (!used[i] && counter[i] == 1) ans = min(ans, dfs(i, -1, 0, 0));
    for (ll i = 0; i < n; i++) if (!used[i] && counter[i] == 2) ans = min(ans, dfs(i, e[i][0], 0, 0));
    for (ll i = 0; i < n; i++) if (!used[i]) ans = min(ans, dfs(i, -1, 0, 0));
    if (ans == INF) ans = -1;
    printf("%lld\n", ans);
  }
}



Measured memory_bytes: 2844
// https://github.com/PabloMessina/Competitive-Programming-Material/blob/master/Codejam_template.cpp
#pragma GCC optimize("Ofast") // OPTIONAL: for faster execution
#include <bits/stdc++.h>      // import everything in one shot
using namespace std;
// defines
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define invrep(i, a, b) for (int i = b - 1; i >= a; --i)
#define umap unordered_map
#define uset unordered_set
// typedefs
typedef unsigned int uint;
typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
// -------------------------------

int main()
{
    // OPTIONAL: for faster input/output (only if using cin/cout)
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s;
    int sum = 0;
    cin >> s;
    for(char c : s)
        sum += c - '0';
    
    
    if (sum % 9 == 0)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}

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

int main()
{
  string str = "abcdefghijklmnopqrstuvwxyz";
  char c;
  cin >> c;
  int index;
  for (int i = 0; i < str.size(); i++) {
  	if (str[i] == c) {
    	index = i;
      	break;
    } 
  }
  cout << str[index + 1] << endl;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  vector<int> A(N,0);
  for(int i = 0; i < K; i++){
    int d;
    cin >> d;
    vector<int> B(d);
    for(int j = 0; j < d; j++){
      cin >> B.at(j);
      A.at(B.at(j)-1) = 1;
    }
  }
  int count = 0;
  for(int i = 0; i < N; i++){
    if(A.at(i) == 0) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

int main() {
	int k;
	cin >> k;
	int kisu = 0, gusu = 0;
	for (int i = 1; i <= k; i++) {
		if (i % 2 == 0) {
			gusu++;
		}
		else {
			kisu++;
		}
	}
	cout << kisu * gusu << endl;
	return 0;
}


Measured memory_bytes: 256