akhauriyash/Code-Regression huggingface dataset:
from itertools import accumulate


def main():
    n = int(input())
    a = [list(accumulate(map(int, input().split()))) for _ in range(2)]
    answer = a[0][0] + a[1][0]
    if n > 1:
        answer = max(a[0][0] + a[1][-1], a[0][-1] + a[1][-1] - a[1][-2])
        for i in range(1, n):
            answer = max(answer, a[0][i] + a[1][-1] - a[1][i - 1])
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#define M_PI       3.14159265358979323846

int main(void)
{
	double r, s, l;
	scanf("%lf", &r);
	
	s = pow(r,2.0)*M_PI;
	l = 2 * r * M_PI;
	
	printf("%lf %lf", s, l);

	return 0;
}

Measured memory_bytes: 648
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <limits>
#include <numeric>
#include <iterator>

using namespace std;

//mergesort
int merge_sort(const vector<int>::iterator beg, const vector<int>::iterator end){
  if(beg+1 >= end) return 0;

  //divide
  const auto mid = beg+(end-beg)/2;
  int comp_count =
    merge_sort(beg, mid) +
    merge_sort(mid, end);
  
  //conquer
  vector<int> buff(end - beg);
  auto h1 = beg, h2 = mid;
  for(int& s : buff){
    if(h1 == mid){
      s = *(h2++);
      ++comp_count;
      //++h2;
    }
    else if(h2 == end){
      s = *(h1++);
      ++comp_count;
      //++h1;
    }
    else{
      s = (*h1 <= *h2 ? *(h1++) : *(h2++));
      //s = *h1; h1++;
      ++comp_count;
    }
  }
  auto itr = beg;
  for(auto s : buff){
    //*(itr++) = s;
    *itr = s;
    ++itr;
  }

  return comp_count;
}


int main(){
  ios::sync_with_stdio(false);
  
  int n;
  vector<int> a;
  cin >> n;
  for(int i = 0; i<n; ++i){int a_i; cin >> a_i; a.push_back(a_i);}
  
  //calc
  int comp_count = merge_sort(a.begin(), a.end());
  
  for(unsigned int i=0; i<a.size(); ++i){
    cout << (i==0?"":" ") << a[i];
  }
  cout << endl;
  cout << comp_count << endl;
  return 0;
}

Measured memory_bytes: 6016
#include <string>
#include <iostream>
using namespace std;
int main() {
	string S;
	cin >> S;
	string cur;
	for (char c : S) {
		if (c != 'B') cur += c;
		else if (!cur.empty()) cur.pop_back();
	}
	cout << cur << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
typedef long long int ll;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T>
bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false;}
template<typename T>
bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false;}
// clang-format on

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n + 1, 1LL << 60);
    REP(i, 0, n) {
        cin >> a[i];
    }
    int ans = 0, len = 0;
    REP(i, 0, n) {
        if (a[i] >= a[i + 1]) {
            len++;
        } else {
            len = 0;
        }
        chmax(ans, len);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1000000007;



int main()
{

    int N;
    ll D,A;
    cin >> N >> D >> A;
    
    ve<pair<ll,ll>> M(N);
    rep(i,N){
        cin >> M[i].fi >> M[i].se;
    }
    sort(all(M));
    ve<pair<ll,ll>> Mo;
    Mo.push_back(M[0]);
    reps(i,1,N){
        if(Mo.back().fi == M[i].fi) Mo.back().se = max(Mo.back().se,M[i].se);
        else Mo.push_back(M[i]);
    }
    N = int(Mo.size());
    
    ll ans = 0;
    ll s = 0,t = 0;
    ll bom = 0;
    
    int mons = 0;
    
    ll del = 0;
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> pq;
    
    while (mons < N) {
        
        
        s = Mo[mons].fi;
        
        while (!pq.empty()) {
            pair<ll,ll> c = pq.top();
            if(c.fi < s){
                pq.pop();
                del-=c.se;
            }else{
                break;
            }
        }
        Mo[mons].se = (Mo[mons].se-del-0 >= 0 ? Mo[mons].se-del : 0);
        t = s + 2*D;
        ll a = (Mo[mons].se+A-1)/A;
        if(a == 0){
            mons++;
            continue;
            
        }
        bom = a*A;
        ans += a;
        del += bom;
        pq.push({t,bom});
        
        
        mons++;
        
    }
    out(ans);


    return 0;
}


Measured memory_bytes: 10092
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000007
using Graph = vector<vector<int>>;
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
  long long as[200010];

int main (){
  int N;
  cin>>N;
  vector<int>A(4,0);
  rep(i,N){
    string S;
    cin>>S;
    if(S=="AC") A[0]++;
    if(S=="WA")A[1]++;
    if(S=="TLE")A[2]++;
    if(S=="RE")A[3]++;
  }
  cout<<"AC x "<<A[0]<<endl;
  cout<<"WA x "<<A[1]<<endl;
  cout<<"TLE x "<<A[2]<<endl;
  cout<<"RE x "<<A[3];
}


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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

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

const int mod = 1e9 + 7;


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

	ll n;
	cin >> n;

	ll ans = n;
	for(ll i = 1; i <= sqrt(n); i++){
		if(n % i == 0){
			ans = min(ans, n / i);
		}
	}

	ans = ans + (n / ans);
	if(ans != n - 1){
		ans -= 2;
	}
	cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"
#include "stack"
#include "queue"

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<vector<int> > mat;

int main()
{
  double t, x;
  cin >> t >> x;
  cout << t / x << "\n";
}

Measured memory_bytes: 256
#include <utility>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#define REP(i, n) for (long long int i = 0; i < (n); i++)
#define YES(b) std::cout<< (b ? "Yes" : "No")
#define YESB(b) std::cout<< (b ? "YES" : "NO")
#define fr first
#define se second
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long int x, y;
	cin >> x >> y;
	if (abs(x - y) <= 1) {
		cout << "Brown";
		return 0;
	}
	cout << "Alice";
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	long long a, b, c, k;

	cin >> a >> b >> c >> k;

	if (a >= k) cout << k;

	if (a < k && a + b >= k) cout << a;

	if (a + b < k) {
		long long res = a - (k-a-b);
		cout << res;
		}

	return 0;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int N, M; cin >> N >> M;
    vector<int> ac(N+1, 0), wa(N+1, 0);
    int wacnt = 0;

    rep(i, M) {
        int p; cin >> p;
        string s; cin >> s;
        if (s=="AC" && ac[p]==0) {
            ac[p] = 1;
            wacnt += wa[p];
        } else if (s=="WA" && ac[p]==0) {
            wa[p]++;
        }
    }

    int accnt = 0;
    repr(i, 1, N+1) if (ac[i]) accnt++;
    cout << accnt << " " << wacnt << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;

    int N;
    io.read(N);
    cout << N * (N + 1) / 2;
    return 0;
}

Measured memory_bytes: 256
s = gets.chomp
len = s.length
wi = -1
cnt = 0
len.times do |i|
  if s[len-1-i] == "B" && wi != -1
    cnt += wi - (len-1-i)
    wi -= 1
  elsif s[len-1-i] == "W" && wi == -1
    wi = len-1-i
  end
end
puts cnt

Measured memory_bytes: 14568
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int ans = 1;
    while(ans <= n){
        ans *= 2;
    }
    cout << ans/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int n; cin >> n;
		vector<int> p(n), q(n);
		vector<int> r(n);
		rep (i, n) {
			cin >> p[i];
		}
		rep (i, n) {
			cin >> q[i];
		}
		repn (i, n) {
			r[i - 1] = i;
		}
		sort(all(r));
		bool p_flg, q_flg;
		p_flg = false;
		q_flg = false;
		int ans = 0;
		auto counter = [&](vector<int> t, vector<int> s) {
			int cnt = 0;
			rep (i, n) {
				if (t[i] == s[i]) cnt++;
			}
			return cnt;
		};
		int p_cnt;
		int q_cnt;
		int loop = 1;
		int ans_p = 0;
		int ans_q = 0;
		do {
			p_cnt = 0; q_cnt = 0;
			if (!p_flg) {
				p_cnt = counter(r, p);
				if (p_cnt == n) {
					ans_p = loop;
					p_flg = true;
				}
			}
			if (!q_flg) {
				q_cnt = counter(r, q);
				if (q_cnt == n) {
					ans_q = loop;
					q_flg = true;
				}
			}
			loop++;
		} while (next_permutation(all(r)));
		cout << abs(ans_p - ans_q) << endl;
    return;
}

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



Measured memory_bytes: 256
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

d, g = map(int, readline().split())
pc = []
for _ in range(d):
    pc.append(readline().split())

def main(d, g, pc):
    min_cnt = 1000000000
    for i in range(2**d):
        wa = 0
        cnt = 0
        nokori = [i for i in range(d)]
        for j in range(d):
            if i & 2**j:
                wa += int(pc[j][1]) + 100 * int(pc[j][0]) * (j+1)
                cnt += int(pc[j][0])
                nokori.remove(j)
        if wa < g:
            if int(pc[nokori[-1]][0]) * 100 *(nokori[-1]+1) > int(g) - wa:
              if (g-wa) % (100 *(nokori[-1]+1)) != 0:
                  ato = 1 + (g-wa) // (100 *(nokori[-1]+1))
              else:
                  ato = (g-wa) // (100 *(nokori[-1]+1))
              cnt += ato
              wa += ato * 100 * (nokori[-1]+1)
        if g <= wa:
	        min_cnt = min(cnt, min_cnt)
    return min_cnt


print(main(d, g, pc))


Measured memory_bytes: 9280
import java.util.Scanner;

class UnionFindTree {
	int[] par;
	int[] rank;
	int[] peers; //仲間の数
	int[] dis; //根からの距離

	public UnionFindTree(int n){
		par = new int[n];
		rank = new int[n];
		peers = new int[n];

		for(int i=0;i<n;i++){
			par[i] = i;
			peers[i] = 1;
		}
	}

	//木の根を求める
	int find(int x){
		if(par[x] == x){
			return x;
		}
		else{
			return par[x] = find(par[x]);
		}
	}

	//xとyの属する集合を併合
	void unite(int x, int y){
		int px = find(x);
		int py = find(y);

		if(px == py){
			return;
		}
		else if(rank[px] < rank[py]){
			peers[py] += peers[px];
			par[px] = py;

		}
		else{
			peers[px] += peers[py];
			par[py] = px;
			if(rank[px]==rank[py]){
				rank[px]++;
			}
		}

	}


	//xとyが同じ集合に属するか
	boolean isEquivalent(int x, int y){
		return find(x) == find(y);
	}

	//xの仲間の数を求める
	int peersnum(int x){
		return peers[find(x)];
	}
}

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int M = sc.nextInt();

		UnionFindTree uf = new UnionFindTree(N);

		for(int i = 0 ; i < M ; i++){
			int X = sc.nextInt()-1;
			int Y = sc.nextInt()-1;
			int Z = sc.nextInt();

			uf.unite(X,Y);
		}
		int count = 0;
		for(int i = 0 ; i < N ; i++){
			if(uf.find(i) == i){
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}

}

Measured memory_bytes: 92260
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

type r struct {
	b, c int
}
type rs []r

func (r rs) Len() int {
	return len(r)
}
func (r rs) Swap(i, j int) {
	r[i], r[j] = r[j], r[i]
}
func (r rs) Less(i, j int) bool {
	return r[i].c < r[j].c
}

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := range a {
		a[i] = nextInt(sc)
	}
	recs := make([]r, m)
	for i := 0; i < m; i++ {
		recs[i].b = nextInt(sc)
		recs[i].c = nextInt(sc)
	}
	sort.Ints(a)
	sort.Sort(sort.Reverse(rs(recs)))
	//fmt.Println("n", n, "m", m, "a", a, "recs", recs)
	ans, j := 0, 0
	for i := 0; i < n; i++ {
		if j < m && a[i] < recs[j].c {
			if recs[j].b > 0 {
				a[i] = recs[j].c
				recs[j].b--
				if recs[j].b == 0 {
					j++
				}
			}
		}
		ans += a[i]
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
int n,m,s=0,x;
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){cin>>x;s+=min(x,m-x)*2;}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
def solve(C, D, lim):
    ans = 0
    for i in range(3000):
        if C*i > lim:
            break
        for j in range(3000):
            eval = C*i + D*j
            if eval > lim:
                break
            elif eval > ans:
                ans = eval
    return ans

A, B, C, D, E, F = map(int,input().split())
# E(A+B) >= C+D, 100A+100B+C+D <= Fを満たす中での(C+D)/(100A+100B+C+D)の最大化
water = [] #ありうる(A, B)の組
waterlen = 0
ans = [0, 0]
noudo = 0
for i in range(30):
    for j in range(30):
        val = 100*A*i + 100*B*j
        if val <= F:
            water.append(val)
            waterlen += 1
        else:
            break
water.pop(0)
waterlen -= 1
for i in range(waterlen):
    sugarlim = min(water[i] // 100 * E, F-water[i])
    sugar = solve(C, D, sugarlim)
    
    val = 100*sugar/(water[i]+sugar)
    if val > noudo:
        noudo = val
        ans[0] = water[i] + sugar
        ans[1] = sugar
if ans[0] == 0 and ans[1] == 0:
    ans[0] = 100*A
print(*ans)


Measured memory_bytes: 40432
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b && a!=c){
        cout << "Yes" << endl;
    }else if(a==c && a!=b){
        cout << "Yes" << endl;
    }else if(b==c && b!=a){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(x) push_back(x)
#define f(i,st,n) for(i=st;i<n;i++)
#define qu queue
#define ps(x) push(x)
#define vec vector
#define ft() front()
#define mst(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define sfl(x) scanf("%lld",&x)
#define pfl(x) printf("%lld\n",x)
#define pf(x) printf("%lld",x)
#define mpr make_pair
#define fs first
#define se second
 
 
 
 
ll gcd(ll a,ll b){
    if(a==0){
        return b;
    }                     
    return gcd(b%a,a);
}
ll power(ll x,ll y){            
    ll res=1;
    while(y>0){
        if(y%2==1){
            res=(res*x);
        }
        x=(x*x);
        y=y/2;
    }
    return res;
}
 
 
int main(){
 
 /*#ifndef ONLINE_JUDGE
    
   freopen("input.txt", "r", stdin);
   
   freopen("output.txt", "w", stdout);
   #endif*/
   
ll n,i,w,j,x,y;
sfl(n);sfl(w);



vec<ll>dp(w+1,0),dp1(w+1,0);

dp[0]=0;
f(i,0,n){
  sfl(x);sfl(y);
  f(j,1,w+1){
    if(x<=j)
  dp1[j]=max(dp[j],dp[j-x]+y);

}
dp=dp1;


}

cout<<dp[w];

 
   return 0;
 }

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

typedef long long ll;

ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b,a % b);
}

int main() {
  ll a,b;
  cin >> a >> b;

  cout << a * b / gcd(a,b) << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        char[] s = in.ns().toCharArray();
        char[] t = in.ns().toCharArray();
        PriorityQueue<String> ans = new PriorityQueue<>();
        out:for (int i = 0; i < s.length - t.length + 1; i++) {
            for (int j = 0; j < t.length; j++) {
                if(s[i+j]!=t[j]&&s[i+j]!='?') continue out;
            }
            char[] S = new char[s.length];
            for (int j = 0; j < i; j++) {
                if(s[j]=='?') S[j] = 'a';
                else S[j] = s[j];
            }
            for (int j = 0; j < t.length; j++) {
                S[j+i] = t[j];
            }
            for (int j = i+t.length; j < s.length ; j++) {
                if(s[j]=='?') S[j] = 'a';
                else S[j] = s[j];
            }
            ans.add(new String(S));
        }
        out.println(ans.isEmpty()?"UNRESTORABLE":ans.poll());
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long int
#define oo 1000000000000000000
#define forr(i,n) for(ll i=0;i<n;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(0) ; cout.tie(0);
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define pb push_back
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
 
using namespace __gnu_pbds; 
using namespace std;

const ll MOD = 1e9 + 7;

ll valueOfIndex(ordered_set&s , ll i){ return *(s.find_by_order(i)); }
ll indexOfValue(ordered_set&s , ll x){ return s.order_of_key(x); }

ll add(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a+b + p)%p;}
ll mul(ll a, ll b,ll p=MOD) { a%=p; b%=p; return (a*b + p)%p;} // __int128

ll power(ll x,ll n,ll p=MOD){ if(x==0) return 0; if(n==0 || x==1) return 1LL;
    ll r = (power(x,n/2,p))%p; if(n&1) return mul(mul(r,r,p) , x,p); else return mul(r,r,p);
}

ll dp[3000];

ll get(ll n){
    if(n==0) return 1;
  //  else if(n<3) return 0;
    ll ans = 0;
    if(dp[n]!=-1) return dp[n];
    for(ll i=3;i<=n;i++) {
        ans = (ans + get(n-i))%MOD;
    }
    return dp[n] = ans;
}

void __sol(){
    
    ll s; cin >> s;
    memset(dp,-1,sizeof(dp));
    cout << get(s);
    return;
}


int main(){
    fastio
    ll tc=1;// cin >> tc;
    while(tc--) __sol();
    return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  int count = 0;
  int K,A;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    string s;
    cin >> s;

    bool ok = false;
    rep(i, s.length()) {
        if (s[i] == '9') ok = true;
    }

    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    for(ll h=1;h<=3500;h++){
        for(ll n=1;n<=3500;n++){
            ll nume = N*h*n;
            ll deno = 4*h*n - N*n - N*h;
            if(deno>0 && nume%deno==0){
                ll w = nume/deno;
                cout<<h<<" "<<n<<" "<<w<<endl;
                return 0;
            }
        }
    }
}

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

const int N=1e5+5;
string s;
int n;
string a[4]={"dream", "dreamer", "erase", "eraser"};
bool vis[N],dp[N];
bool solve( int i ) {
    if ( i==n ) return 1;
    if ( vis[i] ) return dp[i];
    vis[i]=1;
    for ( int j=0; j<4; j++ ) {
        string t=a[j];
        int x=0;
        while ( x<t.size()&&i+x<n&&s[i+x]==t[x] ) {
            x++;
        }
        if ( x==t.size()&&solve(i+x) ) {
            return dp[i]=true;
        }
    }
    return dp[i]=false;
}

int main() {
    cin >> s;
    n=s.size();
    if ( solve(0) ) {
        cout << "YES";
    } else {
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 6608
#include<cstdio>
#include<vector>

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

using namespace std;

struct mobile{ double w,l,r; };

double W;

vector<mobile> dfs(const vector<int> a){
	int n=a.size();
	if(n==1) return vector<mobile>(1,(mobile){a[0],0,0});

	vector<mobile> res;
	rep(S,1<<n) if(0<S && S<(1<<n)-1) {
		vector<int> al,ar;
		double wl=0,wr=0;
		rep(i,n){
			if(S&1<<i) al.push_back(a[i]), wl+=a[i];
			else       ar.push_back(a[i]), wr+=a[i];
		}

		vector<mobile> L=dfs(al),R=dfs(ar);
		rep(i,L.size()) rep(j,R.size()) {
			double l2=min(-wr/(wl+wr)+L[i].l,wl/(wl+wr)+R[j].l);
			double r2=max(-wr/(wl+wr)+L[i].r,wl/(wl+wr)+R[j].r);
			if(r2-l2<W){
				res.push_back((mobile){wl+wr,l2,r2});
			}
		}
	}
	return res;
}

int main(){
	int T; scanf("%d",&T);
	while(T--){
		int n; scanf("%lf%d",&W,&n);
		vector<int> a(n);
		rep(i,n) scanf("%d",&a[i]);

		vector<mobile> res=dfs(a);

		double ans=-1;
		rep(i,res.size()) if(res[i].r-res[i].l<W) ans=max(ans,res[i].r-res[i].l);
		printf("%.9f\n",ans);
	}

	return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define ll long long
  #define int long long 
  #define double long double
  #define max(a,b) (a>b?a:b)
  #define min(a,b) (a<b?a:b)
  #define mkp make_pair
  #define pb push_back
  #define inf INT_MAX

  int32_t main()
  { 
     
    
    IOS
    int n,k;
    cin>>n>>k;
    //max-min of k-th size window in the sorted array!

    std::vector<int> v (n,0);
    for(int i=0;i<n;i++)
      cin>>v[i];
    sort(v.begin(),v.end());
    int ans=v[k-1]-v[0];

    for(int i=k;i<n;i++)
    {
      int diff=v[i]-v[i-k+1];
      ans=min(ans,diff);
      
    }
    
    cout<<ans;
    return 0;
   
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w;
	cin>>h>>w;
	string a;	
	for(int i=0;i<h;i++)
	{
		cin>>a;
		cout<<a;
		cout<<endl; 
		cout<<a;
		cout<<endl;
	}
 	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
// const ll MOD = 1e9 + 7;

int H, W;
bool S[21][21];
bool visit[21][21];

struct pos {
  int h, w, d;
};

int solve(int h, int w) {
  fill(visit[0], visit[21], false);
  queue<pos> q;
  q.push(pos{h, w, 0});
  int m = 0;
  while (!q.empty()) {
    pos p = q.front();
    q.pop();
    visit[p.h][p.w] = true;
    m = max(m, p.d);
    if (p.w > 0 && S[p.h][p.w - 1] && !visit[p.h][p.w - 1]) {
      q.push(pos{p.h, p.w - 1, p.d + 1});
    }
    if (p.w < W - 1 && S[p.h][p.w + 1] && !visit[p.h][p.w + 1]) {
      q.push(pos{p.h, p.w + 1, p.d + 1});
    }
    if (p.h > 0 && S[p.h - 1][p.w] && !visit[p.h - 1][p.w]) {
      q.push(pos{p.h - 1, p.w, p.d + 1});
    }
    if (p.h < H - 1 && S[p.h + 1][p.w] && !visit[p.h + 1][p.w]) {
      q.push(pos{p.h + 1, p.w, p.d + 1});
    }
  }

  return m;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> H >> W;
  int cnt = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      char c;
      cin >> c;
      if (c == '.') {
        S[i][j] = true;
        cnt++;
      }
    }
  }

  if (cnt == 400) {
    cout << 38 << endl;
    return 0;
  }

  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j]) {
        ans = max(ans, solve(i, j));
      }
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define s second
#define f first
#define pb push_back
#define endl '\n'
using namespace std;


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

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;

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

	int T, s;
	cin >> T >> s;

	vector<string> S(T);

	for(int qq = 0; qq < T; qq++){
		cin >> S[qq];
	}

	sort(S.begin(), S.end());
	for(int i = 0; i < T; i++) cout << S[i];

	cout << endl;
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int sum[100010];
pair<int, int> p[100010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W, D;
    cin >> H >> W >> D;
    int A[310][310];
    rep(i, H) {
        rep(j, W)  {
            cin >> A[i][j];
            p[A[i][j]] = {i, j};
        }
    }
    rep(i, D) {
        for(int j = i + 1; j <= H * W - D; j += D) {
            int x1 = p[j + D].first;
            int y1 = p[j + D].second;
            int x2 = p[j].first;
            int y2 = p[j].second;
            int add = abs(x1 - x2) + abs(y1 - y2);
            sum[j + D] = sum[j] + add;
        }
    }
    //rep(i, H * W + 1) cout << i << " " << sum[i] << endl;
    int Q; cin >> Q;
    while(Q--) {
        int L, R;
        cin >> L >> R;
        cout << sum[R] - sum[L] << endl;
    }
    


    return 0;
}


Measured memory_bytes: 2560
#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()
typedef long long ll;
static const int INF (1<<30);

int main() {
  int n; cin >> n;
  cout << n*n*n << endl;

  return 0;
}


Measured memory_bytes: 256
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    b = [0] * n
    ans = []
    for i in range(n-1, -1, -1):
        cnt = 0
        for j in range(i, n, i + 1):
            cnt += b[j]
        if cnt % 2 != a[i]:
            b[i] += 1
            ans.append(i + 1)
    print(len(ans))
    if len(ans) != 0:
        print(*ans)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 65884
#include <iostream>
#include <algorithm>
#include <set>
 
#define INF 2000000000
 
using namespace std;
 
pair<long long, long long> ll[200000];
int n;
long long arr[300000];
bool used[300001];
multiset<long long> st;
 
int main() {
	for (int x = 0; x < 1; x++) {
		cin >> n;
		for (int i = 0; i < 3 * n; i++)
			used[i] = false;
		st.clear();
		for (int i = 0; i < n * 3; i++) {
			cin >> arr[i];
			if (i < 2 * n)
				ll[i] = make_pair(arr[i], 3 * n - i);
		}
		sort(ll, ll + 2 * n);
		reverse(ll, ll + 2 * n);
		long long leftSum = 0;
		long long rightSum = 0;
		for (int i = 0; i < n; i++) {
			leftSum += ll[i].first;
			used[3 * n - ll[i].second] = true;
			rightSum += arr[3 * n - i - 1];
			st.insert(arr[3 * n - i - 1]);
		}
		long long ans = leftSum - rightSum;
		int leftIndex = n - 1;
		for (int i = 2 * n - 1; i >= n; i--) {
			if (arr[i] < *st.rbegin()) {
				rightSum += arr[i] - *st.rbegin();
				st.erase(st.find(*st.rbegin()));
				st.insert(arr[i]);
			}
			if (used[i]) {
				leftIndex++;
				while (3 * n - ll[leftIndex].second >= i) {
					leftIndex++;
				}
				used[3 * n - ll[leftIndex].second] = true;
				leftSum += ll[leftIndex].first - arr[i];
			}
			ans = max(ans, leftSum - rightSum);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 10752
#include<iostream>
#include<queue>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
using namespace std;
/****************************/
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define qi queue<int>
#define mii map<int,int>
#define msi map<string,int>
#define vs vector<string>
#define vc vector<char>
/****************************/
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define rep3(i,a,n) for(ll i=(a);i<(n);i++)
#define rep4(i,a,n) for(ll i=(n)-1;i>=a;i--)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define pi 3.1415926535897932384626433832795
#define zero(n) memset(n,0,sizeof(n));
#define SZ(n) n.size()
#define mod 1000000007
#define INF 1000000000000000000
/****************************/
string s[20];
int n,m,cnt=0,x;  
int dp[20][1010];
int main()
{
  	cin>>n>>m>>x;
  	rep(i,n)
  	{
  		cin>>s[i];
  	}
  	zero(dp);
  	rep3(i,1,n+1)
  	{
  	    rep3(j,1,m+1)
  	    {
  	  		dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1]+(s[i-1][j-1]=='1');
  	    }
  	}
    vi v;
    int ans=1e9;
    rep(i,1<<(n-1))
    {
  	    int now=0;
        v.clear();
  	    rep(j,n-1)
  		{
  	 	    if(i&(1<<j))	
  	       	{
  	  	        now++;
  	  	        v.pb(j);
  	  	    }
	    }
		v.pb(n-1);
		bool flag=0;
		rep(j,m)
		{
			int last=-1;
			rep(k,v.size())
			{
				if((dp[v[k]+1][j+1]-dp[last+1][j+1]-dp[v[k]+1][j]+dp[last+1][j])>x)
				{				
					flag=1;
				}
				last=v[k];
			}
		}
		if(flag) continue;
		int l=-1,r=-1;
		rep(j,m+1)
		{
			l=-1;
			rep(k,v.size())
			{
				if((dp[v[k]+1][j+1]-dp[l+1][j+1])-(dp[v[k]+1][r+1]-dp[l+1][r+1])>x)
				{
					r=j-1;
					now++;
					break;
				}
				l=v[k];
			}
		}
		ans=min(ans,now);
	}
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main() {
	int n;
	scanf("%d\n",&n);
	
	int t, a, b;
	
	bool ans = true;
	
	for (int i = 0; i < n; i++) {
	    scanf("%d %d %d\n", &t, &a, &b);
	    if( (t < (a + b)) or ( (t % 2) != ((a + b) % 2) )) ans = false;
	}
	
	if(ans) std::cout << "Yes" << std::endl;
	else std::cout << "No" << std::endl;
	
	return 0;
}

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

int main(){
    int d;
    cin >> d;
    
    if (d == 25){
        cout << "Christmas" << endl;
    }else {
        if (d == 24){
            cout << "Christmas Eve" << endl;
        }else {
            if (d == 23){
                cout << "Christmas Eve Eve" << endl;
            }else {
                cout << "Christmas Eve Eve Eve" << endl;
            }
        }
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var A, B, K int
	fmt.Scan(&A)
	fmt.Scan(&B)
	fmt.Scan(&K)

	c := make(map[int]struct{})
	for i := A; i < A + K; i++ {
		if i > B {
			break
		}
		c[i] = struct{}{}
	}
	for i := B - K + 1; i <= B; i++ {
		if i < A {
			continue
		}
		c[i] = struct{}{}
	}

	as := keys(c)
	sort.Ints(as)
	for _, key := range as {
		fmt.Println(key)
	}
}

func keys(m map[int]struct{}) []int {
	var ks []int

	for k := range m {
		ks = append(ks, k)
	}
	return ks
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();

        int i = 1;
        while(true) {
            //CHECK_NUM:
            int x = i;
            int  END_CHECK_NUM=0;
            if (x % 3 == 0) {
                System.out.print(" " + i);
                //goto END_CHECK_NUM;
                END_CHECK_NUM=1;
            }
            while(END_CHECK_NUM==0) {
                //INCLUDE3:
                if (x % 10 == 3) {
                    System.out.print(" " + i);
                    break;
                }
                x /= 10;
                if (x==0)break;
            }
            //END_CHECK_NUM:
            if (++i > n) break;
            //if (++i <= n) goto CHECK_NUM;
        }
        System.out.println();
    }
}



Measured memory_bytes: 28880
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int a, b;
    cin >> a >> b;
    if(a == b)
        cout << "Draw" << endl;
    else if((a > b && a != 13) || a == 1)
        cout << "Alice" << endl;
    else
        cout << "Bob" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define FORMIN(N) ((N > 0) ? N : 0)
#define FORMAX(N) ((N > 9) ? 9 : N)

int main(void)
{
	int n, cnt;
	while(cnt = 0, cin >> n) {
		if(n > 36) {
			cout << 0 << endl;
			continue;
		}
	
		for(int a = FORMIN(n - 27); a <= FORMAX(n); a++) {
			for(int b = FORMIN((n - a) - 18); b <= FORMAX(n - a); b++) {
				for(int c = FORMIN((n - a - b) - 9); c <= FORMAX(n - a - b); c++) {
					cnt++;
				}
			}
		}

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

Measured memory_bytes: 1164
n = int(input())
ac = tle = wa = re = 0
for i in range(n):
    s = input()
    if s=='AC':
        ac += 1
    elif s=='WA':
        wa += 1
    elif s=='TLE':
        tle += 1
    else:
        re += 1

print('AC x '+ str(ac))
print('WA x '+ str(wa))
print('TLE x '+ str(tle))
print('RE x '+str(re))

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,ct0=0,ct1=0;
  string data;
  cin >> data;
  for(i=0;i<data.size();i++){
    if(data.at(i)=='0'){
      ct0++;
    }else{
      ct1++;
    }
  }

cout<<min(ct0,ct1)*2<<endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int N;
    string S;
    cin >> N >> S;
    set<string> T, U, V;
    for (int i = 0; i < N; i++) {
        if (U.size() != 0) {
            for (auto x : U) {
                V.insert(x + S.at(i));
            }
        }
        if (T.size() != 0) {
            for (auto x : T) {
                U.insert(x + S.at(i));
            }
        }
        string a = to_string(S.at(i));
        T.insert(a);
    }
    cout << V.size() << endl;
    
}


Measured memory_bytes: 384
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String regex = "s\\Z";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(s);

        if(m.find()){
            System.out.println(s + "es");
        }
        else{
            System.out.println(s + "s");
        }
    }

}


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

int main() {
    int count=0;
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    for (int i=0; i<=A; i++){
        for (int j=0; j<=B; j++){
            for (int k=0; k<=C; k++){
                if (500*i+100*j+50*k==X){
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N], color[N], d[N], f[N], tt;

void dfs();
void dfs_visit(int);
void dfs_print();


int main(){
  int u, v, k, i, j;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++) M[i][j] = 0;
  }

  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    u--;
    for(j=0;j<k;j++){
      scanf("%d",&v);
      v--;
      M[u][v] = 1;
    }
  }

  dfs();
  dfs_print();

  return 0;
}


void dfs(){
  int u;
  for(u=0;u<n;u++) color[N] = WHITE;
  tt = 0;

  for(u=0;u<n;u++){
    if(color[u]==WHITE) dfs_visit(u);
  }
}

void dfs_visit(int u){
  int v;
  color[u] = GRAY;
  d[u] = ++tt;

  for(v=0;v<n;v++){
    if(M[u][v]==0) continue;
    if(color[v]==WHITE) dfs_visit(v);
  }
  color[u] = BLACK;
  f[u] = ++tt;
}


void dfs_print(){
  int u;
  for(u=0;u<n;u++) printf("%d %d %d\n",u+1, d[u], f[u]);
}



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

int f(int n) {
  int sum=0;
  while (n>0) {
    sum += n%10;
    n /= 10;
  }
  return sum;
}

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

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

int main(){
    int n;
    cin >> n;
    int B[n];
    for(int i = 0; i < n; i++){
        cin >> B[i];
    }
    int sum = 0;
    int A[n];
    for(int i = 0; i < n; i++){
        if(i == 0){
            A[i] = B[0];
        }else if(i == n-1){
            A[i] = B[n-2];
        }else{
            A[i] = min(B[i], B[i-1]);
        }
    }
    for(int i = 0; i < n; i++){
        sum += A[i];
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
n_x = input()
n_x_list =n_x.split(' ')

N = int(n_x_list[0])
X = int(n_x_list[1])

# g_list = [''] * N
# def G(N):
#     if N == 0:
#         return 'p'
#
#     gn_1 = G(N-1)
#
#     return 'b' + gn_1 + 'p' + gn_1 + 'b'

# g_n = G(N)
# print(g_n)
# eaten_burger = g_n[0:X]
# print(eaten_burger)
# ans = eaten_burger.count('p')
# print(ans)

def L(N):
    return 2 ** (N+2) - 3

def P(N):
    return 2 ** (N+1) - 1

def solve(N, X):
    half_l = int(L(N) / 2)
    if N == 0 and X >= 1:
        return 1
    elif N == 0 and X == 0:
        return 0

    if half_l <= 1:
        return 0
    elif X < half_l:
        return solve(N - 1, X - 1)
    elif X == half_l:
        return P(N-1)
    elif X == half_l + 1:
        return P(N-1) + 1
    elif half_l + 1 < X:
        return P(N-1) + 1 + solve(N-1, (X - L(N-1) - 2))
    elif half_l * 2 + 3 == X:
        return 2 * P(N-1) + 1


ans = solve(N, X)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
    int d[10001];
    vector<int> G[500000],w[500000];
void DUK(int n){
    queue<int> q;
    int color[100000];
    for(int i=0;i<n;i++){
        d[i]=100000000;
        color[i]=0;
    }
    d[0]=0;
    q.push(0);
    color[0]=1;
    while(q.size()!=0){
        int u=q.front();
        q.pop();
        color[u]=0;
        for(int i=0;i<G[u].size();i++){
            int v=G[u][i];
            if(d[v]>d[u]+w[u][i]){
                d[v]=d[u]+w[u][i];
                if(color[v]==0){
                    q.push(v);
                    //color[v]=1;
                }
            }
        }
    }
}
int main(){
    int n,v,k,c,u;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>u>>k;
        for(int j=0;j<k;j++){
            cin>>v>>c;
            G[u].push_back(v);
            w[u].push_back(c);
        }
    }
    DUK(n);
    for(int i=0;i<n;i++){
        cout<<i<<" "<<d[i]<<endl;
    }
    return 0;
}




Measured memory_bytes: 31272
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, m, cnt = 0, sum = 0;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (4 * m * a[i] >= sum)
        {
            cnt++;
            if (cnt == m)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3564
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			//System.Diagnostics.Debug.WriteLine(s);
			//System.Diagnostics.Debug.WriteLine(string.Join("", s.Reverse()));
			int ans = 0;
			for (int i = 0; i < s.Length / 2; i++) {
				if (s[i] != s[s.Length - 1 - i]) {
					ans++;
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13140