akhauriyash/Code-Regression huggingface dataset:
//=======================================
// abc146a
//
//  2019/11/23
//=======================================

#include <bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[])
{
	cin.tie(0);
  ios::sync_with_stdio(false);

  string s;
  cin >>  s;

  if(s == "SUN") cout << 7 << endl;
  else if(s == "MON") cout << 6 << endl;
  else if(s == "TUE") cout << 5 << endl;
  else if(s == "WED") cout << 4 << endl;
  else if(s == "THU") cout << 3 << endl;
  else if(s == "FRI") cout << 2 << endl;
  else if(s == "SAT") cout << 1 << endl;



  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<string>
#include<iomanip>
#include<queue>
#include<functional>
#include<cmath>
#include<map>
#include<tuple>
#include <numeric>
#define rep(i,n) for(int i=0; i<(int)n; i++)//n回繰り返す
#define rrep(i,n)for(int i=n-1;i>=0;i--)
#define REP(i,n) for (int i = 1; i <= (int)n; i++)//i=1からi=nまで
#define RREP(i,n)for(int i=n;i>=1;i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using graph = vector<vector<int>>;
const ll mod = pow(10, 9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;
const double pi = 3.14159265358979323846;
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; }

int main() {
    string s; cin >> s;
    int  ans, ANS;
    ans = 0; ANS = 0;
    rep(i, 3) {
        if (s[i] =='R') {
            ans++;
            ANS = ans;
           
        }
        else {
            ANS = max(ans, ANS);
            ans = 0;
          
        }
    }
    cout << ANS << endl;
}



  

























Measured memory_bytes: 3592
#include<iostream>

using namespace std;


int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0){
			break;
		}
		int hon[100];
		for(int i=0;i<m;i++){
			cin>>hon[i];
		}
		
		int reft=0;
		int right=0;
		for(int i=0;i<m;i++){
			right+=hon[i];
		}
		
		while(1){
			double h = (double)(reft+right)/2;
			
			int now=0;
			int cont=1;
			for(int i=0;i<m;i++){
				if(cont>n){
					break;
				}
				if(now+hon[i]>h){
					now=0;
					cont++;
					i--;
					continue;
				}
				now+=hon[i];
			}
			
			if(cont>n){
				reft=h;
			}else{
				right=h+0.5;
			}
			
			if(reft+1==right){
				break;
			}
		}
		printf("%d\n",right);
	}
}

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

using namespace std;
using ll = long long;

tuple<int,int,int> a[200005];

ll dp[200005];
int trstp = 1;
ll add[1 << 20];
ll lo[1 << 20];
void split(int i) {
  lo[2*i] += add[i];
  add[2*i] += add[i];
  lo[2*i + 1] += add[i];
  add[2*i + 1] += add[i];
  add[i] = 0;
}
ll query(int root, int u, int v, int s = 1, int e = trstp) {
  if (v < s || e < u) return 1e18;
  if (u <= s && e <= v) return lo[root];
  split(root);
  int mid = (s + e)/2;
  return min(query(2*root, u, v, s, mid), query(2*root + 1, u, v, mid + 1, e));
}
void update(int root, int u, int v, ll x, int s = 1, int e = trstp) {
  if (v < s || e < u) return;
  if (u <= s && e <= v) {
    add[root] += x;
    lo[root] += x;
    return;
  }
  int mid = (s + e)/2;
  split(root);
  update(2*root, u, v, x, s, mid);
  update(2*root + 1, u, v, x, mid + 1, e);
  lo[root] = min(lo[2*root], lo[2*root + 1]);
}

int main() {
  int n, m;
  cin >> n >> m;
  ll sum = 0;
  for (int i = 0; i < m; i++) {
    int val, l, r;
    cin >> l >> r >> val;
    sum += val;
    a[i] = make_tuple(l, r, val);
  }
  sort(a, a + m);

  while (trstp < n + 1) trstp *= 2;
  int j = m - 1;
  for (int i = n; i >= 1; i--) {
    dp[i] = query(1, i + 1, n + 1);
    update(1, i, i, dp[i]);
    while (j >= 0 && get<0>(a[j]) == i) {
      update(1, get<1>(a[j]) + 1, n + 1, get<2>(a[j]));
      j--;
    }
  }
  cout << sum - query(1, 1, n + 1) << '\n';

  return 0;
}


Measured memory_bytes: 11904
#include<cstdio>
#include<iostream>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<cstdlib>
#include<stack>
#include<ctime>
#include<map>
#include<list>
using namespace std;

int main()
{
	char c;
	cin>>c;
	if('a'<=c && c<='z') puts("a");
	else if('A'<=c && c<='Z') puts("A");
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;

typedef long long int ll;

int main () {
    ll n; cin >> n;
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
        if (i % 3 == 0 || i % 5 == 0) {
            continue;
        }
        ans += i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 3e6 + 5;
int vis[35];
long double qpow(long double a, int t) {
	long double ans = 1;
	while (t) {
		if (t & 1)
			ans *= a;
		a *= a;
		t /= 2;
	}
	return ans;
}
int main() {
	vis[0] = 1;
	for (int i = 1; i <= 30; i++)
		vis[i] = vis[i - 1] * 2;
	long double n, k;
	while (cin >> n >> k) {
		long double t = 1.0 / (n*1.0);
		long double ans = 0;
		for (int i = 1; i <= n; i++) {
			long double  w = k / (i*1.0);
			if (w <= 0)
				ans += t;
			else {
				int q = lower_bound(vis, vis + 30, w) - vis;
				ans += t * qpow(0.5, q);
			}
		}
		printf("%.9Lf\n", ans);
	}
	//system("pause");
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
double s,a,left,right;
double b;
string str;
int n;
int main () {
	cin>>str;
	n=str.length();
	for(int i=0;i<n;i++) {
		if(i%2==0) {
			if(str[i]=='R'||str[i]=='U'||str[i]=='D') continue;
			else {
				//cout<<str[i];
				printf("No\n");
				return 0;
			}
		}
		if(i%2==1) {
			if(str[i]=='L'||str[i]=='U'||str[i]=='D') continue;
			else {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<utility>
#include<deque>
using namespace std;
int main(){
    int h,w;cin >> h >> w;
    int ex[4] = {0,0,1,-1};
    int ey[4] = {1,-1,0,0};
    map<pair<int,int>,char> s;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> s[make_pair(i,j)];
        }
    }
    auto bfs = [&](int x,int y) -> map<pair<int,int>,int>{
        map<pair<int,int>,int> dis;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                dis[make_pair(i,j)] = -1;
            }
        }
        deque<pair<int,int>> q;
        q.push_back(make_pair(x,y));
        dis[make_pair(x,y)] = 0;
        while(!q.empty()){
            pair<int,int> p = q.front();
            q.pop_front();
            for(int i = 0; i < 4; i++){
                int H = p.first + ey[i];
                int W = p.second + ex[i];
                if(dis[make_pair(H,W)] != -1) continue;
                if(0 <= H && H < h && 0 <= W && W < w){
                    if(s[make_pair(H,W)] == '.'){
                        dis[make_pair(H,W)] = dis[p] + 1;
                        q.push_back(make_pair(H,W));
                    }
                }
            }
        }
        return dis;
    };
    int M = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[make_pair(i,j)] != '.') continue;
            auto G = bfs(i,j);
            for(int ii = 0; ii < h; ii++){
                for(int jj = 0; jj < w; jj++){
                    M = max(M,G[make_pair(ii,jj)]);
                }
            }
        }
    }
    cout << M << "\n";
}

Measured memory_bytes: 256
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int main(void){
	int n;
	int *a;
	long x = 0;
	long sum = 0;
	scanf("%d", &n);
	a = (int *)malloc(sizeof(int) * n);
	for(int i=0; i<n; i++){
		scanf("%d", &a[i]);
		sum += a[i];
		sum %= 1000000007;
	}
	for(int j=0; j<n-1; j++){
		sum -= a[j];
		if(sum < 0){
			sum += 1000000007;
		}
		x += sum*a[j];
		x %= 1000000007;
	}
	printf("%ld\n", x);
	return 0;
}


Measured memory_bytes: 2500
#include <stdio.h>
#include <vector>
#include <memory.h>
#include <iostream>
#include <map>
#include <algorithm>
  
// Shabdan Batyrkulov
  
using namespace std;
  
#define pb push_back
#define fr first
#define sc second
#define mk make_pair
#define ll long long
#define ld long double
#define vi vector <int>
#define pii pair <int, int>
#define OK puts("OK");                                                                           
                                                                                                
const int N = (int)1e5 + 7;                                                                 
const int inf = (int)1e9 + 7;
const int MAX = (int)1e2 + 7;

int a[N];
int q[N];

int main () {                      
	int n; scanf ("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf ("%d", a + i);
		if (a[i] < 400) {
			q[1]++;
		} else if (a[i] < 800) {
			q[2]++;			
		} else if (a[i] < 1200) {
			q[3]++;
		} else if (a[i] < 1600) {
			q[4]++;
		} else if (a[i] < 2000) {
			q[5]++;
		} else if (a[i] < 2400) {
			q[6]++;
		} else if (a[i] < 2800) {
			q[7]++;
		} else if (a[i] < 3200) {
			q[8]++;
		} else {
			q[9]++;
		}
	}
	int mn = 0, mx = 0;
	for (int i = 1; i <= 8; i++) {
		if (q[i] > 0) {
			mn++;
		}		
	}
	if (mn == 0) {
		mn = 1;
		mx = q[9];
	} else mx = mn + q[9];
	printf ("%d %d", mn, mx);
}    


Measured memory_bytes: 256
import itertools

n=int(input())
data=[x+1 for x in range(n)]
p = [int(_) for _ in input().split()]
q = [int(_) for _ in input().split()]
a=b=-1
i=0
for d in itertools.permutations(data):
  if list(d)==p:
    a=i
  if list(d)==q:
    b=i
  
  i+=1
    
print(abs(a-b))
    

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SIEVE_SIZE 1000000

int sieve_idx, prime_idx;
char sieve[SIEVE_SIZE];

void init_prime_generator() {
    int i;
    sieve_idx = 2;
    prime_idx = 2;
    memset(sieve, 1, sizeof(sieve));
    sieve[0] = sieve[1] = 0;
}

void reset_prime_count() {
    prime_idx = 2;
}

int next_prime() {
    int i, j, dj;
    if (prime_idx < sieve_idx) {
        if (prime_idx == 2) {
            prime_idx = 3;
            return 2;
        }
        for (i = prime_idx; i < SIEVE_SIZE; i += 2) {
            if (sieve[i] == 1) {
                prime_idx = i + 2;
                return i;
            }
        }
    }
    if (sieve_idx < 3) {
        prime_idx = sieve_idx = 3;
        return 2;
    }
    for (i = sieve_idx; i < SIEVE_SIZE; i+=2) {
        if (sieve[i] == 1) {
            sieve_idx = i + 2;
            for (dj = i*2, j = i+dj; j < SIEVE_SIZE; j += dj) {
                sieve[j] = 0;
            }
            prime_idx = sieve_idx;
            return i;
        }
    }
    return 0;
}


int main (void) {
    int a, d, n;
    int i, k, p;

    init_prime_generator();

    while (scanf("%d%d%d", &a, &d, &n) != EOF && a && d && n) {
        reset_prime_count();
        p = 0;
        for (i = a, k = 0; i < SIEVE_SIZE ;i += d) {
            while (p < i) {
                p = next_prime();
            }
            if (i == p) {
                k++;
                if (k == n) break;
            }
        }
        printf("%d\n", p);
    }
    return 0;
}

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

int main(){
    string s;
    set<char> st;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(!st.count(s[i])){
            st.insert(s[i]);
        }else{
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
main = do
    s <- getLine
    w <- readLn
    let zippedS = zip s [0,1..]
    putStrLn $ map fst $ reverse $ f zippedS w
    
f zippedS w = 
    foldl (\acc x -> if ((snd x) `mod` w == 0) then x:acc else acc)   
    []
    zippedS


Measured memory_bytes: 764
#include<bits/stdc++.h>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    int d, n;
    cin>>n>>d;
    int den = 2*d + 1;
    int ans = (n/den);
    if(n%den != 0) ans++;
    cout<<ans;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll INM = 114514;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	ll n;
	cin >> n;
	priority_queue<ld, vector<ld>, greater<ld>> que;
	for (int i = 0; i < n; i++) {
		int v;
		cin >> v;
		que.push(v);
	}
	for (int i = 0; i < n - 1; i++) {
		ld a = que.top();
		que.pop();
		ld b = que.top();
		que.pop();
		que.push((a + b) / 2.0);
	}
	dumpf(que.top(), 10);
	return 0;
}

Measured memory_bytes: 256
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] = 1 / A[i]

    print(1/sum(A))


if __name__ == "__main__":
    main()


Measured memory_bytes: 61896
import java.util.Scanner;



public class Main{

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int n=scanner.nextInt();
    int m=scanner.nextInt();
    int num=0;


    //int[] ans=new int[n+1];

    int l=scanner.nextInt();
    int r=scanner.nextInt();

    for(int i=1;i<m;i++){
      int ll=scanner.nextInt();
      int rr=scanner.nextInt();
      if(ll>l){
        l=ll;
      }
      if(rr<r){
        r=rr;
      }
    }

    num=r-l+1;
    if(num<0){
      num=0;
    }

    System.out.println(num);
    //System.out.printf("%.12f\n",ans);
  }
}


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

using namespace std;


int main()
{
	string a, b, c="";

	cin >> a;
	cin>> b;
	for (int i = 0; i < a.size(); i++)
	{
		c+=a[i];
		if (i<b.size())
		{
			c+= b[i];
		}
	}
	cout << c;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


int n, a[20][20];
ll memo[70000] = {};

ll dp(int s) {
    int i, j, t;
    ll res = 0;

    if (s == 0) return 0;
    if (memo[s] >= 0) {
        return memo[s];
    }

    for (i = 0; i < n; i++) for (j = i + 1; j < n; j++) {
        if ((s >> i) % 2 == 1 && (s >> j) % 2 == 1) {
            res += a[i][j];
        }
    }

    for (t = (s - 1) & s; t > 0; t = (t - 1) & s) {
        res = max(res, dp(t) + dp(s - t));
    }
    
    return memo[s] = res;
}

int main(void) {
    int i, j;

    scanf("%d", &n);
    for (i = 0; i < n; i++) for (j = 0; j < n; j++) {
        scanf("%d", &a[i][j]);
    }

    for (i = 0; i < (1 << n); i++) {
        memo[i] = -1;
    }

    printf("%lld\n", dp((1 << n) - 1));

    return 0;
}

Measured memory_bytes: 4316
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list=new ArrayList<String>(Arrays.asList(s.split("")));
		List<String> list=new ArrayList<String>();
		//int[] array = new int[n];
		int n = sc.nextInt();
		for(int i=0;n>i;i++) {
			String a = sc.next();
			list.add(a);
		}
		List<String> listB = new ArrayList<String>(new HashSet<>(list));
		System.out.println(listB.size());
	}
}

Measured memory_bytes: 73928
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

bool my_compare(pair<string, int> a, pair<string, int> b) {
    if (a.first != b.first) {
        return a.first < b.first;
    }

    if (a.second != b.second) {
        return a.second > b.second;
    }
    else {
        return true;
    }
}

int main()
{
    int N;
    string S,X,Y;
    cin>>N;
    cin>>S;

    deque<int> deq;

for(int i=1;i<=N-1;++i){
X=S.substr(0,i);
Y=S.substr(i,N-i);

sort(X.begin(),X.end());
sort(Y.begin(),Y.end());

X.erase(unique(X.begin(),X.end()),X.end());
Y.erase(unique(Y.begin(),Y.end()),Y.end());

int m=X.size(), n=Y.size();

int jj=0;
for(int p=0;p<m;++p){
for(int q=0;q<n;++q){
if(X[p]==Y[q]){++jj;}
}
}

deq.push_back(jj);

}

int M=0;

int t=deq.size();

for(int i=0;i<t;++i){
M=max(M,deq[i]);
}

cout<<M<<endl;

}

Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M;
	while(cin>>N>>M) {
		vector<string> A(N), B(M);
		REP(i, N) cin>>A[i];
		REP(i, M) cin>>B[i];
		bool ans = false;
		REP(y0, N-M+1) REP(x0, N-M+1) {
			bool m = true;
			REP(y, M) REP(x, M) if(A[y0+y][x0+x]!=B[y][x]) m=false;
			if(m) ans=true;
		}
		cout<<YN(ans)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 384
import numpy as np

N = int(input())
H = list(map(int, input().split()))

cnt = 0
Ha = np.array(H)

for i in range(max(H)):
    for j in range(N):
        if j==0:
            if Ha[0]>0:
                cnt += 1
        else:
            if Ha[j-1]<=0 and Ha[j]>0:
                cnt += 1
    Ha -= 1
print(cnt)

Measured memory_bytes: 13452
_N, _M = map(int, input().split())
N = max(_N, _M)
M = min(_N, _M)
if N >= 3 or M >= 3:
    long = max(1, N - 2)
    short = abs(M - 2)
    print(long * short)
else:
    if N == 1 and M == 1:
        print(1)
    else:
        print(0)

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

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

    cin >> W >> H >> x >> y >> r;

    cout << ((x - r < 0 || y - r < 0 || x + r > W || y + r > H)? "No" : "Yes")
        << endl;

    return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 2010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    string s1,s2;
    cin >> n >> s1 >> s2;
    ll ans = 1,now = 0;
    bool f = 0;
    if (s1[0] == s2[0]){
        ans *= 3;
        now = 1;
        f = 1;
    }
    else{
        ans *= 6;
        now = 2;
    }
    while(now < n){
        if (s1[now] == s2[now]){
            if (f){
                (ans *= 2)%=MOD;
            }
            now += 1;
            f = 1;
        }
        else{
            if (f){
                (ans *= 2)%=MOD;
            }
            else{
                (ans *= 3)%=MOD;
            }
            now += 2;
            f = 0;
        }
    }
    PRINT(ans);
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
	int n =0, i;
	int a[200001] = { 0 };
	int b[200001] = { 0 };
	int *p;
	scanf("%d", &n);
	for (i = 0; i < n - 1; i++) {
		scanf("%d", &a[i]);
		p = &b[0];
		p = p + a[i] -1;
		*p = *p + 1;
	}
	b[n] = 0;
	for (i = 0; i < n; i++) printf("%d\n", b[i]);

}

Measured memory_bytes: 3292
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iomanip>
#include<map>
#include<set>
#include<cstdio>
#define MAXA 100000
#define MAX 20000000000
#define s(i) scanf("%d", &(i))
#define p(i) printf("%d", (i))
#define ps() printf(" ") 
#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))
#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))
using namespace std;
int main(){
	double w, h, x, y, Count;
	cin >> w >> h >> x >> y;
	if(x==(w/2.0)&&y==(h/2.0)){
		Count = 1;
	}else{
		Count = 0;
	}
	cout << fixed << setprecision(6) << (w*h)/2.0;
	cout << " " <<fixed << setprecision(0) << Count << endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
constexpr double eps=1e-8;
const double pi=acos(-1);
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
vector<int>kaijo,invkaijo;
void init_fact(int n){
    kaijo.resize(n+1);
    invkaijo.resize(n+1);
    kaijo[0]=1;
    for(int i=1;i<=n;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
    rep(i,n+1)invkaijo[i]=modpow(kaijo[i],mod-2);
}
int comb(int a,int b){
    if(a<b)return 0;
    if(a<0||b<0)return 0;
    return kaijo[a]*invkaijo[a-b]%mod*invkaijo[b]%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
int cnt[10000001];
signed main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            cnt[j]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans+=cnt[i]*i;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 81776
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

int main(){
  int n;
  cin >> n;
  ll ans = 0;
  for(int i = 1; i <= n; ++i){
  	if(i % 3 == 0 || i % 5 == 0)continue;
  	ans += i;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
																								   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
		
const double eps = 1e-9;																							   
const int INF = 1000000001;																						   
const float PI = 3.14;																								   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra	   
																													   																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////

int tab[200005];
int temp[200005];

///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main()																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int n;
	cin >> n;
	
	for(int i = 1; i < n; i++){
		cin >> tab[i];
	}
	for(int i = 1; i < n; i++){
		temp[tab[i]]++;
	}
	
	for(int i = 1; i <= n; i++){
		cout << temp[i] << endl;
	}
	
	return 0;
 }


Measured memory_bytes: 5132
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long cap[] = new long[num];
		for(int i = 0; i < num; i ++) {
			cap[i] = sc.nextLong();
		}
		Arrays.sort(cap);
		long intCap[] = {cap[0], -1, -1};
		long numCap[] = {1, 0, 0};
		int type = 0;
		for(int i = 1; i < num; i ++) {
			if(intCap[type] != cap[i]) {
				type ++;
				if(type >= 3) {
					System.out.println("No"); return;
				}
				intCap[type] = cap[i];
			}
			numCap[type] ++;
		}
		type ++;

		if(type == 1) {
			System.out.println(intCap[0] == 0 ? "Yes" : "No"); return;
		}
		if(type == 2) {
			System.out.println(intCap[0] == 0 && numCap[1] == numCap[0] * 2
			 ? "Yes" : "No"); return;
		}
		if(type == 3) {
			System.out.println(numCap[0] == numCap[1] && numCap[1] == numCap[2]
					&& intCap[2] == (intCap[1] ^ intCap[0])
			 ? "Yes" : "No"); return;
		}
	}
}

Measured memory_bytes: 55860
n = int(input())
A = list(map(int, input().split()))
print(*A, sep=" ")
for i in range(1, n):
  v = A[i]
  j = i - 1
  while j >= 0 and A[j] > v:
    A[j+1] = A[j]
    j -= 1
  A[j+1] = v
  print(*A, sep=" ")



Measured memory_bytes: 5980
#include<bits/stdc++.h>
using namespace std;
int main ()
{
    long long k, n; cin >>k>>n;
    long long arr[n+2]; arr[0]=0; arr[n+1]=k;
    for(int i=1; i<=n; i++)cin>>arr[i];
    vector<int>v;
    for(int i=1; i<n+2; i++) {v.push_back(arr[i]-arr[i-1]);}
    v[v.size()-1]= v[v.size()-1]+v[0];
    sort(v.begin(),v.end());
    long long ans =  k - v[v.size()-1];
    cout << ans;
}


Measured memory_bytes: 2936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi; 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int mod = 1e9+7;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
double pi=3.1415926;
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int r;
	cin>>r;
	cout<<2*r*pi<<'\n';
	return 0;
}


Measured memory_bytes: 3800
import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long y = sc.nextLong();
        long a = Math.max(x, y);
        long b = Math.min(x, y);
        while (true) {
            b += Math.min(x, y);
            if (b % a == 0) {
                System.out.println(b);
                System.exit(0);
            }
        }
    }
}

Measured memory_bytes: 21844
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n").map(Number);
while(true){
   var n=arr.shift();
   if(n==0)break;
   var ary=[];
   for(var i=0;i<n;i++)ary[i]=false;
   for(var i=1;i<n;i++){
      ary[i*i%n]=true;
   }
   var m=[];
   ary.forEach(function(v,i){
      if(v)m.push(i);
   });
   var ans=[];
   var len=(n-1)/2 ;
   for(var i=0;i<=len;i++)ans[i]=0;
   for(var i=0;i<m.length;i++){
      for(var j=i+1;j<m.length;j++){
         var x=m[i]-m[j];
         if(x<0)x+=n;
         if(len<x)x=n-x;
         ans[x]+=2;
      }
   }
   ans.shift();
   ans.forEach(function(v){
      console.log(v);
   });
}

Measured memory_bytes: 21012
#include<iostream>
#include<stdio.h>
#include<string.h>
#include <algorithm>
using namespace std;

int main(void){
    int n,m,k, ans = 0, x = 0;
    cin >> n >> m >> k;
    int a[n],b[m];
    unsigned long sum = 0, bsum = 0;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < m; i++){
        cin >> b[i];
        bsum += b[i];
    } 

    int y = m;
    while(k >= sum){
        while(y >= 0){
            if(bsum + sum > k){
                y--;
                bsum = bsum - b[y];
            }else break;
        }
        ans = max({ans,x + y});
        if(x == n) break;
        sum += a[x];
        x++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 3e5+5;

int a[sz];

int main()
{
    ll n;
    cin >> n;
    ll x = 100;
    for(int i=1; ; i++) {
        x += x / 100;
        if(x >= n) {
            cout << i << endl;
            exit(0);
        }
    }
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,k,x,y; cin>>n>>k>>x>>y;
	cout << (n<=k ? x*n : x*k + y*(n-k)) << endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    string s;
    cin >> n >> s;
    rep (i, s.size()) {
        cout << (char)((s[i] - 'A' + n) % 26 + 'A');
    } 
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
    
  ll N;
  cin >> N;
  ll ans = 0;
  
  for(ll i=1; i<=N; i++){
    ll a = N/i;
    ans += i * a*(a+1)/2;
  }

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


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define ll      	long long int
#define PI      	acos(-1)
#define read    	freopen("in.txt","r",stdin)
#define uu      	first
#define vv      	second
#define write   	freopen("out.txt","w",stdout)
#define pii     	pair<int,int>
#define pll         pair<ll,ll>
#define INF     	1e9
#define EPS     	1e-8
#define MAX     	1000006
#define MOD     	1000000007
#define fastRead 	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
int n ;
ll ara[MAX] ,dp[MAX];

ll solve(int id) {

    if( id ==n-1 ) return 0;
    ll &ret = dp[id];
    if( ret != -1) return ret;

    ret = abs(ara[id+1] - ara[id]) + solve(id+1);

    if( id + 2 <n ) ret = min(ret , abs(ara[id+2] - ara[id]) + solve(id+2));
    return ret;
}

int main()
{
    fastRead;
    cin>>n;
    for(int i = 0 ; i < n ; i++ ) cin>>ara[i];
    memset(dp , - 1, sizeof dp);
    cout<<solve(0)<<endl;
    return 0;
}


Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int inf = 2e18;
const int mod = 1e9 + 7;

signed main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N + 1, 0);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        A[i]--;
        A[i] = (A[i - 1] + A[i]) % K;
    }
    int ans = 0;
    unordered_map<string, int> data;
    for (int i = 0; i <= N; i++) {
        ans += data[to_string(A[i])];
        data[to_string(A[i])]++;
        if (i >= K - 1) data[to_string(A[i - K + 1])]--;
    }
    cout << ans << endl;
}


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


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

	a=N%K;
	b=K-a;
	
	if(a<=b)cout<<a<<endl;
	else cout<<b<<endl;
	
	return 0;
}

//REとは? 

Measured memory_bytes: 256
N=int(input())
#[[素因数,数]]を出力
def fctr1(n): 
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+2):
        while n%i==0:
            c+=1
            n=n//i
        if c!=0:
            f.append([i,c])
            c=0
    if n!=1:
        f.append([n,1])
    return f
L=fctr1(N)
ans=0
for i in range(len(L)):
  if L[i][1]==1:
    ans+=1
  else:
    ans+=(-1+(1+8*L[i][1])**0.5)//2
print(int(ans))

Measured memory_bytes: 9488
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<iomanip>
#include<float.h>
#include<math.h>
using namespace std;

template <class T>
class _Point{
public:
	T x;
	T y;
	_Point(){}
	_Point(T _x, T _y) :x(_x), y(_y){}
	_Point(const _Point & v) :x(v.x), y(v.y){}

	const _Point operator + (const _Point & v)
	{
		return _Point(x+v.x,y+v.y);
	}
	const _Point operator - (const _Point & v)
	{
		return _Point(x - v.x, y - v.y);
	}
	T abs() const {
		return sqrt(x*x + y*y);
	}
	_Point unit() const{
		T len = abs();
		return _Point(x / len, y / len);
	}
	T operator*(const _Point &v) const
	{
		return x * v.x + y * v.y;
	}
	const _Point operator*(const T &len) const
	{
		return _Point(len * x, len * y);
	}
};
typedef double R;
typedef _Point<R> Point;
typedef Point Vector;

int main(){
	std::istream & c_in = cin;

	Point p0, p1;
	c_in >> p0.x >> p0.y >> p1.x >> p1.y;
	Vector P10(p1 - p0);
	Vector e10(P10.unit());

	int q;
	c_in >> q;
	for (int i = 0; i < q; ++i)
	{
		Point p2;
		c_in >> p2.x >> p2.y;

		Vector P20 = p2 - p0;
		Vector e20(P20.unit());
		bool zero = P20.abs() < DBL_EPSILON*16;
		R projection = e10*e20;
		if (zero)
		{
			//(5)
			cout << "ON_SEGMENT";
		}
		else if (fabs(projection) > 1 - DBL_EPSILON * 16)
		{
			//??´???
			if (projection > 0)
			{
				if (P20.abs() <= P10.abs())
				{
					//(5)
					cout << "ON_SEGMENT";
				}
				else {
					//(4)
					cout << "ONLINE_FRONT";
				}
			}
			else
			{
				//(3)
				cout << "ONLINE_BACK";

			}
		}
		else
		{
			Vector ey(-e10.y, e10.x);
			R projection2 = ey*P20;
			if (projection2 > 0)
			{
				//???????¨??????????????????´??? (1) 
				cout << "COUNTER_CLOCKWISE";
			}
			else
			{
				//????¨??????????????????´???(2) 
				cout << "CLOCKWISE";
			}
		}
		cout << endl;

	}
}

Measured memory_bytes: 1228
import bisect

def main():
    a,b,q = map(int, input().split())

    sl = [int(input()) for _ in range(a)]
    tl = [int(input()) for _ in range(b)]
    xl = [int(input()) for _ in range(q)]

    for x in xl:
        ans = 10**11

        curr_dist = 0
        ind_s = bisect.bisect_left(sl, x)
        ind_t = bisect.bisect_left(tl, x)
        
        for next_s in [ind_s, ind_s-1]:
            if 0 <= next_s < a:
                curr_dist = abs(x-sl[next_s])
                curr_pos = sl[next_s]
                ind_t2 = bisect.bisect_left(tl, curr_pos)
                if ind_t2 == 0:
                    curr_dist += abs(tl[0] - curr_pos)
                elif ind_t2 == b:
                    curr_dist += abs(tl[b-1] - curr_pos)
                else:
                    curr_dist += min( abs( tl[ind_t2-1] - curr_pos), abs(tl[ind_t2]-curr_pos))
                ans = min(curr_dist, ans)


        for next_t in [ind_t, ind_t-1]:
            if 0 <= next_t < b:
                curr_dist = abs(x-tl[next_t])
                curr_pos = tl[next_t]
                ind_s2 = bisect.bisect_left(sl, curr_pos)
                if ind_s2 == 0:
                    curr_dist += abs(sl[0] - curr_pos)
                elif ind_s2 == a:
                    curr_dist += abs(sl[a-1] - curr_pos)
                else:
                    curr_dist += min( abs( sl[ind_s2-1] - curr_pos), abs(sl[ind_s2]-curr_pos))
                ans = min(curr_dist, ans)

        print(ans)


if __name__ == "__main__":
    main()

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

int ans = 0;

long long int ss(long long int hp)
{
    if (hp==1)
    {
        return 1;
    } else
    {
        return ss(hp/2)*2+1;
    }
    
}

int main()
{
    long long int H;
    cin >> H;
    cout << ss(H) << endl;
}


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

using namespace std;

long long n, a, z = 0, ma = 0;
long long hy[100100];

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> a;
        a++;
        z = max(z, a + 1);
        hy[a - 1]++;
        hy[a]++;
        hy[a + 1]++;
    }
    for(int i = 0; i <= z; i++)
    {
        ma = max(hy[i], ma);
    }
    cout << ma;
	return 0;
}


Measured memory_bytes: 1024
#http://at274.hatenablog.com/entry/2018/02/03/140504
#重み付きUnion-Find木

class WeightedUnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        # 根への距離を管理
        self.weight = [0] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            y = self.find(self.par[x])
            # 親への重みを追加しながら根まで走査
            self.weight[x] += self.weight[self.par[x]]
            self.par[x] = y
            return y

    # 併合
    def union(self, x, y, w):
        rx = self.find(x)
        ry = self.find(y)
        # xの木の高さ < yの木の高さ
        if self.rank[rx] < self.rank[ry]:
            self.par[rx] = ry
            self.weight[rx] = w - self.weight[x] + self.weight[y]
        # xの木の高さ ≧ yの木の高さ
        else:
            self.par[ry] = rx
            self.weight[ry] = -w - self.weight[y] + self.weight[x]
            # 木の高さが同じだった場合の処理
            if self.rank[rx] == self.rank[ry]:
                self.rank[rx] += 1

    # 同じ集合に属するか
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # xからyへのコスト
    def diff(self, x, y):
        return self.weight[x] - self.weight[y]

import sys
input = sys.stdin.readline  #文字列入力では注意！

N,M = map(int,input().split())
uf = WeightedUnionFind(N)

for _ in range(M):
    L,R,D = map(int,input().split())
    L -= 1; R -= 1
    if uf.find(L) == uf.find(R):
        if uf.diff(L,R) != D:
            print("No")
            break
    else:
        uf.union(L,R,D)
else:
    print("Yes")


Measured memory_bytes: 91440
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		ArrayList<Integer> price = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			price.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//降順にソート
		Collections.sort(price, Collections.reverseOrder());
		int money = 0;
		for(int i = 0; i < price.size(); i++) {
			if(i == 0) {
				money += price.get(i) / 2;
			}else {
				money += price.get(i);
			}
		}
		System.out.println(money);
	}

}


Measured memory_bytes: 23764
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main() {
	int a, b, k=1;
	int i = 1, j = 0;
	int x[10000];
	cin >> a >> b >> k;
	while (i <= min(a, b)) {
		if (a % i == 0 && b % i == 0) {
			x[j] = i;
			j++;
		}
		i++;
	}
	cout << x[j - k] << endl;
}

Measured memory_bytes: 256
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]

ans={}

for i in s:
    if i not in ans.keys():
        ans[i]=1
    else:
        ans[i]+=1
for j in t:
    if j not in ans.keys():
        ans[j]=-1
    else:
        ans[j]-=1
print(max(max(ans.values()),0))
    


Measured memory_bytes: 3064