akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include <cmath>
#include <limits>
#include <utility>
#include <map>
#include <iomanip>


#define rep(p,q) for(int i = p;i < q;i++)
#define ll long long

using namespace std;

const int cons = 1e9 + 7;

//A
int main(void) {
	int a, b, t;
	cin >> a >> b >> t;
	cout << b*(t / a) << endl;
}

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

int main()
{
    int x,n;
    cin>>x>>n;
    bool arr[102];
    memset(arr,false,sizeof arr);
    int p;
    for(int i=0;i<n;i++)
    {
        cin>>p;
        arr[p]=true;
    }
    if(n == 0 or arr[x]==false)
    {
        cout<<x<<endl;
        return 0;
    }
    int left = x - 1, right = x + 1;

    while(true)
    {
        if(arr[left]==false)
        {
            cout<<left<<endl;
            return 0;
        }
        else if(arr[right]==false)
        {
            cout<<right<<endl;
            return 0;
        }
        left--;right++;
    }


    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define res(n) resize(n)
#define rev(v) reverse(v.begin(),v.end())
#define sor(v) sort(v.begin(),v.end())
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1000000007;



int main()
{
    int N;
    cin >> N;
    ve<int> a(N);
    in(N,a);
    
    int ans = N;
    int num = 1;
    
    rep(i,N){
        if(a[i] == num){
            num++;
            ans--;
        }
    }
    if(ans == N) out(-1);
    else out(ans);

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    int A[3];
    int temp;
    int N = 3;
    cin>>A[0]>>A[1]>>A[2];
    for(int i = N-1;i > 0;i--){
        for(int j = 0;j < i;j++){
            if(A[j]>A[j+1]){
                temp = A[j+1];
                A[j+1]=A[j];
                A[j]=temp;
            }
        }
    }
    cout<<(A[0]*A[1])/2<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
long long m[100][21];
int main()
{
  int N,n,i,j;
  scanf("%d",&N);
  scanf("%d",&i);
  m[0][i] = 1;
  for(n=1;n<N-1;n++){
    scanf("%d",&i);
    for(j=i;j<=20;j++){
      m[n][j] += m[n-1][j-i];
    }
    for(j=20-i;j>=0;j--){
      m[n][j] += m[n-1][j+i];
    }
  }
  scanf("%d",&i);
  printf("%lld\n", m[N-2][i]);
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
const int maxn = 5e5 + 50;
typedef pair<int, int> P;

int arr[maxn];
int a, b, c, d, e, f, g;
void solve();
int main()
{
	int t = 1;
//	cin >> t;
	for(int i=0; i<t; i++)
	{
		solve();
	}
	return 0;
}

// type below

void solve()
{
	string str; cin >> str;
	int mid = (str.size() - 1) / 2;
	for(int i=0, j = mid - 1; i < j; i ++, j --)
	{
		if(str[i] != str[j])
		{
			cout << "No\n";
			return;
		}
	}
	for(int i=mid + 1, j = str.size() - 1; i < j; i ++, j --)
	{
		if(str[i] != str[j])
		{
			cout << "No\n";
			return;
		}
	}
	for(int i=0, j = str.size() - 1; i < j; i++, j--)
	{
		if(str[i] != str[j])
		{
			cout << "No\n";
			return;
		}
	}
	cout << "Yes\n";
	return;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
int n;
cin>>n;
rep(i,n){
double a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
double x,y,r;
double p,q,s,t;
p=a*a+b*b;
q=c*c+d*d;
s=e*e+f*f;
t=2*(a-e)*(b-d)-2*(b-f)*(a-c);

x=((b-d)*(p-s)-(b-f)*(p-q))/t;
y=((a-e)*(p-q)-(a-c)*(p-s))/t;
r=hypot(x-a,y-b);

printf("%.3f %.3f %.3f\n",x,y,r);
}
}

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

int main(){
	ios::sync_with_stdio(0);
	cout << setprecision(10) << fixed;
	int n, x, y;
	cin >> n >> x >> y;
	vector<int> cnt(n, 0);
	for (int i = 1; i <= n - 1; ++i){
		cnt[i] = n - i;
	}
	for (int i = 1; i <= n - 1; ++i){
		for (int j = 1; j + i <= n; ++j){
			if (abs(x - i) + abs(i + j - y) + 1 < j){
				cnt[j]--;
				cnt[abs(x - i) + abs(i + j - y) + 1]++;
			}

		}
	}
	for (int i = 1; i <= n - 1; ++i){
		cout << cnt[i] << "\n";
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(n); ++i)
#define rep1(i,n) for (int i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;
int main(){
  ll n; cin >> n;
  cout << (n%2==0 ? n : 2*n);
  return 0;
}


Measured memory_bytes: 3572
n=int(input())
MAX_N=n
X = [None] * (MAX_N + 1)
def f(n):
    if n==0:
        return 1
    if n==1:
        return 1
    if X[n]:
        return X[n]
    r=f(n-1)+f(n-2)
    X[n]=r
    return r
    
print(f(n))


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int h1, m1, h2, m2; cin >> h1 >> m1 >> h2 >> m2;
	int k; cin >> k;
	cout << (h2 * 60 + m2 - h1 * 60 - m1 - k) << endl;
	return 0;
}


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

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

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

    int mina = *std::min_element(a.begin(), a.end());
    int maxa = *std::max_element(a.begin(), a.end());

    int cost;
    int min = INT32_MAX;
    for (int i = mina; i <= maxa; i++)
    {
        cost = 0;
        for (int j = 0; j < n; j++) {
            cost += (a[j] - i) * (a[j] - i);
        }

        min = std::min(min, cost);
    }

    std::cout << min << "\n";
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int s = 0;
  rep(i, n) {
    cin >> a[i];
    s += a[i];
  }
  int ans = 0;
  rep(i, n) {
    if(a[i] * 4 * m >= s) {
      ans++;
    }
  }
  if(ans >= m)
    cout << "Yes";
  else
    cout << "No";
}


Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll ceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   ll x[6];
   ll m;
   FOR(i, 0, 6)
   cin >> x[i];
   m = x[1];
   FOR(i, 2, 6)
   m = min(m, x[i]);

   cout << ceil(x[0], m) + 4 << endl;
   return 0;
}


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

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

void Main()
{
  int N, X;
  cin >> N >> X;
  vector<int> x(N);
  rep(i,N){
    cin >> x[i];
  }
  sort(x.begin(), x.end());
  //int mindiff = 2e9;
  //if (N == 1) mindiff = abs(x[0] - X);
  //else {
  //  rep(i,N-1) {
  //    mindiff = min(mindiff, x[i+1]-x[i]);
  //  }
  //}
  int cnt = 0;
  int ans = 1;
  //cout << mindiff << endl;
  int mindiff = abs(x[0] - X);
  //cout << mindiff << endl;
  for(int j = 0; j < N; j++) {
    mindiff = gcd(abs(x[j]-X), mindiff);
  }
  cout << mindiff << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    double l;
    cin>>l;
    double ans=(l/3)*(l/3)*(l/3);
    cout<<SP(25)<<ans;
    
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
const ll MOD=1000000007,INF=1e18;

int L;
int a[200020],dp[200020][5];

signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    cin>>L;
    rep(i,1,200020)rep(j,0,5)dp[i][j]=INF;
    rep(i,0,L){
        cin>>a[i];
        rep(j,0,5){
            if(j==0)dp[i+1][j]=dp[i][0]+a[i];
            if(j==1)dp[i+1][j]=min(dp[i][0]+(a[i]%2)+(a[i]==0)*2,dp[i][1]+(a[i]%2)+(a[i]==0)*2);
            if(j==2)dp[i+1][j]=min({dp[i][0]+(a[i]%2==0),dp[i][1]+(a[i]%2==0),dp[i][2]+(a[i]%2==0)});
            if(j==3)dp[i+1][j]=min({dp[i][0]+(a[i]%2)+(a[i]==0)*2,dp[i][1]+(a[i]%2)+(a[i]==0)*2,dp[i][2]+(a[i]%2)+(a[i]==0)*2,dp[i][3]+(a[i]%2)+(a[i]==0)*2});
            if(j==4)dp[i+1][j]=min({dp[i][0]+a[i],dp[i][1]+a[i],dp[i][2]+a[i],dp[i][3]+a[i],dp[i][4]+a[i]});
        }
    }
    cout<<min({dp[L][0],dp[L][1],dp[L][2],dp[L][3],dp[L][4]})<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			String str = br.readLine();
			int N = Integer.parseInt(str);
			str = br.readLine();
			String[] s = str.split(" ",0);
			int[] ss = new int[N];
			for(int i = 0; i < N;i++) {
				ss[i] = Integer.parseInt(s[i]);
			}
			int total = 0;
			for(int i = 0; i < N;i++) {
				if(ss[ss[i]-1]-1 == i) total++;
			}

			System.out.println(total/2);
//			long max  = 1000000007;
		}catch (Exception e) {
			System.exit(0);
		}
	}

}


Measured memory_bytes: 35852
q, h, s, d = map(int, input().split())
n = int(input())
q = q * 4
h = h * 2

l = min(q, h, s)
if l < d // 2:
    print(n * l)
else:
    if n % 2 == 0:
        print(d * n // 2)
    else:
        print(d * (n // 2) + l)


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

using namespace std;
using ll = long long;

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll k; cin >> k;
  ll a, b; cin >> a >> b;
  string res = "NG";
  FOR(i,a,b+1){
    if(i % k == 0){
      res = "OK";
    }
  }
  cout << res << "\n";
  return 0;
}

Measured memory_bytes: 3652
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class C
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		int N = GetInt();
		double[] v = Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
		Array.Sort(v);

		double ans = v[0];
		for(int i = 1; i < N; i++)
			ans = (ans + v[i]) / 2.0;

		Console.WriteLine($"{ans:F12}");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
}


Measured memory_bytes: 13524
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout<<'\n';
    }
};
template <class Integer>
Integer ceil(Integer x, Integer y)
{
    return (x + y - 1) / y;
}


void prog()
{
    input in;
    output out;

    out(ceil(in.read<int>(), 2));
}

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


Measured memory_bytes: 256
import sys
import io


def main():
    f = sys.stdin.buffer
    n = int(f.readline())
    h = list(map(int, f.readline().split()))
    p0, p1 = 0, abs(h[1] - h[0])
    for i in range(2, n):
        p2 = min(p1 + abs(h[i] - h[i - 1]), p0 + abs(h[i] - h[i - 2]))
        p0 = p1
        p1 = p2
    print(p1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 12332
#include <bits/stdc++.h>
#include <unordered_map>
typedef long long ll;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(ll i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s[3];
    rep(i,0,3) cin >> s[i];
    ll c1 = s[0][0] - 'a';
    ll c2 = s[1][0] - 'a';
    ll c3 = s[2][0] - 'a';
    cout << (char)('A'+c1) << (char)('A'+c2) << (char)('A'+c3) << endl; 
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n, k; readV(n, k);
  int[] a; readC(n, a);

  a[] -= k;
  auto c = new long[](n); c[0] = a[0];
  foreach (i; 1..n) c[i] = c[i-1] + a[i];

  auto nz = 0;
  int[long] za;
  foreach (ci; (c.dup ~ 0).sort().uniq)
    za[ci] = nz++;

  auto d = new int[](n+1); d[0] = za[0];
  foreach (i; 0..n) d[i+1] = za[c[i]];

  auto st = new SegmentTree!int(nz), ans = 0L;
  st[d[n]] = 1;
  foreach_reverse (i; 0..n) {
    ans += st[d[i]..$];
    st[d[i]] = st[d[i]] + 1;
  }

  writeln(ans);
}

class SegmentTree(T, alias pred = "a + b")
{
  import core.bitop, std.functional;
  alias predFun = binaryFun!pred;

  const size_t n, an;
  T[] buf;
  T unit;

  this(size_t n, T unit = T.init)
  {
    this.n = n;
    this.unit = unit;
    an = n == 1 ? 1 : (1 << ((n-1).bsr + 1));
    buf = new T[](an*2);
    if (T.init != unit) buf[] = unit;
  }

  this(T[] init, T unit = T.init)
  {
    this(init.length, unit);
    buf[an..an+n][] = init[];
    foreach_reverse (i; 1..an)
      buf[i] = predFun(buf[i*2], buf[i*2+1]);
  }

  void opIndexAssign(T val, size_t i)
  {
    buf[i += an] = val;
    while (i /= 2)
      buf[i] = predFun(buf[i*2], buf[i*2+1]);
  }

  pure T opSlice(size_t l, size_t r)
  {
    l += an; r += an;
    T r1 = unit, r2 = unit;
    while (l != r) {
      if (l % 2) r1 = predFun(r1, buf[l++]);
      if (r % 2) r2 = predFun(buf[--r], r2);
      l /= 2; r /= 2;
    }
    return predFun(r1, r2);
  }

  pure T opIndex(size_t i) { return buf[i+an]; }
  pure size_t opDollar() { return n; }
}


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

long long solve(int N,int A,vector<vector<vector<long long>>> dp){
  long long sum=0;
  for(int j=1;j<=N;j++){
    sum+=dp.at(N).at(j).at(j*A);
  }
  return sum;
}

int main(){
  int N,A;
  cin >> N >> A;
  vector<int> x(N);
  for(int i=0;i<N;i++){
    cin >> x.at(i);
  }
  vector<vector<vector<long long>>> dp(N+1,vector<vector<long long>> (N+1,vector<long long>(2501)));
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N;j++){
      for(int k=0;k<=2500;k++){
        if(i==0&&j==0&&k==0){
          dp.at(i).at(j).at(k)=1;
        }
        else if(1<=i && k<x.at(i-1)){
          dp.at(i).at(j).at(k)=dp.at(i-1).at(j).at(k);
        }
        else if(1<=i&&1<=j&&x.at(i-1)<=k){
          dp.at(i).at(j).at(k)=dp.at(i-1).at(j).at(k)+dp.at(i-1).at(j-1).at(k-x.at(i-1));
        }
        else{
          dp.at(i).at(j).at(k)=0;
        }
      }
    }
  }
  cout << solve(N,A,dp) << endl;
}

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

using Weight = int;
struct Edge {
	int src, dst; Weight weight;
	Edge() {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;

struct UnionFind {
	vector<int> par;
	int cnt;
	UnionFind(int size_) : par(size_, -1), cnt(size_) {}
	void unite(int x, int y) {
		if((x = find(x)) != (y = find(y))) {
			if(par[y] < par[x]) swap(x, y);
			par[x] += par[y]; par[y] = x; cnt--;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
	int size(int x) { return -par[find(x)]; }
	int size() { return cnt; }
};

bool operator < (const Edge &e, const Edge &f) { return e.weight < f.weight; }
pair<Weight, Edges> kruskal(int N, Edges es) {
	UnionFind uf(N);
	Weight total = 0; Edges T;
	for(auto &e : es) if(!uf.same(e.src, e.dst)) {
		T.push_back(e); total += e.weight; uf.unite(e.src, e.dst);
	}
	return make_pair(total, T);
}

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

	int n, m;
	while(cin >> n >> m, n + m) {
		Edges es;
		for(int i = 0; i < m; i++) {
			int a, b, c;
			cin >> a >> b >> c;
			es.push_back({ a, b, c });
		}
		sort(es.begin(), es.end());
		auto res = kruskal(n, es);
		cout << res.first << endl;
	}
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d >> e >> f;
  vector<double>l;
  rep(i,f/(100*a)+1)rep(j,f/(100*b)+1){
    if(i==0&&j==0)continue;
    if(i*a*100+b*j*100<f)l.push_back(i*a*100+b*j*100);
  }
  vector<double> s;
  rep(i,f/c)rep(j,f/d){
    if(i*c+j*d<f)s.push_back(i*c+j*d);
  }
  int ans_l;
  int ans_s;
  double ans_c=-1;
  //rep(i,l.size())cout << l[i] << endl;
  //rep(j,s.size())cout << s[j] << endl;
  rep(i,l.size())rep(j,s.size()){
    if(l[i]+s[j]<=f&&l[i]/100*e>=s[j]){
      //cout << s[j] << " " << l[i] << endl;
      double c = s[j]/(s[j]+l[i]);
      if(chmax(ans_c,c))ans_s=s[j],ans_l=l[i];
    }
  }
  cout << ans_s+ans_l << " " << ans_s << endl;
}


Measured memory_bytes: 2420
open Batteries

let _ = read_int ()
let xs = read_line ()
  |> String.split_on_char ' '
  |> List.map int_of_string
  |> List.sort compare;;

(List.nth xs (List.length xs - 1)) - List.nth xs 0
  |> string_of_int
  |> print_endline

Measured memory_bytes: 1152
#include <bits/stdc++.h>
//#define int long long int
using namespace std;
typedef long long int ll;
int arr[10000];
int main()
{
	int N, X, Y;
	cin >> N >> X >> Y;
	for (int i = 1; i <= N; i++)
	{
		for (int j = i + 1; j <= N; j++)
		{

			arr[min(j - i, abs(X - i) + abs(j - Y) + 1)]++;

			// 	arr[j-Y+1+X-i]++;
			// }
			// else if(j>=Y)
			// {
			// 	arr[min(j-i,i-X+1)]++;
			// }
			// else
			// {
			// 	arr[j-i]++;
			// }
		}
	}
	for (int i = 1; i <= N - 1; i++)
	{
		cout << arr[i] << endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
using namespace std;
int main(){
  int n,i,j;
  int num[50000]={1,1,0};
 
  for(i=3;i<50000;i+=2){
    if(num[i]==1)
      continue;
    for(j=3*i;j<50000;j+=i*2)
      num[j]=1;
  }
  for(i=4;i<50000;i+=2)
      num[i]=1;
 
 int in;
 while(cin>>in,in){
 int co=0;
 loop(k,2,in/2+1)if(!(num[k]||num[in-k]))co++;
 cout<<co<<endl;
}
}

Measured memory_bytes: 1360
#include <cstdio>
using namespace std;
typedef long long ll;
double S(ll n){
	ll t=n;
	int sum=0;
	for(;n;n/=10) sum+=n%10;
	return 1.0*t/sum;
}
int main(){
	ll n;
	scanf("%lld",&n);
	ll cur=0,delta=1;
	while(n--){
		for(;;delta*=10)
			if(S(cur+delta)<=S(cur+delta*10))
				break;
		cur+=delta;
		printf("%lld\n",cur);
	}
	return 0;
}


Measured memory_bytes: 128
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let vec = line.split(' ').collect::<Vec<&str>>();
    let a = vec[0].trim().parse::<i32>().unwrap();
    let b = vec[1].trim().parse::<i32>().unwrap();
    let c = vec[2].trim().parse::<i32>().unwrap();
    let ans = a * 100 + b * 10 + c;
    if ans % 4 == 0 {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

template <typename T>
T gcd(T a, T b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}

int main() {
  ll n, X;
  cin >> n >> X;

  vector<ll> x(n + 1);
  for (int i = 0; i < n; i++) cin >> x[i];
  x[n] = X;

  sort(x.begin(), x.end());
  set<ll> s;
  for (int i = 0; i < n; i++) s.insert(x[i + 1] - x[i]);

  ll ans = *s.begin();
  for (auto itr = s.begin(); itr != s.end(); itr++) {
    ans = gcd(*itr, ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3984
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
import statistics
from statistics import mean, median,variance,stdev
import math

def main():
	N, M, X = map(int, input().split(" "))
	A = input().split(" ")
	A = [int(s) for s in A]
	
	p = bisect_left(A,X)
	
	aa = len(A)-p
	bb = p
	
	print(min(aa,bb))
	
if __name__ == "__main__":
	main()


Measured memory_bytes: 13484
a, b, k = map(int, input().split())
aa = a
bb = b
for i in range(k):
    if i % 2 == 0:
        if aa % 2 == 1:
            aa -= 1
            aa //= 2
            bb += aa
        else:
            aa //= 2
            bb += aa
    else:
        if bb % 2 == 1:
            bb -= 1
            bb //= 2
            aa += bb
        else:
            bb //= 2
            aa += bb
print(aa, bb)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
using namespace std;
#define ll long long

string s;
ll dis;
ll k = 0;

int main() {
	cin >> s;

	for (ll i = 0; i < s.size(); i++)
	{
		if (s[i] == 'W') {
			dis += i;
			dis -= k;
			k++;
		}

	}

	cout << dis << endl;
	return 0;
}

Measured memory_bytes: 640
from queue import deque
s = deque([i for i in input()])
Q = int(input())
 
f = 0
 
for _ in range(Q):
    q = input()
    if int(q[0]) == 1:
        f = abs(f-1)
        continue
    
    _, F, c = q.split()
    if f+int(F) % 2 == 1:
        s.appendleft(c)
    else:
        s.append(c)
        
if f:
    print(''.join(reversed(s)))
else:
    print(''.join(s))

Measured memory_bytes: 9064
#include <stdio.h>

int p[1001], N, K, count=0, suc=0;  // N : ball , K : paint

void f(int s, int c){
    int i;

    p[c] = s;

    if(c == N) {
//        for(i=1; i<=N; i++) printf("%d ", p[i]);
//        printf("\n");
        count++;
        return;
    }

    for(i=1; i<=K; i++){
        if(!suc && s != i) f(i, c+1);
    }

    suc=1;

}

int main(){
    int p[1001]={0}, i, j, tot=1;

    scanf("%d %d", &N, &K);

//    for(i=1; i<=K; i++){
        f(1, 1);
//    }

    for(i=0; i<N-1; i++) tot *= count;

    printf("%d", tot * K);

    return 0;
}

Measured memory_bytes: 128
n = int(input())

time = [0]+list(map(int,input().split()))+[0]
v = [0] + list(map(int,input().split()))+[0]

lines = []
t = 0
lines.append((-1,0,0))
for i in range(1,n+1):
    lines.append((t,t+time[i],v[i]))
    t+=time[i]
lines.append((t,t+1,0))
def f(x):
    speed = 10**18
    for x1,x2,vv in lines:
        if x<x1:
            speed = min(speed,vv+x1-x)
        elif x>x2:
            speed = min(speed,vv+x-x2)
        else:
            speed = min(speed,vv)
    return speed
dp = [0]*(2*t)
for i in range(2*t):
    dp[i] = f(i/2)
dp.append(0)
res = 0
res = sum(dp)*2-dp[0]-dp[-1]
print(res*0.25)


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

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    int L = A + B;
    int R = C + D;
    if (L > R){
        cout << "Left" << endl;
    }
    else if (L == R){
        cout << "Balanced" << endl;
    }
    else {
        cout << "Right" << endl;
    }
}

Measured memory_bytes: 256
using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static int[] dist;
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        dist = new int[n];
        var x = int.Parse(line[1]) - 1;
        var y = int.Parse(line[2]) - 1;
        var p = new List<int>[n];
        for (int i = 0; i < n; i++) p[i] = new List<int>();
        for (int i = 0; i < n - 1; i++)
        {
            p[i].Add(i + 1);
            p[i + 1].Add(i);
        }
        p[n - 1].Add(n - 2);
        p[x].Add(y);
        p[y].Add(x);
        for (int i = 0; i < n; i++) goBfs(p, n, i);
        var ans = new int[n -1];
        for (int i = 1; i < n; i++)
            ans[i - 1] = dist[i] / 2;
        Console.WriteLine(string.Join("\n",ans));
    }
    static void goBfs(List<int>[] p, int n, int s)
    {
        var q = new Queue<int>();
        q.Enqueue(s);
        var visited = new bool[n];
        visited[s] = true;
        var d = new int[n];
        d[s] = 0;
        while (q.Count() > 0)
        {
            var w = q.Dequeue();
            foreach (var x in p[w])
            {
                if (!visited[x])
                {
                    q.Enqueue(x);
                    visited[x] = true;
                    d[x] = d[w] + 1;
                    dist[d[x] ]++;
                }
            }
        }
    }
}


Measured memory_bytes: 35548
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int d,n;
  cin>>d>>n;
  if(d==0){
    if(n==100){
      cout<<"101"<<endl;
    }
    else{
      cout<<n<<endl;
    }
  }
  else if(d==1){
    if(n==100){
      cout<<"10100"<<endl;
    }
    else{
      cout<<100*n<<endl;
    }
  }
  else{
    if(n==100){
      cout<<"1010000"<<endl;
    }
    else{
      cout<<10000*n<<endl;
    }
  }

}


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

int main(){
  ll N,K=0,t=0;
  cin >> N;
  vector<vector<P>> A(N,vector<P>(0));
  vector<ll> C(N-1,0);
  queue<P> Q;
  rep(i,N-1){
    ll a,b;
    cin >> a >> b;
    A.at(a-1).push_back(P(i,b-1));
    A.at(b-1).push_back(P(i,a-1));
  }
  rep(i,N){
    if(A.at(i).size()>K){
      K=A.at(i).size();
      t=i;
    }
  }
  Q.push(P(t,0));
  while(!Q.empty()){
    P q=Q.front();
    ll l=0;
    Q.pop();
    rep(i,A.at(q.first).size()){
      if(i+1+l==q.second){
        l++;
      }
      if(C.at(A.at(q.first).at(i).first)!=0){
        l--;
        continue;
      }
      C.at(A.at(q.first).at(i).first)=i+1+l;
      Q.push(P(A.at(q.first).at(i).second,i+1+l));
    }
  }
  cout << K << endl;
  rep(i,N-1){
    cout << C.at(i) << endl;
  }
        
    
  
}


Measured memory_bytes: 8960
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(A) < sum(B):
    print(-1)
    exit()
BA = sorted(i - j for i, j in zip(A, B))

not_enough = 0
ans = 0
for ba in BA:
    if ba < 0:
        not_enough += ba
        ans += 1
    else:
        break
for ba in BA[::-1]:
    if not_enough >= 0:
        break
    not_enough += ba
    ans += 1
print(ans)


Measured memory_bytes: 19536
#include<bits/stdc++.h>
using namespace std;
int main()
{long long a,b,n;
  cin>>a>>b>>n;

 if(a>=b)
  {   if(b>n)
      cout<<floor(a*n/b)-a*floor(n/b);
      else
          cout<<floor(a*(b-1)/b)-a*floor((b-1)/b);
  exit(0);}
  else if(a<b&&b>=n)
      cout<<floor(a*(n-1)/b)-a*floor((n-1)/b);
  else
      cout<<floor(a*(b-1)/b)-a*floor((b-1)/b);
}

Measured memory_bytes: 3740
#include <stdio.h>
int findSumOfDigits(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main() {
    int N,A,B;
    scanf("%d%d%d",&N,&A,&B);
    int total = 0;
    for (int i = 1; i <= N; ++i) {
        int sum = findSumOfDigits(i);
        if (sum >= A && sum <= B) { 
            total += i;
        }
    }
    printf("%d\n",total);
    return 0;
}


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

int main () {
	int n, c; cin >> n >> c;
	int colors[c][c];
	for (int i = 0; i < c; i++)
		for (int j = 0; j < c; j++)
			cin >> colors[i][j];
	int grid[3][c]; memset(grid, 0, sizeof grid);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++) {
			int tmp; cin >> tmp; grid[(i+j)%3][tmp-1]++;
		}
	int ans = 250000001;
	// literally just try everything
	// O(c^4)
	for (int i = 0; i < c; i++)
		for (int j = 0; j < c; j++)
			if (i != j)
				for (int k = 0; k < c; k++)
					if (i != k and j != k) {
						int temp = 0;
						for (int x = 0; x < c; x++) temp += grid[0][x]*colors[x][i];
						for (int x = 0; x < c; x++) temp += grid[1][x]*colors[x][j];
						for (int x = 0; x < c; x++) temp += grid[2][x]*colors[x][k];
						ans = min(ans, temp);
					}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,k;
	vector<int>v;
	cin >> n >> k;
	int num;
	for (int i = 0; i < n; i++) {
		cin >> num;
		v.push_back(num);
	}	
	sort(v.begin(),v.end());
	int ans = 0;
	for (int i = 0; i <k; i++)
		ans += v[i];
	cout << ans;
	return 0;
}

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

int main(){
  int64_t n;
  cin >> n;
  vector<int64_t> a(n);
  vector<int64_t> psum(n+1);
  psum.at(0) = 0;
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(i == 0){
      psum.at(1) = a.at(0);
    }else{
      psum.at(i+1) = psum.at(i) + a.at(i);
    }
  }
  /*
  for(int i=0;i<n+1;i++){
    cout << psum.at(i) << ",";
  }
  cout << endl;
  */
  sort(psum.begin(),psum.end());
  /*
  for(int i=0;i<n+1;i++){
    cout << psum.at(i) << ",";
  }
  cout << endl;
  */
  vector<int64_t> samenums(n+1);
  samenums.at(0) = 1;
  int64_t cnt = 0;
  for(int i=1;i<n+1;i++){
    if(psum.at(i-1) == psum.at(i)){
      samenums.at(cnt)++;
    }else{
      cnt++;
      samenums.at(cnt)++;
    }
  }
  /*
  for(int i=0;i<n+1;i++){
    cout << samenums.at(i) << ",";
  }
  cout << endl;
  */
  int64_t S = 0;
  for(int i=0;i<n;i++){
    int64_t p = samenums.at(i);
    S += (p*(p-1))/2;
  }
  cout << S << endl;
}
    
      
  

Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

/* --------------------------------------- */

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, q;
	cin >> n >> q;
	REP(i,q) {
		ll v, w;
		cin >> v >> w;
		if(n == 1) {
			cout << min(v, w) << endl;
			continue;
		}
		v--;
		w--;
		while(1) {
			if(v == w) {
				cout << v + 1 << endl;
				break;
			}
			if(v > w) v = (v - 1) / n;
			else w = (w - 1) / n;
		}
	}
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f first
#define s second
#define maxsize 1000005
using namespace std;
int mp[200005];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    for (int i=1;i<n;i++){
        int a;
        cin>>a;
        mp[a]++;
    }
    for (int i=1;i<=n;i++)
        cout<<mp[i]<<endl;
}

Measured memory_bytes: 4392
/*
ID: 5ak0
PROG:
LANG: C++11
*/

#include <bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define mpr make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 7, MAXN = 1e5 + 10;

int n, a[MAXN], b[MAXN], p[MAXN];

int main(){
    #ifndef SAKO
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    #endif // SAKO
    ios_base::sync_with_stdio(0);

    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> p[i];
    for (int i = 1; i <= n; ++i)
        a[i] = 1ll * i * 20003, b[i] = 1ll * (n - i + 1) * 20003;
	for (int i = 1; i <= n; ++i)
        a[p[i]] += i, b[p[i]] += i;
    for (int i = 1; i <= n; ++i)
        cout << a[i] << " ";
    cout << "\n";
    for  (int i = 1; i <= n; ++i)
        cout << b[i] << " ";
    return 0;
}


Measured memory_bytes: 896
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
signed main(){
  init_io();
  ll x;
  cin >> x;
  if(x>=30){
    cout <<"Yes\n";
  }else{
    cout <<"No\n";
  }
}


Measured memory_bytes: 3608
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
inline char nc()
{
    // return getchar();
    static char buf[100000],*l=buf,*r=buf;
    return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x)
{
    x=0; int f=1,ch=nc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
    while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
    x*=f;
}
template<class T> inline bool Cmin(T &x,T y) {return x>y?x=y,1:0;}
typedef long long ll;
const ll INF=1e18;
const int inf=1e9;
const int maxn=5000+50;
int n,A,B;
int p[maxn];
ll f[maxn];
int main()
{
    read(n),read(A),read(B);
    for(int i=1;i<=n;++i)
    {
        read(p[i]);
    }
    ++n; p[n]=n;
    for(int i=1;i<=n;++i) f[i]=INF;
    for(int i=0;i<n;++i)
    {
        ll cost=0; int mn=inf;
        for(int j=i+1;j<=n;++j)
        {
            if(p[j]<p[i])
            {
                cost+=B;
            }
            else
            {
                if(p[j]<mn) 
                {
                    Cmin(f[j],f[i]+cost);
                    mn=p[j];
                }
                cost+=A;
            }
        }
    }
    printf("%lld\n",f[n]);
    return 0;
}

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

#define ll long long

int main(){

    int N;
    int i,j,k;
    ll count = 0;
    
    cin >> N;

    vector<int> a(N);

    for(i=0;i<N;i++){
        cin >> a.at(i);
        if(a.at(i) % 2 == 0){
            while(a.at(i) % 2 == 0){
                a.at(i) /= 2;
                count ++;
            }
        }
    }

    cout << count << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, B;
   cin >> N >> A ;
  B = N - (N/500)*500 ;//
 if ( A >= B ){
   cout << "Yes" << endl;
 }
  else{
    cout << "No" << endl;
  }
  }

Measured memory_bytes: 3608
//Keep working hard :)
#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const int N = 1e5+5;
int a[N];

void fileIO()
{
        #ifndef ONLINE_JUDGE
        freopen("int.txt","r",stdin);
        freopen("out.txt","w",stdout);
        #endif
}
int main()
{
	IOS;
        //fileIO();
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	int x = c-a;int y = d-b;
	for(int i = 0;i < y;i++)cout << 'U';
	for(int j = 0; j < x; j++)cout << 'R';
	for(int i = 0;i < y;i++)cout << 'D';
	for(int i = 0;i < x+1;i++)cout << 'L';
	for(int i = 0; i < y+1;i++)cout << 'U';
	for(int j = 0; j < x+1; j++)cout << 'R';
	cout << "DR";
	for(int i = 0; i < y+1;i++)cout <<'D';
	for(int i = 0; i < x+1;i++)cout <<'L';
	cout <<'U';
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,i;
  scanf("%d%d",&a,&b);
  if(a>b)
    for(i=0;i<a;i++)
      printf("%d",b);
  else
    for(i=0;i<b;i++)
      printf("%d",a);
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define mod 1000000007
#define inf 9999999999999999ll
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vi a(n);
    vi numdiv(n,0);
    for(ll i=0;i<n;i++)
        cin>>a[i];
    for(ll i=0;i<n;i++)
        a[i]/=2;
    for(ll i=0;i<n;i++)
    {
        ll x=a[i];
        while(x%2==0)
        {
            numdiv[i]++;
            x/=2;
        }
    }
    bool possible=true;
    sort(numdiv.begin(),numdiv.end());
    if(numdiv.back()!=numdiv[0])
        possible=false;
    if(possible)
    {
        ll g=a[0];
        ll pro=a[0];
        for(ll i=1;i<n;i++)
        {
            ll x=g;
            ll y=a[i];
            g=gcd(pro,y);
            ll lcm=(pro*y)/g;
            pro=lcm;
            if(pro>m*g)
                break;
        }
        ll total=(m)/pro;
        total=(total+1)/2;
        cout<<total<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
    //2i*p + i ==X
    /*set <ll> s;
    for(ll i=0;i<n;i++)
        s.insert(a[i]);
    ll g=0;
    for(ll i=0;i<n;i++)
    {
        g=gcd(g,a[i]);
    }
    ll pro=1;
    for(auto &i:s)
    {
        pro*=i;
        if(pro>m*g)
            break;
    }
    ll total=m*g/(pro);
    total=ceil((lf)total/2.0);
    cout<<total<<endl;*/
}


Measured memory_bytes: 1792
/*
[abc128] F - Frog Jump
*/

#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 1e5;

int N;
int s[MAX_N];
int used[MAX_N];

ll solve() {
    ll ans = 0;
    for (int d = 1; d < N - 1; d++) {
        ll t = 0;
        for (int k = 0; d < N - 1 - k * d; k++) {
            used[k * d] = d;
            if (used[N - 1 - k * d] >= d) {
                break;
            }
            t += s[k * d] + s[N - 1 - k * d];
            ans = max(ans, t);
        }
    }

    return ans;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <class T>
using max_priority_queue = priority_queue<T>;
template <class T>
using min_priority_queue = priority_queue<T, std::vector<T>, std::greater<T>>;

const int INF = 1 << 29;
const ll LL_INF = 1LL << 60;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int N, X;
const int MAX_N = 210;
const int MAX_SX = 100010;
ll dp[MAX_N][MAX_SX];
ll factor[MAX_N];
vector<int> S;
ll result;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> X;
    S.resize(N);
    for (auto &val : S)
    {
        cin >> val;
    }
    sort(S.rbegin(), S.rend());
    factor[0] = 1;
    for (int i = 1; i < MAX_N; i++)
    {
        factor[i] = factor[i - 1] * i;
        factor[i] %= MOD;
    }
    dp[0][X] = 1;
    for (int i = 0; i < N; i++)
    {
        const int y = S[i];
        for (int j = 0; j <= X; j++)
        {
            if (dp[i][j] == 0)
            {
                continue;
            }
            dp[i + 1][j % y] += dp[i][j];
            dp[i + 1][j % y] %= MOD;
            if (i != N - 1)
            {
                dp[i + 1][j] += dp[i][j] * (N - i - 1);
                dp[i + 1][j] %= MOD;
            }
        }
    }
    for (int i = 0; i < MAX_SX; i++)
    {
        result += (ll)i * dp[N][i];
        result %= MOD;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 155904
kosuu = gets.to_i
kati_ary = gets.split(' ').map(&:to_f).sort


(kosuu-1).times {
result = 0
result += (kati_ary[0] + kati_ary[1]) / 2
kati_ary.shift(2) if kati_ary.length > 0
kati_ary.unshift(result)
}

puts kati_ary[0]

Measured memory_bytes: 1788
import sys

d = {'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}

for s in sys.stdin.read().rstrip().split('\n'):
    r = 0
    for i in range(len(s)):
        r += d[s[i]]
        if i > 0 and (d[s[i]] > d[s[i-1]]):
            r -= d[s[i-1]]*2
    print r

Measured memory_bytes: 4236
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(int i=vv;i<n;i++)
#define FORR(i,n,vv) for(int i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)


int main(){



    FAST
//	PRECISE

ll a,b,c,k;
cin>>a>>b>>c>>k;
ll i=0;
while(b<=a&&k>0){
	k--;
	b*=2;
}
while(c<=b&&k>0){
	k--;
	c*=2;
}

if(a<b&&b<c)cout<<"Yes";
else cout<<"No";

return 0;
 }
 

Measured memory_bytes: 3632