akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int bubble_sort(int *a,int n,int change);

int main(void)
{
	int n;
	int change;
	int i;
	int a[100]={};
	
	while(1){
		scanf("%d",&n);
		if(n==0){break;}
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		change=0;
		change=bubble_sort(a,n,change);
		printf("%d\n",change);
	}
	return 0;
}

int bubble_sort(int *a,int n,int change)
{
	int i,j,tmp;
	int n2;
	
	n2=n;
	for(j=1;j<n;j++){
		for(i=0;i<n2-1;i++){
			if(a[i]>a[i+1]){
				tmp=a[i];
				a[i]=a[i+1];
				a[i+1]=tmp;
				change++;
			}
		}
		n2--;
	}
	return change;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = Console.ReadLine().Split().Select(s=>int.Parse(s)).ToArray();
            var N = NK[0];
            var K = NK[1];
            var hash = new HashSet<int>();
            for(var i=0;i<K;i++)
            {
                Console.ReadLine();
                var tmp = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
                foreach(var it in tmp)
                {
                    if (!hash.Contains(it)) hash.Add(it);
                }
            }
            Console.WriteLine(N - hash.Count());
        }
    }
}

Measured memory_bytes: 20644
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author mikit
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        LightScanner in = new LightScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CProductAndGCD solver = new CProductAndGCD();
        solver.solve(1, in, out);
        out.close();
    }

    static class CProductAndGCD {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            Map<Long, Integer> factor = new HashMap<>();
            long n = in.longs(), p = in.longs();
            Long f = null;
            while ((f = IntMath.getPrimeFactor(p)) != null) {
                factor.merge(f, 1, (x, y) -> x + y);
                p /= f;
            }
            if (p > 1) {
                factor.merge(p, 1, (x, y) -> x + y);
            }

            long ans = 1;
            for (Map.Entry<Long, Integer> e : factor.entrySet()) {
                for (int i = 0; i < e.getValue() / n; i++) {
                    ans *= e.getKey();
                }
            }
            out.println(ans);
        }

    }

    static final class IntMath {
        private IntMath() {
        }

        public static Long getPrimeFactor(long a) {
            if (a <= 1) {
                return null;
            } else if ((a & 1) == 0) {
                return 2L;
            }
            for (long i = 3; i * i <= a; i += 2) {
                if (a % i == 0) {
                    return i;
                }
            }
            return a;
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long longs() {
            return Long.parseLong(string());
        }

    }
}



Measured memory_bytes: 27604
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,m,i;
    cin>>n;
    long long int a[n],sum2=100000000,sum1=0,k,l,h,j;
   for(i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=a[0];i<=a[n-1];i++){
        for(j=0;j<n;j++){
            l=abs(i-a[j]);
           // cout<<"l="<<l<<endl;
            sum1=sum1+(l*l);
         //   cout<<sum1<<endl;
        }
      //  cout<<"sum1="<<sum1<<endl;
         sum2=min(sum2,sum1);
         sum1=0;
    }
  cout<<sum2<<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 100001;

int n, ch[N][2], en[N];
ll L, ans;
int cn;

void add(string &s){
    int node = 0;
    for(auto &i : s){
        int x = i - '0';
        if(ch[node][x] == -1){
            ch[node][x] = ++cn;
        }
        node = ch[node][x];
    }
    en[node] = 1;
}
void go(int node, ll dep){
    if(en[node]) return;
    if(ch[node][0] == -1) ans ^= dep ^ -dep;
    else go(ch[node][0], dep - 1);
    if(ch[node][1] == -1) ans ^= dep ^ -dep;
    else go(ch[node][1], dep - 1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(ch, -1, sizeof ch);
    cin >> n >> L;
    for(int i = 0 ; i < n ; i++){
        string s;
        cin >> s;
        add(s);
    }
    go(0, L);
    if(ans) cout << "Alice\n";
    else cout << "Bob\n";
}


Measured memory_bytes: 6776
#include<bits/stdc++.h>
using namespace std;
string a,b="CF";
int al,bl;

int main(){
    getline(cin,a);
    al=a.length();
    for(int i=0;i<al;i++)
        if(a[i]==b[bl]){ 
            bl++;
            if(bl==2)
                break;
        }
    if(bl==2) cout<<"Yes";
    else cout<<"No";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn._
import scala.collection.mutable.{ArrayBuffer, PriorityQueue}
object Main extends App {
  val Array(n, m) = readLine.split(" ").map(_.toInt)
  val arbeits = Array.fill(100001)(new ArrayBuffer[Int]())
  for (i <- 1 to n) {
    val Array(a, b) = readLine.split(" ").map(_.toInt)
    arbeits(a) += b
  }

  def exec(day: Int, possible: PriorityQueue[Int], income: Int): Int = {
    if (day > m) income
    else {
       possible ++= arbeits(day)
      if (possible.isEmpty) {
        exec(day + 1, possible, income)
      } else {
        val a = possible.dequeue()
        exec(day + 1, possible, income + a)
      }
    }
  }

  println(exec(1, PriorityQueue[Int](), 0))
}

Measured memory_bytes: 80444
import java.io.*;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    private static void slove(long m[],int x){
        for(int i=0;i<120;i++){
            for(int j=1;j<120;j++){
                if(m[i]+m[j]==x){
                    System.out.print(i+" "+(-j));
                    return;
                }
                if(m[i]-m[j]==x){
                    System.out.print(i+" "+j);
                    return;
                }
            }
        }
    }
    public static void main(String[] args) throws IOException{
        Scanner sc=new Scanner(new BufferedInputStream(System.in));
        int x=sc.nextInt();
        long m[]=new long[120];
        for(int i=0;i<m.length;i++)
            m[i]=(long)Math.pow(i,5);
        slove(m,x);
    }
}


Measured memory_bytes: 38652
#include <bits/stdc++.h>
using namespace std;
int N,ans;
long long st,a[25][25],dp[1<<16];
long long Pow[1<<16+5];
long long gx[(1<<17)-1];
int main()
{
	scanf("%d",&N);
	for (int i=1;i<=N;i++)
	  for (int j=1;j<=N;j++)
	    scanf("%lld",&a[i][j]);
	st=(1<<N)-1;
	for (int i=0;i<=16;i++)
	  Pow[1<<i]=i;
	for (int i=0;i<=st;i++)
	{
		int R=i;
		int dl[20];
		int cnt=0;
		while (R!=0)
		{
			cnt++;
			int Num=Pow[R&(-R)]+1;
			R-=R&(-R);
			dl[cnt]=Num;
		}
		for (int j=1;j<=cnt;j++)
		  for (int k=j+1;k<=cnt;k++)
		   gx[i]+=a[dl[j]][dl[k]];
	}
      for (int j=1;j<=st;j++)
        for (int k=j;k!=0;k=(k-1)&j)
           dp[j]=max(dp[j],dp[j^k]+gx[k]);
    printf("%lld",dp[st]);
    return 0;
}

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

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin>>s;
	int zeros=0;
	for(auto it:s)
		zeros+=(it=='0');
	string t;
	long long int ans=0,cnt=0;
	for(auto it:s){
		if(it=='0')	t.push_back(it);
		else{
			if(t.size()&&t.back()=='1')	cnt++,t.pop_back();
			else	t.push_back(it);
		}
	}
	ans=cnt*zeros;
	for(int i=1;i<=s.size()-zeros;i++)
		ans+=(i+1)/2;
	cnt=0;
	long long int ones=0;
	for(int i=0;i<t.size();i++){
		auto it=t[i];
		if(it=='0')	cnt++;
		else{
			ans+=(zeros-cnt);
			ans+=(cnt-ones+(i%2==0))/2;
			ans+=(ones+1)/2;
			ones++;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3892
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007
#define pi (3.141592653589)
#define deb(n) cerr << #n << " = " << (n) << " ";
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout << fixed;
	cout.precision(10);
	
	int n;
	cin >> n;
	int sol = 1;
	for(int i = 1; ; i++)
	{
		int degree = i * 360;
		if(degree % n == 0)
		{
			sol = degree / n;
			break;
		}
	}
	cout << sol;

	return 0;
}


Measured memory_bytes: 3632
use proconio::*;

fn main() {
    input! {
        mut n: i64
    }

    if n == 1 {
        println!("0");
        return;
    }

    let mut ans = 0;
    let maxval = (n as f64).sqrt().ceil() as i64;
    for i in 2..=maxval {
        let mut cnt = 0;
        while n % i == 0 {
            n /= i;
            cnt += 1;
        }

        /*
        if cnt != 0 { println!("{}, {}, {}", i, cnt, n); }
        */

        let mut a = 1;
        while cnt >= a {
            cnt -= a;
            a += 1;
            ans += 1;
        }
    }

    if n != 1 { ans += 1; }

    if ans == 0 { println!("1"); }
    else { println!("{}", ans); }
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    ll i, o, t, j, l, s, z;
    cin >> i >> o >> t >> j >> l >> s >> z;

    ll yoko = o;
    if ((i % 2 && j % 2 && l > 0) || (i > 0 && j % 2 && l % 2) || (i % 2 && j > 0 && l % 2)) {
        yoko += 3;
        i--, j--, l--;
    }
    yoko += (i / 2) * 2 + (j / 2) * 2 + (l / 2) * 2;
    cout << yoko << endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    problem = int(input())
    score = sorted([int(input()) for _ in range(problem)])
    all_score = sum(score)
    if not all_score % 10:
        missed_score = all_score
        for s in score:
            if s % 10:
                missed_score = s
                break
        print(all_score - missed_score)
    else:
        print(all_score)


if __name__ == '__main__':
    main()



Measured memory_bytes: 2940
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define WRAP(y,x,h,w) (0<=y && y<h && 0<=x && x<w)

typedef long long ll;
typedef unsigned long long ull;
typedef string str;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1,0,1,0 }; const int dy[] = { 0,1,0,-1 };
int w, h;
vvi dis;
int idx;
int ans;
void dfs(int cnt,int flag,int d,int now) {
	if (cnt == idx - 1) {
		ans = min(ans,d);
		return;
	}
	REP(i, idx - 1) {
		if (!((flag >> i) & 1)) {
			dfs(cnt + 1, flag | (1 << i), d + dis[now][i], i);
		}
	}
}
int main() {
	while (cin >> w >> h, w) {
		vector<str> cell(h);
		idx = 0;
		map<pii, int> idxd;
		REP(i, h) {
			cin >> cell[i];
			REP(j, w) {
				if (cell[i][j] == '*') {
					idxd[{i, j}] = idx;
					idx++;
				}
			}
		}
		REP(i, h) {
			REP(j, w) {
				if (cell[i][j] == 'o') {
					idxd[{i, j}] = idx;
					idx++;
				}
			}
		}
		dis.clear();
		dis.resize(idx, vi(idx, -1));
		REP(i, h) {
			REP(j, w) {
				if (cell[i][j] == 'o' || cell[i][j] == '*') {
					vvb visited(h, vb(w, false));
					visited[i][j] = true;
					queue<pii> Q;
					Q.push({ i,j });
					int cnt = 0;
					while (!Q.empty()) {
						queue<pii> Q2;
						while (!Q.empty()) {
							pii q = Q.front(); Q.pop();
							if (cell[q.first][q.second] == '*') {
								dis[idxd[{i, j}]][idxd[{q.first, q.second}]] = cnt;
							}
							REP(i, 4) {
								int ny = q.first + dy[i];
								int nx = q.second + dx[i];
								if (WRAP(ny, nx, h, w) && cell[q.first][q.second] != 'x' && !visited[ny][nx]) {
									visited[ny][nx] = true;
									Q2.push({ ny,nx });
								}
							}
						}
						cnt++;
						Q = Q2;
					}
				}
			}
		}
		bool noc=false;
		REP(i, idx - 1) {
			if (dis[idx - 1][i] == -1) {
				noc = true;
				break;
			}
		}
		if (noc) {
			cout << -1 << endl;
			continue;
		}
		ans = 1e9;
		dfs(0,0,0,idx-1);
		cout << ans << endl;
	}
	return 0;
}

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

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

  vector<int> w(n);
  cin >> w.at(0);
  for (int i = 0; i < n-1; i++) {
    cin >> w[i+1];
    w[i+1] += w[i];
  }
  int mini = w.at(n-1);
  for (int i = 0; i < n; i++) {
    w[i] -= w.at(n-1) - w.at(i);
    mini = min(mini, abs(w.at(i)));
  }

  cout << mini << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,r="";
	cin>>s;
	for (int i = 0; i < s.length(); ++i)
	{
		if(s[i]=='0')
		{
			r+='0';
		}
		if(s[i]=='1')
		{
			r+='1';	
		}
		if(s[i]=='B'&&r.length()!=0)
		{
			r.pop_back();
		}
	}
	for (int i = 0; i < r.length(); ++i)
	{
		cout<<r[i];
	}
	cout<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {

	int A, nowA, pastA, B;
	int C, nowC, pastC, D;

	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	scanf("%d", &D);

	nowA = A, pastA = A;
	nowC = C; pastC = C;
  
	while (nowA > 0) {
		nowC = pastC - B;
		pastC = nowC;
		if (nowC <= 0) {
			break;
		}
		nowA = pastA - D;
		pastA = nowA;
	}
	
	if (nowA <= 0) {
		printf("No");
	}
	else if (nowC <= 0) {
		printf("Yes");
	}

	return 0;
}

Measured memory_bytes: 1732
#!/usr/bin/env python3
import sys

YES = "Yes" 
NO = "No" 

A,B,C,D = list(map(int, input().split()))

while True:
    C = C - B
    if C <= 0:
        print(YES)
        break

    A = A - D
    if A <= 0:
        print(NO)
        break



Measured memory_bytes: 61600
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
const int INF = 1e9;
using namespace std;

signed main() {
    double a,b,x; cin >> a >> b >> x;
    double ans;
    if(a*a*b/2.0 <= x) {
        ans = atan(2*(a*a*b-x)/(a*a*a));
    } else {
        ans = M_PI/2 - atan(2*x/(a*b*b));
    }
    ans = ans*180.0/M_PI; 
    cout << fixed << setprecision(8) << ans << endl;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;

    cin>>n;

    long long int arr[n];
    long long int result,max;

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

    max = -1;
    result = 0;
    
    for(int i=0; i<n; i++)
    {
        if(arr[i]>max)
        {
            max = arr[i];
        }
        result = result + (max - arr[i]);
    }

    cout<<result<<"\n";

    

    
    return 0;
}

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

int main() {
	long long N, X, a;
	cin >> N;
	long long total = 0;
	vector<int> vec(N);
	for (int i = 0; i < N; i++) {
		cin >> X;
		vec.at(i) = X;
		total += X;
	}
	a = total % N;
	if (a <= N / 2) {
		a = total / N;
	}
	else {
		a = total / N + 1;
	}
	total = 0;
	for (int j = 0; j < N; j++) {
		total += (a - vec.at(j)) * (a - vec.at(j));
	}
	cout << total << endl;
}

Measured memory_bytes: 3624
from collections import deque
N = int(input())
A = list(map(int, input().split()))
A.sort()


plusq =deque([a for a in A if a >=0])
minusq = deque([a for a in A if a < 0])

if not plusq:
    plusq.append(minusq.pop())
elif not minusq:
    minusq.appendleft(plusq.popleft())

ans = []

x = minusq.pop()
tmp_plus = plusq.pop()
while plusq:
    y = plusq.pop()
    ans.append((x,y))
    x = x - y

ans.append((tmp_plus,x))
x = tmp_plus  - x

while minusq:
    y = minusq.pop()
    ans.append((x,y))
    x = x - y
print(x)
for x,y in ans:
    print(x,y)

Measured memory_bytes: 65468
#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;
#define int long long
typedef long double ld;
typedef unsigned long long ull;
#define X first
#define Y second
#define mp make_pair
template<class T> using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class X> using indexed_map = tree<T, X, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const long long M = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
long long modpow(long long n, long long k, long long MOD);
 
/**************** code starts here ****************/

void poppingfever() {
	int n; cin >> n;
	vector<int> a(n);
	map<int, int> mp;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		mp[a[i]]++;
	}

	if (mp.size() > 3) {
		cout << "No"; return;
	}
	if (mp.size() == 1) {
		if (a[0] == 0) {
			cout << "Yes";
		} else {
			cout << "No";
		}
		return;
	}
	
	sort(a.begin(), a.end());
	if (n % 3) {
		cout << "No"; return;
	}
	for (int i = 1; i < n/3; i++) {
		if (a[i] != a[i-1]) {
			cout << "No"; return;
		}
	}
	for (int i = n/3 + 1; i < 2*n/3; i++) {
		if (a[i] != a[i-1]) {
			cout << "No"; return;
		}
	}
	for (int i = 2*n/3 + 1; i < n; i++) {
		if (a[i] != a[i-1]) {
			cout << "No"; return;
		}
	}

	if ((a[0] ^ a[n/3]) == a[2*n/3]) {
		//cout << a[2*n/3];
		cout << "Yes"; return;
	}
	if ((a[0] ^ a[2*n/3]) == a[n/3]) {
		//cout << a[n/3];
		cout << "Yes"; return;
	}
	if ((a[2*n/3] ^ a[n/3]) == a[0]) {
		//cout << a[0];
		cout << "Yes"; return;
	}
	cout << "No";
}
	
/**************************************************/
 
signed main() {
	#ifdef fastfurioustransform
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif
 
	ios::sync_with_stdio(0); cin.tie(0);
	//cout << fixed << setprecision(12);
 
	poppingfever();
 
	return 0;
}
 
long long modpow(long long n, long long k, long long MOD) {
	long long ans = 1; n %= MOD;
	while (k > 0) {
		if (k & 1) ans = (ans*n) % MOD;
		k >>= 1; n = (n*n) % MOD;
	}
	return ans; 
}

Measured memory_bytes: 5760
#include<stdio.h>
int main(void){
	long long int in;
	int i;
	while(scanf("%lld",&in),in){
		int c=0;
		for(i=1;i<=in;i++){
			int t=i;
			while(t%5==0){c++;t/=5;}
		}
		printf("%d\n",c);
	}
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
#define ll long long
#define Test int T;cin>>T;while(T--)
#define PI acos(-1)
#define endl "\n"
#define fx(x) fixed<<setprecision(x)
#define sz(s) (int)s.size()
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define mem(a,n) memset((a),n,sizeof (a))
#define ii pair<int,int>
const double eps=1e-9;
const int mod=1e9+7;
const int N=100001;
int dx[]={1,-1,0,0};
int dy[]={0,0,1,-1};
ll gcd(ll x,ll y){return(!y)?x:gcd(y,x%y);}
ll lcm(ll x,ll y){return((x/gcd(x,y))*y);}
using namespace std;
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<vector<int> >adj;
bool vis[100001];
void dfs(int u){
    vis[u]=1;
    for(auto i:adj[u]){
        if(!vis[i])dfs(i);
    }
}
int main(){
    fast();
    int n,m,u,v;
    cin>>n>>m;
    adj.resize(n);
    while(m--){
        cin>>u>>v;
        u--;v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(0);
    int ans=0;
    for(int i=0;i<n;i++){
        if(!vis[i]){
            dfs(i);
            ans++;
        }
    }
    cout<<ans;
    return 0;
}


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

int main() {
  int N;
  cin>>N;
  string s,t;
  cin>>s>>t;
  int ans=2*N;
  for(int i=0;i<N;i++){
    string r;
    //cout<<s.substr(N-1-i)<<" "<<t.substr(0,i+1)<<endl;
    if(s.substr(N-1-i)==t.substr(0,i+1)){
      r=r+s+t.substr(i+1);//  cout<<r<<endl;
      ans=min(ans,(int)r.size());
    }
    
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    // 何匹目の犬であるか
    Long n = sc.nextLong();
    List<String> anStrings = new ArrayList<>();
    List<String> list = new ArrayList<>();
    list.add("z");
    list.add("a");
    list.add("b");
    list.add("c");
    list.add("d");
    list.add("e");
    list.add("f");
    list.add("g");
    list.add("h");
    list.add("i");
    list.add("j");
    list.add("k");
    list.add("l");
    list.add("m");
    list.add("n");
    list.add("o");
    list.add("p");
    list.add("q");
    list.add("r");
    list.add("s");
    list.add("t");
    list.add("u");
    list.add("v");
    list.add("w");
    list.add("x");
    list.add("y");
        int cnt = 0;
        boolean flg=false;
        while(true) {
            if(n>=26) {
                n = n - cnt;
                if(n==25 || n==26) flg=true;
                int num = (int) (n % 26);
                anStrings.add(list.get(num));
                n /= 26;
                if(num==0)
                    cnt=1;
                else
                    cnt=0;
                if(flg) break;
            }
            else {
                n = n - cnt;
                if(n==-1) n++;
                int num = (int) (n % 26);
                anStrings.add(list.get(num));
                break;
            }
        }
        for(int i=anStrings.size()-1;i>=0;i--) {
            System.out.print(anStrings.get(i));
        }
        System.out.println("");
      }
  
}

Measured memory_bytes: 35664
x, k, d = map(int, input().split())
flag = False
if x < 0:
    x = -x
    flag = True

a = x // d
k_ = k - a
x_ = x - a*d
if k_ >= 0:
    if k_ % 2 == 0:
        print(x_)
    else:
        print(abs(x_ - d))
else:
    print(x - d*k)


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

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;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  ll N; cin >> N;
  string s; cin >> s;
  ll l = 0, r = 0;
  ll cnt = 0;
  rep(i, s.size()) {
    switch(s[i]) {
    case '(':
      cnt ++;
      break;
    case ')':
      cnt --;
      if(cnt < 0) {
	l ++;
	cnt = 0;
      }
      break;
    }
  }
  cnt = 0;
  rep(i, s.size()) {
    switch(s[s.size() - i - 1]) {
    case ')':
      cnt ++;
      break;
    case '(':
      cnt --;
      if(cnt < 0) {
	r ++;
	cnt = 0;
      }
      break;
    }
  }
  rep(i, l) cout << '(';
  cout << s;
  rep(i, r) cout << ')';
  cout << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3564
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
 
void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main(){
  std::cout<<std::fixed<<std::setprecision(10);
  ll N; cin>>N;
  ld p=0.0;
  rep(i,N){
    ll a; cin>>a;
    ld b=1.0/a;
    p+=b;
  }
  
  ld ans=1.0/p;
  cout<<ans<<endl;
  
}
    

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class UnionFindTree {
	    private int[] parent;    //親ノード
	    private int[] rank;      //高さ or 次数
	    public UnionFindTree(int size) {
	        parent = new int[size];
	        rank = new int[size];
	        for (int i = 0; i < size; i++) {
	            makeSet(i);
	        }
	    }
	    public void makeSet(int x) {
	        parent[x] = x;
	        rank[x] = 0;
	    }
	    public void union(int x, int y) {
	        final int xRoot = find(x);
	        final int yRoot = find(y);
	        if (rank[xRoot] > rank[yRoot]) {
	            parent[yRoot] = xRoot;        //x の木に結合
	        }
	        else if(rank[xRoot] < rank[yRoot]) {
	            parent[xRoot] = yRoot;        //y の木に結合
	        }
	        else if (xRoot != yRoot) {        //同じ高さで根が違うとき
	            parent[yRoot] = xRoot;        //x の木に結合
	            rank[xRoot]++;                //x の木の高さを加算
	        }
	    }
	    public int find(int x) {
	        if (x != parent[x]) {    //根でないとき
	            parent[x] = find(parent[x]);    //直接、根に繋ぐ(経路圧縮)
	        }
	        return parent[x];
	    }
	    public boolean same(int x, int y) {
	        return find(x) == find(y);
	    }
	}
	static class Node{
		List<Integer> adj;
		public Node() {
			adj = new ArrayList<Integer>();
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int K = sc.nextInt();
		Node connects[] = new Node[N];
		Node blocks[] = new Node[N];
		for(int i = 0 ; i < N ; ++i){
			connects[i] = new Node();
			blocks[i] = new Node();
		}
		UnionFindTree uf = new UnionFindTree(N);
		for(int i = 0 ; i < M ; ++i){
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			uf.union(a, b);
			connects[a].adj.add(b);
			connects[b].adj.add(a);
		}
		for(int i = 0 ; i < K ; ++i){
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			blocks[a].adj.add(b);
			blocks[b].adj.add(a);			
		}
		int groupSize[] = new int[N];
		for(int i = 0 ; i < N ; ++i){
			groupSize[uf.find(i)]++;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0 ; i < N ; ++i){
			int gs = groupSize[uf.find(i)];
			gs = gs - 1 - connects[i].adj.size();
			for(int b : blocks[i].adj){
				if(uf.find(i) == uf.find(b)){
					gs--;
				}
			}
			if(sb.length() > 0){
				sb.append(' ');
			}
			sb.append(gs);
//			System.out.println(i+" "+gs);
		}
		System.out.println(sb);
	}
}


Measured memory_bytes: 146820
n, m = map(int, input().split())
Pre = [list(map(int, list(input().split()))) for i in range(m)]

for i in range(1, m + 1):
    Pre[i - 1].append(i)

Pre.sort()

cnt = 1
Pre[0][1] = cnt
for i in range(1,m):
    if Pre[i - 1][0] != Pre[i][0]:
        cnt = 1
        Pre[i][1] = cnt
    else:
        cnt += 1
        Pre[i][1] = cnt

Pre.sort(key=lambda x: x[2])

for i in range(m):
    print("{0:06d}{1:06d}".format(Pre[i][0],Pre[i][1]))

Measured memory_bytes: 33560
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

int N, P;
int a[105];

i64 dp[55][55 * 105];

i64 slv(int i, int sum)
{
  if (i >= N) { return ((sum & 1) == P) ? 1 : 0; }
  i64 &ret = dp[i][sum];
  if (~ret) { return ret; }

  return ret = slv(i+1,sum) + slv(i+1, sum+a[i]);
}

signed main()
{

  cin >> N >> P;
  for (int i= 0; i < N; ++i) {
    cin >> a[i];
  }

  memset(dp, -1, sizeof(dp));

  cout << slv(0,0) << endl;

  return 0;
}



Measured memory_bytes: 2688
use std::io;
use std::collections::BinaryHeap;
use io_ext::Reader;
use parse::ParseNext;

fn main() {
    let stdin = io::stdin();
    let mut r = Reader::new(io::BufReader::new(stdin.lock()));
    let (_, m): (u64, u64) = {
        let s = r.read_line();
        let mut split = s.split_whitespace();
        (split.parse_next(), split.parse_next())
    };

    let mut heap: BinaryHeap<u64> = r.read_line().split_whitespace().map(|x| x.parse::<u64>().unwrap()).collect();

    for _ in 0..m {
        let x = heap.pop().unwrap() >> 1;
        heap.push(x);
    }

    println!("{}", heap.into_iter().sum::<u64>());
}

/// Extension of io module.
pub mod io_ext {
    use std::io::BufRead;

    pub struct Reader<R> {
        buf: String,
        inner: R,
    }

    impl<R> Reader<R> {
        #[inline]
        pub fn new(inner: R) -> Self {
            Reader { buf: String::new(), inner: inner }
        }

        #[inline]
        pub fn into_inner(self) -> R {
            self.inner
        }
    }

    impl<R: BufRead> Reader<R> {
        #[allow(deprecated)]
        #[inline]
        pub fn read_line(&mut self) -> &str {
            self.buf.clear();
            self.inner.read_line(&mut self.buf).unwrap_or_else(|e| panic!("{}", e));
            self.buf.trim_right()
        }
    }
}

/// Module supporting to parse strings.
pub mod parse {
    use std::str::FromStr;
    use std::borrow::Borrow;

    pub trait ParseNext: Iterator {
        fn parse_next<F: FromStr>(&mut self) -> F;
    }

    impl<'a, S: Borrow<str>, I: Iterator<Item=S>> ParseNext for I {
        fn parse_next<F: FromStr>(&mut self) -> F {
            if let Some(s) = self.next() {
                match s.borrow().parse() {
                    Ok(x) => x,
                    Err(_) => panic!("provided string cannot be parsed")
                }
            } else {
                panic!("iterator has no next element")
            }
        }
    }
}


Measured memory_bytes: 8444
def resolve():
    n = int(input())
    def su(x): return x * (x + 1) // 2
    ans = 0
    ans += su(n // 3) * 3
    ans += su(n // 5) * 5
    ans -= su(n // 15) * 15
    ans = su(n) - ans
    print(ans)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 9176
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
#include <cmath>
#include <map>
#include <cstring>
#include <stack>
#include <cstdio>
#include <complex>
#include <iomanip>
#include <cctype>
#include <cassert>
#include <numeric>
#include <climits>
#include <deque>
#include <random>
#include <functional>
#define rep(i,n) for(int i=0;i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define show(x) cout << #x << " = " << x << endl;
ll mo=1000000007;
ll combi(ll N_, ll C_) {
    const int NUM_=400001;
    static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
    if (fact[0]==0) {
        inv[1]=fact[0]=factr[0]=1;
        for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
        for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
    }
    if(C_<0 || C_>N_) return 0;
    return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}
void solve(int n,int l,int r){
    for(int k = 1;k <= n+1; k++){
        // cout <<"bbb " << c(n+1,k) << endl;
        // cout <<"aaa " << c(n-r+l-1,k-1) << endl;
        cout << (combi(n+1,k) + mo - combi(n-r+l,k-1) ) % mo << endl;
    }
}
int main(){
    // cout << c(5,0) << " "<<  c(5,1) << " " << c(5,2) << " " <<c(5,3) << endl;
    int n;
    cin >> n;
    vector<int>a(n+1,-1);
    int temp = 0;
    int l,r;
    rep(i,n+1){
        cin >> temp;
        if(a[temp] != -1){
            l = a[temp];
            r = i;
            break;
        }
        a[temp] = i;
    }
    // cout << l << " " << r << endl;
    solve(n,l,r);
    return 0;
}

Measured memory_bytes: 11008
#include <iostream>
#include <vector>

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

	std::vector<int> v(n);
	for (int i = 0; i < n; i++)  std::cin >> v.at(i);

	bool check = true;
	v[0]--;
	for (int i = 1; i < n; i++) {
		if (v[i - 1] == v[i])
			continue;
		else if (v[i - 1] > v[i]) {
			check = false;
			break;
		}

		v[i]--;
	}

	std::string ans = check ? "Yes" : "No";
	std::cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
const double eps = 1e-12;

int judge(double a,double b,double x,double angle){
    double s = sin(angle), c = cos(angle);
    double line = b/s*c;
    double maxn = line*b/2.0;
    if(line>a){
        double minus = (line-a)/c*s*(line-a)/2.0;
        maxn -= minus;
    }
    //printf("angle = %.3f, max = %.3f\n",angle,maxn);
    if(maxn*a>=x) return 1;
    else return 0;
}

int main(){
    double pi = acos(-1.0);
    double a,b,x;
    scanf("%lf%lf%lf",&a,&b,&x);
    double l = 0, r = pi/2;
    double ans = -1;
    while(l<=r){
        double m = (l+r)/2;
        if(judge(a,b,x,m)){
            ans = m;
            l = m+eps;
        }
        else r = m-eps;
    }
    printf("%.9f\n",ans*180/pi);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define fori(i, m, n) for(int i = m; i < (int)n; i++)
#define forl(i, m, n) for(ll i = m; i < (ll)n; i++)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string btos(bool ans){
  return (ans?"Yes":"No");
}

int countBits(int in){
  int res=0;
  rep(i,10){
    int msk=1<<i;
    if((in&msk)!=0){
      res++;
    }
  }
  return res;
}

int main() {
  int n;cin>>n;
  vector<int> h(n);
  rep(i,n){
    cin>>h[i];
  }
  int ans=0;
  int cnt=100;
  while(cnt--){
    int idx=0;
    int l=-1,r=-1;
    while(l<n){
      fori(i,idx,n){
        if(h[i]>0){
          h[i]--;
          if(l==-1){
            l=i;
          }
          r=i;
        }else if(l>=0){
          break;
        }
      }
      if(l==-1||r==-1){
        break;
      }
      ans++;
      idx=r+1;
      l=-1;r=-1;
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
if(c>=a&&c<=b)System.out.println("Yes");
else System.out.println("No");
}}

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


def is_divisor_counter8(num):
    count = 0
    for i in range(1, num+1):
        if num % i == 0:
            count += 1
    return True if count == 8 else False


count = 0
for i in range(1, N+1, 2):
    if is_divisor_counter8(i):
        count += 1
print(count)


Measured memory_bytes: 2940
def main
  k = gets.chomp.to_i
  a,b = gets.chomp.split(/ /).map {|i| i.to_i}

  ma = a/k
  mb = b/k
  isok = false
  (ma .. mb).each {|i|
    n = i*k 
    if n >= a and n <= b
      isok = true
      break
    end
  }
  if isok
    puts "OK"
  else
    puts "NG"
  end

end


main


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

int main() {
  int a,five=0,seven=0;
  
  for (int i = 0 ; i < 3 ; i++) {
  cin >> a;
  if (a == 5) five++;
  if (a == 7) seven++;
  }
  if (five==2 && seven==1) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int num = 0;
		while(n>0)
		{
			int a = sc.nextInt();
			int b = sc.nextInt();
			num +=(b-a+1);
			n--;
		}
		System.out.println(num);
	}

}

Measured memory_bytes: 27856
import bisect

def main():
    N = int(input())
    L = [int(i) for i in input().split()]
    L.sort()
    count = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            k = bisect.bisect_left(L, L[i] + L[j])
            k -= 1
            count += k - j
    print(count)


if __name__ == "__main__":
    main() 


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

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

	cin >> n;
	long long p[n];
	REP(i, 0, n) cin >> p[i];
	sort(p, p + n);
	REP(i, 1, n) ans += p[n-i/2-1];
	cout << ans;
}

Measured memory_bytes: 5196
n,k = map(int,input().split())
count = 0
for i in range(k, n+2):
    min_num = int((i-1) * i /2)
    max_num = int(i*(2*n-i+1)/2)
    count += (max_num - min_num+1)
print(count % (10**9 + 7))

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

void insertionSort(int a[], int n) 
{
	for(int i=1; i<n; i++) {
		int key = a[i];
		int j = i-1;
		while(j>=0 && a[j] > key) {
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = key;
		for(int i=0; i<n; i++) {
			if(i>0)
				cout << " "; 
			cout << a[i];
		}
		cout << endl;
	}
}
int main(){

	int n;
	cin >> n;
	int array[1000];

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

	for(int i=0; i<n; i++) {
		if(i>0)
			cout << " ";
		cout << array[i];
	}
	cout << endl;

	insertionSort(array, n);
}



Measured memory_bytes: 3088
import numpy as np
n,m,x=map(int,input().split())
c=[0]*n
a=[0]*n
for i in range(n):
    ca=list(map(int,input().split()))
    c[i]=ca[0]
    a[i]=ca[1:]

ans=sum(c)+1
for i in range(2**n):
    bag=[]
    money=0
    point=np.zeros(m, dtype=int)
    for j in range(n):
        if ((i>>j) &1):
            bag.append(j)
            money+=c[j]
    for k in range(len(bag)):
        point+=a[bag[k]][:]
    if min(point)>=x:
        ans=min(ans,money)

if ans>sum(c):
    print(-1)
else:
    print(ans)

Measured memory_bytes: 27228
/**********************************************************
* @Author: 			   .Sunbeam
* @Date:   			   2020-03-22 20:19:54
* @Last Modified by:   .Sunbeam
* @Last Modified time: 2020-03-22 20:20:53
* @Remark: 
**********************************************************/
#include <bits/stdc++.h>
#define lowbit(x) (x&(-x))
#define CSE(x,y) memset(x,y,sizeof(x))
#define INF 0x3f3f3f3f
#define Abs(x) (x>=0?x:(-x))
#define FAST ios::sync_with_stdio(false);cin.tie(0);
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll , ll> pll;

const int maxn=1000;

int main()
{
	double l;
	cin>>l;
	double d=l/3.0;
	printf("%.6f\n",d*d*d);
	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (a, b, x): (i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = if a == 0 {
        b / x + 1
    } else {
        b / x - (a - 1) / x
    };

    println!("{}", ans);
}

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

int main() {
  int a, b, h, m;
  cin >> a >> b >> h >> m;
  double hour_angle = 0.5 * (h * 60 + m);
  double minute_angle = 6 * m;
  double angle = abs(hour_angle - minute_angle);
  angle = min(360 - angle, angle);
  double c = sqrt(a * a + b * b - 2 * a * b * cos(angle * M_PI / 180));
  cout << fixed << setprecision(12) << c << endl;
}


Measured memory_bytes: 4220
#include<stdio.h>
#include<string.h>
#define MAX 2000001

int A[MAX],count;

void maxHeapify(int i){

  int large,tmp,left,right;

  left = 2*i;
  right = 2*i+1;

  if(left <= count && A[left] > A[i])large = left;
  else large = i;

  if(right <= count && A[right] > A[large])large = right;

  if(large != i){
    tmp = A[i];
    A[i] = A[large];
    A[large] = tmp;
    maxHeapify(large);
  }
}

int extractMax(){
  int max = A[1];
  A[1] = A[count];
  count--;
  maxHeapify(1);
  return max;
}

void increaseKey(int key){

  int i = count;
  int tmp;
  A[i] = key;
  while(i>1 && A[i/2] < A[i]){
    tmp = A[i];
    A[i] = A[i/2];
    A[i/2] = tmp;
    i = i/2;
  }
}

void insert(int key){

  count += 1;
  A[count] = 0;
  increaseKey(key);

}

int main(){

  int key;
  char com[10];

  while(1){
    scanf("%s",com);
    if(strcmp(com,"insert") == 0){
      scanf("%d",&key);
      insert(key);
    }
    else if(strcmp(com,"extract") == 0)printf("%d\n",extractMax());
    else if(strcmp(com,"end") == 0)break;
  }
  return 0;
}

Measured memory_bytes: 4696
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  if(a*b%2==0)
  {
    cout << "Even" << endl;
  }
  else
  {
    cout << "Odd" << endl;
  }
  return 0;
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	string s;cin >> s;
	int a=0,b=0,sum=0,cnt=0;
	rep(i,n){
		if(s.at(i)=='('){
			a++;
			cnt++;
		}
		else{
			b++;
			if(cnt>0){
				sum++;
				cnt--;
			}
		}
	}
	a-=sum;
	b-=sum;
	rep(i,b){
		s = '(' + s;
	}
	rep(i,a){
		s = s + ')';
	}
	cout << s << endl;
}

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

int main(void) {
  int N, x;
  cin >> N >> x;

  int a[110];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }

  sort(a, a + N);

  int remaining = x;
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (remaining >= a[i]) {
      ans++;
      remaining -= a[i];
    }
  }

  if (a[N - 1] == remaining) {
    ans++;
  }

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

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int std_list[] = new int[3];
		for (int i = 0; i < 3; i++) {
			int int_x = scanner.nextInt();
				std_list[i] = int_x;
		}
		int count = 0;
		for (int i = std_list[0]; i < std_list[1] + 1; i++) {
			if (std_list[2] % i == 0) {
				count++;
			}
		}
		System.out.println(count);
		    //System.out.print(x);
		    //String trimmed = str.trim();
	}
}


Measured memory_bytes: 26336
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL rou(LL a,LL d){if((a*10/d)%10<5)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
LL ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
LL scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}

int main(){
  LL N,M,i,ac=0,wa=0;
  scanf("%lld%lld",&N,&M);
  LL p[M],flag[N+1],WA[N+1];
  char S[M][3];
  FOR(i,0,M)scanf("%lld%s",&p[i],S[i]);
  FOR(i,0,N+1)flag[i]=0,WA[i]=0;
  FOR(i,0,M){
    if(flag[p[i]]==0&&strcmp(S[i],"AC")==0)flag[p[i]]=1,ac++;
    if(flag[p[i]]==0&&strcmp(S[i],"WA")==0)WA[p[i]]++;
  }
  FOR(i,1,N+1){
    if(flag[i]==1)wa+=WA[i];
  }

  printf("%lld %lld\n",ac,wa);
	return 0;
}


Measured memory_bytes: 2816