akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

void ans(bool flag){
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main(){
    int n;
    cin >> n;
    vector<pair<int, int>> v;
    bool flag = true;
    int a, b;
    rep(i,n){
        cin >> a >> b;
        v.push_back(make_pair(b, a));
    }
    sort(v.begin(), v.end());
    int time = 0;
    rep(i,n){
        time += v[i].second;
        if (time > v[i].first){
            flag = false;
            break;
        }
        /* else {
            int rest = v[i].first - time;
            int j = i + 1;
            while(v[j].second != 0 && rest > 0 && j < n - 1){
                if (v[j].second >= rest)
                    v[j].second -= rest;
                else{
                    v[j].second = 0;
                    rest -= v[j].second;
                }
            }
        }  */
    }
    ans(flag);
    return 0;
}

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

int main(){
    long long int a,b,x;

    cin >> a >> b >> x;

    if(a == 0){
        cout << b / x + 1 << '\n';
    }
    else{
        cout << b / x - (a - 1) / x << '\n';
    }

    return 0;
}

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


public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		while(true){
			int sum=0, n = Integer.parseInt(in.readLine());
			if(n==0){
				break;
			}
			int[] s = new int[n];
			String[] nums = in.readLine().split(" ");
			for(int i=0; i<n; i++){
				s[i] = Integer.parseInt(nums[i]);
				sum += s[i];
			}
			double aveM = (double)sum/n;
			double process=0;
			for(int si : s){
				process += (double)(Math.pow(si-aveM, 2));
			}
			double dev = (double) Math.sqrt(process/n);
			System.out.println(dev);
		}
	}
}

Measured memory_bytes: 17828
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl a(n),b(n);
    rep(i,n)cin >> a[i];
    rep(i,n)cin >> b[i];
    ll d=accumulate(all(b),0LL)-accumulate(all(a),0LL);
    ll cnt=0;
    rep(i,n){
        if(a[i]<b[i])cnt+=(b[i]-a[i]+1)/2;
    }
    if(cnt<=d)cout << "Yes" <<endl;
    else cout <<"No" <<endl;
} 

Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextInt();
        int count = 0;
        boolean[] array = new boolean[s.length()];
        for (int i = 1; i < s.length(); i++) {
            if (s.charAt(i - 1) == s.charAt(i) && !array[i - 1]) {
                count++;
                array[i] = true;
            }
        }
        long ans = k * count;
        if (s.charAt(0) == s.charAt(s.length() - 1) && !array[s.length() - 1] && k > 1) {
            if (s.length() == 1) {
                ans = k / 2;
            } else {
                int recount = 1;
                array = new boolean[s.length()];
                for (int i = 2; i < s.length(); i++) {
                    if (s.charAt(i - 1) == s.charAt(i) && !array[i - 1]) {
                        recount++;
                        array[i] = true;
                    }
                }
                if (!array[s.length() - 1]) {
                    ans = count;
                    ans += recount * (k - 1);
                } else {
                    ans /= 2;
                    ans += recount * k / 2;
                }
            }
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23764
#include <iostream>

#include <vector>

#include <algorithm>

#include <sstream>

#include <string>

#include <cmath>

#include <list>

#include <set>
#include <cstdlib>
using namespace std;

int in() {int x; cin >> x; return x;}

template <typename T> class SegTree

{

public:

	int n;

	T T_max;

	vector<T> dat;

	SegTree(int n_, T t_max)

	{

		int n = 1;

		T_max = t_max;

		while (n < n_)n *= 2;

		for (int i = 0; i < 2 * n - 1; i++)dat.push_back(t_max);

	}

	void update(int k, T a)

	{

		k += n - 1;

		dat[k] = a;

		while (k > 0)

		{

			k = (k - 1) / 2;

			dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);

		}

	}



	//[a,b)

	T query(int a, int b)

	{

		return _query(a, b, 0, 0, n);

	}



private:

	T _query(int a, int b, int k, int l, int r)

	{

		if (r <= a || b <= l)return T_max;

		if (a <= l && r <= b)return dat[k];

		else

		{

			T vl = _query(a, b, k * 2 + 1, l, (l + r) / 2);

			T vr = _query(a, b, k * 2 + 2, (l + r) / 2, r);

			return min(vr, vl);

		}

	}

};


int main()
{
	int n;
	while (cin >> n && n)
	{
		vector<long long> a; a.push_back(0);
		long long ans = -999999999999;
		for (long long i = 0; i < n; i++)
		{
			a.push_back(in());
		}

		for (long long i = 1; i < n + 1; i++)
		{
			a[i] += a[i - 1];
		}

		for (long long l = 0; l < n + 1; l++)
		{
			for (long long r = l + 1; r < n + 1; r++)
			{
				ans = max(ans, a[r] - a[l]);
			}
		}
		cout << ans << endl;


	}
}

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

void time()
{
    //ifstream myfile;
    //myfile.open("sample.txt");

    float D;
    float T;
    float S;
    
    cin >> D >> T >> S;

    float time_taken = D/S;

    (time_taken <= T)?cout << "Yes":cout << "No";
    return;
}

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

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int a,b;
    cin>>a>>b;
    int ans = 0;
    for (int i=a;i<=b;i++) {
        string s,r;
        s = to_string(i);
        r = s;
        reverse(ALL(r));
        if (s == r) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <pair <ll, ll>, ll>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()

typedef long long ll;

typedef long double ld;

using namespace std;

const ll maxn = 1e6;

ll n, m, k, t;

vector <pll> A;

ll L[maxn];

ll R[maxn];

map <ll, ll> ML;

map <ll, ll> MR;

set <ll> SL;

set <ll> SR;

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    cin >> n;
    // A.resize(n);
    ll ans = 0;
    for (q = 0; q < n; q++) {
        cin >> a >> b;
        A.pb(mp(a, b));
        ML[a]++;
        if (ML[a] == 1) {
            SL.insert(-a);
        }
        MR[b]++;
        if (MR[b] == 1) {
            SR.insert(b);
        }
        ans = max(ans, b - a + 1);
    }
    sort(all(A));
    ll l = A[0].first, r = A[0].second;
    for (q = 0; q < n; q++) {
        l = max(l, A[q].first);
        r = min(r, A[q].second);
        // cout << q << " " << l << " " << r << " L" << endl;
        L[q] = max(r - l + 1, 0LL);
    }
    l = A.back().first; r = A.back().second;
    for (q = n - 1; q >= 0; q--) {
        l = max(l, A[q].first);
        r = min(r, A[q].second);
        R[q] = max(r - l + 1, 0LL);
    }
    for (q = 0; q + 1 < n; q++) {
        // cout << q << " " << L[q] << " " << R[q + 1] << endl;
        ans = max(L[q] + R[q + 1], ans);
    }
    for (q = 0; q < n; q++) {
        ll l = A[q].first, r = A[q].second;
        ll dans = r - l + 1;
        ML[l]--;
        if (ML[l] == 0) {
            SL.erase(-l);
        }
        MR[r]--;
        if (MR[r] == 0) {
            SR.erase(r);
        }
        ll l1 = -*SL.begin(), r1 = *SR.begin();
        dans += r1 - l1 + 1;
        ans = max(ans, dans);
        ML[l]++;
        if (ML[l] == 1) {
            SL.insert(-l);
        }
        MR[r]++;
        if (MR[r] == 1) {
            SR.insert(r);
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 30576
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();

    let n:i64 = buf.trim().parse().ok().unwrap();
    if n % 2 == 0 {
        println!("{}", n);
    } else {
        println!("{}", 2*n);
    }
}


Measured memory_bytes: 4476
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

#define PI 3.14159265358979323846
using namespace std;

int main() {
    string s;
    cin >> s;
    string t = "ABC";
    if (s == t) {
        cout << "ARC" << endl;
    }
    else {
        cout << "ABC" << endl;
    }
}

Measured memory_bytes: 3612
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        a.add(2);a.add(4);a.add(8);a.add(16);a.add(32);a.add(64);
        for(int i = scan.nextInt(); i >= 1; i--){
            if(a.contains(i)){
                System.out.println(i);
                return;
            }
        }
        System.out.println(1);
        scan.close();
    }
}

Measured memory_bytes: 27112
from collections import defaultdict
from heapq import heappush, heappop


n, k = map(int, input().split())
dic = defaultdict(list)
for _ in range(n):
    t, d = map(int, input().split())
    dic[t].append(d)

maxs = []
for key in dic:
    dic[key].sort()
    maxs.append((dic[key].pop(), key))

maxs.sort(reverse=True)
queSize = 0
que = []
queScore = 0
defaultScore = 0
cnt = 0
ans = 0
for v, key in maxs:
    defaultScore += v + cnt * 2 + 1
    cnt += 1
    if cnt >= k:
        ans = max(ans, defaultScore)
        break
    for add in dic[key]:
        heappush(que, add)
        queSize += 1
        queScore += add
    while queSize > k - cnt:
        queScore -= heappop(que)
        queSize -= 1
    ans = max(ans, defaultScore + queScore)

print(ans)


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

int compare(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

void Mysort(void* arr, int len, long unsigned int size){
    qsort(arr, len, size, compare);
}

int main(void){
    int n, m, l, r;
    scanf("%d%d", &n, &m);
    l=1;
    r=n;
    for(int i=0;i<m;i++){
        int nl, nr;
        scanf("%d%d", &nl, &nr);
        if(l < nl) l = nl;
        if(nr < r) r = nr;
        if(r < l){
            r = -1;
            l = 0;
            break;
        }
    }
    printf("%d\n", r-l+1);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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 T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



string s;
int main() {
    while (cin >> s) {
        int res = 0;
        stack<char> st;
        for (int i = 0; i < s.size(); ++i) {
            if (st.empty()) st.push(s[i]);
            else {
                char c = st.top();
                if (c == s[i]) st.push(s[i]);
                else {
                    res += 2;
                    st.pop();
                }
            }
        }
        cout << res << endl;
    }
}














Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ALL(c) begin(c), end(c)
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e6+6;

template<typename T>
struct fentsum{
	vector<T> f;
	fentsum(size_t sz): f(sz) {}
	fentsum(const vector<T> &vals): f(size(vals)) {
		for(auto i = size(vals); i--;){
			f[i]+=vals[i];
			auto j = i&(i+1);
			if(j) f[j-1]+=f[i];
		}
	}
	T sum_suf(size_t i){
		T s = T();
		for(;i<size(f);i|=i+1) s+=f[i];
		return s;
	}
	T operator()(int l, int r){
		if(l>=r) return T();
		return sum_suf(l) - sum_suf(r);
	}
	void add(int i, const T &val){
		for(;i>=0;i=(i&(i+1))-1) f[i]+=val;
	}
};




int main(){
	//freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);//cout.precision(12);cout<<fixed;
	
	int n, m;
	
	cin>>n>>m;
	vector<int> a(n);
	for(auto &_ : a) cin>>_;
	
	vector<vector<pair<int,int>>> q(n);
	vector<int> ans(m);
	for(int i=0;i<m;++i){
		int l,r;
		cin>>l>>r;
		--l; --r;
		q[r].push_back({l,i});
	}
	
	fentsum<int> f(n);
	vector<int> pos(n,-1);
	for(int r=0;r<n;++r){
		int x = a[r] - 1;
		if(pos[x]!=-1) f.add(pos[x], -1);
		f.add(r,+1);
		pos[x] = r;
		
		for(auto [l,i] : q[r]){
			ans[i] = f(l,r+1);
		}
	}
	
	for(int i=0;i<m;++i) cout<<ans[i]<<'\n';
	
	return 0;
}


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

int main() {
	string s;
	cin >> s;
	string c[] = { "NA","YYMM","MMYY","AMBIGUOUS" };
	int a = 0;
	int x = stoi(s.substr(0, 2)), y = stoi(s.substr(2));
	if (x&&x < 13) a += 2;
	if (y&&y < 13) a++;
	cout << c[a] << endl;
	return 0;
}


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

int main(){
  int a, b, c;
  int sub;
  cin >> a >> b >> c;
  if(b >= c){
    cout << b+c << endl;
  }else{
    sub = c - b - 1;
    if(sub <= a){
      cout << b+c << endl;
    }else{
      cout << a+b+1+b << endl;
    }
  }
  return 0;
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	
	vector<int> v(n);
	vector<int> c(n);
	
	for(int i = 0; i < n; i++) {
		cin >> v[i];
	}
	
	for(int i = 0; i < n; i++) {
		cin >> c[i];
	}
	
	int sum = 0;
	for(int i = 0; i < n; i++) {
		sum += max(v[i] - c[i], 0);
	}
	
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
def distance(point1, point2):
    return abs(point1[0] - point2[0]) + abs(point1[1] - point2[1])
def solve(t1, t2, point1, point2):
    t = abs(t2 - t1)
    d = distance(point1, point2)
    if d==t:
        return True
    elif d<t and t%2==d%2:
        return True
    return False

n = int(input())
t = [0]*(n+1)
xy = [[0,0]]*(n+1)
for i in range(1,n+1):
    t[i], *xy[i] = list(map(int, input().split()))
ans = True
for i in range(1, n+1):
    if not solve(t[i-1], t[i], xy[i-1], xy[i]):
        ans = False

print('Yes' if ans else 'No')

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

/* REPmacro */
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define REPR(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=(int)(m);i<(int)(n);++i)

/*alias*/
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair 

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*using*/
using ll = long long;
using ull = unsigned long long;
using unsi = unsigned;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using db = double;
using plex = complex<double>;
using vs = vector<string>;

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */

/*struct*/
struct aaa {
	aaa() {
		cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const db EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//Counterclockwise from the 9o'clock direction
//Take the x-axis downward and the y-axis right

//#define int ll
//#define int long long

signed main()
{
  int n; cin >> n;
  string s; cin >> s;
  int cntb = 0,cntr = 0;
  
  for(const auto &i: s){
    if(i == 'B'){
      ++cntb;
    }
    if(i == 'R'){
      ++cntr;
    }
  }
  
  if(cntr > cntb)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define mod2 1000000007
#define MOD 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2e9

bool compare(int a,int b)
{
    if(abs(a)>abs(b))
        return true;
    return false;
}

int main()
{
    int n,k;
    cin >> n >> k;
    vector<int>v(n);
    for(int i=0;i<n;i++)
        cin >> v[i];
    sort(v.begin(),v.end(),compare);
    int cnt=0;
    vector<int>pos,neg;
    for(int i=0;i<k;i++)
    {
        if(v[i]<0)
        {
            cnt+=1;
            neg.push_back(-v[i]);
        }
        else
            pos.push_back(v[i]);
    }
    if(cnt%2==0)
    {
        int t=1;
        for(int i=0;i<k;i++)
            t=t*1LL*v[i]%mod2;
        t=(t*1LL+mod2)%mod2;
        cout << t << endl;
    }
    else
    {
        sort(pos.begin(),pos.end());
        sort(neg.begin(),neg.end());
        int bpos=-1,bneg=1;
        for(int i=k;i<n;i++)
        {
            if(v[i]>=0)
            {
                bpos=v[i];
                break;
            }
        }   
        for(int i=k;i<n;i++)
        {
            if(v[i]<0)
            {
                bneg=v[i];
                break;
            }
        } 
        if(pos.size()==0)
        {
            if(bpos==-1)
            {
                int t=1;
                for(int i=n-1;i>n-k-1;i--)
                    t=t*1LL*v[i]%mod2;
                t=(t*1LL+mod2)%mod2;
                cout << t << endl;
            }
            else
            {
                int t=1;
                for(int i=0;i<k-1;i++)
                    t=t*1LL*v[i]%mod2;
                t=t*1LL*bpos%mod2;
                t=(t*1LL+mod2)%mod2;
                cout << t << endl;
            }
        }
        else
        {
            int p1=pos[0],n1=-neg[0];
            int res=1;
            for(int i=1;i<pos.size();i++)
                res=res*1LL*pos[i]%mod2;
            for(int i=1;i<neg.size();i++)
                res=res*1LL*-neg[i]%mod2;
            // cout << res << endl;
            // cout << bpos << " " << bneg << endl;
            if(bpos!=-1 and bneg!=1)
            {
                if(bpos*1LL*p1>bneg*1LL*n1)
                {
                    res=res*1LL*bpos%mod2;
                    res=res*1LL*p1%mod2;
                }
                else
                {
                    res=res*1LL*bneg%mod2;
                    res=res*1LL*n1%mod2;
                }
            }
            else if(bpos!=-1)
            {
                res=res*1LL*bpos%mod2;
                res=res*1LL*p1%mod2;
            }
            else if(bneg!=1)
            {
                res=res*1LL*bneg%mod2;
                res=res*1LL*n1%mod2;
            }
            else
            {
                res=res*1LL*p1%mod2;
                res=res*1LL*n1%mod2;
            }
            res=(res*1LL+mod2)%mod2;
            cout << res << endl;
        }
    }
}

Measured memory_bytes: 5028
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(void)
{
    char X, Y;
    int x, y;

    scanf("%c", &X);
    scanf("%c", &Y);
    scanf("%c", &Y);

    if(X == 'A')
        x = 10;
    if(X == 'B')
        x = 11;
    if(X == 'C')
        x = 12;
    if(X == 'D')
        x = 13;
    if(X == 'E')
        x = 14;
    if(X == 'F')
        x = 15;

    if(Y == 'A')
        y = 10;
    if(Y == 'B')
        y = 11;
    if(Y == 'C')
        y = 12;
    if(Y == 'D')
        y = 13;
    if(Y == 'E')
        y = 14;
    if(Y == 'F')
        y = 15;

    if(x > y)
        printf(">");
    else if(x < y)
        printf("<");
    else
        printf("=");

    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll a[5];
int main(void){
  int n;
  scanf("%d",&n);
  char s[11],c[6]="MARCH";
  FOR(n){
    scanf("%s",s);
    FORJ(5)if(s[0]==c[j])a[j]++;
  }
  ll ans=0;
  FOR(3)for(int j=i+1;j<4;j++)for(int k=j+1;k<5;k++)ans+=a[i]*a[j]*a[k];
  PRL(ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define eps 1e-6
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n>>a;
 // ll ar[n+2]={0};
 vector<ll>ar(n+2);
  //ll br[n]={0};
  vector<ll>br(n);
  ar[n]=1;
 // ar[n-1]=1;
  while(a--)
  {
    cin>>m;
    br[m]=1;
  }
  per(i,n-1,-1)
  {
    if(br[i]) continue ;
    ar[i]=(ar[i+1]+ar[i+2])%l;
  }
  cout<<ar[0];
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
   //cin>>t;
    while(t--)
    {
      solve();
    }
    return 0;
}

Measured memory_bytes: 4788
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
#define itn int
#define all(c) c.begin(),c.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;

const ll N = 1e6 + 5, inf = 1e18, mod = 1e9 + 7;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31,30, 31, 31, 30, 31, 30, 31};

template<typename T>
ostream& operator<< (ostream& out, const vector<T>& mas) {
    for (const auto& x : mas) {
        out << x << ' ';
    }
    out << '\n';
    return out;
}

bool is_prime(ll n) {
    for (ll i = 2; i * i <= n; ++i) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

inline ll getPow(ll a, ll b) {
    ll res = 1ll, tp = a;
    while (b){
        if (b&1ll) {
            res *= tp;
        }
        tp *= tp;
     //   tp %= mod; res %= mod;
        b >>= 1ll;
    }
    return res;
}

ll vec_mult(const pll & t1, const pll & t2, const pll & t3) {
    const ll & x1 = t1.first, y1 = t1.second;
    const ll & x2 = t2.first, y2 = t2.second;
    const ll & x3 = t3.first, y3 = t3.second;
    return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
}

void ok() {
    cout << "YES" << '\n';
}

void no() {
    cout << "NO" << '\n';
}

inline ll nxt() {
    ll x;
    cin >> x;
    return x;
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int n = nxt(), m = nxt();
    vector<pii> ab(n); 
    multiset<int> buf;
    for (int i = 0; i < n; i++) {
        int x = nxt(), y = nxt(); 
        ab[i] = {x, y};
    }
    sort(ab.begin(), ab.end());
    int ind = 0;
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        while (ind < n && i >= ab[ind].first) {
            buf.insert(ab[ind].second);
            ind++;
        }
        if (buf.size()) {
            ans += *buf.rbegin();
            buf.erase(buf.find(*buf.rbegin()));
        }
    }
    cout << ans;
    
    return 0;
}


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

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

    int ans = a + a*a + a*a*a;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
import math
import itertools

# a = 6
# b = 4
#
# print(math.gcd(a, b))
k = int(input())
kk = k + 1
ans = 0
for i in range(1, kk):
    # print(i)
    for ii in range(1, kk):
        # print(ii)
        for iii in range(1, kk):
            # print((i,ii,iii))
            gcd2 = math.gcd(ii, iii)
            gcd3 = math.gcd(i, gcd2)
            ans += gcd3

print(ans)


Measured memory_bytes: 67920
import sys
a, b, k = map(int, input().split())

if a == 1 or b == 1:
    print(1)
    sys.exit(0)

def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x % y)

s = gcd(a, b)
count = 0
for i in range(1, s + 1):
    if s % i == 0:
        count += 1
    if count == k:
        print(s // i)
        break


Measured memory_bytes: 3060
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

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

    vector<Int> sorted(a);
    sort(sorted.begin(), sorted.end());

    // + start
    Int temA, ansA = 0;
    if (a[0] == 0) {
        temA = 1;
        ansA += 1;
    } else if (a[0] < 0) {
        temA = 1;
        ansA += abs(a[0]) + 1;
    } else {
        temA = a[0];
    }
    for (int i = 1; i < n; i++) {
        if (i % 2 == 1) {
            if (temA + a[i] == 0) {
                temA = -1;
                ansA += 1;
            } else if (0 < temA + a[i]) {
                ansA += abs(temA + a[i]) + 1;
                temA = -1;
            } else {
                temA += a[i];
            }
        } else {
            if (temA + a[i] == 0) {
                temA = 1;
                ansA += 1;
            } else if (temA + a[i] < 0) {
                ansA += abs(temA + a[i]) + 1;
                temA = 1;
            } else {
                temA += a[i];
            }
        }
    }

    // - start
    Int temB, ansB = 0;
    if (a[0] == 0) {
        temB = -1;
        ansB += 1;
    } else if (0 < a[0]) {
        temB = -1;
        ansB += abs(a[0]) + 1;
    } else {
        temB = a[0];
    }
    for (int i = 1; i < n; i++) {
        if (i % 2 == 0) {
            if (temB + a[i] == 0) {
                temB = -1;
                ansB += 1;
            } else if (0 < temB + a[i]) {
                ansB += abs(temB + a[i]) + 1;
                temB = -1;
            } else {
                temB += a[i];
            }
        } else {
            if (temB + a[i] == 0) {
                temB = 1;
                ansB += 1;
            } else if (temB + a[i] < 0) {
                ansB += abs(temB + a[i]) + 1;
                temB = 1;
            } else {
                temB += a[i];
            }
        }
    }

    cout << min(ansA, ansB) << endl;

    return 0;
}


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

using namespace std;

int main() {
  string S;

  cin>>S;

  int cnt1 = 0;
  for(int i=0; i<4; i++){
    if(S[0]==S[i]) {
      cnt1++;
    }
  }

  string s;
  for(int i=0; i<4; i++){
    if(S[0]!=S[i]) {
      s = S[i];
      break;
    }
  }

  int cnt2 = 0;
  for(int i=0; i<4; i++){
    if(s[0]==S[i]) {
      cnt2++;
    }
  }

  if(cnt1==2 && cnt2==2) {
    cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }

  return 0;
}

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

signed main(){
    int M; cin >> M;
    vector<int> b(M + 1), box(M + 1, 0);
    for(int i = 1; i <= M; i++) cin >> b[i];
    for(int i = M; i >= 1; i--){
        int number = 0;
        for(int j = i; j <= M; j += i){
            number += box[j];
        }
        number %= 2;
        if(number != b[i]) box[i] = 1;
    }
    int k = count(box.begin(), box.end(), 1);
    cout << k << endl;
    if(k == 0){
        return 0;
    }
    for(int i = 1; i <= M; i++){
        if(box[i]){
            cout << i << " ";
        }
    }
    cout << endl;
}


Measured memory_bytes: 3968
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    // There exist an index i <= min(n, m) && sj = tj && si < ti
    int n, length;
    string result = "";
    cin >> n >> length;
    vector<string> tmp(n);
    while (n > 0) {
        string curr;
        cin >> curr;
        tmp.push_back(curr);
        n--;
    }
    sort(tmp.begin(), tmp.end());

    for (auto a : tmp) {
        result += a;
    }
    cout << result << endl;
}

Measured memory_bytes: 256
package main

// Solution for https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_a

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var x int
	con.Scan(&x)
	q := 0
	if x < 600 {
		q = 8
	} else if x < 800 {
		q = 7
	} else if x < 1000 {
		q = 6
	} else if x < 1200 {
		q = 5
	} else if x < 1400 {
		q = 4
	} else if x < 1600 {
		q = 3
	} else if x < 1800 {
		q = 2
	} else {
		q = 1
	}
	con.Println(q)
	return nil
}


Measured memory_bytes: 1848
#pragma warning(disable : 4996)
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5 + 5;
vector<pii> opt[2];
int f[maxn]; //链的并查集
bool vis[maxn], used[maxn];
int find(int x)
{
    return x == f[x] ? x : f[x] = find(f[x]);
}
set<int> Set;
int main()
{
    long long nn, mm;
    scanf("%lld%lld", &nn, &mm);
    int q;
    scanf("%d", &q);
    int u, v, x;
    for (int i = 1; i <= q; i++) {
        scanf("%d%d%d", &u, &v, &x);
        opt[x].push_back(make_pair(u, v));
    }
    if (nn == 2) {
        if (opt[0].size() == 1 && q == 1)
            printf("Yes\n");
        else
            printf("No\n");
        return 0;
    }
    for (int i = 0; i < nn; i++)
        f[i] = i;
    for (auto it : opt[0]) {
        vis[it.first] = vis[it.second] = true;
        f[find(it.first)] = find(it.second);
    }
    long long sum = 0, num = 0;
    for (int i = 0; i < nn; i++)
        if (vis[i]) {
            sum++;
            if (find(i) == i)
                num++;
        }
    for (auto it : opt[1]) {
        if (vis[it.first] && vis[it.second]) {
            if (find(it.first) == find(it.second)) {
                printf("No\n");
                return 0;
            }
        }
    }
    long long lone = nn - sum;
    long long m1 = 0, m2 = 0;
    if (opt[1].size() == 0) {
        m1 = sum - num;
        m2 = sum - num + (lone + num) * (lone + num - 1) / 2;
    } else {
        m1 = sum - num + max(3LL, num + lone);
        m2 = (num + lone) * (num + lone - 1) / 2 + sum - num;
    }
    if (mm >= m1 && mm <= m2) {
        printf("Yes\n");
    } else
        printf("No\n");
    return 0;
}


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

int main(void)
{
    long long int n;
    cin >> n;
    vector<int> ss(1,0);

    for (long long int i = 2; i*i <= n; ++i)
    {
        int x = 0;
        while(n%i == 0)
        {
            n /= i;
            ++x;
        }
        ss.push_back(x);
    }
    if(n != 1) ss.push_back(1);

    int ans = 0;

    for(int i = 0; i < ss.size(); ++i)
    {
        int j = 1;
//        cout << ss[i] << endl;
        while(j <= ss[i])
        {
            ss[i] -= j;
            ++ans;
            ++j;
        }
    }

    cout << ans << endl;


    

    return 0;
}



Measured memory_bytes: 7460
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a % 2 == 0 || b % 2 == 0)
	{
		cout <<"Even" << endl;
	}
	else
	{
		cout << "Odd" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
#define abs(X) ((X) < 0 ? -1 * (X) : (X))

using namespace std;

int main()
{
    long long n;
    long long ans = 1ll << 60ll;

    cin >> n;

    do {
        ans = min(abs(753 - (n % 1000)), ans);

        n = n / 10;
    } while (n / 100 >= 1);

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<int> v1(25, 0);
	v1[0] = v1[24] = 1;
	rep(i, n) {
		int d; cin >> d;
		++v1[d];
	}
	if (v1[0] > 1) {
		cout << 0 << endl;
		return 0;
	}
	int res = 0;
	rep(i, pow(2, 12)) {
		vector<int> v = v1;
		rep(j, 12) {
			if (((i >> j) & 1) && v[j] > 0) {
				--v[j];
				++v[24 - j];
			}
		}
		int mn = 12;
		if (i == pow(2, 11)) {
			int a = 0;
		}
		for (int j = 1; j < 25; ++j) {
			int cnt = 0;
			if (v[j] > 1)mn = 0;
			else {
				while (j < 25 && v[j] == 0) {
					++cnt;
					++j;
				}
				if (v[j] > 1)mn = 0;
			}
			mn = min(mn, cnt+1);
		}

		res = max(res, mn);
	}
	cout << res << endl;
}

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

using namespace std;

#define sz(x) (int)(x.size())
#define fi(a, b) for(int i=a;i<b;++i)
#define fj(a, b) for(int j=a;j<b;++j)
#define fk(a, b) for(int k=a;k<b;++k)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;

//////////////////
int const N = 1e5 + 41;
int n;
vector<pii> a;
ll ans[N];

void solve(){
	cin >> n;
	fi(0, n){
		int v;
		cin >> v;
		a.pb(mp(v, i));
	}
	sort(a.begin(), a.end());

	if(n == 1){
		cout << a[0].first << endl;
		return;
	}

	ll sum = 0;
	int miniId = a.back().second;
	int miniVal = a.back().first;
	for(int i=n-1;i>=0;--i){
		if(a[i].first != miniVal){
			ans[miniId] += (n-1-i) * 1LL * (a[i+1].first - a[i].first);
			miniVal = a[i].first;
		}
		miniId = min(miniId, a[i].second);
		sum += a[i].first; 
	}

	ans[miniId] += n * 1LL * a[0].first;
	fi(0, n) cout << ans[i] << endl;

}


int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
#endif
	solve();

	return 0;
}

Measured memory_bytes: 2804
def mincos(n,ab):
    aball=[]
    aball+=[(ab[i][0],i+1,'a') for i in range(n)]
    aball+=[(ab[i][1],i+1,'b') for i in range(n)]
    aball.sort()
    
    ans1=sum([i[0] for i in aball[:n]])

    hen=aball[n][0]
    hen2=aball[n+1][0]
    d=set()
    t=None
    hantei=True
    for i,c,mab in aball[:n]:
        if t!=None and t!=mab:
            hantei=False
        if  c in d:
            print(ans1)
            exit()
        d.add(c)
        t=mab

    if hantei:
        print(ans1)
        exit()

    ans2=[]
    for i,c,aorb in aball[:n]:
        if aball[n][1]!=c:
            ans2+=[ans1-i+hen]
        else:
            ans2+=[ans1-i+hen2]
    print(min(ans2))
    exit()

n=int(input())
print(mincos(n,[list(map(int,input().split())) for i in range(n)]))

Measured memory_bytes: 98388
#include<stdio.h>

int main(){
    int N,Alice=0,Bob=0;
    int A[N];

    scanf("%d", &N);
    for(int i=0;i<N;i++){
        scanf("%d", &A[i]);
    }

    int temp=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(A[i]<A[j]){
                temp = A[j];
                A[j] = A[i];
                A[i] = temp;
            }
        }
    }
    for(int i=0;i<N;i++){
        if(i%2 == 0){
            Alice += A[i];
        }
        else{
            Bob += A[i];
        }
    }

    printf("%d\n",Alice-Bob);
}

Measured memory_bytes: 128
N, M, X, Y = map(int,input().split())
x = list(map(int,input().split()))
x.sort(reverse=True)
y = list(map(int,input().split()))
y.sort()
if x[0] < y[0] and X < y[0] and x[0] < Y:
    print('No War')
else:
    print('War')

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	int n, k;
	ll a[15];
	
	cin >> n >> k;
	REP(i, n) scanf("%lld", a + i);
	
	ll ans = INF;
	
	REP(s, 1<<n) {
		int cnt = 0;
		REP(i, n) if (s >> i & 1) cnt++;
		
		if (cnt < k) continue;
		
		ll cost = 0;
		ll last = 0;
		
		REP(i, n) {
			
			ll now = a[i];
			
			if (s >> i & 1) {
				if (last >= a[i]) {
					cost += last - a[i] + 1;
					now += last - a[i] + 1;
				}
			}
			chmax(last, now);
		}
		
		chmin(ans, cost);
	}
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
from math import log
N=int(input())
lp=[1 for i in range(N+1)]#ind=suuzi
for i in range(2,N+1):
    if lp[i]==1:
        for j in range(2*i,N+1,i):
            lp[j]=0
ans=1
MOD=10**9+7
for i in range(2,N+1):
    if lp[i]==1:
        count=0
        for j in range(int(log(N,i))):
            count=(count+N//(i**(j+1))%MOD)%MOD
        ans=ans*(count+1)%MOD
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
int main(void) {
	int a[101],n,i;
	scanf("%d",&n);
	for(i=n;i;i--){
		scanf("%d",&a[i]);
	}
	for(i++;i<=n;i++){
		if(i!=1){
			printf(" %d",a[i]);
		}else{
			printf("%d",a[i]);
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  int N, MA, MB;
  cin >> N >> MA >> MB;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N);
  rep(i, N) cin >> A[i] >> B[i] >> C[i];

  vector<vector<vector<int>>> DP(
      N + 1, vector<vector<int>>(401, vector<int>(401, 1e5)));
  DP[0][0][0] = 0;
  for (int i = 0; i < N; ++i) {
    for (int a = 400; a >= 0; --a) {
      if ((a + A[i]) > 400) continue;
      for (int b = 400; b >= 0; --b) {
        if ((b + B[i]) > 400) continue;
        for (int j = 0; j < N; ++j) {
          DP[j + 1][a + A[i]][b + B[i]] =
              min(DP[j + 1][a + A[i]][b + B[i]], DP[j][a][b] + C[i]);
        }
      }
    }
  }

  int answer = 1e5;
  rep(i, N) {
    for (int a = 1; a <= 400; ++a) {
      for (int b = 1; b <= 400; ++b) {
        // a : b == MA : MB
        if (a * MB != b * MA) continue;
        answer = min(answer, DP[i + 1][a][b]);
      }
    }
  }
  if (answer == 1e5)
    cout << -1 << endl;
  else
    cout << answer << endl;
  return 0;
}


Measured memory_bytes: 30140
n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
  a,b,c = map(int,input().split())
  a-=1;b-=1
  g[a].append([b,c])
  g[b].append([a,c])
q,k = map(int,input().split())
k -= 1
con = [-1] * n
con[k] = 0
stack = [k]
while stack:
  cur = stack.pop()
  for i,j in g[cur]:
    if con[i] == -1:
      con[i] = con[cur] + j
      stack.append(i)
for i in range(q):
  x,y = map(int,input().split())
  x-=1;y-=1
  print(con[x]+con[y])


Measured memory_bytes: 91168
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

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

  int n;
  string s;
  cin >> s;
  n = s.length();
  ll cnt = 0;
  ll A = 0;
  rep(i, n - 1)
  {
    if (s[i] == 'A')
    {
      A++;
    }
    else if (s[i] == 'B' && s[i + 1] == 'C')
    {
      cnt += A;
      i++;
    }
    else
    {
      A = 0;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 720
/*

                   Ø¨ÙØ³Ù’Ù…Ù Ù±Ù„Ù„ÙŽÙ‘Ù°Ù‡Ù Ù±Ù„Ø±ÙŽÙ‘Ø­Ù’Ù…ÙŽÙ°Ù†Ù Ù±Ù„Ø±ÙŽÙ‘Ø­ÙÙŠÙ…Ù
                  Ù„Ø¢ Ø§ÙÙ„ÙŽÙ‡ÙŽ Ø§ÙÙ„Ù‘Ø§ Ø§Ù„Ù„Ù‘Ù‡Ù Ù…ÙØ­ÙŽÙ…ÙŽÙ‘Ø¯ÙŒ Ø±ÙŽØ³ÙÙˆÙÙ„ Ø§Ù„Ù„Ù‘Ù‡Ù
*/

/*
    Auther:   n0oO0o0Ob(None of them)
    from  :   https://n0oo0o0ob.sleek.page/

*/




#include <bits/stdc++.h>

using namespace std;
#define endl "\n"
#define pb push_back

                                        #define noob n0oO0o0Ob
// ---------------------------------
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double db;
//----------------------------------
const ld PI = acos((ld)-1);
const int MOD = 1000000007;
//----------------------------------


int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    
    string x;
    cin >> x;
    int n = x.size();
    if(x[n-1] == 's') cout << x << "es" << endl;
    else cout << x << 's' << endl;
	
		
	return 0;
}









Measured memory_bytes: 3648
package main

import (
	"fmt"
)

func max(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func main() {
	var a, b, c, d int64
	fmt.Scan(&a, &b, &c, &d)
	ans := int64(-1000 * 1000 * 1000 * 1000 * 1000 * 1000)

	ans = max(ans, a*c)
	ans = max(ans, a*d)
	ans = max(ans, b*c)
	ans = max(ans, b*d)
	fmt.Println(ans)
}


Measured memory_bytes: 1772
from decimal import Decimal

N = int(input())

xy = [list(map(Decimal,input().split())) for i in range(N)]

cnt ={}

for i in range(N):
    xi = xy[i][0]
    yi = xy[i][1]

    for j in range(i+1,N):
        xj = xy[j][0]
        yj = xy[j][1]

        x_dif =xi-xj
        y_dif = yi-yj
        if x_dif<0:
            x_dif = -x_dif
            y_dif = -y_dif
        elif x_dif == 0:
            y_dif = abs(y_dif)

        if (x_dif,y_dif)  in cnt.keys():
            cnt[x_dif,y_dif] += 1
        else:
            cnt[x_dif, y_dif] =1

if N == 1:
    print(1)
else: print(N-max(cnt.values()))

Measured memory_bytes: 10316