akhauriyash/Code-Regression huggingface dataset:
/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

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

  int n; cin >> n;
  int sum = 0, tmp = 1;
  while(sum < n){
    sum += tmp; tmp++;
  }
  cerr << "SUM: " << sum << endl;
  int diff = sum - n;
  for(int i = --tmp; i > 0; i--){
    if(i != diff) cout << i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <climits>
#define sync                                                                   \
        ios_base::sync_with_stdio(0);                                                \
        cin.tie(0);                                                                  \
        cout.tie(0)
#define ss second
#define ff first
#define ll long long
#define mp make_pair
#define endl "\n"
#define pb push_back
#define ld long double
#define M_PI 3.14159265358979323846
#define puss vector
#define ull unsigned long long
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
#define die {cout<<-1; return 0;}
double EPS = 0.00001;
const ll INF = 1000000007;
using namespace std;


int main() {
        sync;
        int n;
        cin>>n;
        vector<int> a(n);
        FOR(i, 0, n) cin>>a[i];
        ll step=2;
        int ans=0;
        for (int i=0;i<100000;i++){
                bool good=true;
                FOR(j, 0, n){
                        if (a[j]%step) good=false;
                }
                if (!good){
                        cout<<i;
                        return 0;
                }
                step*=2;
        }




}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())

using namespace std;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

using ll = long long;
constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u * v / gcd(u, v);
}

struct City {
    int cityNum;
    int prefNum;
    int year;
    string ID = "";
};

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

    int N, M;
    cin >> N >> M;
    vector<City> cities(M);
    REP(i, M) {
        cities[i].cityNum = i;
        cin >> cities[i].prefNum >> cities[i].year;
    }

    sort(ALL(cities), [](auto c1, auto c2) {return c1.year < c2.year; });

    map<int, int> m;
    REP(i, M) {
        m[cities[i].prefNum]++;
        stringstream ss;
        ss << setw(6) << setfill('0');
        ss << cities[i].prefNum;
        ss << setw(6) << setfill('0');
        ss << m[cities[i].prefNum];
        cities[i].ID = ss.str();
    }

    sort(ALL(cities), [](auto c1, auto c2) {return c1.cityNum < c2.cityNum; });
    REP(i, M) {
        cout << cities[i].ID << endl;
    }

    return 0;

}

Measured memory_bytes: 13696
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int num = sc.nextInt();
		long a[] = new long[num + 1];
		long sum = 0;
		for(int i = 0; i <= num; i ++) {
			a[i] = sc.nextLong();
			sum += a[i];
		}
		long b[] = new long[num];
		for(int i = 0; i < num; i ++) {
			b[i] = sc.nextLong();
		}
		for(int i = 0; i < num; i ++) {
			if(b[i] > a[i]) {
				a[i + 1] = Math.max(0, a[i + 1] - (b[i] - a[i]));
				a[i] = 0;
			}else {
				a[i] = a[i] - b[i];
			}
		}

		long sum2 = 0;
		for(int i = 0; i <= num; i ++) {
			sum2 += a[i];
		}

		System.out.println(sum - sum2);
	}
}

Measured memory_bytes: 64756
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
using ll = long long;

//const long long MOD = 998244353;
//const long long MOD = 1000000007;

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

    std::vector<double> p;
    for(int i=0; i<N; ++i){
        double b; std::cin >> b; p.push_back(b);
    }

    std::vector<std::vector<double>> dp(N+1, std::vector<double>(N+1, 0.0));
    dp[0][0] = 1.0;
    for(int i=0; i<N; ++i){
        for(int j=0; j<i+1; ++j){
            dp[i+1][j+1] += dp[i][j] * p[i];
            dp[i+1][j  ] += dp[i][j] * (1.0 - p[i]);
        }
    }

    double ans = std::accumulate(dp.at(N).begin()+N/2+1, dp.at(N).end(), 0.0);
    std::cout << std::fixed << std::setprecision(10) <<  ans;
    return 0;
}


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

int main(){
    int n, m ;

    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i);
    }
    
    cin >> m;
    vector<string> b(m);
    for (int i = 0; i < m; i++)
    {
        cin >> b.at(i);
    }
    
    vector<int> c(n),d(n);

    for (int i = 0; i < n; i++)
    {
        int count = 0 ;
        for (int j = 0; j < n; j++)
        {
            if(a.at(i)==a.at(j)){
                count ++ ;
            }
        }
        c.at(i)=count;
        
    }
    
    for (int i = 0; i < n; i++)
    {
        int count = 0 ;
        for (int j = 0; j < m; j++)
        {
            if(a.at(i)==b.at(j)){
                count ++;
            }
        }
        d.at(i)=count;
        
    }   

    int ans = 0;

    for (int i = 0; i < n; i++)
    {
        if(ans<c.at(i)-d.at(i)){
            ans = c.at(i)-d.at(i);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n;
  cin>>n;
  ll a[n+1];
  a[0]=2;a[1]=1;
  for(int i=2;i<=n;i++){
    a[i]=a[i-1]+a[i-2];
  }
  cout<<a[n];
}

Measured memory_bytes: 256
h, n = map(int, input().split())
spells = [list(map(int, input().split())) for _ in range(n)]
INF = 10 ** 9
dp = [INF] * (h + 1)
dp[0] = 0

for i in range(h):
    for a, b in spells:
        ni = min(i + a, h)
        dp[ni] = min(dp[ni], dp[i] + b)

print(dp[h])

Measured memory_bytes: 41964
import java.util.Scanner;

class Main {
	
	static int getGCD(int a,int b){
		if(b > a){
			int temp=a;  a=b;  b=temp;
		}
		
		if(a % b==0)
			return b;
		
		return getGCD(b,a%b);
	}
	
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		
		int a=scan.nextInt();
		int b=scan.nextInt();
		
		System.out.println(getGCD(a,b));
	}
}


Measured memory_bytes: 26000
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#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 ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, d;
    cin >> n >> m >> d;
    double ans;
    if(d == 0) ans = (double)(m - 1) / n;
    else ans = (double)(m - 1) * 2 * (n - d)  / (n * n);
    printf("%11.10lf", ans);

    return 0;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

const int64 mod = 1e9+7;

int64 N, P;

int64 powp(int64 a, int64 b){
	if(b == 0) return 1;
	if(b%2) return a*powp(a, b-1);
	int64 ret = powp(a, b/2);
	return ret*ret;
}

int main(void){
	int32 N;
	int64 x = 0;
	cin >> N;
	REP(i, N){
		cin >> x;
		if(x%2){
			cout << "first" << endl;
			return 0;
		}
	}
	cout << "second" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std ;

int main(void){
    int i,j,A,B,x[5]={},c=0;

    cin >> A >> B;

    for(int i=A; i<=B; i++) {
        x[0] = i % 10;
        x[4] = i / 10000 % 10;

        x[1] = i / 10 % 10;
        x[3] = i / 1000 % 10;
        if(x[0] == x[4] && x[1] == x[3]) c++;
    }

    cout << c << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
void MRoy(){
	char s[1001];
	int f = 0;
	scanf("%s",s);
	for(int i = 0;s[i];i++){
		if(i&1) {
			if(s[i]=='R') f = 1;
		}
		else if(s[i]=='L') f = 1;
	}
	if(f) printf("No\n");
	else printf("Yes\n");
	return;
}
int main(){
	MRoy();
	return 0;
}


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

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

  int n = s.size();
  int64_t ans = 0;
  for (int i = 0; i < (1 << (n - 1)); i++){
    bitset<10> op(i);
    op.set(n - 1, 1);
    int64_t p = 0;
    for (int j = 0; j < n; j++){
      p = p * 10 + (s.at(j) - '0');
      if (op.test(j)){
        ans += p;
        p = 0;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1

def prime_list(tt):
    p_list=[]
    for i in range(2,tt+1):
        if prime_t(i):
            p_list.append(i)
    return p_list
d=prime_list(55555)
ans=[i for i in d if i%10==1]
n=int(input())
print(*ans[:n])

Measured memory_bytes: 42076
k = int(input())
cnt = 1
mods = set()
mod = 7
while True:
  mod = mod%k
  if mod==0:
    break
  if mod not in mods:
    mods.add(mod)
    cnt += 1
  else:
    cnt = -1
    break
  mod = (10*mod)+7
print(cnt)

Measured memory_bytes: 77956
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
typedef long double ld;
const int INF = 1e9;
const ll MOD = 1000000007;
int water[10000];
int sugar[10000];
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int A, B, C, D, E, F;
  cin >> A >> B >> C >> D >> E >> F;
  water[0] = 1;
  REP(i, F) {
    chmax(water[i + A * 100], water[i]);
    chmax(water[i + B * 100], water[i]);
  }
  sugar[0] = 1;
  REP(i, F) {
    chmax(sugar[i + C], sugar[i]);
    chmax(sugar[i + D], sugar[i]);
  }
  ld _max = -1;
  int W = 0, S = 0;
  water[0] = 0;
  sugar[1] = 0;
  REP(i, F + 1) {
    if (water[i] == 0) continue;
    int j;
    for (j = min(F - i, (i * E) / 100); j >= 0; j--) {
      if (sugar[j] == 1) break;
    }
    ld w = i, s = j;
    ld tmp = 100 * s / (w + s);
    if (_max < tmp) {
      _max = tmp;
      W = i, S = j;
    }
  }
  cout << W + S << " " << S << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
int a, ax = 1, ay = 0;
int b, bx = 0, by = 1;
int s = 0;
signed main() {
	cin >> a >> b;
	if (a == b) { cout << "0 1\n"; return 0; }
	while (1) {
		if (a < b) {
			swap(a, b);
			swap(ax, bx);
			swap(ay, by);
			s++;
		}
		if (a % b == 0) break;
		bx += a / b * ax;
		by += a / b * ay;
		a %= b;
	}
	int x = ay / (bx * ay - ax * by), y = -(ax * x) / ay;
	cout << x << ' ' << y << endl;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);  

int main(){
  int n;  cin >> n;
  vector<ll> a(n);
  bool flag=false;  int cnt=0;
  for(int i=0; i<n; i++){
    cin >> a.at(i);
    if(a[i]<0){
      cnt += 1; a[i] = -a[i];}
    if(a[i]==0) flag=true;
  }
  ll sum=0;
  sort(a.begin(), a.end());
  for(int i=0; i<n; i++)  sum += a[i];
  
  if(!flag && cnt%2==1) sum -= 2*a[0];
  cout << sum << endl;
  
}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main()
{
  //input
  int N; cin >> N;
  string S; cin >> S;
  int l = N;
  
  //main
  int count = 0;
  for(int i=0; i<l-1; i++){
    if(S[i] == S[i+1]){ count ++; }
  }
  
  // output
  cout << l-count << endl;

  return 0;
}

Measured memory_bytes: 512
import bisect
A,B,Q = map(int,input().split())
a = []
b = []
x = []
for i in range(A):
  a.append(int(input()))
for j in range(B):
  b.append(int(input()))
for k in range(Q):
  x.append(int(input()))
a.insert(0,-(10**15))
a.append(10**15)
b.insert(0,-(10**15))
b.append(10**15)
for k in range(Q):  
  p = bisect.bisect_left(a,x[k])
  q = bisect.bisect_left(b,x[k])
  teraleft_right = [a[p-1],a[p]]
  jinjyaleft_right = [b[q-1],b[q]]
  minlist = []
  for i in range(2):
    for j in range(2):
      minlist.append(abs(x[k]-teraleft_right[i])+abs(teraleft_right[i]-jinjyaleft_right[j]))
      minlist.append(abs(x[k]-jinjyaleft_right[i])+abs(jinjyaleft_right[i]-teraleft_right[j]))
  minlist.sort() 
  print(minlist[0])

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	vll v(3);
	rep(i,3) cin >> v[i];
	sort(all(v));
	rep(i,3) cout << v[i] << (i==2?"\n":" ");
	return 0;
}


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x;
string s;

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



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	vll a(n);
	multiset<ll,greater<ll>> val;
	for(ll i=0;i<n;i++) cin>>a[i];
	for(ll i=0;i<n;i++) {
		cin>>x;
		val.insert(a[i]-x);
	}

	ll sum = 0;
	for(auto it : val) {
		if(it <= 0) break;
		sum += it;
	}

	cout<<sum;
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {

		MAIN();
	}
	return 0;
}


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

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

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

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

  // LW[i]:i番目の人よりLeft にいる人のうち、Wを向いている人の数
  // RE[i]:i番目の人よりRightにいる人のうち、Lを向いている人の数
  // 求める答えは、LW[i]+RE[i]のうち最小のもの
  vi LW(n),RE(n);

  // LW の決定。LW[0]=0 としてよい
  for (int i = 1; i < n; i++) {
    if(s[i-1]=='W') LW[i] = LW[i-1] + 1;
    else LW[i] = LW[i-1];
  }
  // RE の決定。RE[n-1]=0
  for (int i = n-2; i >= 0; i--) {
    if(s[i+1]=='E') RE[i] = RE[i+1] + 1;
    else RE[i] = RE[i+1];
  }

  int ans = 1e9;
  rep(i, n) chmin(ans,LW[i]+RE[i]);
  std::cout << ans << '\n';
}


Measured memory_bytes: 2948
#include <bits/stdc++.h>
using namespace std;
double getExpection(vector<double> &expection, vector<vector<int>> &passages, int i) {
  for (int j = i; j >= 0; j--) {
    expection[j] = 0;
    int total = passages[j].size();
    for (int next : passages[j]) {;
      expection[j] += expection[next] / total;
    }
    expection[j]++;
  }
  return expection[0];
}
int main()
{
  int N, M;
  cin >> N >> M;
  vector<vector<int>> passages(N);
  for (int i = 0; i < M; i++) {
    int si, ti;
    cin >> si >> ti;
    passages[si - 1].push_back(ti - 1);
  }
  vector<double> expection(N, 0);
  double min_expection = getExpection(expection, passages, N - 2);
  for (int i = 0; i < N; i++) {
    if (passages[i].size() <= 1) {
      continue;
    }
    int max_next = passages[i][0];
    for (int next : passages[i]) {
      if (expection[next] > expection[max_next]) {
        max_next = next;
      }
    }
    int total = passages[i].size() - 1;
    expection[i] = 0;
    for (int next : passages[i]) {
      if (next == max_next) {
        continue;
      }
      expection[i] += expection[next] / total;
    }
    expection[i]++;
    double cur_expection = getExpection(expection, passages, i - 1);
    min_expection = min(min_expection, cur_expection);
  }
  cout << setprecision(10) << min_expection << endl;
  return 0;
}

Measured memory_bytes: 1408
#include <string>
#include <vector>
#include <map>
#include <deque>
#include <iostream>
#include <queue>
#include <math.h>
#include <algorithm>
#include <fstream>

using namespace std;
typedef long long ll;


int main(void) {
	char s[3], t[3];
	for (int i = 0; i < 3; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < 3; i++) {
		cin >> t[i];
	}

	int count = 0;
	for (int i = 0; i < 3; i++) {
		if (s[i] == t[i]) {
			count++;
		}
	}
	cout << count;
	return 0;

}

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;

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

constexpr long long mod = 1000000007;

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

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

    int n, k;
    cin >> n >> k;

    vi a(n);
    rep(i, n) cin >> a[i];

    vector<double> v(n + 1, 0);
    for (int i = 0; i < n; i++) {
        v[i + 1] = 0.5 * a[i] * (a[i] + 1) / a[i] + v[i];
    }

    double ans = 0.0;

    for (int i = k; i <= n; i++){
        ans = max(v[i] - v[i - k], ans);
    }
    printf("%.9lf\n", ans);
}

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

using namespace std;
typedef long long ll;

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

int main()
{
    int h, w;
    cin >> h >> w;

    vector<string> a(h);
    rep(i, h) cin >> a[i];
    rep(i, w + 2) cout << '#';
    cout << '\n';
    rep(i, h)
    {
        cout << '#';
        cout << a[i];
        cout << '#' << '\n';
    }
    rep(i, w + 2) cout << '#';
    cout << '\n';
    return 0;
}


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

int main(){
  int n; cin >> n;
  vector<int> p;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    if(a == i + 1) p.push_back(a);
  }
  int ans = p.size();
  for(int i = 0; i < p.size(); i++){
    if(i+1 < p.size() && p[i] == p[i+1] - 1){
      ans--;
      i++;
    }
  }
  cout << ans << endl;
}


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

#define ll long long
#define EPSION numeric_limits<double>::epsilon()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

//ifstream f("input.in");
//ofstream g("output.out");

signed main(int argc, char **argv)
{
    IOS;
    int n, m, c, t, ans = 0;
    cin>>n>>m>>c;
    int b[m], a[m];

    for(int i = 0; i < m; ++i)
        cin>>b[i];

    for(int i = 0; i < n; ++i)
    {
        int sum = 0;
        for(int j =0; j < m; ++j)
        {
            cin>>t;
            sum += b[j] * t;
        }
        if(sum + c > 0)
            ans++;
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    vector<int> p(k,0);
    while(n>0)
        for(int i=0;i<k;i++)
            if(n>0){p[i]++; n--;}
    cout << *max_element(p.begin(),p.end()) - *min_element(p.begin(),p.end()) << endl;
    return 0;
}

Measured memory_bytes: 256
L,R=(int(x) for x in input().split())

def Solve():
    if R-L>=672: #3*673=2019
        return 0
    
    result=2*10**9
    for i in range(L,R+1):
        for j in range(L,R+1):
            if j==i:
                continue
            result=min(result,(j*i)%2019)

    return result
    
print(Solve())
        


Measured memory_bytes: 2940
#include <stdio.h>
#include <ctype.h>

int main(void)
{
    char s[1200];
    int i = 0;
    char c;

    while ((c = getchar()) != EOF) {
        char u_c, l_c;
        u_c = toupper(c);
        l_c = tolower(c);

        if (c != u_c) s[i] = u_c;
        else if (c != l_c) s[i] = l_c;
        else s[i] = c;

        i++;
    }

    s[i] = '\0';

    printf("%s", s);

    return 0;
}

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

int main(){

    string S;
    cin >> S;

    long long count = 0;
    int left = 0;
    for(int i = 0; i < S.length(); i++){
        if(S[i] == 'W'){
            count += i - left;
            left++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 640
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long m = long.Parse(input[1]);
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
    long[] numsSub = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);

    long height = 0;
    long width = 0;
    long mod = 1000000007;
    long answer = 1;

    for(int i = 0; i < n-1; i++)
    {
      height += (i+1)*(n-1-i)*(nums[i+1]-nums[i]);
      height %= mod;
    }

    for(int i = 0; i < m-1; i++)
    {
      width += (i+1)*(m-1-i)*(numsSub[i+1]-numsSub[i]);
      width %= mod;
    }

    answer = height * width;
    answer %= mod;
    
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 33868
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int main()
{
    ll h;
    cin >> h;
    ll tmp = 2;
    ll cnt = 1;
    while(tmp < h+1){
        cnt++;
        tmp *= 2;
    }
    ll ans = 1;
    for(int i = 0; i < cnt; i++){
        ans *= 2;
    }
    cout << ans -1;
}

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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << max({a * c, b * d, a * d, b * c}) << endl;
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define LL long long
#define inf 0x3f3f3f3f
#define eps 1e-15
inline int read() {
    res s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') {
        if(ch=='-')w=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')s=s*10+ch-'0',ch=getchar();
    return s*w;
}
inline void write(res x) {
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
inline int _max(res x,res y) {
    return x>y?x:y;
}
inline int _min(res x,res y) {
    return x>y?y:x;
}
const int N=100+10;
int n,a[N],ans;
bool mag[N];
int main(){
	n=read();
	for(res i=1;i<=n;i++)a[i]=read();
	for(res i=1;i<=n;i++)
		if(a[i]==a[i-1]&&!mag[i-1])mag[i]=1,ans++;
	write(ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

long int f(long int b){
    if( b % 4 == 0 ) return b;
    if( b % 4 == 1 ) return 1;
    if (b % 4 == 2 ) return b+1;
    if (b % 4 == 3 ) return 0;
}

int main(void){
    long int a,b;
    scanf("%ld%ld",&a,&b);
    if( a != b){
        printf("%ld\n",f(a-1) ^ f(b) );
    }else{
        printf("%ld\n",f(b));
    }

    return 0;
}

Measured memory_bytes: 128
N,A,B=list(map(int,input().split()))
H = [int(input()) for _ in range(N)]

def can_eliminate(n): #O(N)
  H_ = [((h-B*n)+A-B-1)//(A-B) for h in H if h>B*n]
  if sum(H_)<=n:
    #print('can eliminate by ' + str(n) +'times')
    return True
  else:
    #print('can not eliminate by ' + str(n) +'times')
    return False
    
def binary_search(l,r): #r:inclusive
  #print('search between ' + str((l,r)))
  if r==l+1:
    if can_eliminate(l):
      return l
    else:
      return r
  
  c = (l+r)//2
  if can_eliminate(c):
    return binary_search(l,c)
  else:
    return binary_search(c,r)
  
print(binary_search(1, (sum(H)+2*B+1)//B))

Measured memory_bytes: 11060
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N; cin>>N;
    for(int i=0;i<=50;i++){
        for(int j=0;j<=14;j++){
            if(N==4*i+7*j){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#define rep(i,N) for(int i = 0; i < (int)(N); i++)
using namespace std;

int main(){
        string str1 = "qazwsxedcrfvtgb";
        string str2 = "yhnujmikolp";

        map<char,bool> left;
        map<char,bool> right;
        rep(i,str1.size()) left[str1[i]]=true;
        rep(i,str2.size()) right[str2[i]]=true;
        char lr[32];

        string input;
        while(true) {
                cin >> input;
                if(input == "#") break;
                int ans = 0;
                rep(i, input.size()){
                        if(left[input[i]] == true) {
                                lr[i] =  'l';
                        }else if (right[input[i]] == true) {
                                lr[i] =  'r';
                        }
                        if(i != 0 && lr[i-1] != lr[i]) {
                                ans++;
                        }
                }
                cout << ans << endl;
        }

        return 0;
}



Measured memory_bytes: 3120
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
A = np.array(IL())

cnt = 0
for i in range(40):
    if 1 in (A%2):
        print(cnt)
        exit()
    else:
        A //= 2
        cnt += 1

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

int main(){
  int N;
  cin >> N;
  vector<int> L(N);
  for(int i = 0; i < N; i++) cin >> L.at(i);
  sort(L.begin(), L.end());
  long long ans = 0;
  for(int i = 0; i < N-2; i++){
    for(int j = i+1; j < N-1; j++){
      int sum = L.at(i) + L.at(j);
      for(int k = N-1; k > j; k--){
        if(sum > L.at(k)){
          //cout << "L.at(i) = " << L.at(i) << ", L.at(j) = " << L.at(j) << endl;
          ans += k-j;
          break;
        }
      }
    }
  }
  cout << ans << endl;
}


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

const int N = 1e5 + 5, mod = 1e9 + 7;
int n, m;
int a[N];

int main()
{
    //ios::sync_with_stdio(false);cin.tie(nullptr);ios_base::sync_with_stdio(false);
    cin >> n >> m;
    ll ans = 0;
    int last = 0;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> q;
    priority_queue<pair<int, int>> v;
    while (m--)
    {
        int x, y;
        cin >> x >> y;
        v.push({y, x});
    }
    while (!v.empty() && last < n)
    {
        pair<int, int> cur = v.top();
        v.pop();
        while (last < n && cur.second > 0 && a[last] < cur.first)
            a[last++] = cur.first,
            cur.second--;
    }
    for (int i = 0; i < n; i++)
        ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4680
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void)
{
    int r, g, b;
    scanf("%d %d %d", &r, &g, &b);

    int n = g*10 + b;
    if (n%4 == 0) printf("YES\n");
    else printf("NO\n");

    
    return 0;
} 



Measured memory_bytes: 128
#include <iostream>

using namespace std;

const int kMax = 100;

int main () {
    int w, h, n;
    bool region[kMax][kMax] = {false};

    cin >> w >> h >> n;

    int x, y, a;
    int x_0, x_1, y_0, y_1;

    for (int i = 0; i < n; i++) {
        cin >> x >> y >> a;
        if (a == 1) {
            x_0 = 0;
            x_1 = x;
            y_0 = 0;
            y_1 = h;
        }
        else if (a == 2) {
            x_0 = x;
            x_1 = w;
            y_0 = 0;
            y_1 = h;
        }
        else if (a == 3) {
            x_0 = 0;
            x_1 = w;
            y_0 = 0;
            y_1 = y;
        }
        else if (a == 4) {
            x_0 = 0;
            x_1 = w;
            y_0 = y;
            y_1 = h;
        }

        for (int j = x_0; j < x_1; j++) {
            for (int k = y_0; k < y_1; k++) {
                region[j][k] = true;
            }
        }
    }

    int ans = 0;

    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            if (region[i][j] == false) {
                ans++;
            }
        }
    }

    cout << ans << endl;
}

        


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <numeric>
#include <string>
#include <map>
#include <queue>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;
typedef long long ll;


int main(){
        ll N;
        cin >> N;
        cout << "ABC" << N;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long dp[100006];
int main()
{
	long long n;
	cin>>n;
	vector<long long> v(n);
	for(int i=0;i<n;i++)
	{
		cin>>v[i];
	}
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for (int i=2;i<n;i++)
	{
		dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	cout<<dp[n-1]<<endl;
}

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

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

    vector<int> v(n), x(n, 0);

    for(auto& y : v) cin >> y;
    for(int i = 0; i < n; ++i) v[i] -= i, x[i] -= i;

    long long rez = 0;
    while(!v.empty() && !x.empty()){
        if(v.size() < x.size()){
            x.pop_back();
            continue; }

        if(v.back() == x.back()){
            v.pop_back();
            continue; }

        if(v.back() != x.back()){
            while(!x.empty() && v.back() != x.back()){
                x.pop_back(); }
            if(!x.empty()) rez += v.size() - x.size(); } }

    if(x.empty() && !v.empty()){
        cout << -1;
        return 0; }

    cout << rez << endl;
    return 0; }


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

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

int main(){
    int x,y;
    cin>>x>>y;
    cout<<x+y-gcd(x,y)+1<<endl;
    return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max({a * d, b * c, a * c, b * d}) << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
    
#define int long long
    
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
#define MOD (int)(1e9)+7
    
using namespace std;
    
int dy[4]={1, 0, -1, 0};
int dx[4]={0, 1, 0, -1};
    
int32_t main(){
    int x[2], y[2];
    REP(i, 2) cin >> x[i] >> y[i];

    int h = y[1]-y[0];
    int w = x[1]-x[0];

    cout << x[1]-h << " " << y[1]+w << " " << x[1]-h-w << " " << y[1]+w-h << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	static	int count = 0;
	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int ans = 0;
			if(N / 10 == 9 || N % 10  == 9){
				System.out.println("Yes");
				return;

			}
	
		
			
			System.out.println("No");
		


	}

}

class Pair implements Comparable{
	int from;
	int middle;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 21460
#include<iostream>
using namespace std;
int main(){
    int x;
    int i = 1;
    
    while(1){
        cin >> x;
        if(x == 0) break; 
        else cout << "Case" << " " << i << ":" << " " << x << endl;
        i += 1;
        
    }
    
    
    return 0;
}


Measured memory_bytes: 3068
#include <stdio.h>
#include <string.h>

int main(void) 
{
    char input[1001];
    int len, i, j, dir[4];

    for (i = 0; i < 4; i++) {
        dir[i] = 0;
    }
    scanf("%s", input);
    len = strlen(input);
    for (i = 0; i < len; i++) {
        if (input[i] == 'W') {
            dir[0] = 1;
        } else if (input[i] == 'N') {
            dir[1] = 1;
        } else if (input[i] == 'S') {
            dir[2] = 1;
        } else if (input[i] == 'E') {
            dir[3] = 1;
        }
    }
    if (dir[0] == dir[3] && dir[2] == dir[1]) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}
 
    


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[300][2],a,b,sum;
main(){
  cin>>a>>b;
  dp[0][1]=1;
  for(int i=0;i<=100;i++){
    for(int j=0;j<2;j++){
      if(dp[i][j]){
        if(j)dp[i+b][j^1]+=dp[i][j];
        dp[i+1][j^1]+=dp[i][j];
      }
    }
  }
  for(int i=1;i<=a;i++) sum+=dp[i][0];
  cout<<sum<<endl;
}

Measured memory_bytes: 3100
require 'prime'

n = gets.to_i
cnt = 0

Prime.prime_division(n).each do |x, y|
  tmp_cnt = 0
  d = 1
  while y > 0
    tmp_cnt += 1 if y - d >= 0
    y -= d
    d += 1
  end
  cnt += tmp_cnt
end

p cnt

Measured memory_bytes: 14428
kingaku = int(input())

en500 =0
amari = 0
en5 =0

kotae= divmod(kingaku,500)
en500 = int(kotae[0]) * 1000
amari = int(kotae[1])

kotae2= divmod(amari,5)
en5 = kotae2[0] *5

print(en500+en5)

Measured memory_bytes: 3060
N = int(input())

S = []
for _ in range(N):
    s = int(''.join(input().split()), 2)
    S.append(s)

P = []
for _ in range(N):
    p = [int(i) for i in input().split()]
    P.append(p)

ans = -10**20
for i in range(1, 2 ** 10):
    c = 0
    for j in range(N):
        c += P[j][bin(S[j] & i).count('1')]
    ans = max(ans, c)

print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <map>
#include <sstream>
#define ll long long
using namespace std;
// ver..(1.1)
string ent="\n";
string space=" ";
      
      ll arr[100010];
int main(){
   	ios_base::sync_with_stdio(false);
      bool arr[5]={};
      int n;
      cin >> n;
      arr[n]=true;
      cin >> n;
      arr[n]=true;

      for(int i=1;i<=3;i++){
         if(!arr[i]) cout << i << '\n';
      }

}
/*


*/

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

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

    bool is_t = true;
    while (A > 0 && B > 0) {
        if (is_t) {
            C -= B;
        }
        else {
            A -= D;
        }
        is_t ^= true;
    }

    cout << (C <= 0 ? "Yes\n" : "No\n");

    return 0;
}

Measured memory_bytes: 3612
import java.io.*;

public class Main{
  public static void main(String... args) throws IOException {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    String line = stdin.readLine();
    String[] in = line.split(" ");
    int n = Integer.parseInt(in[0]);
    System.err.println(n);
    int beginB = 0;
    int endA = 0;
    int naka = 0;
    boolean sep = false;
	for (int i=0; i<n; i++) {
	  line = stdin.readLine();
      boolean begin = line.charAt(0) == 'B';
      if (begin) {
        beginB++;
      }
      boolean end = line.charAt(line.length() - 1) == 'A';
      if (end) {
        endA++;
      }
      if ((begin ^ end) && !sep) {
        sep = true;
      }
      naka += line.split("AB").length - 1;
    }
    System.err.println(beginB);
    System.err.println(endA);
    System.err.println(naka);
    System.err.println(sep);
	
    int ret;
    if (sep || beginB == 0) {
      ret = naka + Math.min(beginB, endA);
    } else {
      ret = naka + beginB - 1;
    }
    System.out.println(ret);
  }
}

Measured memory_bytes: 32464
//Don't be late 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    double d,t,s;cin>>d>>t>>s;
    if(d/s<=t)cout<<"Yes"<<nnn;
    else cout<<"No"<<nnn;
    return 0;
}

Measured memory_bytes: 3728
#include <iostream>
#include <numeric>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
const ll MOD=1000003;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const vector<pll> dir={{0,1},{1,0},{-1,0},{0,-1},{1,1},{-1,1},{1,-1},{-1,-1}};
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=b-1;i>=a;i--)
#define range(i) (i).begin(),(i).end()
#define rrange(i) (i).rbegin(),(i).rend()
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm (ll a,ll b) {return a*b/gcd(a,b);}
inline constexpr int intpow(ll a,ll b){
    if(b==0) return 1;
    ll ans=intpow(a,b/2);
    return ans*ans%MOD*(b&1?a:1)%MOD;
}
inline constexpr int modf(ll n){
    ll ans=1;
    rep(i,0,n) {ans=ans*(n-i)%MOD;}
    return ans;
}
inline long double median(vector<ll> v){
    ll size=v.size();
    sort(v.begin(),v.end());
    if (size % 2 == 1) return v[(size - 1) / 2];
    else return v[(size / 2) - 1] ;
}
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;}
template<class T,class L>ostream& operator << (ostream& os, pair<T,L>& p){os << p.first << " " << p.second;return os;}

int main(){
  vector<char> s(4);
  rep(i,0,4) cin>>s[i];
  sort(range(s));
  ll f=0;
  if(s[0]!=s[1]) f=1;
  if(s[1]==s[2]) f=1;
  if(s[2]!=s[3]) f=1;
  if(f) cout<<"No";
  else cout<<"Yes";
}


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

// See debug.cc for usage etc
#define DEBUG 0

template <class... Args>
string dbgFormat(const char* fmt, Args... args) {
  size_t len = snprintf(nullptr, 0, fmt, args...);
  char buf[len + 1];
  snprintf(buf, len + 1, fmt, args...);
  return string(buf);
}

#if DEBUG
  #define DLOG(...)        cerr << dbgFormat(__VA_ARGS__) << endl
  #define DCALL(func, ...) func(__VA_ARGS__)
#else
  #define DLOG(...)
  #define DCALL(func, ...)
#endif

ll N, M;
vector<vector<ll>> nbr;
ll S, T;

ll enc(ll level, ll i) { return level * N + (i-1); }
ll nl(ll level) { return (level + 1) % 3; }

int main() {
#if !DEBUG
  ios_base::sync_with_stdio(false);
#endif
  cout << setprecision(20);

  cin >> N >> M;
  nbr.resize(3*N);
  for (ll i = 0; i < M; i++) {
    ll u, v;  cin >> u >> v;
    for (ll level = 0; level < 3; level++) {
      nbr.at(enc(level, u)).push_back(enc(nl(level), v));
    }
  }
  cin >> S >> T;

  vector<ll> dist(3*N, -1);
  vector<bool> done(3*N);
  queue<ll> que;
  dist.at(enc(0, S)) = 0;
  que.push(enc(0, S));
  while (!que.empty()) {
    ll x = que.front(); que.pop();
    DLOG("qtop = %lld", x);
    if (done.at(x)) continue;
    for (ll y : nbr.at(x)) {
      if (dist.at(y) >= 0) continue;
      dist.at(y) = dist.at(x) + 1;
      que.push(y);
    }
    done.at(x) = true;
  }
  ll z = dist.at(enc(0, T));
  ll ans = z < 0 ? -1 : z / 3;
  cout << ans << endl;


  return 0;
}



Measured memory_bytes: 19072