akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
    return a * (b / gcd(a, b));
}

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

  ll l = 1;
  rep(i, n){
    ll t; cin >> t;
    l = lcm(l, t);
  }

  cout << l << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.function.Function;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());

      Function<String,double[]> lineSpliteThenArray =
        s -> Stream.of(s.split(" "))
          .mapToDouble(Double::parseDouble)
          .toArray();

      double[][] vecter =
        br.lines()
          .limit(2)
          .map( lineSpliteThenArray )
          .toArray(double[][]::new);

      double p1 =
        IntStream.range(0, n)
          .mapToDouble(i -> Math.abs(vecter[0][i] - vecter[1][i]) )
          .sum();

      double p2 = Math.sqrt(
        IntStream.range(0, n)
          .mapToDouble(i -> Math.pow( vecter[0][i] - vecter[1][i], 2))
          .sum() );

      double p3 = Math.pow(
        IntStream.range(0, n)
        .mapToDouble(i -> Math.pow( Math.abs(vecter[0][i] - vecter[1][i]), 3d))
        .sum() , 1d/3d );

      double p00 =
        IntStream.range(0, n)
          .mapToDouble(i -> Math.abs(vecter[0][i] - vecter[1][i]))
          .max()
          .getAsDouble();

      System.out.printf("%.8f\n%.8f\n%.8f\n%.8f\n", p1,p2,p3,p00);
    }
  }

}


Measured memory_bytes: 31960
#include "bits/stdc++.h"
using namespace std;
const int mod = 1000000000 + 7;
const int maxn = 5e3 + 10;
int p[maxn];
int par[maxn], sub[maxn];
long long fac[maxn];
long long dp[maxn][maxn];
int cmp;
int root(int x) {
	if(x == par[x]) return x;
	return par[x] = root(par[x]);
}
void join(int x, int y) {
	x = root(x);
	y = root(y);
	if(x != y) {
		par[x] = y;
		sub[y] += sub[x];
		cmp--;
	}
}
long long modpow(int b, int e) {
	if(e == 0) return 1;
	if(e & 1) return (modpow(b, e - 1) * b) % mod;
	long long m = modpow(b, e >> 1);
	return (m * m) % mod;
}
int main() {
	int n;
	cin >> n;
	fac[0] = 1;
	for(int i = 1; i <= n; i++) {
		cin >> p[i];
		par[i] = i;
		sub[i] = 1;
		fac[i] = (fac[i - 1] * i) % mod; 
	}
	cmp = n;
	for(int i = 1; i <= n; i++) {
		if(p[i] != -1) join(i, p[i]);
	}
	vector <int> v;
	for(int i = 1; i <= n; i++) {
		if(p[i] == -1) {
			v.push_back(sub[root(i)]);
		}
	}
	dp[0][0] = 1;
	for(int i = 1; i <= v.size(); i++) {
		dp[i][0] = 1;
		for(int j = 1; j <= i; j++) {
			dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1] * v[i - 1];
			dp[i][j] %= mod;
		}
	}
	long long ans = (cmp - v.size()) * modpow(n - 1, v.size());
	for(int i = 2; i <= v.size(); i++) {
		long long ways = (dp[v.size()][i] * fac[i - 1]) % mod; 
		ans += ways * modpow(n - 1, v.size() - i);
		ans %= mod;
	}
	for(auto i : v) {
		ans += (i - 1) * modpow(n - 1, v.size() - 1);
		ans %= mod;
	}
	ans = n * modpow(n - 1, v.size()) - ans;
	ans %= mod;
	ans += mod;
	cout << ans % mod << endl;
 	return 0;
}

Measured memory_bytes: 120352
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 2e5 + 5;
int n, p[N], pos[N];
class SegTree {
private:
	int t[N << 2][2];
	void build(int l, int r, int x) {
		if (l == r) {
			t[x][0] = inf, t[x][1] = inf;
			t[x][l & 1] = p[l];
			return;
		}
		int m = (l + r) >> 1;
		build(l, m, x << 1), build(m + 1, r, x << 1 | 1);
		t[x][0] = min(t[x << 1][0], t[x << 1 | 1][0]);
		t[x][1] = min(t[x << 1][1], t[x << 1 | 1][1]);
	}
	int getMin(int l, int r, int s, int e, int x, int parity) {
		if (l > r || l > e || r < s) return inf;
		if (s <= l && r <= e) return t[x][parity];
		int m = (l + r) >> 1;
		return min(getMin(l, m, s, e, x << 1, parity), getMin(m + 1, r, s, e, x << 1 | 1, parity));
	}
public:
	int n;
	void init(int _n) { n = _n; build(0, n - 1, 1); }
	int getMin(int l, int r, int parity) { return getMin(0, n - 1, l, r, 1, parity); }
} st;
struct Segment {
	int l, r, mnValue;
	Segment(int l = -1, int r = -1, int mnValue = -1): l(l), r(r), mnValue(mnValue) {};
	bool operator<(const Segment &rhs) const { return mnValue < rhs.mnValue; }
};
set<Segment> s;
vector<int> ans;
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
//	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	fw (i, 0, n) {
		cin >> p[i];
		pos[p[i]] = i;
	}
	st.init(n);
	s.insert(Segment(0, n - 1, st.getMin(0, n - 2, 0)));
	while (!s.empty()) {
		Segment tmp = *s.begin(); s.erase(s.begin());
		int mnValue, mnPos;
//		cout << "tmp.l = " << tmp.l << " tmp.r = " << tmp.r << " mnValue = " << tmp.mnValue << "\n";
		mnValue = tmp.mnValue, mnPos = pos[mnValue];
		int nxtMn = st.getMin(mnPos + 1, tmp.r, tmp.r & 1), nxtMnPos = pos[nxtMn];
//		cout << "mnPos = " << mnPos << " nxtMnPos = " << nxtMnPos << "\n";
		ans.pb(mnValue), ans.pb(nxtMn);
		if (tmp.l < mnPos) s.insert(Segment(tmp.l, mnPos - 1, st.getMin(tmp.l, mnPos - 2, tmp.l & 1)));
		if (mnPos + 1 <= nxtMnPos - 1) 
			s.insert(Segment(mnPos + 1, nxtMnPos - 1, st.getMin(mnPos + 1, nxtMnPos - 2, (mnPos + 1) & 1)));
		if (nxtMnPos + 1 <= tmp.r) 
			s.insert(Segment(nxtMnPos + 1, tmp.r, st.getMin(nxtMnPos + 1, tmp.r - 1, (nxtMnPos + 1) & 1)));
	}
	fa (i, ans) cout << i << " ";
	return 0;
}

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

int A, B, C;

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

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<tuple>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
	string s, t;
	cin >> s >> t;
	bool ans = false;
	rep(i, s.size()) {
		if (s == t) {
			ans = true;
			break;
		}
		s = s.back() + s.substr(0, s.size() - 1);
	}
	if (ans) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
import sys

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


def main():
    A, B = map(int, readline().split())

    if A * B % 2 == 1:
        print('Yes')
    else:
        print('No')

    return


if __name__ == '__main__':
    main()


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

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

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	long long sum = 0;
	for(int i = 1; i <= n; i++) {
		int num = getSum(i);
		if(num >= a and num <= b) {
			sum += i;
		}
	}
	cout << sum;
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

const ll mod[] = { 999999937, 1000000007 }, base = 10000103;

struct RollingHash
{
	int n;
	vector<ll> hs[2], pw[2];
	RollingHash() {};
	RollingHash(const string& s)
	{
		n = s.size();
		REP(i, 2)
		{
			hs[i].assign(n + 1, 0);
			pw[i].assign(n + 1, 0);
			hs[i][0] = 0;
			pw[i][0] = 1;
			REP(j, n)
			{
				pw[i][j + 1] = pw[i][j] * base%mod[i];
				hs[i][j + 1] = (hs[i][j] * base + s[j]) % mod[i];
			}
		}
	}

	ll hash(int l, int r, int i)
	{
		return ((hs[i][r] - hs[i][l] * pw[i][r - l]) % mod[i] + mod[i]) % mod[i];
	}

	bool match(int l1, int r1, int l2, int r2)
	{
		return (hash(l1, r1, 0) == hash(l2, r2, 0)) && (hash(l1, r1, 1) == hash(l2, r2, 1));
	}
};


int n, m, k;
vs v;
vector<pii> vrh;
short dp[5001][1 << 12];	
string s;
RollingHash rh;

int is_match(int p, int i)
{
	if (pii(rh.hash(p, p + v[i].size(), 0), rh.hash(p, p + v[i].size(), 1)) == vrh[i]) return 1;
	else return 0;
}

int solve(int p, int used)
{
	if (used == (1 << n) - 1) return 1;
	if (dp[p][used] >= 0) return dp[p][used];
	int res = 0;
	REP(i, n)
	{
		if ((used >> i) & 1) continue;
		if (is_match(p, i))
		{
			chmax(res, solve(p + v[i].size(), used | (1 << i)));
		}
	}
	return dp[p][used] = res;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	while (cin >> n >> m, n)
	{
		MS(dp, -1);
		v.clear();
		s.clear();
		vrh.clear();
		k = 0;
		v.resize(n); cin >> v;
		for (auto &i : v)
		{
			k += i.size();
			RollingHash rh(i);
			vrh.emplace_back(rh.hash(0, i.size(), 0), rh.hash(0, i.size(), 1));
		}
		REP(i, m)
		{
			string a; cin >> a;
			s += a;
		}
		rh = RollingHash(s);
		int ans = 0;
		REP(i, s.size() - k + 1)
		{
			string t = s.substr(i, k);
			ans += solve(i, 0);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 43388
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

int fun(int n){
    return ((n*(n-1))/2)%1000000007;
}

inline void solve(){
    map <int,int> oc;
    int n,k,ans=0; 
    cin>>n>>k; 
    vi a(n),b(n),help(n,0);
    for (int &i: a) cin>>i;
    for (int i=0;i<n;i++){
        int b=0,f=0;
        for (int j=i+1;j<n;j++) if (a[i]>a[j]) b++;
        for (int j=0;j<i;j++) if (a[i]>a[j]) f++;
        ans = (ans  + ((f+b)*fun(k)) + (b*k))%1000000007;
    }
    cout << ans << endl;
    return;
}

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


Measured memory_bytes: 3660
#include <iomanip>
#include <iostream>
#include <string>

using Int = int_fast64_t;
using Real = long double;
using String = std::string;

struct Fio {
    Int precision;
    Fio(Int precision) : precision(precision) {}
};

std::ostream& operator<<(std::ostream& os, const Fio& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}

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

    Real ans = 0;
    for (Int i = 0; i < n; ++i) {
        Real x;
        String u;
        std::cin >> x >> u;
        if (u == "BTC") {
            x *= 380000;
        }
        ans += x;
    }

    std::cout << Fio(10) << ans << std::endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector< vector<int> > A(2);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < N; j++) {
      int a;
      cin >> a;
      A[i].push_back(a);
    }
  }

  for (int i = 1; i < N; i++) {
    A[0][i] += A[0][i-1];
    A[1][N-i-1] += A[1][N-i];
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans = max(ans, A[0][i] + A[1][i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N=int(input())
L=[]
for i in range(N):
    a,b=map(int,input().split())
    L.append([a,b])

if N%2==0:
    Min=[]
    for i in range(N):
        Min.append(min(L[i]))
    #print(Min)
    Min.sort()
    MIN=(Min[N//2]+Min[N//2-1])/2
    #print(MIN)
    Max=[]
    for i in range(N):
        Max.append(max(L[i]))
    Max.sort()
    MAX=(Max[N//2]+Max[N//2-1])/2
    print(int((MAX-MIN)*2+1))
else:
    Min=[]
    for i in range(N):
        Min.append(min(L[i]))
    #print(Min)
    Min.sort()
    MIN=Min[N//2]
    Max=[]
    for i in range(N):
        Max.append(max(L[i]))
    Max.sort()
    MAX=Max[N//2]
    print(int((MAX-MIN)+1))

Measured memory_bytes: 114572
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    L = lmi()
    L.sort()
    print(L[0] * L[1] // 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c=1;
    cin>>a>>b;
    for(int i=0;i<a;i++)
    {
        if(c>b)c+=b;
        else c+=c;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 256
import math
A, B, H, M  = map(int, input().split())

tansin = 360*H/12 + 360*M/(12*60)

chosin = 360*M/60

kakudo = abs(tansin - chosin)
kotae = A**2 + B**2 - 2*A*B*(math.cos(math.radians(kakudo)))

print(math.sqrt(kotae))

Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;long long n,m,i,j,k,a_a[200007],ans=1ll<<55,l,r,mid,ss,asd[200007];vector<long long> a,b,c,d;long long s_m(long long x,long long y){	return asd[y]-asd[x-1];}
int main(){cin>>n;	for (i=1;i<=n;i++)	{	cin>>a_a[i];		asd[i]=asd[i-1]+a_a[i];	}	for (i=2;i<n-1;i++)	{		a.clear();		b.clear();
		c.clear();		d.clear();		l=ss=1;r=i;		while (l<r)	{		mid=(l+r)/2;			if (s_m(1,mid)<=s_m(mid+1,i))			{
				ss=mid;
				l=mid+1;			}			else r=mid;		}		a.push_back(s_m(1,ss));
		b.push_back(s_m(ss+1,i));
		if (ss+2<=i)
		{			a.push_back(s_m(1,ss+1));			b.push_back(s_m(ss+2,i));
		}
		l=ss=i+1;r=n;		while (l<r)
		{			mid=(l+r)/2;
			if (s_m(i+1,mid)<=s_m(mid+1,n))			{				ss=mid;
				l=mid+1;
			}			else r=mid;
		}		c.push_back(s_m(i+1,ss));
		d.push_back(s_m(ss+1,n));		if (ss+2<=n)
		{			c.push_back(s_m(i+1,ss+1));			d.push_back(s_m(ss+2,n));
		}
		for (j=0;j<a.size();j++)
		{			for (k=0;k<c.size();k++)
			{				ans=min(ans,max(max(a[j],b[j]),max(c[k],d[k]))-min(min(a[j],b[j]),min(c[k],d[k])));
			}		}	}	cout<<ans<<endl;	return 0;
}

Measured memory_bytes: 3328
//この書き方なら、ボールが３以上でも対応できる！
using System;

namespace tst
{
    class Program
    {
        public struct Ball
        {
            public string color;
            public int num;
        }
        public static void Main()
        {
            string[] In1 = Console.ReadLine().Split(' ');
            string[] In2 = Console.ReadLine().Split(' ');
            string target = Console.ReadLine();
            Ball[] balls = new Ball[2];
            for(int i=0; i<=1; i++)
            {
                balls[i].color = In1[i];
                balls[i].num = int.Parse(In2[i]);
                if (balls[i].color == target)
                {
                    balls[i].num--;
                }
            }
            Console.Write(balls[0].num);
            for(int i=1; i<=1; i++)
            {
                Console.Write(" "+balls[i].num);
            }
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 13140
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n, k;
	cin >> n >> k;
	vector<pair<ll, ll>> p(n);
	rep(i, n) cin >> p[i].fi >> p[i].se;
	ll ans = 9223372036854775806LL;
	rep(i, n) rep(j, n) rep(l, n) rep(m, n){
		if(!(p[i].se >= p[j].se && p[l].fi <= p[m].fi)) continue;
		int tot = 0;
		rep(o, n) if(p[o].fi >= p[l].fi && p[o].fi <= p[m].fi && p[o].se <= p[i].se && p[o].se >= p[j].se) tot++;
		if(tot >= k) ans = min(ans, (ll)((p[i].se - p[j].se) * (p[m].fi - p[l].fi)));

	}
	cout << ans << endl;
	return 0;	
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/8/ITP2/2/ITP2_2_B

#include <iostream>
#include <vector>
#include <queue>

int main()
{
    int n, q;
    std::cin >> n >> q;
    std::vector<std::queue<int>> qu(n);

    int m, t, x;
    for (int i = 0; i < q; i++)
    {
        std::cin >> m >> t;
        if (m == 0)
        {
            std::cin >> x;
            qu[t].push(x);
        }
        else if (m == 1)
        {
            if (qu[t].size() > 0)
            {
                std::cout << qu[t].front() << std::endl;
            }
        }
        else if (m == 2)
        {
            if (qu[t].size() > 0)
            {
                qu[t].pop();
            }
        }
    }
    return 0;
}


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

using namespace std;

using ll = long long;

int Group(int x) {
    if (x == 2) return 2;
    else if (x == 4 || x == 6 || x == 9 || x == 11) return 1;
    else return 0;
}

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

    int x, y;
    cin >> x >> y;

    int g1 = Group(x), g2 = Group(y);
    if (g1 == g2) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
n,k = list(map(int,input().split(' ')))

ans =[]

for i10 in range(0,n+1):
  for i5 in range(0,n+1):
    i1 = n-i10-i5
    if (i1 >= 0) and ((i10*10000+i5*5000+1000*(i1))== k) :
      ans = [i10,i5,(n-i10-i5)]
#      print(ans)      
              
#print(ans)
if (ans)  :
  print(ans[0],ans[1],ans[2])
else:
  print('-1 -1 -1')


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
struct lucheng
{
	int daijia;
	int shijian;
};
int main()
{
	int n,t,jishuqi=0;
	cin>>n>>t;
	lucheng a[n],b[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i].daijia>>a[i].shijian;
		if(a[i].shijian<=t)
		{
			b[jishuqi]=a[i];
			jishuqi++;
		}
	}
	int min=99999;
	for(int i=0;i<jishuqi;i++)
	{
		if(min>b[i].daijia)
		{
			min=b[i].daijia;
		}
	}
	if(min==99999)
	{
		cout<<"TLE";
		return 0;
	}
	cout<<min;
	return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005

void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int abs(int a){if(a<0)return -a;return a;}
int dup(int a,int d){if(a%d==0)return a/d;else return a/d+1;}
int mod(int a,int m){if(a<0)return a%m+m;else return a%m;}
int GCD(int a,int b){int c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
int LCM(int a,int b){return a*b/GCD(a,b);}
int POW(int a,int n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return (int)ans;}
int icmp(const void* a,const void* b){return *(int*)a-*(int*)b;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}
LL fac[NUM],finv[NUM],inv[NUM];
void comi(){int i;fac[0]=fac[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fac[i]=fac[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
int com(int n,int k){if(n<k||n<0||k<0)return 0;return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;}


int main(){
  int M,D,m,d,i,ans=0;
  scanf("%d%d%d%d",&M,&D,&m,&d);
  if(M!=m)ans=1;

  printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define gc getchar_unlocked
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long int
#define s(x)	cin>>x
#define p(x)	cout<<x<<"\n"
#define goog(x, y)  cout<<"Case #"<<x<<": "<<y<<"\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 100000000000
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpi;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
typedef long double ld;

mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);
int gcd(int a, int b) ;

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve() {
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll maxv;
    maxv=max(b*d,a*c);
    maxv=max(maxv,a*d);
    maxv=max(maxv,b*c);
    p(maxv);
    
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}

void ipgraph(int n, int m){
	int i, u, v;
	while(m--){
		cin>>u>>v;
    //u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}

void dfs(int u, int par){
	for(int v:g[u]){
		if (v == par) continue;
		dfs(v, u);
	}
}

int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

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

int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;

    if((x - r) >= 0 && (y - r) >= 0 && (x + r) <= W && (y + r) <= H){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3096
ALPHABET = ["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"]

s = input()
for i in range(26):
    if ALPHABET[i] not in s:
        print(ALPHABET[i])
        break
else:
    print("None")


Measured memory_bytes: 3188
lines = $stdin.read
array = lines.split("\n")
N = array[0].to_i

def erastosthenes(n)
  array = (2..n).to_a
  threshold = Math.sqrt(n)
  count = 2
  while threshold > count
    array.reject!{|n| n != count and n % count == 0}
    count += 1
  end
  array
end

PRIME = erastosthenes(10**4).select{|n| n%5==1}.sort
puts PRIME.take(N).join(" ")

Measured memory_bytes: 1916
package main

import "fmt"

func main(){
  var (
    n int
    k int
    q int
  )
  fmt.Scan(&n,&k,&q)
  var winner int
  scores := make([]int,n)
  for i:=0;i<q;i++{
    fmt.Scan(&winner)
    scores[winner -1 ] ++
  }
  for _,score :=range(scores){
    if score >= q - k + 1{
      fmt.Println("Yes")
    }else{
      fmt.Println("No")
    }
  }
}

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

int main()
{
    int odd = 0, eve = 1;
    string str_a, str_b, str_c;
    cin >> str_a >> str_b;
    str_c = str_a + str_b;
    for (int i = 0; i < str_a.length();i++){
        str_c.at(odd) = str_a.at(i);
        odd = odd + 2;
    }
    for (int i = 0; i < str_b.length(); i++)
    {
        str_c.at(eve) = str_b.at(i);
        eve = eve + 2;
    }
    cout << endl;
    cout <<str_c <<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 int main(void){
   int N,i;
   
   scanf("%d",&N);
   
   for(i = 1;i <= 9;i++){
     //printf("%d\n",i);
     if( N % i == 0 && N/i <= 9){
       break;
     }
   }
   //printf("%d,%d\n",N/i,N%i);
   if(N/i <= 9 && N/i > 0 && N % i == 0 && i < 10){
       printf("Yes");
   }else{printf("No");}
return 0;
}
     

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
long long dp[6000000],u=1e9+7;
int o[25][25],n,q;
long long bt(int x,int id)
{
    if(id==n)return 1;
    if(dp[x]!=-1)return dp[x];
    long long &ret=dp[x];
    ret=0;
    for(int i=0;i<n;i++)
    {
        if((1<<i)&x)continue;
        if(o[id][i]==0)continue;
        ret+=(bt(x+(1<<i),id+1))%u;
        ret%=u;
    }
    return ret%u;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n;
    q==(1<<n)-1;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)cin>>o[i][j];
    }
    cout<<bt(0,0)%u;
}
/*100 10 1
100 100 3
1000 10 10*/


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

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

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

                int count1 = 1;
                int count2 = N;

                while (M > 0) {
                        System.out.println(count1+" "+count2);
                        if (N%2 == 0 && count1 == N/4) {count2--;}
                        count1++;
                        count2--;
                        M--;
                }
        }
}

Measured memory_bytes: 55544
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int n;
  vector<int> a;

  while(scanf("%d",&n) && n){
    a.resize(n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);

    int ans = n;
    for(int i=0;i<n;i++){
      for(int j=1;j<=3;j++){
	if(a[i] == j)continue;
	if( (i && a[i-1]==j) || (i==n-1 && a[i+1]==j) ){
	  vector<int> v = a;
	  v[i] = j;
	  
	  
	  for(;;){
	    int prv = 0,color = a[0],num = 1;
	    for(int i=1;i<(int)v.size();i++){
	      if(v[i] == color)num++;
	      else{
		if(4<=num)break;
		color = v[i];
		num = 1;
		prv = i;
	      }
	    }
	    
	    if(4<=num)for(int i=0;i<num;i++)v.erase(v.begin()+prv);
	    else break;
	  }
	  ans = min(ans,(int)v.size());
	}
      }
    }
    printf("%d\n",ans);
  }
}

Measured memory_bytes: 916
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader((new InputStreamReader(System.in)));
        String[] l = reader.readLine().split(" ");
        int N = Integer.parseInt(l[0]);
        String[] list = reader.readLine().split(" ");
        int[] arr = new int[N];
        for(int i= 0;i<N;i++){
            arr[i] =Integer.parseInt(list[i]);
        }
        int[] dp = new int[N];
        dp[0] = 1;
        int min = arr[0];
        for(int j = 1;j<N;j++){
            if(arr[j]<min){
                dp[j] = 1+dp[j-1];
                min = arr[j];
            }
            else{
                dp[j] = dp[j-1];
            }
        }
        System.out.println(dp[dp.length-1]);
    }

}


Measured memory_bytes: 50072
#include<bits/stdc++.h>
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 Would
#define you
#define please


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


	int N;
	cin >> N;

	int IP[200001];
	rep1(i, N) {
		int p;
		cin >> p;
		IP[p] = i;
	}

	int saidai = 0;
	rep1(i, N) {
		int ima = IP[i];
		int kazu = 1;
		while (i + 1 <= N && IP[i + 1] > ima) {
			ima = IP[i + 1];
			i++;
			kazu++;
		}
		saidai = max(saidai, kazu);
	}

	co(N - saidai);

	Would you please return 0;
}

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

int main(){
	
	int n, x;
	cin >> n >> x;
	vector<int> v(n);
	for (int& e: v){
		cin >> e;
	}
	sort(v.begin(), v.end());
	int count = 0;
	for (int e: v){
		x = x - e;
		if (x<0) break;
		count++;
	}
	if (x>0) count--;
	cout << count;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long int LLI;
int main()
{
  	int n;
 	cin >> n;
  	int tmp, colours[9]{}, ans_min = 0;
  	for(int i = 0; i < n; i++)
    {
      	cin >> tmp;
      	if( tmp >= 3200 )
          	colours[8]++;
      	else{
          colours[tmp/400]++;
          if( colours[tmp/400] == 1 )
            	ans_min++;
        }
    }
  	if( ans_min == 0 and colours[8] > 0 )
      	cout << 1;
  	else if( ans_min > 0 )
      	cout << ans_min;
  	cout << " " << ans_min + colours[8];
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int n;
class Dice{
private:
  int right,left,front,back,bottom,now,flag=1;
  int role(int num[6],int num2[6],string str){
    for(int i=0;i<str.size();i++){
      if(num[0]==num2[0]&&num[1]==num2[1]&&num[2]==num2[2]&&num[3]==num2[3]&&num[4]==num2[4]&&num[5]==num2[5]){
	cout<<"No"<<endl;
	flag=0;
	return 0;
      }
      switch(str[i]){
      case 'S':num[1]=now;num[0]=back;num[4]=bottom;num[5]=front;now=num[0];back=num[4];bottom=num[5];front=num[1];break;
      case 'W':num[3]=front;num[1]=right;num[2]=back;num[4]=left;front=num[1];left=num[3];back=num[4];right=num[2];break;
      case 'E':num[3]=bottom;num[0]=left;num[2]=now;num[5]=right;now=num[0];left=num[3];bottom=num[5];right=num[2];break;
      case 'N':num[4]=now;num[0]=front;num[1]=bottom;num[5]=back;now=num[0];back=num[4];bottom=num[5];front=num[1];break;
      }
      if(num[0]==num2[0]&&num[1]==num2[1]&&num[2]==num2[2]&&num[3]==num2[3]&&num[4]==num2[4]&&num[5]==num2[5]){
	cout<<"No"<<endl;
	flag=0;
	return 0;
      }
    }
  }
public:
  void Scan(int num[100][6]){
   
    for(int i=0;i<n-1;i++){
      now=num[i][0];right=num[i][2];left=num[i][3];front=num[i][1];back=num[i][4];bottom=num[i][5];
      for(int j=i+1;j<n;j++){    
	role(num[i],num[j],"WWWNWWWWNWWWWNWWWNWWWWNNWWWNWWW");
	if(flag==0)
	  return;
      }
    }
    if(flag==1)
      cout<<"Yes"<<endl;
  }
};

int main(){
  Dice dice;
  int a,b;
  cin>>n;
  int num[100][6];
  for(int i=0;i<n;i++)
    for(int j=0;j<6;j++)
      cin>>num[i][j];
  dice.Scan(num);
  return 0;
}

Measured memory_bytes: 3180
#include <stdio.h>
int main(void){
    // Your code here!
    int H,W;
    int i,j;
    
    while(1){
        scanf("%d %d",&H,&W);
        
        if(H==0&&W==0) break;
        
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



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

using namespace std;

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

    int N; cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; ++i)
        cin >> A[i] >> B[i];

    int64_t answer = 0;
    for (int i = N - 1; i >= 0; --i) {
        int rem = (A[i] + answer) % B[i];
        if (rem > 0)
            answer += B[i] - rem;
    }

    cout << answer << "\n";
}


Measured memory_bytes: 1024
S =list(input())
N = len(S)
ans = [0]*N
A = []
cnt = 0
for i in range(N-1):
    if S[i:i+2] == ['R','L']:
        for j in range(i,-1,-1):
            if S[j] == 'R':
                cnt += 1
            else:
                break
        even =  cnt//2
        odd = cnt-even
        ans[i+1] += even
        ans[i] += odd
        cnt = 0
        for j in range(i+1,N):
            if S[j] == 'L':
                cnt += 1
            else:
                break
        even =  cnt//2
        odd = cnt-even
        ans[i] += even
        ans[i+1] += odd
        cnt = 0
for a in ans:
    A.append(str(a))
print(' '.join(A))

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

#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> P;
void solve(){
    int n;cin>>n;
    vector<P> v(n);
    vector<int> x,y;
    rep(i,n){
        cin>>v[i].first>>v[i].second;
        v[i].first--;v[i].second--;
        x.push_back(v[i].first);
        y.push_back(v[i].second);

    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    rep(i,n-1){
        if(x[i]==x[i+1]){
            cout<<-1<<endl;return;
        }
        if(y[i]==y[i+1]){
            cout<<-1<<endl;return;
        }
    }
    vector<int> p(n);
    rep(i,n){
        p[v[i].second]=v[i].first;
    }
    //rep(i,n)cout<<p[i]<<endl;
    vector<bool> used(n,false);
    int ans=0;
    rep(i,n){
        if(used[i])continue;
        used[i]=true;
        int tmp=0;
        int cur=p[i];
        while(!used[cur]){
            used[cur]=true;
            tmp++;cur=p[cur];
        }
        //cout<<tmp<<endl;
        ans+=tmp;
    }
    cout<<ans<<endl;

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


Measured memory_bytes: 5036
#include <stdio.h>

int sosuu_num;
int sosuu_list[30000];
char is_sosuu[30001];

void make_sosuu_list(void) {
	int i,j;
	for(i=0;i<=30000;i++)is_sosuu[i]=1;
	is_sosuu[0]=is_sosuu[1]=0;
	sosuu_num=0;
	for(i=2;i<=30000;i++) {
		if(is_sosuu[i]) {
			sosuu_list[sosuu_num++]=i;
			for(j=i+i;j<=30000;j+=i)is_sosuu[j]=0;
		}
	}
}

int main(void) {
	int query;
	int i,j;
	int count;
	int a,b,c;
	make_sosuu_list();
	while(1) {
		scanf("%d",&query);
		if(query==0)break;
		count=0;
		for(i=0;i<sosuu_num;i++) {
			if(sosuu_list[i]>query)break;
			for(j=i;j<sosuu_num;j++) {
				a=sosuu_list[i];
				b=sosuu_list[j];
				c=query-a-b;
				if(c<b)break;
				if(is_sosuu[c]) {
					if(c>b-a && c<a+b)count++;
				}
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 0
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.buffer.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.buffer.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = sorted(rr())
if len(set(s)) == 2 and s.count(s[0]) == 2:
  print('Yes')
else:
  print('No')
















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

int main() {
    int s;
    cin>>s;
    set<int> st;
    for (int i=2;i<=1000000;i++) {
        st.insert(s);
        if (s%2==0)
            s/=2;
        else
            s=3*s+1;
        if (st.count(s)) {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod=1000000007;



int main()
{
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif*/

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    ll num1=0,num2=0;
    int a,b,i,j;
    cin>>a>>b;

    for(i=b-1;i>=0;i--)
    {
      num1+=a*pow(10,i); //a
    }
    for(i=a-1;i>=0;i--)
    {
      num2+=b*pow(10,i); //b
    }

    if(a>b)
      cout<<num2<<endl;
    else
      cout<<num1<<endl;

    
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <queue>
#include <stack>
#include <bitset>
#include <set>
#include <map>
#include <chrono>
#include <string>
#include <assert.h>

using namespace std;

#define endl '\n'

long long gcd(long long a, long long b) {
    while (b) {
        auto t = a % b;
        a = b;
        b = t;
    }
    return a;
}

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

    long long a, b;
    cin >> a >> b;

    long long g = gcd(a, b);

    vector<int> total;

    for (long long i = 2; i * i <= g; ++i) {
        if (g % i == 0) {
            int t = 1;
            g /= i;

            while (g % i == 0) {
                t++;
                g /= i;
            }

            total.push_back(t);
        }
    }

    if (g > 1) {
        total.push_back(1);
    }

    cout << total.size() + 1 << endl;
    return 0;
}

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

template<typename T>
T gcd(T a,T b)
{
	if(a<b) swap(a,b);
	T r = a % b;
	while(r!=0)
	{
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}
int main()
{
	int T; scanf("%d",&T);
	unsigned long int A,B,C,D;
	for(int i=0;i<T;i++)
	{
		scanf("%ld%ld%ld%ld",&A,&B,&C,&D);
		if(A<B || D<B || C<A%B || C<B-gcd(B,D))	puts("No");
		else		puts("Yes");
	}
	return 0;
}

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

int main() {
  int N,K;
  cin >> N >> K;
  int a = 1;
  for (int i; i < N; i++) {
    if (a < K) {
      a *= 2;
    }
    else {
      a += K;
    }      
  }
  cout << a << endl;
}

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

public class Main {

	private static boolean DEBUG = false;

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String[] raw = reader.readLine().split("\\s");
		int N = Integer.parseInt(raw[0]);
		int M = Integer.parseInt(raw[1]);
		raw = reader.readLine().split("\\s");
		RemainderItem[] C = new RemainderItem[M/2 + 1];
		for (int j = 0; j < C.length; j++)
			C[j] = new RemainderItem();
		for (int j = 0; j < N; j++) {
			int item = Integer.parseInt(raw[j]);
			int r = item % M;
			int c = r;
			if (r < C.length) {
				C[r].P++;
			}
			else {
				C[M-r].N++;
				c = M-r;
			}
			if (!C[c].ClassItems.containsKey(item)) 
				C[c].ClassItems.put(item, 1);
			else
				C[c].ClassItems.put(item, C[c].ClassItems.get(item) + 1);
		}
		long result = 0;
		if (DEBUG) {
			System.out.println("Classes:");
			for (int j = 0; j < C.length; j++) {
				System.out.print(String.format("Class %d: P: %d N: %d (", j, C[j].P, C[j].N));
				for (int key: C[j].ClassItems.keySet())
					System.out.print(String.format("[key: %d, count: %d]", key, C[j].ClassItems.get(key)));
				System.out.println();
			}
		}
		for (int j = 0; j < C.length; j++) {
			// zero class adds all items.
			if (j == 0 || (M%2 == 0 && j == M / 2)) {
				result += (C[j].P + C[j].N) / 2;
			}
			else {
				int min = Math.min(C[j].P, C[j].N);
				int max = Math.max(C[j].P, C[j].N);
				long ep = 0;
				if (max - min > 1) {
					for (int key: C[j].ClassItems.keySet())
						if ((max == C[j].P && key % M< C.length) || (max == C[j].N && key % M >= C.length))
							ep += C[j].ClassItems.get(key) / 2;
					ep = Math.min(ep, (long)(max - min) / 2);
				}
				if (DEBUG) {
					System.out.println(String.format("Class %d sums %d", j, min+ep));
				}
				result += min + ep;
			}
		}
		System.out.println(result);
	}

	static class RemainderItem {
		int P, N;
		Map<Integer, Integer> ClassItems;

		public RemainderItem() {
			ClassItems = new HashMap<Integer, Integer>();
		}
	}
	
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cout.precision(10);
    cout<<fixed;
#ifdef _DEBUG
    freopen("input.txt", "r", stdin);
#endif
    int m[3][3];
    bool b[3][3];
    memset(b, false, sizeof(b));
    for(auto &a:m) for(auto &i:a) cin>>i;
    int n;
    cin>>n;
    while(n--) {
        int x;
        cin>>x;
        for(int i=0; i<3; ++i) for(int j=0; j<3; ++j)
                if (m[i][j]==x) b[i][j]=true;
    }
    if(b[0][0] && b[0][1] && b[0][2]) cout<<"Yes";
    else if(b[1][0] && b[1][1] && b[1][2]) cout<<"Yes";
    else if(b[2][0] && b[2][1] && b[2][2]) cout<<"Yes";
    else if(b[0][0] && b[1][0] && b[2][0]) cout<<"Yes";
    else if(b[0][1] && b[1][1] && b[2][1]) cout<<"Yes";
    else if(b[0][2] && b[1][2] && b[2][2]) cout<<"Yes";
    else if(b[0][0] && b[1][1] && b[2][2]) cout<<"Yes";
    else if(b[0][2] && b[1][1] && b[0][2]) cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

bool check(int i, string s) {
    string num = to_string(i);
    while (num.size() < 3) num = '0' + num;
    int idx = 0;
    for (int j=0; j<s.size(); j++) {
        if (idx == 3) return true;
        if (num[idx] == s[j]) {
            idx++;
        }
    }
    return idx == 3;
}

int main() {
    int N; cin >> N;
    string s; cin >> s;
    int counter = 0;
    for (int i=0; i<1000; i++) {
        if (check(i, s)) counter++;
    }
    cout << counter << endl;
}

Measured memory_bytes: 3748
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;



int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	
	
	ins(morty);
	int rick = 0;
	FOR(i,0,(1<<(morty.size()-1))){
		int tmp = morty[0]-'0';
		FOR(i1,0,morty.size()-1){
			if(i&(1<<i1)){
				rick+=tmp;
				tmp = 0;
			}
			tmp = tmp*10+morty[i1+1]-'0';
		}
      rick+=tmp;
	}
	out(rick);












	return 0;
}


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

int main(){
	int n,x;
	cin >> n >> x;
	int m[n];
	REP(i,n) cin >> m[i];
	sort(m, m + n);
	REP(i,n) x -= m[i];
	cout << n + x / m[0] << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,41)):
    imos=[0]*(n+1)
    for i in range(n):
        imos[max(0,i-a[i])]+=1
        imos[min(n-1,i+a[i])+1]-=1
    for i in range(n-1):
        imos[i+1]+=imos[i]
    for i in range(n):
        a[i]=imos[i]
print(*a)

Measured memory_bytes: 164532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n);++i)
const int INF =1001001001;
using ll=long long;
using P = pair<int,int>;
using Graph =vector<string>;
Graph field;
queue<P> q;

int main() {
  ll n;
  ll ans=0;
  string ab;
  cin>>ab;
  n=ab.size();
  rep(i,n){
    ans=ans+ab[i]-'0';
  }
  if(ans%9){
    cout<<"No"<<endl;
  }else{
    cout<<"Yes"<<endl;
  }

}


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

int main() {
  vector<ll> a(3), b(3), c(3), al(9);
  for (ll i = 0; i < 3; i++) {
    cin >> a.at(i);
    al.at(i) = a.at(i);
  }
  for (ll i = 0; i < 3; i++) {
    cin >> b.at(i);
    al.at(i + 3) = b.at(i);
  }
  for (ll i = 0; i < 3; i++) {
    cin >> c.at(i);
    al.at(6 + i) = c.at(i);
  }
  ll n;
  cin >> n;
  rep(i, n) {
    ll tmp;
    cin >> tmp;
    rep(j, 9) {
      if (al.at(j) == tmp) al.at(j) = 0;
    }
  }
  if ((al.at(0) == 0 && al.at(1) == 0 && al.at(2) == 0) ||
      (al.at(3) == 0 && al.at(4) == 0 && al.at(5) == 0) ||
      (al.at(6) == 0 && al.at(7) == 0 && al.at(8) == 0) ||
      (al.at(0) == 0 && al.at(3) == 0 && al.at(6) == 0) ||
      (al.at(1) == 0 && al.at(4) == 0 && al.at(7) == 0) ||
      (al.at(2) == 0 && al.at(5) == 0 && al.at(8) == 0) ||
      (al.at(0) == 0 && al.at(4) == 0 && al.at(8) == 0) ||
      (al.at(2) == 0 && al.at(4) == 0 && al.at(6) == 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main(){
    int n;
    string s,t;
    cin >> n >> s;
    rep(i,s.size()){
        if(s[i] + n > 'Z') t += (s[i] + n - 'Z' + 'A' - 1);
        else t += (s[i] + n);
    }
    cout << t << endl;
    return 0;
}


Measured memory_bytes: 256