akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		solver.readA(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split("\\s+");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public void readA(String str) {
		String[] strArr = str.split("\\s+");
		int[] A = new int[N + 1];
		for (int i = 1; i <= N; i++)
			A[i] = Integer.parseInt(strArr[i - 1]);
		HashSet<Integer> B = new HashSet<Integer>();
		for (int i = N; i >= 1; i--) {
			int b = A[i];
			for (int j = i * 2; j <= N; j = j + i) {
				if (B.contains(j)) {
					if (b == 0)
						b = 1;
					else
						b = 0;
				}
			}
			if (b == 1)
				B.add(i);
		}
		System.out.println(B.size());
		String sep = "";
		for (int n : B) {
			System.out.print(sep);
			if ("".equals(sep))
				sep = " ";
			System.out.print(n);
		}
		System.out.println();
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {
	}
}


Measured memory_bytes: 71840
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <set>
using ll = long long;
using graph = std::vector<std::vector<ll>>;
using wGraph = std::vector<std::vector<std::pair<ll,ll>>>;
#define rep(i,n) for (int i=0; i < int(n); i++)

using namespace std;
vector<ll> InputVec(ll N){
    vector<ll> A(N);
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    return A;
}
void OutputVec(vector<ll> A){
    for (int i = 0; i < A.size(); ++i) {
        cout << A[i] << ",";
    }
    cout << endl;
}
vector<vector<ll>> InputVec2d(ll H,ll W){
    vector<vector<ll>> A(H);
    for (int yi = 0; yi < H; ++yi) {
        A[yi] = vector<ll>(W);
    }
    for (int yi = 0; yi < H; ++yi) {
        for (int xi = 0; xi < W; ++xi) {
            cin >> A[yi][xi];
        }
    }
}

void OutputVec2d(vector<vector<ll>> A){
    for (int yi = 0; yi < A.size(); ++yi) {
        for (int xi = 0; xi < A[yi].size(); ++xi) {
            cout << A[yi][xi] << ",";
        }
        cout << endl;
    }
}
vector<vector<ll>> memo(3005);
vector<ll> a;
void init(){
    for (int i = 0; i < 3005; ++i) {
        memo[i] = vector<ll>(3005);
        for (int j = 0; j < 3005; ++j) {
            memo[i][j] = -1;
        }
    }
}

ll solve(ll si,ll gi){
    if(memo[si][gi] != -1){
        return memo[si][gi];
    }
    if(si == gi){
        memo[si][gi] = a[si];
        return memo[si][gi];
    }
    memo[si][gi] = max(a[si] - solve(si + 1,gi),a[gi] - solve(si,gi - 1));
    return memo[si][gi];
}

int main() {
    ll N;
    cin >> N;
    a = InputVec(N);
    init();
    solve(0,N-1);
    //OutputVec2d(memo);
    for (int yi = 0; yi < N + 1; ++yi) {
        for (int xi = 0; xi < N + 1; ++xi) {
            //cout << memo[yi][xi] << ",";
        }
        //cout << endl;
    }

    cout << memo[0][N-1] << endl;

}


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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
const int maxn = 1e5+5;
ll n,m;
vector<ll> a;
ll s[maxn];
bool check(ll k){
    ll cnt = 0;
    for(int i=0;i<n;i++) cnt += a.end()-lower_bound(a.begin(),a.end(),k-a[i]);
    return cnt>=m;
}
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >>  n >> m;
    rep(i,0,n){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(all(a));
    ll l=0,r=1e6;
    ll cnt=0;
    ll base;
    while(l<=r){
        ll c = (l+r)/2;
        //片方固定したときのcを超える数がm個以上のときtrue
        if(check(c)){ l=c+1,base=c;}
        else r = c-1;
    }
    //これによって、使う値の下限がわかった
    ll sum=0,num=0;
     for(int i=1;i<=n;i++) s[i] = s[i-1]+a[i-1];
    rep(i,0,n){
        ll t = lower_bound(all(a),base-a[i]) - a.begin(); //下限の数を示せる
        num += n-t;//越してる値が知りたいから
        sum += s[n] - s[t] + (n-t) * a[i]; // 相手側と自分何個かけたか
    }
    sum += (m-num) * base; // 下限の値なんこ使うか
    cout << sum << endl;

}

Measured memory_bytes: 1908
import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}
import java.lang

import scala.reflect.ClassTag

object Main {
  def get[T: ClassTag](implicit in: BufferedReader, converter: String => T): T = {
    converter(in.readLine)
  }

  def getArray[T: ClassTag](implicit in: BufferedReader, converter: String => T): Array[T] = {
    get[String].split("\\s+").map[T](converter)
  }

  implicit val idConverter: String => String = s => s
  implicit val intConverter: String => Int = s => Integer.parseInt(s)
  implicit val longConverter: String => Long = s => lang.Long.parseLong(s)

  def get[T1, T2](
                   implicit in: BufferedReader,
                   converter1: String => T1,
                   converter2: String => T2
                 ): (T1, T2) = {
    getArray[String] match {
      case Array(v1, v2) => (converter1(v1), converter2(v2))
    }
  }

  def get[T1, T2, T3](
                       implicit in: BufferedReader,
                       converter1: String => T1,
                       converter2: String => T2,
                       converter3: String => T3
                     ): (T1, T2, T3) = {
    getArray[String] match {
      case Array(v1, v2, v3) => (converter1(v1), converter2(v2), converter3(v3))
    }
  }

  implicit class TimesInt(val n: Int) {
    def times(f: Int => Unit): Unit = {
      for (i <- 0 until n) {
        f(i)
      }
    }
  }

  def main(args: Array[String]): Unit = {
    implicit val in: BufferedReader = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))
    val n = get[Int]
    val as = getArray[Long]

    if(as.contains(0L)) {
      out.println(0)
      out.flush()
      return
    }

    var product = 1L
    for (i <- as.indices) {
      if(Math.log10(product) + Math.log10(as(i)) > 18) {
        out.println(-1)
        out.flush()
        return
      }
      product *= as(i)
      if (product > 1000000000000000000L) {
        out.println(-1)
        out.flush()
        return
      }
    }

    out.println(product)

    out.flush()
  }
}

Measured memory_bytes: 68788
N, K = [int(i) for i in input().split()]
S = input()
if S[K-1] == 'A':
    x = 'a'
elif S[K-1] == 'B':
    x = 'b'
elif S[K-1] == 'C':
    x = 'c'
S = S[:K-1] + x + S[K:]
print(S)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;

void solve() {
	cin >> N;
	rep(i, 0, 100) {
		rep(j, 0, 100) {
			if(i * 4 + j * 7 == N) {
				cout << "Yes\n";
				return;
			}
		}
	}
	cout << "No\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main() {
  ll n, q;
  cin >> n;
  ll s = 0;
  unordered_map<ll, int> mp;
  rep(i, n) {
    ll a;
    cin >> a;
    if (mp.count(a))
      mp[a]++;
    else
      mp[a] = 1;
    s += a;
  }

  cin >> q;
  rep(i, q) {
    ll b, c;
    cin >> b >> c;
    if (mp.count(b) == 0) {
      cout << s << endl;
      continue;
    }

    if (mp.count(c))
      mp[c] += mp[b];
    else
      mp[c] = mp[b];

    s = s - b * mp[b] + c * mp[b];
    mp.erase(b);
    cout << s << endl;
  }

  return 0;
}

Measured memory_bytes: 6616
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
using namespace std;
#define INF (1<<30)
#define MAX_N 5010
struct state{
  int cost,pos,cnt;
  bool operator < (const state& p)const{
    return cost > p.cost;
  }
};
vector<int>G[MAX_N];
int C[MAX_N];//money
int R[MAX_N];//count
int N,K;
int d[MAX_N][MAX_N];
void dijkstra(){

  for(int i=0;i<MAX_N;i++)
    for(int j=0;j<MAX_N;j++)
      d[i][j]=INF;
  d[0][0]=0;
  priority_queue< state > Q;
  Q.push((state){0,0,0});

  while(!Q.empty()){
    state s=Q.top();Q.pop();
    if(s.cost>d[s.pos][s.cnt])continue;
    
    for(int i=0;i<(int)G[s.pos].size();i++){

      int npos=G[s.pos][i];
      int ncost=s.cost;
      int ncnt=s.cnt-1;
      if(ncnt==-1){
	ncnt=R[s.pos]-1;
	ncost+=C[s.pos];
      }
      if(ncost>=d[npos][ncnt])continue;
      d[npos][ncnt]=ncost;
      Q.push((state){ncost,npos,ncnt});
    }
    if(s.cost+C[s.pos]<d[s.pos][R[s.pos]]){
      d[s.pos][R[s.pos]]=s.cost+C[s.pos];
      Q.push((state){s.cost+C[s.pos],s.pos,R[s.pos]});
    }
  }

  int ans=INF;
  for(int i=0;i<MAX_N;i++)ans=min(ans,d[N-1][i]);
  cout<<ans<<endl;
}

void init(){
  for(int i=0;i<MAX_N;i++){
    G[i].clear();
  }
}
int main(){
  init();
  cin>>N>>K;
  for(int i=0;i<N;i++)cin>>C[i]>>R[i];
  for(int i=0;i<K;i++){
    int a,b;
    cin>>a>>b;
    a--,b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dijkstra();
  return 0;
}

Measured memory_bytes: 100060
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
ll mx(ll a,ll b){if(a>=b) return a;return b;}
ll mn(ll a,ll b){if(a<b) return a;return b;}
#define pb push_back
#define mp make_pair
#define endl "\n"
#define INF (ll) (3e18)
const ll mod=1e9+7;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll n,k;
    cin>>n>>k;
    ll a[n];ll dp[n][k+1];
    for(ll i=0;i<n;i++)
        cin>>a[i],dp[i][0]=1;
    for(ll x=1;x<=a[0];x++)
        dp[0][x]=1;
    for(ll x=a[0]+1;x<=k;x++)
        dp[0][x]=0;
    for(ll i=1;i<n;i++)
        for(ll x=1;x<=k;x++)
            dp[i][x]=(dp[i][x-1]+dp[i-1][x]-(x-1>=a[i] ? dp[i-1][x-a[i]-1] : 0)) % mod;
    cout<<(dp[n-1][k]+mod)%mod<<endl;
    return 0;
}





Measured memory_bytes: 78336
#include<iostream>
#include<cstring>
#define N 100001
using namespace std;

long long dp[N];

int main(){
    int n,k;
    cin>>n>>k;
    int h[n];
    for(int i=0;i<n;i++)
        cin>>h[i];
    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int i=2;i<n;i++){
        dp[i] = 1e9;
        for(int j=1;j<=k;j++){
            if(i-j>=0){
                dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;


public class Main {
	static ArrayList<Integer> list = new ArrayList<Integer>();

	public static void main(String[] args) throws Exception {
		BufferedReader br;
		if( args.length > 0 && args[0].equals("File") == true ) {
			br = getReader("C:\\Users\\USER\\Downloads\\ALDS1_4_A-in8.txt");
		} else {
			br = getReader();
		}
		int snum = getInt(br);
		int[] snumAry = getIntAry(br);
		int tnum = getInt(br);
		int[] tnumAry = getIntAry(br);
		int count = 0;
		for( int t = 0; t < tnumAry.length ; t++ ) {
			if ( /*member(tnumAry[t], snumAry) == true*/ Arrays.binarySearch(snumAry,tnumAry[t]) >= 0 ) {
				slist(tnumAry[t]);
//				break;
			}
		}
		count = list.size();
//		System.out.println("");
		System.out.println(count);
	}
	public static boolean member( int t, int[] num ) {
		int i = 0;
		int j = num.length-1;
		int k = i + (j-i)/2 ;
		while(i<=j) {
			if (t == num[k]) {
				return true;
			} else if ( t > num[k]) {
				i = k+1;
			} else {
				j = k-1;
			}
			k = i + (j-i)/2;
		}
		return false;
	}
	public static void slist(int v) {
		boolean insert = false;
		for( int i = 0 ; i < list.size() ; i++ ) {
			if ( list.get(i) == v) {
				insert = true;
				break;
			} else if ( list.get(i) > v ) {
				list.add(i,v);
				insert = true;
				break;
			}
		}
		if ( insert == false ) {
			list.add(v);
		}
	}
	public static BufferedReader getReader() {
		return( new BufferedReader(new InputStreamReader(
				System.in)));
	}
	public static BufferedReader getReader(String path) throws Exception{
		return( new BufferedReader(new InputStreamReader(
				new FileInputStream(path))));
	}
	public static int getInt(BufferedReader br)throws Exception {
		String line = br.readLine();
		return Integer.valueOf(line);
	}
	public static String[] getAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		return nstr;
	}
	public static int[] getIntAry(BufferedReader br)throws Exception {
		String line = br.readLine();
		String[] nstr = line.split(" ");
		int[] n = new int[nstr.length];
		for( int i=0 ; i < nstr.length ; i++ ) {
			n[i] = Integer.valueOf(nstr[i]);
		}
		return n;
	}
	public static int[] getAryMl(BufferedReader br)throws Exception {
		int n = getInt(br);
		int[] ary = new int[n];
		for( int i=0 ; i < n ; i++ ) {
			ary[i] = getInt(br);
		}
		return ary;
	}
	public static void putAry(int[] ary, int num) {
		for( int i = 0; i < num ; i++ ) {
			System.out.print(ary[i]);
			if ( i < num-1) {
				System.out.print(" ");
			}
		}
		System.out.println("");
	}
	public static void putAry(int[] ary) {
		putAry(ary, ary.length ) ;
	}
	public static boolean isPrime(int n) {
		int r = (int)Math.sqrt((double)n)+1;
		for( int j = 2 ; j < r ; j += 1) {
			if ( n%j == 0 ) {
				return false;
			}
		}
		return true;
	}

}

Measured memory_bytes: 44584
#include <stdio.h>

int main(void){
	double a,b,c,d,e,f;
	double ans_x,ans_y;
	while(scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f) != EOF){
		ans_y = (c*d-a*f) / (b*d-a*e);
		ans_x = (c - (b*ans_y)) / a;

		printf("%.3lf %.3lf\n",ans_x,ans_y);
	}

	return 0;
}

Measured memory_bytes: 1080
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;
int main(){
    int n,a,b,c;
    bool flag = 1;
    cin >> n;

    map<int,int> px,py;
    int lx,ly;
    px[0] = 0;
    py[0] = 0;
    for(int i=0;i<n;i++){
        scanf("%d %d %d",&a,&b,&c);
        px[a] = b;
        py[a] = c;
    }
    auto itrx1 = px.begin();
    auto itry1 = py.begin();
    auto itrx2 = next(itrx1,1);
    auto itry2 = next(itry1,1);
for(int i=0;i<n;i++){
    lx = max(itrx1->second-itrx2->second,itrx2->second-itrx1->second);
    ly = max(itry1->second-itry2->second,itry2->second-itry1->second);
    if((itrx2->first - itrx1->first - lx - ly) < 0 ||  (itrx2->first - itrx1->first - lx - ly)%2 == 1){
        flag = 0;
        break;
    }
    itrx1 = itrx2;
    itry1 = itry2;
    itrx2 = next(itrx2,1);
    itry2 = next(itry2,1);
}
if(flag)cout << "Yes" << endl;
else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 51;
vector<int> adj[MAXN];
long long cur[MAXN], path[MAXN];

void dfs(int u, long long pp, int p = 0){
	path[u] = pp;
	for (int v : adj[u]){
		if (v != p){
			dfs(v, (pp | (1ll << v)), u);
		}
	}
}

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	int n;
	cin >> n;
	for (int i = 0; i < n - 1; ++i){
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	dfs(1, 0ll);
	int m;
	cin >> m;
	for (int i = 0; i < m; ++i){
		int u, v;
		cin >> u >> v;
		cur[i] = path[u] ^ path[v];
	}
	long long ans = 0ll;
	int mx = (1 << m);
	for (int i = 0; i < mx; ++i){
		long long num = 0ll;
		int cnt = 0;
		for (int j = 0; j < m; ++j){
			if (i & (1 << j)){
				cnt++;
				num |= cur[j];
			}
		}
		int free = n - 1 - __builtin_popcountll(num);
		ans += (1ll << free) * (cnt & 1 ? -1ll : 1ll);
	}
	cout << ans;
	return 0;
}



Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define vint(a,n) vint a(n); rep(i, n) cin >> a[i];
#define vll(a,n) vll a(n); rep(i, n) cin >> a[i];
#define ALL(n) begin(n),end(n)
#define RALL(n) rbegin(n),rend(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
using vint=vector<int>;
using vll=vector<ll>;
using vbool=vector<bool>;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

vint primes;
map<int, int> sum;

template<class T>bool isprime(T n){
if(n==2) return true;
if(!(n&1)) return false;
for(T i=3; i*i<=n; i+=2){if(n%i==0) return false;}
return true;}

template<class T>
map<T, int> prime_factorize(T n){
    map<T, int> m;
    T t = n;
    for(int i=2; i*i<=t; i++){
        int k=i;
        while(t!=1&&t%i==0){
            m[k]++;
            k*=i;
            t/=i;
        }
    }
    if(t!=1) m[t]++;
    return m;
}

int main()
{
    int n; cin >> n;
    vint(a, n);

    map<int, int> m[n];
    vint v;
    rep(i, n){
        m[i] = prime_factorize(a[i]);
        // cout << a[i] << ":";
        for(auto p: m[i]){
            // cout << " " << p.first;
            sum[p.first]++;
        }
        // pr("");
    }

    for(auto p: sum) {
        v.push_back(p.first);
        if(isprime(p.first)) primes.push_back(p.first);
    }

    // prvec(v);
    // prvec(primes);
    int ans = 1;

    rep(i, n){
        int t = 1;
        for(int p: primes){
            int k = p;

            // cout << k << " " << sum[k]-m[i][k] << endl;
            if(sum[k]-m[i][k]<n-1) continue;
            while(sum[k*p] > 0 && sum[k*p]-m[i][k*p]>=n-1){
                k*=p;
            }
            t *= k;
        }
        chmax(ans, t);
    }
    pr(ans);
    return 0;}

Measured memory_bytes: 92644
using System;

namespace ABC128 {
	class Program {
		static void Main(string[] args) {
			// 入力
			int A, P;
			int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
			A = array[0];
			P = array[1];
			// 処理・出力
			int pie = (A * 3 + P) / 2; // 切り捨てでok
			Console.WriteLine(pie);
		}
	}
}

Measured memory_bytes: 13140
#include<cstdio>
#include <iostream>
#include <string>
#include<algorithm>
#include <map>
#pragma warning(disable:4786)  // VisualC++6.0の警告対策



using namespace std;

#define ll long long
#define SINT(n) scanf("%d",&n);
#define SINT2(n,m) scanf("%d %d",&n,&m);
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o);
#define SINT4(n,m,o,p) scanf("%d %d %d %d",&n,&m,&o,&p);
#define SLL(n) scanf("%lld",&n);
#define SST(s) scanf("%s",&s);

#define PINT(n) printf("%d",(int)(n));
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m));
#define PLL(n) printf("%lld",(long long)(n));
#define PST(s) printf("%s",(s));
#define PCH(s) printf("%c",(s));

#define PINTN(n) printf("%d\n",(int)(n));
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m));
#define PLLN(n) printf("%lld\n",(long long)(n));
#define PSTN(s) printf("%s\n",(s));
#define PCHN(s) printf("%c\n",(s));

#define PSP() printf(" ");
#define PN() printf("\n");


#define dlp(i) while(i-->0)
#define ulp(i) for(ll _hoge_counter_hoge_=i,i=0;i<_hoge_counter_hoge_;i++)

#define lp(i) for(ll _hoge_counter_hoge_=i;_hoge_counter_hoge_--;)
#define lpp(i,to) for(i=0;i<to;i++)
#define lpft(i,from,to) for(i=from;i<to;i++)

#define lengthof(x) (sizeof(x) / sizeof(*(x)))

map<ll, map<ll, short> > memo[50][50][4];

char Map[60][60];

int main(){

	int N;
	int i,j,k;
	int a,b,c,d;
	int t[100];


	std::fill((int*) t, (int*) (t + lengthof(t)), 0);
	//memset(t,sizeof(t),0);

	SINT(N);

	
	lpp(i,N*(N-1)/2){
		SINT4(a,b,c,d);
		if(c>d){
			t[a-1]+=3;
		}
		if(c<d){
			t[b-1]+=3;
		}
		if(c==d){
			t[a-1]++;
			t[b-1]++;
		}
	}

	lpp(i,N){
		a=1;
		lpp(j,N){
			if(t[j]>t[i]) a++;
		}
		PINTN(a);
	}
	
	return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int n, k;
	cin >> n >> k;
	if (n % k) cout << 1 << endl;
	else cout << 0 << endl; 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i, n) for (int i = 0; i < (int)(n); 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;}
typedef long long ll;

int n,k,c;
string s,t;

int main() {
  cin >> n >> c >> k;
  int t[n];
  rep(i,n) cin >> t[i];
  sort(t,t+n);
  int ans=0,sum=0,time;
  rep(i,n){
    if(!sum) sum++,time=t[i]+k;
    else if(sum<c && t[i]<=time) sum++;
    else if(t[i]>time) sum=1,ans++,time=t[i]+k;
    if(sum==c) sum=0,ans++;
    if(i==n-1 && sum>0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>

typedef long long ll;

int main(int argc, char* argv[])
{
  ll x1, y1, x2, y2;
  ll x3, y3, x4, y4;
  
  std::cin >> x1 >> y1 >> x2 >> y2;

  ll dx = x2 - x1;
  ll dy = y2 - y1;

  x3 = x2 - dy;
  y3 = y2 + dx;
  x4 = x3 - dx;
  y4 = y3 - dy;

  std::cout << x3 << " " << y3 << " " << x4 << " " << y4 << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <numeric>
#include <math.h>
using namespace std;
int main(){
    long long N;
    cin >> N;
    pair<long long,long long> P[N];
    for(int i=0;i<N;i++){
        cin >> P[i].second >> P[i].first;
    }
    sort(P,P+N);
    reverse(P,P+N);

    long long time = P[0].first;
    for(int i=0;i<N;i++){
        if(time>P[i].first){
            time = P[i].first;
        }
        time = time - P[i].second;
        
        if(time<0){
            cout << "No" << endl;
            return 0;
        }

    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll wt[2005];
ll val[2005];
ll dp[150][100005];
ll knapsack(ll n,ll w){
	if((w==0) || (n==0)){
		return 0;
	}
	if(dp[n][w]!=-1){
		return dp[n][w];
	}
	if(wt[n-1]>w){
		return dp[n][w]=knapsack(n-1,w);
	}
	else{
		return dp[n][w]=max(knapsack(n-1,w),knapsack(n-1,w-wt[n-1])+val[n-1]);
	}
}
int main(){
	ll n,s,i,j;
	cin>>n>>s;
	for(i=0;i<=n;i++){
		for(j=0;j<=s;j++){
			dp[i][j]=-1;
		}
	}
	for(i=0;i<n;i++){
		cin>>wt[i]>>val[i];
	}
	cout<<knapsack(n,s)<<endl;
}

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

ll N, ans=0, tmp=0;
vector<pair<ll, ll>> XL;

void solve(){
    ll cur = -10000000000;
    for(int i=0;i<N;i++) {
        if(cur<=XL[i].second) {
            ans++;
            cur = XL[i].first;
        }
    }
}

signed main(){
    cin >> N;
    for(int i=0;i<N;i++) {
        ll x, l;
        cin >> x >> l;
        XL.push_back({x+l, x-l});
    }
    sort(XL.begin(), XL.end());
    solve();
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2420
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double; using str = string;
template <typename T> using vec = vector<T>;
template <typename T> using heap = priority_queue<T>;
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) (((x) & 1) == 0)
#define odd(x) (((x) & 1) == 1)
#define append emplace_back
#define findge lower_bound
#define findgt upper_bound
const i64 MOD = 1000000007;
const f64 EPS = 1e-10;

i32 n, m, q;
i32 s[2001][2001];
i32 v[2001][2001];
i32 eh[2001][2001], ev[2001][2001];

i32 main()
{
	scanf("%d%d%d", &n, &m, &q);
	upto(1, n, i) {
		str t; cin >> t;
		upto(1, m, j) {
			s[i][j] = t[j-1] - '0';
		}
	}
	upto(1, n, i) {
		upto(1, m, j) {
			v[i][j] = v[i][j - 1] + v[i - 1][j] - v[i - 1][j - 1] + s[i][j];
			i32 e1 = (s[i][j] + s[i][j - 1]) / 2;
			i32 e2 = (s[i][j] + s[i - 1][j]) / 2;
			eh[i][j] = eh[i][j - 1] + eh[i - 1][j] - eh[i - 1][j - 1] + e1;
			ev[i][j] = ev[i][j - 1] + ev[i - 1][j] - ev[i - 1][j - 1] + e2;
		}
	}
	times(q, _) {
		i32 a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		i32 cnt = v[c][d] - v[a-1][d] - v[c][b-1] + v[a-1][b-1];
		i32 ehcnt = eh[c][d] - eh[a-1][d] - eh[c][b] + eh[a-1][b];
		i32 evcnt = ev[c][d] - ev[a][d] - ev[c][b-1] + ev[a][b-1];
		printf("%d\n", cnt - ehcnt - evcnt);
	}
	return 0;
}


Measured memory_bytes: 64384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000007
const int maxn=1e5+5;
ll n,q,tmp,a,b,sum=0;
map<int,int>m;
int main(){
	cin>>n;
	while(n--){
		cin>>tmp;
		sum+=tmp;
		m[tmp]++;
	}
	cin>>q;
	while(q--){
		cin>>a>>b;
		sum-=m[a]*(a-b);
		m[b]+=m[a];
		m[a]=0;
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 8024
package main

import (
	"fmt"
)

const mod = 1e9 + 7

var m map[int]int
var ifac, fac []int

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	fac = make([]int, 2e5+1)
	ifac = make([]int, 2e5+1)
	inv := make([]int, 2e5+1)
	fac[0], fac[1] = 1, 1
	ifac[0], ifac[1] = 1, 1
	inv[0], inv[1] = 1, 1
	for i := 2; i < 2e5+1; i++ {
		fac[i] = (fac[i-1] * i) % mod
		inv[i] = (mod - inv[mod%i]*(mod/i)) % mod
		ifac[i] = (ifac[i-1] * inv[i]) % mod
	}

	m = make(map[int]int)
	res := calc(n) - 1 - comb(n, a) - comb(n, b)
	if res < 0 {
		res += 10 * mod
	}
	res %= mod

	fmt.Println(res)
}

func calc(n int) int {
	if r, ok := m[n]; ok {
		return r
	}
	if n == 1 {
		return 2
	}
	if n%2 == 0 {
		r := (calc(n/2) * calc(n/2)) % mod
		m[n] = r
		return r
	}
	r := (calc(n-1) * 2) % mod
	m[n] = r
	return r
}

func cm(n int) int {
	n = n % mod
	for n < 0 {
		n += mod
	}
	return n
}

func comb(n, r int) int {
	b := ifac[r]
	for i := 0; i < r; i++ {
		b *= (n - i)
		b %= mod
	}
	return b
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int euler_phi(int n){
    int ret=n;
    for(int i=2;i*i<=n;++i){
        if(n%i==0){
            ret=ret/i*(i-1);
            while(n%i==0) n/=i;
        }
    }
    if(n!=1) ret=ret/n*(n-1);
    return ret;
}
int main(){
    int n;
    cin>>n;
    cout<<euler_phi(n)<<endl;
    return 0;
}


Measured memory_bytes: 3088
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int a,b;
	cin >> a >> b;
	a += 11; a %= 13;
	b += 11; b %= 13;
	cout << ((a==b)?("Draw"):((a>b)?"Alice":"Bob")) << endl;
	return 0;
}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int n, a, b, c;
int l[10];
int ans = INF;

void dfs(int *use, int cnt) {
	if (cnt == n) {
		int suma = 0, sumb = 0, sumc = 0;
		int cnta = 0, cntb = 0, cntc = 0;
		rep(i, n) {
			if (use[i] == 0) {
				suma += l[i];
				cnta++;
			} else if (use[i] == 1) {
				sumb += l[i];
				cntb++;
			} else if (use[i] == 2) {
				sumc += l[i];
				cntc++;
			}
		}
		
		if (cnta == 0 or cntb == 0 or cntc == 0) return;
		
		int sum = 0;
		sum += (cnta - 1) * 10 + (cntb - 1) * 10 + (cntc - 1) * 10;
		sum += abs(a - suma) + abs(b - sumb) + abs(c - sumc);
		ans = min(sum, ans);
//		cout << " " << ans << endl;
		return;
	}
	rep(i, 4) {
//		cout << i << endl;
		use[cnt] = i;
		dfs(use, cnt + 1);
	}
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n >> a >> b >> c;
	rep(i, n) cin >> l[i];
	
	int use[n];
	dfs(use, 0);
	
	cout << ans << endl;
	
	return 0;
}

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

int main(){
    int a,b;
    cin>>a>>b;
    
    if( a < b ) cout<<"a < b"<<endl;
    if( a == b ) cout<<"a == b"<<endl;
    if( a > b ) cout<<"a > b"<<endl;
    
}


Measured memory_bytes: 3084
n=int(input())
a=list(map(int,input().split()))
li1=[0]*n
li2=[0]*n
for i in range(n):
    li1[i] = i + a[i]
    li2[i] = i - a[i]

li1.sort()
li2.sort()
l1=l2=0

ans = 0

while 1:
    if li1[l1] == li2[l2]:
        cnt1=cnt2=1
        while  l1 < n-1 and li1[l1] == li1[l1+1]:
            l1 += 1
            cnt1 += 1
        while  l2 < n-1 and li2[l2] == li2[l2+1]:
            l2 += 1
            cnt2 += 1
        ans += cnt1*cnt2
        l1+=1
        l2+=1
    elif li1[l1] < li2[l2]:
        l1+=1
    else:
        l2+=1
    if l1 == n or l2 == n or (l1==l2==n-1):
        break
print(ans)

Measured memory_bytes: 92952
#include <bits/stdc++.h>
using namespace std;
#define modulo N
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000005



int main(){
	
	vector<int> c(3);
	int K;
	cin>>c[0]>>c[1]>>c[2]>>K;
	
	int ans = 0;
	
	for(int i=0;i<3;i++){
		int t = 1-i;
		if(c[i]<=K){
			K-=c[i];
			ans+=c[i]*t;
		}
		else{
			ans+=K*t;
			K=0;
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {

		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){

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

			System.out.println(inpuNumber * inpuNumber * inpuNumber);
		}

	}

}


Measured memory_bytes: 24084
#include<stdio.h>
#define INFTY 1000000000

int count = 0;

void merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;
  n1=mid-left;
  n2=right-mid;
  int L[n1],R[n2];
  for(i=0;i<n1;i++)L[i]=A[left+i];
  for(i=0;i<n2;i++)R[i]=A[mid+i];
  L[n1]=INFTY;
  R[n2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      count++;
      A[k]=L[i];
      i=i+1;
    }
    else {
      count++;
      A[k]=R[j];
      j=j+1;
    }
  }
}

void mergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,left,mid);
    mergeSort(A,mid,right);
    merge(A,left,mid,right);
  }
}


int main(){
  int n,i;
  int A[500000];
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&A[i]);
  mergeSort(A,0,n);
  for(i=0;i<n;i++){
    if(i!=n-1)printf("%d ",A[i]);
    else printf("%d",A[i]);
  }
  printf("\n%d\n",count);
  return 0;
}



Measured memory_bytes: 5600
/*
lakshaygpt28
Lakshay Gupta
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

pll a[N];
multiset < ll > s;

int main() {
    fast_io();
    ll n, m;
    cin >> n >> m;
    for (ll i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a, a + n);
    ll ans = 0, j = 1, k = 0;
    for (ll i = 0; i < n and j <= m; i++) {
        if (a[i].first <= j) {
            s.insert(a[i].second);
        } else {
            if (!s.empty()) {
                // debug(*s.rbegin());
                ans += *s.rbegin();
                auto it = s.end();
                it--;
                s.erase(it);
                k++;
            }
            j++;
            i--;
        }
    }
    while (j <= m) {
        // debug("hi");
        if (!s.empty()) {
            // debug(*s.rbegin());
            ans += *s.rbegin();
            auto it = s.end();
            it--;
            s.erase(it);
            k++;
            j++;
        } else {
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6400
#include<bits/stdc++.h>
#define pb push_back
#define pair pair<int,int>
#define ll long long
#define f first
#define se second
using namespace std;
double pi=acos(-1.0);
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int x;
    cin>>x;
    int y=x%100;
    int z=y/5;
    int z1=y-5*z;
    int co=z1==0?0:1;
    if(x>=100*(z+co) || x%104==0 || x%105==0 || x%103==0 || x%102==0 || x%101==0 || x%100==0)
      cout<<1;
  else
    cout<<0;
}


Measured memory_bytes: 256
N, M = [int(i) for i in input().split()]
red = [False for i in range(N+1)]
red[1] = True
balls = [1 for i in range(N+1)]
for i in range(M):
    x, y = [int(_) for _ in input().split()]
    if red[x]:
        red[y] = True
    balls[x] -= 1
    if balls[x] == 0:
        red[x] = False
    balls[y] += 1
print(len([r for r in red if r]))

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

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    char c;
    cin >> c;
    if (c == 'Y') {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn = 100;
double a[maxn];
int n;
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i++){
		scanf("%lf", &a[i]);
	}
	sort(a + 1, a + 1 + n);
	double ans = (a[1] + a[2]) / 2;
	for(int i = 3; i <= n; i++){
		ans = (ans + a[i]) / 2;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

def main():
  def p(a,b):
    if a < b:
      return (a,b)
    else:
      return (b,a)
  input = open(0).readline
  N = int(input())
  E = [[] for i in range(N)]
  C = {}
  D = [0] * N
  parent = [0]*N
  for i in range(N-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    E[a].append(b)
    E[b].append(a)
    C[p(a,b)] = c

  M, K = map(int, input().split())
  K -= 1
  parent[K] = K
  Q = deque()
  Q.append(K)

  while Q:
    u = Q.popleft()
    d = D[u]
    for v in E[u]:
      if parent[u] == v:
        continue
      parent[v] = u
      D[v] = d + C[p(u,v)]
      Q.append(v)

  for i in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(D[x]+D[y])

main()
  
 

Measured memory_bytes: 44412
# -*- coding: utf-8 -*-
N = int(input())
number_list = list(map(int, input().split()))
sort_number_list = sorted(number_list, reverse=True)
 
Alice = 0
Bob = 0
for i, x in enumerate(sort_number_list):
  i += 1
  if i % 2 != 0:
    Alice += x
  else:
    Bob += x

print("{}".format(Alice - Bob))

Measured memory_bytes: 3060
import sys,collections,math,random;sys.setrecursionlimit(10**7)
from fractions import gcd
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
if n%2 == 1:
    print(0)
    exit()
lis = []
for i in range(1,26):
    lis.append((n // (5**i))//2 )
print(sum(lis))


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

#define LL long long
const int N = 200005;
int fac[N] = {1, 1}, rfac[N] = {1, 1}, inv[N] = {0, 1};
const int mod = 1e9 + 7;
int nCr(int n, int r) {return 1ll * fac[n] * rfac[n-r] % mod * rfac[r] % mod;}

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

    for (int i = 2; i < N; i ++) {
        inv[i] = 1ll * (mod / i) * (mod - inv[mod%i]) % mod;
        fac[i] = 1ll * fac[i-1] * i % mod;
        rfac[i] = 1ll * rfac[i-1] * inv[i] % mod;
    }

    LL n, m, a, b;
    cin >> n >> m >> a >> b;

    LL ans = nCr(n + m - 2, m - 1);
    for(LL i = n-a+1; i <= n; i++) {
        LL x = nCr(i-1 + b-1, b-1), y = nCr(n-i + m-b-1, n-i);
        LL z = (x * y) % mod;
        ans -= z;
        if(ans < 0) ans += mod;
    }
    cout << ans;
}


Measured memory_bytes: 5888
import java.util.Scanner;
import java.lang.Math;
class Main{
    public static void main(String[] arsg){
        Scanner sc = new Scanner(System.in);
       int a = sc.nextInt();
       int b = sc.nextInt();
       int c = sc.nextInt();
       int d = sc.nextInt();
       int e = sc.nextInt();
       int k = sc.nextInt();
       int[] l = {a,b,c,d,e};
       String ans = "Yay!";
       out:
       for(int i = 0;i < l.length-1;i++){
           for(int x = 1;x < l.length;x++){
               if(Math.abs(l[i] - l[x]) > k){
                   ans = ":(";
                   break out;
               }
           }
       }
       System.out.println(ans);
    }
}

Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
#include<queue>
#include<cmath>
#include<numeric>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<iomanip>
#include<functional>
#include<bitset>

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

using namespace std;
typedef long long ll;

int main(){
    int n,m,x;
    ll ans = 1000000000000000000;
    cin>>n>>m>>x;
    int c[n],a[n][m],algo[m];
    rep(i,n){
        cin>>c[i];
        rep(j,m) cin>>a[i][j];
    }
    for(int bit = 0;bit<(1<<n);++bit){
        ll money =0;
        rep(i,m) algo[i] = 0;
        rep(i,n){
            if(bit&(1<<i)){
                rep(j,m) algo[j] += a[i][j];
                money += c[i];
            }
        }
        int xormore = 1;
        rep(i,m){
            if(algo[i] < x) xormore=0;
        }
        // cout<<xormore<<" "<<money<<endl;
        if(xormore){
            ans = min(ans,money);
        }
    }
    if(ans==1000000000000000000) cout<<-1<<endl;
    else cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<set>
#include<vector>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main(){
    int n,x;
    long long ans=0;
    long long s=0;
    int a[100003];
    cin>>n>>x;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if(a[0]>x){
        ans+=a[0]-x;
        a[0]=x;
    }
    for(int i=1;i<n;i++){
        s=a[i]+a[i-1];
        if(s>x){
            ans+=s-x;
            a[i]-=s-x;
            if(a[i]<0){
                a[i-1]+=a[i];
                a[i]=0;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

  if(n.at(0) == '7'){
    cout << "Yes";
    return 0;
  }

  if(n.at(1) == '7'){
    cout << "Yes";
    return 0;
  }

  if(n.at(2) == '7'){
    cout << "Yes";
    return 0;
  }

  cout << "No";

  return 0; 
}


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

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int x1 = scanner.nextInt(), y1 = scanner.nextInt(), x2 = scanner.nextInt(), y2 = scanner.nextInt(), x3 = scanner.nextInt(), y3 = scanner.nextInt();
        System.out.println(Math.max(Math.max(Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)),Math.sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))),Math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)))/(2+Math.max(Math.max(Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)),Math.sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))),Math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3)))/(Math.abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/(Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))+Math.sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))+Math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3))))));
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21076
def run(H, W, s):
    for y in range(H):
        for x in range(W):
            if check(s, H, W, y, x):
                continue
            else:
                return 'No'
    return 'Yes'


def check(s, H, W, y, x):
    '''
    sの(x, y)座標から見て、4方向をチェックする
    (x, y)が'#'の場合は、4方向のどこかに'#'があればTrue, なければFalse
    (x, y)が'.'の場合は、True
    '''
    ret = False
    if s[y][x] == '.':
        ret = True
    if x - 1 >= 0:
        if s[y][x-1] == '#':
            ret = True
    if x + 1 < W:
        if s[y][x+1] == '#':
            ret = True
    if y - 1 >= 0:
        if s[y-1][x] == '#':
            ret = True
    if y + 1 < H:
        if s[y+1][x] == '#':
            ret = True
    return ret


def main():
    H, W = map(int, input().split())
    s = []
    for i in range(H):
        s.append(input())
    print(run(H, W, s))


if __name__ == '__main__':
    main()


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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    multiset<int> mst;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        auto itr = mst.lower_bound(a);
        if (itr == mst.begin())
        {
            mst.insert(a);
        }
        else
        {
            itr--;
            mst.erase(itr);
            mst.insert(a);
        }
    }
    cout << mst.size() << endl;
}


Measured memory_bytes: 4992
#include <iostream>
using namespace std;
int main()
{
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    if (i*i <= N) {
      ans = i*i;
    } else {
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
import java.util.*;
public class Main {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    String s1 = sc.next();
    String s2 = sc.next();
    String s3 = sc.next();

    s1 = s1.substring(0,1);
	s2 = s2.substring(0,1);
	s3 = s3.substring(0,1);

    System.out.println(s1.toUpperCase() + s2.toUpperCase() + s3.toUpperCase());

  }
}

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

const int N = 110;

int q[N];
int c[8];

int main()
{
    int n;
    int cnt = 0;
    cin >> n;

    for (int i = 0; i < n ; i ++ )
        {
            cin >> q[i];
            //cout <<q[i] << endl;
        }

    for (int i = 0; i < n; i ++ )
    {
        if(q[i] >= 1 &&  q[i] <= 399) c[0] ++ ;
        else if(q[i] >= 400 &&  q[i] <= 799) c[1] ++ ;
        else if(q[i] >= 800 &&  q[i] <= 1199) c[2] ++ ;
        else if(q[i] >= 1200 &&  q[i] <= 1599) c[3] ++ ;
        else if(q[i] >= 1600 &&  q[i] <= 1999) c[4] ++ ;
        else if(q[i] >= 2000 &&  q[i] <= 2399) c[5] ++ ;
        else if(q[i] >= 2400 &&  q[i] <= 2799) c[6] ++ ;
        else if(q[i] >= 2800 &&  q[i] <= 3199) c[7] ++ ;
        else if(q[i] >= 3200) cnt++;
    }

    int cnt1 = 0;
    for (int i = 0; i < 8; i ++ ) if(c[i] > 0) cnt1++;

    if(cnt == 0) cout << cnt1 << " " << cnt1 << endl;
    else if(cnt != 0)
    {
        if(cnt1 != 0)
        cout << cnt1 << " " << cnt1+cnt << endl;
        else if(cnt1 == 0)
        cout << "1 " << cnt << endl;
    }
    return 0;
}


Measured memory_bytes: 256