akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>

using namespace std;

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

  int min = 100000000;
  for (int a = 1; a < n; a++) {
    int b = n - a;
    int sum = 0;

    for (int ta = a; ta != 0; ta /=10)
      sum += ta%10;

    for (int tb = b; tb != 0; tb /=10)
      sum += tb%10;
    //cout << a << " " << b << " " << sum << endl;
    if (sum < min)
      min = sum;
  }

  cout << min << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    string s;
    cin>>s;
    if(s.length()==2)
    {
        cout<<s<<endl;
    }
    else
    {
        reverse(s.begin(),s.end());
        cout<<s<<endl;
    }
    return 0;
}


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

int main(){
  int n,m;
  cin>>n>>m;
  
  vector<pair<int,int>> a(n);
  for(int i=0 ; i<n ; ++i)
    cin>>a[i].first>>a[i].second;
  
  sort(a.begin(),a.end());
  priority_queue<int> q;
  
  long long ans=0 , j=0;
  for(int i=1 ; i<=m ; ++i){
    while(j<n && a[j].first == i)
      q.push(a[j].second) , ++j;
    
    if(q.size()){
      ans += q.top();
      q.pop();
    }
  }
  
  cout<<ans;
}
    
      
      
    

Measured memory_bytes: 1660
#include <bits/stdc++.h>
/*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
*/
#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
int main() {
   int n;
   int e;
   
   cin >> n >> e;
   int dist[n][n];
   
   int i, j, k;
   //隣接行列作成
   for(i = 0; i < n; i++){
       for(j = 0; j < n; j++){    
           dist[i][j] = INF;
        }
    }

    int s, t, d;
    for(i = 0; i < e; i++){
        cin >> s >> t >> d;
        dist[s][t] = d;
    }
    
    int dp[1<<n][n];

   //dp初期化
   for(i = 0; i < (1<<n); i++){
       for(j = 0; j < n; j++){
           dp[i][j] = INF;
       }
   }
   dp[1][0] = 0;

   for(i = 0; i < (1<<n); i++){
       for(j = 0; j < n; j++){
           if(dp[i][j] == INF) continue;
           for(k = 0; k < n; k++){
               //もしkが訪問済みだったら何もしない
               if((i>>k)%2 == 1) continue;
               if(dist[j][k] == INF) continue;
               //集合の更新
               int nexti = i | (1<<k);
               //経路長を求める
               int nextd = dp[i][j] + dist[j][k];
               //現在の値より小さいなら更新する
               dp[nexti][k] = min(dp[nexti][k], nextd);
           }
       }
   }

   //全て訪問した時の状態
   int all = (1<<n) - 1;
   int ans = INF;
   int goal;
   for(i = 0; i < n; i++){
       if(dp[all][i] == INF) continue;
       int tmp = dp[all][i] + dist[i][0];
       ans = min(ans, tmp);
   }

   if(ans == INF){
       cout << -1 << endl;
   }else{
       cout << ans << endl;
   }
}







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

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

    if (u == s)
    {
        cout << a - 1 << " " << b << endl;
    }

    else
    {
        cout << a << " " << b - 1 << endl;
    }
}


Measured memory_bytes: 256
Scanf.scanf "%d" (fun n ->
    let d = Array.init n (fun _ -> Scanf.scanf " %d" (fun d -> d)) in
    Array.sort compare d;

    let calc l =
        let a = Array.of_list l in
        Array.sort compare a;

        let rec loop i acc = 
            if i = n + 1 then acc else
                loop (i + 1) (min acc (abs (a.(i) - a.(i - 1))))
        in
        loop 1 12
    in

    let rec loop i flag acc =
        if i = n then calc acc else
            loop (i + 1) (not flag) ((if flag then d.(i) else 24 - d.(i)) :: acc)
    in
    loop 0 true [ 0 ] |> Printf.printf "%d\n"
)

Measured memory_bytes: 3840
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <functional>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#define PI 3.14159265358979
#define EPS 1e-15
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int n;
ll K;
double pre[SIZE];

void make()
{
	for(int i=0;i<=n;i++) pre[i]=sin(2.0*PI*(double) i/(double) n);
}
double calc_area(int i,int j)//i+j<N
{
	return (pre[i]+pre[j]+pre[n-i-j])/2.0;
}
int count(int i,double X)
{
	if(i==n-1) return 0;
	int all=(n-i)/2;
	int l=0,r=all+1;
	while(r-l>1)
	{
		int m=(l+r)/2;
		if(calc_area(i,m)>X+EPS) r=m;
		else l=m;
	}
	if(r==all+1) return n-i-1;
	return l*2;
}
bool check(double X)
{
	ll sum=0;
	for(int i=1;i<n;i++) sum+=count(i,X);
	return sum*(ll) n>=K;
}
int main()
{
	scanf("%d %lld",&n,&K);
	make();
	K=3LL*K;
	double l=0.0,r=2.0*PI;
	for(int i=0;i<50;i++)
	{
		double m=(l+r)/2;
		if(check(m)) r=m;
		else l=m;
	}
	printf("%.10f\n",r);
	return 0;
}


Measured memory_bytes: 640
//Bismillahir Rahmanir Rahim
//Atcoder problem
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;

	if((b*c)>=a)
	{
		cout<<"Yes"<<endl;
	}
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 3032
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<algorithm>
#include<cstdio>

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

const int bm = 3010;
ll BIT[bm];
void add(int A, ll B) {
	while (A <= bm) {
		BIT[A] = max(BIT[A], B);
		A += A & -A;
	}
}
ll query(int A) {
	ll kotae = 0;
	while (A > 0) {
		kotae = max(BIT[A], kotae);
		A -= A & -A;
	}
	return kotae;
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll V[200000], tmp[200000];

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


	int R = getint(), C = getint(), K = getint();

	rep(i, K) {
		ll r = getint(), c = getint(), v = getint();
		V[i] = v << 30 | r << 12 | c;
	}

	const int b = 12;
	int kazu[1 << b] = {}, kazu2[1 << b] = {};
	rep(i, K) kazu[V[i] & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
	for (int i = K - 1; i >= 0; i--) tmp[--kazu[V[i] & ((1 << b) - 1)]] = V[i];
	rep(i, K) kazu2[tmp[i] >> b & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
	for (int i = K - 1; i >= 0; i--) V[--kazu2[tmp[i] >> b & ((1 << b) - 1)]] = tmp[i];

	int mae = -1;
	ll A[4] = {};
	ll L[3001];
	int l = 0;
	rep(k, K) {
		int v = V[k] >> 30;
		int i = V[k] >> 12 & 4095;
		int j = V[k] & 4095;
		if (mae != i) {
			mae = i;
			A[0] = 0;
			A[1] = 0;
			A[2] = 0;
			A[3] = 0;
			rep(a, l) add(L[a] & 4095, L[a] >> 12);
			l = 0;
		}
		ll kari = query(j);
		A[0] = kari;
		chmax(A[3], kari);
		chmax(A[2], kari);
		chmax(A[1], kari);
		chmax(A[3], A[2] + v);
		chmax(A[2], A[1] + v);
		chmax(A[1], A[0] + v);
		L[l++] = A[3] << 12 | j;
	}

	rep(a, l) add(L[a] & 4095, L[a] >> 12);
	ll kotae = query(C);

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

	Would you please return 0;
}

Measured memory_bytes: 4940
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n;
		do {
		n = stdIn.nextInt();
		}while(n<0||n>26);
		String S;
		do {
		S = stdIn.next();
		}while(S.length()<1||S.length()>10000);
		int len = S.length();
		String s[] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
		for(int i=1 ; i<=len ; i++ ) {
			for(int j=0 ; j<26 ; j++)
				if(s[j].equals(S.substring(i-1,i))) {
					System.out.print(s[(j+n)%26]);
				}
		}
	}
}


Measured memory_bytes: 39260
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define N 2*10e5
#define precise cout<<fixed<<setprecision(10)
#pragma GCC optimize("O0")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#define rep(i,a,b) for(int i=a;i<b;i++)
#define min3(a,b,c) min(a,min(b,c))
#define nl cout<<"\n";
#define all(v) v.begin(),v.end()
#define F first
#define S second
typedef long long ll;
typedef vector<long long> vl;
typedef vector<pair<long,long>> vp;
void get(ll arr[],ll n){for(ll i=0;i<n;i++) cin>>arr[i];}
ll gcd(ll a,ll b);
ll binpow(ll a,ll b);
void solve()
{
    ll x;
    cin>>x;
    if(x==0) cout<<"1";
    else cout<<"0";
}
int main()
{
 	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll t;
	t=1;
	//cin>>t;
	while(t--)
	{
	 	solve();
	}
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
ll binpow(ll a, ll b) {
   ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

Measured memory_bytes: 3608
#b
#上で再起の代わりにナイーブに配列内の値を埋めていく。
#aこのほうがちょい早い。

#b
#by using the condition d<=10, we should memorize V*d whether the pair is already searched.
#if searched, we can stop.
#まだ遅い。TLE.

n,m = [int(i) for i in input().split()]
edges = [[] for _ in range(n)]
colors = [0]*n

checker = [[0 for _ in range(11)] for _ in range(n)]        

for _ in range(m):
    a,b = [int(i) for i in input().split()]
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    

def dfs(d,v,c):
    if checker[v][d] != 0 or d<0:
        return
    #d>=0 and (v,d) is not checked
    if colors[v]==0: #not colored yet
        colors[v] = c
        
    #ここよ
    for j in range(d+1):
        checker[v][j] = 1
        
        
    nodes=edges[v]
    for u in nodes:
        dfs(d-1, u, c)

    
q = int(input())
info = []
for _ in range(q):
    v,d,c = [int(i) for i in input().split()]
    info.append((v-1,d,c))
    
info.reverse()
for tupple in info:
    v,d,c = tupple
    
    #not bfs but dfs
    dfs(d,v,c)
    
for i in range(n):
    print(colors[i])


Measured memory_bytes: 57692
n=int(input())
ts=[]; xs=[]; ys=[]

for i in range(n):
    t,x,y = map(int,input().split())
    ts.append(t); xs.append(x); ys.append(y)

flag=1
for i in range(n):
    t = ts[i]
    d = abs(xs[i]) + abs(ys[i])
    if t>=d and (t-d)%2==0: continue
    else: flag=0; break

if flag: print("Yes")
else: print("No")

Measured memory_bytes: 11716
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
typedef long long ll;

int main () {

    ll A,B,C,K;
    cin >> A >> B >> C >> K;

    if (K % 2 == 1) {
        cout << B - A << endl;
    } else {
        cout << A - B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>

typedef long long ll;

using namespace std;

int n,m;
string s;

unordered_map<int,bool> edges[200000];

void del_edge(int now) {
	//if(edges[now].empty()) return;
	int ab_bits = 0;
	for(pair<int,bool> p : edges[now]) {
		int next = p.first;
		if(s.at(next)=='A') ab_bits |= 0b01;
		if(s.at(next)=='B') ab_bits |= 0b10;
	}
	if(ab_bits!=0b11) {
		vector<int> q;
		for(pair<int,bool> p : edges[now]) {
			int next = p.first;
		}
		for(pair<int,bool> p : edges[now]) {
			int next = p.first;
			q.push_back(next);
		}
		for(int next : q) {
			edges[next].erase(now);
		}
		edges[now].clear();
		for(int next : q) {
			del_edge(next);
		}
	}
}

int main() {
	cin >> n >> m >> s;
	for(int i = 0; i < m; i++) {
		int a,b;
		cin >> a >> b;
		a--;
		b--;
		edges[a][b] = true;
		edges[b][a] = true;
	}

	//
	for(int i = 0; i < n; i++) {
		del_edge(i);
	}

	//
	for(int i = 0; i < n; i++) {
		if(!edges[i].empty()) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}


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

using namespace std;

void funcA() {

    int n;
    cin >> n;
    for (int i = 1; i <= 10; ++i) {
        if (i * 1000 >= n) {
            cout << i * 1000 - n;
            break;
        }
    }
}
void funcB() {

    int n;
    cin >> n;
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    string s;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        if (s == "AC") ++ac;
        else if(s == "WA") ++wa;
        else if(s == "TLE") ++tle;
        else if (s == "RE")++re;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;




}

int main() {

    //funcA();
    funcB();

    return 0;
}

Measured memory_bytes: 3624
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength

def brick(a,n,m,N):#ABC 148
  #n番目以降にmがあるか調べる
  if not m in a[n:]:
    print(N-(m-1))
  else:
    #b = copy.deepcopy(a)
    brick(a,a[n:].index(m),m+1,N)

#X = str(input()).split()
#a = [int(x) for x in input().split()]

N = int(input())
S = []
B = []
for i in range(N):
    S.append(str(input()))

c = collections.Counter(S)
a = c.most_common()


B.append(a[0][0])

for i in range(len(a)-1):
    if(a[i][1]==a[i+1][1]):
        B.append(a[i+1][0])
    else:
        break
B.sort()

for i in range(len(B)):
    print(B[i])


Measured memory_bytes: 56380
/*
 NOTE:
*/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <queue>
#include <vector>
#include <map>
#include <stack>
#include <set>
#define MP make_pair
#define F first
#define S second
#define TIME (double)clock()/CLOCKS_PER_SEC
using namespace std;
typedef long long ll;

int n;
bool a[300030];
int l[300030], r[300030];
int ans = 1e9;

int main()
{
//	freopen("test.in", "r", stdin);
//	freopen("test.out", "w", stdout);
 	ios::sync_with_stdio(false);
	cin >> n;
	char c;
	for (int i = 1; i <= n; i ++) {
		cin >> c;
		a[i] = (c == 'E');
	}
	for (int i = 1; i <= n; i ++)
		l[i] = l[i - 1] + (a[i] == 0);
	for (int i = n; i >= 1; i --)
		r[i] = r[i + 1] + (a[i] == 1);
	for (int i = 1; i <= n; i ++)
		ans = min(ans, l[i - 1] + r[i + 1]);
	cout << ans << endl;
	return 0;
}
/*
*/



Measured memory_bytes: 2944
n = int(input())
a = list(map(int , input().split()))
x = 1000
k = 0
 
 
for i in range(n-1):
    if a[i] < a[i+1]:
        t = x // a[i]
        k += t
        x -= t * a[i]
    else:
        x += k * a[i]
        k = 0
    #print(x,k)
print( x + k * a[-1])

Measured memory_bytes: 61820
require 'prime'

n =  10 ** 7
table = Array.new(n+1, false)
Prime.each(n) {|prime| table[prime] = true }
ps = (1..55555).select { |i| i % 5 == 1 && table[i] }

n = gets.to_s.to_i

puts ps[0...n].join(" ")

Measured memory_bytes: 101356
fun main() {
    val s = next()
    (0 until s.lastIndex).forEach { i ->
        when {
            s[i] == s[i + 1] -> {
                println("${i + 1} ${i + 2}")
                return
            }
            i < s.lastIndex - 1 && s[i] == s[i + 2] -> {
                println("${i + 1} ${i + 3}")
                return
            }
        }
    }
    println("-1 -1")
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

fun gcd(x: Int, y: Int): Int {
    fun innerGcd(x: Int, y: Int): Int {
        return if (x % y == 0) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

fun gcd(x: Long, y: Long): Long {
    fun innerGcd(x: Long, y: Long): Long {
        return if (x % y == 0L) y else innerGcd(y, x % y)
    }
    return if (x >= y) innerGcd(x, y) else innerGcd(y, x)
}

// classes
class UnionFindTree(val size: Int) {
    private val r = sizedArray(size, -1)
    fun root(x: Int): Int {
        if (r[x] < 0) return x
        return root(r[x])
    }

    fun unite(x: Int, y: Int) {
        var rx = root(x)
        var ry = root(y)
        if (rx == ry) return
        if (r[rx] > r[ry]) {
            rx = ry.also { ry = rx }
        }
        r[rx] += r[ry]
        r[ry] = rx
    }

    fun size(x: Int) = -r[root(x)]

    override fun toString(): String {
        return r.joinToString(separator = ", ")
    }
}

Measured memory_bytes: 38396
def solve():
    us = [[i] for i in range(0,n+1)]
    for i in range(1, n + 1):
        for fr in fs[i]:
            if not us[i] is us[fr]:
                if len(us[i])>len(us[fr]):
                    us[i].extend(us[fr])
                    for aa in us[fr]:
                        us[aa] = us[i]
                else:
                    us[fr].extend(us[i])
                    for aa in us[i]:
                        us[aa] = us[fr]
    for i in range(1, n + 1):
        frens = len(us[i]) - 1 - len(fs[i])
        for blo in bs[i]:
            if us[i] is us[blo]:
                frens -= 1
        print(frens, end=" ")
    print()
    return



n, m, k = [int(s) for s in input().split(" ")]

fs = [[] for i in range(n + 1)]
bs = [[] for i in range(n + 1)]
for i in range(m):
    a, b = [int(s) for s in input().split(" ")]
    fs[a].append(b)
    fs[b].append(a)
for i in range(k):
    c, d = [int(s) for s in input().split(" ")]
    bs[c].append(d)
    bs[d].append(c)


solve()


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

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

  typedef long long ll;
  ll a, b;
  cin >> a >> b;
  ll c = a / __gcd(a, b) * b;
  cout << c << endl;
}

Measured memory_bytes: 256
n = int(input())
ls = [[0,0,0]]
for x in range(n):
    tmp = list(map(int, input().split()))
    ls.append(tmp)

for i in range(len(ls)-1):
    t = ls[i+1][0] - ls[i][0]
    minkyori = abs(ls[i+1][1] - ls[i][1]) + abs(ls[i+1][2] - ls[i][2])
    if (t - minkyori) % 2 != 0 or (t - minkyori) < 0: #到着不可能,今回であればt=minkyori+2nなら到着できる
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 27300
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        Reader r = new Reader();
        int[] num = r.ii(),
        even = new int[3];
        Arrays.sort(num);
        for(int i = 0; i < 3; i++)
            if(num[i]%2 == 0)
                even[i] = 1;

        int total = even[0] + even[1] + even[2],
        ans = 0;
        if(total%3 > 0){
            ans++;
            for(int i = 0; i < 3; i++)
                if(even[i] == total%2)
                    num[i]--;
        }
        ans += num[2] - (num[0]+num[1])/2;
        print(ans);
    }

    static void print(Object o){
        System.out.println(o.toString());
    }
    static class Reader extends BufferedReader{
        Reader(){
            super(new InputStreamReader(System.in));
        }

        String s() throws IOException{
            return readLine();
        }

        String[] ss() throws IOException{
            return s().split(" ");
        }

        int Int(String s){
            return Integer.parseInt(s);
        }

        int i() throws IOException{
            return Int(s());
        }

        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Int(ss[j]);
            return ii;
        }
    }
}


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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int a, b;
    cin >> a >> b;

    // 処理
    int c   = b - a;
    int sum = 0;
    for (int i = 1; i <= c; i++) {
        sum += i;
    }
    cout << sum - b << endl;

    // 出力

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main (){
  string d;
  cin >> d;
  if(d == "SUN")
    cout << 7 << endl;
  else if (d == "MON")
    cout << 6 << endl;
  else if (d == "TUE")
    cout << 5 << endl;
  else if (d == "WED")
    cout << 4 << endl;
  else if (d == "THU")
    cout << 3 << endl;
  else if (d == "FRI")
    cout << 2 << endl;
  else 
    cout << 1 << endl;
}
  

Measured memory_bytes: 256
M=10**9+7;n,k,*A=map(int,open(0).read().split());C=[[0]*(n+1)for _ in"_"*(n+1)]
for i in range(n+1):
 for j in range(i+1):C[i][j]=(1,C[i-1][j-1]+C[i-1][j])[j>0]%M
F=[[0]*(n+1)for _ in"_"*(k+1)];F[0][0]=1
for i in range(k):
 for j in range(n+1):
  for m in range(j+1):F[i+1][j]+=C[j][m]*F[i][m]*C[n-j+m][A[i]-j+m]
print(F[k][n]%M)

Measured memory_bytes: 57052
#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0}; //次に行くところ
int dx[] = {0,1,0,-1}; //s上に同じ

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll cnt = 0;
  string s;
  cin >> s;
  int n = s.size();
  vector<int> a(n);

  for (int i = 0; i < n; i++){
    a[i] = s[i]-'0';
    cnt += a[i];
    if (cnt % 9 == 0){
      cnt = 0;
    }
  }

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

  return 0;
}

Measured memory_bytes: 4320
N = gets.to_i
B = gets.split.map(&:to_i)

ans = Array.new(N, 0)
ans[0] = B[0]

(N - 1).times do |i|
  ans[i] = [ans[i], B[i]].min
  ans[i+1] = B[i]
end

puts ans.inject(:+)


Measured memory_bytes: 1788
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <climits>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <functional>
#include <set>
#include <numeric>
#include <stack>
#include <utility>
#include <time.h>
#include <iterator>
//#include "util.h"

using namespace std;
typedef unsigned uint;
typedef long long lint;
typedef unsigned long long ulint;


//呪文
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const pair<_KTy, _Ty>& m) { cout << "{" << m.first << ", " << m.second << "}"; return ostr; }
template <typename _KTy, typename _Ty> ostream& operator << (ostream& ostr, const map<_KTy, _Ty>& m) { if (m.empty()) { cout << "{ }"; return ostr; } cout << "{" << *m.begin(); for (auto itr = ++m.begin(); itr != m.end(); itr++) { cout << ", " << *itr; } cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const vector<_Ty>& v) { if (v.empty()) { cout << "{ }"; return ostr; }	cout << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
template <typename _Ty> ostream& operator << (ostream& ostr, const set<_Ty>& s) { if (s.empty()) { cout << "{ }"; return ostr; } cout << "{" << *(s.begin()); for (auto itr = ++s.begin(); itr != s.end(); itr++) { cout << ", " << *itr; }	cout << "}"; return ostr; }
//template <typename T> void print(T* v, int N) { if (N == 0) cout << "{ }"; cout << "{" << v[0]; for (int p = 1; p < N; p++) cout << ", " << v[p]; cout << "}"; }
#define PI 3.14159265358979323846
#define EPS 1e-8
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define all(x) (x).begin(), (x).end()
	


int main() {
	string A, X, C;
	cin >> A >> X >> C;
	cout << 'A' << X[0] << 'C' << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		HashMap<Character, Character> map = new HashMap<Character, Character>();
		map.put('A', 'T');
		map.put('C', 'G');
		map.put('G', 'C');
		map.put('T', 'A');
		System.out.println(map.get(sc.next().charAt(0)));
	}

}


Measured memory_bytes: 26760
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#pragma GCC optimize(2)
#define int long long
#define MAXN 2000000
#define INF (1e13 + 7)
#define MANX MAXN

using namespace std;

inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (c > '9' || c < '0') { if (c == '-') f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + (c ^ 48); c = getchar(); }
	return f * x;
}

signed main()
{
	for (int i = 1; i <= 5; i++)
	{
		int x = read();
		if (x == 0) {cout << i; return 0;}
	}
	return 0;
}

Measured memory_bytes: 3564
def main():
    S = str(input())
    front = int(S[0:2])
    latter = int(S[2:4])
    if front < 13 and latter < 13 and (front > 0 and latter > 0):
        print('AMBIGUOUS')
    elif front < 13 and latter < 100 and front > 0:
        print('MMYY')
    elif front < 100 and latter < 13 and latter > 0:
        print('YYMM')
    else:
        print('NA')
main()

Measured memory_bytes: 8928
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  sort(A.begin(), A.end());
  cout << A.back() - A.front() << endl;
  return 0;
}


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

int main(){
int A,B,C,D;
cin >> A >> B >> C >> D;
if (A+B == C+D){
cout << "Balanced" << endl;
}
if (A+B > C+D){
cout << "Left" << endl;
}
if (A+B < C+D){
cout << "Right" << endl;
}
}


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

void Waku(int x) {
  for (int i = 0; i < x + 2; i++) {
    cout << '#';
  }
  cout << endl;
}

int main() {
  int H, W;
  cin >> H >> W;
  Waku(W);
  for (int i = 0; i < H; i++) {
    string a;
    cin >> a;
    cout << '#' + a + '#' << endl;
  }
  Waku(W);
}


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


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

  map<string,int> dict;


  for (int i = 0;i < n;i++){
      string com,cont;
      cin >> com >> cont;
      if (com == "insert"){
          dict[cont] = 1;
      }else if (com == "find"){
          if (dict[cont] == 1){
              cout << "yes" << endl;
          }else{
              cout << "no" << endl;
          }

      }
  }
  
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int N, M;
    cin >> N >> M;

    //
    //  スイッチの状態を全探索
    //

    int ans = 0;
    vector<set<int>> ccond;   // 電球のスイッチ接続条件
    vector<int> parr;         // スイッチの個数のparity

    for (int i = 0; i < M; i++) {
        int n;
        cin >> n;
        set<int> tarr;
        for (int j = 0; j < n; j++) {
            int k;
            cin >> k;
            tarr.insert(k);
        }
        ccond.push_back(tarr);
    }

    for (int k = 0; k < M; k++) {
        int c;
        cin >> c;
        parr.push_back(c);
    }

    for (int i = 0; i < (1 << N); i++) {
        //  i を bit 列に直す
        //  スイッチの状態がbit列となる
        bitset<10> bs(i);
        string bsstr(bs.to_string().substr(10 - N));

        //   電球毎に調べる
        int num_on = 0;
        for (int j = 0; j < ccond.size(); j++) {
            //  現在の電球
            set<int> cur_cond = ccond[j];  // 現在の電球の条件
            int curp = parr[j];  // スイッチの個数のparity
            //  スイッチの状態
            int num = 0;
            for (int i = 0; i < N; i++) {
                if (bsstr[i] == '1') {
                    if (cur_cond.find(i + 1) != cur_cond.end()) {
                        num++;
                    }
                }
            }
            if (num % 2 == curp) {
                num_on++;
            }
        }
        if (num_on == M) {
            ans++;
        }
    }

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


Measured memory_bytes: 256
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

vector<vector<int>> calcNext(const string &S) {
    int n = (int)S.size();
    vector<vector<int>> res(n + 1, vector<int>(10, n));
    for (int i = n - 1; i >= 0; --i) {
        for (int j = 0; j < 10; ++j)
            res[i][j] = res[i + 1][j];
        res[i][S[i] - '0'] = i;
    }
    return res;
}

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

    int N;
    string s;
    cin >> N >> s;

    int ans = 0;
    vector<vector<int>> next = calcNext(s);
    vector<vector<int>> dp(N + 1, vector<int>(4));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int k = 0; k <= 2; k++) {
            for (int j = 0; j < 10; j++) {
                if (next[i][j] >= N)
                    continue;
                dp[next[i][j] + 1][k + 1] += dp[i][k];
            }
        }
    }

    rep(i, N + 1) { ans += dp[i][3]; }

    cout << ans << endl;
}

Measured memory_bytes: 6872
#include <iostream>                                                                                                            
#include <vector>                                                                                                              
                                                                                                                               
using namespace std;                                                                                                           
                                                                                                                               
int main(){                                                                                                                    
    int A, B;                                                                                                                  
    cin >> A >> B;                                                                                                             
    int res = A+B;                                                                                                             
    if(res > 23) res -= 24;                                                                                                    
    cout << res << endl;                                                                                                       
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
    
using namespace std;
    
#define endl "\n"
#define ll unsigned long long
#define int long long int
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define vi vector <int >
#define vvi vector < vi > 
#define vii vector < pii >
#define viii vector < piii >
#define vll vector <ll >
#define vb vector <bool > 
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
#define double long double
#define a first
#define b second

int dp[3005][3005];
vi arr(3005);
const int inf = -1e16;

int f(int i, int j){
    if(i == j){
        return arr[i];
    }

    if(dp[i][j] != inf) return dp[i][j];

    return dp[i][j] = max(arr[i] - f(i + 1, j), arr[j] - f(i, j - 1));

}

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0);
    
    int n;
    cin >> n;
    forn(i, n){
        cin >> arr[i];
    }
    forn(i, 3003){
        forn(j, 3003){
            dp[i][j] = inf;
        }
    }
    cout << f(0, n - 1) << endl;

    return 0;
}


Measured memory_bytes: 70912
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
   ll a,b,c;
   cin>>a>>b>>c;
   ll ans=0;
   if((a+b+c)>=22)
    cout<<"bust";
   else
    cout<<"win";
  
    cout<<endl;
 	
 }

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, N)
	ans := make([]string, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
		ans[a[i]-1] = strconv.Itoa(i + 1)
	}
	fmt.Println(strings.Join(ans, " "))
}


Measured memory_bytes: 8320
#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>;
//using T = tuple<string, int, int>;

int main() {
  int A,B,C;
  cin >> A >> B >> C;
  cout << max(C-(A-B), 0) << endl;

  return 0;
}

// https://github.com/atcoder/live_library

Measured memory_bytes: 3636
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B - Postdocs
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

char s[MAX_N + 4];

/* subroutines */

/* main */

int main() {
  scanf("%s", s);

  for (char *cpt = s; *cpt; cpt++)
    if (*cpt == '?') *cpt = 'D';
  puts(s);
  return 0;
}


Measured memory_bytes: 3352
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){



int cnt=0;
	int w[10001],h[10001],x[1001],y[1001];
	int W,H,N;
	cin>>W>>H>>N;
	
	//for(int i=1;i<=W;i++)cin>>w[i];
	//for(int i=1;i<=H;i++)cin>>h[i];	
	
	for(int i=1;i<=N;i++)cin>>x[i]>>y[i];
	int nx=x[1],ny=y[1];
	

	for(int i=2;i<=N;i++){
	nx=x[i-1],ny=y[i-1];
	while(true){
	
		if(nx==x[i]&&ny==y[i])break;
	

	if(nx<x[i]||ny<y[i]){
		if(nx<x[i]&&ny<y[i]){
			nx++,ny++,cnt++;//斜め上に進む
			//cout<<nx<<" "<<ny<<endl;
		}
		else if(nx<x[i]){
			nx++,cnt++;
			//cout<<nx<<" "<<ny<<endl;
		}	
	else if(ny<y[i]){
			ny++,cnt++;
			//cout<<nx<<" "<<ny<<endl;
		}
	}

	else{
	if(nx>x[i]&&ny>y[i]){
			nx--,ny--,cnt++;//斜め上に進む
			//cout<<nx<<" "<<ny<<endl;
		}
		else if(nx>x[i]){
			nx--,cnt++;
			//cout<<nx<<" "<<ny<<endl;
		}	
	else if(ny>y[i]){
			ny--,cnt++;
			//cout<<nx<<" "<<ny<<endl;
		}
	}
	
	}//whileの終わり
	//cout<<endl<<cnt<<endl;
}
cout<<cnt<<endl;
return 0;
}

Measured memory_bytes: 1168
#include <iostream>
using namespace std;
struct Card
{
    char suit, value;
};
void bubble(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        for (int j = N - 1; j >= i + 1; j--)
        {
            if (A[j].value < A[j - 1].value)
            {
                Card t = A[j];
                A[j] = A[j - 1];
                A[j - 1] = t;
            }
        }
    }
}

void selection(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        int minj = i;
        for (int j = i; j < N; j++)
        {
            if (A[j].value < A[minj].value)
                minj = j;
        }
        Card t = A[i];
        A[i] = A[minj];
        A[minj] = t;
    }
}
void print(struct Card A[], int N)
{
    for (int i = 0; i < N; i++)
    {
        if (i > 0)
            cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N)
{
    for (int i = 0; i < N; i++)
    {
        if (C1[i].suit != C2[i].suit)
            return false;
    }
    return true;
}
int main()
{
    Card C1[1000], C2[100];
    int N;
    char ch;

    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> C1[i].suit >> C1[i].value;
    }
    for (int i = 0; i < N; i++)
        C2[i] = C1[i];

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;
    print(C2, N);
    if (isStable(C1, C2, N))
    {
        cout << "Stable" << endl;
    }
    else
    {
        cout << "Not stable" << endl;
    }
    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1n(x,n) for(int x = 1; x <= n ;++ x)
#define forn1(x,n) for(int x = 1; x < n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

const int M = 1e5+1;
const int N = 100+1;
ll dp[N][M];
int main(){
	IOS

	
	ll n,w;
	cin>>n>>w;
	vector<pl>v(n);
	cin>>v;

	ll maxv = 0;
	forn(i,n)
	{
		maxv += v[i].se;
	}
	forn(i,n+1)
	fill(begin(dp[i]),end(dp[i]),1e9+5);

	// dp[0][0]=0;
	for(int i=0;i<=n;i++)
		dp[i][0] = 0;
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=maxv;j++)
		{
			if(j<v[i-1].se)
				dp[i][j] = dp[i-1][j];
			else
			dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i-1].se]+v[i-1].fi);
		}
	}
	ll ans=0;

	for(ll i=0;i<=n;i++)
		for(ll j=0;j<=maxv;j++)
			if(dp[i][j]<=w)
				ans = max(ans,j);

	cout<<ans;
	return 0;	
}

Measured memory_bytes: 79232
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;


#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pi 3.14159265358979323846
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
vll factor(ll n){
    vll ans;
    if(n>0)ans.pb(1);if(n==2)ans.pb(2);
    for(ll i=2;i*i<=n;i++){if(n%i==0){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}if(n>2)ans.pb(n);
    return ans;
}
ll fact(ll n){
	
    ll res = 1; 
    for (ll i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
  
int nCr(ll n, ll r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
 
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 


ll ston(string s) 
{ 
    stringstream geek(s); 
    ll x = 0; 
    geek >> x; 
    
  
    return x; 
}
ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}
bool bserch(vector<string> a, string s){
	
	ll l=0,r=a.sz-1,mid;
	while(l<=r){
		mid=(l+r)/2;
		if(a[mid]==s)return true;
		if(a[mid]<s){
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	return false;
}

bool sortcol( const vector<int>& v1, 
               const vector<int>& v2 ) { 
 return v1[0] < v2[0]; 
} 

void solve()
{
	ll n,ans=0;
	cin>>n;
	string s;
	cin>>s;
	for(ll i=0;i<n;)
	{
		if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
		{
			ans++;
			i+=3;
		}
		else
			i++;
		
	}
	cout<<ans;
	return;
}

int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}

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

using namespace std;

int Q, A, B, C, D, K;

int getA(int A, int B, int K)
{
    int le = 0, ri = A, mid, best = 0;
    while(le <= ri)
    {
        mid = (le + ri) / 2;
        int newB = B - mid / K + (mid % K == 0);
        if(newB - newB % K <= 1ll * (A - mid) * K)
        {
            best = mid;
            le = mid + 1;
        }
        else
            ri = mid - 1;
    }
    return best;
}


int main()
{
    for(cin >> Q; Q; Q--)
    {
        cin >> A >> B >> C >> D;
        K = max(A, B) / (min(A, B) + 1) + (max(A, B) % (min(A, B) + 1) != 0);
        int leA = getA(A, B, K);
        int leB = leA / K - (leA % K == 0);
        int pos = leA + leB;
        A = A - leA;
        B = B - leB;
        int onlyB = B - A * K;
        for(int i = C; i <= D; i++)
        {
            if(i <= pos)
            {
                if(i % (K + 1) == 0)
                    cout << 'B';
                else
                    cout << 'A';
            }
            else
                if(i <= pos + onlyB)
                    cout << 'B';
                else
                {
                    if((i - pos - onlyB) % (K + 1) == 1)
                        cout << 'A';
                    else
                        cout << 'B';
                }
        }
        cout << "\n";
    }
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
//#pragma GCC optimize ("02")
#define ll long long
#define oo 1000000007
using namespace std;

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

	int a, b, ans = 0;
	cin >> a >> b;
	for(int i=1; i<a; i++){
		ans += i;
	}
	for(int i=1; i<b; i++){
		ans += i;
	}

	cout << ans;

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

template <class T> inline bool chmin(T& a, T b){if(a>b){a=b; return true;} return false;}
template <class T> inline bool chmax(T& a, T b){if(a<b){a=b; return true;} return false;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    int a , b;
    cin >> a >> b;
    cout << a * b << endl;
}

Measured memory_bytes: 3620
package main
 
import (
	"fmt"
)
 
func main() {
	var n int
	fmt.Scanf("%d", &n)

	A := make([]int, n)
    // 数列の長さの分だけScanfを繰り返す
    for i := 0; i < n; i++ {
        fmt.Scanf("%d", &A[i])
	}
		
	var height int = A[0]
	var humidai int
	var min_humidai int 

	for i := 1; i < n; i++ {

		if height > A[i]{
			humidai = height - A[i]
			min_humidai = min_humidai + humidai
			height = height
		} else {
			height = A[i]
		}
	}

	fmt.Printf("%d\n", min_humidai)
}

Measured memory_bytes: 6484
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;
//stoi(s) : string→int stoll(s) :string→longlong  int→string to_string(i)
const double PI = acos(-1.0);
//小数点の表し方 cout << fixed << setprecision(5);

int main(){
    int a,b;
    cin >> a >> b;
    cout << a *  b << endl;

}

Measured memory_bytes: 3636
#include<stdio.h>
 
int main(void){
        int i,n,x;
        scanf("%d",&n);
        for(i=1; i<=n; i++){
                x = i;
                if(x % 3 == 0)
                        printf(" %d",i);
                else{
                        do{
                                if(x % 10 == 3){
                                        printf(" %d",i);
                                        break;
                                }
                                x /= 10;
                        }while(x);
                }
        }
        printf("\n");
        return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>

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

    std::vector<int> ans(n);
    for (int i = 1; i <= n; ++i) {
        int a;
        std::cin >> a;
        --a;
        ans[a] = i;
    }

    for (auto x : ans) {
        std::cout << x << ' ';
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 1152