akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	int H = sc.nextInt();
    	int M = sc.nextInt();
    	double h = 30 * (H + M/60.0);
    	double m = M * 6.0;
    	double k = Math.abs(m - h);
    	double cos = Math.cos(Math.toRadians(k));
    	double a = A*A + B*B - (2*A*B*cos);
    	System.out.println(Math.sqrt(a));
    }
}

Measured memory_bytes: 35992
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif
 
int main(){
	std::string buf;
	std::string str;
	int num = 0;


#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		str += buf;
	}
 
	for(int i = 0; i < str.size(); i++){
		if(str[i] >= '0' && str[i] <= '9'){
			int j = i + 1;
			for(; j < str.size(); j++){
				if(!(str[j] >= '0' && str[j] <= '9')){
					break;
				}
			}
			num += std::stoi(str.substr(i, j - i));
			i = j;
		}
	}

	std::cout << num << std::endl;


#if INPUT_FROM_FILE
	//fclose(fp);
#endif
    return 0;
}


Measured memory_bytes: 3168
n,x = map(int, input().split())

p, a = [1], [1]

for i in range(n):
    p.append(p[i]*2+1)
    a.append(a[i]*2+3)

def f(n,x):
    if x <= 0:
        return 0
    else:
        if n <= 0:
            return min(x, 3)
        else:
            if x > a[n]:
                return p[n] + 1 + f(n-1, x-2-a[n])
            elif x == a[n]:
                return p[n]
            else:
                return f(n-1,x-1)

print(f(n,x))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()
ll d1[4] = {1, -1, 0, 0};
ll d2[4] = {0, 0, 1, -1};

int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, 0, n) cin >> a[i];

    ll itr = 0;
    bool exi = true;
    while(itr < k && exi){
        bool f = false;
        vector<ll> imos(n+1, 0);
        rep(i, 0, n){
            if(a[i] != n) f = true;
            imos[max(0LL, i - a[i])]++;
            imos[min(n, i + a[i] + 1)]--;
        }
        ll acc = 0;
        rep(i, 0, n){
            acc += imos[i];
            a[i] = acc;
        }
        exi = f;
        itr++;
    }

    rep(i, 0, n-1) cout << a[i] << " ";
    cout << a[n-1] << endl;
    return 0;
}

Measured memory_bytes: 6428
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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 long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main() {
  string s;
  cin >> s;
  for (int i=0; i<s.size(); ++i) {
    if (s.substr(i, 2) == "AC") {
      cout << "Yes" << "\n";
      return 0;
    }
  }
  cout << "No" << "\n";
}


Measured memory_bytes: 256
fun main(args: Array<String>) = yorukatsu18d()

fun yorukatsu18d() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val edges = (1..m).map {
        readLine()!!.split(' ').map { it.toInt() - 1 }.let { Edge(it[0], it[1]) }
    }.toSet()

    val answer = edges.count { edge ->
        val other = edges - edge
        val uf = UnionFind(n)
        other.forEach { uf.unite(it.from, it.to) }
        (0 until n).map { uf.root(it) }.distinct().size != 1
    }

    println(answer)
}

private data class Edge(val from: Int, val to: Int)

private class UnionFind(initSize: Int) {
    private val parent = IntArray(initSize) { it }
    private val size = LongArray(initSize) { 1L }

    fun root(x: Int): Int {
        if (x == parent[x]) return x

        val xr = root(parent[x])
        parent[x] = xr
        return xr
    }

    fun unite(x: Int, y: Int) {
        val xr = root(x)
        val yr = root(y)
        if (xr == yr) return

        if (size[xr] >= size[yr]) {
            size[xr] += size[yr]
            parent[yr] = xr
        } else {
            size[yr] += size[xr]
            parent[xr] = yr
        }
    }

    fun isSame(x: Int, y: Int): Boolean = root(x) == root(y)

    fun size(x: Int): Long = size[root(x)]
}



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

int main(){
    int N, W;
    cin >> N >> W;
    
    vector<int> v(N), w(N);
    vector<vector<int>> dp(N+1, vector<int>(W+1));

    for(int i = 0; i < N; i++){
        cin >> v[i] >> w[i];
    }
    
    for(int i = 0; i < N; i++){
        for(int j = 0; j <= W; j++){
            if(j < w[i]) dp[i+1][j] = dp[i][j];
            else dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
        }
    }
    
    cout << dp[N][W] << endl;
    
    return 0;
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  while (true) {
    string s;
    cin >> s;
    if (s[0] == '-') { break; }
    int m;
    cin >> m;
    for (int i = 0; i < m; ++i) {
      int h;
      fscanf(stdin, "%d", &h);
      string t = s.substr(h) + s.substr(0, h);
      s = t;
    }
    fprintf(stdout, "%s\n", s.c_str());
  }
  return 0;
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
vector<int> x = {1,-1,0,0};
vector<int> y = {0,0,-1,1};
int main(){
    ll n,t;
    cin >> n >> t;
    vector<ll> time(n);
    rep(i,0,n){
        cin >> time[i];
    }
    ll finish = 0;
    ll sum=0;
    rep(i,0,n){
        if(finish>time[i]){
            sum += t-(finish-time[i]);
        }else{
            sum += t;
        }
        finish = time[i]+t;
    }
    cout<<sum << endl;
    

  return 0;
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
const long long mod = pow(10, 9) + 7;
const long long INF = 1LL << 60;
template <class T> bool chmin(T& a, T b){if (a > b) {a = b; return true;} return false;}
template <class T> bool chmax(T& a, T b){if (a < b) {a = b; return true;} return false;}
int divCeil(int A, int B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, int B) {return (A + (B - 1)) / B;}
long long divCeil(int A, long long B) {return (A + (B - 1)) / B;}
long long divCeil(long long A, long long B) {return (A + (B - 1)) / B;}

int main()
{
  string S;
  cin >> S;
  int N = S.size();
  
  int ans = 999;
  
  for (int i = 0; i < N - 2; i++)
  {
    int X = stoi(S.substr(i, 3));
    chmin(ans, abs(X - 753));
  }
  
  cout << ans << endl;
}

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

int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s,t;
    cin>>s;
    cin>>t;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 3640
/*********************
*  Author: xuziyuan  * 
*********************/

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair <int,int>
#define fi first
#define se second
#define pb push_back
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

string s;

int main()
{
	cin>>s;
	int ans=0;
	rep(i,s.size()/2) if(s[i]!=s[s.size()-i-1]) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
class LinearLazySegmentTree
	def initialize(a, l = 1, r = a.size)
		@range_min = l
		@range_max = r
		@n = r - l + 1
		@a = 1
		@b = 0
		if l == r
			@sum = a[l-1]
		else
			c = (l + r) / 2
			@left_child = self.class.new(a, l, c)
			@right_child = self.class.new(a, c+1, r)
			@sum = @left_child.sum(l,c) + @right_child.sum(c+1,r)
		end
	end

	attr_reader :range_min, :range_max

	def operate(x, y, a1, b1)
		return 0 if x > y

		if x == @range_min && y == @range_max
			s = @a * @sum + @n * @b
			@a, @b = @a * a1,  (a1 * @b + b1)
			(a1 * s + @n * b1 - s)
		else
			force
			lr = @left_child.range_max
			addition = @left_child.operate(x, lr < y ? lr : y, a1, b1)
			rl = @right_child.range_min
			addition += @right_child.operate(rl > x ? rl : x, y, a1, b1)
			@sum = (@sum + addition)
			addition
		end
	end

	def add(x, y, v)
		operate(x, y, 1, v)
	end

	def sub(x, y, v)
		operate(x, y, 1, -v)
	end

	def mul(x, y, v)
		operate(x, y, v, 0)
	end

	def const(x, y, v)
		operate(x, y, 0, v)
	end

	def force
		if @range_min != @range_max
			@left_child.delegate(@a, @b)
			@right_child.delegate(@a, @b)
		end
		@sum = (@a * @sum + @n * @b)
		@a = 1
		@b = 0
	end

	def delegate(a, b)
		@a = @a * a  
		@b =  (a * @b + b)
	end

	def sum(x, y)
		return 0 if x > y

		if x == @range_min && y == @range_max
			(@a * @sum + @n * @b)
		else
			force
			lr = @left_child.range_max
			sum = @left_child.sum(x, lr < y ? lr : y)
			rl = @right_child.range_min
			sum += @right_child.sum(rl > x ? rl : x, y)
			sum
		end
	end
end

n, m = gets.split.map(&:to_i)
llst = LinearLazySegmentTree.new([0] * (n-1))

route = gets.split.map(&:to_i)
route.each_cons(2){|i, j|
	i, j = j, i if i > j
	llst.add(i, j-1, 1)
}

min_cost = 0
(1..n-1).each{|i|
	a, b, c = gets.split.map(&:to_i)	
	k = llst.sum(i, i)
	min_cost += [a * k, b * k + c].min
}
p min_cost

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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define inf 100000000000010
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

struct CustomCompare
{
    bool operator()(const int& lhs, const int& rhs)
    {
        return lhs < rhs;
    }
};

bool comp(pair<ll, pi>a,pair<ll,pi>b)
{
    if(a.se.fi==b.se.fi)return a.se.se>b.se.se;
    return a.se.fi>b.se.fi;
}

ll builtin_popcount(ll x)
{
    ll cnt = 0;
    for(ll i=60;i>=0;i--)
    {
        if((1LL<<i)&x)cnt++;
    }
    return cnt;
}


int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
string s; cin>>s;
cout<<s.substr(0,3)<<endl;
return 0;
}
/*
50 25
39 99 70 24 49 13 86 43 88 74 45 92 72 71 90 32 19 76 84 46 63 15 87 1 39 58 17 65 99 43 83 29 64 67 100 14 17 100 81 26 45 40 95 94 86 2 89 57 52 91 45
1221 360 459 651 958 584 345 181 536 116 1310 403 669 1044 1281 711 222 280 1255 257 811 409 698 74 838
*/


Measured memory_bytes: 3648
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T, class U>
vector<T> make_v(U size, const T& init){ return vector<T>(static_cast<size_t>(size), init); }

template<class... Ts, class U>
auto make_v(U size, Ts... rest) { return vector<decltype(make_v(rest...))>(static_cast<size_t>(size), make_v(rest...)); }

template<class T> void chmin(T &a, const T &b){ a = (a < b ? a : b); }
template<class T> void chmax(T &a, const T &b){ a = (a > b ? a : b); }

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    auto dp = make_v(n, n+1, 10, (signed char)(-1));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < 10; ++j) {
            dp[i][i+1][j] = 0;
        }
        dp[i][i+1][v[i]] = 1;
    }
    for (int l = 0; l < n; ++l) {
        int r = l;
        while(r < n && v[l] == v[r]) r++;
        for (int i = l+2; i < r; ++i) {
            dp[l][i][0] = dp[l][i][v[l]] =  1;
        }
    }
    auto dfs = [&](int l, int r, int x, auto &&f) -> signed char {
        if(~dp[l][r][x]) return dp[l][r][x];
        if(!x){
            for (int i = l+1; i < r; ++i) {
                for (int j = 0; j < 10; ++j) {
                    if(f(l, i, j, f) && f(i, r, j, f)) return dp[l][r][x] = 1;
                }
            }
        }else {
            for (int i = l+1; i < r; ++i) {
                if(f(l, i, 0, f) && f(i, r, x, f)) return dp[l][r][x] = 1;
                if(f(l, i, x, f) && f(i, r, 0, f)) return dp[l][r][x] = 1;
                if(f(l, i, x, f) && f(i, r, x, f)) return dp[l][r][x] = 1;
            }
        }
        return dp[l][r][x] = 0;
    };
    puts(dfs(0, n, 0, dfs) ? "yes" : "no");
    return 0;
}


Measured memory_bytes: 3788
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
As = [int(x) for x in input().rstrip('\n').split()]
res = [0]*N
for i in range(N,0,-1):
  now = sum(res[i-1::i])%2
  if now!=As[i-1]:
    res[i-1] += 1
print(sum(res))
print(*[x+1 for x in range(N) if res[x]>0])

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

using namespace std;
# define rep(i, a, b) for(int i = a; i < (b); ++i)
# define trav(a, x) for(auto& a : x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n, nRem = 0;
    cin >> n;
    ll x, m;
    ll b, e, times;
    cin >> x >> m;
    map<ll, int> seen;
    seen[x] = 1;
    vector<ll> sum;
    sum.push_back(0);
    sum.push_back(x);
    for (int i = 2; i < m + 5; i++) {
        x = (x * x) % m;
        sum.push_back(sum[i - 1] + x);
        if (seen.find(x) != seen.end()) {
            b = seen[x];
            e = i;
            times = (n - e) / (e - b);
            nRem = (n - e) % (e - b);
            cout << sum[e - 1] + (sum[e - 1] - sum[b - 1]) * times + (sum[b + nRem] - sum[b - 1]);
            return 0;
        }
        seen[x] = i;
        if (i == n) {
            cout << sum[i] << endl;
            return 0;
        }
    }
    return 0;
}

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

int main(){
    int N, i;
    int Alice=0, Bob=0;
    int a[120];
    cin >> N;

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

    sort(a, a + N, greater<int>());

    for (i=0; i<N; i++){
        if(i%2 == 0)
            Alice = Alice + a[i];
        else
            Bob = Bob + a[i];
    }

    cout << Alice - Bob << endl;
   }




Measured memory_bytes: 256
n,m=map(int,input().split())
l=[[] for i in range(n)]
for i in range(m):
    p=[int(j) for j in input().split()]
    l[p[1]-1].append(p[0]-1)

dp=[-1]*n
import sys
sys.setrecursionlimit(10**6)
def f(v):
    if dp[v]!=-1:
        return dp[v]
    p=0
    for i in l[v]:
        p=max(p,f(i)+1)
    dp[v]=p
    return dp[v]

for i in range(n):
    f(i)

print(max(dp))

Measured memory_bytes: 103984
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int a,b,c,A,B,C;
    cin>>a>>b>>c;
    A=a+b;
    B=b+c;
    C=c+a;
    if(A<=B&&A<=C)cout<<A<<endl;
    else if(B<A&&B<C)cout<<B<<endl;
    else if(C<A&&C<B)cout<<C<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int r,D,x_2000,x_2001,x_2002,x_2003,x_2004,x_2005,x_2006,x_2007,x_2008,x_2009,x_2010;
  cin >> r>>D >>x_2000;
  x_2001 = r*x_2000 - D;
  x_2002 = r*x_2001 - D;
  x_2003 = r*x_2002 - D;
  x_2004 = r*x_2003 - D;
  x_2005 = r*x_2004- D;
  x_2006 = r*x_2005- D;
  x_2007 = r*x_2006 - D;
  x_2008 = r*x_2007 - D;
  x_2009 = r*x_2008 - D;
  x_2010 = r*x_2009 - D;
  cout <<x_2001<<endl;
  cout <<x_2002<<endl;
  cout <<x_2003<<endl;
  cout <<x_2004<<endl;
  cout <<x_2005<<endl;
  cout <<x_2006<<endl;
  cout <<x_2007<<endl;
  cout <<x_2008<<endl;
  cout <<x_2009<<endl;
  cout<<x_2010<<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 main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  stack<int> s;
  s.push(7);
  s.push(5);
  s.push(3);

  int ans = 0;
  while(!s.empty()) {
    ll v = s.top(); s.pop();
    if(10*v+7<=n) s.push(10*v+7);
    if(10*v+5<=n) s.push(10*v+5);
    if(10*v+3<=n) s.push(10*v+3);

    vector<int> cnt_753(3, 0);
    for(ll i = v; i > 0; i/=10) {
      if(i%10 == 7) ++cnt_753[0];
      if(i%10 == 5) ++cnt_753[1];
      if(i%10 == 3) ++cnt_753[2];
    }
    ans += (cnt_753[0]>0&&cnt_753[1]>0&&cnt_753[2]>0);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            if (10 <= A || 10 <= B) {
                out.println(-1);
            } else {
                out.println(A * B);
            }
        }

    }
}



Measured memory_bytes: 21588
import collections as C
H,W,K=map(int,input().split())
A=[list(input())for _ in[0]*H]
for i,a in enumerate(A):
	if"S"in a:j=a.index("S");Q=C.deque([(1,i,j)])
d=1e9
while Q:
	c,i,j=Q.popleft();d=min(d,i,j,H-i-1,W-j-1)
	if c>K:continue
	for h,w in((i+1,j),(i,j+1),(i-1,j),(i,j-1)):
		if 0<=h<H and 0<=w<W and A[h][w]==".":A[h][w]="";Q+=[(c+1,h,w)]
print(1--d//K)

Measured memory_bytes: 75356
#include<bits/stdc++.h>
using namespace std;
typedef signed long long ll;
 
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int i,j,k,n,m,l,f,x,y,z; string s;
	int a[6];
	rep(i, 6) cin >> a[i];
	int X[6] = {0};
	rep(i, 6){
		X[a[i]] += 1;
	}

	rep(i, 6){
		if(X[a[i]] == 3){
			cout << "NO" << endl;
			return 0;
		}
	}

	cout << "YES" << endl;
}

Measured memory_bytes: 256
from operator import itemgetter
from itertools import accumulate
import sys
N = int(input())
AB = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
AB.sort(key = itemgetter(1))
A1, B1 = list(map(list, zip(*AB)))
SA = list(accumulate(A1))
if all(a <= b for a, b in zip(SA, B1)):
    print('Yes')
else:
    print('No')        


Measured memory_bytes: 105536
n, k = map(int, input().split())
ans = 0
count = 0

if k == 1:
  print(1)
else:
  for i in range(1, n+1):
    while i < k:
      i *= 2
      count += 1
    ans = ans + 0.5**count/n
    count = 0
  
  print(ans)

Measured memory_bytes: 9224
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return (i for i in range(self.n) if self.find(i) == root)

    def roots(self):
        return (i for i, x in enumerate(self.parents) if x < 0)

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        d = {}
        for i in range(self.n):
            p = self.find(i)
            d[p] = d.get(p, []) + [i]
        return d

    def __str__(self):
        return '\n'.join('{}: {}'.format(k, v) for k, v in self.all_group_members().items())


def resolve():
    import sys
    input = sys.stdin.readline
    n, m = map(int, input().split())
    u = UnionFind(n)
    for _ in range(m):
        a, b = map(int, input().split())
        u.union(a - 1, b - 1)
    ans = 0
    for i in u.roots():
        ans = max(u.size(i), ans)
    print(ans)


if __name__ == '__main__':
    resolve()


Measured memory_bytes: 74144
import java.util.Scanner;

class	Main{
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		int a =  scanner.nextInt();			
		int b =  scanner.nextInt();			
		int c =  scanner.nextInt();			
		hikaku(a,b,c);

	}

	public static void hikaku(int a, int b , int c){
		if(a<b && b<c){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26028
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,M;
  cin>>N>>M;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  sort(A.begin(),A.end());
  vector<pair<int64_t,int>>D(M);
  for(int i=0;i<M;i++){
  int B; int64_t C;
    cin>>B>>C;
    pair<int64_t,int>p(C,B);
    D.at(i)=p;
  }
  sort(D.begin(),D.end());
  reverse(D.begin(),D.end());
  vector<int64_t>R(N,0);
  int m=-1;
  for(int i=0;i<M;i++){
    
    for(int j=m+1;j<=min(m+D.at(i).second,N-1);j++){
     R.at(j)=D.at(i).first;
    }
   m+=D.at(i).second;
     if((N-1)<=m)
       break;
    
    
 }int64_t ans=0;
  for(int i=0;i<N;i++){
   ans+=max(A.at(i),R.at(i));
  }cout<<ans<<endl;
   return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

ll a , b , k;

int main()
{
    cin >> a >> b >> k;
    ll x = a;
    a -= k;
    if(x < k){
        a = 0;
        k -= x;
         b -= k;
    }
    if(b < 0) b = 0;
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
void solve() {
  fore(i, 0, 5) {
    int num;
    cin >> num;
    if (num == 0) {
      cout << i + 1 << '\n';
      return;
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t = 1;
  //cin >> t;
  while (t--) solve();

  return 0;
}

Measured memory_bytes: 3604
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)
    if op=='?' :break
    if op=='+': print(a+b)
    elif op=='-' : print(a-b)
    elif op=='*' : print(a*b)
    elif op=='/' : print(a//b)
    


Measured memory_bytes: 5596
x = {}
for i in range(4):
    for j in range(3):
        for k in range(10):
            i,j,k = str(i), str(j), str(k)
            x[i+j+k] = 0

n = int(input())
for i in range(n):
    i,j,k,l = map(int, input().split())
    key = str(i-1)+str(j-1)+str(k-1)
    x[key] = x[key] + int(l)

for i in range(4):
    for j in range(3):
        for k in range(10):
            i,j,k = str(i), str(j), str(k)
            if k != "9":
                print(" " + str(x[i+j+k]), end='')
            else:
                print(" "+ str(x[i+j+k]))
    if int(i) + 1 < 4:
        print("#"*20)

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main () {
    int H, W; cin >> H >> W;
    vector<string> a(H+2);
    a[0].resize(W, '#');
    a[H+1].resize(W, '#');
    REP(i, 1, H+1) cin >> a[i];
    rep(i, a.size()) cout << '#' << a[i] << '#' << endl;
}

Measured memory_bytes: 256
X, Y = map(int, input().split())

# A[i+1] = 2 * A[i] と構成すればよさげ
# このとき A[0] = X とすれば A[n] = X * pow(2, n-1)

for i in range(100):
    X *= 2
    if X > Y:
        print(i+1)
        exit()


Measured memory_bytes: 2940
#区間スケジューリング
n, m = map(int, input().split())
lst = []
for _ in range(m):
    a, b = map(int, input().split())
    lst.append([a, b])

lst.sort(key=lambda x:x[1])

ans = 0
ed = 0
for _ in lst:
    if _[0] < ed:
      pass
    else:
        ed = _[1]
        ans += 1
print(ans)


Measured memory_bytes: 21340
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] data = new int[N];
		for (int i=0;i<N;i++) {
			data[i] = sc.nextInt();
		}
		int result = 0;
		for(int i=0;i<data.length-1;i++){
			for(int j=data.length-1;j>i;j--){
				if(data[j]<data[j-1]){
					int t=data[j];
					data[j]=data[j-1];
					data[j-1]=t;
				}
			}
		}		
		for (int i=0;i<K;i++) {
			result = result + data[i];
		}
		System.out.println(result);
		sc.close();
	}
}

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

int main ()
{
  int N;
  int p = 0,w = 0,g = 0,y = 0;
  cin >> N;
  
  for(int i = 0;i < N;i++){
    string S;
    cin >> S;
    if(S == "P"){
      p = 1;
    }else if(S == "W"){
      w = 1;
    }else if(S == "G"){
      g = 1; 
    }else if(S == "Y"){
      y = 1;
    }
  }
  
  if(p + w + g + y == 4){
    cout << "Four" << endl;
  }else{
	cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include "bits/stdc++.h"
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

int main(){
    string a,b,c;
    cin>>a>>b>>c;
    
    a=toupper(a.at(0));
    b=toupper(b.at(0));
    c=toupper(c.at(0));
    
    cout<<a<<b<<c<<endl;
    
 }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)
#define pi 3.141592653589793238462643

ll dp[1005][10005];
ll n, h;
ll a[1005], b[1005];

ll f(ll idx, ll health){
    if(health <= 0) return 0;
    if(idx >= n && health > 0) return inf;
    else if(dp[idx][health] != -1) return dp[idx][health];
    else {
        return dp[idx][health] = min(b[idx] + f(idx, health-a[idx]), f(idx+1, health));
    }
}

void solve(){
    cin>>h>>n;
    loop(i,0,n) cin>>a[i]>>b[i];
    loop(i,0,1005){
        loop(j,0,10005){
            dp[i][j] = -1;
        }
    }
    print(f(0, h));

}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
   
}


Measured memory_bytes: 79360
#include <iostream>

using namespace std;
int a[5000], b[5000], c[5000];

int main(){
  int n;
  while(cin >> n && n){
    for(int i = 0; i < n; i++){
      cin >> a[i];
    }

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

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

      c[0] = b[0];
      for(int i = 1; i < n; i++){
	c[i] = min(c[i-1], b[i]);
      }

      int ans = a[0];
      for(int i = 1; i < n; i++){
	ans = max(ans, b[i] - c[i-1]);
	ans = max(ans, b[i]);
      }
      cout << ans << endl;
    }
  }
}

Measured memory_bytes: 3084
import math

n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))

def library_number(x,n):
  l = list(range(1,n+1))
  tmp = 0
  for i in range(n):
    tmp += math.factorial(n-1-i)*l.index(x[i])
    l.remove(x[i])
  return tmp

ans = abs(library_number(p,n) - library_number(q,n))
print(ans)

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

int h, w, K, a[305][305];
int row[305];
char s[305][305];

void solve (int r1, int r2) {
  vector<int> l;
  for (int i = r1; i < r2; ++i) {
    for (int j = 0; j < w; ++j) {
      if (s[i][j] == '#') l.push_back(j);
    }
  }
  for (int i = 0; i < l.size(); ++i) {
    int i1 = 0, i2 = w;
    if (i > 0) i1 = l[i];
    if (i < l.size()-1) i2 = l[i+1];
    for (int j = i1; j < i2; ++j) {
      for (int k = r1; k < r2; ++k) {
        a[k][j] = K;
      }
    }
    --K;
  }
}

int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> h >> w >> K;
  rep(i, h) {
    rep(j, w) {
      cin >> s[i][j];
      if (s[i][j] == '#') row[i]++;
    }
  }
  vector<int> r;
  rep(i, h) if (row[i] >= 1) r.push_back(i);
  rep(i, r.size()) {
    int i1 = 0, i2 = h;
    if (i > 0) i1 = r[i];
    if (i < r.size()-1) i2 = r[i+1];
    solve(i1, i2);
  }
  rep(i, h) {
    rep(j, w) {
      cout << a[i][j] << (j == w-1?'\n':' ');
    }
  }
}

Measured memory_bytes: 1280
N=int(input())
a=list(map(int,input().split()))
x=set(a)
if len(x)==1:
    if 0 in x:
        ans=1
    else:
        ans=0
elif len(x)==2:
    if 0 in x:
        count0=0
        count1=0
        for i in range(len(a)):
            if a[i]==0:
                count0+=1
            else:
                count1+=1
        if count0*2==count1:
            ans=1
        else:
            ans=0
    else:
        ans=0
elif len(x)==3:
    y=list(x)
    t=y[0]^y[1]^y[2]
    if t==0:
        count0=0
        count1=0
        count2=0
        for i in range(len(a)):
            if a[i]==y[0]:
                count0+=1
            elif a[i]==y[1]:
                count1+=1
            else:
                count2+=1
        if count0==count1:
            if count1==count2:
                ans=1
            else:
                ans=0
        else:
            ans=0
    else:
        ans=0
else:
    ans=0
if ans:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 60784
using System;

class test
{
    public static void Main()
    {

        var num = int.Parse(Console.ReadLine());

        var datas = Console.ReadLine().Trim().Split(' ');


        var cnt = 0;

        var flag = true;

        for (var i = 0; i < datas.Length; i++)
        {
            var cunum = int.Parse(datas[i]);

            while(flag==true)
            {
                
                if(cunum%2==0)
                {
                    cunum /= 2;
                    cnt++;
                }
                else
                {
                    flag = false;
                }
            }
            flag = true;
      
        }
        Console.WriteLine(cnt);


    }
}

Measured memory_bytes: 13792
#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

class MaxFlow {
public:
  struct edge { ll to, cap, rev; };

  const ll INF = 1LL << 60;
  ll N;
  vector< vector<edge> > E;
  vector<bool> used;

  MaxFlow(ll n): N(n), E(n), used(n) {};

  void add_directed_edge(ll from, ll to, ll cap) {
    E[from].push_back((edge) { to, cap, (ll) E[to].size() });
    E[to].push_back((edge) { from, 0, (ll) E[from].size() - 1 });
  }

  void add_undirected_edge(ll from, ll to, ll cap) {
    E[from].push_back((edge) { to, cap, (ll) E[to].size() });
    E[to].push_back((edge) { from, cap, (ll) E[from].size() - 1 });
  }

  ll dfs(ll v, ll t, ll f) {
    if(v == t) return f;
    used[v] = true;
    REP(i, 0, E[v].size()) {
      edge &e = E[v][i];
      if(!used[e.to] && e.cap > 0) {
        ll d = dfs(e.to, t, min(f, e.cap));
        if(d > 0) {
          e.cap -= d;
          E[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  ll max_flow(ll s, ll t) {
    ll flow = 0;
    while(1) {
      REP(i, 0, N) used[i] = false;
      ll f = dfs(s, t, INF);
      if(f == 0 || f == INF) break;
      flow += f;
    }
    return flow;
  }
};

int main(void) {
  ll N, M;
  cin >> N >> M;
  MaxFlow mf(N);
  map<ll, ll> edges;
  REP(i, 0, M) {
    ll X, Y;
    cin >> X >> Y;
    X--;
    Y--;
    mf.add_undirected_edge(X, Y, 1);
    edges[X * N + Y] = i;
  }
  ll S, T;
  cin >> S >> T;
  S--;
  T--;

  ll f = mf.max_flow(S, T);
  vector<ll> idx;
  REP(i, 0, N) {
    for(auto e : mf.E[i]) {
      if(edges.count(e.to * N + i) && e.cap == 0) {
        idx.push_back(edges[e.to * N + i]);
      }
    }
  }

  cout << f << endl;
  cout << idx.size() << endl;
  for(auto i : idx) cout << i + 1 << endl;
}



Measured memory_bytes: 3324
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

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

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

signed main() {
    //宣言
    int n, m;
    long double sum = 0;
    cin >> n >> m;
    vector<int> vec(n);
    rep(i, n) {
        cin >> vec[i];
        sum += vec[i];
    }
    sort(vec.rbegin(), vec.rend());
    if (vec[m - 1] >= sum / (4 * m)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3636
import sys

# S = input()
# N, M = map(int, input().split())
# As = [int(input()) for _ in range(N)]
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():
    print(solve())


def solve():
    N, M = map(int, input().split())

    scs = [list(map(int, input().split())) for _ in range(M)]

    answer = '0' * N
    used = []

    for s, c in scs:
        s -= 1

        if s in used and answer[s] != str(c):
            return -1

        used.append(s)

        answer = answer[:s] + str(c) + answer[s+1:]

    if N > 1 and 0 not in used:
        answer = "1" + answer[1:]

    if N > 1 and answer[0] == "0":
        return -1

    return int(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
void main() {
	auto N = ri;
	auto s = rs, t = rs;
	if(s==t) writeln(N);
	else {
		auto tmp = s;
		foreach_reverse(i; 0..N+1) {
			tmp = s ~ t[i..$];
			if(tmp.endsWith(t)) {
				writeln(tmp.length);
				break;
			}
		}
	}
}

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

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(int i = K; i < N; i++)
#define ll long long int
using namespace std;
int main() {
int N, Q;cin >> N >> Q;
string S;cin >> S;
vector<pair<int, int>> range(Q);
vector<int> V;

rep(i, 0, Q)cin >> range[i].first >> range[i].second;

rep(i, 1, N){
if(S[i - 1] == 'A' && S[i] == 'C')V.push_back(i - 1);
}

if(V.empty()){
rep(i, 0, Q)cout << 0 << endl;
exit(0);
}

for(auto x : range){
int l = 0, r  = V.size() - 1;

if(x.second - 1 <= V[0] || x.first - 1 >= V[r] + 1){
cout << 0 << endl;continue;}

    while(V[l] < x.first - 1){
    l++;
    }

    while(V[r] + 1 > x.second - 1){
    r--;
    }

cout <<  r - l + 1 << endl;

}


}

Measured memory_bytes: 4416
while True:
    n = int(input())
    if n == 0: break
    dataset = list(map(int, input().split()))
    dataset.sort()

    minimumDiff = 99999999999999
    for i in range(0,n-1):
        temp = dataset[i+1] - dataset[i]
        if minimumDiff > temp:
            minimumDiff = temp
    print(minimumDiff)



Measured memory_bytes: 5624
using System;
using System.Linq;
using static System.Console;

namespace b {
static class Extensions {
   public static int ToInt(this string str) {
      return int.Parse(str);
   }

   public static int[] readIntArr() {
      return ReadLine().Split(' ').Select(int.Parse).ToArray();
   }
}

class Program {
   public static void Main(string[] args) {
      var n = ReadLine().ToInt();
      var h = Extensions.readIntArr();

      int count = 0;
      for (int i = 0; i < n; i++) {
         bool flag = true;
         for (int j = 0; j < i; j++) {
            if (h[j] > h[i]) {
               flag = false;
               break;
            }
         }

         if (flag) count++;
      }

      WriteLine(count);
   }
}

}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    int res=0;
    int a[n];
    rep(i,n){
        cin>>a[i];
        res ^= a[i];
        a[i] = a[i] & (-a[i]);
    }
    sort(a,a+n,greater<int>());
    int cnt=0;
    rep(i,n){
        if(res&a[i]){
            res ^= a[i];
            res ^= a[i]-1;
            cnt++;
        }
    }
    cout << (res==0 ? cnt : -1) << endl;
    return 0;
}


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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    map<pair<i64, i64>, int> mp;
    vector<pair<i64, i64>> v;
    for(int i=0;i<n;++i){
        i64 x, y;
        cin >> x >> y;
        mp[make_pair(x, y)] = i+1;
        v.emplace_back(x, y);
    }

    set<pair<i64, i64>> dst;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<n;++j){
            int dx = v[i].first-v[j].first, dy = v[i].second-v[j].second;
            if(dx == 0 && dy == 0)continue;
            dst.insert(make_pair(dx, dy));
        }
    }

    int ans = n;
    for(auto d: dst){
        deque<bool> used(n+1, false);
        int cost = 0;
        for(int i=0;i<n;++i){
            if(used[i+1])continue;
            used[i+1] = true;
            cost++;
            i64 x = v[i].first, y = v[i].second;
            int idx = mp[make_pair(x, y)];
            while(idx != 0){
                x += d.first;
                y += d.second;
                idx = mp[make_pair(x, y)];
                if(used[idx])break;
                if(idx != 0){
                    used[idx] = true;
                }
            }
            x = v[i].first; y = v[i].second;
            idx = mp[make_pair(x, y)];
            while(idx != 0){
                x -= d.first;
                y -= d.second;
                idx = mp[make_pair(x, y)];
                if(used[idx])break;
                if(idx != 0){
                    used[idx] = true;
                }
            }
        }
        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4096
N, M = map(int, input().split())
C = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
D = 0
E = 0
for i in range(N):
    if E + C[i][1] >= M:
        D += C[i][0]*(M - E)
        break
    D += C[i][0]*C[i][1]
    E += C[i][1]
print(D)

Measured memory_bytes: 18884
#include<iostream>
#include<set>

using namespace std;

int main() {
	set<int> st;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (st.count(a))st.erase(a);
		else st.insert(a);
	}
	
	cout << st.size() << endl;
}

Measured memory_bytes: 4864
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int):
    a = math.floor(math.sqrt(N))
    mn = N
    for aa in range(1, a+1):
        if N % aa == 0:
            k = math.floor(math.log10(N // aa)) + 1
            mn = min(mn, k)
    print(mn)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5344
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while(true)
int main(){
    int a,b;
    cin >> a >> b;
    int N;
    cin >> N;
    bool t[1002];
    for(int i=0; i<1002; i++){
        t[i] = false;
    }
    for(int i=a; i<b; i++){
        t[i] = true;
    }
    for(int i=0; i<N; i++){
        int s,f;
        cin >> s >> f;
        for(int j=s; j<f; j++){
            if(t[j] == true){
                cout << 1 << endl;
                return 0;
            }
        }
    }
    cout << 0 << endl;
}


Measured memory_bytes: 3092
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;

class Prog
{
    public Prog() { }
    public static int Main()
    {
        new Prog().calc();
        return 0;
    }

    Scanner cin;

    public void calc()
    {
        cin = new Scanner();
        long x = cin.nextLong();

        long ans = (x / 11) * 2;
        if (1 <= x % 11 && x % 11 <= 6) ans += 1;
        else if(7 <= x % 11 && x % 11 <= 10) ans += 2;

        Console.WriteLine(ans);
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Measured memory_bytes: 2648
#include<iostream>
using namespace std;
int main(void){
  int a,b;
  cin >> a;
  int i = 0,flag = 0;
  while(i != 3){
    b = a % 10;
    if(b == 7){
      flag = 1;
      break;
    }
    a /= 10;
    i++;
  }
    if(flag == 0){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
       
}
    


Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
	int n,x,y,b,p,m,d[365],sw,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&x,&y,&b,&p);
		sw=0;
		d[i]=x*b+y*p;
		if(4<b&&1<p){
			d[i]=d[i]*0.8;
			sw=1;
		}
		if(4<b&&sw==0){
			m=x*b+y*2;
			m=m*0.8;
			sw=1;		
			if(m<d[i])
				d[i]=m;
		}
		if(2<p&&sw==0){
			m=x*5+y*p;
			m=m*0.8;
			sw=1;
			if(m<d[i])
				d[i]=m;		
		}
		if(sw==0){
			m=x*5+y*2;
			m=m*0.8;
			if(m<d[i])
				d[i]=m;
		}	
	}
	for(i=0;i<n;i++)
		printf("%d\n",d[i]);
	return 0;
}

Measured memory_bytes: 604