akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};

int main(){
	int n,a,b;
	cin>>n>>a>>b;
	int tmp1=a*n;
	int tmp2=b;
	print(min(tmp1,tmp2));
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args) throws java.io.IOException{
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int tmp;
        if (a>b) {
            tmp = b;
            b = a;
            a = tmp;
        }
        if (b>c) {
            tmp = c;
            c = b;
            b = tmp;
        }
        // ここまで最大値がきまる．
        if (a>b) {
         tmp = b;
            b = a;
            a = tmp;
        }
        System.out.println( a+ " "+ b+ " "+c);
    }
}

Measured memory_bytes: 17176
def dot(a,b):
    return a[0]*b[0] + a[1]*b[1]

x1,y1,x2,y2 = [int(i) for i in input().split()] 
q = int(input())
for i in range(q):
    x,y = [int(i) for i in input().split()]
    a = [x2-x1,y2-y1]
    b = [x-x1,y-y1]
    co = dot(a,b) / dot(a,a)
    isec = [co*a[0]+x1,co*a[1]+y1]
    c = [isec[0] - x, isec[1] - y]
    print(isec[0]+c[0],isec[1]+c[1])

Measured memory_bytes: 7776
#include <iostream>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int a, b;
while(cin >> a >> b) {
if (a == 0 && b == 0) break;
if (a < b)
 cout << a << " " << b << "\n";
else
 cout << b << " " << a << "\n";
}
}

Measured memory_bytes: 3020
#include <bits/stdc++.h>
#define llint long long int
#define ldouble long double

//setprecision()<<

using namespace std;

int main() {
    string s;
    cin>>s;
    int head=0,tale=0;
    for(int i=0;i<s.size();i++){
        if(s.at(i)=='A'){
            head=i;
            break;
        }
    }
    for(int j=s.size()-1;j>=0;j--){
        if(s.at(j)=='Z'){
            tale=j;
            break;
        }
    }
    cout<<tale-head+1<<endl;
return 0;
}

Measured memory_bytes: 640
program patisserie_abc
  implicit none
  integer :: n, m, i
  integer(8) :: x(1000), y(1000), z(1000), s(1000), w(8)
  x = 0_8
  y = 0_8
  z = 0_8
  s = 0_8
  read(*,*) n, m
  if (m.eq.0) then
    write(*,'(i0)') 0
    stop
  end if
  do i = 1, n
    read(*,*) x(i), y(i), z(i)
  end do
  do i = 0, 7
    s = 0_8
    if (btest(i,0)) then
      s = s + x
    else
      s = s - x
    end if
    if (btest(i,1)) then
      s = s + y
    else
      s = s - y
    end if
    if (btest(i,2)) then
      s = s + z
    else
      s = s - z
    end if
    call merge_sort(n,s(1:n))
    w(i+1) = abs(sum(s(1:m)))
  end do
  write(*,'(i0)') maxval(w)
  stop
contains
  subroutine merge_sort(n,c)
    implicit none
    integer, intent(in)       :: n
    integer(8), intent(inout) :: c(n)
    integer                   :: num, lng, i, ubnd
    num = n
    lng = 1
    do while (num.gt.1)
      do i = 1, num/2
        ubnd = min(2*i*lng,n)
        call merge(c(2*(i-1)*lng+1:(2*i-1)*lng),c((2*i-1)*lng+1:ubnd))
      end do
      lng = 2*lng
      num = (num+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2)
    implicit none
    integer(8), intent(inout) :: c1(:), c2(:)
    integer(8)                :: c(size(c1)+size(c2))
    integer                   :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1)
    n2 = size(c2)
    do while (i1.le.n1.and.i2.le.n2)
      if (c1(i1).le.c2(i2)) then
        c(i1+i2-1) = c1(i1)
        i1 = i1+1
      else
        c(i1+i2-1) = c2(i2)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2) = c1(i1:n1)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2) = c2(i2:n2)
    end if
    c1 = c(1:n1)
    c2 = c(n1+1:n1+n2)
    return
  end subroutine merge
end program patisserie_abc

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

/*
AC
外側からxを書いていく．
＝外のxを消していく
*/

int main(void){
	bool ok=true;
	ll ans=0,l=0,r;
	string s;
	cin>>s;
	r=s.size()-1;
	while(l<r){
		if(s[l]=='x'){
			if(s[r]!='x'){//外側のxを消していく
				l++;
				ans++;
			}else{//どっちもxなので何もしなくて良い
				l++;
				r--;
			}
		}else{
			if(s[r]!='x'){
				if(s[l]==s[r]){//同じなので無問題
					l++;
					r--;
				}else{//解消不可能
					ok=false;
					break;
				}
			}else{//外側のxを消していく
				r--;
				ans++;
			}
		}
	}
	cout<<(ok?ans:-1)<<endl;
	return 0;
}

Measured memory_bytes: 512
N=int(input())
red=[list(map(int, input().split())) for _ in range(N)]
blue=[list(map(int, input().split())) for _ in range(N)]
red.sort(key=lambda x:x[1])
blue.sort(key=lambda x:x[0])
ct=0
for i in blue:
    for j in reversed(red):
        if i[0]>j[0] and i[1]>j[1]:
            red.remove(j)

            ct+=1
            break
print(ct)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int N;
    cin >> N;
    vector<int> v(N);
    cin >> v;
    SORT(v);
    double ans = v[0];
    FOR(i, 1, N) {
        ans = (ans + v[i]) / 2.0;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
def main():
	W, H, N = map(int, input().split())
	lst = [[True for _ in range(H)] for _ in range(W)]

	for _ in range(N):
		x, y, a = map(int, input().split())

		if a == 1:
			for i in range(x):
				for j in range(H):
					lst[i][j] = False
		elif a == 2:
			for i in range(x, W):
				for j in range(H):
					lst[i][j] = False
		elif a == 3:
			for i in range(W):
				for j in range(y):
					lst[i][j] = False
		elif a == 4:
			for i in range(W):
				for j in range(y, H):
					lst[i][j] = False
		
	cnt = 0

	for i in range(W):
		for j in range(H):
			if lst[i][j]:
				cnt += 1

	print(cnt)

  
if __name__ == "__main__":
  	main()

Measured memory_bytes: 9284
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	int n, k, x[100], c = 0;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> x[i];
		c += min(x[i], k - x[i]) * 2; 
	}
	
	cout << c << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

int main() {
  int a = in();
  int b = in();

  if (a + b == 15) {
    puts("+");
  } else if (a * b == 15) {
    puts("*");
  } else {
    puts("x");
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
    int n;
    cin>>n;
    string s[n];
    for (int i = 0; i < n; ++i) {
        cin>>s[i];
    }
    int m;
    cin>>m;
    string t[m];
    for (int j = 0; j < m; ++j) {
        cin>>t[j];
    }

    int maxyen = 0;
    for (int i = 0; i < n; ++i) {
        string speak = s[i];
        int yen = 0;
        for (int j = 0; j < n; ++j) {
            if(speak == s[j]){
                yen++;
            }
        }
        for (int k = 0; k < m; ++k) {
            if(speak == t[k]){
                yen--;
            }
        }
        maxyen = max(maxyen,yen);
    }

    cout<<maxyen<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;

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

	if(a == b){
		cout << a << endl;
		return 0;
	}

	if(a != 0){
		ll xora = a/2 % 2;
		if(a % 2 == 1)xora ^= a-1;

		ll xorb = (b+1)/2 % 2;
		if((b+1) % 2 == 1)xorb ^= b;

		cout << (xora^xorb) << endl;
	}
	if(a == 0){
		ll xorb = (b+1)/2 % 2;
		if((b+1) % 2 == 1)xorb ^= b;
		cout << xorb << endl;
	}
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
/*#pragma GCC target("avx,avx2,fma")
#pragma GCC target ("sse4")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define ld double 
#define rep(i,a,b) for(ll i=a; i<b; ++i)
#define BOOST std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(v) v.begin(),v.end()
#define sl(a) a.size()
#define mod 1000000007 
#define lcm(a,b) (a*b)/__gcd(a,b)
#define MAX1 100006
#define f first
#define s second
#define pi 2*acos(0.0)
bool isPowerOfTwo (int x) {  return x && (!(x&(x-1)));  }
void solve()
{
    ll n; cin>>n;
    map<vector<ll>,ll> mp;
    rep(i,0,n)
    {
        string str;  cin>>str;
        vector<ll> freq(26,0);
        rep(j,0,sl(str)) freq[str[j]-'a']++;
        mp[freq]++;
    }
    ll ans=0;
    for(auto i: mp)
    {
        ans+=((i.s)*(i.s-1))/2;
    }
    cout<<ans;
}
int main()
{
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt","r",stdin);
    //for getting error from error.txt
    freopen("error.txt", "w", stderr);
    // for writing output to output.txt
    freopen("output.txt","w",stdout);
    #endif
    BOOST
    int T=1;  //cin>>T;
    while(T--) solve();
    cerr<<"Time taken : "<<fixed<<setprecision(5)<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<"\n";
    cerr<<"My CLOCKS_PER_SEC= "<<CLOCKS_PER_SEC<<"\n";
    return 0;
}

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

int main() {
  string S;
  string holder = "";

  cin >> S;

  for (int i = 0; i < S.size(); i++) {
    if (!holder[holder.find(S[i])]) {
      holder += S[i];
    }
  }

  if (holder.size() != 2) {
    cout << "No";
  }
  else {
    cout << "Yes";
  }

  return 0;
}

Measured memory_bytes: 764
def resolve():
    # 整数 1 つ
    n = input()
    # 整数複数個
    # a, b, c = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    if n == "ABC":
        print("ARC")
    else:
        print("ABC")

 #   print("n")

resolve()

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

int values[] = {10, 50, 100, 500};

int main () {
	int n;
	bool first = true;
	while (cin >> n, n) {
		if (first) {
			first = false;
		}
		else {
			cout << endl;
		}
		int c[4], sum = 0;
		for (int i = 0; i < 4; i++) {
			cin >> c[i];
			sum += values[i] * c[i];
		}
		sum -= n;
		for (int i = 3; i >= 0; i--) {
			int s = sum / values[i];
			sum -= s * values[i];
			c[i] -= s;
		}
		for (int i = 0; i < 4; i++) {
			if (c[i] <= 0) continue;
			cout << values[i] << ' ' << c[i] << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main()
{
	
	int n,ans=0,temp;
	cin>>n;
	for (int i = 0; i < n; ++i)
	{
		cin>>temp;
		ans+=temp-1;
	}
	cout<<ans<<"\n";
    
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

def search(i, L, Lnum, K):
    if i > 40: return 0
    add = pow(2, 40 - i)
    nextK = []
    count = 0
    for l in L:
        if l & add == add:
            nextK.append(l)
            count += 1
    #print(i, L)
    if count >= K: return add + search(i+1, nextK, count, K)
    else: return search(i+1, L, Lnum, K)


def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    sumA = [0] * (N + 1)
    for i, a in enumerate(A): sumA[i+1] = sumA[i] + a
    subA = []
 
    for i in range(N):
        for j in range(i+1, N+1): subA.append(sumA[j] - sumA[i])

    print(search(0, subA, N * (N + 1) // 2, K))

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 29340
#include<stdio.h>
#include<stdlib.h>
#define ll long long

#define rep(i,l,r)for(ll i=(l);i<(r);i++)

ll a[3];
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		ll t;
		scanf("%lld",&t);
		if(t%2)a[0]++;
		else if(t%4)a[1]++;
		else a[2]++;
	}
	if(a[1])a[0]++;
	puts(a[2]+1<a[0]?"No":"Yes");
	return 0;
}

Measured memory_bytes: 128
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,n) for(int i=0;i<(n);i++)
#define ote(x) cout<<(x)<<endl

int main(){
	int N,M;cin>>N>>M;
	map<int,int> AB;
	rp(i,M){
		int a,b;
		cin>>a>>b;
		AB[a]++;
		AB[b]++;
	}

	// for(auto e:AB)cout<<e.first<<","<<e.second<<"\n";//
	// for(auto e:AB)ote(e.second);
	for(int i=1; i<=N; ++i){
		decltype(AB)::iterator it = AB.find(i);
    if(it!=AB.end()){
			ote(AB[i]);
    }
		else{
			ote(0);
		}
	}
}


Measured memory_bytes: 256
<?php

list($a, $b) = explode(" ", trim(fgets(STDIN)));

if ($a == 'H') {
    echo $b;
} elseif ($a == 'D' && $b == 'H') {
    echo 'D';
} elseif ($a == 'D' && $b == 'D') {
    echo 'H';
}



?>

Measured memory_bytes: 4728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,b,c,d;cin>>n>>a>>b>>c>>d;
  ll x=a-b,l,r;
  bool isok=false;
  rep(i,n) {
    l=i*c-(n-1-i)*d;
    r=i*d-(n-1-i)*c;
    if(l<=x&&x<=r) {isok=true;break;}
  }
  print(isok?"YES":"NO");
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define revrep(i, s) for (int i = s-1; i > 0; i--)
#define revrrep(i, s) for (int i = s-1; i >= 0; i--)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N, ans = 0; cin >> N;
    rep (i, 0, N) {
        int a, b; cin >> a >> b;
        ans += (b - a) + 1;
    }
    cout << ans << endl;
}

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

int main() {
	string w;
	cin >> w;
	sort(w.begin(), w.end());
	int count = 0;
	char judge = ' ';
	for (int i = 0;i < w.size();++i) {
		if (w[i] != judge) {
			judge = w[i];
			count = 1;
		}
		if (w[i + 1] != judge && count % 2 != 0) {
			puts("No");
			return 0;
		}
		count += 1;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  solve
  def solve: Unit ={
    val str = readLine.trim
    if (str == "END OF INPUT") return
    println(
      str.split(' ').map(_.length).mkString("")
    )
    solve
  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 43752
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	if(a>b)
	   swap(a,b);
	for(int i=1;i<=3;i++)
	   if((a*b*i)%2==1)
	   {
	   	  cout<<"Yes"<<endl;
	   	  return 0;
	   }
	cout<<"No"<<endl;
	return 0;
}


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

int main() {
  int a, b, A, B;
  cin >> a >> b;
  A = a % 2, B = b % 2;
  if (A == 0 || B == 0) cout << "Even" << endl;
  else cout << "Odd" << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <class T>
void setmin(T &a, T const &b) {
    if (a > b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

int main() {
    int N, M;
    cin >> N >> M;
    auto G = vectors(-1, N, 0);
    for (int i = 0; i < M; ++i) {
        int A, B;
        cin >> A >> B;
        --A, --B;
        G[A].push_back(B);
        G[B].push_back(A);
    }

    vector<int> color(N, -1);
    // 二部グラフか判定
    auto dfs = [&](auto f, int cur, int col) -> bool {
        color[cur] = col;
        for (int next_v : G[cur]) {
            if (color[next_v] == col) return false;

            if (color[next_v] == -1)
                if (!f(f, next_v, 1 - col)) return false;
        }
        return true;
    };

    if (dfs(dfs, 0, 0)) {
        // 二部グラフの場合
        long long B = 0, W = 0;
        for (int col : color) {
            if (col == 1)
                ++B;
            else
                ++W;
        }
        cout << B * W - (long long)M << endl;
    } else {
        // 二部グラフじゃない場合
        long long ans = (long long)N * (N - 1) / 2 - M;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 9404
a,b = map(int, input().split())
ab = []
ba = []
ans = []
for i in range(b):
    ab.append(str(a))
for i in range(a):
    ba.append(str(b))
ans.append(''.join(ab))
ans.append(''.join(ba))
new = sorted(ans)
print(new[0])



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

using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
void debugF(ostream &os) {os << endl;}
template <typename Head, typename... Tail>
void debugF(ostream &os, Head H, Tail... T) { os << " " << H; debugF(os, T...); }
#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debugF(cout, __VA_ARGS__)
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); os << (i>0 ? " ":"") << v[i++]); return os;}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, i;
    cin >> n;
    vi a(n);
    int sm = 0;
    for(i=0;i<n;i++){
        cin >> a[i];
        sm ^= a[i];
    }
    for(i=0;i<n;i++){
        a[i] = sm ^ a[i];
    }
    cout << a << "\n";

    return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a==b && a==c && b==c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> x(n), c(n);
    rep(i, n){
        cin >> x.at(i);
        c.at(i) = x.at(i);
    }
    sort(all(c));
    rep(i, n){
        if(x.at(i) <= c.at(n/2-1))cout << c.at(n/2);
        else cout << c.at(n/2-1);
        cout << endl;
    }
}

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

int main() {
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  int x = sx;
  int y = sy;
  while(x != tx) {
    cout << 'R';
    x++;
  }
  while(y != ty + 1) {
    cout << 'U';
    y++;
  }
  while(x != sx - 1) {
    cout << 'L';
    x--;
  }
  while(y != sy) {
    cout << 'D';
    y--;
  }
  while(x != sx) {
    cout << 'R';
    x++;
  }
  while(y != ty) {
    cout << 'U';
    y++;
  }
  while(x != tx + 1) {
    cout << 'R';
    x++;
  }
  while(y != sy - 1) {
    cout << 'D';
    y--;
  }
  while(x != sx) {
    cout << 'L';
    x--;
  }
  while(y != sy) {
    cout << 'U';
    y++;
  }
  cout << endl;
  return 0;
}

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

int main() {
  vector <int> list = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout <<list.at(k-1) << endl;
  return 0;
}
//vector <int> a(3);

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a, c(1e+6 + 5, 1), b(1e+6 + 5, 0);
    int lim = -1;
    int ans = 0;

    rep(i, n) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
        lim = max(a[i], lim);
    }
    sort(a.begin(), a.end());
    rep(i,n-1) {
        if (a[i] == a[i + 1]) {
            b[a[i]] = 1;
        }
    }
    rep(i, n) {
        int current = a[i];
        if (c[current]) {
            if (b[current] == 0) {
                ans++;
            }
            for (int j = current; j <= lim; j += current) {
                b[j] = 1;
            }
        }
        c[current] = 0;
    }

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

Measured memory_bytes: 12136
#include "bits/stdc++.h"

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
//int dx[] = { 1, 0 };
//int dy[] = { 0, 1 };
#define mod7 1e9+7;
#define mod9 1e9+9;

int nextInt(){
	int a;	cin >> a;return a;
}
string next(){
	string s;cin >> s;return s;
}
char nextChar(){
	char c;cin >> c;return c;
}

unsigned long long strtoint(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

void solve(){
	string a = next();
	string b = next();
	if(a.length() < b.length()){
		P("LESS");
		return;
	}else if(a.length() > b.length()){
		P("GREATER");
		return;
	}else{
		rep(i,a.length()){
			if(a[i] != b[i]){
				if(a[i] < b[i]){
					P("LESS");
					return;
				}else{
					P("GREATER");
					return;
				}
			}
		}
		P("EQUAL");
	}
}

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


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

using namespace std;

int main()
{
    long long int n,m;
    cin>>n>>m;
    long long int a[n],i,sum=0,c=0;
    for(i=0;i<n;i++)
        cin>>a[i];
        for(i=0;i<n;i++)
            sum=sum+a[i];
        for(i=0;i<n;i++)
        {
            if(4*m*a[i]>=sum)
                c++;
        }
    if(c>=m)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (100005)
#define INF (1LL << 60)
const int MOD = (int)1e9 + 7;


signed main(){
    string s;
    cin >> s;

    map<char,int> mp;
    for(int i=0; i<s.length()-1; i++){
        if(s[i]==s[i+1]){
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;

}

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

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

    priority_queue<int, vector<int>, greater<int>> prices;
    for (int i = 1; i <= n; ++i) {
        int temp;
        cin >> temp;
        prices.emplace(temp);
    }

    int total = 0;
    for (int i = 1; i <= k; ++i) {
        total += prices.top();
        prices.pop();
    }
    cout << total;
}

Measured memory_bytes: 3600
package main

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

func main() {
	N := nextInt()
	var n float64
	if N%2 == 0 {
		n = float64(N) / float64(2*N)
	} else {
		n = float64(N+1) / float64(2*N)
	}
	fmt.Printf("%0.10f\n", n)
}

var stdin = initStdin()

func initStdin() *bufio.Scanner {
	bufsize := 1 * 1024 * 1024 // 1 MB
	var stdin = bufio.NewScanner(os.Stdin)
	stdin.Buffer(make([]byte, bufsize), bufsize)
	stdin.Split(bufio.ScanWords)
	return stdin
}

func nextString() string {
	stdin.Scan()
	return stdin.Text()
}

func nextBytes() []byte {
	stdin.Scan()
	return stdin.Bytes()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextString())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextString(), 10, 64)
	return i
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    int n ;
    cin >> n; 
    vector<int>a(n);
    for(int i = 0 ; i < n ; i++ )
    {
         cin >> a[i];
    }
    int init = 2000 , ans = 0 ;
    for ( int i = 1 ; i < n ; i++ )
    {
        if ( a[i] == a[i-1])
        {
             a[i] = init ;
             init -- ;
             ans++;
        }
    }
    cout << ans << endl ;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int insertionSort(int a[], int n, int g) {
  int i, j, v, cnt = 0;
  for (i = g; i < n ; i++) {
    v = a[i];
    j = i - g;
    while (j >= 0 && a[j] > v) {
      a[j+g] = a[j];
      j = j - g;
      cnt++;
    }
    a[j+g] = v;
  }
  return cnt;
}

void shellSort(int a[], int n) {
  int i, cnt = 0;
  double l = ceil(log((double)n) / log(4.0));
  int m = l;
  if (m == 0) m = 1;
  int g[m];
  for (i = 0; i < m; i++) {
    if (i==m-1) g[i] = 1;
    else g[i] = pow(2, (m-i));
  }
  cout << m << endl;
  for (i = 0; i < m; i++) {
    if (i != 0) cout << " ";
    cout << g[i];
  }
  cout << endl;
  for (i = 0; i < m; i++) {
    cnt += insertionSort(a, n, g[i]);
  }
  cout << cnt << endl;
}

int main(void) {
  int i, j, n;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  shellSort(a, n);
  for (i = 0; i < n; i++) cout << a[i] << endl;
  return 0;
}

Measured memory_bytes: 5132
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	int n; cin >> n;
    vector<int> a(n);
    int sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    int ans = INF;
    int sum1 = 0;
    rep(i, n - 1) {
        sum1 += a[i];
        int sum2 = sum - sum1;
        chmin(ans, abs(sum1 - sum2));
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int a[mx5];

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

    for(int i = 0; i < n; i++)
        cin >> a[i];

    for(int i = 1; i < n; i++)
        a[i] = __gcd(a[i], a[i - 1]);

    cout << a[n - 1] << '\n';
    return 0;
}


Measured memory_bytes: 3980
from collections import Counter

N, K = map(int, input().split())
A = map(int, input().split())
C = Counter(A)
if len(C.keys()) <= K:
    print(0)
else:
    n = len(C.keys()) - K
    print(sum(map(lambda x:x[1],C.most_common()[-n:])))

Measured memory_bytes: 41504
#include "bits/stdc++.h"
#include <unordered_set>

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;
//==============================================

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

	unordered_set<string> hasuSet;
	string s, word;
	int n;

	cin >> n;
	REP(i, n) {
		cin >> s;
		if (s == "insert") {
			cin >> word;
			hasuSet.insert(word);
		} else {
			cin >> word;
			if (hasuSet.count(word) > 0) {
				cout << "yes" << "\n";
			} else {
				cout << "no" << "\n";
			}
		}
	}
	return 0;
}

Measured memory_bytes: 29652
# -*- coding: utf-8 -*-
import sys
import itertools

N,M,Q=map(int, sys.stdin.readline().split())
X=[ map(int, sys.stdin.readline().split()) for _ in range(Q) ]

LL=list(itertools.combinations_with_replacement(range(1, M+1), N))

ans=float("-inf")
for L in LL:
    temp_ans=0
    for a,b,c,d in X:
        if L[b-1]-L[a-1]==c:
            temp_ans+=d
    ans=max(ans,temp_ans)
print ans


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

int main() {
  string s;
  stack<int> st;

  while (cin >> s) {
    if (s == "+") {
      int v1 = st.top();
      st.pop();
      int v2 = st.top();
      st.pop();
      st.push(v2 + v1);
    } else if (s == "-") {
      int v1 = st.top();
      st.pop();
      int v2 = st.top();
      st.pop();
      st.push(v2 - v1);
    } else if (s == "*") {
      int v1 = st.top();
      st.pop();
      int v2 = st.top();
      st.pop();
      st.push(v2 * v1);
    } else {
      st.push(stoi(s));
    }
  }

  cout << st.top() << endl;

  return 0;
}


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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> Pair;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

VL divisor(ll n) {
    VL res;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            res.push_back(i);
            if(i != n / i) res.push_back(n / i);
        }
    }
    return res;
}

ll N, M;

int main() {
    cin >> N >> M;
    VL di = divisor(M);
    sort(All(di), greater<ll>());
    REP(i, di.size()) {
        if(M / di[i] >= N) {
            cout << di[i];
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=2e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int n;
char s[N];
int a[N],b[N];
int main(){
	read(n);
	cin>>s+1;
	for(int i=1;i<=n;i++)a[i]+=a[i-1]+(s[i]=='#');
	for(int i=n;i;i--)b[i]+=b[i+1]+(s[i]=='.');
	int ans=INF;
	for(int i=0;i<=n;i++){
		ans=min(ans,a[i]+b[i+1]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2048
using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

partial class Solver {
    public void Run() {
        var S = ns();
        cout.WriteLine(700 + S.Count(c => c == 'o') * 100);
    }
}

// PREWRITEN CODE BEGINS FROM HERE
partial class Solver : Scanner {
    public static void Main(string[] args) {
        new Solver(Console.In, Console.Out).Run();
    }

    TextReader cin;
    TextWriter cout;

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        this.cin = reader;
        this.cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

    public int ni() { return NextInt(); }
    public int[] ni(int n) { return NextIntArray(n); }
    public long nl() { return NextLong(); }
    public long[] nl(int n) { return NextLongArray(n); }
    public double nd() { return NextDouble(); }
    public string ns() { return Next(); }
}

public class Scanner {
    private TextReader Reader;
    private Queue<String> TokenQueue = new Queue<string>();
    private CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        this.Reader = reader;
    }

    public int NextInt() { return Int32.Parse(Next(), ci); }
    public long NextLong() { return Int64.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        var array = new string[size];
        for (int i = 0; i < size; i++) array[i] = Next();
        return array;
    }
    public int[] NextIntArray(int size) {
        var array = new int[size];
        for (int i = 0; i < size; i++) array[i] = NextInt();
        return array;
    }

    public long[] NextLongArray(int size) {
        var array = new long[size];
        for (int i = 0; i < size; i++) array[i] = NextLong();
        return array;
    }

    public String Next() {
        if (TokenQueue.Count == 0) {
            if (!StockTokens()) throw new InvalidOperationException();
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext() {
        if (TokenQueue.Count > 0)
            return true;
        return StockTokens();
    }

    private bool StockTokens() {
        while (true) {
            var line = Reader.ReadLine();
            if (line == null) return false;
            var tokens = line.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) continue;
            foreach (var token in tokens)
                TokenQueue.Enqueue(token);
            return true;
        }
    }
}


Measured memory_bytes: 11348
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
    int n,x,min = 1000;
    int a[100];

    cin >> n >> x;
    FOR(i,0,n){
        cin >> a[i];
        x -= a[i];
        if(a[i] < min)min = a[i];
    }

    cout << x / min + n << endl;
    return 0;
}


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

#define int long long

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

long long L, R;
const long long MOD = 1e9 + 7;

long long res(long long len, long long xR, long long yR)
{
    long long mins = (1LL << len) / 2;
    long long maxs = mins * 2 - 1;
    if (mins > xR || mins > yR) return 0;
    long long dp[2][2];
    dp[0][0] = 1;
    dp[0][1] = 0, dp[1][0] = 0, dp[1][1] = 0;
    if (maxs <= xR)
    {
        dp[0][0] = 0, dp[1][0] = 1;
    }
    if (maxs <= yR)
    {
        dp[0][0] = 0, dp[0][1] = 1;
    }
    if (maxs <= xR && maxs <= yR)
    {
        dp[0][0] = 0, dp[0][1] = 0, dp[1][0] = 0, dp[1][1] = 1;
    }
    for (int deg = len - 2; deg >= 0; deg--)
    {
        ll dp2[2][2];
        dp2[0][0] = 0, dp2[1][0] = 0, dp2[0][1] = 0, dp2[1][1] = 0;
        for (int state1 = 0; state1 < 2; state1++)
        {
            for (int state2 = 0; state2 < 2; state2++)
            {
                for (int pu1 = 0; pu1 < 2; pu1++)
                {
                    for (int pu2 = pu1; pu2 < 2; pu2++)
                    {
                        int can = 1;
                        long long digit1 = ((1LL << deg) & xR);
                        long long digit2 = ((1LL << deg) & yR);
                        if (digit1 == 0 && state1 == 0 && pu1 == 1)
                            can = 0;
                        if (digit2 == 0 && state2 == 0 && pu2 == 1)
                            can = 0;
                        if (!can) break;
                        int broke1 = 0, broke2 = 0;

                        if (state1 == 0 && digit1 >= 1 && pu1 == 0)
                            broke1 = 1;
                        if (state2 == 0 && digit2 >= 1 && pu2 == 0)
                            broke2 = 1;

                        dp2[state1 ^ broke1][state2 ^ broke2] += dp[state1][state2];
                    }
                }
            }
        }
        dp[0][0] = dp2[0][0] % MOD;
        dp[1][0] = dp2[1][0] % MOD;
        dp[0][1] = dp2[0][1] % MOD;
        dp[1][1] = dp2[1][1] % MOD;
    }
    return (dp[0][0] + dp[0][1] + dp[1][0] + dp[1][1]) % MOD;
}

long long get(long long xR, long long yR)
{
    long long ans = 0;
    for (int len = 1; len <= 61; len++)
    {
        //cout << xR << " " << yR << " " << len << " " << res(len, xR, yR) << endl;
        ans += res(len, xR, yR);
    }
    return ans % MOD;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> L >> R;
    cout << (MOD * MOD + get(R, R) - get(L - 1, R) - get(R, L - 1) + get(L - 1, L - 1)) % MOD;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;

char O[55], E[55];
char ans[200];
int main()
{
	while(scanf("%s %s", O + 1, E + 1) != EOF)
	{
		int h = 1;
		int leno = strlen(O + 1);
		int lene = strlen(E + 1);
		for(int i = 1; i <= leno; i++)
		{
			ans[h] = O[i];
			h += 2;
		}
		h = 2;
		for(int i = 1; i <= lene; i++)
		{
			ans[h] = E[i];
			h += 2;
		}
		for(int i = 1; i <= leno + lene; i++)
			printf("%c", ans[i]);
		printf("\n");
		memset(O, 0, sizeof(O));
		memset(E, 0, sizeof(E));
		memset(ans, 0, sizeof(ans));
	}
}

Measured memory_bytes: 128
from collections import defaultdict
import sys
N = int(input())

if N == 1:
    print(0)
    sys.exit(0)


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


T = prime_factorize(N)


q = defaultdict(int)
p = set(T)

for t in T:
    q[t] += 1

ans = 0

for pp in list(p):
    count = 0
    tmp = 0
    while True:
        tmp += 1
        count += tmp + 1
        if count >= q[pp]:
            break
    ans += tmp

print(ans)


Measured memory_bytes: 66016
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define ULL unsigned long long
#define UI unsigned int
#define PII pair<int,int>
#define MPII(x,y) pair<int,int>{x,y}
#define _for(i,j,k) for(int i=j;i<=k;i++)
#define for_(i,j,k) for(int i=j;i>=k;i--)
#define efor(i,u) for(int i=head[u];i;i=net[i])
#define lowbit(x) (x&-x)
#define ls(x) x<<1
#define rs(x) x<<1|1
#define inf 0x3fffffff
//#pragma comment(linker, "/STACK:10240000000,10240000000")
using namespace std;
const int maxn = 2e6 + 5;
const int M = 1e9 + 7;
inline int mad(int a,int b){return (a+=b)>=M?a-M:a;}
int a[maxn],n,b[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	_for(i,1,n){
		cin>>a[i];b[a[i]]=i;
	}
	_for(i,1,n){
		if(i>1) cout<<" ";
		cout<<b[i];
	}
	return 0;
}


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

using namespace std;

#define MAX_N 1005
#define MOD 1000000007

char grid[MAX_N][MAX_N], tmpstr[MAX_N];

int h, w, dp[MAX_N][MAX_N];

int f_imp(int, int);

int f(int y, int x)
{
	if (y >= h || x >= w || grid[y][x] == '#')
		return 0;
	if (dp[y][x] == 0)
		dp[y][x] = f_imp(y, x) + 1;
	return dp[y][x] - 1;
}

int f_imp(int y, int x)
{
	if (y == h - 1 && x == w - 1)
		return 1;
	return (f(y + 1, x) + f(y, x + 1)) % MOD;
}

int main()
{
	scanf("%d %d", &h, &w);
	for (int i = 0; i < h; i++)
	{
		scanf("%s", tmpstr);
		for (int c = 0; c < w; c++)
		{
			grid[i][c] = tmpstr[c];
		}
	}
	printf("%d\n", f(0, 0));
}


Measured memory_bytes: 5248